Merge branch 'refs/heads/feature/DM/nflg-bom' into feature/DM/nflg-bom-transition

This commit is contained in:
曹鹏飞 2024-05-10 16:29:34 +08:00
commit 756bb53a39
3 changed files with 24 additions and 13 deletions

View File

@ -289,10 +289,10 @@ public class EbomApi extends BaseApi {
return ResultVO.success(true);
}
@GetMapping("editDetail")
@ApiOperation("编辑物料列表")
public ResultVO<BomNewEbomEditDetailVO> editDetail(@RequestParam("rowId") Long rowId, @RequestParam("bomRowId") Long bomRowId, @RequestParam("projectType") String projectType) {
public ResultVO<BomNewEbomEditDetailVO> editDetail(@RequestParam("rowId") Long rowId, @RequestParam("bomRowId") Long bomRowId
, @RequestParam("projectType") String projectType, @RequestParam(value = "hideVirtualPackage", defaultValue = "0") Integer hideVirtualPackage) {
if (Objects.isNull(rowId)) {
VUtils.isTure(true).throwMessage("rowId 不能为空");
}
@ -300,7 +300,7 @@ public class EbomApi extends BaseApi {
VUtils.isTure(true).throwMessage("bomRowId不能为空");
}
return ResultVO.success(bomNewEbomParentService.editDetail(rowId, bomRowId, projectType));
return ResultVO.success(bomNewEbomParentService.editDetail(rowId, bomRowId, projectType, hideVirtualPackage));
}
@PostMapping("updateProjectType")

View File

@ -1537,11 +1537,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
return true;
}
public BomNewEbomEditDetailVO editDetail(Long rowId, Long bomRowId, String projectType) {
public BomNewEbomEditDetailVO editDetail(Long rowId, Long bomRowId, String projectType, Integer hideVirtualPackage) {
BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO();
BomNewEbomParentVO parentVO;
if (bomRowId == null || bomRowId.longValue() == 0) {
if (bomRowId == null || bomRowId == 0) {
BomNewEbomChildEntity child = SpringUtil.getBean(BomNewEbomChildService.class).getBaseMapper().selectById(rowId);
@ -1553,8 +1553,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|| parentVO.getMaterialCategoryCode().equals("7013")) {
;
} else {
VUtils.isTure(true).throwMessage("编辑条件需满足1.存在下级物料或是缺BOM 2.物料的分类20且流程类型为外协和采购部分\n" +
" 3.分类70中的7013时的物料 ");
VUtils.isTure(true).throwMessage("编辑条件需满足<br/>1.存在下级物料或是缺BOM<br/>2.物料的分类20且流程类型为外协和采购部分<br/>3.分类70中的7013时的物料 ");
}
vo.setDatas(new ArrayList<>());
} else {
@ -1566,7 +1565,17 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
parentVO.setParentRowId(0L);
parentVO.setChildBomRowId(rowId);
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
vo.setDatas(getChild(bomRowId));
List<BomNewEbomParentVO> childList = getChild(bomRowId);
if (hideVirtualPackage == 1) {
List<BomNewEbomParentVO> virtualPackageList = childList.stream()
.filter(c -> c.getVirtualPackageIs() == 1 && c.getBomRowId() > 0)
.collect(Collectors.toList());
virtualPackageList.forEach(v -> {
childList.remove(v);
childList.addAll(getChild(v.getBomRowId()));
});
}
vo.setDatas(childList);
}

View File

@ -255,11 +255,13 @@ public class EBomEdit {
}
materialNos.add(dto.getParent().getMaterialNo());
//检查物料编码是否在主数据中存在
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料主数据中不存在");
//暂存不需检查提交时检查
if(ObjectUtil.equal(EbomEditStatusEnum.HANDLER_FINISHED.getValue(),dto.getOpType())) {
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料主数据中不存在");
}
//检查数据是否可修改
List<BomNewEbomParentVO> notNullRowIdList= dto.getDatas().stream().filter(u->u.getRowId()!=null && u.getRowId()>0).collect(Collectors.toList());