feat(ebom): 工作表借用件支持展开显示
This commit is contained in:
parent
7806d18874
commit
acc2e770fd
|
|
@ -110,11 +110,17 @@ public class EbomApi extends BaseApi {
|
||||||
return ResultVO.success(true);
|
return ResultVO.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取子级
|
||||||
|
* @param bomRowId bom行id
|
||||||
|
* @param type 类型:0-工作表数据;1-正式表数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("getChild")
|
@GetMapping("getChild")
|
||||||
@ApiOperation("获取子级")
|
@ApiOperation("获取子级")
|
||||||
public ResultVO<List<BomNewEbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId) {
|
public ResultVO<List<BomNewEbomParentVO>> getChild(@Valid @RequestParam("bomRowId") @NotNull Long bomRowId
|
||||||
return ResultVO.success(bomNewEbomParentService.getChild(bomRowId));
|
, @Valid @RequestParam("type") @NotNull Integer type) {
|
||||||
|
return ResultVO.success(bomNewEbomParentService.getChild(bomRowId, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("projectTypeInit")
|
@PostMapping("projectTypeInit")
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
* @param rowId
|
* @param rowId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<BomNewEbomParentVO> getChild(Long rowId) {
|
public List<BomNewEbomParentVO> getChild(Long rowId, Integer type) {
|
||||||
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(rowId);
|
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(rowId);
|
||||||
|
|
||||||
List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
|
List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
|
||||||
|
|
@ -387,10 +387,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
child.setNoticeNums(parentEntity.getNoticeNums());
|
child.setNoticeNums(parentEntity.getNoticeNums());
|
||||||
child.setSuperMaterialStatus(parentEntity.getSuperMaterialStatus());
|
child.setSuperMaterialStatus(parentEntity.getSuperMaterialStatus());
|
||||||
|
|
||||||
if (!parent.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())
|
if ((type == 0 || !parent.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue()))
|
||||||
&& parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
|
&& parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
|
||||||
child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue());
|
child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue());
|
||||||
child.setBomRowId(0L);
|
child.setEditStatus(EbomEditStatusEnum.HANDLER_FINISHED.getValue());
|
||||||
child.setCurrentVersion(parentEntity.getCurrentVersion());
|
child.setCurrentVersion(parentEntity.getCurrentVersion());
|
||||||
}
|
}
|
||||||
// //非本人则为借用件
|
// //非本人则为借用件
|
||||||
|
|
@ -413,6 +413,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
} else {
|
} else {
|
||||||
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||||
}
|
}
|
||||||
|
if (type == 0 && child.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
|
||||||
|
child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
child.setChildBomRowId(child.getRowId());
|
child.setChildBomRowId(child.getRowId());
|
||||||
}
|
}
|
||||||
|
|
@ -511,7 +514,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
public List<BomNewEbomParentVO> getChildBatch(List<Long> rowIds) {
|
public List<BomNewEbomParentVO> getChildBatch(List<Long> rowIds) {
|
||||||
List<BomNewEbomParentVO> result = new ArrayList<>();
|
List<BomNewEbomParentVO> result = new ArrayList<>();
|
||||||
for (Long bomRowId : rowIds) {
|
for (Long bomRowId : rowIds) {
|
||||||
result.addAll(getChild(bomRowId));
|
result.addAll(getChild(bomRowId, 1));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -749,7 +752,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
if (root.getVirtrualPackageEnum() <= 0) {
|
if (root.getVirtrualPackageEnum() <= 0) {
|
||||||
if (root.getMaterialNo().startsWith("31")) {
|
if (root.getMaterialNo().startsWith("31")) {
|
||||||
|
|
||||||
List<BomNewEbomParentVO> list = getChild(root.getRowId());
|
List<BomNewEbomParentVO> list = getChild(root.getRowId(), 0);
|
||||||
List<BomNewEbomParentVO> deliveryList = list.stream().filter(u -> VirtualPackageTypeEnum.DELIVERY_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList());
|
List<BomNewEbomParentVO> deliveryList = list.stream().filter(u -> VirtualPackageTypeEnum.DELIVERY_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(deliveryList)) {
|
if (CollUtil.isNotEmpty(deliveryList)) {
|
||||||
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue() | VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
|
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue() | VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
|
||||||
|
|
@ -765,7 +768,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
if (root.getMaterialNo().startsWith("21")) {
|
if (root.getMaterialNo().startsWith("21")) {
|
||||||
|
|
||||||
List<BomNewEbomParentVO> list = getChild(root.getRowId());
|
List<BomNewEbomParentVO> list = getChild(root.getRowId(), 0);
|
||||||
List<BomNewEbomParentVO> makeList = list.stream().filter(u -> VirtualPackageTypeEnum.MAKING_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList());
|
List<BomNewEbomParentVO> makeList = list.stream().filter(u -> VirtualPackageTypeEnum.MAKING_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(makeList)) {
|
if (CollUtil.isNotEmpty(makeList)) {
|
||||||
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
|
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
|
||||||
|
|
@ -1114,7 +1117,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
public void editExportBom(EbomEditExportDTO param, OutputStream response) throws IOException {
|
public void editExportBom(EbomEditExportDTO param, OutputStream response) throws IOException {
|
||||||
List<BomNewEbomParentVO> result = param.getList();
|
List<BomNewEbomParentVO> result = param.getList();
|
||||||
if (CollUtil.isEmpty(param.getList())) {
|
if (CollUtil.isEmpty(param.getList())) {
|
||||||
result = getChild(param.getBomRowId());
|
result = getChild(param.getBomRowId(), 1);
|
||||||
}
|
}
|
||||||
final ListSheet<EbomExcelEditVO> listSheet = new ListSheet<EbomExcelEditVO>(Convert.toList(EbomExcelEditVO.class, result));
|
final ListSheet<EbomExcelEditVO> listSheet = new ListSheet<EbomExcelEditVO>(Convert.toList(EbomExcelEditVO.class, result));
|
||||||
EecExcelUtil.eecExcel("bom列表", listSheet, response);
|
EecExcelUtil.eecExcel("bom列表", listSheet, response);
|
||||||
|
|
@ -1609,14 +1612,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
parentVO.setParentRowId(0L);
|
parentVO.setParentRowId(0L);
|
||||||
parentVO.setChildBomRowId(rowId);
|
parentVO.setChildBomRowId(rowId);
|
||||||
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||||
List<BomNewEbomParentVO> childList = getChild(bomRowId);
|
List<BomNewEbomParentVO> childList = getChild(bomRowId, 0);
|
||||||
if (hideVirtualPackage == 1) {
|
if (hideVirtualPackage == 1) {
|
||||||
List<BomNewEbomParentVO> virtualPackageList = childList.stream()
|
List<BomNewEbomParentVO> virtualPackageList = childList.stream()
|
||||||
.filter(c -> c.getVirtualPackageIs() == 1 && c.getBomRowId() > 0)
|
.filter(c -> c.getVirtualPackageIs() == 1 && c.getBomRowId() > 0)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
virtualPackageList.forEach(v -> {
|
virtualPackageList.forEach(v -> {
|
||||||
childList.remove(v);
|
childList.remove(v);
|
||||||
childList.addAll(getChild(v.getBomRowId()));
|
childList.addAll(getChild(v.getBomRowId(), 0));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
vo.setDatas(childList);
|
vo.setDatas(childList);
|
||||||
|
|
@ -2295,7 +2298,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildChildren(BomNewEbomParentVO vo) {
|
private void buildChildren(BomNewEbomParentVO vo) {
|
||||||
if (Objects.isNull(vo.getLastVersionIs())) return;
|
if (Objects.isNull(vo.getLastVersionIs()) || vo.getBomRowId() == 0) return;
|
||||||
|
//log.debug("buildChildren BomRowId:{},MaterialNo:{},orderNum:{}", vo.getBomRowId(), vo.getMaterialNo(), vo.getOrderNumber());
|
||||||
List<BomNewEbomParentVO> children = this.getBaseMapper().getChildren(vo.getBomRowId(), 0);
|
List<BomNewEbomParentVO> children = this.getBaseMapper().getChildren(vo.getBomRowId(), 0);
|
||||||
//children.removeIf(c -> c.getLastVersionIs() != 1);
|
//children.removeIf(c -> c.getLastVersionIs() != 1);
|
||||||
vo.setChildNodes(children);
|
vo.setChildNodes(children);
|
||||||
|
|
@ -2315,7 +2319,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
if (c.getBomRowId() != 0 && c.getUserRootIs() == 0 && !Objects.equals(c.getStatus(), EBomStatusEnum.BORROWED_PARTS.getValue())) {
|
if (c.getBomRowId() != 0 && c.getUserRootIs() == 0 && !Objects.equals(c.getStatus(), EBomStatusEnum.BORROWED_PARTS.getValue())) {
|
||||||
List<BomNewEbomParentVO> cc = this.getBaseMapper().getChildren(c.getBomRowId(), 0);
|
List<BomNewEbomParentVO> cc = this.getBaseMapper().getChildren(c.getBomRowId(), 0);
|
||||||
//cc.removeIf(ci -> ci.getLastVersionIs() != 1);
|
|
||||||
c.setChildNodes(cc);
|
c.setChildNodes(cc);
|
||||||
cc.forEach(this::buildChildren);
|
cc.forEach(this::buildChildren);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue