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.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist());
child.setStatus(parentEntity.getStatus());
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.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> 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)) {
// 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)));
// }
if (pbomList.size() > 0) {
if (CollectionUtil.isNotEmpty(pbomList) ) {
List<String> materialNoList = pbomList.stream().map(BomNewEbomParentVO::getMaterialNo).collect(Collectors.toList());
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<>();
for (Long rowId : revertList) {
BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
entity.setRowId(rowId);
entity.setEditStatus(EBomStatusEnum.RETURNED.getValue());
entity.setRevertTime(LocalDateTime.now());
entity.setRevertUserName(dto.getRevertUserName());
updateList.add(entity);
if(CollectionUtil.isNotEmpty(revertList)) {
UpdateWrapper<BomNewEbomParentEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda()
.set(BomNewEbomParentEntity::getAuditTime, LocalDateTime.now())
.set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName())
.set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.RETURNED.getValue())
.set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue())
.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)) {
throw new NflgBusinessException(STATE.Error, "退回设计失败");
}
//重新创建保存list 避免污染
// 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<>();
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(CollectionUtil.isNotEmpty(updateReviewIdList)){
UpdateWrapper<BomNewEbomParentEntity> updateWrapper=new UpdateWrapper<>();
updateWrapper.lambda()
.set(BomNewEbomParentEntity::getAuditTime,LocalDateTime.now())
.set(BomNewEbomParentEntity::getAuditUserName,SessionUtil.getUserName())
.set(BomNewEbomParentEntity::getStatus,EBomStatusEnum.CHECKED.getValue())
.set(BomNewEbomParentEntity::getEditStatus,EbomEditStatusEnum.HANDLER_FINISHED.getValue())
.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;
}
@ -1021,8 +1068,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
computeLevelNumAndRootState();
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
// computeLevelNumAndRootState();
}
return true;