diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService.java index 40c84d0..29563e8 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService.java @@ -244,9 +244,6 @@ public class MesSendEquipParamsCmdStepService extends BaseStepService { return null != productionPartContext ? productionPartContext.getWorkOrderSeq() : null; case "%CUSTBARCODE%": return null != productionPsOutContext ? productionPsOutContext.getCustSn() : null; - case "%RFIDSN%": - MesShippingQueue shippingQueue = productionDispatchContextStepService.getShippingQueueContext(reqBean); - return null != shippingQueue ? shippingQueue.getRfidSn() : null; default: return matchRule; } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidMatchStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidMatchStepService.java index cd3d005..b9387bc 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidMatchStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidMatchStepService.java @@ -1,11 +1,8 @@ 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.IMesShippingQueueService; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsInContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; -import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingQueue; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; @@ -18,7 +15,6 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.util.List; -import java.util.stream.Collectors; /** * @Description : 发运队列RFID匹配工步 @@ -31,9 +27,6 @@ public class MesShippingRfidMatchStepService extends BaseStepService { @Autowired private IMesProductionDispatchContextStepService productionDispatchContextStepService; - @Autowired - private IMesShippingQueueService shippingQueueService; - @Override public StepResult execute(StationRequestBean reqBean) { @@ -43,38 +36,20 @@ public class MesShippingRfidMatchStepService extends BaseStepService { //获取上下文发运队列信息 MesShippingQueue shippingQueue = productionDispatchContextStepService.getShippingQueueContext(reqBean); - if ((null == shippingQueue || StringUtils.isEmpty(shippingQueue.getRfidSn()))) { - return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().checkRepeat(), stepResult, - false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, "当前未获取到缓存中有效的发运队列,即将重新获取!", - getStepParams(reqBean), MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); - } + if ((null == shippingQueue || StringUtils.isEmpty(shippingQueue.getRfidSn()))) + return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前未获取到缓存中有效的发运队列!"); - //获取上下文进料零件条码信息集合 - List productionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean); - //过滤有效的进料零件条码 - String productSn = filterProductionPsInContextList(productionPsInContextList); - if (StringUtils.isEmpty(productSn)) { - return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().checkRepeat(), stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PRODUCT_SN), - false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, "当前未获取到缓存中有效的进料条码,即将重新获取!", - getStepParams(reqBean), MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); - } + //获取上下文扫/读信息:主条码 + List equipVariableCollectContextList = productionDispatchContextStepService.getScanProductSnContext(reqBean); + //设备写的条码 + String productSn = CollectionUtils.isEmpty(equipVariableCollectContextList) ? null : equipVariableCollectContextList.get(0).getEquipVariableValue(); + if (StringUtils.isEmpty(productSn)) return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前未获取到设备写入的主条码信息!"); - if (!shippingQueue.getRfidSn().equals(productSn)) { - return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().checkRepeat(), stepResult, - false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, String.format("RFID匹配失败!读条码[%s]与RFID条码[%s]不一致!", productSn, shippingQueue.getRfidSn()), - getStepParams(reqBean), MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); - } + if (!shippingQueue.getRfidSn().equals(productSn)) + return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("RFID匹配失败!读条码[%s]与RFID条码[%s]不一致!", productSn, shippingQueue.getRfidSn())); - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "RFID匹配成功!"); + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "RFID匹配成功!", MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); } - //过滤有效的进料零件条码 - private String filterProductionPsInContextList(List productionPsInContextList) { - productionPsInContextList = CollectionUtils.isEmpty(productionPsInContextList) ? null : - productionPsInContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList()); - return CollectionUtils.isEmpty(productionPsInContextList) ? null : productionPsInContextList.get(0).getProductSn(); - } - - } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidSeresFindStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidSeresFindStepService.java index f4ee1d8..65ab8e1 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidSeresFindStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidSeresFindStepService.java @@ -2,8 +2,10 @@ 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.IMesShippingQueueService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.mes.bean.MesProdRouteOptParam; import cn.estsh.i3plus.pojo.mes.bean.seres.MesCimSeresJisRfid; @@ -11,11 +13,15 @@ import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingQueue; 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.util.MesExtEnumUtil; +import cn.estsh.impp.framework.boot.util.SpringContextsUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.Optional; @@ -69,6 +75,21 @@ public class MesShippingRfidSeresFindStepService extends BaseStepService { stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); } + List equipVariableCollectContextList = new ArrayList<>(); + equipVariableCollectContextList.add(new MesEquipVariableCollectContext(reqBean.getOrganizeCode(), rfidSn, MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue())); + //保存上下文扫/读信息:主条码 + productionDispatchContextStepService.dispatchScanProductSnContext(reqBean, equipVariableCollectContextList); + + //主条码验证工步 【非排序】 + stepResult = ((IStepService) SpringContextsUtil.getBean("mesProductSnCheckStepService")).executeInState(reqBean); + + if (!stepResult.isCompleted()) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().checkRepeat(), stepResult, + false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, + String.format("当前零件发运组[%s]匹配的发运队列单号[%s]VIN[%s]查询到的赛力斯RFID[%s]验证错误,请人工处理! 持续监听中...", shippingQueue.getShippingGroupCode(), shippingQueue.getShippingCode(), shippingQueue.getVin(), cimSeresJisRfid.getRfid()), + stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); + } + //保存上下文发运队列信息 shippingQueue.setPidStr(cimSeresJisRfid.getId().toString()); shippingQueue.setRfidSn(rfidSn);