fix(ebom): 编辑物料列表接口添加是否隐藏虚拟包参数

This commit is contained in:
曹鹏飞 2024-05-10 16:29:20 +08:00
parent 952da323cd
commit 8dc7503f39
2 changed files with 17 additions and 8 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

@ -1543,11 +1543,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);
@ -1559,8 +1559,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 {
@ -1572,7 +1571,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);
}