optimize(ebom): 从excel导入时,将本人以前导入的草稿数据中的顶级设置为非顶级

This commit is contained in:
曹鹏飞 2024-06-29 22:55:38 +08:00
parent 6eee207e29
commit 7357e70ce7
1 changed files with 11 additions and 0 deletions

View File

@ -118,6 +118,17 @@ public class EBomImportService {
});
bomNewEbomParentService.setLastVersionIs0(oldParents.stream().map(BomNewEbomParentEntity::getRowId).collect(Collectors.toList()));
}
//取消本人以前导入的草稿状态的bom的顶级状态
Set<String> materialNos = children.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet());
bomNewEbomParentService.lambdaUpdate()
.set(BomNewEbomParentEntity::getRootIs, 0)
.set(BomNewEbomParentEntity::getUserRootIs, 0)
.set(BomNewEbomParentEntity::getRootIsForWaitReview, 0)
.in(BomNewEbomParentEntity::getMaterialNo, materialNos)
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
.eq(BomNewEbomParentEntity::getCreatedBy, SessionUtil.getUserCode())
.update();
bomNewEbomParentService.saveBatch(parents);
bomNewEbomChildService.saveBatch(children);
}