Merge branch 'feature/DM/nflg-bom-transition'

This commit is contained in:
jing's 2024-09-10 16:45:30 +08:00
commit f243456805
2 changed files with 76 additions and 77 deletions

View File

@ -2140,10 +2140,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// return dto.getParent(); // return dto.getParent();
// } // }
//检查是否在主数据里
if (CollUtil.isNotEmpty(dto.getDatas())) {
CheckEBomException.checkMaterialNoInMain(dto.getDatas());
}
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue()); EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());
dto.setOpType(EbomEditStatusEnum.HANDLER_CREATED.getValue()); dto.setOpType(EbomEditStatusEnum.HANDLER_CREATED.getValue());
@ -2163,12 +2160,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
//ebomChildService.getBaseMapper().updateEBomMaterialUse(); //ebomChildService.getBaseMapper().updateEBomMaterialUse();
} }
if(CollUtil.isNotEmpty(dto.getDatas())) {
superMaterialStatus(dto.getDatas()); superMaterialStatus(dto.getDatas());
}
// checkAndSaveEBomException(childList);
//不要异步 //不要异步
ebomChildService.updateEBomMaterialUse(eBomEdit.childEntities.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet())); ebomChildService.updateEBomMaterialUse(eBomEdit.childEntities.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet()));
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
if (eBomEdit.isRootForWaitReview()) { if (eBomEdit.isRootForWaitReview()) {
updateRootForWaitReview(); updateRootForWaitReview();
@ -2197,10 +2196,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
//检查是否在主数据里
if (CollUtil.isNotEmpty(dto.getDatas())) {
CheckEBomException.checkMaterialNoInMain(dto.getDatas());
}
//构建操作数据 //构建操作数据
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue()); EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());
dto.setOpType(EbomEditStatusEnum.HANDLER_FINISHED.getValue()); dto.setOpType(EbomEditStatusEnum.HANDLER_FINISHED.getValue());
@ -2242,7 +2238,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities); ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
} }
if (CollectionUtil.isNotEmpty(dto.getDatas())) {
superMaterialStatus(dto.getDatas()); superMaterialStatus(dto.getDatas());
}
// checkAndSaveEBomException(dto.getParent().getBomRowId()); // checkAndSaveEBomException(dto.getParent().getBomRowId());
if (eBomEdit.isRootForWaitReview()) { if (eBomEdit.isRootForWaitReview()) {

View File

@ -113,6 +113,7 @@ public class EBomEdit {
/** /**
* 如果有定版后才能新建bom * 如果有定版后才能新建bom
*
* @param materialNo * @param materialNo
*/ */
void checkHadBom(String materialNo) { void checkHadBom(String materialNo) {
@ -125,9 +126,6 @@ public class EBomEdit {
} }
void createRootBom(BomNewEBomParentEditDTO createDTO) { void createRootBom(BomNewEBomParentEditDTO createDTO) {
checkHadBom(createDTO.getParent().getMaterialNo()); checkHadBom(createDTO.getParent().getMaterialNo());
@ -262,9 +260,6 @@ public class EBomEdit {
throw new NflgBusinessException(STATE.Error, "parent 数据不能为空"); throw new NflgBusinessException(STATE.Error, "parent 数据不能为空");
} }
// if (CollUtil.isEmpty(dto.getDatas())) {
// throw new NflgBusinessException(STATE.Error, "datas 数据不能为空");
// }
List<String> materialNos = dto.getDatas().stream() List<String> materialNos = dto.getDatas().stream()
.filter(f -> !StrUtil.equals(f.getProjectType(), BomConstant.PROJECT_TYPE_TEMPORARY, true)) .filter(f -> !StrUtil.equals(f.getProjectType(), BomConstant.PROJECT_TYPE_TEMPORARY, true))
@ -276,6 +271,11 @@ public class EBomEdit {
//检查物料编码是否在主数据中存在 //检查物料编码是否在主数据中存在
//暂存不需检查提交时检查 //暂存不需检查提交时检查
if (ObjectUtil.equal(EbomEditStatusEnum.HANDLER_FINISHED.getValue(), dto.getOpType())) { if (ObjectUtil.equal(EbomEditStatusEnum.HANDLER_FINISHED.getValue(), dto.getOpType())) {
List<String> checkMaterialInNull = materialNos.stream().filter(item -> StrUtil.isEmpty(item)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(checkMaterialInNull)) {
VUtils.isTure(true).throwMessage("提交数据包含空物料编码");
}
materialNos.add(dto.getParent().getMaterialNo()); materialNos.add(dto.getParent().getMaterialNo());
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos); List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList()); List<String> effectiveMaterialNos = materialBaseInfo.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList());
@ -300,6 +300,9 @@ public class EBomEdit {
List<BomNewEbomChildEntity> check1List = childList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource()) List<BomNewEbomChildEntity> check1List = childList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
&& Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList()); && Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());
if (CollUtil.isEmpty(check1List)) {
return;
}
for (BomNewEbomChildEntity childEntity : for (BomNewEbomChildEntity childEntity :
check1List) { check1List) {
if (mapList.get(childEntity.getRowId()) == null) { if (mapList.get(childEntity.getRowId()) == null) {
@ -319,8 +322,6 @@ public class EBomEdit {
} }
public void handleBom(BomNewEBomParentEditDTO dto) { public void handleBom(BomNewEBomParentEditDTO dto) {
checkDataRule(dto); checkDataRule(dto);
//添加根节点数据 //添加根节点数据