已处理调整

This commit is contained in:
jing's 2023-12-27 17:51:41 +08:00
parent a65025da79
commit 81a1bd6112
1 changed files with 73 additions and 26 deletions

View File

@ -245,6 +245,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setCurrentVersion(parentEntity.getCurrentVersion());
child.setStatus(parentEntity.getStatus());
child.setDeviseName(parentEntity.getDeviseName());
child.setDeviseUserCode(parentEntity.getDeviseUserCode());
@ -256,7 +257,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());
@ -268,6 +269,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setDeviseUserCode(parent.getDeviseUserCode());
child.setDeviseName(parent.getDeviseName());
child.setDeptName(parent.getDeptName());
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
child.setStatus(parent.getStatus());
@ -788,21 +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.setStatus(EBomStatusEnum.RETURNED.getValue());
entity.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.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, "退回设计失败");
// }
}
@ -864,20 +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());
entity.setEditStatus(EbomEditStatusEnum.HANDLER_FINISHED.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;
}