修复上料问题

uat-temp-nht-2506120000-jialiao
jason 4 weeks ago
parent a90b8d16c3
commit 2c07545ad5

@ -8,7 +8,7 @@ public interface IMesContainerSnBindService {
MesContainerSnBindModel doScanContainer(MesContainerSnBindModel model);
@ApiOperation("扫描零件条码")
MesContainerSnBindModel doScanBarcode(MesContainerSnBindModel model);
MesContainerSnBindModel doScanBarcode(MesContainerSnBindModel model, boolean bStep);
@ApiOperation("清空")
MesContainerSnBindModel doClear(MesContainerSnBindModel model);

@ -58,7 +58,7 @@ public class MesContainerSnBindController {
MesPcnException.throwMesBusiException("需要选择零件号");
}
}
model = containerSnBindService.doScanBarcode(model);
model = containerSnBindService.doScanBarcode(model, false);
return ResultBean.success("扫描成功").setResultObject(model);
} catch (ImppBusiException imppException) {
return ResultBean.fail(imppException);

@ -241,7 +241,6 @@ public class MesPackageContainerSnServiceImpl implements IMesPackageContainerSnS
masterContainerPackage.setOrganizeCode(masterContainerSn.getOrganizeCode());
masterContainerPackage.setContainerSn(masterContainerSn.getContainerSn());
masterContainerPackage.setPackageStatus(10);
masterContainerPackage.setQty(0);
ConvertBean.serviceModelInitialize(masterContainerPackage, userName);
containerPackageRepository.save(masterContainerPackage);
return masterContainerPackage;

@ -50,6 +50,8 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
@Autowired
private MesNumberRuleMatchRegularExpressionService matchRegularService;
@Autowired
private MesContainerSnStationRepository containerSnStationRDao;
@Autowired
private EntityManager entityManager;
private MesContainerPackage getContainerPackage(MesContainerSnBindModel model, MesContainerSn containerSn) {
@ -66,15 +68,6 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
return packageDetails;
}
private int getContainerPackageDetailCount(MesContainerSnBindModel model, MesContainerSn containerSn) {
List<MesContainerPackageDetail> bottomPackageDetails = new ArrayList<>();
getBottomPackageDetails(model.getOrganizeCode(), containerSn.getContainerSn(), bottomPackageDetails);
return bottomPackageDetails.size();
// return containerPackageDetailRDao.findByPropertyCount(
// new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
// new Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn.getContainerSn()});
}
private List<MesContainerPartsModel> getContainerParts(String organizeCode, String containerTypeCode, String containerSn) {
List<MesContainerPartsModel> result = new ArrayList<>();
Set<String> partNoSet = new HashSet<>();
@ -256,14 +249,20 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
return containerSn;
}
private Boolean getBottomPackageDetails(String organizeCode, String containerSn, List<MesContainerPackageDetail> bottomPackageDetails) {
List<MesContainerPackageDetail> packageDetailList = containerPackageDetailRDao.findByProperty(new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_VALID, MesConstWords.IS_DELETED, "containerSn"},
new Object[]{organizeCode, CommonEnumUtil.IS_VAILD.VAILD.getValue(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), containerSn});
private Boolean getBottomPackageDetails(String organizeCode, MesContainerPackage containerPackage, List<MesContainerPackageDetail> bottomPackageDetails) {
if (containerPackage == null) {
return true;
}
List<MesContainerPackageDetail> packageDetailList = containerPackageDetailRDao.findByProperty(new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_VALID, MesConstWords.IS_DELETED, "pid"},
new Object[]{organizeCode, CommonEnumUtil.IS_VAILD.VAILD.getValue(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), containerPackage.getId()});
if (CollectionUtils.isEmpty(packageDetailList)) {
return true;
}
for (MesContainerPackageDetail packageDetail : packageDetailList) {
if (getBottomPackageDetails(organizeCode, packageDetail.getBarCode(), bottomPackageDetails)) {
MesContainerPackage childContainerPackage = containerPackageRDao.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), packageDetail.getBarCode()});
if (childContainerPackage == null || getBottomPackageDetails(organizeCode, childContainerPackage, bottomPackageDetails)) {
bottomPackageDetails.add(packageDetail);
}
}
@ -271,6 +270,11 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
return false;
}
/**
*
* @param organizeCode
* @param barcode /
*/
private List<MesContainerPackageDetail> checkContainerBarcode(String organizeCode, String barcode, List<MesContainerPackageDetail> oldPackageDetails) {
MesContainerPackage containerPackage = containerPackageRDao.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
@ -278,16 +282,9 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
if (containerPackage == null || !Objects.equals(containerPackage.getPackageStatus(),MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_20.getValue())) {
MesPcnException.throwMesBusiException("容器条码【%s】未关箱不能进行上料操作", barcode);
}
MesContainerPackageDetail bindDetail = containerPackageDetailRDao.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "barCode"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), barcode}
);
if (bindDetail != null) {
MesPcnException.throwMesBusiException("容器条码【%s】被容器【%s】绑定不能进行上料操作", barcode, bindDetail.getContainerSn());
}
List<MesContainerPackageDetail> bottomPackageDetails = new ArrayList<>();
getBottomPackageDetails(organizeCode, barcode, bottomPackageDetails);
getBottomPackageDetails(organizeCode, containerPackage, bottomPackageDetails);
if (CollectionUtils.isEmpty(bottomPackageDetails)) {
return new ArrayList<>();
}
@ -314,8 +311,54 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
return bottomPackageDetails;
}
/**
*
*
* @param organizeCode
* @param containerSn
* @param bStep
* @param username
*/
private void autoOpenContainerSn(String organizeCode, String containerSn, boolean bStep, String username) {
MesContainerPackage containerPackage = containerPackageRDao.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn});
if (containerPackage == null) {
return;
}
List<MesContainerPackageDetail> bottomPackageDetails = new ArrayList<>();
getBottomPackageDetails(organizeCode, containerPackage, bottomPackageDetails);
boolean isAllDeduction = true;
for (MesContainerPackageDetail packageDetail : bottomPackageDetails) {
if (!Objects.equals(packageDetail.getSnStatus(), MesExtEnumUtil.CONTAINER_BARCODE_STATUS.STATUS_20.getValue())) {
isAllDeduction = false;
}
}
if (isAllDeduction) {
MesContainerPackageDetail detail = containerPackageDetailRDao.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "barCode"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerPackage.getContainerSn()});
if (detail != null) {
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(containerPackage, detail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.UN_BINDING, username);
detailBindingRDao.insert(binding);
containerPackageDetailRDao.deleteWeaklyById(detail.getId(), username);
}
containerPackageRDao.deleteWeaklyById(containerPackage.getId(), username);
// 非工步上料,需要将容器与站点解绑!
if (!bStep) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(containerSn, "containerSn", ddlPackBean);
containerSnStationRDao.updateByProperties(
new String[]{"modifyUser", "modifyDatetime", "isDeleted"},
new Object[]{username, TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()},
ddlPackBean);
}
}
}
@Override
public MesContainerSnBindModel doScanBarcode(MesContainerSnBindModel model) {
public MesContainerSnBindModel doScanBarcode(MesContainerSnBindModel model, boolean bStep) {
final String organizeCode = model.getOrganizeCode();
//校验容器条码
MesContainerSn containerSn = containerSnService.checkContainerSn(organizeCode, model.getContainerSn());
@ -328,6 +371,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
if (containerType.getMixType() == null) {
MesPcnException.throwMesBusiException("容器类型代码【%s】未配置混包类型请检查容器类型主数据", containerSn.getContainerTypeCode());
}
autoOpenContainerSn(organizeCode, containerSn.getContainerSn(), bStep, model.getUserName());
List<MesContainerPackageDetail> packageDetails;
MesContainerPackage containerPackage = containerPackageRDao.getByProperty(
@ -341,22 +385,16 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
MesPcnException.throwMesBusiException("容器条码【%s】已关箱不能再进行上料", containerSn.getContainerSn());
}
packageDetails = containerPackageDetailRDao.findByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn.getContainerSn()});
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "pid"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerPackage.getId()});
}
MesContainerPackageDetail barcodePackageDetail = containerPackageDetailRDao.getByProperty(new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "barCode"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), model.getBarCode()});
if (barcodePackageDetail != null) {
MesPcnException.throwMesBusiException("条码【%s】已被容器【%s】绑定请检查数据", model.getBarCode(), barcodePackageDetail.getContainerSn());
}
// for (MesContainerPackageDetail packageDetail : packageDetails) {
// if (Objects.equals(packageDetail.getBarCode(), model.getBarCode())) {
// MesPcnException.throwMesBusiException("容器条码【%s】与条码【%s】已绑定请检查数据", containerSn.getContainerSn(), model.getBarCode());
// }
// }
List<MesContainerPackageDetail> oldPackageDetails = new ArrayList<>();
getBottomPackageDetails(organizeCode, containerSn.getContainerSn(), oldPackageDetails);
getBottomPackageDetails(organizeCode, containerPackage, oldPackageDetails);
// 判断扫描的是否为容器条码
List<MesContainerPackageDetail> bottomPackageDetails;
@ -397,7 +435,6 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
combPackageDetails.addAll(bottomPackageDetails);
}
containerPackage.setQty(combPackageDetails.size());
MesAbstractContainerBindCheckQtyService checkQtyService = ContainerBindManager.INSTANCE.getCheckQtyService(MesExtEnumUtil.CONTAINER_TYPE_MIX_TYPE.getByValue(containerType.getMixType()));
Map<String, Object> checkQtyResult = checkQtyService.doCheck(model.getOrganizeCode(), containerPackage, combPackageDetails, getContainerParts(model.getOrganizeCode(), containerType.getContainerTypeCode(), containerSn.getContainerSn()));
if (checkQtyResult != null && Objects.equals(checkQtyResult.get(MesPcnExtConstWords.RESULT), false)) {
@ -452,7 +489,6 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
containerPackageDetailRDao.updateByProperties(new String[]{"modifyUser", "modifyDatetime", "isDeleted"},
new Object[]{model.getUserName(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()}, ddlPackBean);
containerPackage.setQty(0);
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_30.getValue());
ConvertBean.serviceModelUpdate(containerPackage, model.getUserName());
containerPackageRDao.update(containerPackage);
@ -482,7 +518,6 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
}
containerPackageDetailRDao.deleteWeaklyByIds(deleteDetailIds.toArray(new Long[0]), model.getUserName());
containerPackage.setQty(getContainerPackageDetailCount(model, containerSn));
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_30.getValue());
ConvertBean.serviceModelUpdate(containerPackage, model.getUserName());
containerPackageRDao.update(containerPackage);
@ -571,7 +606,6 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
containerPackage.setOrganizeCode(model.getOrganizeCode());
containerPackage.setContainerSn(model.getContainerSn());
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_10.getValue());
containerPackage.setQty(0);
ConvertBean.serviceModelInitialize(containerPackage, model.getUserName());
return containerPackage;
}

