From b335bdd105838bbd23a0a1d0856fb539eb6981ef Mon Sep 17 00:00:00 2001 From: "castle.zang" Date: Wed, 25 Dec 2024 17:23:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=2044253=20=20=E5=90=8CPis?= =?UTF-8?q?ces=EF=BC=8C=E9=9B=B6=E4=BB=B6=E5=8F=91=E8=BF=90=E7=BB=84/?= =?UTF-8?q?=E5=8F=91=E8=BF=90=E7=BB=84=E6=98=8E=E7=BB=86=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E2=80=9C=E5=89=8D=E9=81=93=E5=B7=A5=E8=89=BA?= =?UTF-8?q?=E2=80=9D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/api/busi/IMesPartShippingGroupService.java | 3 ++ .../pcn/api/busi/IMesProductionRecordService.java | 3 ++ .../busi/MesPartShippingGroupService.java | 9 ++++ .../busi/MesProductionRecordService.java | 8 ++++ .../busi/MesSortShippingCheckService.java | 51 ++++++++++++++++++++++ .../MesShippingScanSnStrategyServiceImpl.java | 2 + 6 files changed, 76 insertions(+) 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 8599268..b9f9224 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 @@ -27,4 +27,7 @@ public interface IMesPartShippingGroupService { @ApiOperation(value = "发运组明细") MesPartShippingGroupDetail getMesPartShippingGroupDetail(String organizeCode, String shippingGroupCode, String partNo, String custPartNo); + + @ApiOperation(value = "发运组明细") + MesPartShippingGroupDetail getMesPartShippingGroupDetailByPartNo(String organizeCode, String shippingGroupCode, String partNo); } diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionRecordService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionRecordService.java index 3717001..c1f213b 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionRecordService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionRecordService.java @@ -19,6 +19,9 @@ public interface IMesProductionRecordService { @ApiOperation(value = "根据零件条码查询加工记录信息") List findProductionRecordList(String organizeCode, String productSn); + @ApiOperation(value = "根据零件条码和工艺查询加工记录") + Integer findFrontProcessProductionRecord(String organizeCode, String productSn,String craftCode); + @ApiOperation(value = "查询加工记录, 根据完成时间倒序") List findProductionRecordListCompleteDateTimeDesc(String organizeCode, String productSn); 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 9a00b89..22efbbf 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 @@ -94,4 +94,13 @@ public class MesPartShippingGroupService implements IMesPartShippingGroupService DdlPreparedPack.getStringEqualPack(custPartNo, "custPartNo", packBean); return mesPartShippingGroupDetailRepository.getByProperty(packBean); } + + @Override + public MesPartShippingGroupDetail getMesPartShippingGroupDetailByPartNo(String organizeCode, String shippingGroupCode, String partNo) { + if(StringUtil.isEmpty(organizeCode) || StringUtil.isEmpty(shippingGroupCode) || StringUtil.isEmpty(partNo)) return null; + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringEqualPack(shippingGroupCode, "shippingGroupCode", packBean); + DdlPreparedPack.getStringEqualPack(partNo, "partNo", packBean); + return mesPartShippingGroupDetailRepository.getByProperty(packBean); + } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProductionRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProductionRecordService.java index 37a5864..f94eaa6 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProductionRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProductionRecordService.java @@ -67,6 +67,14 @@ public class MesProductionRecordService implements IMesProductionRecordService { new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), productSn}); } + @Override + public Integer findFrontProcessProductionRecord(String organizeCode, String productSn, String craftCode) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(productSn) || StringUtils.isEmpty(craftCode)) return null; + return productionRecordRepository.findByPropertyCount( + new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.PRODUCT_SN, MesPcnExtConstWords.CRAFT_CODE}, + new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), productSn, craftCode}); + } + //查询加工记录, 根据完成时间倒序 @Override public List findProductionRecordListCompleteDateTimeDesc(String organizeCode, String productSn) { 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 c96d81a..d55d0c3 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 @@ -159,6 +159,23 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService skipShippingDetails(model, model.getUserInfo(), orderManagement); //扫描条码 } else { + /** + * 修复bug 44253 by castle 同Pisces,零件发运组/发运组明细可以实现“前道工艺”校验 + * 逻辑: + * + * 1.查询零件发运组 + * + * 2.查询对应零件发运组详情 + * + * 3.根据条码查询有没有在条码表中,用于判断是自制件,有则为自制件 + * + * 4.自制件需要查看明细是否维护了 前道工艺,如果维护了则需要校验前道工艺有没有加工记录;如果明细没有维护,则找零件发运组是否维护了,维护则需要校验;两者都没有维护,则不需要校验 + * + * 5.外协件不需要校验前道工艺 + */ + if(!checkFrontProcess(model, shippingGroup)){ + MesPcnException.throwMesBusiException("条码【%s】前道校验未通过,请检查数据",model.getSn()); + } if (StringUtils.isEmpty(shippingGroup.getConfirmPartType())) { MesPcnException.throwMesBusiException("零件发运组【%s】扫描确认方式未维护,请检查数据!"); } @@ -174,6 +191,40 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService return model; } + private boolean checkFrontProcess(MesSortShippingCheckModel model,MesPartShippingGroup shippingGroup){ + boolean flag = false; + String organizeCode = model.getOrganizeCode(); + //1.首先校验自制件 + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringEqualPack(model.getSn(), "productSn", packBean); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); + MesProduceSn produceSn = produceSnRepository.getByProperty(packBean); + + if (Objects.isNull(produceSn)) { + //外协件不需要校验前道工艺 + flag = true; + }else{ + //自制件校验前道工艺 零件发运组详情中的优先 + MesPartShippingGroupDetail groupDetail = mesPartShippingGroupService.getMesPartShippingGroupDetailByPartNo(organizeCode, shippingGroup.getShippingGroupCode(), produceSn.getPartNo()); + if (!StringUtils.isEmpty(groupDetail.getFrontProcessCode())){ + Integer count = mesProductionRecordService.findFrontProcessProductionRecord(organizeCode, produceSn.getProductSn(), groupDetail.getFrontProcessCode()); + if (count > 0){ + flag = true; + } + }else if (!StringUtils.isEmpty(shippingGroup.getFrontProcessCode())){ + Integer count = mesProductionRecordService.findFrontProcessProductionRecord(organizeCode, produceSn.getProductSn(), shippingGroup.getFrontProcessCode()); + if (count > 0){ + flag = true; + } + }else { + //如果都没有 + flag = true; + } + } + return flag; + } + + @Override public MesSortShippingCheckModel saveSnAndLocationCode(MesSortShippingCheckModel model, String organizeCode, String userInfo) { //校验条码 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 d4446d5..64ad98a 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 @@ -92,6 +92,8 @@ public class MesShippingScanSnStrategyServiceImpl implements IMesShippingScanStr } private void checkShippingDetails(MesSortShippingCheckModel model, MesShippingOrderManagement orderManagement, MesPartShippingGroup shippingGroup, MesProduceSn produceSn, 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();