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"; }