@ -2,15 +2,22 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.rulematch.containerbi
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.rulematch.containerbind.ContainerBindManager;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesContainerPartsModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesContainerPackage;
import cn.estsh.i3plus.pojo.mes.bean.MesContainerPackageDetail;
import cn.estsh.i3plus.pojo.mes.bean.MesContainerPackageDetailFeeding;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerPackageDetailFeedingRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
public class MesAbstractContainerBindCheckQtyService {
@Autowired
protected MesContainerPackageDetailFeedingRepository packageDetailFeedingRDao;
protected MesAbstractContainerBindCheckQtyService(MesExtEnumUtil.CONTAINER_TYPE_MIX_TYPE type) {
ContainerBindManager.INSTANCE.registerCheckQty(type, this);
@ -18,4 +25,21 @@ public class MesAbstractContainerBindCheckQtyService {
@ApiOperation(value = "校验数量")
public Map<String, Object> doCheck(String organizeCode, MesContainerPackage containerPackage, List<MesContainerPackageDetail> packageDetails, List<MesContainerPartsModel> containerParts) { return null; }
protected double getContainerPackageQty(String organizeCode, List<MesContainerPackageDetail> packageDetails) {
double totalQty = 0;
for (MesContainerPackageDetail detail : packageDetails) {
if (detail.getQty() == null) {
continue;
}
totalQty += detail.getQty();
MesContainerPackageDetailFeeding feeding = packageDetailFeedingRDao.getByProperty(new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "pid", "sourceId"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), detail.getPid(), detail.getId()});
if (feeding != null && feeding.getQty() != null) {
totalQty -= feeding.getQty();
}
}
return totalQty;
}
}

@ -23,6 +23,7 @@ public class MesContainerBindMixService extends MesAbstractContainerBindCheckQty
public Map<String, Object> doCheck(String organizeCode, MesContainerPackage containerPackage, List<MesContainerPackageDetail> packageDetails, List<MesContainerPartsModel> containerParts) {
Map<String, Object> result = new HashMap<>();
result.put(MesPcnExtConstWords.RESULT, false);
final double packageQty = getContainerPackageQty(organizeCode, packageDetails);
Set<String> partNoSet = new HashSet<>();
for (MesContainerPackageDetail packageDetail : packageDetails) {
@ -35,11 +36,11 @@ public class MesContainerBindMixService extends MesAbstractContainerBindCheckQty
if (containerPart.getQty() == null || !partNoSet.contains(containerPart.getPartNo())) {
continue;
}
if (containerPackage.getQty() > containerPart.getQty()) {
if (packageQty > containerPart.getQty()) {
result.put(MesPcnExtConstWords.MESSAGE, String.format("容器条码【%s】超出了包装规格", containerPackage.getContainerSn()));
return result;
}
if (containerPackage.getQty().equals(containerPart.getQty().intValue())) {
if (Objects.equals(packageQty, containerPart.getQty().intValue())) {
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_20.getValue());
}
}

@ -23,6 +23,7 @@ public class MesContainerBindNotMixService extends MesAbstractContainerBindCheck
public Map<String, Object> doCheck(String organizeCode, MesContainerPackage containerPackage, List<MesContainerPackageDetail> packageDetails, List<MesContainerPartsModel> containerParts) {
Map<String, Object> result = new HashMap<>();
result.put(MesPcnExtConstWords.RESULT, false);
final double packageQty = getContainerPackageQty(organizeCode, packageDetails);
final Set<String> partNoSet = packageDetails.stream().map(MesContainerPackageDetail::getPartNo).collect(Collectors.toSet());
if (StringUtils.isEmpty(partNoSet)) {
@ -39,11 +40,11 @@ public class MesContainerBindNotMixService extends MesAbstractContainerBindCheck
continue;
}
if (containerPackage.getQty() > containerPart.getQty()) {
if (packageQty > containerPart.getQty()) {
result.put(MesPcnExtConstWords.MESSAGE, String.format("容器条码【%s】超出了包装规格", containerPackage.getContainerSn()));
return result;
}
if (containerPackage.getQty().equals(containerPart.getQty().intValue())) {
if (Objects.equals(packageQty, containerPart.getQty().intValue())) {
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_20.getValue());
}
}
@ -51,13 +52,4 @@ public class MesContainerBindNotMixService extends MesAbstractContainerBindCheck
result.put(MesPcnExtConstWords.RESULT, true);
return result;
}
private String getPartNo(List<MesContainerPackageDetail> packageDetails) {
for (MesContainerPackageDetail packageDetail : packageDetails) {
if (!StringUtils.isEmpty(packageDetail.getPartNo())) {
return packageDetail.getPartNo();
}
}
return "";
}
}

@ -15,10 +15,7 @@ import cn.estsh.i3plus.pojo.mes.bean.*;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerPackageRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerSnPartRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerSnStationRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerTypePartRepository;
import cn.estsh.i3plus.pojo.mes.repository.*;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -50,6 +47,8 @@ public class MesStationFeedContainerPackageDetailStepService extends BaseStepSer
private IMesContainerSnBindService containerSnBindService;
@Autowired
private MesContainerPackageRepository containerPackageRDao;
@Autowired
private MesContainerSnRepository containerSnRDao;
@Override
public StepResult execute(StationRequestBean reqBean) {
@ -57,11 +56,17 @@ public class MesStationFeedContainerPackageDetailStepService extends BaseStepSer
StationResultBean resultBean = new StationResultBean();
StepResult stepResult = StepResult.getSuccessComplete();
final String organizeCode = reqBean.getOrganizeCode();
//扫描信息置空
String barcode = reqBean.resetScanInfo(reqBean.getScanInfo());
if (StringUtils.isEmpty(barcode)) stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "请扫描上料条码!");
if (containerSnRDao.isExitByProperty(new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), barcode})) {
stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), String.format("不能扫描容器条码【%s】请重新扫描!", barcode));
}
//获取工位当前设备信息
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
@ -75,7 +80,6 @@ public class MesStationFeedContainerPackageDetailStepService extends BaseStepSer
if (CollectionUtils.isEmpty(stationList)) {
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "容器条码扣减装配件时验证设备未关联支持上料的站点");
}
final String organizeCode = reqBean.getOrganizeCode();
final String lastFeedContainerSn = productionDispatchContextStepService.getMatchStationFeedContainerSnContext(reqBean);
if (!StringUtils.isEmpty(lastFeedContainerSn)) {
@ -84,11 +88,13 @@ public class MesStationFeedContainerPackageDetailStepService extends BaseStepSer
}
}
stationList.sort(Comparator.comparing(MesStation::getCreateDatetime));
for (MesStation station : stationList) {
List<MesContainerSnStation> containerSnStations = getMesContainerSnStation(organizeCode, station.getStation());
if (CollectionUtils.isEmpty(containerSnStations)) {
continue;
}
containerSnStations.sort(Comparator.comparing(MesContainerSnStation::getTopContainerSn));
for (MesContainerSnStation containerSnStation : containerSnStations) {
final String feedContainerSn = containerSnStation.getTopContainerSn();
if (Objects.equals(feedContainerSn, lastFeedContainerSn)) {
@ -101,6 +107,7 @@ public class MesStationFeedContainerPackageDetailStepService extends BaseStepSer
}
}
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "未匹配到可上料的容器!");
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "零件条码上料成功!");
}
@ -120,7 +127,7 @@ public class MesStationFeedContainerPackageDetailStepService extends BaseStepSer
.barCode(barcode)
.build();
try {
containerSnBindService.doScanBarcode(model);
containerSnBindService.doScanBarcode(model, true);
final String lastFeedContainerSn = hasFullPackage(organizeCode, containerSn) ? "" : containerSn;
//加料后容器还未满,保存最近使用的站点
productionDispatchContextStepService.dispatchMatchStationFeedContainerSnContext(reqBean, lastFeedContainerSn);

@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.platform.common.util.MesConstWords;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
@ -18,6 +19,7 @@ import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerPackageDetailRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerPackageRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerSnRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerSnStationRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import lombok.extern.slf4j.Slf4j;
@ -46,17 +48,25 @@ public class MesStationFeedContainerSnStepService extends BaseStepService {
private IMesProductionProcessContextStepService productionProcessContextStepService;
@Autowired
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
@Autowired
private MesContainerSnRepository containerSnRDao;
@Override
public StepResult execute(StationRequestBean reqBean) {
StationResultBean resultBean = new StationResultBean();
StepResult stepResult = StepResult.getSuccessComplete();
final String organizeCode = reqBean.getOrganizeCode();
//扫描信息置空
String containerSn = reqBean.resetScanInfo(reqBean.getScanInfo());
if (StringUtils.isEmpty(containerSn)) stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "请扫描上料容器条码!");
if (!containerSnRDao.isExitByProperty(new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn})) {
stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), String.format("请扫描容器条码【%s】!", containerSn));
}
//获取工位当前设备信息
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
@ -88,8 +98,6 @@ public class MesStationFeedContainerSnStepService extends BaseStepService {
if (station == null) {
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "不存在站点类型为【原料站点】、【装配件站点】、【混料站点】的站点信息!");
}
final String organizeCode = reqBean.getOrganizeCode();
String topContainerSn = getTopContainerSn(organizeCode, containerSn);
if (!topContainerSn.equals(containerSn)) {
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("此容器已绑定容器条码【%s】请扫描容器条码【%s】!", containerSn, topContainerSn));

Loading…
Cancel
Save