From 4893ccaba79010cdfe90b4ed2013e60c8d03ed22 Mon Sep 17 00:00:00 2001 From: jing's Date: Thu, 4 Jan 2024 23:25:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nflg/product/bomnew/api/user/EbomApi.java | 8 ++- .../service/BomNewEbomParentService.java | 70 ++++++++++++++----- .../domain/EBom/CheckEBomException.java | 2 +- .../bomnew/service/domain/EBom/EBomEdit.java | 26 +++---- 4 files changed, 71 insertions(+), 35 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java index 33c0d721..44078d5b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java @@ -264,10 +264,14 @@ public class EbomApi extends BaseApi { @GetMapping("editDetail") @ApiOperation("编辑物料列表") - public ResultVO editDetail(@RequestParam("bomRowId") Long bomRowId) { + public ResultVO editDetail(@RequestParam("bomRowId") Long bomRowId,@RequestParam("projectType") String projectType) { + + if(Objects.isNull(bomRowId)){ + VUtils.isTure(true ).throwMessage("bomRowId不能为空"); + } ResultVO resultVO = new ResultVO(); - resultVO.setData(bomNewEbomParentService.editDetail(bomRowId)); + resultVO.setData(bomNewEbomParentService.editDetail(bomRowId,projectType)); return resultVO; } 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 780abe8a..9f4c2e52 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 @@ -499,6 +499,17 @@ public class BomNewEbomParentService extends ServiceImpl list) throws ExecutionException, InterruptedException { + CheckEBomException checkEBomException = new CheckEBomException(list); + checkEBomException.initException(); + + //保存异常 + saveException(checkEBomException); + + + } + + /** * 生成虚拟包 @@ -984,7 +995,7 @@ public class BomNewEbomParentService extends ServiceImpl childList=getBomTree(bomRowId); CheckEBomException checkEBomException = new CheckEBomException(childList); // System.out.println(JSON.toJSONString(checkEBomException.getAllBomDetail())); - checkEBomException.initException("projectType"); + checkEBomException.initException(); //错误状态包含在checkStatus内有异常抛出 checkEBomException.checkContainExcept(checkStatus); //筛选bomRowId()>0 说明有bom,更新只到parent这层,无bom不需要更新 @@ -1074,12 +1085,13 @@ public class BomNewEbomParentService extends ServiceImpl childList=dto.getDatas(); - checkAndSaveEBomException(dto.getParent().getBomRowId()); - - + if( dto.getParent().getRootIs()==null || dto.getParent().getRootIs()==0) { + childList.add(dto.getParent()); + } + checkAndSaveEBomException(childList); ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); - return true; } @@ -1242,6 +1259,11 @@ public class BomNewEbomParentService extends ServiceImpl allBom = Convert.convert(new TypeReference>() { }, eBomEdit.childEntities); + BomNewEbomParentVO parent = Convert.convert( BomNewEbomParentVO .class + , eBomEdit.parentEntities.get(0)); + + if(dto.getParent().getRootIs()==null || dto.getParent().getRootIs()==0) { + allBom.add(parent); + } CheckEBomException checkEBomException = new CheckEBomException(allBom); - checkEBomException.initException("material", "materialTexture", "projectType"); - checkEBomException.checkContainExcept(checkStatus); - } if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) { @@ -1267,12 +1292,18 @@ public class BomNewEbomParentService extends ServiceImpl childList= dto.getDatas(); + + if(dto.getParent().getRootIs()==null || dto.getParent().getRootIs()==0) { + childList.add(dto.getParent()); + } - checkAndSaveEBomException(dto.getParent().getBomRowId()); + + checkAndSaveEBomException(childList); // ebomChildService.getBaseMapper().updateEBomMaterialUse(); ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); return true; @@ -1292,8 +1323,8 @@ public class BomNewEbomParentService extends ServiceImpl delTagList = new ArrayList<>(); - CheckEBomException checkEBomException = new CheckEBomException(delList); - checkEBomException.initException("material", "materialTexture", "projectType"); +// CheckEBomException checkEBomException = new CheckEBomException(delList); +// checkEBomException.initException(); //原始bom不正常 List s1List = delList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource()) && !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList()); @@ -1326,10 +1357,8 @@ public class BomNewEbomParentService extends ServiceImpl changeMaterial(BomNewEBomChangeDTO dto) { - CheckEBomException.checkMaterialNoInMain(dto.getDatas()); - List checkBom = new ArrayList<>(); List tmp1=dto.getDatas().stream().filter(item->Objects.nonNull(item.getRowId()) && item.getRowId()>0).collect(Collectors.toList()); @@ -1350,6 +1379,9 @@ public class BomNewEbomParentService extends ServiceImpl Date: Fri, 5 Jan 2024 15:13:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/service/domain/EBom/CheckEBomException.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/domain/EBom/CheckEBomException.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java index 2de13709..3784daa9 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 @@ -111,7 +111,7 @@ public class CheckEBomException { vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue()); } else if (StrUtil.isNotBlank(vo.getMaterialNo()) && Objects.isNull(vo.getMaterialState())) { vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue()); - } else if (StrUtil.isBlank(vo.getProjectType()) && Objects.nonNull(vo.getRootIs()) && !vo.getRootIs().equals(1)) { + } else if (StrUtil.isBlank(vo.getProjectType()) && (vo.getRootIs()==null || vo.getRootIs()==0)) { vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue()); } else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equalsValue(vo.getExceptionStatus())){