EBOM生成虚拟包

This commit is contained in:
大米 2024-02-28 16:33:01 +08:00
parent 9efab16980
commit 4999312fbc
4 changed files with 34 additions and 20 deletions

View File

@ -104,8 +104,11 @@ public class PBomApi extends BaseApi {
@PostMapping("editSubmit")
@ApiOperation("编辑-提交")
public ResultVO<Boolean> editSubmit(@Valid @RequestBody EditPBomParamDTO param){
//检查物料编码是否存在
bomNewPbomParentService.checkMaterialNo(param.getChildList());
//检查物料是否被冻结
materialMainService.checkMaterialFreeze(param.getChildList());
bomNewPbomParentService.editSave(param, PBomEditStatusEnum.HANDLER_FINISHED);
return ResultVO.success(true);
}

View File

@ -311,6 +311,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
public void editSave(EditPBomParamDTO paramDTO, PBomEditStatusEnum editStatus) {
BomNewPbomParentEntity parent = this.getById(paramDTO.getBomRowId());
VUtils.isTure(Objects.isNull(parent)).throwMessage("参数错误该BOM不存在");
List<BomNewPbomChildEntity> childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList());
childList.forEach(u -> {
u.setParentRowId(paramDTO.getBomRowId());
@ -322,8 +323,22 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
}
/**
* 1物料编码不能为空
* 2物料编码需在主数据中存在
*/
public void checkMaterialNo(List<BomNewPbomParentVO> data) {
List<BomNewPbomParentVO> noMaterialNoList = data.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
VUtils.isTure(CollUtil.isNotEmpty(noMaterialNoList)).throwMessage("存在物料编码为空的数据");
List<String> materialNos = data.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
List<BaseMaterialVO> mainMaterialList = materialMainService.getMaterialBaseInfo(materialNos);
Set<String> mainMaterialNoSet = mainMaterialList.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
Set<String> difference = Sets.difference(Sets.newHashSet(materialNos), mainMaterialNoSet);
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference)+"物料编码在主数据中不存在");
}
/**
@ -738,7 +753,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
/**
* 修改生产工厂
* 重新发布
*
*/
public void reConvertToMBom(Long bomRowId, List<Long> sourceRowId) throws ExecutionException, InterruptedException {
@ -873,7 +887,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
}
private void importSap(BomNewPbomParentEntity parent, List<BomNewPbomParentVO> children) {
Sap sap = new Sap(parent, children);
@ -886,8 +899,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
}
/**
* 获取CRM 订单号
*

View File

@ -31,7 +31,7 @@ public class MaterialshouldBomExistUtil {
if(StrUtil.isNotBlank(material.getMaterialCategoryCode()) &&
(material.getMaterialCategoryCode().startsWith("30") || material.getMaterialCategoryCode().equals(OriginalConstant.COMMON_MATERIAL_CATEGORY_CODE) ||
( material.getMaterialCategoryCode().startsWith("20") && material.getMaterialGetType().equals(MaterialGetEnum.developing.getValue())))){
( material.getMaterialCategoryCode().startsWith("20") && MaterialGetEnum.developing.equalsValue(material.getMaterialGetType()) ))){
return true;
}

View File

@ -20,7 +20,7 @@ public class SessionUtil {
* @return
*/
public static Long getRowId() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getRowId).orElse(null);
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getRowId).orElse(1585164668335439881L);
}
/**