Merge remote-tracking branch 'origin/feature/DM/nflg-bom-transition' into feature/DM/nflg-bom-transition

This commit is contained in:
大米 2024-08-22 17:50:16 +08:00
commit a21d25215c
3 changed files with 14 additions and 6 deletions

View File

@ -174,7 +174,7 @@ public class BomNewEbomExportToSAP {
BomNewEbomParentEntity p = bomNewEbomParentService.lambdaQuery() BomNewEbomParentEntity p = bomNewEbomParentService.lambdaQuery()
.select(BomNewEbomParentEntity::getRowId, BomNewEbomParentEntity::getMaterialNo .select(BomNewEbomParentEntity::getRowId, BomNewEbomParentEntity::getMaterialNo
, BomNewEbomParentEntity::getMaterialDesc, BomNewEbomParentEntity::getUserRootIs , BomNewEbomParentEntity::getMaterialDesc, BomNewEbomParentEntity::getUserRootIs
, BomNewEbomParentEntity::getSource) , BomNewEbomParentEntity::getSource, BomNewEbomParentEntity::getSapState)
.eq(BomNewEbomParentEntity::getMaterialNo, c.getMaterialNo()) .eq(BomNewEbomParentEntity::getMaterialNo, c.getMaterialNo())
// .eq(BomNewEbomParentEntity::getUserRootIs, 0) // .eq(BomNewEbomParentEntity::getUserRootIs, 0)
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()) .eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
@ -182,7 +182,7 @@ public class BomNewEbomExportToSAP {
.orderByDesc(BomNewEbomParentEntity::getCurrentVersion) .orderByDesc(BomNewEbomParentEntity::getCurrentVersion)
.last(" limit 1") .last(" limit 1")
.one(); .one();
if (Objects.nonNull(p) && p.getSapState() >= SapStatusEnum.PUB_ERROR.getValue()) { if (Objects.nonNull(p) && Objects.nonNull(p.getSapState()) && p.getSapState() >= SapStatusEnum.PUB_ERROR.getValue()) {
liPIds.add(p.getRowId()); liPIds.add(p.getRowId());
} }
return p; return p;

View File

@ -160,6 +160,10 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
} }
private BomNewPbomParentEntity addZFBParent(BomNewPbomChildEntity child) { private BomNewPbomParentEntity addZFBParent(BomNewPbomChildEntity child) {
BomNewPbomParentEntity tp = bomNewPbomParentService.lambdaQuery()
.eq(BomNewPbomParentEntity::getMaterialNo, child.getMaterialNo())
.eq(BomNewPbomParentEntity::getFacCode, child.getFacCode())
.one();
BomNewPbomParentEntity parent = new BomNewPbomParentEntity(); BomNewPbomParentEntity parent = new BomNewPbomParentEntity();
parent.setRowId(IdWorker.getId()); parent.setRowId(IdWorker.getId());
parent.setCreatedTime(LocalDateTime.now()); parent.setCreatedTime(LocalDateTime.now());
@ -170,7 +174,13 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
parent.setBatchNo(""); parent.setBatchNo("");
parent.setCreatedBy(SessionUtil.getUserCode()); parent.setCreatedBy(SessionUtil.getUserCode());
parent.setCreatedJob(UserJobEnum.ENGINEER.getValue()); parent.setCreatedJob(UserJobEnum.ENGINEER.getValue());
parent.setCurrentVersion(VersionUtil.getNextVersion("")); if (Objects.isNull(tp)) {
parent.setCurrentVersion(VersionUtil.getNextVersion(""));
} else {
parent.setCurrentVersion(tp.getCurrentVersion());
tp.setCurrentVersion(VersionUtil.getNextVersion(tp.getCurrentVersion()));
bomNewPbomParentService.updateById(tp);
}
parent.setDeptRowId(SessionUtil.getDepartRowId()); parent.setDeptRowId(SessionUtil.getDepartRowId());
parent.setDeptName(SessionUtil.getDepartName()); parent.setDeptName(SessionUtil.getDepartName());
parent.setDeviseName(SessionUtil.getRealName()); parent.setDeviseName(SessionUtil.getRealName());
@ -341,7 +351,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
.orderByDesc(BomNewPbomParentEntity::getCurrentVersion) .orderByDesc(BomNewPbomParentEntity::getCurrentVersion)
.last(" limit 1") .last(" limit 1")
.one(); .one();
if (Objects.nonNull(parent) && parent.getSapState() >= SapStatusEnum.PUB_ERROR.getValue()) { if (Objects.nonNull(parent) && Objects.nonNull(parent.getSapState()) && parent.getSapState() >= SapStatusEnum.PUB_ERROR.getValue()) {
liPIds.add(parent.getRowId()); liPIds.add(parent.getRowId());
} }
return parent; return parent;

View File

@ -98,7 +98,6 @@ public class PBomUpgrade {
pbomParent.setTechnologyUserCode(SessionUtil.getUserCode()); pbomParent.setTechnologyUserCode(SessionUtil.getUserCode());
pbomParent.setRemark(""); pbomParent.setRemark("");
pbomParent.setSource(PbomSourceEnum.FROM_CHANGE.getValue()); pbomParent.setSource(PbomSourceEnum.FROM_CHANGE.getValue());
pbomParent.setSourceStatus(PbomSourceStatusEnum.PBOM.getValue());
pbomParent.setReleaseTime(null); pbomParent.setReleaseTime(null);
pbomParent.setReleaseUserName(null); pbomParent.setReleaseUserName(null);
pbomParent.setSapState(1); pbomParent.setSapState(1);
@ -135,7 +134,6 @@ public class PBomUpgrade {
child.setCreatedBy(SessionUtil.getUserCode()); child.setCreatedBy(SessionUtil.getUserCode());
child.setModifyTime(null); child.setModifyTime(null);
child.setSource(PbomSourceEnum.FROM_CHANGE.getValue()); child.setSource(PbomSourceEnum.FROM_CHANGE.getValue());
child.setSourceStatus(PbomSourceStatusEnum.PBOM.getValue());
child.setRemark(""); child.setRemark("");
this.childResult.add(child); this.childResult.add(child);
} }