From d9c2b6c8b19b427c4faccd5b116c0cffea42562c Mon Sep 17 00:00:00 2001 From: "logic.fang" Date: Sun, 9 Mar 2025 18:35:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?45550=20PDA-MES-PDA=E5=8F=91=E8=BF=90?= =?UTF-8?q?=E6=89=AB=E6=8F=8F=E6=8E=92=E5=BA=8F=E6=96=B9=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busi/MesSortShippingCheckService.java | 17 ++++++++- ...sShippingScanSnAndOrderStrategyServiceImpl.java | 41 ++++++++++++++++------ .../MesShippingScanSnStrategyServiceImpl.java | 28 +++++++++++++-- .../mes/pcn/pojo/constant/MesCommonConstant.java | 2 ++ 4 files changed, 73 insertions(+), 15 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java index 23e022c..ad80669 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java @@ -117,6 +117,9 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService @Autowired private IMesProduceSnExtService mesProduceSnExtService; + @Autowired + private IMesConfigService mesConfigService; + @Override public MesSortShippingCheckModel doShippingOrderNoQuery(MesShippingOrderManagement shippingOrderManagement) { //校验发运单 @@ -368,10 +371,22 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService } private List getMesShippingOrderManagementDetails(MesShippingOrderManagement orderManagement,MesPartShippingGroup mesPartShippingGroup) { + //45550 PDA-MES-PDA发运扫描排序方式修改 + List shippingBusiSoftCfgList = mesConfigService.getConfigList(orderManagement.getOrganizeCode(), + MesCommonConstant.SHIPPING_BUSI_SOFT_CFG, mesPartShippingGroup.getShippingGroupCode(), null); DdlPackBean orderDetailPackBean = DdlPackBean.getDdlPackBean(orderManagement.getOrganizeCode()); DdlPreparedPack.getNumEqualPack(orderManagement.getId(), "pid", orderDetailPackBean); DdlPreparedPack.getNumberSmallerPack(MesExtEnumUtil.SHIPPING_ORDER_DETAIL_SHIPPING_STATUS.CLOSE.getValue(),"status",orderDetailPackBean); - DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"custInfoSeq"}, orderDetailPackBean); + if (CollectionUtils.isEmpty(shippingBusiSoftCfgList)) { + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"custInfoSeq"}, orderDetailPackBean); + }else { + MesConfig mesConfig = shippingBusiSoftCfgList.get(0); + if (!Objects.isNull(mesConfig) && + !StringUtils.isEmpty(mesConfig.getCfgValue()) && + "logic_seq".equals(mesConfig.getCfgValue())) { + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"logicSeq"}, orderDetailPackBean); + } + } List detailList = shippingOrderManagementDetailRepository.findByHqlWhere(orderDetailPackBean); if(CollectionUtils.isEmpty(detailList)){ throw new ImppBusiException(String.format("发运单【%s】明细信息不存在,请检查数据!", orderManagement.getShippingCode())); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java index 2b4dc04..4f2bbc9 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java @@ -1,9 +1,6 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.shippingscan.strategy; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesCustomerSnTransformService; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEmergencyLocationService; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderExtService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.*; import cn.estsh.i3plus.ext.mes.pcn.apiservice.aspect.MonitorLog; import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.shippingscan.IMesShippingScanStrategyService; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; @@ -14,6 +11,7 @@ import cn.estsh.i3plus.platform.common.tool.TimeTool; 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.MesConfig; import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder; @@ -28,12 +26,10 @@ import cn.estsh.impp.framework.boot.exception.ImppBusiException; import groovy.util.logging.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.util.Comparator; -import java.util.Objects; -import java.util.Optional; -import java.util.StringJoiner; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -71,6 +67,9 @@ public class MesShippingScanSnAndOrderStrategyServiceImpl implements IMesShippin @Autowired private IMesCustomerSnTransformService mesCustomerSnTransformService; + @Autowired + private IMesConfigService mesConfigService; + @Override public MesSortShippingCheckModel doScan(MesSortShippingCheckModel model, MesShippingOrderManagement orderManagement, MesPartShippingGroup shippingGroup) { final String barcode = mesCustomerSnTransformService.transformBarCodeGm(model.getSn()); @@ -169,9 +168,29 @@ public class MesShippingScanSnAndOrderStrategyServiceImpl implements IMesShippin private void checkShippingDetails(MesSortShippingCheckModel model, MesShippingOrderManagement orderManagement, MesPartShippingGroup shippingGroup, String partNo, MesShippingOrderManagementDetail detail) { //校验发运单明细顺序 if (!Objects.isNull(shippingGroup) && !StringUtils.isEmpty(shippingGroup.getIsEnableShippingFailSafe()) && CommonEnumUtil.VALID == shippingGroup.getIsEnableShippingFailSafe()) { - Optional first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); - if (first.isPresent()) { - throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + //45550 PDA-MES-PDA发运扫描排序方式修改 + List shippingBusiSoftCfgList = mesConfigService.getConfigList(orderManagement.getOrganizeCode(), + MesCommonConstant.SHIPPING_BUSI_SOFT_CFG, shippingGroup.getShippingGroupCode(), null); + if (CollectionUtils.isEmpty(shippingBusiSoftCfgList)) { + Optional first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); + if (first.isPresent()) { + throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + } + }else { + MesConfig mesConfig = shippingBusiSoftCfgList.get(0); + if (!Objects.isNull(mesConfig) && + !StringUtils.isEmpty(mesConfig.getCfgValue()) && + "logic_seq".equals(mesConfig.getCfgValue())) { + Optional first = model.getDetailList().stream().filter(k -> k.getLogicSeq().compareTo(detail.getLogicSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); + if (first.isPresent()) { + throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + } + }else { + Optional first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); + if (first.isPresent()) { + throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + } + } } } //判断是否需要排序校验 默认排序则需要校验 diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnStrategyServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnStrategyServiceImpl.java index 40e0dce..f836399 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnStrategyServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnStrategyServiceImpl.java @@ -13,6 +13,7 @@ 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.base.util.StringUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesConfig; import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup; import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroupDetail; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; @@ -28,6 +29,7 @@ import cn.estsh.impp.framework.boot.util.SpringContextsUtil; import groovy.util.logging.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.util.Comparator; @@ -97,9 +99,29 @@ public class MesShippingScanSnStrategyServiceImpl implements IMesShippingScanStr //校验发运单明细顺序 if (!Objects.isNull(shippingGroup) && !StringUtils.isEmpty(shippingGroup.getIsEnableShippingFailSafe()) && CommonEnumUtil.VALID == shippingGroup.getIsEnableShippingFailSafe()) { - Optional first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); - if (first.isPresent()) { - throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + //45550 PDA-MES-PDA发运扫描排序方式修改 + List shippingBusiSoftCfgList = mesConfigService.getConfigList(orderManagement.getOrganizeCode(), + MesCommonConstant.SHIPPING_BUSI_SOFT_CFG, shippingGroup.getShippingGroupCode(), null); + if (CollectionUtils.isEmpty(shippingBusiSoftCfgList)) { + Optional first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); + if (first.isPresent()) { + throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + } + }else { + MesConfig mesConfig = shippingBusiSoftCfgList.get(0); + if (!Objects.isNull(mesConfig) && + !StringUtils.isEmpty(mesConfig.getCfgValue()) && + "logic_seq".equals(mesConfig.getCfgValue())) { + Optional first = model.getDetailList().stream().filter(k -> k.getLogicSeq().compareTo(detail.getLogicSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); + if (first.isPresent()) { + throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + } + }else { + Optional first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); + if (first.isPresent()) { + throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + } + } } } //判断是否需要排序校验 默认排序则需要校验 diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/constant/MesCommonConstant.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/constant/MesCommonConstant.java index 23b074f..455530b 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/constant/MesCommonConstant.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/constant/MesCommonConstant.java @@ -32,5 +32,7 @@ public class MesCommonConstant { //报工条码规则 public static final String REPORT_SN = "REPORT_SN"; + //PDA发运校验-排序字段参数配置 + public static final String SHIPPING_BUSI_SOFT_CFG = "SHIPPING_BUSI_SOFT_CFG"; } From 5dd7bb7eeed48abb4990dac5b183ba00c8782bcc Mon Sep 17 00:00:00 2001 From: "logic.fang" Date: Sun, 9 Mar 2025 20:54:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?45550=20PDA-MES-PDA=E5=8F=91=E8=BF=90?= =?UTF-8?q?=E6=89=AB=E6=8F=8F=E6=8E=92=E5=BA=8F=E6=96=B9=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=88=E5=BA=8F=E5=8F=B7=E6=8F=90=E7=A4=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java | 2 +- .../shippingscan/strategy/MesShippingScanSnStrategyServiceImpl.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/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java index 4f2bbc9..6b624d1 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java @@ -183,7 +183,7 @@ public class MesShippingScanSnAndOrderStrategyServiceImpl implements IMesShippin "logic_seq".equals(mesConfig.getCfgValue())) { Optional first = model.getDetailList().stream().filter(k -> k.getLogicSeq().compareTo(detail.getLogicSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); if (first.isPresent()) { - throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getLogicSeq())); } }else { Optional first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnStrategyServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnStrategyServiceImpl.java index f836399..dca8099 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnStrategyServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnStrategyServiceImpl.java @@ -114,7 +114,7 @@ public class MesShippingScanSnStrategyServiceImpl implements IMesShippingScanStr "logic_seq".equals(mesConfig.getCfgValue())) { Optional first = model.getDetailList().stream().filter(k -> k.getLogicSeq().compareTo(detail.getLogicSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); if (first.isPresent()) { - throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getLogicSeq())); } }else { Optional first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst();