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()); } } }