1.ebom-列表
This commit is contained in:
parent
93a34b0f5c
commit
0df472a26b
|
|
@ -273,6 +273,9 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime modifyTime;
|
||||
|
||||
@ApiModelProperty("bom层级数")
|
||||
private BigDecimal levelNumber;
|
||||
|
||||
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.nflg.product.bomnew.service.domain.EBom;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Ebom 转Pbom
|
||||
*/
|
||||
public class EBomToPBom {
|
||||
|
||||
private BomNewEbomParentVO parent;
|
||||
|
||||
private List<BomNewEbomParentVO> allBomDetail;
|
||||
|
||||
|
||||
private Map<String, String> generateDrawingNoMap = new HashMap<>();
|
||||
|
||||
|
||||
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail) {
|
||||
this.parent = inParent;
|
||||
this.allBomDetail = inAllBomDetail;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成 层级号
|
||||
*
|
||||
* @param saveBomDetailParamDTO
|
||||
* @param bomRowID
|
||||
* @param parentDrawingNo
|
||||
*/
|
||||
private void generateDrawingNo(List<BomNewEbomParentVO> saveBomDetailParamDTO, Long bomRowID, String parentDrawingNo) {
|
||||
List<BomNewEbomParentVO> firstLevelBoms = saveBomDetailParamDTO.stream().filter(u -> u.getBomRowId().equals(bomRowID)).collect(Collectors.toList());
|
||||
parentDrawingNo = StrUtil.isNotBlank(parentDrawingNo) ? parentDrawingNo : "";
|
||||
Integer gNo = 1;
|
||||
for (BomNewEbomParentVO firstLevelBom : firstLevelBoms) {
|
||||
String key = StrUtil.join("-", bomRowID.toString(), firstLevelBom.getMaterialNo());
|
||||
if (generateDrawingNoMap.containsKey(key)) {
|
||||
// firstLevelBom.setLevelNumber(generateDrawingNoMap.get(key));
|
||||
continue;
|
||||
}
|
||||
|
||||
firstLevelBom.setDrawingNo(StrUtil.isNotBlank(parentDrawingNo) ? StrUtil.join("-", parentDrawingNo, gNo.toString()) : gNo.toString());
|
||||
gNo++;
|
||||
generateDrawingNo(saveBomDetailParamDTO, firstLevelBom.getChildBomRowId(), firstLevelBom.getDrawingNo());
|
||||
|
||||
generateDrawingNoMap.put(key, firstLevelBom.getDrawingNo());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue