From 09f0d666de3cea2a4748f846cd410c645efc8ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Thu, 11 Apr 2024 17:13:17 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=94=9F=E6=88=90=E8=99=9A=E6=8B=9F?= =?UTF-8?q?=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BomNewEbomParentService.java | 82 +++++++++++++++++++ .../domain/EBom/VirtualPackageBase.java | 2 +- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 51d3a0ea..04709f93 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -372,6 +372,88 @@ public class BomNewEbomParentService extends ServiceImpl getChildForVirtualPackage(Long rowId) { + BomNewEbomParentEntity parent = this.getBaseMapper().selectById(rowId); + + List parentChild = this.getBaseMapper().getParentChild(rowId); + //排除项目类别的赋值 + materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); + if (CollUtil.isNotEmpty(parentChild)) { + List materialNos = parentChild.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(materialNos)) { + List list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos) + .eq(BomNewEbomParentEntity::getLastVersionIs, 1).list(); + + Map bomListMap= list.parallelStream() + .collect(Collectors.toMap( + BomNewEbomParentEntity::getMaterialNo, // key: DrawingNo + Function.identity(), + BinaryOperator.maxBy(Comparator.comparing(BomNewEbomParentEntity::getCurrentVersion)) + )); +// Map bomListMap = ListCommonUtil.listToMap(list, BomNewEbomParentEntity::getMaterialNo); + for (BomNewEbomParentVO child : parentChild) { + if (bomListMap.containsKey(child.getMaterialNo())) { + BomNewEbomParentEntity parentEntity = bomListMap.get(child.getMaterialNo()); + + + child.setCurrentVersion(parentEntity.getCurrentVersion()); + child.setStatus(parentEntity.getStatus()); + child.setDeviseName(parentEntity.getDeviseName()); + child.setDeviseUserCode(parentEntity.getDeviseUserCode()); + + child.setCreatedTime(parentEntity.getCreatedTime()); + child.setBomRowId(parentEntity.getRowId()); + child.setLevelNum(parentEntity.getLevelNum()); + child.setDeptName(parentEntity.getDeptName()); + // child.setSource(parentEntity.getSource()); + child.setSourceRowId(parentEntity.getSourceRowId()); + child.setBomExist(parentEntity.getBomExist()); + child.setShouldBomExist(parentEntity.getShouldBomExist()); + child.setVirtualPackageIs(parentEntity.getVirtualPackageIs()); + child.setChangeDesc(parentEntity.getChangeDesc()); + child.setNoticeNums(parentEntity.getNoticeNums()); + child.setSuperMaterialStatus(parentEntity.getSuperMaterialStatus()); + + if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) { + child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue()); + } + // //非本人则为借用件 + // else if (!parentEntity.getCreatedBy().equals(child.getCreatedBy())) { + // child.setStatus(EBomStatusEnum.REFERENCE.getValue()); + // } + + } else { //无BOM-版本时 确定版本号 + + //child.setSource(Objects.nonNull(parent) ? parent.getSource() : EBomSourceEnum.FROM_BOM.getValue()); + child.setDeviseUserCode(parent.getDeviseUserCode()); + child.setDeviseName(parent.getDeviseName()); + child.setDeptName(parent.getDeptName()); + child.setStatus(parent.getStatus()); + child.setEditStatus(parent.getEditStatus()); + child.setVirtualPackageIs(parent.getVirtualPackageIs()); + child.setSuperMaterialStatus(parent.getSuperMaterialStatus()); + if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) { + child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION); + child.setStatus(parent.getStatus()); + // child.setEditStatus(OriginalEditStatusEnum.HANDLER_CREATED.getValue()); + } + + + } + } + } + } + //动态判断异常 + //CheckEBomExceptoinDynamic.check(parentChild); + return parentChild; + + } + public List getChildBatch(List rowIds) { List result = new ArrayList<>(); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/VirtualPackageBase.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/VirtualPackageBase.java index c56fbb33..0a4d9aac 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/VirtualPackageBase.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/VirtualPackageBase.java @@ -193,7 +193,7 @@ public abstract class VirtualPackageBase { * @return */ protected List getChild(){ - return SpringUtil.getBean(BomNewEbomParentService.class).getChild(bomRowId); + return SpringUtil.getBean(BomNewEbomParentService.class).getChildForVirtualPackage(bomRowId); } protected BomNewEbomParentEntity getParentZhiZuo(String inDrawingNo){