From 62a45210fdf9197118a0ffdd463c909fd4baa2f6 Mon Sep 17 00:00:00 2001 From: jun Date: Thu, 18 Jul 2024 14:56:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=B8=85=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/api/busi/IMesPartShippingGroupService.java | 3 +++ .../busi/MesInputDefectRecordService.java | 27 +++++++++++++++++----- .../busi/MesPartShippingGroupService.java | 7 ++++++ .../busi/MesShippingLoadingCheckService.java | 27 ++++++++++++++++++---- .../busi/MesSortShippingCheckService.java | 25 +++++++++++++++++--- .../serviceimpl/busi/MesSpotCheckOrderService.java | 7 ++++-- .../pojo/model/MesPartInspectionInputModel.java | 2 ++ 7 files changed, 83 insertions(+), 15 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPartShippingGroupService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPartShippingGroupService.java index c1575f8..02f55c0 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPartShippingGroupService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPartShippingGroupService.java @@ -17,4 +17,7 @@ public interface IMesPartShippingGroupService { @ApiOperation(value = "查询发运组数据") public List findAll(DdlPackBean packBean); + @ApiOperation(value = "查询发运组数据") + MesPartShippingGroup getMesPartShippingGroup(String organizeCode,String shippingGroupCode); + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java index 5d9f283..cc4f3f0 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java @@ -98,7 +98,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //检查物料 MesPart part; //获取NC-零件检测-单据 - MesPartInspection partInspection; + MesPartInspection partInspection = null; Integer sourceType = null; if (!StringUtils.isEmpty(inputModel.getSn())) { // 数据校验 @@ -125,7 +125,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService part = checkPartByPartNo(inputModel.getPartNo(), org); //获取NC-零件检测-单据 - partInspection = getPartInspectionByPartAndLot(inputModel, org); + if(!Objects.isNull(inputModel.getId())){ + partInspection = getPartInspectionByPartAndLot(inputModel, org); + } sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(); } @@ -332,16 +334,21 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspectionDetailRepository.saveAll(model.getPartInspectionDetailList()); + String srcLocateNo = null; //若是扫描条码 则判定条码可疑 if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { MesProduceSn produceSn = checkProduceSn(model.getSn(), org); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); produceSnExtService.update(produceSn); + //查询条码所在库位 + srcLocateNo = getDestLocateNo(model, org); + } + if (Objects.isNull(srcLocateNo)) { + srcLocateNo = configService.getCfgValue(org, "LGORT"); } - //移库 - MesMove move = createMove(model, configService.getCfgValue(org, "LGORT"), configService.getCfgValue(org, "UMLGO"), org); + MesMove move = createMove(model,srcLocateNo, configService.getCfgValue(org, "UMLGO"), org); moveRepository.save(move); } else { @@ -399,12 +406,19 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } } + private String getDestLocateNo(MesPartInspectionInputModel model, String org) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(model.getSn(), "productSn", packBean); + DdlPreparedPack.getOrderBy(null, null, packBean); + MesMove mesMove = moveRepository.getByProperty(packBean); + return Objects.isNull(mesMove) ? null : mesMove.getUmlgo(); + } + private MesMove getMesMove(MesPartInspectionInputModel model, String org) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getNumEqualPack(model.getPartInspection().getId(),"partInspectionId",packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE.getValue(),"moveType",packBean); - MesMove mesMove = moveRepository.getByProperty(packBean); - return mesMove; + return moveRepository.getByProperty(packBean); } /** @@ -438,6 +452,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService private MesPartInspection getPartInspectionByPartAndLot(MesPartInspectionInputModel inputModel, String org) { //根据扫描的条码查询条码是否存在 DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getNumEqualPack(inputModel.getId(), "id", packBean); DdlPreparedPack.getStringEqualPack(inputModel.getPartNo(), "partNo", packBean); DdlPreparedPack.getStringEqualPack(inputModel.getLotNo(), "lotNo", packBean); DdlPreparedPack.getNumEqualPack(inputModel.getQty().intValue(), "qty", packBean); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java index 31dbae5..452654e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java @@ -24,4 +24,11 @@ public class MesPartShippingGroupService implements IMesPartShippingGroupService return detailDeleteList; } + @Override + public MesPartShippingGroup getMesPartShippingGroup(String organizeCode, String shippingGroupCode) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringEqualPack(shippingGroupCode, "partShippingGroupCode", packBean); + return shippingGroupRepository.getByProperty(packBean); + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java index 2e63f96..7c705ba 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java @@ -10,6 +10,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.MesPartShippingGroup; import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingList; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingListDetail; @@ -23,9 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import java.util.*; /** * @Description : @@ -54,6 +53,9 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS @Autowired private MesJisShippingRepository jisShippingRepository; + @Autowired + private MesPartShippingGroupService mesPartShippingGroupService; + @Override public MesShippingLoadingCheckModel queryLoadingOrderNo(MesLoadingList loadingList) { @@ -139,15 +141,24 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS if (StringUtils.isEmpty(vehiclesOrderDetail)) { throw new ImppBusiException(String.format("【%s】此发运单不存在或还未生成装车单明细,请检查数据!", model.getShippingCode())); } + //查询零件发运组 + MesPartShippingGroup shippingGroup = getMesPartShippingGroup(org, loadingList.getPartShippingGroupCode()); //根据扫描的发运单以及前端传的发运单明细,进行匹配,若没有找到扫描的发运单,则提示扫描的发运单号不在此装车单中,请检查数据!。 Boolean scanflg = false; for (MesLoadingListDetail loadingListDetail : model.getDetailList()) { if (loadingListDetail.getShippingCode().equals(model.getShippingCode())) { - if (loadingListDetail.getTempStatus() == MesCommonConstant.TRUE_INTEGER) { + if (Objects.equals(loadingListDetail.getTempStatus(), MesCommonConstant.TRUE_INTEGER)) { throw new ImppBusiException(String.format("【%s】此发运单已经扫描过,请检查数据!", model.getShippingCode())); } + //校验发运单明细顺序 + if(CommonEnumUtil.VALID == shippingGroup.getIsEnableLoadingFailSafe()){ + Optional detail = model.getDetailList().stream().filter(k -> k.getShippingCode().compareTo(loadingListDetail.getShippingCode()) < 0 && !Objects.equals(k.getTempStatus(), MesCommonConstant.TRUE_INTEGER)).findFirst(); + if(detail.isPresent()){ + throw new ImppBusiException(String.format("装车单【%s】启用明细顺序防错,发运单【%s】前还有未扫描的发运单,请检查数据!", loadingList.getOrderCode(), model.getShippingCode())); + } + } //判断是否需要排序校验 默认排序则需要校验 if (loadingList.getScanSeqWay() == MesExtEnumUtil.SHIPPING_GROUP_SCAN_CONFIRM_SEQ_MODE.DEFAULT_SORT.getValue()) { @@ -232,6 +243,14 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS return model; } + private MesPartShippingGroup getMesPartShippingGroup(String org, String partShippingGroupCode) { + MesPartShippingGroup shippingGroup = mesPartShippingGroupService.getMesPartShippingGroup(org, partShippingGroupCode); + if(Objects.isNull(shippingGroup)){ + throw new ImppBusiException(String.format("零件发运组【%s】信息不存在,请检查数据!", partShippingGroupCode)); + } + return shippingGroup; + } + /** * 校验装车单 * 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 6d7ad12..b0f0bee 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 @@ -7,6 +7,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesSortShippingCheckService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.aspect.MonitorLog; import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingLoadingCheckModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSortShippingCheckModel; import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.tool.TimeTool; @@ -15,6 +16,7 @@ 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.MesJisShipping; +import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingList; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingListDetail; @@ -78,6 +80,9 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService @Autowired private MesCustomerPartRepository mesCustomerPartRepository; + @Autowired + private MesPartShippingGroupService mesPartShippingGroupService; + @Override public MesSortShippingCheckModel queryShippingOrderNo(MesShippingOrderManagement shippingOrderManagement) { @@ -209,13 +214,19 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService //校验发运单是否存在 MesShippingOrderManagement orderManagement = checkMesShippingOrderManagement(model, org); - - + //零件发运组 + MesPartShippingGroup shippingGroup = getMesPartShippingGroup(org, orderManagement.getShippingGroupCode()); //根据条码找到对应的物料号,若物料号一致,则修改扫描flg,将flg改为true. boolean scanFlg = false; for (MesShippingOrderManagementDetail detail : model.getDetailList()) { if (detail.getPartNo().equals(produceSn.getPartNo()) && StringUtils.isEmpty(detail.getBarcode())) { - + //校验发运单明细顺序 + if(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())); + } + } //判断是否需要排序校验 默认排序则需要校验 if (orderManagement.getScanSeqWay() == MesExtEnumUtil.SHIPPING_GROUP_SCAN_CONFIRM_SEQ_MODE.DEFAULT_SORT.getValue()) { @@ -332,6 +343,14 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService } + private MesPartShippingGroup getMesPartShippingGroup(String org, String partShippingGroupCode) { + MesPartShippingGroup shippingGroup = mesPartShippingGroupService.getMesPartShippingGroup(org, partShippingGroupCode); + if(Objects.isNull(shippingGroup)){ + throw new ImppBusiException(String.format("零件发运组【%s】信息不存在,请检查数据!", partShippingGroupCode)); + } + return shippingGroup; + } + private MesProduceSn checkSn(MesSortShippingCheckModel model, String org) { //校验条码是否重复扫描 Optional optional = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getBarcode()) && k.getBarcode().equals(model.getSn())).findFirst(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java index 0720a8a..065a163 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java @@ -100,13 +100,16 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { if(CollectionUtils.isEmpty(mesEquipmentSpotCheckList)){ return null; } - Map> mesEquipmentSpotCheckMap = mesEquipmentSpotCheckList.stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getEquipCode)); + Map> mesEquipmentSpotCheckMap = mesEquipmentSpotCheckList.stream().filter(t->!StringUtils.isEmpty(t.getEquipCode())).collect(Collectors.groupingBy(MesEquipmentSpotCheck::getEquipCode)); + if(Objects.isNull(mesEquipmentSpotCheckMap)){ + return null; + } List mesEquipmentSpotCheckModelList = new ArrayList<>(); for (Map.Entry> mesEquipmentSpotCheckEntry : mesEquipmentSpotCheckMap.entrySet()) { MesEquipmentSpotCheck next = mesEquipmentSpotCheckEntry.getValue().iterator().next(); MesEquipmentSpotCheckModel mesEquipmentSpotCheckModel = new MesEquipmentSpotCheckModel(); BeanUtils.copyProperties(next,mesEquipmentSpotCheckModel); - Map> listMap = mesEquipmentSpotCheckEntry.getValue().stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getSpotCheckOrderType)); + Map> listMap = mesEquipmentSpotCheckEntry.getValue().stream().filter(t->!StringUtils.isEmpty(t.getSpotCheckOrderType())).collect(Collectors.groupingBy(MesEquipmentSpotCheck::getSpotCheckOrderType)); for (Map.Entry> entry : listMap.entrySet()) { MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel mesEquipmentSpotCheckDataModel = new MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel(); mesEquipmentSpotCheckDataModel.setSpotCheckOrderType(entry.getKey()); diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java index edcad96..0267209 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java @@ -18,6 +18,8 @@ import java.util.List; @Data public class MesPartInspectionInputModel { + @ApiParam("NC-零件检测-单据id") + private Long id; @ApiParam("物料") private MesPartSap part;