From adf65265ba60f6bd2ded1748adaac22d84d82f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Thu, 9 May 2024 08:34:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0sap=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java | 3 +++ .../com/nflg/product/bomnew/pojo/vo/BomNewPbomParentVO.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java index bb0cc756..e0e45eb4 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java @@ -328,6 +328,9 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable { @ApiModelProperty(value = "待复核根节点") private Integer rootIsForWaitReview; + @ApiModelProperty(value = "导入SAP状态") + private Integer sapState; + private List childNodes = Collections.emptyList(); private static final long serialVersionUID = 1L; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewPbomParentVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewPbomParentVO.java index 0a9daed6..147bb8d0 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewPbomParentVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewPbomParentVO.java @@ -263,6 +263,9 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable { @ApiModelProperty("层级数字") private BigDecimal levelNumber; + @ApiModelProperty(value = "导入SAP状态") + private Integer sapState; + private String levelNo; From 4b706e9ec28d5e34c1cf51556e61b37db564e24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Thu, 9 May 2024 09:35:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(ebom):=20=E8=99=9A=E6=8B=9F=E5=8C=85?= =?UTF-8?q?=E7=9A=84child=E7=9A=84=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E8=B7=9F=E7=88=B6=E7=BA=A7=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bomnew/service/domain/EBom/VirtualPackageBase.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/VirtualPackageBase.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/VirtualPackageBase.java index f673675a..640f8590 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/VirtualPackageBase.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/VirtualPackageBase.java @@ -6,7 +6,10 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.nflg.product.base.core.conmon.util.SessionUtil; -import com.nflg.product.bomnew.constant.*; +import com.nflg.product.bomnew.constant.EBomSourceEnum; +import com.nflg.product.bomnew.constant.EBomStatusEnum; +import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum; +import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum; import com.nflg.product.bomnew.pojo.dto.AddVirtrualMaterialDTO; import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity; import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity; @@ -177,7 +180,7 @@ public abstract class VirtualPackageBase { childEntity.setIdentityNo(parent.getRowId().toString()); childEntity.setOrderNumber(orderNo); childEntity.setNum(new BigDecimal(1)); - childEntity.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue()); + childEntity.setEditStatus(parent.getEditStatus()); childEntity.setSource(EBomSourceEnum.FROM_MDM.getValue()); childEntity.setVirtualPartType(virtualPackageTypeEnum.getValue()); childEntity.setProjectType("L"); From da8e40c8bd37994664ea29e2b48800318b93e315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 10 May 2024 17:30:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(dqbom):=20=E4=BF=AE=E5=A4=8D=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E7=9A=84=E6=95=B0=E6=8D=AE=E9=87=8D=E5=A4=8D=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/mapper/master/BomNewDQbomParentMapper.java | 2 +- .../java/com/nflg/product/bomnew/service/DQBomService.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewDQbomParentMapper.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewDQbomParentMapper.java index 777f1439..f6c72489 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewDQbomParentMapper.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewDQbomParentMapper.java @@ -22,7 +22,7 @@ public interface BomNewDQbomParentMapper extends BaseMapper getChildren(Long bomRowId); + // List getChildren(Long bomRowId); List getBom(int status, String materialNo, String drawingNo, String materialName); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java index 3c0d20cd..5b917b99 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java @@ -375,7 +375,8 @@ public class DQBomService { private void getChildren(List datas, BomNewDQbomVO parent) { if (Objects.isNull(parent) || parent.getBomRowId() == 0) return; - List cc = dQBomParentService.getBaseMapper().getChildren(parent.getBomRowId()); + //List cc = dQBomParentService.getBaseMapper().getChildren(parent.getBomRowId()); + List cc = getChild(parent.getBomRowId()); if (CollUtil.isNotEmpty(cc)) { cc.forEach(c -> { c.setParentMaterialNo(parent.getMaterialNo()); From d43c9153c9177e5ce8c14f500c6eb778e54c1d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Thu, 16 May 2024 11:35:47 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat(dqbom):=20=E4=BB=8Eexcel=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=97=B6=E5=A6=82=E6=9E=9C=E7=BC=96=E5=8F=B7=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=EF=BC=8C=E5=9B=BE=E5=8F=B7=E4=B8=8D=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E7=BC=96=E5=8F=B7=E4=BD=BF=E7=94=A8=E4=B8=BB?= =?UTF-8?q?=E7=89=A9=E6=96=99=E7=BC=96=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bomnew/service/DQBomImportService.java | 60 +++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomImportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomImportService.java index 69642e0c..251ef872 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomImportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomImportService.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.fasterxml.jackson.core.JsonProcessingException; @@ -14,6 +15,7 @@ import com.nflg.product.bomnew.constant.BomConstant; import com.nflg.product.bomnew.constant.DQBomStatusEnum; import com.nflg.product.bomnew.constant.EBomExceptionStatusEnum; import com.nflg.product.bomnew.constant.UserJobEnum; +import com.nflg.product.bomnew.mapper.master.MaterialMainMapper; import com.nflg.product.bomnew.pojo.dto.BaseImportExcelDTO; import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity; import com.nflg.product.bomnew.pojo.entity.BomNewDQbomParentEntity; @@ -240,18 +242,48 @@ public class DQBomImportService { ); } - List materialNos = datas.stream().map(DQbomExcelVO::getMaterialNo).distinct().collect(Collectors.toList()); + errorMsg.addAll(datas.stream() + .filter(d -> StrUtil.isBlank(d.getMaterialNo()) && StrUtil.isBlank(d.getDrawingNo())) + .map(d -> OperationErrorMsgVO.create("第" + d.getRowNum() + "行", "编号和图号都为空")) + .collect(Collectors.toList())); + + //如果编号不为空,则图号使用主物料图号 + List materialNos = datas.stream() + .map(DQbomExcelVO::getMaterialNo) + .filter(StrUtil::isNotBlank) + .distinct() + .collect(Collectors.toList()); List materialBaseInfos = materialMainService.getMaterialBaseInfo(materialNos); - datas.forEach(d -> { + for (DQbomExcelVO d : datas) { BaseMaterialVO vo = materialBaseInfos.stream() .filter(m -> m.getMaterialNo().equals(d.getMaterialNo())) .findFirst() .orElse(null); - if (!Objects.isNull(vo)) { + if (Objects.nonNull(vo)) { d.setDrawingNo(vo.getDrawingNo()); } - }); + } + //如果编号为空,图号不为空,则编号使用主物料编号 + List drawingNos = datas.stream() + .filter(d -> StrUtil.isNotBlank(d.getDrawingNo()) && StrUtil.isBlank(d.getMaterialNo())) + .map(DQbomExcelVO::getDrawingNo) + .distinct() + .collect(Collectors.toList()); + materialBaseInfos = SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(drawingNos); + for (DQbomExcelVO d : datas) { + if (StrUtil.isNotBlank(d.getDrawingNo()) && StrUtil.isBlank(d.getMaterialNo())) { + BaseMaterialVO vo = materialBaseInfos.stream() + .filter(m -> m.getDrawingNo().equals(d.getDrawingNo())) + .findFirst() + .orElse(null); + if (Objects.nonNull(vo)) { + d.setMaterialNo(vo.getMaterialNo()); + } else { + errorMsg.add(OperationErrorMsgVO.create("第" + d.getRowNum() + "行", "图号不存在")); + } + } + } return errorMsg; } @@ -266,27 +298,7 @@ public class DQBomImportService { BomNewDQbomParentEntity parent = parents.stream().filter(p -> p.getMaterialNo().equals(data.getMaterialNo())) .findFirst() .orElse(null); - //if (parent == null && (count - 1 != index || datas.get(index + 1).getLevel() > data.getLevel())) { if (parent == null && count - 1 > index && datas.get(index + 1).getLevel() > data.getLevel()) { - // if (index == 0) { - // BomNewDQbomParentEntity old = dQBomParentService.lambdaQuery() - // .eq(data.getProjectType().equals("L"), BomNewDQbomParentEntity::getMaterialNo, data.getMaterialNo()) - // .eq(data.getProjectType().equals("T"), BomNewDQbomParentEntity::getMaterialName, data.getMaterialName()) - // .orderByDesc(BomNewDQbomParentEntity::getRowId) - // .last(" limit 1") - // .one(); - // if (!Objects.isNull(old)) { - // VUtils.isTure(Objects.equals(data.getMaterialUnit(), old.getMaterialUnit()) - // || Objects.equals(data.getNum(), old.getNum()) - // || Objects.equals(data.getMaterialTexture(), old.getMaterialTexture())) - // .throwMessage("导入的数据已存在,请勿重复导入"); - // if (Objects.equals(old.getStatus(), DQBomStatusEnum.WAIT_CONVERT.getValue())) { - // VUtils.isTure(!Objects.equals(old.getCreatedBy(), SessionUtil.getUserCode())) - // .throwMessage(StrUtil.format("此物料已由{}导入过,不能再次导入", old.getCreatedName())); - // } - // } - // } - parent = new BomNewDQbomParentEntity(); parent.setRowId(IdWorker.getId()); parent.setLevel(data.getLevel());