optimize: 反查返回参数添加bomVersion,用于区分是否为一个bom
This commit is contained in:
parent
768fd2c293
commit
16c877882c
|
|
@ -64,7 +64,7 @@ public class ReverseReportVO {
|
|||
private String childDrawingNo;
|
||||
|
||||
@ApiModelProperty("层级")
|
||||
private String levelNum;
|
||||
private Integer levelNum;
|
||||
|
||||
@ApiModelProperty("物料类别")
|
||||
private String categoryName;
|
||||
|
|
@ -85,5 +85,6 @@ public class ReverseReportVO {
|
|||
return Objects.isNull(expireEndTime)? LocalDateTime.parse("9999-12-31 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")):expireEndTime;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty("bom颜色区分")
|
||||
private String bomVersion;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class EBomQueryService {
|
|||
if (CollUtil.isNotEmpty(vos)) {
|
||||
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(vos.stream().map(ReverseReportVO::getMaterialNo).collect(Collectors.toList()));
|
||||
vos.forEach(it -> {
|
||||
it.setLevelNum("1");
|
||||
it.setLevelNum(1);
|
||||
BaseMaterialVO materialVO = materialVOS.stream()
|
||||
.filter(f -> StrUtil.equals(f.getMaterialNo(), it.getMaterialNo()))
|
||||
.findFirst()
|
||||
|
|
@ -113,7 +113,7 @@ public class EBomQueryService {
|
|||
if (Objects.nonNull(parent)) {
|
||||
List<BomNewPbomParentVO> pVOs = getReverseBoms(parent.getRowId());
|
||||
pVOs.forEach(p -> {
|
||||
vos.add(createVO(p, 1));
|
||||
// vos.add(createVO(p, 1));
|
||||
bindData(p, 1, vos);
|
||||
});
|
||||
} else {
|
||||
|
|
@ -132,7 +132,7 @@ public class EBomQueryService {
|
|||
p.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
}
|
||||
}
|
||||
vos.add(createVO(p, 1));
|
||||
// vos.add(createVO(p, 1));
|
||||
bindData(p, 1, vos);
|
||||
});
|
||||
}
|
||||
|
|
@ -155,14 +155,18 @@ public class EBomQueryService {
|
|||
return vos;
|
||||
}
|
||||
|
||||
private void bindData(BomNewPbomParentVO pVO, Integer level, List<ReverseReportVO> vos) {
|
||||
private void bindData(BomNewPbomParentVO pVO, final Integer level, List<ReverseReportVO> vos) {
|
||||
if (Objects.nonNull(pVO.getParentRowId())) {
|
||||
List<BomNewPbomParentVO> parents = getReverseBoms(pVO.getParentRowId());
|
||||
level++;
|
||||
Integer finalLevel = level;
|
||||
for (BomNewPbomParentVO it : parents) {
|
||||
vos.add(createVO(it, finalLevel));
|
||||
bindData(it, finalLevel, vos);
|
||||
if (vos.stream().noneMatch(v -> StrUtil.equals(v.getMaterialNo(), it.getMaterialNo())
|
||||
&& Objects.equals(v.getLevelNum(), level)
|
||||
&& Objects.equals(v.getNum(), it.getNum())
|
||||
&& StrUtil.equals(v.getMaterialUnit(), it.getMaterialUnit())
|
||||
&& StrUtil.equals(v.getCreatedBy(), it.getCreatedBy()))) {
|
||||
vos.add(createVO(it, level, vos.isEmpty() ? null : vos.get(vos.size() - 1)));
|
||||
}
|
||||
bindData(it, level + 1, vos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -171,9 +175,14 @@ public class EBomQueryService {
|
|||
return ebomParentService.getReverseBoms(parentRowId);
|
||||
}
|
||||
|
||||
private ReverseReportVO createVO(BomNewPbomParentVO parentVO, Integer level) {
|
||||
private ReverseReportVO createVO(BomNewPbomParentVO parentVO, Integer level, ReverseReportVO lastVO) {
|
||||
ReverseReportVO vo = Convert.convert(ReverseReportVO.class, parentVO);
|
||||
vo.setLevelNum(String.valueOf(level));
|
||||
vo.setLevelNum(level);
|
||||
if (Objects.isNull(lastVO)) {
|
||||
vo.setBomVersion("1");
|
||||
} else {
|
||||
vo.setBomVersion(level >= lastVO.getLevelNum() ? lastVO.getBomVersion() : String.valueOf(Integer.parseInt(lastVO.getBomVersion()) + 1));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class PBomQueryService {
|
|||
if (CollUtil.isNotEmpty(vos)) {
|
||||
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(vos.stream().map(ReverseReportVO::getMaterialNo).collect(Collectors.toList()));
|
||||
vos.forEach(it -> {
|
||||
it.setLevelNum("1");
|
||||
it.setLevelNum(1);
|
||||
BaseMaterialVO materialVO = materialVOS.stream()
|
||||
.filter(f -> StrUtil.equals(f.getMaterialNo(), it.getMaterialNo()))
|
||||
.findFirst()
|
||||
|
|
@ -107,7 +107,7 @@ public class PBomQueryService {
|
|||
if (Objects.nonNull(parent)) {
|
||||
List<BomNewPbomParentVO> pVOs = getReverseBoms(parent.getRowId());
|
||||
pVOs.forEach(p -> {
|
||||
vos.add(createVO(p, 1));
|
||||
// vos.add(createVO(p, 1));
|
||||
bindData(p, 1, vos);
|
||||
});
|
||||
} else {
|
||||
|
|
@ -126,7 +126,7 @@ public class PBomQueryService {
|
|||
p.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
}
|
||||
}
|
||||
vos.add(createVO(p, 1));
|
||||
// vos.add(createVO(p, 1));
|
||||
bindData(p, 1, vos);
|
||||
});
|
||||
}
|
||||
|
|
@ -149,14 +149,18 @@ public class PBomQueryService {
|
|||
return vos;
|
||||
}
|
||||
|
||||
private void bindData(BomNewPbomParentVO pVO, Integer level, List<ReverseReportVO> vos) {
|
||||
private void bindData(BomNewPbomParentVO pVO, final Integer level, List<ReverseReportVO> vos) {
|
||||
if (Objects.nonNull(pVO.getParentRowId())) {
|
||||
List<BomNewPbomParentVO> parents = getReverseBoms(pVO.getParentRowId());
|
||||
level++;
|
||||
Integer finalLevel = level;
|
||||
for (BomNewPbomParentVO it : parents) {
|
||||
vos.add(createVO(it, finalLevel));
|
||||
bindData(it, finalLevel, vos);
|
||||
if (vos.stream().noneMatch(v -> StrUtil.equals(v.getMaterialNo(), it.getMaterialNo())
|
||||
&& Objects.equals(v.getLevelNum(), level)
|
||||
&& Objects.equals(v.getNum(), it.getNum())
|
||||
&& StrUtil.equals(v.getMaterialUnit(), it.getMaterialUnit())
|
||||
&& StrUtil.equals(v.getCreatedBy(), it.getCreatedBy()))) {
|
||||
vos.add(createVO(it, level, vos.isEmpty() ? null : vos.get(vos.size() - 1)));
|
||||
}
|
||||
bindData(it, level + 1, vos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -165,9 +169,14 @@ public class PBomQueryService {
|
|||
return pbomParentService.getReverseBoms(parentRowId);
|
||||
}
|
||||
|
||||
private ReverseReportVO createVO(BomNewPbomParentVO parentVO, Integer level) {
|
||||
private ReverseReportVO createVO(BomNewPbomParentVO parentVO, Integer level, ReverseReportVO lastVO) {
|
||||
ReverseReportVO vo = Convert.convert(ReverseReportVO.class, parentVO);
|
||||
vo.setLevelNum(String.valueOf(level));
|
||||
vo.setLevelNum(level);
|
||||
if (Objects.isNull(lastVO)) {
|
||||
vo.setBomVersion("1");
|
||||
} else {
|
||||
vo.setBomVersion(level >= lastVO.getLevelNum() ? lastVO.getBomVersion() : String.valueOf(Integer.parseInt(lastVO.getBomVersion()) + 1));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -561,11 +561,12 @@
|
|||
</foreach>;
|
||||
</select>
|
||||
<select id="getReverseBoms" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||
SELECT c.num, c.project_type projectType, c.project_type, p1.row_id parentRowId, p.*
|
||||
SELECT IFNULL(c.num, p.num) AS num, c.project_type projectType, c.project_type, p1.row_id parentRowId, p.*
|
||||
FROM t_bom_new_ebom_child c
|
||||
RIGHT JOIN t_bom_new_ebom_parent p ON c.material_no = p.material_no
|
||||
LEFT JOIN t_bom_new_ebom_parent p1 ON c.parent_row_id = p1.row_id AND p1.status = 4
|
||||
WHERE p.row_id = #{parentRowId}
|
||||
ORDER BY p.material_no
|
||||
</select>
|
||||
|
||||
<insert id="insertEBomFormalParent">
|
||||
|
|
|
|||
|
|
@ -296,12 +296,13 @@
|
|||
WHERE p.created_by = #{userCode}
|
||||
</select>
|
||||
<select id="getReverseBoms" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||
SELECT c.num, c.project_type projectType, c.project_type, p1.row_id parentRowId, p.*
|
||||
SELECT IFNULL(c.num, p.num) AS num, c.project_type projectType, c.project_type, p1.row_id parentRowId, p.*
|
||||
FROM t_bom_new_pbom_child c
|
||||
RIGHT JOIN t_bom_new_pbom_parent p ON c.material_no = p.material_no AND c.fac_code = p.fac_code
|
||||
LEFT JOIN t_bom_new_pbom_parent p1
|
||||
ON c.parent_row_id = p1.row_id AND p1.status >= 4 AND c.fac_code = p1.fac_code
|
||||
WHERE p.row_id = #{parentRowId}
|
||||
ORDER BY p.material_no
|
||||
</select>
|
||||
|
||||
<sql id="upRootStateWhr">
|
||||
|
|
|
|||
Loading…
Reference in New Issue