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 692df61b..41fc72ad 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 @@ -208,11 +208,12 @@ public class EbomApi extends BaseApi { @PostMapping("revertDesign") @ApiOperation("退回到设计") - public ResultVO revertDesign(@RequestBody BomNewEBomRevertDTO dto) { + public ResultVO revertDesign(@RequestBody BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException { if (CollectionUtil.isEmpty(dto.getRowIdList())) { return ResultVO.error(STATE.ParamErr, "请选择要退回的数据"); } dto.setRevertUserName(SessionUtil.getUserName()); + dto.setUserCode(SessionUtil.getUserCode()); bomNewEbomParentService.revertDesign(dto); return ResultVO.success(true); @@ -221,14 +222,15 @@ public class EbomApi extends BaseApi { @PostMapping("reviewDesign") @ApiOperation("设计复核") - public ResultVO reviewDesign(@RequestBody BomNewEBomRevertDTO dto) { + public ResultVO reviewDesign(@RequestBody BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException { if (CollectionUtil.isEmpty(dto.getRowIdList())) { return ResultVO.error(STATE.ParamErr, "请选择要复核的数据"); } dto.setRevertUserName(SessionUtil.getUserName()); - return bomNewEbomParentService.designReview(dto); - + dto.setUserCode(SessionUtil.getUserCode()); + bomNewEbomParentService.designReview(dto); + return ResultVO.success(true); } @@ -270,8 +272,8 @@ public class EbomApi extends BaseApi { @GetMapping("delete") @ApiOperation("删除物料") - public ResultVO deleteMaterial(@RequestParam("bomRowId") Long bomRowId ) throws ExecutionException, InterruptedException{ - bomNewEbomParentService.deleteMaterial(bomRowId); + public ResultVO deleteBom(@RequestParam("bomRowId") Long bomRowId ) throws ExecutionException, InterruptedException{ + bomNewEbomParentService.deleteBom(bomRowId); bomNewEbomParentService.computeLevelNumAndRootState(); return ResultVO.success(true); } @@ -291,7 +293,7 @@ public class EbomApi extends BaseApi { @PostMapping("submit") @ApiOperation("提交") - public ResultVO submit(@RequestBody BomNewEBomParentEditDTO dto) { + public ResultVO submit(@RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException { return ResultVO.success(bomNewEbomParentService.submit(dto)); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OriginalBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OriginalBomApi.java index 3e929fb1..7a53fc12 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OriginalBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OriginalBomApi.java @@ -47,7 +47,7 @@ import java.util.concurrent.ExecutionException; @Api(tags = "原始BOM") @RestController @RequestMapping("bom/new/bomOriginal") -public class OriginalBomApi extends BaseApi { +public class OriginalBomApi extends BaseApi { @Resource BomNewOriginalParentService originalParentService; @@ -78,15 +78,16 @@ public class OriginalBomApi extends BaseApi { public ResultVO>> getChildTree(@RequestParam("rowId") Long rowId) throws ExecutionException, InterruptedException { return ResultVO.success(originalParentService.getChildTree(rowId)); } + @PostMapping("saveBom") @ApiOperation("编辑时-暂存") public ResultVO saveBom(@Valid @RequestBody OriginalSaveBomDTO bom) { - return ResultVO.success(originalParentService.saveBom(bom,false)); + return ResultVO.success(originalParentService.saveBom(bom, false)); } @PostMapping("saveSubmit") @ApiOperation("编辑时-提交") - public ResultVO saveSubmit(@Valid @RequestBody OriginalSaveBomDTO bom) { + public ResultVO saveSubmit(@Valid @RequestBody OriginalSaveBomDTO bom) { return ResultVO.success(originalParentService.saveSubmit(bom)); } @@ -120,6 +121,7 @@ public class OriginalBomApi extends BaseApi { /** * 原始BOM转EBom + * * @return */ @PostMapping("convertToEBom") @@ -128,7 +130,7 @@ public class OriginalBomApi extends BaseApi { public ResultVO convertToEBom(@RequestBody List bomRowIds) throws ExecutionException, InterruptedException { VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要转换的BOM"); - VUtils.isTure(bomRowIds.size()>20).throwMessage("你选择的BOM数据大于20"); + VUtils.isTure(bomRowIds.size() > 20).throwMessage("你选择的BOM数据大于20"); originalParentService.convertToEBom(bomRowIds); //更新物料使用 bomNewEbomChildMapper.updateEBomMaterialUse(); @@ -152,7 +154,7 @@ public class OriginalBomApi extends BaseApi { @ApiOperation("导入") @PostMapping("importBom") @Transactional(rollbackFor = Exception.class) - public ResultVO importBom(@RequestParam(value = "file")MultipartFile file) throws IOException { + public ResultVO importBom(@RequestParam(value = "file") MultipartFile file) throws IOException { if (file != null && !file.getOriginalFilename().endsWith("xls") && !file.getOriginalFilename().endsWith("xlsx")) { return ResultVO.error("请上传Excel文件"); } @@ -160,12 +162,7 @@ public class OriginalBomApi extends BaseApi { //计算层级 originalParentService.computeLevelNumAndRootState(); -// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { -// @Override -// public void afterCommit() { -// originalParentService.computeLevelNumAndRootState(); -// } -// }); + return ResultVO.success(true); } @@ -174,18 +171,18 @@ public class OriginalBomApi extends BaseApi { @ApiOperation("新增物料") @GetMapping("testaddMaterial") @Transactional(rollbackFor = Exception.class) - public ResultVO testaddMaterial(@RequestParam(value = "drawingNo" ,required = false)String drawingNo, - @RequestParam(value = "materialName" ,required = false)String materialName, - @RequestParam("materialCategoryCode")String materialCategoryCode) throws IOException { + public ResultVO testaddMaterial(@RequestParam(value = "drawingNo", required = false) String drawingNo, + @RequestParam(value = "materialName", required = false) String materialName, + @RequestParam("materialCategoryCode") String materialCategoryCode) throws IOException { - materialService.addMaterial(drawingNo, materialName,materialCategoryCode); + materialService.addMaterial(drawingNo, materialName, materialCategoryCode); return ResultVO.success("true"); } @ApiOperation("获取sessionKey") @GetMapping("getSessionKey") - public ResultVO getSessionKey() { + public ResultVO getSessionKey() { return ResultVO.success(SessionUtil.getSessionKey()); @@ -196,19 +193,16 @@ public class OriginalBomApi extends BaseApi { @PostMapping("testImportBom") @Transactional(rollbackFor = Exception.class) public ResultVO testImportBom() throws IOException { - InputStream inputStream=new FileInputStream("C:\\Users\\01956\\Desktop\\西卡印尼烘干线总站BOM.xlsx"); + InputStream inputStream = new FileInputStream("C:\\Users\\01956\\Desktop\\西卡印尼烘干线总站BOM.xlsx"); originalParentService.importBomTest(inputStream); - TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { - @Override - public void afterCommit() { - originalParentService.computeLevelNumAndRootState(); - } - }); + + // originalParentService.computeLevelNumAndRootState(); + + originalParentService.computeLevelNumAndRootState(); + return ResultVO.success(true); } - - } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomExceptionStatusEnum.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomExceptionStatusEnum.java index 9efac418..fafab8cf 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomExceptionStatusEnum.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomExceptionStatusEnum.java @@ -39,4 +39,20 @@ public enum EBomExceptionStatusEnum implements ValueEnum { private final Integer value; private final String description; + + public static EBomExceptionStatusEnum findEnumByCode(Integer code) { + for (EBomExceptionStatusEnum statusEnum : EBomExceptionStatusEnum.values()) { + if (statusEnum.getValue().equals(code)) { + + return statusEnum; + } + } + throw new IllegalArgumentException("code is invalid"); + } + + public static String code2description(Integer code) { + return findEnumByCode(code).getDescription(); + } + + } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ProjectTypeInputTypeEnum.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ProjectTypeInputTypeEnum.java index 9e0e5654..aeee5e2f 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ProjectTypeInputTypeEnum.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ProjectTypeInputTypeEnum.java @@ -32,7 +32,9 @@ public enum ProjectTypeInputTypeEnum implements ValueEnum { @AllArgsConstructor public enum ProjectTypeEnum implements ValueEnum { TYPE_Q("Q", "Q"), - TYPE_F("F", "F"); + TYPE_F("F", "F"), + TYPE_Z("Z", "Z"), + TYPE_L("L", "L"); private final String value; private final String description; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewOriginalParentMapper.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewOriginalParentMapper.java index 73d0b69c..8d0f215b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewOriginalParentMapper.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewOriginalParentMapper.java @@ -33,5 +33,8 @@ public interface BomNewOriginalParentMapper extends BaseMapper rowIdList; } 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 6838d167..7a9461e5 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 @@ -295,8 +295,16 @@ public class BomNewEbomParentService extends ServiceImpl buildBomTree(Long rowId) throws Exception { - return getBomTree(rowId); + public List buildBomTreeContainSelf(Long rowId) throws ExecutionException, InterruptedException { + + List list= getBomTree(rowId); + BomNewEbomParentVO parentVO=Convert.convert(BomNewEbomParentVO.class,this.getById(rowId)); + if(parentVO!=null) { + parentVO.setBomRowId(rowId); + parentVO.setParentRowId(0L); + list.add(parentVO); + } + return list; } @@ -583,7 +591,6 @@ public class BomNewEbomParentService extends ServiceImpl result = EecExcelUtil.getExcelContext(inputStream, BomNewEBomImportExcelDTO.class); @@ -597,7 +604,13 @@ public class BomNewEbomParentService extends ServiceImpl rowIds = dto.getRowIdList(); - List bomNewEbomParentEntityList = this.getBaseMapper().selectBatchIds(rowIds); + + + // List bomNewEbomParentEntityList = this.getBaseMapper().selectBatchIds(rowIds); + + + List bomNewEbomParentEntityList = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, rowIds).eq(BomNewEbomParentEntity::getRootIs, 1).list(); + + if (CollUtil.isEmpty(bomNewEbomParentEntityList)) { - throw new NflgBusinessException(STATE.BusinessError, "下级BOM无法进行退回"); + // throw new NflgBusinessException(STATE.BusinessError, "下级BOM无法进行退回"); + VUtils.isTure(true).throwMessage("下级BOM无法进行退回"); } if (rowIds.size() != bomNewEbomParentEntityList.size()) { - throw new NflgBusinessException(STATE.BusinessError, "选择数据中包含有下级BOM无法进行退回"); + + // throw new NflgBusinessException(STATE.BusinessError, "选择数据中包含有下级BOM无法进行退回"); + VUtils.isTure(true).throwMessage("选择数据中包含有下级BOM无法进行退回"); } - List waitList = bomNewEbomParentEntityList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.WAIT_CHECK.getValue())).collect(Collectors.toList()); - List revertList = bomNewEbomParentEntityList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.RETURNED.getValue())).collect(Collectors.toList()); - List pbomList = bomNewEbomParentEntityList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(waitList)) { - List materialNoList = waitList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList()); + List revertList=new ArrayList<>(); + for (Long bomRowId: + rowIds) { - throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编号 {} 状态为待复核,无法退回设计", StrUtil.join(",", materialNoList))); - } - if (CollUtil.isNotEmpty(revertList)) { - List materialNoList = revertList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList()); + List bomTreeList= buildBomTreeContainSelf(bomRowId); +// +// +// +// List waitList = bomNewEbomParentEntityList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.WAIT_CHECK.getValue())).collect(Collectors.toList()); +// List revertList = bomNewEbomParentEntityList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.RETURNED.getValue())).collect(Collectors.toList()); - throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编号 {} 状态为已退回,不需要退回设计", StrUtil.join(",", materialNoList))); - } - if (pbomList.size() > 0) { - List materialNoList = pbomList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList()); + List pbomList = bomTreeList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())).collect(Collectors.toList()); +// if (CollUtil.isNotEmpty(waitList)) { +// List materialNoList = waitList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList()); +// +// throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编号 {} 状态为待复核,无法退回设计", StrUtil.join(",", materialNoList))); +// } +// if (CollUtil.isNotEmpty(revertList)) { +// List materialNoList = revertList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList()); +// +// throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编号 {} 状态为已退回,不需要退回设计", StrUtil.join(",", materialNoList))); +// } + if (pbomList.size() > 0) { + List materialNoList = pbomList.stream().map(BomNewEbomParentVO::getMaterialNo).collect(Collectors.toList()); + throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编号 {} 状态为已发布PBOM,无法退回设计", StrUtil.join(",", materialNoList))); - throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编号 {} 状态为已发布PBOM,无法退回设计", StrUtil.join(",", materialNoList))); + } + + //忽略叶子节点 + revertList.addAll(bomTreeList.stream() + .filter(u->u.getBomRowId()>0) + .map(BomNewEbomParentVO::getRowId).collect(Collectors.toList())); } //重新创建保存list 避免污染 List updateList = new ArrayList<>(); - bomNewEbomParentEntityList.forEach(item -> { + for (Long rowId : revertList) { BomNewEbomParentEntity entity = new BomNewEbomParentEntity(); - entity.setRowId(item.getRowId()); - entity.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue()); + entity.setRowId(rowId); + entity.setEditStatus(EBomStatusEnum.RETURNED.getValue()); entity.setRevertTime(LocalDateTime.now()); entity.setRevertUserName(dto.getRevertUserName()); updateList.add(entity); - }); - + } if (!this.updateBatchById(updateList)) { throw new NflgBusinessException(STATE.Error, "退回设计失败"); @@ -731,144 +768,63 @@ public class BomNewEbomParentService extends ServiceImpl designReview(BomNewEBomRevertDTO dto) { + public Boolean designReview(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException { List rowIds = dto.getRowIdList(); - List bomNewEbomParentEntityList = this.getBaseMapper().selectBatchIds(rowIds); + List bomNewEbomParentEntityList = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, rowIds).eq(BomNewEbomParentEntity::getRootIs, 1).list(); + if (CollUtil.isEmpty(bomNewEbomParentEntityList)) { - return ResultVO.error("下级BOM无法进行复核"); + // return ResultVO.error("下级BOM无法进行复核"); + VUtils.isTure(true).throwMessage("下级BOM无法进行复核"); } if (rowIds.size() != bomNewEbomParentEntityList.size()) { - - return ResultVO.error("选择数据中包含有下级BOM无法进行复核"); - } - - for (BomNewEbomParentEntity item : - bomNewEbomParentEntityList) { - - - if (item.getStatus().equals(EBomStatusEnum.CHECKED.getValue())) { - return ResultVO.error(StrUtil.format("{} 已复核过,不需重复复核", item.getMaterialNo())); - } - - if (item.getNum().equals(EBomExceptionStatusEnum.INIT.getValue())) { - return ResultVO.error("请调整数据后进行复核"); - } - - if (item.getNum().equals(EbomEditStatusEnum.HANDLER_CREATED.getValue())) { - return ResultVO.error("请先提交确认后进行复核"); - } - - - if (StrUtil.isEmpty(item.getMaterialNo()) || (item.getNum() == null || item.getNum().floatValue() == 0)) { - return ResultVO.error(EBomExceptionStatusEnum.EXCEPT_NO_4.getDescription()); - } - - MaterialMainEntity entity = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, item.getMaterialNo()).one(); - - if (entity == null) { - return ResultVO.error("物料编码[" + item.getMaterialNo() + "]物料不存在"); - } - - if (Objects.equals(entity.getMaterialState(), MaterialGetEnum.MaterialStateEnum.STATE_NO_4) - || Objects.equals(entity.getMaterialState(), MaterialGetEnum.MaterialStateEnum.STATE_NO_5)) { - return ResultVO.error("物料编码[" + item.getMaterialNo() + "]冻结/完全弃用异常"); - } - - + VUtils.isTure(true).throwMessage("数据中包含有下级BOM无法进行复核"); + // return ResultVO.error("数据中包含有下级BOM无法进行复核"); } + List checkStatus=CollectionUtil.toList(new Integer[]{ + EBomExceptionStatusEnum.EXCEPT_NO_2.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_3.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_4.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_6.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_7.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_8.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_9.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_10.getValue() + }); List updateReviewIdList = new ArrayList<>(); - //子bom检查 - for (BomNewEbomParentEntity item : - bomNewEbomParentEntityList) { - - List childBomList; - try { - childBomList = buildBomTree(item.getRowId()); - } catch (Exception e) { - return ResultVO.error("获取Bom数据失败"); - } - - - if (CollUtil.isNotEmpty(childBomList)) { - - for (BomNewEbomParentVO childBomItem : - childBomList) { - - - if (childBomItem.getNum().equals(EBomExceptionStatusEnum.INIT.getValue())) { - return ResultVO.error("请调整数据后进行复核"); - } - - if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue())) { - return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_2.getDescription())); - } - - if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_3.getValue())) { - return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_3.getDescription())); - } - - if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue())) { - return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_4.getDescription())); - } - - if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_6.getValue())) { - return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_6.getDescription())); - } - - if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue())) { - return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_7.getDescription())); - } - - - if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue())) { - return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_7.getDescription())); - } - - if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue())) { - return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_8.getDescription())); - } - if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue())) { - return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_9.getDescription())); - - } - if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue())) { - return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_10.getDescription())); - - } - - - } - - - } - - updateReviewIdList.addAll(childBomList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList())); - + for (Long bomRowId: + rowIds) { + CheckEBomException checkEBomException=new CheckEBomException(bomRowId); + //错误状态包含在checkStatus内有异常抛出 + checkEBomException.checkContainExcept(checkStatus); + //筛选bomRowId()>0 说明有bom,更新只到parent这层,无bom不需要更新 + //设计人员只可以复核自己的物料,如果存在引用其他用户创建的物料时,不可以改变被引用物料的审核状态。 + updateReviewIdList.addAll( checkEBomException.getAllBomDetail().stream() + .filter(u->u.getBomRowId()>0 + && u.getCreatedBy().equals(dto.getUserCode())) + .map(BomNewEbomParentVO::getRowId).collect(Collectors.toList())); } - //改变复核状态 - List updateReviewList = new ArrayList<>(); for (Long id : updateReviewIdList) { BomNewEbomParentEntity entity = new BomNewEbomParentEntity(); entity.setRowId(id); entity.setAuditTime(LocalDateTime.now()); entity.setAuditUserName(dto.getRevertUserName()); + entity.setStatus(EBomStatusEnum.CHECKED.getValue()); updateReviewList.add(entity); } + if (!this.updateBatchById(updateReviewList)) { throw new NflgBusinessException(STATE.Error, "复核失败"); } - - return ResultVO.success(true); - + return true; } @@ -902,6 +858,7 @@ public class BomNewEbomParentService extends ServiceImpl parentList = new ArrayList<>(); // parentList.add(parentVO); // materialMainService.intiMaterialInfo(parentList); @@ -950,12 +907,13 @@ public class BomNewEbomParentService extends ServiceImpl checkStatus=CollectionUtil.toList(new Integer[]{ + EBomExceptionStatusEnum.EXCEPT_NO_2.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_3.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_4.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_6.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_7.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_8.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_9.getValue(), + EBomExceptionStatusEnum.EXCEPT_NO_10.getValue() + }); + + + List allBom =Convert.convert(new TypeReference>() { + },eBomEdit.childEntities); + + if(CollectionUtil.isNotEmpty(eBomEdit.parentEntities)){ + allBom.add(Convert.convert(BomNewEbomParentVO.class,eBomEdit.parentEntities.get(0))); + } + + CheckEBomException checkEBomException = new CheckEBomException(allBom); + checkEBomException.checkContainExcept(checkStatus); + + + if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) { this.saveOrUpdateBatch(eBomEdit.parentEntities); } - if (CollUtil.isNotEmpty(eBomEdit.childEntities)) { + if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) { ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities); } + if (dto.getParent() != null) { if (dto.getParent().getSource().equals(EBomSourceEnum.FROM_MDM.getValue()) || dto.getParent().getSource().equals(EBomSourceEnum.FROM_EXCE.getValue())) { diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewOriginalParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewOriginalParentService.java index f4674b1b..913746f1 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewOriginalParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewOriginalParentService.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.nflg.product.base.core.config.SpringContextUtils; import com.nflg.product.base.core.conmon.util.SessionUtil; +import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.OriginalConstant; import com.nflg.product.bomnew.constant.OriginalEditStatusEnum; import com.nflg.product.bomnew.constant.OriginalSourceEnum; @@ -99,22 +100,22 @@ public class BomNewOriginalParentService extends ServiceImpl saveEnts = bom.getBomList().stream().filter(u -> u.getDelIs().equals(0)).collect(Collectors.toList()); List childEntities = Convert.toList(BomNewOriginalChildEntity.class, saveEnts); // originalChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id",bom.getParentRowId())); childEntities.forEach(u -> { u.setParentRowId(bom.getParentRowId()); - if(submitIs){ + if (submitIs) { u.setEditStatus(OriginalEditStatusEnum.HANDLER_FINISHED.getValue()); } }); if (CollUtil.isNotEmpty(childEntities)) { //删除行 - List delRowIds = bom.getBomList().stream().filter(u->u.getRowId()>0).map(u-> u.getRowId()).collect(Collectors.toList()); - originalChildService.getBaseMapper().delOriginalChildNotInRowIds(delRowIds,bom.getParentRowId()); + List delRowIds = bom.getBomList().stream().filter(u -> u.getRowId() > 0).map(u -> u.getRowId()).collect(Collectors.toList()); + originalChildService.getBaseMapper().delOriginalChildNotInRowIds(delRowIds, bom.getParentRowId()); originalChildService.saveOrUpdateBatch(childEntities); } return true; @@ -128,7 +129,7 @@ public class BomNewOriginalParentService extends ServiceImpl bomDetail = this.getBaseMapper().getParentChild(bom.getRowId()); OriginalBomDetailTask detailTask = new OriginalBomDetailTask(bomDetail); detailTask.setLevelNum(1); @@ -284,16 +285,18 @@ public class BomNewOriginalParentService extends ServiceImpl { - try { - this.getBaseMapper().updateRootState(); - this.compucteLevelNum(); - } catch (Exception e) { - log.info("计算层级出错:"+e.getMessage()); - } -// }); + try { + this.getBaseMapper().updateRootState_1(); + this.getBaseMapper().updateRootState_2(); + this.getBaseMapper().updateRootState_3(); + this.compucteLevelNum(); + + + } catch (Exception e) { + + log.info("计算层级出错:" + e.getMessage()); + } } @@ -310,8 +313,8 @@ public class BomNewOriginalParentService extends ServiceImpl bomTree = getBomTree(bomRowId); //需删除的BOM List delBom = bomTree.stream().filter(u -> u.getBomRowId() > 0 && OriginalStatusEnum.UN_CONVERT.equalsValue(u.getStatus())).collect(Collectors.toList()); - List delParentRowId=new ArrayList<>(); - for ( BomOriginalListVO bom: delBom) { + List delParentRowId = new ArrayList<>(); + for (BomOriginalListVO bom : delBom) { delParentRowId.add(bom.getBomRowId()); } delParentRowId.add(bomRowId); @@ -333,7 +336,7 @@ public class BomNewOriginalParentService extends ServiceImpl bomNewOriginalParentEntities = this.getBaseMapper().selectBatchIds(bomRowIds); List convertedBom = bomNewOriginalParentEntities.stream().filter(u -> OriginalStatusEnum.OVER_CONVERT.equalsValue(u.getStatus())).collect(Collectors.toList()); - // VUtils.isTure(CollUtil.isNotEmpty(convertedBom)).throwMessage("所选BOM中存在已转换的BOM"); + // VUtils.isTure(CollUtil.isNotEmpty(convertedBom)).throwMessage("所选BOM中存在已转换的BOM"); //开始转换 for (BomNewOriginalParentEntity parent : bomNewOriginalParentEntities) { @@ -385,17 +388,16 @@ public class BomNewOriginalParentService extends ServiceImpl()); String uuid = IdUtil.simpleUUID(); EecExcelUtil.handlerExcel(file.getInputStream(), BomNewOriginalExcelDTO.class, BomNewOriginalParentService::handlerExcelRow); List excelContext = excelContextTL.get(); - List noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u->u.getRowNum()).collect(Collectors.toList()); - VUtils.isTure(CollUtil.isNotEmpty(noLevelNo)).throwMessage(StrUtil.join(",",noLevelNo )+"层次为空"); - List noDrawingNo = excelContext.stream().filter(u -> StrUtil.isBlank(u.getChartNo())).map(u->u.getRowNum()).collect(Collectors.toList()); - VUtils.isTure(CollUtil.isNotEmpty(noDrawingNo)).throwMessage(StrUtil.join(",",noDrawingNo )+"图号为空"); + List noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u -> u.getRowNum()).collect(Collectors.toList()); + VUtils.isTure(CollUtil.isNotEmpty(noLevelNo)).throwMessage(StrUtil.join(",", noLevelNo) + "层次为空"); + List noDrawingNo = excelContext.stream().filter(u -> StrUtil.isBlank(u.getChartNo())).map(u -> u.getRowNum()).collect(Collectors.toList()); + VUtils.isTure(CollUtil.isNotEmpty(noDrawingNo)).throwMessage(StrUtil.join(",", noDrawingNo) + "图号为空"); // List noNum = excelContext.stream().filter(u -> Objects.isNull(u.getQty())).map(u->u.getRowNum()).collect(Collectors.toList()); // VUtils.isTure(CollUtil.isNotEmpty(noNum)).throwMessage( StrUtil.join(",",noNum )+"数量为空"); @@ -410,7 +412,7 @@ public class BomNewOriginalParentService extends ServiceImpl chileds = excelContext.stream().filter(u -> u.getParentKey().equals(data.getLevelNo() + "-" + data.getRowNum())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(chileds)) { - int i=1; + int i = 1; for (BomNewOriginalExcelDTO ch : chileds) { ch.setOrderNo(i); i++; @@ -430,8 +432,8 @@ public class BomNewOriginalParentService extends ServiceImpl excelContext = excelContextTL.get(); - List noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u->u.getRowNum()).collect(Collectors.toList()); - VUtils.isTure(CollUtil.isNotEmpty(noLevelNo)).throwMessage(StrUtil.join(",",noLevelNo )+"层次为空"); - List noDrawingNo = excelContext.stream().filter(u -> StrUtil.isBlank(u.getChartNo())).map(u->u.getRowNum()).collect(Collectors.toList()); - VUtils.isTure(CollUtil.isNotEmpty(noDrawingNo)).throwMessage(StrUtil.join(",",noDrawingNo )+"图号为空"); - List noNum = excelContext.stream().filter(u -> Objects.isNull(u.getQty())).map(u->u.getRowNum()).collect(Collectors.toList()); - VUtils.isTure(CollUtil.isNotEmpty(noNum)).throwMessage( StrUtil.join(",",noNum )+"数量为空"); + List noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u -> u.getRowNum()).collect(Collectors.toList()); + VUtils.isTure(CollUtil.isNotEmpty(noLevelNo)).throwMessage(StrUtil.join(",", noLevelNo) + "层次为空"); + List noDrawingNo = excelContext.stream().filter(u -> StrUtil.isBlank(u.getChartNo())).map(u -> u.getRowNum()).collect(Collectors.toList()); + VUtils.isTure(CollUtil.isNotEmpty(noDrawingNo)).throwMessage(StrUtil.join(",", noDrawingNo) + "图号为空"); + List noNum = excelContext.stream().filter(u -> Objects.isNull(u.getQty())).map(u -> u.getRowNum()).collect(Collectors.toList()); + VUtils.isTure(CollUtil.isNotEmpty(noNum)).throwMessage(StrUtil.join(",", noNum) + "数量为空"); for (BomNewOriginalExcelDTO data : excelContext) { List parentData = excelContext.stream().filter(u -> u.getLevelNo().equals(data.getLevelNo() - 1) && u.getRowNum() < data.getRowNum()) @@ -464,7 +466,7 @@ public class BomNewOriginalParentService extends ServiceImpl chileds = excelContext.stream().filter(u -> u.getParentKey().equals(data.getLevelNo() + "-" + data.getRowNum())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(chileds)) { - int i=1; + int i = 1; for (BomNewOriginalExcelDTO ch : chileds) { ch.setOrderNo(i); i++; 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 43a54c8b..bdc735a3 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 @@ -1,18 +1,25 @@ 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.NumberUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; +import com.google.common.collect.ImmutableList; +import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.EBomExceptionStatusEnum; import com.nflg.product.bomnew.constant.MaterialGetEnum; +import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum; import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity; import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO; import com.nflg.product.bomnew.service.BomNewEbomParentService; import com.nflg.product.bomnew.service.MaterialMainService; import com.nflg.product.bomnew.util.ListCommonUtil; import com.nflg.product.bomnew.util.TreeUtils; +import com.nflg.product.bomnew.util.VUtils; import lombok.Getter; +import nflg.product.common.constant.STATE; import java.math.BigDecimal; import java.util.ArrayList; @@ -31,12 +38,16 @@ public class CheckEBomException { List allBomDetail ; public CheckEBomException(Long bomRowId) throws ExecutionException, InterruptedException { - allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId); - BomNewEbomParentEntity parent = SpringUtil.getBean(BomNewEbomParentService.class).getById(bomRowId); - BomNewEbomParentVO convert = Convert.convert(BomNewEbomParentVO.class, parent); - convert.setBomRowId(convert.getRowId()); - convert.setParentRowId(0L); - allBomDetail.add(convert); + +// allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId); +// BomNewEbomParentEntity parent = SpringUtil.getBean(BomNewEbomParentService.class).getById(bomRowId); +// BomNewEbomParentVO convert = Convert.convert(BomNewEbomParentVO.class, parent); +// convert.setBomRowId(convert.getRowId()); +// convert.setParentRowId(0L); +// allBomDetail.add(convert); + + allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).buildBomTreeContainSelf(bomRowId); + } /** @@ -58,9 +69,14 @@ public class CheckEBomException { if(Objects.isNull(vo.getExceptionStatus())) { 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()))) { + 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()); - } else if (StrUtil.isBlank(vo.getMaterialNo()) || Objects.isNull(vo.getNum()) || (Objects.nonNull(vo.getNum()) && BigDecimal.ZERO.compareTo(vo.getNum()) >= 0)) { + } else if (StrUtil.isBlank(vo.getMaterialNo()) + || Objects.isNull(vo.getNum()) + || (Objects.nonNull(vo.getNum()) + && BigDecimal.ZERO.compareTo(vo.getNum()) >= 0)) { vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue()); } else if (StrUtil.isNotBlank(vo.getMaterialNo()) && Objects.isNull(vo.getMaterialState())) { vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue()); @@ -106,15 +122,15 @@ public class CheckEBomException { } } - if ("Q".equals(parent.getProjectType())) { - List qList = child.stream().filter(u -> "Q".equals(u.getProjectType())).collect(Collectors.toList()); + if (ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.equals(parent.getProjectType())) { + List qList = child.stream().filter(u -> ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.equals(u.getProjectType())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(qList)) { parent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue()); qList.forEach(u -> u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue())); } } - if ("F".equals(parent.getProjectType())) { - List qList = child.stream().filter(u -> "F".equals(u.getProjectType())).collect(Collectors.toList()); + if (ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.equals(parent.getProjectType())) { + List qList = child.stream().filter(u -> ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.equals(u.getProjectType())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(qList)) { parent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()); qList.forEach(u -> u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue())); @@ -138,4 +154,32 @@ public class CheckEBomException { } } + + + public void checkContainExcept(List codeList) throws NflgBusinessException { + + if(CollUtil.isEmpty(codeList))return; + + for (BomNewEbomParentVO item: + allBomDetail) { + //并集 寻找相同 + List list=CollectionUtil.intersection(codeList, ImmutableList.of(item.getExceptionStatus())).stream().collect(Collectors.toList());; + + if(CollUtil.isNotEmpty(list)){ + + throw new NflgBusinessException(STATE.BusinessError, EBomExceptionStatusEnum.code2description(list.get(0))); + + } + + } + + + + } + + + + + + } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java index f071d22a..ed40aacc 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java @@ -45,8 +45,6 @@ public class EBomEdit { BomNewEbomParentEntity createParentBomInfo(BomNewEbomParentVO vo) { - - BomNewEbomParentEntity parent = new BomNewEbomParentEntity(); BeanUtil.copyProperties(parent, vo); @@ -73,6 +71,7 @@ public class EBomEdit { parent.setBomExist(1); parent.setLastVersionIs(1); parent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue()); + parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); if(StrUtil.isEmpty(parent.getProjectType())){ parent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue()); } @@ -96,7 +95,6 @@ public class EBomEdit { List materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); - //检查物料编码是否在主数据中存在 List materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos); List effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); @@ -143,7 +141,10 @@ public class EBomEdit { child.setCreatedTime(LocalDateTime.now()); child.setCreatedBy(SessionUtil.getUserCode()); child.setSourceRowId(0l); - } + parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); + parent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician()?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue()); + + } parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EbomInitProjectType.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EbomInitProjectType.java index 1413b2fc..580efded 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EbomInitProjectType.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EbomInitProjectType.java @@ -133,7 +133,7 @@ public class EbomInitProjectType { sameLevelChild = getChilds(child.getParentRowId()); sResult = sameLevelChild.stream().filter(u -> u.getMaterialCategoryCode().startsWith("2005") || u.getMaterialCategoryCode().startsWith("2006")).collect(Collectors.toList()); if (CollUtil.isNotEmpty(sResult)) { - List projectType = sResult.stream().map(u -> u.getProjectType()).distinct().collect(Collectors.toList()); + List projectType = sResult.stream().filter(u->StrUtil.isNotBlank(u.getProjectType())).map(u -> u.getProjectType()).distinct().collect(Collectors.toList()); if (projectType.size() == 1 && projectType.get(0).equals("Q")) { child.setProjectType("Q"); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/OriginalBom/OriginalBomToEBomConvert.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/OriginalBom/OriginalBomToEBomConvert.java index b06d6191..b19deace 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/OriginalBom/OriginalBomToEBomConvert.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/OriginalBom/OriginalBomToEBomConvert.java @@ -231,6 +231,7 @@ public class OriginalBomToEBomConvert extends BaseConvert { eBomParent.setConvertToEbomTime(LocalDateTime.now()); eBomParent.setSourceRowId(parentEnt.getBomRowId()); eBomParent.setLastVersionIs(1); + eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue()); eBomParent.setModifyTime(LocalDateTime.now()); eBomParent.setBomExist(parentEnt.getBomRowId()>0?1:0); //工艺岗直接到已复核 diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml index b7f70961..68999133 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml +++ b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml @@ -82,12 +82,12 @@ @@ -119,7 +119,7 @@ diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewOriginalParentMapper.xml b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewOriginalParentMapper.xml index e4afcf2b..30934a7f 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewOriginalParentMapper.xml +++ b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewOriginalParentMapper.xml @@ -48,7 +48,7 @@ and status=2 - and created_time> DATE_ADD(now(), INTERVAL -3 DAY) + and convert_to_ebom_time> DATE_ADD(now(), INTERVAL -3 DAY) @@ -111,7 +111,7 @@ - update t_bom_new_original_parent set status = #{status} where + update t_bom_new_original_parent set status = #{status},convert_to_ebom_time=now() where row_id in #{rowId} @@ -124,23 +124,27 @@ ; - + - update t_bom_new_original_parent set root_is=0,user_root_is=0 where last_version_is=1; + update t_bom_new_original_parent set root_is=0,user_root_is=0 where last_version_is=1 + + + update t_bom_new_original_parent a join ( select a.row_id from t_bom_new_original_parent a left join t_bom_new_original_child b on a.drawing_no=b.drawing_no - where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.root_is=1; - + where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.root_is=1 + + update t_bom_new_original_parent a join ( select a.row_id from t_bom_new_original_parent a left join t_bom_new_original_child b on a.drawing_no=b.drawing_no and a.created_by=b.created_by - where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.user_root_is=1; - + where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.user_root_is=1 +