optimize: 导入SAP时,先获取所有bom,然后将来源是SAP的bom丢弃,其余的导入到SAP中

This commit is contained in:
曹鹏飞 2024-08-16 16:48:18 +08:00
parent 553e9f699d
commit c6d9b3e031
2 changed files with 7 additions and 7 deletions

View File

@ -112,7 +112,7 @@ public class BomNewEbomExportToSAP {
private void handlerItem(BomNewEbomChildEntity it, BomNewEbomParentEntity p) {
LOGGER.debug("{} 添加物料 编号:{},父级编号:{},数量:{},描述:{}", TAG, it.getMaterialNo(), p.getMaterialNo(), it.getNum().toString(), it.getMaterialDesc());
addToT1(convert(it, p.getMaterialNo(), Objects.equals(it.getVirtualPartType(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue())));
addToT1(convert(it, p, Objects.equals(it.getVirtualPartType(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue())));
BomNewEbomParentEntity cp = getParent(it);
if (Objects.nonNull(cp)) {
buildChildrenForSap(cp);
@ -142,16 +142,16 @@ public class BomNewEbomExportToSAP {
}
}
private T1ExtDTO convert(BomNewEbomChildEntity child, String parentMaterialNo, boolean isZFB) {
private T1ExtDTO convert(BomNewEbomChildEntity child, BomNewEbomParentEntity p, boolean isZFB) {
T1ExtDTO t = new T1ExtDTO();
t.setID(RandomUtil.randomNumbers(5));
t.setMATNR(parentMaterialNo);
t.setMATNR(p.getMaterialNo());
t.setMENGE(child.getNum().toString());
t.setPOSTP(child.getProjectType());
t.setDATUM(dateYMD);
t.setMEINS(child.getMaterialUnit());
t.setIDNRK(child.getMaterialNo());
t.setIgnore(false);
t.setIgnore(Objects.equals(p.getSource(), EBomSourceEnum.FROM_SAP.getValue()));
t.setZFB(isZFB);
if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(child.getProjectType())) {
t.setIDNRK("");
@ -168,7 +168,7 @@ public class BomNewEbomExportToSAP {
.eq(BomNewEbomParentEntity::getMaterialNo, c.getMaterialNo())
.eq(BomNewEbomParentEntity::getUserRootIs, 0)
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
.ne(BomNewEbomParentEntity::getSource, EBomSourceEnum.FROM_SAP.getValue())
// .ne(BomNewEbomParentEntity::getSource, EBomSourceEnum.FROM_SAP.getValue())
.orderByDesc(BomNewEbomParentEntity::getCurrentVersion)
.last(" limit 1")
.one();

View File

@ -195,7 +195,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
t.setIDNRK(child.getMaterialNo());
t.setZSORT(BomUtil.generateSapOrderNum(child.getProjectType(), child.getMaterialCategoryCode()
, child.getFacCode(), child.getMaterialNo(), Objects.isNull(parent) ? 0 : parent.getBomExist()));
t.setIgnore(ignore);
t.setIgnore(ignore || Objects.equals(parent.getSource(), PbomSourceEnum.FROM_SAP.getValue()));
if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(child.getProjectType())) {
t.setIDNRK("");
t.setPOTX1(child.getMaterialDesc());
@ -282,7 +282,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
.eq(BomNewPbomParentEntity::getMaterialNo, child.getMaterialNo())
.ge(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
.eq(BomNewPbomParentEntity::getFacCode, child.getFacCode())
.ne(BomNewPbomParentEntity::getSource, PbomSourceEnum.FROM_SAP.getValue())
// .ne(BomNewPbomParentEntity::getSource, PbomSourceEnum.FROM_SAP.getValue())
.orderByDesc(BomNewPbomParentEntity::getCurrentVersion)
.last(" limit 1")
.one();