feat(dqbom): 同步到pbom时,如果是31码,则状态为已分配工厂,如果是21码,则状态为已发布;设置dept_row_id

This commit is contained in:
曹鹏飞 2024-06-03 08:49:26 +08:00
parent 75443db826
commit 96a7e92898
1 changed files with 5 additions and 4 deletions

View File

@ -509,7 +509,7 @@ public class DQBomService {
buildTree(root, parents, children);
dQBomParentService.updateBatchById(parents);
dQBomChildService.updateBatchById(children);
savePbomParents(parents);
savePbomParents(parents, root.getMaterialNo().startsWith("31") ? PBomStatusEnum.FACTORY_CONFIRM : PBomStatusEnum.PUBLISH);
savePbomChildren(children, parents);
CompletableFuture.runAsync(() -> {
@ -549,7 +549,7 @@ public class DQBomService {
bomNewPbomChildService.saveBatch(pchildren);
}
private void savePbomParents(List<BomNewDQbomParentEntity> parents) {
private void savePbomParents(List<BomNewDQbomParentEntity> parents, PBomStatusEnum status) {
List<BomNewPbomParentEntity> pparents = Convert.toList(BomNewPbomParentEntity.class, parents);
pparents.forEach(p -> {
if (Objects.equals(p.getRootIs(), 1)) {
@ -571,12 +571,13 @@ public class DQBomService {
p.setCreatedTime(LocalDateTime.now());
p.setModifyTime(null);
p.setEditStatus(PBomEditStatusEnum.HANDLER_FINISHED.getValue());
p.setStatus(PBomStatusEnum.WAIT_FACTORY.getValue());
p.setStatus(status.getValue());
p.setFacCode(FactoryCodeEnum.FACTORY_1010.getValue());
p.setSourceRowId(p.getRowId());
p.setLevelNum(parents.stream().filter(ps -> Objects.equals(ps.getRowId(), p.getRowId())).findFirst().get().getLevel());
p.setReleaseTime(LocalDateTime.now());
p.setReleaseUserName(SessionUtil.getUserName());
p.setDeptRowId(SessionUtil.getDepartRowId());
});
bomNewPbomParentService.saveBatch(pparents);
}
@ -601,7 +602,7 @@ public class DQBomService {
VUtils.isTure(true).throwMessage(StrUtil.format("{}的当前版本为{}比pbom中版本{}低", parent.getMaterialNo()
, parent.getCurrentVersion(), pp.getCurrentVersion()));
} else {
if (pp.getStatus() >= 4) {
if (pp.getStatus() >= PBomStatusEnum.PUBLISH.getValue()) {
parent.setCurrentVersion(VersionUtil.getNextVersion(pp.getCurrentVersion()));
pp.setLastVersionIs(0);
bomNewPbomParentService.updateById(pp);