fix(pbom): 修复导入SAP时使用的父级错误的问题

This commit is contained in:
曹鹏飞 2024-08-18 15:55:00 +08:00
parent 2c7db34d4a
commit c6589d9bf1
1 changed files with 7 additions and 7 deletions

View File

@ -87,7 +87,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
} }
for (BomNewPbomChildEntity it : rcs) { for (BomNewPbomChildEntity it : rcs) {
BomNewPbomParentEntity cp = getParent(it); BomNewPbomParentEntity cp = getParent(it);
addToT1(convert(cp, it, root.getMaterialNo(), false)); addToT1(convert(cp, it, root, false));
if (Objects.nonNull(cp)) { if (Objects.nonNull(cp)) {
if (!is31) { if (!is31) {
buildChildrenForSap(ddpRowId, cp, it, false); buildChildrenForSap(ddpRowId, cp, it, false);
@ -180,14 +180,14 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
* 转换为sap的t1 * 转换为sap的t1
* @param parent 该节点对应的parent * @param parent 该节点对应的parent
* @param child 该节点对应的child * @param child 该节点对应的child
* @param parentMaterialNo 父级物料编号 * @param p 父级节点parent
* @param ignore 导入时是否忽略 * @param ignore 导入时是否忽略
* @return * @return
*/ */
private T1ExtDTO convert(BomNewPbomParentEntity parent, BomNewPbomChildEntity child, String parentMaterialNo, Boolean ignore) { private T1ExtDTO convert(BomNewPbomParentEntity parent, BomNewPbomChildEntity child, BomNewPbomParentEntity p, Boolean ignore) {
T1ExtDTO t = new T1ExtDTO(); T1ExtDTO t = new T1ExtDTO();
t.setID(RandomUtil.randomNumbers(5)); t.setID(RandomUtil.randomNumbers(5));
t.setMATNR(parentMaterialNo); t.setMATNR(p.getMaterialNo());
t.setMENGE(child.getNum().toString()); t.setMENGE(child.getNum().toString());
t.setPOSTP(child.getProjectType()); t.setPOSTP(child.getProjectType());
t.setDATUM(dateYMD); t.setDATUM(dateYMD);
@ -195,7 +195,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
t.setIDNRK(child.getMaterialNo()); t.setIDNRK(child.getMaterialNo());
t.setZSORT(BomUtil.generateSapOrderNum(child.getProjectType(), child.getMaterialCategoryCode() t.setZSORT(BomUtil.generateSapOrderNum(child.getProjectType(), child.getMaterialCategoryCode()
, child.getFacCode(), child.getMaterialNo(), Objects.isNull(parent) ? 0 : parent.getBomExist())); , child.getFacCode(), child.getMaterialNo(), Objects.isNull(parent) ? 0 : parent.getBomExist()));
t.setIgnore(ignore || Objects.equals(parent.getSource(), PbomSourceEnum.FROM_SAP.getValue())); t.setIgnore(ignore || Objects.equals(p.getSource(), PbomSourceEnum.FROM_SAP.getValue()));
if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(child.getProjectType())) { if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(child.getProjectType())) {
t.setIDNRK(""); t.setIDNRK("");
t.setPOTX1(child.getMaterialDesc()); t.setPOTX1(child.getMaterialDesc());
@ -236,7 +236,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
.orElse(null); .orElse(null);
if (Objects.isNull(cct)) { if (Objects.isNull(cct)) {
LOGGER.debug("{} 物料提层到顶级发货包 编号:{},父级编号:{},数量:{},描述:{}", TAG, it.getMaterialNo(), p.getMaterialNo(), it.getNum().toString(), it.getMaterialDesc()); LOGGER.debug("{} 物料提层到顶级发货包 编号:{},父级编号:{},数量:{},描述:{}", TAG, it.getMaterialNo(), p.getMaterialNo(), it.getNum().toString(), it.getMaterialDesc());
cct = convert(cp, it, p.getMaterialNo(), false); cct = convert(cp, it, p, false);
cmap.get(cRowId).add(cct); cmap.get(cRowId).add(cct);
addToT1(cct); addToT1(cct);
} else { } else {
@ -248,7 +248,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
// } else if (!Objects.equals(it.getVirtualPartType(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue())) { // } else if (!Objects.equals(it.getVirtualPartType(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue())) {
} else { } else {
LOGGER.debug("{} 添加物料 编号:{},父级编号:{},数量:{},描述:{}", TAG, it.getMaterialNo(), p.getMaterialNo(), it.getNum().toString(), it.getMaterialDesc()); LOGGER.debug("{} 添加物料 编号:{},父级编号:{},数量:{},描述:{}", TAG, it.getMaterialNo(), p.getMaterialNo(), it.getNum().toString(), it.getMaterialDesc());
addToT1(convert(cp, it, p.getMaterialNo(), ignore)); addToT1(convert(cp, it, p, ignore));
} }
if (Objects.nonNull(cp)) { if (Objects.nonNull(cp)) {
if (!ignore && cp.getUserRootIs() == 1) { if (!ignore && cp.getUserRootIs() == 1) {