From 794721e1a02f5095875fcf3980845afc84bc4c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Wed, 22 May 2024 09:33:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(ebom):=20=E4=BF=AE=E5=A4=8D=E4=BB=8Eexcel?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=97=B6T=E9=A1=B9=E5=9B=BE=E5=8F=B7?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/service/EBomImportService.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 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 66301957..9fa7a53f 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 @@ -220,7 +220,7 @@ public class EBomImportService { if (Objects.isNull(dto.getNum())) { dto.setNum(BigDecimal.ONE); } - if (Objects.isNull(dto.getUnit())) { + if (StrUtil.isBlank(dto.getUnit())) { dto.setUnit("PC"); } } @@ -294,7 +294,10 @@ public class EBomImportService { List parents = new ArrayList<>(); List children = new ArrayList<>(); - List materialNos = datas.stream().map(EbomExcelDTO::getMaterialNo).collect(Collectors.toList()); + List materialNos = datas.stream() + .filter(d -> !StrUtil.equals(d.getProjectType(), BomConstant.PROJECT_TYPE_TEMPORARY, true)) + .map(EbomExcelDTO::getMaterialNo) + .collect(Collectors.toList()); materialNos.addAll(datas.stream().map(EbomExcelDTO::getParentMaterialNo).collect(Collectors.toList())); materialNos = materialNos.stream().distinct().collect(Collectors.toList()); List materialBaseInfos = materialMainService.getMaterialBaseInfo(materialNos); @@ -338,7 +341,7 @@ public class EBomImportService { .filter(m -> m.getMaterialNo().equals(child.getMaterialNo())) .findFirst() .orElse(null); - if (!Objects.isNull(vo)) { + if (Objects.nonNull(vo)) { child.setMaterialCategoryCode(vo.getMaterialCategoryCode()); child.setMaterialName(vo.getMaterialName()); child.setDrawingNo(vo.getDrawingNo()); @@ -379,7 +382,7 @@ public class EBomImportService { .filter(m -> m.getMaterialNo().equals(data.getParentMaterialNo())) .findFirst() .orElse(null); - if (!Objects.isNull(vo)) { + if (Objects.nonNull(vo)) { parent.setDrawingNo(vo.getDrawingNo()); parent.setUnitWeight(vo.getMaterialWeight()); parent.setMaterialName(vo.getMaterialName()); @@ -438,7 +441,7 @@ public class EBomImportService { .filter(m -> m.getMaterialNo().equals(materialNo)) .findFirst() .orElse(null); - if (!Objects.isNull(vo)) { + if (Objects.nonNull(vo)) { parent.setDrawingNo(vo.getDrawingNo()); parent.setUnitWeight(vo.getMaterialWeight()); parent.setMaterialName(vo.getMaterialName());