From 841c20dff83dd766d79cdf95dca6fc88217e30f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Tue, 24 Sep 2024 17:18:24 +0800 Subject: [PATCH 01/16] =?UTF-8?q?pbom-=E5=BC=82=E5=B8=B8=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nflg/product/bomnew/api/user/PBomApi.java | 11 ++ .../bomnew/pojo/vo/BomNewPbomParentVO.java | 4 + .../service/BomNewPbomParentService.java | 41 +++++++ .../domain/EBom/CheckPBomException.java | 109 ++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java index 89ed62e8..568c4ed8 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java @@ -25,6 +25,7 @@ import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.VUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import nflg.product.common.vo.ResultVO; import org.apache.commons.compress.utils.Lists; import org.springframework.transaction.annotation.Transactional; @@ -439,4 +440,14 @@ public class PBomApi extends BaseApi { } + @GetMapping("checkException") + @ApiOperation("PBOM-数据异常检查") + @LogRecord(success = "PBom-BOM数据异常检查,操作结果:{{#_ret}}", bizNo = "{{#bomRowId.toString()}}", type = "PBom-数据异常检查") + public ResultVO checkException(@RequestParam("bomRowId") Long bomRowId, @ApiParam("pBomType:pbom类型: 0- pBom工作表 1-pBOM正式表")@RequestParam("pBomType") Integer pBomType) { + + bomNewPbomParentService.checkException(bomRowId,pBomType); + return ResultVO.success(true); + } + + } 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 8362e825..aa3dd655 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 @@ -338,6 +338,10 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable { //发布PBOM 时 ,对比Pbom已发布版是否一致,一致则不转PBOM正式,直接删除PBOM 草稿数据 private Integer delIs=0; + + @ApiModelProperty(value = "异常状态:1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常 7=物料主数据不存在 8=项目类别为空 9=项目赋值异常(父级物料的项目类型为Q时,子级中不能存在项目类别为Q的物料) 10=项目赋值异常(当父级物料的项目类型为F时,子级中不能存在项目类型为F的物料) 11=未填写变更原因和技术通知单 12=数量需要用户确认 13=项目类型需要用户确认") + private Integer exceptionStatus; + private static final long serialVersionUID = 1L; @Override diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index 2705b726..4fc69ac2 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -28,6 +28,7 @@ import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery; import com.nflg.product.bomnew.pojo.query.CopyPBomV2Query; import com.nflg.product.bomnew.pojo.query.PbomImportToSAPQuery; import com.nflg.product.bomnew.pojo.vo.*; +import com.nflg.product.bomnew.service.domain.EBom.CheckPBomException; import com.nflg.product.bomnew.service.domain.PBom.*; import com.nflg.product.bomnew.service.domain.Sap; import com.nflg.product.bomnew.util.*; @@ -769,6 +770,24 @@ public class BomNewPbomParentService extends ServiceImpl getFormalAllBom(Long rowId, Integer countLevelNum) { + List bomDetail = this.getBaseMapper().getParentChild(rowId); + AtomicInteger levelNum = new AtomicInteger(1); + BomNewPbomParentEntity parent = this.getBaseMapper().selectById(rowId); + PBomFormalTreeTask detailTask = new PBomFormalTreeTask(bomDetail, countLevelNum, levelNum,parent.getFacCode()); + ForkJoinTask> submit = bomDetailPool.submit(detailTask); + + List result = submit.join(); + return result.stream().distinct().collect(Collectors.toList()); + + } + public List getAllBom(Long rowId, Integer countLevelNum, Boolean generateDrawingNumberFalg) throws ExecutionException, InterruptedException { List bomDetail = this.getBaseMapper().getParentChild(rowId); AtomicInteger levelNum = new AtomicInteger(1); @@ -2004,5 +2023,27 @@ public class BomNewPbomParentService extends ServiceImpl allBom =new ArrayList<>(); + if(bomType==0){ + allBom= this.getAllBom(rowId, 0); + }else { + this.getFormalAllBom(rowId,0); + } + BomNewPbomParentVO convert = Convert.convert(BomNewPbomParentVO.class, parent); + convert.setBomRowId(convert.getRowId()); + convert.setParentRowId(0L); + allBom.add(convert); + CheckPBomException checkException=new CheckPBomException(allBom); + checkException.initException(); + + } + } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java new file mode 100644 index 00000000..dd76664d --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java @@ -0,0 +1,109 @@ +package com.nflg.product.bomnew.service.domain.EBom; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Sets; +import com.nflg.product.base.core.exception.NflgBusinessException; +import com.nflg.product.bomnew.constant.*; +import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity; +import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity; +import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO; +import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO; +import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO; +import com.nflg.product.bomnew.service.BomNewEbomChildService; +import com.nflg.product.bomnew.service.BomNewEbomParentService; +import com.nflg.product.bomnew.service.MaterialMainService; +import com.nflg.product.bomnew.util.*; +import lombok.Getter; +import lombok.Setter; +import nflg.product.common.constant.STATE; + +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 检查BOM 异常 + */ +public class CheckPBomException { + + @Getter + List allBomDetail; + + + + + + /** + * @param allBom 整颗BOM树(包含跟节点) + */ + public CheckPBomException(List allBom) { + allBomDetail = allBom; + } + + /** + * 初始化异常 + */ + public void initException() { + //初始化物料信息 + SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); + + checkException(); + } + public void checkException() { + for (BomNewPbomParentVO vo : allBomDetail) { + vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); + + if (StrUtil.isNotBlank(vo.getMaterialNo()) + && (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(vo.getMaterialState()) + || MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(vo.getMaterialState()))) { + vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue()); + } + } + } + /** + * 黄色警号异常 + * + * @param + */ + public void initExceptionYellowWarn() { + Set exceptionItems = allBomDetail.stream().filter(u -> EBomExceptionStatusEnum.EXCEPT_NO_2.equals(u.getExceptionStatus())).collect(Collectors.toSet()); + for (BomNewPbomParentVO vo : exceptionItems) { + initExceptionParent(vo); + } + + } + + + /** + * 初始化上级警告 + * @param vo + * @return + */ + protected void initExceptionParent(BomNewPbomParentVO vo) { + + List parentEnts = initExceptionParentDo(ImmutableList.of(vo)); + + while (CollUtil.isNotEmpty(parentEnts) ) { + parentEnts = initExceptionParentDo(parentEnts); + } + + } + + private List initExceptionParentDo(List vos) { + Set parentRowIds = vos.stream().filter(u->u.getParentRowId()>0).map(u -> u.getParentRowId()).collect(Collectors.toSet()); + List parents = allBomDetail.stream().filter(u ->parentRowIds.contains(u.getBomRowId())).collect(Collectors.toList()); + parents.forEach(u->u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue())); + return parents; + } + + + + + + +} From 76870060450374f0e5c91b84cafa3ea21b5ea2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Wed, 25 Sep 2024 15:04:21 +0800 Subject: [PATCH 02/16] =?UTF-8?q?bom-=E6=9F=A5=E7=9C=8B=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/api/user/BomReportApi.java | 12 ++++-- .../product/bomnew/pojo/vo/UpdateLogVO.java | 42 +++++++++++++++++++ .../bomnew/service/ForwardReportService.java | 5 +++ 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java index f8c86720..1277b47d 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java @@ -21,12 +21,10 @@ import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.VUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import nflg.product.common.constant.STATE; import nflg.product.common.vo.ResultVO; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.ttzero.excel.entity.ListSheet; import javax.annotation.Resource; @@ -127,6 +125,12 @@ public class BomReportApi extends BaseApi { return ResultVO.success(forwardReportService.factoryBomType(query)); } + @PostMapping("getUpdateLog") + @ApiOperation("bom-变更记录(和上一版本对比)") + public ResultVO> getUpdateLog(@ApiParam("bom版本RowId") @RequestParam("bomRowId") Long bomRowId) { + return ResultVO.success(forwardReportService.getUpdateLog(bomRowId)); + } + @PostMapping("compareReport") @ApiOperation("bom-比对") diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java new file mode 100644 index 00000000..29b39741 --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java @@ -0,0 +1,42 @@ +package com.nflg.product.bomnew.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 版本变更-记录VO + */ +@Data +public class UpdateLogVO { + + @ApiModelProperty(value = "序号") + private String orderNumber; + + @ApiModelProperty("项目类别") + private String projectType; + + @ApiModelProperty("物料编码") + private String materialNo; + + @ApiModelProperty("物料名称") + private String materialName; + + @ApiModelProperty("物料描述") + private String materialDesc; + + @ApiModelProperty(value = "数量") + private BigDecimal num; + + @ApiModelProperty("单位") + private String materialUnit; + + @ApiModelProperty("排序字符串") + private String orderStr; + + @ApiModelProperty("操作类型") + private String opType; + + +} diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java index d670d798..3806ff9b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java @@ -402,4 +402,9 @@ public class ForwardReportService { } + public List getUpdateLog(Long bomRowId){ + + } + + } From f9829796c0e374d832180467335fa90fc586a852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Wed, 25 Sep 2024 16:14:45 +0800 Subject: [PATCH 03/16] =?UTF-8?q?bom-=E6=9F=A5=E7=9C=8B=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/api/user/BomReportApi.java | 4 +- .../product/bomnew/constant/BomConstant.java | 4 + .../product/bomnew/pojo/vo/UpdateLogVO.java | 7 ++ .../bomnew/service/ForwardReportService.java | 114 +++++++++++++++++- 4 files changed, 126 insertions(+), 3 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java index 1277b47d..99c8db8b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java @@ -127,8 +127,8 @@ public class BomReportApi extends BaseApi { @PostMapping("getUpdateLog") @ApiOperation("bom-变更记录(和上一版本对比)") - public ResultVO> getUpdateLog(@ApiParam("bom版本RowId") @RequestParam("bomRowId") Long bomRowId) { - return ResultVO.success(forwardReportService.getUpdateLog(bomRowId)); + public ResultVO> getUpdateLog(@ApiParam("bom版本RowId") @RequestParam("bomRowId") Long bomRowId , @ApiParam("BOM 类型 0-原始BOM 1-EBom 2-PBom") @RequestParam("bomType") Integer bomType) { + return ResultVO.success(forwardReportService.getUpdateLog(bomRowId,bomType)); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/BomConstant.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/BomConstant.java index af9ca74d..f0967714 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/BomConstant.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/BomConstant.java @@ -16,4 +16,8 @@ public class BomConstant { public static final Integer YES=1; public static final Integer NO=0; + + public static final String ADD="新增"; + public static final String UP="修改"; + public static final String DEL="删除"; } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java index 29b39741..81c7e4d4 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java @@ -14,6 +14,10 @@ public class UpdateLogVO { @ApiModelProperty(value = "序号") private String orderNumber; + @ApiModelProperty(value = "版本号") + private String currentVersion; + + @ApiModelProperty("项目类别") private String projectType; @@ -38,5 +42,8 @@ public class UpdateLogVO { @ApiModelProperty("操作类型") private String opType; + @ApiModelProperty("旧版或新版 0-旧版 1-新版") + private Integer oldOrNewVersion=0; + } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java index 3806ff9b..bb784ed2 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java @@ -1,10 +1,13 @@ package com.nflg.product.bomnew.service; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.lang.TypeReference; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; +import com.google.common.collect.Sets; +import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.*; import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper; import com.nflg.product.bomnew.pojo.entity.*; @@ -19,9 +22,12 @@ import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.ListCommonUtil; import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil; import com.nflg.product.bomnew.util.VUtils; +import nflg.product.common.constant.STATE; +import org.apache.ibatis.builder.ParameterExpression; import org.springframework.stereotype.Service; import org.ttzero.excel.entity.ListSheet; +import javax.annotation.Resource; import java.io.IOException; import java.io.OutputStream; import java.util.*; @@ -32,6 +38,19 @@ import java.util.stream.Collectors; @Service public class ForwardReportService { + @Resource + private BomNewEbomParentFormalService ebomParentFormalService; + + @Resource + private BomNewEbomChildFormalService ebomChildFormalService; + + + @Resource + private BomNewPbomParentFormalService pbomParentFormalService; + + @Resource + private BomNewPbomChildFormalService pbomChildFormalService; + public ReportBomVersionVO factoryVersion(ReverseReportQuery query) { //原始BOM @@ -402,8 +421,101 @@ public class ForwardReportService { } - public List getUpdateLog(Long bomRowId){ + /** + * 获取BOM变更记录 + * @param bomRowId bom版本rowId + * @param bomType BOM 类型 0-原始BOM 1-EBom 2-PBom + * @return + */ + public List getUpdateLog(Long bomRowId ,Integer bomType){ + //结果 + List result=new ArrayList<>(); + //eBom + if(bomType==1){ + BomNewEbomParentFormalEntity ebomVersion = ebomParentFormalService.getById(bomRowId); + if(Objects.nonNull(ebomVersion)){ + //上一个BOM版本 + BomNewEbomParentFormalEntity preBomVersion = ebomParentFormalService.lambdaQuery().eq(BomNewEbomParentFormalEntity::getMaterialNo, ebomVersion.getMaterialNo()) + .lt(BomNewEbomParentFormalEntity::getCurrentVersion, ebomVersion.getCurrentVersion()).orderByDesc(BomNewEbomParentFormalEntity::getCurrentVersion).last(" limit 1").one(); + if(Objects.nonNull(preBomVersion)) { + List newBomDetail = ebomChildFormalService.lambdaQuery().eq(BomNewEbomChildFormalEntity::getParentRowId, bomRowId).list(); + List oldBomDetail = ebomChildFormalService.lambdaQuery().eq(BomNewEbomChildFormalEntity::getParentRowId, preBomVersion.getRowId()).list(); + List newBomChild = Convert.toList(UpdateLogVO.class, newBomDetail); + List oldBomChild = Convert.toList(UpdateLogVO.class, oldBomDetail); + newBomChild.forEach(item->{item.setCurrentVersion(ebomVersion.getCurrentVersion()); item.setOldOrNewVersion(1);}); + oldBomChild.forEach(item->item.setCurrentVersion(preBomVersion.getCurrentVersion())); + result=compare(oldBomChild,newBomChild); + } + } + }//pBom + else if(bomType==2){ + BomNewPbomParentFormalEntity pbomVersion = pbomParentFormalService.getById(bomRowId); + if(Objects.nonNull(pbomVersion)){ + //上一个BOM版本 + BomNewPbomParentFormalEntity preBomVersion = pbomParentFormalService.lambdaQuery().eq(BomNewPbomParentFormalEntity::getMaterialNo, pbomVersion.getMaterialNo()) + .lt(BomNewPbomParentFormalEntity::getCurrentVersion, pbomVersion.getCurrentVersion()).orderByDesc(BomNewPbomParentFormalEntity::getCurrentVersion).last(" limit 1").one(); + if(Objects.nonNull(preBomVersion)) { + List newBomDetail = pbomChildFormalService.lambdaQuery().eq(BomNewPbomChildFormalEntity::getParentRowId, bomRowId).list(); + + List oldBomDetail = pbomChildFormalService.lambdaQuery().eq(BomNewPbomChildFormalEntity::getParentRowId, preBomVersion.getRowId()).list(); + List newBomChild = Convert.toList(UpdateLogVO.class, newBomDetail); + List oldBomChild = Convert.toList(UpdateLogVO.class, oldBomDetail); + newBomChild.forEach(item->{item.setCurrentVersion(pbomVersion.getCurrentVersion()); item.setOldOrNewVersion(1);}); + oldBomChild.forEach(item->item.setCurrentVersion(preBomVersion.getCurrentVersion())); + result=compare(oldBomChild,newBomChild); + } + } + } + else { + throw new NflgBusinessException(STATE.ParamErr ,"bomType参数错误:暂不支持该类型BOM"); + } + return result; + } + + + /** + * bom-对比(变更记录) + * @param oldBom + * @param newBom + * @return + */ + private List compare(List oldBom, List newBom){ + List result =new ArrayList<>(); + + Set oldSet = oldBom.stream().map(u -> u.getOrderNumber()).collect(Collectors.toSet()); + Set newSet =newBom.stream().map(u->u.getOrderNumber()).collect(Collectors.toSet()); + //删除的 + Set del = Sets.difference(oldSet, newSet); + for (String item: del) { + UpdateLogVO oldEnd=oldBom.stream().filter(u->u.getOrderNumber().equals(item)).findFirst().get(); + result.add(oldEnd); + UpdateLogVO newEnt =new UpdateLogVO(); + BeanUtil.copyProperties(oldEnd,newEnt); + newEnt.setOpType(BomConstant.DEL); + + } + + //新增 + Set add= Sets.difference(newSet,oldSet); + for (String item: add) { + UpdateLogVO updateLogVO=newBom.stream().filter(u->u.getOrderNumber().equals(item)).findFirst().get(); + updateLogVO.setOpType(BomConstant.ADD); + result.add(updateLogVO); + } + + //都有比较编辑字段 + Set intersection = Sets.intersection(oldSet,newSet); + for (String item: intersection) { + UpdateLogVO oldEnt = oldBom.stream().filter(u -> u.getOrderNumber().equals(item)).findFirst().get(); + UpdateLogVO newEnt = newBom.stream().filter(u -> u.getOrderNumber().equals(item)).findFirst().get(); + if(!oldEnt.getMaterialNo().equals(newEnt.getMaterialNo()) || ! oldEnt.getNum().equals(newEnt.getNum()) || oldEnt.getProjectType().equals(newEnt.getProjectType())){ + result.add(oldEnt); + newEnt.setOpType(BomConstant.UP); + result.add(newEnt); + } + } + return result; } From 0e47cbc96e2eb7d7971675ba379ff5fe83f351ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Thu, 26 Sep 2024 16:32:13 +0800 Subject: [PATCH 04/16] =?UTF-8?q?pbom-=E5=BC=82=E5=B8=B8=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/pojo/entity/BomNewPbomChildEntity.java | 4 ++++ .../product/bomnew/pojo/entity/BomNewPbomParentEntity.java | 4 ++++ .../main/resources/mapper/master/BomNewPbomChildMapper.xml | 3 ++- .../main/resources/mapper/master/BomNewPbomParentMapper.xml | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewPbomChildEntity.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewPbomChildEntity.java index 31fc3bd5..cbe4169b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewPbomChildEntity.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewPbomChildEntity.java @@ -256,6 +256,10 @@ public class BomNewPbomChildEntity implements Serializable { @ApiModelProperty(value = "原始项目类别-来自ebom(不会变)") private String originalProjectType; + @TableField(value = "exception_status") + @ApiModelProperty(value = "异常状态:1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常") + private Integer exceptionStatus; + private static final long serialVersionUID = -76633783850936076L; } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewPbomParentEntity.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewPbomParentEntity.java index 943e8717..ce3022c2 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewPbomParentEntity.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewPbomParentEntity.java @@ -374,6 +374,10 @@ public class BomNewPbomParentEntity implements Serializable { @ApiModelProperty(value = "来源状态:1-EBOM导入、2-PBOM创建、3-E->P修改") private Integer sourceStatus; + @TableField(value = "exception_status") + @ApiModelProperty(value = "异常状态:1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常") + private Integer exceptionStatus; + private static final long serialVersionUID = -31999878274445137L; } diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomChildMapper.xml b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomChildMapper.xml index c4dd0571..24eaf22a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomChildMapper.xml +++ b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomChildMapper.xml @@ -38,11 +38,12 @@ + - row_id, parent_row_id, identity_no, fac_code, order_number, drawing_no, material_no, material_name, material_desc, material_texture, material_unit, material_category_code, unit_weight, num, total_weight, project_type, production_factory_code,production_factory_code_input_type, set_production_factory_time, super_material_status, virtual_part_is, created_by, created_time, modify_time, source_row_id, remark, source_parent_material_no ,virtual_part_type ,virtual_part_root_material_no ,bom_version_row_id ,original_material_no , original_num, original_project_type + row_id, parent_row_id, identity_no, fac_code, order_number, drawing_no, material_no, material_name, material_desc, material_texture, material_unit, material_category_code, unit_weight, num, total_weight, project_type, production_factory_code,production_factory_code_input_type, set_production_factory_time, super_material_status, virtual_part_is, created_by, created_time, modify_time, source_row_id, remark, source_parent_material_no ,virtual_part_type ,virtual_part_root_material_no ,bom_version_row_id ,original_material_no , original_num, original_project_type ,exception_status diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomParentMapper.xml b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomParentMapper.xml index 2ba3a8b3..96c60af3 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomParentMapper.xml +++ b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomParentMapper.xml @@ -48,6 +48,7 @@ + @@ -57,7 +58,7 @@ should_bom_exist, super_material_status, bom_exist, last_version_is, edit_status, status, user_root_is, virtual_package_is, source_row_id, devise_user_code, devise_name,technology_user_code,technology_user_name, created_by, created_time, created_job, release_time, release_user_name,last_convert_mbom_user_name,last_convert_mbom_time, expire_end_time, remark, dept_name, level_num, change_desc, notice_nums, - order_no, modify_time + order_no, modify_time,exception_status From ad7afba8f0bd7f0aea1ae6e2c2373baf88f60866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Thu, 26 Sep 2024 17:19:28 +0800 Subject: [PATCH 05/16] =?UTF-8?q?pbom-=E5=BC=82=E5=B8=B8=E6=A3=80=E6=9F=A5?= =?UTF-8?q?,=E5=8F=98=E6=9B=B4=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/api/user/BomReportApi.java | 2 +- .../nflg/product/bomnew/api/user/PBomApi.java | 7 ++--- .../pojo/dto/PBomCheckExceptionDTO.java | 16 ++++++++++ .../bomnew/pojo/vo/BomNewPbomParentVO.java | 2 +- .../service/BomNewPbomParentService.java | 31 +++++++++++++++++++ .../bomnew/service/ForwardReportService.java | 2 -- 6 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java index 99c8db8b..9b7a0e04 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java @@ -127,7 +127,7 @@ public class BomReportApi extends BaseApi { @PostMapping("getUpdateLog") @ApiOperation("bom-变更记录(和上一版本对比)") - public ResultVO> getUpdateLog(@ApiParam("bom版本RowId") @RequestParam("bomRowId") Long bomRowId , @ApiParam("BOM 类型 0-原始BOM 1-EBom 2-PBom") @RequestParam("bomType") Integer bomType) { + public ResultVO> getUpdateLog(@ApiParam("bom版本RowId") @RequestParam("bomRowId") Long bomRowId , @ApiParam("BOM 类型 1-EBom 2-PBom") @RequestParam("bomType") Integer bomType) { return ResultVO.success(forwardReportService.getUpdateLog(bomRowId,bomType)); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java index 568c4ed8..e168378a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java @@ -440,12 +440,11 @@ public class PBomApi extends BaseApi { } - @GetMapping("checkException") + @PostMapping("checkException") @ApiOperation("PBOM-数据异常检查") - @LogRecord(success = "PBom-BOM数据异常检查,操作结果:{{#_ret}}", bizNo = "{{#bomRowId.toString()}}", type = "PBom-数据异常检查") - public ResultVO checkException(@RequestParam("bomRowId") Long bomRowId, @ApiParam("pBomType:pbom类型: 0- pBom工作表 1-pBOM正式表")@RequestParam("pBomType") Integer pBomType) { + public ResultVO checkException(@RequestBody PBomCheckExceptionDTO checkExceptionDTO) { - bomNewPbomParentService.checkException(bomRowId,pBomType); + bomNewPbomParentService.checkException(checkExceptionDTO.getBomRowId(),checkExceptionDTO.getPBomType()); return ResultVO.success(true); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java new file mode 100644 index 00000000..9a90a5a0 --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java @@ -0,0 +1,16 @@ +package com.nflg.product.bomnew.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PBomCheckExceptionDTO { + + @ApiModelProperty("BOM版本ID") + private Long bomRowId; + + + + @ApiModelProperty("pbom类型: 0- pBom工作表 1-pBOM正式表") + private Integer pBomType; +} 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 aa3dd655..bbee485d 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 @@ -340,7 +340,7 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable { @ApiModelProperty(value = "异常状态:1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常 7=物料主数据不存在 8=项目类别为空 9=项目赋值异常(父级物料的项目类型为Q时,子级中不能存在项目类别为Q的物料) 10=项目赋值异常(当父级物料的项目类型为F时,子级中不能存在项目类型为F的物料) 11=未填写变更原因和技术通知单 12=数量需要用户确认 13=项目类型需要用户确认") - private Integer exceptionStatus; + private Integer exceptionStatus=1; private static final long serialVersionUID = 1L; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index 4fc69ac2..3a10eba2 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -2042,7 +2042,38 @@ public class BomNewPbomParentService extends ServiceImpl allBom){ + //父级 + List parents = allBom.stream().filter(u -> u.getBomRowId() != null && u.getBomRowId() > 0 && u.getExceptionStatus()>1).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(parents)) { + List pentList = new ArrayList<>(); + parents.forEach(k -> { + BomNewPbomParentEntity pEnt = new BomNewPbomParentEntity(); + pEnt.setRowId(k.getBomRowId()); + pEnt.setExceptionStatus(k.getExceptionStatus()); + pentList.add(pEnt); + }); + if (CollUtil.isNotEmpty(pentList)) { + this.updateBatchById(pentList); + } + } + //子级 + List child = allBom.stream().filter(u -> u.getRowId() != null && u.getRowId() > 0 && u.getExceptionStatus()>1).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(parents)) { + List childList = new ArrayList<>(); + child.forEach(k -> { + BomNewPbomChildEntity pEnt = new BomNewPbomChildEntity(); + pEnt.setRowId(k.getRowId()); + pEnt.setExceptionStatus(k.getExceptionStatus()); + childList.add(pEnt); + }); + if (CollUtil.isNotEmpty(childList)) { + pbomChildService.updateBatchById(childList); + } + } } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java index bb784ed2..232a685f 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java @@ -495,7 +495,6 @@ public class ForwardReportService { newEnt.setOpType(BomConstant.DEL); } - //新增 Set add= Sets.difference(newSet,oldSet); for (String item: add) { @@ -503,7 +502,6 @@ public class ForwardReportService { updateLogVO.setOpType(BomConstant.ADD); result.add(updateLogVO); } - //都有比较编辑字段 Set intersection = Sets.intersection(oldSet,newSet); for (String item: intersection) { From 1e3641703827ed84e9c9f58a5dc40b5371852c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Fri, 27 Sep 2024 15:29:04 +0800 Subject: [PATCH 06/16] =?UTF-8?q?bom-=E6=9F=A5=E7=9C=8B=EF=BC=9A=E5=9B=BE?= =?UTF-8?q?=E5=8F=B7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/api/user/BomReportApi.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java index 9b7a0e04..ad02869a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java @@ -10,12 +10,14 @@ import com.google.common.collect.ImmutableList; import com.nflg.product.base.core.api.BaseApi; import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.ReportConstant; +import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity; import com.nflg.product.bomnew.pojo.query.ChildBomReportQuery; import com.nflg.product.bomnew.pojo.query.CompareReportQuery; import com.nflg.product.bomnew.pojo.query.ReverseReportQuery; import com.nflg.product.bomnew.pojo.vo.*; import com.nflg.product.bomnew.service.CompareReportService; import com.nflg.product.bomnew.service.ForwardReportService; +import com.nflg.product.bomnew.service.MaterialMainService; import com.nflg.product.bomnew.service.ReverseReportService; import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.VUtils; @@ -48,13 +50,17 @@ public class BomReportApi extends BaseApi { @Resource CompareReportService compareReportService; + @Resource + MaterialMainService materialMainService; + @PostMapping("reverseReport") @ApiOperation("bom-反查") public ResultVO> reverseReport(@Valid @RequestBody ReverseReportQuery query) { VUtils.isTure(!ImmutableList.of(1,2).contains(query.getBomType())).throwMessage("只能查询EBom和PBom"); - VUtils.isTure(StrUtil.isBlank(query.getMaterialNo())).throwMessage("物料编码不能为空"); + //图号查询 + checkAndDrawingNoToMaterialNo(query); if(query.getBomType().equals(1)){ return ResultVO.success(reverseReportService.queryEBom(query)); } @@ -64,6 +70,39 @@ public class BomReportApi extends BaseApi { return ResultVO.success(); } + /** + * 图号转物料编码 + * @param query + * @return + */ + private void checkAndDrawingNoToMaterialNo(ReverseReportQuery query){ + VUtils.isTure(StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())).throwMessage("请输入物料编码或图号"); + if(StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isNotBlank(query.getDrawingNo())) { + List materials = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, query.getDrawingNo()).list(); + VUtils.isTure(CollUtil.isEmpty(materials)).throwMessage("图号在物料库不存在"); + query.setMaterialNo(materials.get(0).getMaterialNo()); + + } + + } + + /** + * 处理图号查询 + * 1.当输入物料编码时,物料编码优先 + * @param query + */ + private void handlerDrawingNoQuery(ReverseReportQuery query){ + + if(StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isNotBlank(query.getDrawingNo())) { + List materials = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, query.getDrawingNo()).list(); + if(CollUtil.isNotEmpty(materials)) { + query.setMaterialNo(materials.get(0).getMaterialNo()); + } + + } + + } + ResultVO checkQueryParam(ReverseReportQuery query) { if (query == null) { @@ -121,7 +160,7 @@ public class BomReportApi extends BaseApi { if (resultVO != null) { return resultVO; } - + handlerDrawingNoQuery(query); return ResultVO.success(forwardReportService.factoryBomType(query)); } From 8dd4dda3c5b9c187e30da775d74d44a078547834 Mon Sep 17 00:00:00 2001 From: jing's Date: Fri, 27 Sep 2024 22:55:47 +0800 Subject: [PATCH 07/16] =?UTF-8?q?ebom=E3=80=81pbom=20=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=AF=94=E8=BE=83=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=AF=94=E8=BE=83=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=8F=8F=E8=BF=B0(=20=201-=E7=9B=B8=E7=AD=89,=202-?= =?UTF-8?q?=E5=B7=A6=E6=9C=89=E5=8F=B3=E7=BC=BA=20,3-=E5=B7=A6=E7=BC=BA?= =?UTF-8?q?=E5=8F=B3=E6=9C=89,10-=E6=95=B0=E9=87=8F=E4=B8=8D=E7=9B=B8?= =?UTF-8?q?=E7=AD=89,11-=E5=8D=95=E4=BD=8D=E4=B8=8D=E7=9B=B8=E7=AD=89,12-?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=B1=BB=E5=9E=8B=E4=B8=8D=E7=9B=B8=E7=AD=89?= =?UTF-8?q?,13-=E7=88=B6=E7=BA=A7=E7=89=A9=E6=96=99=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E4=B8=8D=E7=9B=B8=E7=AD=89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bomnew/constant/ReportConstant.java | 11 ++++- .../bomnew/pojo/vo/CompareReportField.java | 17 ++++++++ .../bomnew/pojo/vo/CompareReportVO.java | 21 +++++++++- .../bomnew/service/CompareReportService.java | 41 +++++++++++++++---- 4 files changed, 77 insertions(+), 13 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ReportConstant.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ReportConstant.java index 3842ac4d..d6a398d8 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ReportConstant.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ReportConstant.java @@ -85,9 +85,16 @@ public class ReportConstant { //比对 EQ(1, "相等"), - NON_EQ(0, "不相等"), + // NON_EQ(0, "不相等"), L_NULL(2, "左有右无"), - NULL_R(3, "左无右有"); + NULL_R(3, "左无右有"), + NON_EQ_NUM(10, "数量不相等"), + NON_EQ_UNIT(11, "单位不相等"), + NON_EQ_PROJECT_TYPE(12, "项目类型不相等"), + NON_EQ_PARENT_MaterialNo(13, "父级物料编码不相等") + ; + + private final Integer value; private final String description; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CompareReportField.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CompareReportField.java index 019b9bc8..601f784d 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CompareReportField.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CompareReportField.java @@ -42,11 +42,19 @@ public class CompareReportField { // @ExcelProperty(value = "单位") @ExcelColumn(value="单位") private String materialUnit; + + @ApiModelProperty("项目类型") + // @ExcelProperty(value = "单位") + @ExcelColumn(value="项目类型") + private String projectType; + @ApiModelProperty("层级") // @ExcelProperty(value="层级") @ExcelColumn(value="层级") private Integer levelNum; + + @ApiModelProperty("比对结果") //@ExcelProperty("比对结果") @MediaColumn @@ -65,6 +73,15 @@ public class CompareReportField { // @ExcelProperty(value = "单位2") @ExcelColumn(value="单位 ") private String materialUnit2; + + + @ApiModelProperty("项目类型") + // @ExcelProperty(value = "单位") + @ExcelColumn(value="项目类型") + private String projectType2; + + + @ApiModelProperty("层级") @ExcelColumn(value="层级 ") //@ExcelProperty(value="层级2") diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CompareReportVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CompareReportVO.java index 7eb42467..748a7fda 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CompareReportVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CompareReportVO.java @@ -1,9 +1,14 @@ package com.nflg.product.bomnew.pojo.vo; +import com.nflg.product.bomnew.constant.ReportConstant; +import com.nflg.product.bomnew.constant.SapErrorMsgTypeEnum; +import com.nflg.product.bomnew.util.EnumUtils; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Objects; + /** * 比对 */ @@ -18,9 +23,21 @@ public class CompareReportVO { @ApiModelProperty("右侧bom2") private ForwardReportVO right; - @ApiModelProperty("符号: 0-不相等 1-相等, 2-左有右缺 ,3-左缺右有") + @ApiModelProperty("符号: 1-相等, 2-左有右缺 ,3-左缺右有,10-数量不相等,11-单位不相等,12-项目类型不相等,13-父级物料编码不相等") private Integer symbol; -public CompareReportVO(){ + @ApiModelProperty("比较描述") + private String symbolDesc; + + public String getSymbolDesc() { + + if(Objects.isNull(symbol)){ + return "未知"; + } + return EnumUtils.getEnumDescription(ReportConstant.SymbolEnum.class,symbol); + + } + + public CompareReportVO(){ } public CompareReportVO(ForwardReportVO lt,Integer symbol,ForwardReportVO rt){ diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/CompareReportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/CompareReportService.java index 3ffda21b..8d3fc35a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/CompareReportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/CompareReportService.java @@ -92,13 +92,16 @@ public class CompareReportService { } excelList.add(compareReportField); if (ObjectUtil.equal(compareReportVO.getSymbol(), ReportConstant.SymbolEnum.EQ.getValue()) - || ObjectUtil.equal(compareReportVO.getSymbol(), ReportConstant.SymbolEnum.NON_EQ.getValue())) { + || compareReportVO.getSymbol()>=ReportConstant.SymbolEnum.NON_EQ_NUM.getValue()) { compareReportField.setLevelNum(compareReportVO.getLeft().getLevelNum()); compareReportField.setNum(compareReportVO.getLeft().getNum()); compareReportField.setMaterialUnit(compareReportVO.getLeft().getMaterialUnit()); + compareReportField.setProjectType(compareReportVO.getLeft().getProjectType()); + compareReportField.setLevelNum2(compareReportVO.getRight().getLevelNum()); compareReportField.setNum2(compareReportVO.getRight().getNum()); compareReportField.setMaterialUnit2(compareReportVO.getRight().getMaterialUnit()); + compareReportField.setProjectType2(compareReportVO.getRight().getProjectType()); if (ObjectUtil.equal(compareReportVO.getLeft().getTag(), ReportConstant.TagEnum.SIGMA.getValue()) || ObjectUtil.equal(compareReportVO.getRight().getTag(), ReportConstant.TagEnum.SIGMA.getValue())) { compareReportField.setSumSymbol("Σ"); @@ -107,19 +110,23 @@ public class CompareReportService { compareReportField.setLevelNum(compareReportVO.getLeft().getLevelNum()); compareReportField.setNum(compareReportVO.getLeft().getNum()); compareReportField.setMaterialUnit(compareReportVO.getLeft().getMaterialUnit()); + compareReportField.setProjectType(compareReportVO.getLeft().getProjectType()); if (ObjectUtil.equal(compareReportVO.getLeft().getTag(), ReportConstant.TagEnum.SIGMA.getValue())) { compareReportField.setSumSymbol("Σ"); } compareReportField.setLevelNum2(null); compareReportField.setNum2(null); compareReportField.setMaterialUnit2(null); + compareReportField.setProjectType2(null); } else if (ObjectUtil.equal(compareReportVO.getSymbol(), ReportConstant.SymbolEnum.NULL_R.getValue())) { compareReportField.setLevelNum(null); compareReportField.setNum(null); compareReportField.setMaterialUnit(null); + compareReportField.setProjectType(null); compareReportField.setLevelNum2(compareReportVO.getRight().getLevelNum()); compareReportField.setNum2(compareReportVO.getRight().getNum()); compareReportField.setMaterialUnit2(compareReportVO.getRight().getMaterialUnit()); + compareReportField.setProjectType2(compareReportVO.getRight().getProjectType()); if (ObjectUtil.equal(compareReportVO.getRight().getTag(), ReportConstant.TagEnum.SIGMA.getValue())) { compareReportField.setSumSymbol("Σ"); } @@ -161,7 +168,7 @@ public class CompareReportService { filePath = "1.png"; - } else if (ObjectUtil.equal(type, ReportConstant.SymbolEnum.NON_EQ.getValue())) { + } else if ( type>=ReportConstant.SymbolEnum.NON_EQ_NUM.getValue() ) { filePath = "0.png"; } else if (ObjectUtil.equal(type, ReportConstant.SymbolEnum.L_NULL.getValue())) { @@ -359,29 +366,45 @@ public class CompareReportService { //比较数量 if(ObjectUtil.isNull(from.getNum()) || ObjectUtil.isNull(to.getNum())){ + compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_NUM.getValue()); continue; } if ( from.getNum().compareTo(to.getNum()) !=0) { - compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ.getValue()); + compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_NUM.getValue()); continue; } + //项目类型比较 + if(ObjectUtil.isNull(from.getProjectType()) || ObjectUtil.isNull(to.getProjectType())){ + compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_PROJECT_TYPE.getValue()); + continue; + } + if (!StrUtil.equals(from.getProjectType().toUpperCase(),to.getProjectType().toUpperCase()) ) { + compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_PROJECT_TYPE.getValue()); + continue; + } + + + + //多层比较父级物料编码/图号 if (queryType.compareTo(ReportConstant.QueryTypeEnum.MULTI.getValue()) == 0) { - //根节点下面不用比较 + if ( (Objects.nonNull(from.getParentRowId()) &&from.getParentRowId()>0) && (Objects.nonNull(to.getParentRowId()) &&to.getParentRowId()>0) ) { if (CollUtil.isEmpty(leftBomRowIdMap.get(from.getParentRowId())) || CollUtil.isEmpty(rightBomRowIdMap.get(to.getParentRowId()))) { - compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ.getValue()); + compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_PARENT_MaterialNo.getValue()); continue; } + + //父级物料比 ForwardReportVO fromParent = leftBomRowIdMap.get(from.getParentRowId()).get(0); ForwardReportVO toParent = rightBomRowIdMap.get(to.getParentRowId()).get(0); if (!compareFunc.apply(fromParent).equals(compareFunc.apply(toParent))) { - compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ.getValue()); + compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_PARENT_MaterialNo.getValue()); continue; } @@ -389,12 +412,12 @@ public class CompareReportService { } else { //比较单位 - if (!ObjectUtil.equal(from.getMaterialUnit().toUpperCase(), to.getMaterialUnit().toUpperCase())) { - compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ.getValue()); + if (!StrUtil.equals(from.getMaterialUnit().toUpperCase(), to.getMaterialUnit().toUpperCase())) { + compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_UNIT.getValue()); continue; } } - //找到相等退出 + //上面条件都不满足即为相等 compareReportVO.setSymbol(ReportConstant.SymbolEnum.EQ.getValue()); break; } From 729f300b0a22393014aba22e080b74da73920bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Sun, 29 Sep 2024 18:16:31 +0800 Subject: [PATCH 08/16] =?UTF-8?q?pbom-=E5=BC=82=E5=B8=B8=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E5=8F=AF=E5=A4=9A=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nflg/product/bomnew/api/user/PBomApi.java | 15 ++++++++++----- .../bomnew/pojo/dto/PBomCheckExceptionDTO.java | 4 +++- .../bomnew/service/BomNewPbomParentService.java | 1 - 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java index e168378a..4e6f562a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java @@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Sets; import com.mzt.logapi.context.LogRecordContext; import com.mzt.logapi.starter.annotation.LogRecord; import com.nflg.product.base.core.api.BaseApi; @@ -36,10 +37,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.concurrent.ExecutionException; import java.util.function.Consumer; import java.util.stream.Collectors; @@ -443,8 +441,15 @@ public class PBomApi extends BaseApi { @PostMapping("checkException") @ApiOperation("PBOM-数据异常检查") public ResultVO checkException(@RequestBody PBomCheckExceptionDTO checkExceptionDTO) { + VUtils.isTure(CollUtil.isEmpty(checkExceptionDTO.getBomRowIds())).throwMessage("请选择要检查的BOM"); + List pBoms = bomNewPbomParentService.lambdaQuery().in(BomNewPbomParentEntity::getRowId, checkExceptionDTO.getBomRowIds()).list(); + Set exitsBoms = pBoms.stream().map(u -> u.getRowId()).collect(Collectors.toSet()); + Set noBomParams= Sets.difference(Sets.newHashSet(checkExceptionDTO.getBomRowIds()) , exitsBoms); + VUtils.isTure(CollUtil.isNotEmpty(noBomParams)).throwMessage(StrUtil.join(",", noBomParams)+ "PBom版本不存在,请检查参数是否正确."); - bomNewPbomParentService.checkException(checkExceptionDTO.getBomRowId(),checkExceptionDTO.getPBomType()); + for(Long rowId : checkExceptionDTO.getBomRowIds()) { + bomNewPbomParentService.checkException(rowId, checkExceptionDTO.getPBomType()); + }; return ResultVO.success(true); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java index 9a90a5a0..61b4f00e 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java @@ -3,11 +3,13 @@ package com.nflg.product.bomnew.pojo.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.List; + @Data public class PBomCheckExceptionDTO { @ApiModelProperty("BOM版本ID") - private Long bomRowId; + private List bomRowIds; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index 3a10eba2..19dcd66f 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -2029,7 +2029,6 @@ public class BomNewPbomParentService extends ServiceImpl allBom =new ArrayList<>(); if(bomType==0){ allBom= this.getAllBom(rowId, 0); From 309948adbdfdbc11dc6cfa2d6231d29348815dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Sun, 29 Sep 2024 18:32:38 +0800 Subject: [PATCH 09/16] =?UTF-8?q?pbom-=E5=BC=82=E5=B8=B8=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E5=8F=AF=E5=A4=9A=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java | 2 +- .../com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java index 4e6f562a..eecf23d2 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java @@ -448,7 +448,7 @@ public class PBomApi extends BaseApi { VUtils.isTure(CollUtil.isNotEmpty(noBomParams)).throwMessage(StrUtil.join(",", noBomParams)+ "PBom版本不存在,请检查参数是否正确."); for(Long rowId : checkExceptionDTO.getBomRowIds()) { - bomNewPbomParentService.checkException(rowId, checkExceptionDTO.getPBomType()); + bomNewPbomParentService.checkException(rowId, checkExceptionDTO.getBomType()); }; return ResultVO.success(true); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java index 61b4f00e..3a4e682d 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PBomCheckExceptionDTO.java @@ -14,5 +14,5 @@ public class PBomCheckExceptionDTO { @ApiModelProperty("pbom类型: 0- pBom工作表 1-pBOM正式表") - private Integer pBomType; + private Integer bomType; } From b46d67dc4e953d5e82d44840e874b75ffa7e51df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Mon, 30 Sep 2024 08:20:25 +0800 Subject: [PATCH 10/16] =?UTF-8?q?pbom-=E5=BC=82=E5=B8=B8=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E5=8F=AF=E5=A4=9A=E9=80=89-2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bomnew/service/domain/EBom/CheckPBomException.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java index dd76664d..8e6ea243 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java @@ -64,6 +64,8 @@ public class CheckPBomException { vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue()); } } + + initExceptionYellowWarn(); } /** * 黄色警号异常 @@ -71,7 +73,7 @@ public class CheckPBomException { * @param */ public void initExceptionYellowWarn() { - Set exceptionItems = allBomDetail.stream().filter(u -> EBomExceptionStatusEnum.EXCEPT_NO_2.equals(u.getExceptionStatus())).collect(Collectors.toSet()); + Set exceptionItems = allBomDetail.stream().filter(u -> EBomExceptionStatusEnum.EXCEPT_NO_2.equalsValue(u.getExceptionStatus())).collect(Collectors.toSet()); for (BomNewPbomParentVO vo : exceptionItems) { initExceptionParent(vo); } From 6e3d37d1ad2afc05de5f8c0cc4438a9c74364399 Mon Sep 17 00:00:00 2001 From: luolm <470431449@qq.com> Date: Fri, 4 Oct 2024 19:38:47 +0800 Subject: [PATCH 11/16] =?UTF-8?q?pbom-=E6=8A=A5=E8=A1=A8=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nflg/product/bomnew/api/user/BomReportApi.java | 5 +++-- .../nflg/product/bomnew/pojo/dto/PdateLogDTO.java | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PdateLogDTO.java diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java index ad02869a..e992175d 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java @@ -10,6 +10,7 @@ import com.google.common.collect.ImmutableList; import com.nflg.product.base.core.api.BaseApi; import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.ReportConstant; +import com.nflg.product.bomnew.pojo.dto.PdateLogDTO; import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity; import com.nflg.product.bomnew.pojo.query.ChildBomReportQuery; import com.nflg.product.bomnew.pojo.query.CompareReportQuery; @@ -166,8 +167,8 @@ public class BomReportApi extends BaseApi { @PostMapping("getUpdateLog") @ApiOperation("bom-变更记录(和上一版本对比)") - public ResultVO> getUpdateLog(@ApiParam("bom版本RowId") @RequestParam("bomRowId") Long bomRowId , @ApiParam("BOM 类型 1-EBom 2-PBom") @RequestParam("bomType") Integer bomType) { - return ResultVO.success(forwardReportService.getUpdateLog(bomRowId,bomType)); + public ResultVO> getUpdateLog(@RequestBody PdateLogDTO pdateLogDTO) { + return ResultVO.success(forwardReportService.getUpdateLog(pdateLogDTO.getBomRowId(),pdateLogDTO.getBomType())); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PdateLogDTO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PdateLogDTO.java new file mode 100644 index 00000000..64a9dd41 --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/PdateLogDTO.java @@ -0,0 +1,14 @@ +package com.nflg.product.bomnew.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PdateLogDTO { + + @ApiModelProperty("bom版本RowId") + private Long bomRowId; + + @ApiModelProperty("BOM 类型 1-EBom 2-PBom") + private Integer bomType; +} From 4270e8662d2c01780412d05095b7d7df41e5b4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Sat, 5 Oct 2024 08:47:32 +0800 Subject: [PATCH 12/16] =?UTF-8?q?pbom-=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= =?UTF-8?q?-=E5=BC=82=E5=B8=B8=E5=88=B0=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nflg/product/bomnew/service/BomNewPbomParentService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index 19dcd66f..cd805fbd 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -2046,7 +2046,7 @@ public class BomNewPbomParentService extends ServiceImpl allBom){ //父级 - List parents = allBom.stream().filter(u -> u.getBomRowId() != null && u.getBomRowId() > 0 && u.getExceptionStatus()>1).collect(Collectors.toList()); + List parents = allBom.stream().filter(u -> u.getBomRowId() != null && u.getBomRowId() > 0).collect(Collectors.toList()); if (CollUtil.isNotEmpty(parents)) { List pentList = new ArrayList<>(); parents.forEach(k -> { From 020b18afd4df30ef6c483e88a88a6c4863b4842d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Sun, 6 Oct 2024 17:42:13 +0800 Subject: [PATCH 13/16] =?UTF-8?q?pbom-=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= =?UTF-8?q?,=E7=89=88=E6=9C=AC=E5=8F=98=E6=9B=B4-bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java | 4 ++++ .../nflg/product/bomnew/service/BomNewPbomParentService.java | 2 +- .../com/nflg/product/bomnew/service/ForwardReportService.java | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java index 81c7e4d4..71c72567 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/UpdateLogVO.java @@ -33,6 +33,10 @@ public class UpdateLogVO { @ApiModelProperty(value = "数量") private BigDecimal num; + public BigDecimal getNum() { + return num!=null ?num.stripTrailingZeros():null; + } + @ApiModelProperty("单位") private String materialUnit; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index cd805fbd..a76bb7e5 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -2060,7 +2060,7 @@ public class BomNewPbomParentService extends ServiceImpl child = allBom.stream().filter(u -> u.getRowId() != null && u.getRowId() > 0 && u.getExceptionStatus()>1).collect(Collectors.toList()); + List child = allBom.stream().filter(u -> u.getRowId() != null && u.getRowId() > 0).collect(Collectors.toList()); if (CollUtil.isNotEmpty(parents)) { List childList = new ArrayList<>(); child.forEach(k -> { diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java index 232a685f..762e7333 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java @@ -507,7 +507,7 @@ public class ForwardReportService { for (String item: intersection) { UpdateLogVO oldEnt = oldBom.stream().filter(u -> u.getOrderNumber().equals(item)).findFirst().get(); UpdateLogVO newEnt = newBom.stream().filter(u -> u.getOrderNumber().equals(item)).findFirst().get(); - if(!oldEnt.getMaterialNo().equals(newEnt.getMaterialNo()) || ! oldEnt.getNum().equals(newEnt.getNum()) || oldEnt.getProjectType().equals(newEnt.getProjectType())){ + if(!oldEnt.getMaterialNo().equals(newEnt.getMaterialNo()) || !oldEnt.getNum().equals(newEnt.getNum()) || !oldEnt.getProjectType().equals(newEnt.getProjectType())){ result.add(oldEnt); newEnt.setOpType(BomConstant.UP); result.add(newEnt); From 8434168cca8405b2a88718719e658aa43ec91a89 Mon Sep 17 00:00:00 2001 From: luolm <470431449@qq.com> Date: Sun, 6 Oct 2024 22:16:52 +0800 Subject: [PATCH 14/16] =?UTF-8?q?pbom-=E6=8A=A5=E8=A1=A8=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nflg/product/bomnew/service/ForwardReportService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java index 762e7333..2158cb5b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java @@ -493,7 +493,7 @@ public class ForwardReportService { UpdateLogVO newEnt =new UpdateLogVO(); BeanUtil.copyProperties(oldEnd,newEnt); newEnt.setOpType(BomConstant.DEL); - + result.add(newEnt); } //新增 Set add= Sets.difference(newSet,oldSet); From 8293df0459ef110a005c8c806102b8b1e62002d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Mon, 7 Oct 2024 08:34:43 +0800 Subject: [PATCH 15/16] =?UTF-8?q?pbom-=E5=BC=82=E5=B8=B8=E6=A3=80=E6=9F=A5?= =?UTF-8?q?-=E5=8C=85=E5=90=AB=E4=B8=BB=E6=95=B0=E6=8D=AE=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bomnew/service/domain/EBom/CheckPBomException.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java index 8e6ea243..e09cc843 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckPBomException.java @@ -63,6 +63,9 @@ public class CheckPBomException { || MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(vo.getMaterialState()))) { vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue()); } + if(StrUtil.isNotBlank(vo.getMaterialNo()) && Objects.isNull(vo.getMaterialState()) ){ + vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue()); + } } initExceptionYellowWarn(); @@ -73,7 +76,7 @@ public class CheckPBomException { * @param */ public void initExceptionYellowWarn() { - Set exceptionItems = allBomDetail.stream().filter(u -> EBomExceptionStatusEnum.EXCEPT_NO_2.equalsValue(u.getExceptionStatus())).collect(Collectors.toSet()); + Set exceptionItems = allBomDetail.stream().filter(u -> EBomExceptionStatusEnum.EXCEPT_NO_2.equalsValue(u.getExceptionStatus()) || EBomExceptionStatusEnum.EXCEPT_NO_7.equalsValue(u.getExceptionStatus()) ).collect(Collectors.toSet()); for (BomNewPbomParentVO vo : exceptionItems) { initExceptionParent(vo); } From 3ad5db86496247d7552156bb39040d0e651caa70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Tue, 8 Oct 2024 10:49:32 +0800 Subject: [PATCH 16/16] =?UTF-8?q?pbom-=E5=8F=98=E6=9B=B4=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=8A=A0=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nflg/product/bomnew/service/ForwardReportService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java index 2158cb5b..98d11100 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/ForwardReportService.java @@ -492,6 +492,7 @@ public class ForwardReportService { result.add(oldEnd); UpdateLogVO newEnt =new UpdateLogVO(); BeanUtil.copyProperties(oldEnd,newEnt); + newEnt.setCurrentVersion(newBom.get(0).getCurrentVersion()); newEnt.setOpType(BomConstant.DEL); result.add(newEnt); }