From be2a133e2b93a797f3a2a532dfa1f3b0285db40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Thu, 13 Jun 2024 17:54:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(ebom):=20=E4=BF=AE=E5=A4=8D=E6=9A=82?= =?UTF-8?q?=E5=AD=98=E5=92=8C=E6=8F=90=E4=BA=A4=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/service/domain/EBom/EBomEdit.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java index 7834db21..c91b8746 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java @@ -203,7 +203,6 @@ public class EBomEdit { //新增数据 if (child.getRowId() == null || child.getRowId() == 0) { child.setRowId(IdWorker.getId()); - child.setIdentityNo(StrUtil.join("_", parentEntity.getRowId(), child.getRowId())); child.setSource(source); child.setCreatedTime(LocalDateTime.now()); child.setCreatedBy(SessionUtil.getUserCode()); @@ -236,6 +235,7 @@ public class EBomEdit { } child.setInitialParentRowId(parentEntity.getRowId()); } + child.setIdentityNo(StrUtil.join("_", parentEntity.getRowId(), child.getRowId())); } @@ -275,17 +275,19 @@ public class EBomEdit { if (CollUtil.isEmpty(dto.getDatas())) { throw new NflgBusinessException(STATE.Error, "datas 数据不能为空"); } - - List materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); + List materialNos = dto.getDatas().stream() + .filter(f -> !StrUtil.equals(f.getProjectType(), BomConstant.PROJECT_TYPE_TEMPORARY, true)) + .map(BaseMaterialVO::getMaterialNo) + .collect(Collectors.toList()); if(materialNos.contains(dto.getParent().getMaterialNo())){ VUtils.isTure(true).throwMessage(StrUtil.format("上下级存在相同物料{}",dto.getParent().getMaterialNo())); } - materialNos.add(dto.getParent().getMaterialNo()); //检查物料编码是否在主数据中存在 //暂存不需检查,提交时检查 if(ObjectUtil.equal(EbomEditStatusEnum.HANDLER_FINISHED.getValue(),dto.getOpType())) { + materialNos.add(dto.getParent().getMaterialNo()); List materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos); - List effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); + List effectiveMaterialNos = materialBaseInfo.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList()); Set difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos)); VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料主数据中不存在"); }