Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom

# Conflicts:
#	nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java
This commit is contained in:
大米 2023-12-27 19:35:44 +08:00
commit 77a04f6911
1 changed files with 75 additions and 28 deletions

View File

@ -256,7 +256,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setSourceRowId(parentEntity.getSourceRowId()); child.setSourceRowId(parentEntity.getSourceRowId());
child.setBomExist(parentEntity.getBomExist()); child.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist()); child.setShouldBomExist(parentEntity.getShouldBomExist());
child.setStatus(parentEntity.getStatus());
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) { if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue()); child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue());
@ -765,7 +765,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// List<BomNewEbomParentEntity> waitList = bomNewEbomParentEntityList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.WAIT_CHECK.getValue())).collect(Collectors.toList()); // List<BomNewEbomParentEntity> waitList = bomNewEbomParentEntityList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.WAIT_CHECK.getValue())).collect(Collectors.toList());
// List<BomNewEbomParentEntity> revertList = bomNewEbomParentEntityList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.RETURNED.getValue())).collect(Collectors.toList()); // List<BomNewEbomParentEntity> revertList = bomNewEbomParentEntityList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.RETURNED.getValue())).collect(Collectors.toList());
List<BomNewEbomParentVO> pbomList = bomTreeList.stream().filter(item -> item.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())).collect(Collectors.toList()); List<BomNewEbomParentVO> pbomList = bomTreeList.stream().filter(item -> EBomStatusEnum.PUBLISHED.getValue().equals(item.getStatus())).collect(Collectors.toList());
// if (CollUtil.isNotEmpty(waitList)) { // if (CollUtil.isNotEmpty(waitList)) {
// List<String> materialNoList = waitList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList()); // List<String> materialNoList = waitList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList());
// //
@ -776,7 +776,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// //
// throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编号 {} 状态为已退回,不需要退回设计", StrUtil.join(",", materialNoList))); // throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编号 {} 状态为已退回,不需要退回设计", StrUtil.join(",", materialNoList)));
// } // }
if (pbomList.size() > 0) { if (CollectionUtil.isNotEmpty(pbomList) ) {
List<String> materialNoList = pbomList.stream().map(BomNewEbomParentVO::getMaterialNo).collect(Collectors.toList()); List<String> 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)));
@ -790,20 +790,44 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
//重新创建保存list 避免污染
List<BomNewEbomParentEntity> updateList = new ArrayList<>(); if(CollectionUtil.isNotEmpty(revertList)) {
for (Long rowId : revertList) { UpdateWrapper<BomNewEbomParentEntity> updateWrapper = new UpdateWrapper<>();
BomNewEbomParentEntity entity = new BomNewEbomParentEntity(); updateWrapper.lambda()
entity.setRowId(rowId); .set(BomNewEbomParentEntity::getAuditTime, LocalDateTime.now())
entity.setEditStatus(EBomStatusEnum.RETURNED.getValue()); .set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName())
entity.setRevertTime(LocalDateTime.now()); .set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.RETURNED.getValue())
entity.setRevertUserName(dto.getRevertUserName()); .set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue())
updateList.add(entity); .in(BomNewEbomParentEntity::getRowId, revertList);
UpdateWrapper<BomNewEbomChildEntity > childWrapper = new UpdateWrapper<>();
childWrapper.lambda()
.set(BomNewEbomChildEntity::getModifyTime, LocalDateTime.now())
.set(BomNewEbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue())
.in(BomNewEbomChildEntity ::getParentRowId, revertList);
if (!this.update(updateWrapper)) {
throw new NflgBusinessException(STATE.Error, "退回设计失败");
}
ebomChildService.update(childWrapper);
} }
if (!this.updateBatchById(updateList)) { //重新创建保存list 避免污染
throw new NflgBusinessException(STATE.Error, "退回设计失败"); // List<BomNewEbomParentEntity> updateList = new ArrayList<>();
} // for (Long rowId : revertList) {
// BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
// entity.setRowId(rowId);
// entity.setStatus(EBomStatusEnum.RETURNED.getValue());
// entity.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
// entity.setRevertTime(LocalDateTime.now());
// entity.setRevertUserName(dto.getRevertUserName());
// updateList.add(entity);
// }
//
// if (!this.updateBatchById(updateList)) {
// throw new NflgBusinessException(STATE.Error, "退回设计失败");
// }
} }
@ -865,19 +889,42 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
//改变复核状态 //改变复核状态
List<BomNewEbomParentEntity> updateReviewList = new ArrayList<>(); if(CollectionUtil.isNotEmpty(updateReviewIdList)){
for (Long id : updateReviewIdList) { UpdateWrapper<BomNewEbomParentEntity> updateWrapper=new UpdateWrapper<>();
BomNewEbomParentEntity entity = new BomNewEbomParentEntity(); updateWrapper.lambda()
entity.setRowId(id); .set(BomNewEbomParentEntity::getAuditTime,LocalDateTime.now())
entity.setAuditTime(LocalDateTime.now()); .set(BomNewEbomParentEntity::getAuditUserName,SessionUtil.getUserName())
entity.setAuditUserName(dto.getRevertUserName()); .set(BomNewEbomParentEntity::getStatus,EBomStatusEnum.CHECKED.getValue())
entity.setStatus(EBomStatusEnum.CHECKED.getValue()); .set(BomNewEbomParentEntity::getEditStatus,EbomEditStatusEnum.HANDLER_FINISHED.getValue())
updateReviewList.add(entity); .in(BomNewEbomParentEntity::getRowId,updateReviewIdList);
}
UpdateWrapper<BomNewEbomChildEntity > childWrapper = new UpdateWrapper<>();
childWrapper.lambda()
.set(BomNewEbomChildEntity::getModifyTime, LocalDateTime.now())
.set(BomNewEbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue())
.in(BomNewEbomChildEntity ::getParentRowId, updateReviewIdList);
if (! this.update(updateWrapper)) {
throw new NflgBusinessException(STATE.Error, "复核失败");
}
ebomChildService.update(childWrapper);
if (!this.updateBatchById(updateReviewList)) {
throw new NflgBusinessException(STATE.Error, "复核失败");
} }
// List<BomNewEbomParentEntity> 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());
// entity.setEditStatus(EbomEditStatusEnum.HANDLER_FINISHED.getValue());
// updateReviewList.add(entity);
// }
//
// if (!this.updateBatchById(updateReviewList)) {
// throw new NflgBusinessException(STATE.Error, "复核失败");
// }
return true; return true;
} }
@ -1021,8 +1068,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) { if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
computeLevelNumAndRootState(); // computeLevelNumAndRootState();
} }
return true; return true;