From e3fc5b236105601a7fb5f54eb33547e097ddfb34 Mon Sep 17 00:00:00 2001 From: 10001392 <1055202292@qq.com> Date: Wed, 16 Oct 2024 17:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=90=88=E5=B9=B6test?= =?UTF-8?q?=E4=B8=8A=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=9A=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=B2=97=E7=94=A8=E6=88=B7=E5=8F=AF=E7=BB=B4=E6=8A=A4=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=9A=84=E6=95=B0=E6=8D=AE=EF=BC=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E5=8C=85=E6=8B=AC=EF=BC=88=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?Bom=E3=80=81sap=20=E3=80=81excel=E3=80=81mdm=E3=80=81=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BomNewEbomParentService.java | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) 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 c0dcce20..5897fb45 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 @@ -2425,7 +2425,7 @@ public class BomNewEbomParentService extends ServiceImpl delChildList = SpringUtil.getBean(BomNewEbomChildService.class).list(queryChildWrapper); - List delTagList = new ArrayList<>(); + List deletingTagList = new ArrayList<>(); //检查原始bom里过来数据是否包含正常数据 // List check1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource()) @@ -2448,30 +2448,34 @@ public class BomNewEbomParentService extends ServiceImpl s1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource()) - && !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(s1List)) { - delTagList.addAll(s1List); - } + //原始bom不正常 , + //24/10/15需求变更原始bom正常数据可删除 +// List toDel1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource()) +// && !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList()); +// if (CollectionUtil.isNotEmpty(s1List)) { +// delTagList.addAll(s1List); +// } //手动创建 - List s2List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_EXCE.getValue(), u.getSource()) - || Objects.equals(EBomSourceEnum.FROM_MDM.getValue(), u.getSource()) - || Objects.equals(EBomSourceEnum.FROM_CHANGE.getValue(), u.getSource()) - - ).collect(Collectors.toList()); + //可删数据来源包含全部 +// List toDel2List = delChildList.stream().filter(u -> +// Objects.equals(EBomSourceEnum.FROM_EXCE.getValue(), u.getSource()) +// || Objects.equals(EBomSourceEnum.FROM_MDM.getValue(), u.getSource()) +// || Objects.equals(EBomSourceEnum.FROM_CHANGE.getValue(), u.getSource()) +// || Objects.equals(EBomSourceEnum.FROM_SAP.getValue(), u.getSource()) +// || Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource()) +// ).collect(Collectors.toList()); //工艺岗可以删自己的和设计岗(手动、excel), // 设计自己删除自己 //工艺岗用户1 可以删工艺岗用户2 的数据? - if (CollectionUtil.isNotEmpty(s2List)) { + if (CollectionUtil.isNotEmpty(delChildList)) { for (BomNewEbomChildEntity vo : - s2List) { + delChildList) { if (userRoleService.technician()) { //工艺岗可删 - delTagList.add(vo); + deletingTagList.add(vo); } else if (userRoleService.designer() && vo.getCreatedBy().equals(SessionUtil.getUserCode())) { //自己的数据可删 - delTagList.add(vo); + deletingTagList.add(vo); } else { throw new NflgBusinessException(STATE.Error, StrUtil.format("{}数据不是你的,无权删除", vo.getMaterialNo())); @@ -2479,12 +2483,12 @@ public class BomNewEbomParentService extends ServiceImpl rowIdList = delTagList.stream().map(BomNewEbomChildEntity::getRowId).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(deletingTagList)) { + List rowIdList = deletingTagList.stream().map(BomNewEbomChildEntity::getRowId).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(rowIdList)) { ebomChildService.removeByIds(rowIdList); //将对应的parent设置为根节点 - setRootIs1(delTagList.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()), SessionUtil.getUserCode()); + setRootIs1(deletingTagList.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()), SessionUtil.getUserCode()); } } }