diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionCustomContextStepService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionCustomContextStepService.java index 8605d73..6d07a72 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionCustomContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionCustomContextStepService.java @@ -101,6 +101,15 @@ public interface IMesProductionCustomContextStepService { @ApiOperation(value = "删除打包数据") void removePackageDataContext(StationRequestBean reqBean); + @ApiOperation(value = "获取选择/扫描零件发运组信息上下文") + List getFunctionChooseShippingGroupContext(StationRequestBean reqBean); + + @ApiOperation(value = "保存选择/扫描零件发运组信息上下文", notes = "[StationKvBean(key=shippingGroupCode, name=零件发运组代码, value=xxx, seq=0), StationKvBean(key=cellMessageSource, name=工位信息来源, value=10, seq=1)]") + Boolean dispatchFunctionChooseShippingGroupContext(StationRequestBean reqBean, List resultList); + + @ApiOperation(value = "删除选择/扫描零件发运组信息上下文") + void removeFunctionChooseShippingGroupContext(StationRequestBean reqBean); + @ApiOperation(value = "获取排序线工单队列推送锁数据, 返回的值是工位代码") String getSortQueuePushLockContext(StationRequestBean reqBean, String queuePushId); diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java index 42f613f..97892a7 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java @@ -167,15 +167,6 @@ public interface IMesProductionProcessContextStepService { @ApiOperation(value = "获取设备点检上下文对象") MesEquipSpotCheckContext dispatchEquipSpotCheckContext(StationRequestBean reqBean, String equipmentCode); - @ApiOperation(value = "获取选择/扫描零件发运组信息上下文") - List getFunctionChooseShippingGroupContext(StationRequestBean reqBean); - - @ApiOperation(value = "保存选择/扫描零件发运组信息上下文", notes = "[StationKvBean(key=shippingGroupCode, name=零件发运组代码, value=xxx, seq=0), StationKvBean(key=cellMessageSource, name=工位信息来源, value=10, seq=1)]") - Boolean dispatchFunctionChooseShippingGroupContext(StationRequestBean reqBean, List resultList); - - @ApiOperation(value = "删除选择/扫描零件发运组信息上下文") - void removeFunctionChooseShippingGroupContext(StationRequestBean reqBean); - @ApiOperation(value = "处理加工不可用规则") MesProductionProcessContext dispatchProdRuleIgnoreCfgContext(StationRequestBean reqBean); @@ -194,4 +185,13 @@ public interface IMesProductionProcessContextStepService { @ApiOperation(value = "处理工位零件打印机配置") List disPatchWorkCellPartPrinterCfg(StationRequestBean reqBean, Boolean pcNosortPrinterCfg); + @ApiOperation(value = "获取发运RFID生产模式") + String getShippingRfidRouteModeContext(StationRequestBean reqBean); + + @ApiOperation(value = "处理发运RFID生产模式") + String disPatchShippingRfidRouteModeContext(StationRequestBean reqBean); + + @ApiOperation(value = "处理切换发运RFID生产模式的标志") + Boolean disPatchChooseShippingRfidRouteMode(StationRequestBean reqBean); + } diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingQueueService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingQueueService.java index 5c33b19..d55bb49 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingQueueService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingQueueService.java @@ -1,18 +1,36 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi; +import cn.estsh.i3plus.pojo.mes.bean.MesProdRouteOptParam; import cn.estsh.i3plus.pojo.mes.bean.seres.MesCimSeresJisRfid; +import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagement; +import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagementDetail; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingQueue; import io.swagger.annotations.ApiOperation; +import java.util.Map; +import java.util.Optional; + public interface IMesShippingQueueService { @ApiOperation("根据零件发运组代码查询创建时间正序创建状态的一条发运队列") MesShippingQueue getShippingQueue(String organizeCode, String shippingGroupCode); + @ApiOperation("根据发运代码查询创建时间正序创建状态的一条发运队列") + MesShippingQueue getShippingQueueByCode(String organizeCode, String shippingCode); + @ApiOperation("根据ID修改发运队列") void saveShippingQueue(String organizeCode, Long id, String[] propertyName, Object[] propertyValue); @ApiOperation("根据VIN查询赛力斯RFID信息") MesCimSeresJisRfid getCimSeresJisRfid(String organizeCode, String vin); + @ApiOperation("根据发运代码查询发运主表") + MesShippingOrderManagement getShipping(String organizeCode, String shippingCode); + + @ApiOperation("根据发运主表ID查询发运明细表") + MesShippingOrderManagementDetail getShippingDetail(String organizeCode, Long pid); + + @ApiOperation("解析rfidSn") + String getRfidSn(Optional> stepParamMap, String rfid); + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingQueueService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingQueueService.java index 48356f0..a26fc8b 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingQueueService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingQueueService.java @@ -5,8 +5,13 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +import cn.estsh.i3plus.pojo.mes.bean.MesProdRouteOptParam; import cn.estsh.i3plus.pojo.mes.bean.seres.MesCimSeresJisRfid; +import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagement; +import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagementDetail; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingQueue; +import cn.estsh.i3plus.pojo.mes.repository.MesShippingOrderManagementDetailRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesShippingOrderManagementRepository; import cn.estsh.i3plus.pojo.mes.repository.MesShippingQueueRepository; import cn.estsh.i3plus.pojo.mes.repository.seres.IMesCimSeresJisRfidRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; @@ -15,6 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; +import java.util.Map; +import java.util.Optional; + @Service @Slf4j public class MesShippingQueueService implements IMesShippingQueueService { @@ -25,6 +33,12 @@ public class MesShippingQueueService implements IMesShippingQueueService { @Autowired private IMesCimSeresJisRfidRepository cimSeresJisRfidRepository; + @Autowired + private MesShippingOrderManagementRepository shippingOrderManagementRepository; + + @Autowired + private MesShippingOrderManagementDetailRepository shippingOrderManagementDetailRepository; + @Override public MesShippingQueue getShippingQueue(String organizeCode, String shippingGroupCode) { if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(shippingGroupCode)) return null; @@ -36,6 +50,16 @@ public class MesShippingQueueService implements IMesShippingQueueService { } @Override + public MesShippingQueue getShippingQueueByCode(String organizeCode, String shippingCode) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(shippingCode)) return null; + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringEqualPack(shippingCode, MesPcnExtConstWords.SHIPPING_CODE, packBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.QUEUE_ORDER_STATUS.CREATE.getValue(), MesPcnExtConstWords.QUEUE_STATUS, packBean); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{MesPcnExtConstWords.CREATE_DATE_TIME}, packBean); + return shippingQueueRepository.getByProperty(packBean); + } + + @Override public void saveShippingQueue(String organizeCode, Long id, String[] propertyName, Object[] propertyValue) { if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(id)) return; shippingQueueRepository.updateByPropertiesNoSync(new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, new Object[]{id, organizeCode}, propertyName, propertyValue); @@ -48,4 +72,46 @@ public class MesShippingQueueService implements IMesShippingQueueService { new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.VIN, MesPcnExtConstWords.STATUS}, new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), vin, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()}); } + + @Override + public MesShippingOrderManagement getShipping(String organizeCode, String shippingCode) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(shippingCode)) return null; + return shippingOrderManagementRepository.getByProperty( + new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.SHIPPING_CODE}, + new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), shippingCode}); + } + + @Override + public MesShippingOrderManagementDetail getShippingDetail(String organizeCode, Long pid) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(pid)) return null; + return shippingOrderManagementDetailRepository.getByProperty( + new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.PID}, + new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), pid}); + } + + /** + * ################## 【拉动单号18位】 + * 3263 【供应商代码 4位】 + * 1 【-个VIN对应几个托盘 1位】 + * 2 【左右区分,0代表做,1代表右;不区分左右为2 1位】 + * JSG1DJ05 【LMS零件类 8位】 + * 默认替换说明: 截取96位后面的32位替换为上面拼接的字符串 + */ + //解析rfidSn + @Override + public String getRfidSn(Optional> stepParamMap, String rfid) { + //replaceIndex=替换起始位置; replaceLength=替换长度; replaceInfo=替换信息 + String replaceIndex = (null != stepParamMap && stepParamMap.isPresent() && stepParamMap.get().containsKey(MesPcnExtConstWords.REPLACE_INDEX)) ? stepParamMap.get().get(MesPcnExtConstWords.REPLACE_INDEX).getParamValue() : null; + String replaceLength = (null != stepParamMap && stepParamMap.isPresent() && stepParamMap.get().containsKey(MesPcnExtConstWords.REPLACE_LENGTH)) ? stepParamMap.get().get(MesPcnExtConstWords.REPLACE_LENGTH).getParamValue() : null; + String replaceInfo = (null != stepParamMap && stepParamMap.isPresent() && stepParamMap.get().containsKey(MesPcnExtConstWords.REPLACE_INFO)) ? stepParamMap.get().get(MesPcnExtConstWords.REPLACE_INFO).getParamValue() : null; + if (StringUtils.isEmpty(replaceIndex)) replaceIndex = "96"; + if (StringUtils.isEmpty(replaceLength)) replaceLength = "32"; + if (StringUtils.isEmpty(replaceInfo)) replaceInfo = "##################326312JSG1DJ05"; + try { + return new StringBuilder().append(rfid, MesPcnExtConstWords.ZERO, Integer.parseInt(replaceIndex)).append(replaceInfo).append(rfid, Integer.parseInt(replaceIndex) + Integer.parseInt(replaceLength), rfid.length()).toString(); + } catch (Exception e) { + return null; + } + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionChooseShippingGroupService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionChooseShippingGroupService.java index 9c5027d..02d2d42 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionChooseShippingGroupService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionChooseShippingGroupService.java @@ -1,6 +1,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPartShippingGroupService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseSwsService; @@ -28,7 +29,7 @@ import java.util.List; public class MesFunctionChooseShippingGroupService extends BaseSwsService implements IFsmModuleFunctionService { @Autowired - private IMesProductionProcessContextStepService productionProcessContextStepService; + private IMesProductionCustomContextStepService productionCustomContextStepService; @Autowired private IShippingDispatchService shippingDispatchService; @@ -49,7 +50,7 @@ public class MesFunctionChooseShippingGroupService extends BaseSwsService implem } //保存选择的零件发运组信息上下文 - productionProcessContextStepService.dispatchFunctionChooseShippingGroupContext(reqBean, resultList); + productionCustomContextStepService.dispatchFunctionChooseShippingGroupContext(reqBean, resultList); this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PICK.getValue()).scanInfo(buttonDynamicModel.getFunctionValue()), String.format("生产线[%s]工位[%s]%s成功,请等待验证!提交信息[%s]", reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), buttonDynamicModel.getButtonName(), buttonDynamicModel.getFunctionValue()), diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionChooseShippingRfidRouteModeService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionChooseShippingRfidRouteModeService.java new file mode 100644 index 0000000..370c6f4 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionChooseShippingRfidRouteModeService.java @@ -0,0 +1,55 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function; + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseSwsService; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IShippingDispatchService; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.function.IFsmModuleFunctionService; +import cn.estsh.i3plus.platform.common.util.MesPcnConstWords; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +import cn.estsh.i3plus.pojo.mes.model.ButtonDynamicModel; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StationResultBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +/** + * @Description : 工位参数按钮事件接口实现【发运RFID切换生产模式】 + **/ +@Service +public class MesFunctionChooseShippingRfidRouteModeService extends BaseSwsService implements IFsmModuleFunctionService { + + @Autowired + private IMesProductionProcessContextStepService productionProcessContextStepService; + + @Autowired + private IShippingDispatchService shippingDispatchService; + + @Override + public Boolean doFunction(StationRequestBean reqBean, StationResultBean resultBean, ButtonDynamicModel buttonDynamicModel) { + + //获取发运RFID生产模式 + String routeMode = productionProcessContextStepService.getShippingRfidRouteModeContext(reqBean); + + //判断是否人工模式 + Boolean isManualMode = !StringUtils.isEmpty(routeMode) && routeMode.equals(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValueStr()); + + //处理切换发运RFID生产模式的标志 + productionProcessContextStepService.disPatchChooseShippingRfidRouteMode(reqBean); + + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PICK.getValue()).scanInfo(buttonDynamicModel.getFunctionValue()), + String.format("生产线[%s]工位[%s]%s:[%s],请等待验证!", reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), buttonDynamicModel.getButtonName(), isManualMode ? "人工 -> 自动" : "自动 -> 人工"), + MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + + reqBean.setClientInfo(shippingDispatchService.getActorClientInfo(reqBean)); + reqBean.setInterfaceType(MesPcnConstWords.SHIPPING); + reqBean.setBusiType(MesPcnEnumUtil.ACTOR_RECEIVE_STRATEGY.WS_CMD_DO_SCAN.getCode()); + reqBean.setForceJumpProcess(true); + shippingDispatchService.sendScanQueueNextExec(reqBean); + + return true; + + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingCodeScanStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingCodeScanStepService.java new file mode 100644 index 0000000..c94f506 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingCodeScanStepService.java @@ -0,0 +1,135 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService; +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.api.busi.IMesShippingQueueService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; +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; +import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagement; +import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagementDetail; +import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingQueue; +import cn.estsh.i3plus.pojo.mes.model.StationKvBean; +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; + +/** + * @Description : 发运队列工位人工扫描发运单号工步 + * @Author : wangjie + **/ +@Slf4j +@Service("mesShippingCodeScanStepService") +public class MesShippingCodeScanStepService extends BaseStepService { + + @Autowired + private IMesProductionProcessContextStepService productionProcessContextStepService; + + @Autowired + private IMesProductionDispatchContextStepService productionDispatchContextStepService; + + @Autowired + private IMesProductionCustomContextStepService productionCustomContextStepService; + + @Autowired + private IMesShippingQueueService shippingQueueService; + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StationResultBean resultBean = new StationResultBean(); + + StepResult stepResult; + + //获取上下文信息 + MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean); + + //配置错误 抛出异常 + if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + + //存储生产过程上下文对象 + productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); + + //扫描信息置空 + String scanInfo = reqBean.resetScanInfo(reqBean.getScanInfo()); + + //验证发运组信息是否有效 + List resultList = null; + + if (StringUtils.isEmpty(scanInfo)) stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!"); + + //发送工步内容 + productionCustomContextStepService.sendStepContextMessage(reqBean, scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN); + + //根据发运代码查询创建时间正序创建状态的一条发运队列 + MesShippingQueue shippingQueue = shippingQueueService.getShippingQueueByCode(reqBean.getOrganizeCode(), scanInfo); + String vinCode = (null == shippingQueue || StringUtils.isEmpty(shippingQueue.getVin())) ? null : shippingQueue.getVin(); + if (StringUtils.isEmpty(vinCode)) { + MesShippingOrderManagement shipping = shippingQueueService.getShipping(reqBean.getOrganizeCode(), scanInfo); + MesShippingOrderManagementDetail shippingDetail = null == shipping ? null : shippingQueueService.getShippingDetail(reqBean.getOrganizeCode(), shipping.getId()); + vinCode = null == shippingDetail ? null : shippingDetail.getVin(); + } + + if (StringUtils.isEmpty(vinCode)) { + this.sendMessage(reqBean, new StationResultBean().writeDbLog().scanInfo(scanInfo), String.format("当前扫描信息发运单号[%s]信息无效!", scanInfo), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); + stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!"); + } + + //根据VIN查询赛力斯RFID信息 + MesCimSeresJisRfid cimSeresJisRfid = shippingQueueService.getCimSeresJisRfid(reqBean.getOrganizeCode(), vinCode); + if (null == cimSeresJisRfid || StringUtils.isEmpty(cimSeresJisRfid.getRfid())) { + this.sendMessage(reqBean, new StationResultBean().writeDbLog().scanInfo(scanInfo), String.format("当前扫描信息发运单号[%s]信息关联的VIN[%s]未查询到有效的赛力斯RFID信息!", scanInfo, vinCode), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); + stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!"); + } + + //获取工步参数 + Optional> stepParamMap = getStepParams(reqBean); + //解析rfidSn + String rfidSn = shippingQueueService.getRfidSn(stepParamMap, cimSeresJisRfid.getRfid()); + if (StringUtils.isEmpty(rfidSn)) { + this.sendMessage(reqBean, new StationResultBean().writeDbLog().scanInfo(scanInfo), String.format("当前扫描信息发运单号[%s]信息关联的VIN[%s]查询到的赛力斯RFID[%s]解析错误!", scanInfo, vinCode, cimSeresJisRfid.getRfid()), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); + stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!"); + } + + 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()) { + this.sendMessage(reqBean, new StationResultBean().writeDbLog().scanInfo(scanInfo), String.format("当前扫描信息发运单号[%s]信息关联的VIN[%s]查询到的赛力斯RFID[%s]验证错误!", scanInfo, vinCode, cimSeresJisRfid.getRfid()), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); + stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!"); + } + + //保存上下文发运队列信息 + if (null != shippingQueue) { + //保存上下文发运队列信息 + shippingQueue.setPidStr(cimSeresJisRfid.getId().toString()); + shippingQueue.setRfidSn(rfidSn); + productionDispatchContextStepService.dispatchShippingQueueContext(reqBean, shippingQueue); + } + + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("当前扫描信息发运单号[%s]VIN[%s]已匹配到赛力斯RFID信息[%s]!", scanInfo, vinCode, cimSeresJisRfid.getRfid())); + + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingQueueFindStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingQueueFindStepService.java index ffc7fe1..a5d833c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingQueueFindStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingQueueFindStepService.java @@ -8,8 +8,10 @@ import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function.MesFu 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.actor.shipping.dispatch.IFsmCommonService; +import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesConfig; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingQueue; import cn.estsh.i3plus.pojo.mes.model.StationKvBean; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; @@ -23,6 +25,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.util.List; +import java.util.StringJoiner; import java.util.stream.Collectors; /** @@ -51,6 +54,9 @@ public class MesShippingQueueFindStepService extends BaseStepService { @Autowired private IFsmCommonService fsmCommonService; + @Autowired + private IConfigService configService; + @Override public StepResult init(StationRequestBean reqBean) { @@ -101,9 +107,21 @@ public class MesShippingQueueFindStepService extends BaseStepService { } //扫描的发运组信息无效,获取缓存中的发运组信息 - if (CollectionUtils.isEmpty(resultList)) resultList = productionProcessContextStepService.getFunctionChooseShippingGroupContext(reqBean); + if (CollectionUtils.isEmpty(resultList)) { + resultList = productionCustomContextStepService.getFunctionChooseShippingGroupContext(reqBean); + } + + //缓存中无发运组信息,获取默认配置的发运组代码 + if (CollectionUtils.isEmpty(resultList)) { + scanInfo = getDefaultShippingGroupCodeCfg(reqBean); + //验证扫描的发运组信息是否有效 + resultList = functionChooseShippingGroupService.checkShippingGroupIsValid(reqBean.getOrganizeCode(), scanInfo); + } + //扫描的发运组信息有效,保存到上下文 - else productionProcessContextStepService.dispatchFunctionChooseShippingGroupContext(reqBean, resultList); + if (!StringUtils.isEmpty(scanInfo) && !CollectionUtils.isEmpty(resultList)) { + productionCustomContextStepService.dispatchFunctionChooseShippingGroupContext(reqBean, resultList); + } //验证是否存在发运组代码 if (CollectionUtils.isEmpty(resultList)) { @@ -116,6 +134,7 @@ public class MesShippingQueueFindStepService extends BaseStepService { productionCustomContextStepService.sendStepContextMessage(reqBean, scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN); scanInfo = resultList.stream().filter(o -> (null != o && o.getKey().equals(MesPcnExtConstWords.SHIPPING_GROUP_CODE))).findFirst().get().getValue(); + //根据零件发运组代码查询创建时间正序创建状态的一条发运队列 MesShippingQueue shippingQueue = shippingQueueService.getShippingQueue(reqBean.getOrganizeCode(), scanInfo); if (null == shippingQueue) { @@ -137,4 +156,10 @@ public class MesShippingQueueFindStepService extends BaseStepService { } + private String getDefaultShippingGroupCodeCfg(StationRequestBean reqBean) { + MesConfig config = configService.getMesConfigByCfgCodeKeyOrg(MesPcnExtConstWords.FUNCTION_CHOOSE_SHIPPING_GROUP, + new StringJoiner(MesPcnExtConstWords.AND).add(reqBean.getWorkCenterCode()).add(reqBean.getWorkCellCode()).toString(), reqBean.getOrganizeCode()); + return (null != config && !StringUtils.isEmpty(config.getCfgValue())) ? config.getCfgValue() : null; + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidRouteModeCheckStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidRouteModeCheckStepService.java new file mode 100644 index 0000000..b30031b --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidRouteModeCheckStepService.java @@ -0,0 +1,40 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +/** + * @Description : 验证发运队列生产模式工步 + * @Author : wangjie + **/ +@Slf4j +@Service("mesShippingRfidRouteModeCheckStepService") +public class MesShippingRfidRouteModeCheckStepService extends BaseStepService { + + @Autowired + private IMesProductionProcessContextStepService productionProcessContextStepService; + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StepResult stepResult = StepResult.getSuccessComplete(); + + //获取发运RFID生产模式 + String routeMode = productionProcessContextStepService.getShippingRfidRouteModeContext(reqBean); + + //判断是否人工模式 + Boolean isManualMode = !StringUtils.isEmpty(routeMode) && routeMode.equals(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValueStr()); + if (isManualMode) stepResult.isCompleted(false); + + return stepResult; + + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidRouteModeLoadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidRouteModeLoadStepService.java new file mode 100644 index 0000000..275dd28 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesShippingRfidRouteModeLoadStepService.java @@ -0,0 +1,55 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; +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.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StationResultBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +/** + * @Description : 加载发运队列生产模式工步 + * @Author : wangjie + **/ +@Slf4j +@Service("mesShippingRfidRouteModeLoadStepService") +public class MesShippingRfidRouteModeLoadStepService extends BaseStepService { + + @Autowired + private IMesProductionProcessContextStepService productionProcessContextStepService; + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StationResultBean resultBean = new StationResultBean(); + + StepResult stepResult = StepResult.getSuccessComplete(); + + //获取上下文信息 + MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean); + + //配置错误 抛出异常 + if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + + //存储生产过程上下文对象 + productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); + + //处理发运RFID生产模式 + String routeMode = productionProcessContextStepService.disPatchShippingRfidRouteModeContext(reqBean); + + //判断是否人工模式 + Boolean isManualMode = !StringUtils.isEmpty(routeMode) && routeMode.equals(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValueStr()); + if (isManualMode) resultBean.writeDbLog(); + + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean, stepResult, isManualMode ? false : true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("当前生产模式是否人工模式[%s]!", isManualMode)); + + } + +} 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 65ab8e1..2e5ceee 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 @@ -67,7 +67,7 @@ public class MesShippingRfidSeresFindStepService extends BaseStepService { } //解析rfidSn - String rfidSn = getRfidSn(stepParamMap, cimSeresJisRfid.getRfid()); + String rfidSn = shippingQueueService.getRfidSn(stepParamMap, cimSeresJisRfid.getRfid()); if (StringUtils.isEmpty(rfidSn)) { return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().checkRepeat(), stepResult, false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, @@ -100,30 +100,6 @@ public class MesShippingRfidSeresFindStepService extends BaseStepService { } - /** - * ################## 【拉动单号18位】 - * 3263 【供应商代码 4位】 - * 1 【-个VIN对应几个托盘 1位】 - * 2 【左右区分,0代表做,1代表右;不区分左右为2 1位】 - * JSG1DJ05 【LMS零件类 8位】 - * 默认替换说明: 截取96位后面的32位替换为上面拼接的字符串 - */ - //解析rfidSn - private String getRfidSn(Optional> stepParamMap, String rfid) { - //replaceIndex=替换起始位置; replaceLength=替换长度; replaceInfo=替换信息 - String replaceIndex = (null != stepParamMap && stepParamMap.isPresent() && stepParamMap.get().containsKey(MesPcnExtConstWords.REPLACE_INDEX)) ? stepParamMap.get().get(MesPcnExtConstWords.REPLACE_INDEX).getParamValue() : null; - String replaceLength = (null != stepParamMap && stepParamMap.isPresent() && stepParamMap.get().containsKey(MesPcnExtConstWords.REPLACE_LENGTH)) ? stepParamMap.get().get(MesPcnExtConstWords.REPLACE_LENGTH).getParamValue() : null; - String replaceInfo = (null != stepParamMap && stepParamMap.isPresent() && stepParamMap.get().containsKey(MesPcnExtConstWords.REPLACE_INFO)) ? stepParamMap.get().get(MesPcnExtConstWords.REPLACE_INFO).getParamValue() : null; - if (StringUtils.isEmpty(replaceIndex)) replaceIndex = "96"; - if (StringUtils.isEmpty(replaceLength)) replaceLength = "32"; - if (StringUtils.isEmpty(replaceInfo)) replaceInfo = "##################326312JSG1DJ05"; - try { - return new StringBuilder().append(rfid, MesPcnExtConstWords.ZERO, Integer.parseInt(replaceIndex)).append(replaceInfo).append(rfid, Integer.parseInt(replaceIndex) + Integer.parseInt(replaceLength), rfid.length()).toString(); - } catch (Exception e) { - return null; - } - } - // public static void main(String[] args) { // String rfid = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567"; // System.out.println(rfid.length()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java index 2fd9f2c..10bcecb 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java @@ -294,6 +294,29 @@ public class MesProductionCustomContextStepService extends BaseStepService imple removeFsmBusiData(reqBean.getOrganizeCode(), getPackageDataContextKey(reqBean)); } + //上个扫描/读取信息KEY + private String getShippingGroupContextKey(StationRequestBean reqBean) { return getFsmBusikey(reqBean, new StringJoiner(MesPcnExtConstWords.COLON).add(MesPcnExtConstWords.PRODUCTION_PROCESS_CONTEXT).add(MesPcnExtConstWords.FUNCTION_CHOOSE_SHIPPING_GROUP).toString()); } + + //获取选择/扫描零件发运组信息上下文 + @Override + public List getFunctionChooseShippingGroupContext(StationRequestBean reqBean) { + String chooseCavityOrderJson = getFsmBusiData(reqBean.getOrganizeCode(), getShippingGroupContextKey(reqBean)); + return !StringUtils.isEmpty(chooseCavityOrderJson) ? JSONObject.parseArray(chooseCavityOrderJson, StationKvBean.class) : null; + } + + //保存选择/扫描零件发运组信息上下文 腔数=工单个数 数据格式: [StationKvBean(key=shippingGroupCode, name=零件发运组代码, value=xxx, seq=0), StationKvBean(key=cellMessageSource, name=工位信息来源, value=10, seq=1)] + @Override + public Boolean dispatchFunctionChooseShippingGroupContext(StationRequestBean reqBean, List resultList) { + if (CollectionUtils.isEmpty(resultList)) return false; + return dispatchFsmBusiData(reqBean.getOrganizeCode(), getShippingGroupContextKey(reqBean), JSONObject.toJSONString(resultList)); + } + + //删除选择/扫描零件发运组信息上下文 + @Override + public void removeFunctionChooseShippingGroupContext(StationRequestBean reqBean) { + removeFsmBusiData(reqBean.getOrganizeCode(), getShippingGroupContextKey(reqBean)); + } + //排序线工单队列推送锁数据KEY 【PS:生产线级别】 private String getSortQueuePushLockContextKey(StationRequestBean reqBean) { return new StringJoiner(MesPcnExtConstWords.COLON).add(reqBean.getOrganizeCode()).add(reqBean.getWorkCenterCode()).add(MesPcnExtConstWords.QUEUE_PUSH_LOCK_CONTEXT).toString(); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java index 809ef4d..c811a51 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java @@ -589,26 +589,6 @@ public class MesProductionProcessContextStepService extends BaseStepService impl return equipSpotCheckContext; } - //获取选择/扫描零件发运组信息上下文 - @Override - public List getFunctionChooseShippingGroupContext(StationRequestBean reqBean) { - String chooseCavityOrderJson = getFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.FUNCTION_CHOOSE_SHIPPING_GROUP); - return !StringUtils.isEmpty(chooseCavityOrderJson) ? JSONObject.parseArray(chooseCavityOrderJson, StationKvBean.class) : null; - } - - //保存选择/扫描零件发运组信息上下文 腔数=工单个数 数据格式: [StationKvBean(key=shippingGroupCode, name=零件发运组代码, value=xxx, seq=0), StationKvBean(key=cellMessageSource, name=工位信息来源, value=10, seq=1)] - @Override - public Boolean dispatchFunctionChooseShippingGroupContext(StationRequestBean reqBean, List resultList) { - if (CollectionUtils.isEmpty(resultList)) return false; - return dispatchFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.FUNCTION_CHOOSE_SHIPPING_GROUP, JSONObject.toJSONString(resultList)); - } - - //删除选择/扫描零件发运组信息上下文 - @Override - public void removeFunctionChooseShippingGroupContext(StationRequestBean reqBean) { - removeFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.FUNCTION_CHOOSE_SHIPPING_GROUP); - } - //处理加工不可用规则 @Override public MesProductionProcessContext dispatchProdRuleIgnoreCfgContext(StationRequestBean reqBean) { @@ -698,6 +678,7 @@ public class MesProductionProcessContextStepService extends BaseStepService impl return filterList; } + //处理工位零件打印机配置 @Override public List disPatchWorkCellPartPrinterCfg(StationRequestBean reqBean, Boolean pcNosortPrinterCfg) { if (!pcNosortPrinterCfg) return null; @@ -709,4 +690,36 @@ public class MesProductionProcessContextStepService extends BaseStepService impl return workCellPartPrinterCfgList; } + //获取发运RFID生产模式 + @Override + public String getShippingRfidRouteModeContext(StationRequestBean reqBean) { + return getFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.SHIPPING_RFID_ROUTE_MODE_CONTEXT); + } + + //处理发运RFID生产模式 + @Override + public String disPatchShippingRfidRouteModeContext(StationRequestBean reqBean) { + //当前生产模式 + String routeMode = getShippingRfidRouteModeContext(reqBean); + //选择的生产模式 + String chooseRouteMode = getFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.CHOOSE_SHIPPING_RFID_ROUTE_MODE); + //生产模式默认自动 + if (StringUtils.isEmpty(routeMode)) routeMode = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr(); + if (StringUtils.isEmpty(chooseRouteMode)) return routeMode; + //删除切换发运RFID生产模式的标志 + removeFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.CHOOSE_SHIPPING_RFID_ROUTE_MODE); + //切换发运RFID生产模式 + if (routeMode.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) routeMode = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValueStr(); + else routeMode = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr(); + //保存发运RFID生产模式 + dispatchFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.SHIPPING_RFID_ROUTE_MODE_CONTEXT, routeMode); + return routeMode; + } + + //处理切换发运RFID生产模式的标志 + @Override + public Boolean disPatchChooseShippingRfidRouteMode(StationRequestBean reqBean) { + return dispatchFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.CHOOSE_SHIPPING_RFID_ROUTE_MODE, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr()); + } + } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java index 7ee00a3..9db31ee 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java @@ -672,6 +672,10 @@ public class MesPcnExtConstWords { public static final String CELL_PART_PRINTER_CONTEXT = "CELL_PART_PRINTER_CONTEXT"; // 工单完成数上下文 public static final String WORK_ORDER_COMPLETE_CONTEXT = "WORK_ORDER_COMPLETE_CONTEXT"; + // 发运RFID生产模式上下文 + public static final String SHIPPING_RFID_ROUTE_MODE_CONTEXT = "SHIPPING_RFID_ROUTE_MODE_CONTEXT"; + // 选择发运RFID生产模式 + public static final String CHOOSE_SHIPPING_RFID_ROUTE_MODE = "CHOOSE_SHIPPING_RFID_ROUTE_MODE"; // 上下文: 展示组件数据 public static final String MODULE_CONTENT_CONTEXT = "MODULE_CONTENT_CONTEXT";