From 6f1fe719a0944cf7ba554b66207c82aca13258b8 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Sat, 8 Feb 2025 14:18:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=2044424=20PCN=EF=BC=9A=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=88=A4=E5=8F=AF=E7=96=91=E7=9A=84=E7=A0=81=EF=BC=8C=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E5=B7=A5=E5=8D=95=E6=A3=80=E9=AA=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=9C=A8=E6=89=AB=E6=8F=8F=E8=A3=85=E9=85=8D?= =?UTF-8?q?=E4=BB=B6=E5=B7=A5=E6=AD=A5=E6=97=B6=E6=89=AB=E6=8F=8F=E5=88=A4?= =?UTF-8?q?=E5=8F=AF=E7=96=91=E7=A0=81=EF=BC=8C=E5=B7=A5=E5=8D=95=E6=A0=87?= =?UTF-8?q?=E8=AE=B0=E4=B8=BA=E5=8F=AF=E7=96=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../step/MesAssemblyMatchSortStepService.java | 10 ++++++++++ .../serviceimpl/step/MesAssemblyScanStepService.java | 19 ++++++++++++++++--- .../MesProductionProcessContextStepService.java | 7 +++++-- .../pcn/pojo/context/MesProductionProcessContext.java | 9 +++++++++ .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 2 ++ 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java index 13604e6..9669031 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java @@ -67,6 +67,16 @@ public class MesAssemblyMatchSortStepService extends BaseStepService { //存储生产过程上下文对象 productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); + //获取加工结果 + String productResult = productionDispatchContextStepService.getProductResultContext(reqBean); + if (!StringUtils.isEmpty(productResult) && !productResult.equals(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValueStr()) && + (StringUtils.isEmpty(productionProcessContext.getWorkCenter().getIsIgnoreQc()) + || productionProcessContext.getWorkCenter().getIsIgnoreQc().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) != 0)) { + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, + String.format("加工单质量状态标记[%s],当前装配件清单默认跳过!", MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(Integer.parseInt(productResult))), + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); + } + //获取上下文产品加工规则数据信息集合 List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); if (CollectionUtils.isEmpty(prodRuleContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在非排序加工规则数据,请重置工序!"); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java index f4da625..2b20a37 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java @@ -112,7 +112,7 @@ public class MesAssemblyScanStepService extends BaseStepService { productionCustomContextStepService.sendStepContextMessage(reqBean, scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN); //封装当前扫描的装配件信息 - List equipVariableCollectContextList = getAssemblySnJson(reqBean, scanInfo); + List equipVariableCollectContextList = getAssemblySnJson(reqBean, productionProcessContext, scanInfo); //从上下文中取出工位当前要使用的设备 MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip(); @@ -153,7 +153,17 @@ public class MesAssemblyScanStepService extends BaseStepService { productionDispatchContextStepService.dispatchScanAssemblySnContext(reqBean, equipVariableCollectContextList); //唯一加工规则场景 默认扫描一次 匹配一次 循环处理直到当前的加工规则全部匹配完毕 - if (busiType == BUSI_TYPE.ONE.value) return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), stepResult, String.format("当前扫描信息装配件条码[%s]!", scanInfo)); + if (busiType == BUSI_TYPE.ONE.value) { + //排序线可疑码场景下,该数据为空,验证生产线是否忽略质量状态 + if (CollectionUtils.isEmpty(equipVariableCollectContextList)) { + //保存上下文加工结果:可疑 + productionDispatchContextStepService.dispatchProductResultContext(reqBean, MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValueStr()); + this.sendMessage(reqBean, new StationResultBean().writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), "当前扫描信息[排序线可疑码]!", MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + if (StringUtils.isEmpty(productionProcessContext.getWorkCenter().getIsIgnoreQc()) || productionProcessContext.getWorkCenter().getIsIgnoreQc().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) != 0) return stepResult; + else stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "请扫描装配件条码!"); + } + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), stepResult, String.format("当前扫描信息装配件条码[%s]!", scanInfo)); + } String suffix = repeatAssemblySnAmount == 0 ? MesPcnExtConstWords.EMPTY : String.format(",可复用个数[%s]", repeatAssemblySnAmount); @@ -265,7 +275,10 @@ public class MesAssemblyScanStepService extends BaseStepService { } //封装当前扫描的装配件信息 - private List getAssemblySnJson(StationRequestBean reqBean, String scanInfo) { + private List getAssemblySnJson(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, String scanInfo) { + + //排序线可疑码 + if (productionProcessContext.getWorkCenter().getCenterType().compareTo(MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue()) == 0 && scanInfo.equals(productionProcessContext.getSortSuspiciousCode())) return null; List equipVariableCollectContextList = new ArrayList<>(); 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 eeb5810..12ff35e 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 @@ -114,7 +114,9 @@ public class MesProductionProcessContextStepService extends BaseStepService impl if (isCheckProcess && (StringUtils.isEmpty(productionProcessContext.getProcessCode()) || !productionProcessContext.getProcessCode().equals(reqBean.getProcessCode()))) processContext(reqBean, productionProcessContext); //生产过程上下文对象赋值生产过程控制全局密码 - if (StringUtils.isEmpty(productionProcessContext.getFinishCode()) || StringUtils.isEmpty(productionProcessContext.getCraftJumpCode()) || StringUtils.isEmpty(productionProcessContext.getAssemblySkipCode()) || StringUtils.isEmpty(productionProcessContext.getAssemblyCavitySkipCode())) productionPwdContext(reqBean, productionProcessContext); + if (StringUtils.isEmpty(productionProcessContext.getFinishCode()) || StringUtils.isEmpty(productionProcessContext.getCraftJumpCode()) || + StringUtils.isEmpty(productionProcessContext.getAssemblySkipCode()) || StringUtils.isEmpty(productionProcessContext.getAssemblyCavitySkipCode()) || + StringUtils.isEmpty(productionProcessContext.getSortSuspiciousCode())) productionPwdContext(reqBean, productionProcessContext); return productionProcessContext; @@ -152,7 +154,8 @@ public class MesProductionProcessContextStepService extends BaseStepService impl return productionProcessContext.finishCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.CAVITY_FINISH_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.CAVITY_FINISH_CODE).get(0).getCfgValue() : MesPcnExtConstWords.CAVITY_FINISH_CODE) .craftJumpCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.CRAFT_JUMP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.CRAFT_JUMP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.CRAFT_JUMP_CODE) .assemblySkipCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.ASSEMBLY_SKIP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.ASSEMBLY_SKIP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.ASSEMBLY_SKIP_CODE) - .assemblyCavitySkipCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE); + .assemblyCavitySkipCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE) + .sortSuspiciousCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.SORT_SUSPICIOUS_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.SORT_SUSPICIOUS_CODE).get(0).getCfgValue() : MesPcnExtConstWords.SORT_SUSPICIOUS_CODE); } //验证组织模型有效性 diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java index c8ba4bb..643d047 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java @@ -47,6 +47,9 @@ public class MesProductionProcessContext implements Serializable { @ApiParam("装配件整腔跳过码") private String assemblyCavitySkipCode; + @ApiParam("排序线可疑码") + private String sortSuspiciousCode; + @ApiParam("生产线信息([Json]MesWorkCenter)") private String workCenterJson; @@ -142,6 +145,12 @@ public class MesProductionProcessContext implements Serializable { return this.isNeedCache(); } + //排序线可疑码 + public MesProductionProcessContext sortSuspiciousCode(String sortSuspiciousCode) { + this.sortSuspiciousCode = sortSuspiciousCode; + return this.isNeedCache(); + } + //---------------------- 生产线对象 --------------------------------------- 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 e9d756c..563ea87 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 @@ -386,6 +386,8 @@ public class MesPcnExtConstWords { public static final String ASSEMBLY_SKIP_CODE = "ASSEMBLY_SKIP_CODE"; // 装配件整腔跳过码 public static final String ASSEMBLY_CAVITY_SKIP_CODE = "ASSEMBLY_CAVITY_SKIP_CODE"; + // 排序线可疑码 + public static final String SORT_SUSPICIOUS_CODE = "SORT_SUSPICIOUS_CODE"; // 设备代码[工步参数] public static final String EQUIPMENT_CODE_UC = "EQUIPMENT_CODE"; // 模具号读一模多腔配置[工步参数] From b46e6a6a8a7639063dfb0b1fc764040dc4db28c1 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Sat, 8 Feb 2025 14:21:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=2044424=20PCN=EF=BC=9A=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=88=A4=E5=8F=AF=E7=96=91=E7=9A=84=E7=A0=81=EF=BC=8C=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E5=B7=A5=E5=8D=95=E6=A3=80=E9=AA=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=9C=A8=E6=89=AB=E6=8F=8F=E8=A3=85=E9=85=8D?= =?UTF-8?q?=E4=BB=B6=E5=B7=A5=E6=AD=A5=E6=97=B6=E6=89=AB=E6=8F=8F=E5=88=A4?= =?UTF-8?q?=E5=8F=AF=E7=96=91=E7=A0=81=EF=BC=8C=E5=B7=A5=E5=8D=95=E6=A0=87?= =?UTF-8?q?=E8=AE=B0=E4=B8=BA=E5=8F=AF=E7=96=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java | 2 +- .../mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java index 9669031..b609510 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java @@ -69,7 +69,7 @@ public class MesAssemblyMatchSortStepService extends BaseStepService { //获取加工结果 String productResult = productionDispatchContextStepService.getProductResultContext(reqBean); - if (!StringUtils.isEmpty(productResult) && !productResult.equals(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValueStr()) && + if (!StringUtils.isEmpty(productResult) && !productResult.equals(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue() + MesPcnExtConstWords.EMPTY) && (StringUtils.isEmpty(productionProcessContext.getWorkCenter().getIsIgnoreQc()) || productionProcessContext.getWorkCenter().getIsIgnoreQc().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) != 0)) { return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java index 2b20a37..75558a9 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java @@ -157,7 +157,7 @@ public class MesAssemblyScanStepService extends BaseStepService { //排序线可疑码场景下,该数据为空,验证生产线是否忽略质量状态 if (CollectionUtils.isEmpty(equipVariableCollectContextList)) { //保存上下文加工结果:可疑 - productionDispatchContextStepService.dispatchProductResultContext(reqBean, MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValueStr()); + productionDispatchContextStepService.dispatchProductResultContext(reqBean, MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue() + MesPcnExtConstWords.EMPTY); this.sendMessage(reqBean, new StationResultBean().writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), "当前扫描信息[排序线可疑码]!", MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); if (StringUtils.isEmpty(productionProcessContext.getWorkCenter().getIsIgnoreQc()) || productionProcessContext.getWorkCenter().getIsIgnoreQc().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) != 0) return stepResult; else stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "请扫描装配件条码!"); From 3b391c1019f737bd0db66bea89bf04c1f6bf9a6a Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Sat, 8 Feb 2025 15:29:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=2044424=20PCN=EF=BC=9A=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=88=A4=E5=8F=AF=E7=96=91=E7=9A=84=E7=A0=81=EF=BC=8C=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E5=B7=A5=E5=8D=95=E6=A3=80=E9=AA=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=9C=A8=E6=89=AB=E6=8F=8F=E8=A3=85=E9=85=8D?= =?UTF-8?q?=E4=BB=B6=E5=B7=A5=E6=AD=A5=E6=97=B6=E6=89=AB=E6=8F=8F=E5=88=A4?= =?UTF-8?q?=E5=8F=AF=E7=96=91=E7=A0=81=EF=BC=8C=E5=B7=A5=E5=8D=95=E6=A0=87?= =?UTF-8?q?=E8=AE=B0=E4=B8=BA=E5=8F=AF=E7=96=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../step/MesWorkOrderSaveSortStepService.java | 85 +++++++++++++++------- 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java index 763fdd0..b38176f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java @@ -17,6 +17,7 @@ import cn.estsh.i3plus.pojo.mes.model.StationResultBean; import cn.estsh.i3plus.pojo.mes.model.StepResult; import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -26,7 +27,9 @@ import org.springframework.util.StringUtils; import javax.persistence.EntityManager; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @Description : 保存加工单信息工步 【排序】 @@ -89,42 +92,68 @@ public class MesWorkOrderSaveSortStepService extends BaseStepService { private void doHandleWorkOrderData(StationRequestBean reqBean, StationResultBean resultBean, List productionPartContextList, MesWorkCell workCell) { + //获取上下文加工结果 + String productResult = productionDispatchContextStepService.getProductResultContext(reqBean); + + Map propertyMap; + for (MesProductionPartContext productionPartContext : productionPartContextList) { if (null == productionPartContext || StringUtils.isEmpty(productionPartContext.getForeignKey())) continue; + //判断是否末道工位 Boolean isEndWorkCell = (!StringUtils.isEmpty(workCell.getIsEndWorkCell()) && workCell.getIsEndWorkCell().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) ? true : false; - if (!isEndWorkCell && productionPartContext.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()) == 0) continue; - - if (!isEndWorkCell) { - workOrderRepository.updateByPropertiesNoSync( - new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, - new Object[]{productionPartContext.getId(), reqBean.getOrganizeCode()}, - new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, - MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME, - MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.START_TIME, MesPcnExtConstWords.ONLINE_TIME}, - new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), - CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesPcnExtConstWords.EMPTY, - MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue(), productionPartContext.getOnlineTime(), productionPartContext.getOnlineTime()}); - } else { - productionPartContext.setOfflineTime(TimeTool.getNowTime(true)); - workOrderRepository.updateByPropertiesNoSync( - new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, - new Object[]{productionPartContext.getId(), reqBean.getOrganizeCode()}, - new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, - MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME, - MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.COMPLETE_QTY, MesPcnExtConstWords.UN_COMPLETE_QTY, - MesPcnExtConstWords.START_TIME, MesPcnExtConstWords.ONLINE_TIME, MesPcnExtConstWords.END_TIME, MesPcnExtConstWords.OFFLINE_TIME}, - new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), - CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesPcnExtConstWords.EMPTY, - MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue(), new Double(1), new Double(0), - productionPartContext.getOnlineTime(), productionPartContext.getOnlineTime(), productionPartContext.getOfflineTime(), productionPartContext.getOfflineTime()}); + propertyMap = new HashMap<>(); + + //质量非合格 + if (!StringUtils.isEmpty(productResult) && !productResult.equals(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue() + MesPcnExtConstWords.EMPTY)) { + propertyMap.put(MesPcnExtConstWords.QC_STATUS, Integer.valueOf(productResult)); } - log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:[{}:{}]", - reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), - StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), productionPartContext.getWorkOrderNo(), MesPcnExtConstWords.WORK_ORDER_STATUS, !isEndWorkCell ? MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue() : MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); + //末工位 或者 非加工中 + if (isEndWorkCell || productionPartContext.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()) != 0) { + if (!isEndWorkCell) { + propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()); + propertyMap.put(MesPcnExtConstWords.START_TIME, productionPartContext.getOnlineTime()); + propertyMap.put(MesPcnExtConstWords.ONLINE_TIME, productionPartContext.getOnlineTime()); + } else { + productionPartContext.setOfflineTime(TimeTool.getNowTime(true)); + propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); + propertyMap.put(MesPcnExtConstWords.START_TIME, productionPartContext.getOnlineTime()); + propertyMap.put(MesPcnExtConstWords.ONLINE_TIME, productionPartContext.getOnlineTime()); + propertyMap.put(MesPcnExtConstWords.END_TIME, productionPartContext.getOfflineTime()); + propertyMap.put(MesPcnExtConstWords.OFFLINE_TIME, productionPartContext.getOfflineTime()); + propertyMap.put(MesPcnExtConstWords.COMPLETE_QTY, new Double(1)); + propertyMap.put(MesPcnExtConstWords.UN_COMPLETE_QTY, new Double(0)); + } + } + + //当存在修改字段的情况下进行修改工单信息 + if (!CollectionUtils.isEmpty(propertyMap) && propertyMap.size() > 0) { + propertyMap.put(MesPcnExtConstWords.MODIFY_USER, reqBean.getUserInfo()); + propertyMap.put(MesPcnExtConstWords.MODIFY_DATE_TIME, (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date())); + propertyMap.put(MesPcnExtConstWords.SYSTEM_SYNC_STATUS, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); + propertyMap.put(MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME, MesPcnExtConstWords.EMPTY); + + String[] propertyName = new String[propertyMap.size()]; + Object[] propertyValue = new Object[propertyMap.size()]; + + Integer index = 0; + for (Map.Entry innerEntry : propertyMap.entrySet()) { + if (null == innerEntry) continue; + propertyName[index] = innerEntry.getKey(); + propertyValue[index] = innerEntry.getValue(); + index ++; + } + + workOrderRepository.updateByPropertiesNoSync(new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, new Object[]{productionPartContext.getId(), reqBean.getOrganizeCode()}, propertyName, propertyValue); + + log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:{}", + reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), + StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), productionPartContext.getWorkOrderNo(), JSONObject.toJSONString(propertyMap)); + + } } }