Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom

This commit is contained in:
大米 2024-03-28 19:26:24 +08:00
commit 5505efa335
8 changed files with 74 additions and 21 deletions

View File

@ -167,6 +167,7 @@ public class OriginalBomApi extends BaseApi {
//更新-原始BOM跟节点
CompletableFuture.runAsync(() -> {
originalParentService.getBaseMapper().updateRootState_1(OriginalStatusEnum.OVER_CONVERT.getValue());
originalParentService.getBaseMapper().updateRootState_2(OriginalStatusEnum.OVER_CONVERT.getValue());
originalParentService.getBaseMapper().updateRootState_3(OriginalStatusEnum.OVER_CONVERT.getValue());
});

View File

@ -38,7 +38,7 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
/**
* 更新是否根节点状态
*/
void updateRootState_1();
void updateRootState_1(@Param("status") Integer status);
void updateRootState_2(@Param("status") Integer status);
void updateRootState_3(@Param("status") Integer status);

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无法进行退回请选择顶层");
}
@ -1185,7 +1185,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
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::getUserRootIs, rowIds).eq(BomNewEbomParentEntity::getUserRootIs, 1).list();
if (CollUtil.isEmpty(bomNewEbomParentEntityList)) {
// return ResultVO.error("下级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());
@ -1585,6 +1598,25 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (eBomEdit.getParentEntity() != null) {
if(ObjectUtil.isNotNull(eBomEdit.getParentEntity().getLastVersionIs()) && ObjectUtil.equal(eBomEdit.getParentEntity().getLastVersionIs(),1)) {
QueryWrapper<BomNewEbomParentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BomNewEbomParentEntity::getMaterialNo, eBomEdit.getParentEntity().getMaterialNo());
queryWrapper.lambda().eq(BomNewEbomParentEntity::getLastVersionIs, 1);
queryWrapper.lambda().notIn(BomNewEbomParentEntity::getRowId, eBomEdit.getParentEntity().getRowId());
BomNewEbomParentEntity oldParent= this.getOne(queryWrapper);
if(oldParent!=null){
eBomEdit.getParentEntity().setCurrentVersion(oldParent.getCurrentVersion());
BomNewEbomParentEntity updateOld=new BomNewEbomParentEntity();
updateOld.setLastVersionIs(0);
updateOld.setModifyTime(LocalDateTime.now());
updateOld.setRowId(oldParent.getRowId());
this.updateById(updateOld);
}
}
this.saveOrUpdate(eBomEdit.getParentEntity());
}
@ -1638,6 +1670,25 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (eBomEdit.getParentEntity() != null) {
if(ObjectUtil.isNotNull(eBomEdit.getParentEntity().getLastVersionIs()) && ObjectUtil.equal(eBomEdit.getParentEntity().getLastVersionIs(),1)) {
QueryWrapper<BomNewEbomParentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BomNewEbomParentEntity::getMaterialNo, eBomEdit.getParentEntity().getMaterialNo());
queryWrapper.lambda().eq(BomNewEbomParentEntity::getLastVersionIs, 1);
queryWrapper.lambda().notIn(BomNewEbomParentEntity::getRowId, eBomEdit.getParentEntity().getRowId());
BomNewEbomParentEntity oldParent= this.getOne(queryWrapper);
if(oldParent!=null){
eBomEdit.getParentEntity().setCurrentVersion(oldParent.getCurrentVersion());
BomNewEbomParentEntity updateOld=new BomNewEbomParentEntity();
updateOld.setLastVersionIs(0);
updateOld.setModifyTime(LocalDateTime.now());
updateOld.setRowId(oldParent.getRowId());
this.updateById(updateOld);
}
}
this.saveOrUpdate(eBomEdit.getParentEntity());
}
@ -1660,12 +1711,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

@ -428,7 +428,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
public void computeLevelNumAndRootState() {
try {
this.getBaseMapper().updateRootState_1();
this.getBaseMapper().updateRootState_1(OriginalStatusEnum.UN_CONVERT.getValue());
this.getBaseMapper().updateRootState_2(OriginalStatusEnum.UN_CONVERT.getValue());
this.getBaseMapper().updateRootState_3(OriginalStatusEnum.UN_CONVERT.getValue());
// this.compucteLevelNum();

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);
@ -285,7 +288,7 @@ public class EBomEdit {
//缺bom
if (dto.getParent().getBomRowId() == null || dto.getParent().getBomRowId().longValue() == 0) {
checkHadBom(dto.getParent().getMaterialNo());
checkHadBom(dto.getParent().getMaterialNo());
dto.getParent().setBomRowId(dto.getParent().getRowId());
parentEntity = createParentBomInfo(dto.getParent());

View File

@ -126,7 +126,11 @@ public abstract class VirtualPackageBase {
protected BomNewEbomParentEntity buildParentVirtualPackage(Long rowId,VirtualPackageTypeEnum virtualPackageTypeEnum) throws IOException {
AddVirtrualMaterialDTO addM = vMNos.get(StrUtil.join("",rowId,virtualPackageTypeEnum.getConMaterialName()));
BomNewEbomParentEntity oldParent= SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, addM.getMaterialNo()).eq(BomNewEbomParentEntity::getLastVersionIs,1).one();
BomNewEbomParentEntity oldParent= SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery()
.eq(BomNewEbomParentEntity::getMaterialNo, addM.getMaterialNo())
.eq(BomNewEbomParentEntity::getLastVersionIs,1)
.ne(BomNewEbomParentEntity::getStatus,4)
.one();
if(Objects.nonNull(oldParent)){
oldParent.setLastVersionIs(0);

View File

@ -195,7 +195,7 @@
<update id="updateRootState">
update t_bom_new_ebom_parent
set root_is=0, user_root_is=0
where last_version_is = 1;
where last_version_is = 1 AND `status` &lt; 4;
update t_bom_new_ebom_parent a left join (

View File

@ -146,7 +146,7 @@
update t_bom_new_original_parent
set root_is=0,
user_root_is=0
where last_version_is = 1
where last_version_is = 1 and `status`= #{status}
</update>
<!--处理根节点-->
<update id="updateRootState_2">