From a54b18684532d1d4b4e97ce1c3ca6d8164af1728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 14 Jun 2024 14:12:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(ebom):=20=E4=BB=8Eexcel=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4=EF=BC=88=E6=97=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=98=AF=E6=AD=A3=E5=BC=8F=E8=A1=A8=E5=88=99=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=B0=8F=E7=89=88=E6=9C=AC=EF=BC=9B=E6=97=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=98=AF=E5=B7=A5=E4=BD=9C=E8=A1=A8=E4=B8=94=E6=98=AF?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E4=BA=BA=E5=88=9B=E5=BB=BA=E5=88=99=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E6=97=A7=E7=89=88=E6=9C=AC=E6=98=AF=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E8=A1=A8=E4=B8=94=E6=98=AF=E8=87=AA=E5=B7=B1=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=88=99=E8=A6=86=E7=9B=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bomnew/service/EBomImportService.java | 21 +++++++++++++++++-- .../mapper/master/BomNewEbomParentMapper.xml | 8 +++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/EBomImportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/EBomImportService.java index 6c4fc889..c9abccf4 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/EBomImportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/EBomImportService.java @@ -75,7 +75,8 @@ public class EBomImportService { List importRoots = pcs.getLeft().stream().filter(BomNewEbomParentEntity::isImportRoot).collect(Collectors.toList()); //VUtils.isTure(importRoots.size() > 1).throwMessage("不支持一次导入多个bom"); importRoots.forEach(it -> { - VUtils.isTure(checkInconsistentData(pcs.getLeft().get(0), pcs.getLeft(), pcs.getRight())).throwMessage("导入的数据已存在,请勿重复导入"); + //VUtils.isTure(checkInconsistentData(pcs.getLeft().get(0), pcs.getLeft(), pcs.getRight())).throwMessage("导入的数据已存在,请勿重复导入"); + checkData(it, pcs.getLeft(), pcs.getRight()); }); save(pcs.getLeft(), pcs.getRight()); @@ -110,7 +111,7 @@ public class EBomImportService { }); } else { parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> { - it.setCurrentVersion(VersionUtil.getNextVersion(p.getCurrentVersion())); + it.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(p.getCurrentVersion())); }); } }); @@ -119,6 +120,22 @@ public class EBomImportService { bomNewEbomChildService.saveBatch(children); } + private void checkData(BomNewEbomParentEntity parent, List parents, List children) { + log.debug("checkData,entity:" + JSON.toJSONString(parent)); + BomNewEbomParentEntity oldParent = bomNewEbomParentService.getLatestByMaterialNo(parent.getMaterialNo()); + if (Objects.nonNull(oldParent)) { + VUtils.isTure(oldParent.getStatus() < EBomStatusEnum.PUBLISHED.getValue() + && !StrUtil.equals(parent.getCreatedBy(), SessionUtil.getUserCode())) + .throwMessage(StrUtil.format("{}正由{}编辑中,请联系Ta处理", oldParent.getMaterialNo(), oldParent.getCreatedBy())); + } + Set cmn = children.stream() + .filter(c -> c.getParentRowId().equals(parent.getRowId())) + .map(BomNewEbomChildEntity::getMaterialNo) + .collect(Collectors.toSet()); + List cps = parents.stream().filter(p -> cmn.contains(p.getMaterialNo())).collect(Collectors.toList()); + cps.forEach(ps -> checkData(ps, parents, children)); + } + private boolean checkInconsistentData(BomNewEbomParentEntity parent, List parents, List children) { log.debug("checkInconsistentData,entity:" + JSON.toJSONString(parent)); diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml index 9fceb804..0037e75c 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml +++ b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml @@ -532,12 +532,12 @@