From 96f7923e26d566a10e2d21e2fd204df55ee13f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Thu, 5 Sep 2024 19:45:41 +0800 Subject: [PATCH] =?UTF-8?q?PBOM=E5=8F=91=E5=B8=83=E6=97=B6=EF=BC=8Cpbom?= =?UTF-8?q?=E5=9C=A8=E5=B7=A5=E4=BD=9C=E8=A1=A8=E6=97=B6=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BA=BA=E4=B8=BA=E6=9C=AC=E4=BA=BA=E6=88=96?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=A4=A7=E4=BA=8E=E5=BD=93=E5=89=8D=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=88=99=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/domain/EBom/EBomToPbomBase.java | 6 ++++-- .../EBom/topbomnew/FormalEBomToPbomBase.java | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPbomBase.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPbomBase.java index 3afeef20..189b47b2 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPbomBase.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPbomBase.java @@ -85,7 +85,7 @@ public abstract class EBomToPbomBase { //当子级为F项或Z项时-无需转的父级物料 protected Set childDelMaterialNos = new HashSet<>(); - private BomNewPbomParentEntity ; + public abstract void convert(); @@ -188,6 +188,8 @@ public abstract class EBomToPbomBase { else if (Objects.nonNull(oldParent) && oldParent.getStatus() < EBomStatusEnum.PUBLISHED.getValue()) { //if (oldParent.getCreatedBy().equals(parentVo.getCreatedBy())) { if (ConvertToPBomModelEnum.OVERRIDE.equalsValue(convertMode.getValue())) { + //当bom创建人为本人 或 版本大于当前版本则覆盖 + if (oldParent.getCreatedBy().equals(parentVo.getCreatedBy()) || VersionUtil.compare(parentVo.getCurrentVersion(),oldParent.getCurrentVersion())>0){ SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId())); // this.delParentRowIds.add(oldParent.getRowId()); oldParent.setSourceRowId(parentVo.getBomRowId()); @@ -197,7 +199,7 @@ public abstract class EBomToPbomBase { oldParent.setDeptRowId(SessionUtil.getDepartRowId()); this.pBomParentResult.add(oldParent); return oldParent; - // } + } } else { // 降parentVo 及其子节点标记为不转换 diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/topbomnew/FormalEBomToPbomBase.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/topbomnew/FormalEBomToPbomBase.java index b0e239af..94674102 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/topbomnew/FormalEBomToPbomBase.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/topbomnew/FormalEBomToPbomBase.java @@ -192,14 +192,16 @@ public abstract class FormalEBomToPbomBase { else if (Objects.nonNull(oldParent) && oldParent.getStatus() < EBomStatusEnum.PUBLISHED.getValue()) { //if (oldParent.getCreatedBy().equals(parentVo.getCreatedBy())) { if (ConvertToPBomModelEnum.OVERRIDE.equalsValue(convertMode.getValue())) { - SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId())); - oldParent.setSourceRowId(parentVo.getBomRowId()); - oldParent.setCreatedTime(LocalDateTime.now()); - oldParent.setCreatedBy(SessionUtil.getUserCode()); - oldParent.setDeptName(SessionUtil.getDepartName()); - oldParent.setDeptRowId(SessionUtil.getDepartRowId()); - this.pBomParentResult.add(oldParent); - return oldParent; + if (oldParent.getCreatedBy().equals(parentVo.getCreatedBy()) || VersionUtil.compare(parentVo.getCurrentVersion(),oldParent.getCurrentVersion())>0) { + SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId())); + oldParent.setSourceRowId(parentVo.getBomRowId()); + oldParent.setCreatedTime(LocalDateTime.now()); + oldParent.setCreatedBy(SessionUtil.getUserCode()); + oldParent.setDeptName(SessionUtil.getDepartName()); + oldParent.setDeptRowId(SessionUtil.getDepartRowId()); + this.pBomParentResult.add(oldParent); + return oldParent; + } } else { // 降parentVo 及其子节点标记为不转换