fix: 电气bom优化

This commit is contained in:
曹鹏飞 2024-04-25 19:37:36 +08:00
parent beedcbeb27
commit 251d5b6bbd
3 changed files with 9 additions and 22 deletions

View File

@ -127,8 +127,6 @@ public class BomNewDQbomExceptionCheckService {
if (StrUtil.isBlank(parent.getMaterialName())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_4;
}
// } else if (parent.getMaterialNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) {
// status = EBomExceptionStatusEnum.EXCEPT_NO_4;
} else {
BaseMaterialVO materialVO = materialVOS.stream()
.filter(v -> v.getMaterialNo().equals(parent.getMaterialNo()))
@ -138,7 +136,7 @@ public class BomNewDQbomExceptionCheckService {
status = EBomExceptionStatusEnum.EXCEPT_NO_7;
} else if (materialVO.getMaterialState().equals(MaterialGetEnum.MaterialStateEnum.STATE_NO_4.getValue())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_2;
} else if (!materialVO.getMaterialName().equals(parent.getMaterialName())) {
} else if (!materialVO.getMaterialDesc().equals(parent.getMaterialName())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_15;
} else if (Objects.isNull(parent.getNum()) || parent.getNum().equals(BigDecimal.ZERO)) {
status = EBomExceptionStatusEnum.EXCEPT_NO_4;
@ -178,7 +176,7 @@ public class BomNewDQbomExceptionCheckService {
status = EBomExceptionStatusEnum.EXCEPT_NO_7;
} else if (materialVO.getMaterialState().equals(MaterialGetEnum.MaterialStateEnum.STATE_NO_4.getValue())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_2;
} else if (!materialVO.getMaterialName().equals(child.getMaterialName())) {
} else if (!materialVO.getMaterialDesc().equals(child.getMaterialName())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_15;
} else if (Objects.isNull(child.getNum()) || child.getNum().equals(BigDecimal.ZERO)) {
status = EBomExceptionStatusEnum.EXCEPT_NO_4;

View File

@ -144,11 +144,7 @@ public class DQBomService {
parents.forEach(p -> {
if (Objects.isNull(vo.getStatus())) {
vo.setStatus(p.getStatus());
// vo.setCurrentVersion("A00");
}
// if (Objects.equals(vo.getBomExist(), 0) && Objects.equals(vo.getShouldBomExist(), 1)) {
// vo.setCurrentVersion("A-1");
// }
p.setChildNodes(CollUtil.toList(vo));
datas.addAll(buildParent(p));
});
@ -188,7 +184,7 @@ public class DQBomService {
BaseMaterialVO bm = materialBaseInfos.stream().filter(m -> m.getMaterialNo().equals(d.getMaterialNo())).findFirst().orElse(null);
if (bm != null) {
d.setMaterialState(bm.getMaterialState());
d.setSystemMaterialName(bm.getMaterialName());
d.setSystemMaterialName(bm.getMaterialDesc());
d.setSystemMaterialCategoryName(bm.getCategoryName());
d.setSystemMaterialUnit(bm.getMaterialUnit());
d.setMaterialRowId(bm.getMaterialRowId());
@ -220,7 +216,7 @@ public class DQBomService {
*/
@Transactional(rollbackFor = Exception.class)
public BomNewDQbomSaveQuery save(BomNewDQbomSaveQuery query) {
BomNewDQbomParentEntity parent;
BomNewDQbomParentEntity parent = Convert.convert(BomNewDQbomParentEntity.class, query.getParent());
if (Objects.isNull(query.getParent()) || query.getParent().getBomRowId() == 0) {
//新增父级节点
@ -232,7 +228,6 @@ public class DQBomService {
.throwMessage("父级已被其他人创建");
VUtils.isTure(CollUtil.isEmpty(query.getChildren())).throwMessage("新添加的bom必须有子级");
parent = Convert.convert(BomNewDQbomParentEntity.class, query.getParent());
parent.setRowId(IdWorker.getId());
parent.setLevel(1);
parent.setBomExist(1);
@ -249,7 +244,8 @@ public class DQBomService {
} else {
//删除所有子级关系
dQBomChildService.deleteAllChildren(query.getParent().getBomRowId());
parent = dQBomParentService.getById(query.getParent().getBomRowId());
parent.setRowId(query.getParent().getBomRowId());
parent.setModifyTime(LocalDateTime.now());
if (CollUtil.isEmpty(query.getChildren())) {
parent.setBomExist(0);
@ -412,12 +408,14 @@ public class DQBomService {
p.setCreatedTime(LocalDateTime.now());
p.setCreatedBy(SessionUtil.getUserCode());
p.setModifyTime(null);
initMaterialInfo(Collections.singletonList(p));
vo.setParent(p);
} else {
BomNewDQbomParentEntity parent = dQBomParentService.getById(bomRowId);
BomNewDQbomVO p = Convert.convert(BomNewDQbomVO.class, parent);
p.setBomRowId(bomRowId);
p.setRowId(rowId);
initMaterialInfo(Collections.singletonList(p));
vo.setParent(p);
vo.setDatas(getChild(bomRowId));
}

View File

@ -129,16 +129,7 @@
</select>
<select id="getVOById" resultType="com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO">
SELECT IFNULL(b.exception_status, a.exception_status) exception_status
, IFNULL(b.created_by, a.created_by) created_by
, IFNULL(b.edit_status, a.edit_status) edit_status
, IFNULL(b.created_time, a.created_time) created_time
, b.exception_tag
, b.project_type
, IFNULL(b.num, a.num) num
, IFNULL(b.modify_time, a.modify_time) modify_time
, IFNULL(b.parent_row_id, 0) parent_row_id
, a.row_id bomRowId
SELECT a.row_id bomRowId
, b.order_number
, a.*
FROM t_bom_new_dqbom_parent a