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

This commit is contained in:
luoliming 2024-08-10 14:27:38 +08:00
commit df179207b9
4 changed files with 12 additions and 6 deletions

View File

@ -43,4 +43,6 @@ public class T1ExtDTO {
* 是否是直发包 * 是否是直发包
*/ */
private boolean isZFB = false; private boolean isZFB = false;
private Long childRowId;
} }

View File

@ -137,7 +137,7 @@ public class BomNewEbomExportToSAP {
private void addToT1(T1ExtDTO dto) { private void addToT1(T1ExtDTO dto) {
if (StrUtil.equals(dto.getPOSTP(), BomConstant.PROJECT_TYPE_TEMPORARY) if (StrUtil.equals(dto.getPOSTP(), BomConstant.PROJECT_TYPE_TEMPORARY)
|| children.stream().noneMatch(c -> StrUtil.equals(c.getIDNRK(), dto.getIDNRK()) && StrUtil.equals(c.getMATNR(), dto.getMATNR()))) { || children.stream().noneMatch(c -> Objects.equals(c.getChildRowId(), dto.getChildRowId()))) {
children.add(dto); children.add(dto);
} }
} }
@ -157,6 +157,7 @@ public class BomNewEbomExportToSAP {
t.setIDNRK(""); t.setIDNRK("");
t.setPOTX1(child.getMaterialDesc()); t.setPOTX1(child.getMaterialDesc());
} }
t.setChildRowId(child.getRowId());
return t; return t;
} }

View File

@ -200,6 +200,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
t.setIDNRK(""); t.setIDNRK("");
t.setPOTX1(child.getMaterialDesc()); t.setPOTX1(child.getMaterialDesc());
} }
t.setChildRowId(child.getRowId());
return t; return t;
} }
@ -259,7 +260,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
private void addToT1(T1ExtDTO dto) { private void addToT1(T1ExtDTO dto) {
if (StrUtil.equals(dto.getPOSTP(), BomConstant.PROJECT_TYPE_TEMPORARY) if (StrUtil.equals(dto.getPOSTP(), BomConstant.PROJECT_TYPE_TEMPORARY)
|| children.stream().noneMatch(c -> StrUtil.equals(c.getIDNRK(), dto.getIDNRK()) && StrUtil.equals(c.getMATNR(), dto.getMATNR()))) { || children.stream().noneMatch(c -> Objects.equals(c.getChildRowId(), dto.getChildRowId()))) {
children.add(dto); children.add(dto);
} }
} }

View File

@ -15,6 +15,7 @@ import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.mapper.master.MaterialMainMapper; import com.nflg.product.bomnew.mapper.master.MaterialMainMapper;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1ExtDTO;
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity; import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewDQbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity; import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
@ -403,12 +404,12 @@ public class DQBomService {
sapDto.setI_WERKS("1"); sapDto.setI_WERKS("1");
sapDto.setI_STLAN("1"); sapDto.setI_STLAN("1");
sapDto.setI_EMPNO(root.getCreatedBy()); sapDto.setI_EMPNO(root.getCreatedBy());
List<T1DTO> t1s = new ArrayList<>(); List<T1ExtDTO> t1s = new ArrayList<>();
String dateYMD = DateUtil.format(new Date(), "yyyyMMdd"); String dateYMD = DateUtil.format(new Date(), "yyyyMMdd");
datas.forEach(d -> { datas.forEach(d -> {
if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, d.getProjectType()) if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, d.getProjectType())
|| t1s.stream().noneMatch(c -> StrUtil.equals(c.getIDNRK(), d.getMaterialNo()) && StrUtil.equals(c.getMATNR(), d.getParentMaterialNo()))) { || t1s.stream().noneMatch(c -> Objects.equals(c.getChildRowId(), d.getRowId()))) {
T1DTO t1 = new T1DTO(); T1ExtDTO t1 = new T1ExtDTO();
t1.setID(RandomUtil.randomNumbers(5)); t1.setID(RandomUtil.randomNumbers(5));
t1.setMATNR(d.getParentMaterialNo()); t1.setMATNR(d.getParentMaterialNo());
t1.setMENGE(d.getNum().toString()); t1.setMENGE(d.getNum().toString());
@ -426,11 +427,12 @@ public class DQBomService {
t1.setMEINS(bm.getMaterialUnit()); t1.setMEINS(bm.getMaterialUnit());
} }
} }
t1.setChildRowId(d.getRowId());
t1s.add(t1); t1s.add(t1);
} }
}); });
sapDto.setT1(t1s); sapDto.setT1(Convert.toList(T1DTO.class, t1s));
SapStatusEnum state = SapStatusEnum.PUB_ERROR_ALL; SapStatusEnum state = SapStatusEnum.PUB_ERROR_ALL;
List<OperationErrorMsgVO> liErrMsg = null; List<OperationErrorMsgVO> liErrMsg = null;
try { try {