同步sap

This commit is contained in:
luoliming 2024-01-21 22:13:28 +08:00
parent eb70a94864
commit 67bfc6686a
1 changed files with 21 additions and 16 deletions

View File

@ -1,5 +1,6 @@
package com.nflg.product.bomnew.service.domain; package com.nflg.product.bomnew.service.domain;
import cn.hutool.core.convert.Convert;
import com.nflg.product.bomnew.constant.BomConstant; import com.nflg.product.bomnew.constant.BomConstant;
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;
@ -9,6 +10,7 @@ import org.apache.http.util.Args;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class Sap { public class Sap {
@ -30,24 +32,27 @@ public class Sap {
result.setI_STLAN(BomConstant.SAP_PBOM); result.setI_STLAN(BomConstant.SAP_PBOM);
result.setT1(new ArrayList<>()); result.setT1(new ArrayList<>());
BomNewPbomParentVO rootParent = Convert.convert(BomNewPbomParentVO.class, parent);
rootParent.setBomRowId(rootParent.getRowId());
children.add(rootParent);
List<BomNewPbomParentVO> parents = children.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
for (BomNewPbomParentVO child : children){ for (BomNewPbomParentVO parentBom :parents) {
T1DTO t1=new T1DTO(); List<BomNewPbomParentVO> parentChilds = children.stream().filter(u -> u.getParentRowId().equals(parentBom.getBomRowId())).collect(Collectors.toList());
t1.setID(child.getOrderNumber()); for (BomNewPbomParentVO child : parentChilds){
t1.setMATNR(parent.getMaterialNo()); T1DTO t1=new T1DTO();
t1.setIDNRK(child.getMaterialNo()); t1.setID(child.getOrderNumber());
t1.setMEINS(child.getMaterialUnit()); t1.setMATNR(parentBom.getMaterialNo());
t1.setMENGE(child.getNum().toString()); t1.setIDNRK(child.getMaterialNo());
t1.setPOSTP(child.getProjectType()); t1.setMEINS(child.getMaterialUnit());
t1.setMAKTX(parent.getMaterialDesc()); t1.setMENGE(child.getNum().toString());
t1.setMAKTX1(child.getMaterialDesc()); t1.setPOSTP(child.getProjectType());
result.getT1().add(t1); t1.setMAKTX(parentBom.getMaterialDesc());
t1.setMAKTX1(child.getMaterialDesc());
result.getT1().add(t1);
}
} }
return result; return result;
} }
} }