调整删除

This commit is contained in:
jing's 2024-03-28 16:47:43 +08:00
parent 7c5c9abc40
commit d0050dd1ad
2 changed files with 25 additions and 15 deletions

View File

@ -1106,7 +1106,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public void revertDesign(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException {
List<Long> rowIds = dto.getRowIdList();
List<BomNewEbomParentEntity> bomNewEbomParentEntityList = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, rowIds).eq(BomNewEbomParentEntity::getRootIs, 1).list();
List<BomNewEbomParentEntity> bomNewEbomParentEntityList = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, rowIds).eq(BomNewEbomParentEntity::getUserRootIs, 1).list();
if (CollUtil.isEmpty(bomNewEbomParentEntityList)) {
VUtils.isTure(true).throwMessage("下级BOM无法进行退回请选择顶层");
}
@ -1471,7 +1471,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
QueryWrapper<BomNewEbomParentEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda() .eq(BomNewEbomParentEntity::getRowId, bomRowId)
.eq(BomNewEbomParentEntity::getRootIs, 1);
.eq(BomNewEbomParentEntity::getUserRootIs, 1);
BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectOne(queryWrapper);
@ -1486,18 +1486,27 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// }
//待复核和已退回才能删除
VUtils.isTure(parentEntity.getStatus().equals(EBomStatusEnum.WAIT_CHECK.getValue())
|| parentEntity.getStatus().equals(EBomStatusEnum.RETURNED.getValue()))
VUtils.isTure(!(parentEntity.getStatus().equals(EBomStatusEnum.WAIT_CHECK.getValue())
|| parentEntity.getStatus().equals(EBomStatusEnum.RETURNED.getValue())))
.throwMessage(EBomStatusEnum.findByValue(parentEntity.getStatus()).getDescription() + "状态不能删除");
EBomDel eBomDel = new EBomDel(bomRowId);
eBomDel.classifyBom();
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
List<Long> bomRowIdList= eBomDel.getDelEBom().stream()
.map(BomNewEbomParentVO::getBomRowId) .collect(Collectors.toList());
//取bom信息删除
this.getBaseMapper().delBatch(eBomDel.getDelEBom().stream()
.map(BomNewEbomParentVO::getBomRowId)
.collect(Collectors.toList()));
this.getBaseMapper().delBatch(bomRowIdList);
QueryWrapper<BomNewEbomChildEntity > delChildQuery=new QueryWrapper<>();
delChildQuery.lambda().in(BomNewEbomChildEntity::getParentRowId,bomRowIdList);
SpringUtil.getBean(BomNewEbomChildService.class).getBaseMapper().delete(delChildQuery);
}
@ -1506,6 +1515,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<Long> rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList());
SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds);
}
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
@ -1672,12 +1685,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// checkAndSaveEBomException(dto.getParent().getBomRowId());
List<BomNewEbomParentVO> childList = dto.getDatas();
if (dto.getParent().getRootIs() == null || dto.getParent().getRootIs() == 0) {
childList.add(dto.getParent());
}
return true;

View File

@ -244,7 +244,10 @@ public class EBomEdit {
QueryWrapper<BomNewEbomChildEntity> queryChildWrapper=new QueryWrapper<>();
List<Long> rowIds=notNullRowIdList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
List<Long> rowIds=notNullRowIdList.stream().filter(u->ObjectUtil.isNotNull(u.getRowId()) && u.getRowId()>0 ).map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
if(CollUtil.isEmpty(rowIds)){
return;
}
queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId,rowIds);
List<BomNewEbomChildEntity> childList=SpringUtil.getBean(BomNewEbomChildService.class).list(queryChildWrapper);