From e8d970d59347338e63b4d53c9cceb99177fdc497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Wed, 10 Jan 2024 12:05:32 +0800 Subject: [PATCH] =?UTF-8?q?PBOM-=E6=AD=A3=E5=BC=8F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BomNewEbomParentService.java | 6 +++--- .../service/BomNewPbomParentService.java | 6 +++--- .../bomnew/service/UserRoleService.java | 11 +++++----- .../domain/EBom/CheckEBomException.java | 20 +++++++++---------- .../service/domain/EBom/EBomToPBom.java | 6 +++--- .../mapper/master/BomNewPbomParentMapper.xml | 2 +- 6 files changed, 26 insertions(+), 25 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 1438e820..2b4634a9 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -627,9 +627,9 @@ public class BomNewEbomParentService extends ServiceImpl bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(bomRowIds)) { + this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), 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 4fb227eb..e5cba4c6 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 @@ -108,8 +108,8 @@ public class BomNewPbomParentService extends ServiceImpl parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo).stream().collect(Collectors.toList()); if (CollUtil.isNotEmpty(parentMaterialByMaterialNo)) { - List parents = this.getBaseMapper().getParentForMaterialNoSeach(userRoleService.getUserFactory(),parentMaterialByMaterialNo ); - List childs = this.getBaseMapper().getChildForMaterialNoSeach(userRoleService.getUserFactory(),parentMaterialByMaterialNo, materialNo); + List parents = this.getBaseMapper().getParentForMaterialNoSeach(StrUtil.isBlank(userRoleService.getUserFactory())?userRoleService.getUserFactory():query.getFacCode(),parentMaterialByMaterialNo ); + List childs = this.getBaseMapper().getChildForMaterialNoSeach(StrUtil.isBlank(userRoleService.getUserFactory())?userRoleService.getUserFactory():query.getFacCode(),parentMaterialByMaterialNo, materialNo); List data = new ArrayList<>(); data.addAll(parents); data.addAll(childs); @@ -117,7 +117,7 @@ public class BomNewPbomParentService extends ServiceImpl() ; } else { Page result = this.getBaseMapper().workDetailsListByPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserFactory()); materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/UserRoleService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/UserRoleService.java index 4749d35b..0ade2519 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/UserRoleService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/UserRoleService.java @@ -60,11 +60,12 @@ public class UserRoleService { */ public String getUserFactory(){ Integer userMultiplantFacRoleCount = materialMainService.getBaseMapper().getUserMultiplantFacRoleCount(SessionUtil.getRowId()); - if(userMultiplantFacRoleCount>0){ - return ""; - }else { - return SessionUtil.getFullDeptName().contains("仙桃公司")?"1020":"1010"; - } + return ""; +// if(userMultiplantFacRoleCount>0){ +// return ""; +// }else { +// return SessionUtil.getFullDeptName().contains("仙桃公司")?EBomConstant.XIAN_TAO_FACTORY_CODE_1020:EBomConstant.MAIN_FACTORY_CODE_1010; +// } } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java index ae45cc4f..2132774b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java @@ -26,6 +26,7 @@ import lombok.Setter; import nflg.product.common.constant.STATE; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; @@ -185,23 +186,22 @@ public class CheckEBomException { * @param list */ public void initExceptionYellowWarn(List list) { - List exceptionList = allBomDetail.stream().filter(u -> u.getExceptionStatus() > 1).collect(Collectors.toList()); + List exceptionList = allBomDetail.stream().filter(u -> u.getExceptionStatus() > EBomExceptionStatusEnum.OK.getValue()).collect(Collectors.toList()); // List exceptionMaterialNos = exceptionList.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); if (CollUtil.isEmpty(exceptionList)) { return; } for (BomNewEbomParentVO exItem : list) { - - try { - List warnList = allBomDetail.stream().filter(u -> exItem.getBomRowId() != null && exItem.getBomRowId() > 0 && u.getLevelNumber().compareTo(exItem.getLevelNumber()) < 0 && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList()); - warnList.forEach(k -> { - k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue()); - }); - }catch ( Exception e){ - e.printStackTrace(); - } + List warnList = allBomDetail.stream().filter(u -> u.getBomRowId() > 0 && u.getLevelNumber().compareTo(exItem.getLevelNumber().setScale(0, RoundingMode.FLOOR))>=0 && u.getRowId()!=exItem.getRowId() && u.getLevelNumber().compareTo(exItem.getLevelNumber()) < 0 && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList()); + warnList.forEach(k -> { + k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue()); + }); } + List root = allBomDetail.stream().filter(u -> u.getLevelNumber().compareTo(BigDecimal.ZERO) == 0 && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList()); + root.forEach(k->{ + k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue()); + }); // List allErrorParent = SpringUtil.getBean(BomNewEbomParentService.class).getBatchParentMaterialByMaterialNo(exceptionMaterialNos); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPBom.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPBom.java index f1e98d35..87d4316b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPBom.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPBom.java @@ -61,8 +61,8 @@ public class EBomToPBom { @Getter private List upgradeChangeResult = new ArrayList<>(); - @Getter - private List hasConvertEBomRowIds=new ArrayList<>(); +// @Getter +// private List hasConvertEBomRowIds=new ArrayList<>(); private Map generateDrawingNoMap = new HashMap<>(); @@ -152,7 +152,7 @@ public class EBomToPBom { .eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo()) .eq(BomNewPbomParentEntity::getFacCode, facCode).one(); - this.hasConvertEBomRowIds.add(parentVo.getRowId()); + // this.hasConvertEBomRowIds.add(parentVo.getRowId()); if (Objects.nonNull(oldParent) && !EBomStatusEnum.PUBLISHED.equalsValue(oldParent.getStatus())) { SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId())); oldParent.setCurrentVersion(parentVo.getCurrentVersion()); 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 24ae8440..fe7d37e4 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 @@ -154,7 +154,7 @@ c.row_id as bomRowId, c.row_id as childBomRowId, b.* from t_bom_new_pbom_parent a join t_bom_new_pbom_child b on a.row_id =b.parent_row_id - left join t_bom_new_pbom_parent c on b.material_no=c.material_no and c.last_version_is=1 + left join t_bom_new_pbom_parent c on b.material_no=c.material_no and b.fac_code=c.fac_code and c.last_version_is=1 where a.last_version_is=1 and a.fac_code=#{userFac}