一般零部件-bomExists 问题
This commit is contained in:
parent
64b81b88b3
commit
45381290e9
|
|
@ -152,7 +152,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
BomNewEbomParentEntity oldEBom = ebomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo()).last(" order by current_version desc limit 1").one();
|
BomNewEbomParentEntity oldEBom = ebomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo()).last(" order by current_version desc limit 1").one();
|
||||||
//无Ebom时
|
//无Ebom时
|
||||||
if (Objects.isNull(oldEBom)) {
|
if (Objects.isNull(oldEBom)) {
|
||||||
Long parentRowId = buildEBomParent(parentEnt, VersionUtil.getNextVersion(""));
|
Long parentRowId = buildEBomParent(parentEnt, VersionUtil.getNextVersion("")).getRowId();
|
||||||
parentEnt.setEBomRowId(parentRowId);
|
parentEnt.setEBomRowId(parentRowId);
|
||||||
handlerChild(parentEnt, parentChild);
|
handlerChild(parentEnt, parentChild);
|
||||||
return;
|
return;
|
||||||
|
|
@ -170,7 +170,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
if (parent.getCreatedBy().equals(oldEBom.getCreatedBy())) {
|
if (parent.getCreatedBy().equals(oldEBom.getCreatedBy())) {
|
||||||
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
||||||
ebomChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldEBom.getRowId()));
|
ebomChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldEBom.getRowId()));
|
||||||
Long parentRowId = buildEBomParent(parentEnt, oldEBom.getCurrentVersion());
|
Long parentRowId = buildEBomParent(parentEnt, oldEBom.getCurrentVersion()).getRowId();
|
||||||
parentEnt.setEBomRowId(parentRowId);
|
parentEnt.setEBomRowId(parentRowId);
|
||||||
handlerChild(parentEnt, parentChild);
|
handlerChild(parentEnt, parentChild);
|
||||||
}
|
}
|
||||||
|
|
@ -187,7 +187,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
||||||
ebomChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldEBom.getRowId()));
|
ebomChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldEBom.getRowId()));
|
||||||
|
|
||||||
Long parentRowId = buildEBomParent(parentEnt, oldEBom.getCurrentVersion());
|
Long parentRowId = buildEBomParent(parentEnt, oldEBom.getCurrentVersion()).getRowId();
|
||||||
newChild.setParentRowId(parentRowId);
|
newChild.setParentRowId(parentRowId);
|
||||||
this.eBomChildResult.add(newChild);
|
this.eBomChildResult.add(newChild);
|
||||||
}
|
}
|
||||||
|
|
@ -199,7 +199,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
} else { //正式版(生成临时小版本)
|
} else { //正式版(生成临时小版本)
|
||||||
|
|
||||||
String smallBomVersion = VersionUtil.getNextVersionForSmallVersion(oldEBom.getCurrentVersion());
|
String smallBomVersion = VersionUtil.getNextVersionForSmallVersion(oldEBom.getCurrentVersion());
|
||||||
Long parentRowId = buildEBomParent(parentEnt, smallBomVersion);
|
Long parentRowId = buildEBomParent(parentEnt, smallBomVersion).getRowId();
|
||||||
parentEnt.setEBomRowId(parentRowId);
|
parentEnt.setEBomRowId(parentRowId);
|
||||||
handlerChild(parentEnt, parentChild);
|
handlerChild(parentEnt, parentChild);
|
||||||
}
|
}
|
||||||
|
|
@ -256,8 +256,9 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
||||||
ebomChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldEBom.getRowId()));
|
ebomChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldEBom.getRowId()));
|
||||||
|
|
||||||
Long parentRowId = buildEBomParent(childVo, oldEBom.getCurrentVersion());
|
BomNewEbomParentEntity bomNewEbomParentEntity = buildEBomParent(childVo, oldEBom.getCurrentVersion());
|
||||||
newChild.setParentRowId(parentRowId);
|
newChild.setParentRowId(bomNewEbomParentEntity.getRowId());
|
||||||
|
bomNewEbomParentEntity.setBomExist(1);
|
||||||
this.eBomChildResult.add(newChild);
|
this.eBomChildResult.add(newChild);
|
||||||
}
|
}
|
||||||
} else { //正式则直接升级
|
} else { //正式则直接升级
|
||||||
|
|
@ -279,8 +280,9 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
* @param materialBaseInfo
|
* @param materialBaseInfo
|
||||||
*/
|
*/
|
||||||
private void buildCommonMaterialChildBom(BomOriginalListVO childVo, BaseMaterialVO materialBaseInfo, String bomVersion) {
|
private void buildCommonMaterialChildBom(BomOriginalListVO childVo, BaseMaterialVO materialBaseInfo, String bomVersion) {
|
||||||
Long parentRowId = buildEBomParent(childVo, bomVersion);
|
BomNewEbomParentEntity bomNewEbomParentEntity = buildEBomParent(childVo, bomVersion);
|
||||||
childVo.setEBomRowId(parentRowId);
|
childVo.setEBomRowId(bomNewEbomParentEntity.getRowId());
|
||||||
|
bomNewEbomParentEntity.setBomExist(1);
|
||||||
BomNewEbomChildEntity childEntity = buildCommonEbomChildEntity(materialBaseInfo, childVo);
|
BomNewEbomChildEntity childEntity = buildCommonEbomChildEntity(materialBaseInfo, childVo);
|
||||||
this.eBomChildResult.add(childEntity);
|
this.eBomChildResult.add(childEntity);
|
||||||
}
|
}
|
||||||
|
|
@ -359,10 +361,10 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
/**
|
/**
|
||||||
* 构建EBom父级
|
* 构建EBom父级
|
||||||
*/
|
*/
|
||||||
private Long buildEBomParent(BomOriginalListVO parentEnt, String bomVersion) {
|
private BomNewEbomParentEntity buildEBomParent(BomOriginalListVO parentEnt, String bomVersion) {
|
||||||
Map<String, BomNewEbomParentEntity> parentMap = ListCommonUtil.listToMap(this.getEBomParentResult(), BomNewEbomParentEntity::getMaterialNo);
|
Map<String, BomNewEbomParentEntity> parentMap = ListCommonUtil.listToMap(this.getEBomParentResult(), BomNewEbomParentEntity::getMaterialNo);
|
||||||
if (parentMap.containsKey(parentEnt.getMaterialNo())) {
|
if (parentMap.containsKey(parentEnt.getMaterialNo())) {
|
||||||
return parentMap.get(parentEnt.getMaterialNo()).getRowId();
|
return parentMap.get(parentEnt.getMaterialNo());
|
||||||
}
|
}
|
||||||
BomNewEbomParentEntity ebom = SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo()).last(" order by current_version desc limit 1").one();
|
BomNewEbomParentEntity ebom = SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo()).last(" order by current_version desc limit 1").one();
|
||||||
BomNewEbomParentEntity eBomParent = new BomNewEbomParentEntity();
|
BomNewEbomParentEntity eBomParent = new BomNewEbomParentEntity();
|
||||||
|
|
@ -394,7 +396,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
eBomParent.setDeptRowId(SessionUtil.getDepartRowId());
|
eBomParent.setDeptRowId(SessionUtil.getDepartRowId());
|
||||||
this.eBomParentResult.add(eBomParent);
|
this.eBomParentResult.add(eBomParent);
|
||||||
|
|
||||||
return eBomParent.getRowId();
|
return eBomParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue