|
|
|
@ -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,11 +168,31 @@ 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()) {
|
|
|
|
|
//45550 PDA-MES-PDA发运扫描排序方式修改
|
|
|
|
|
List<MesConfig> shippingBusiSoftCfgList = mesConfigService.getConfigList(orderManagement.getOrganizeCode(),
|
|
|
|
|
MesCommonConstant.SHIPPING_BUSI_SOFT_CFG, shippingGroup.getShippingGroupCode(), null);
|
|
|
|
|
if (CollectionUtils.isEmpty(shippingBusiSoftCfgList)) {
|
|
|
|
|
Optional<MesShippingOrderManagementDetail> 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<MesShippingOrderManagementDetail> 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.getLogicSeq()));
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
Optional<MesShippingOrderManagementDetail> 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()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//判断是否需要排序校验 默认排序则需要校验
|
|
|
|
|
if (!StringUtils.isEmpty(orderManagement.getScanSeqWay()) && orderManagement.getScanSeqWay() == MesExtEnumUtil.SHIPPING_GROUP_SCAN_CONFIRM_SEQ_MODE.SHIPPING_GROUP_SCAN_CONFIRM_SEQ_MODE_10.getValue()) {
|
|
|
|
|
//获取明细中最小的
|
|
|
|
|