暂存、提交 非定版相同Bom变更状态

This commit is contained in:
jing's 2024-03-31 10:43:48 +08:00
parent f21f7585b4
commit d10962d79c
1 changed files with 32 additions and 17 deletions

View File

@ -1522,8 +1522,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;
@ -1600,15 +1600,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (eBomEdit.getParentEntity() != null) { if (eBomEdit.getParentEntity() != null) {
//同一物料且存在一个 lastVersionIs=1
if(ObjectUtil.isNotNull(eBomEdit.getParentEntity().getLastVersionIs())
&& ObjectUtil.equal(eBomEdit.getParentEntity().getLastVersionIs(),1L)) {
BomNewEbomParentEntity oldParent= this.lambdaQuery()
.eq(BomNewEbomParentEntity::getMaterialNo, eBomEdit.getParentEntity().getMaterialNo())
.eq(BomNewEbomParentEntity::getLastVersionIs,1)
.ne(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
.ne(BomNewEbomParentEntity::getRowId, eBomEdit.getParentEntity().getRowId())
.one();
if(ObjectUtil.isNotNull(eBomEdit.getParentEntity().getLastVersionIs()) && ObjectUtil.equal(eBomEdit.getParentEntity().getLastVersionIs(),1)) { if(Objects.nonNull(oldParent)){
QueryWrapper<BomNewEbomParentEntity> queryWrapper = new QueryWrapper<>(); oldParent.setLastVersionIs(0);
queryWrapper.lambda().eq(BomNewEbomParentEntity::getMaterialNo, eBomEdit.getParentEntity().getMaterialNo()); this.updateById(oldParent);
queryWrapper.lambda().eq(BomNewEbomParentEntity::getLastVersionIs, 1); }
queryWrapper.lambda().notIn(BomNewEbomParentEntity::getRowId, eBomEdit.getParentEntity().getRowId());
} }
this.saveOrUpdate(eBomEdit.getParentEntity()); this.saveOrUpdate(eBomEdit.getParentEntity());
@ -1664,6 +1669,23 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (eBomEdit.getParentEntity() != null) { if (eBomEdit.getParentEntity() != null) {
//同一物料且存在一个 lastVersionIs=1
if(ObjectUtil.isNotNull(eBomEdit.getParentEntity().getLastVersionIs())
&& ObjectUtil.equal(eBomEdit.getParentEntity().getLastVersionIs(),1L)) {
BomNewEbomParentEntity oldParent= this.lambdaQuery()
.eq(BomNewEbomParentEntity::getMaterialNo, eBomEdit.getParentEntity().getMaterialNo())
.eq(BomNewEbomParentEntity::getLastVersionIs,1)
.ne(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
.ne(BomNewEbomParentEntity::getRowId, eBomEdit.getParentEntity().getRowId())
.one();
if(Objects.nonNull(oldParent)){
oldParent.setLastVersionIs(0);
this.updateById(oldParent);
}
}
this.saveOrUpdate(eBomEdit.getParentEntity()); this.saveOrUpdate(eBomEdit.getParentEntity());
} }
@ -1686,13 +1708,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// checkAndSaveEBomException(dto.getParent().getBomRowId()); // checkAndSaveEBomException(dto.getParent().getBomRowId());
List<BomNewEbomParentVO> childList = dto.getDatas();
if (dto.getParent().getRootIs() == null || dto.getParent().getRootIs() == 0) {
childList.add(dto.getParent());
}
return true; return true;