|
|
|
@ -567,39 +567,23 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
//查询这个地方先暂时去掉Order_Status = '3' 条件
|
|
|
|
|
List<SapMaterialPosting> sapMaterialPostingList=new ArrayList<>();
|
|
|
|
|
List<OdsProcureOutOrder> orderList2=new ArrayList<>();
|
|
|
|
|
List<SapBackflushMPQuery> sapMaterialPostingFCList=new ArrayList<>();//反冲
|
|
|
|
|
List<OdsProcureOutOrder> orderList2FC=new ArrayList<>();//反冲
|
|
|
|
|
for (OdsProcureOutOrder odsProcureOutOrder:
|
|
|
|
|
orderList1) {
|
|
|
|
|
//取sap仓库号
|
|
|
|
|
if ("X".equals(odsProcureOutOrder.getUserDefined3())){
|
|
|
|
|
List<SapBackflushMPQuery> sapBackflushMPQueryList=new ArrayList<>();
|
|
|
|
|
SapBackflushMPQuery sapBackflushMPQuery=new SapBackflushMPQuery();
|
|
|
|
|
sapBackflushMPQuery.setPlant(odsProcureOutOrder.getSiteCode()); //工厂
|
|
|
|
|
String lgort= baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode());
|
|
|
|
|
String lgort= baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode());
|
|
|
|
|
sapBackflushMPQuery.setLgort(lgort);//库存地点
|
|
|
|
|
sapBackflushMPQuery.setMatnr(odsProcureOutOrder.getMaterialCode());//物料号
|
|
|
|
|
sapBackflushMPQuery.setQuantity(odsProcureOutOrder.getOutNumber().toString()); //数量
|
|
|
|
|
sapBackflushMPQuery.setMeins(odsProcureOutOrder.getUnit()); //基本计量单位
|
|
|
|
|
sapBackflushMPQuery.setBatch(odsProcureOutOrder.getUserDefined2()); //批号
|
|
|
|
|
sapBackflushMPQueryList.add(sapBackflushMPQuery);
|
|
|
|
|
R result2= remoteSapService.sapBackflushMP(sapBackflushMPQueryList);//x
|
|
|
|
|
int code= result2.getCode();
|
|
|
|
|
|
|
|
|
|
String msg= result2.getMsg();
|
|
|
|
|
odsProcureOutOrder.setUserDefined11(msg);
|
|
|
|
|
if (code==200){//过账成功
|
|
|
|
|
Map map=new HashMap();
|
|
|
|
|
map= (Map) result2.getData();
|
|
|
|
|
String userDefined9= (String) map.get("MATERIALDOCUMENT");
|
|
|
|
|
odsProcureOutOrder.setUserDefined9(userDefined9);
|
|
|
|
|
odsProcureOutOrder.setUserDefined10("2");//成功
|
|
|
|
|
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
|
|
|
|
|
}else {//
|
|
|
|
|
odsProcureOutOrder.setUserDefined9("");
|
|
|
|
|
odsProcureOutOrder.setUserDefined10("3");//失败
|
|
|
|
|
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
|
|
|
|
|
}
|
|
|
|
|
sapMaterialPostingFCList.add(sapBackflushMPQuery);
|
|
|
|
|
orderList2FC.add(odsProcureOutOrder);
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
SapMaterialPosting sapMaterialPosting =new SapMaterialPosting();
|
|
|
|
|
sapMaterialPosting.setAufnr(odsProcureOutOrder.getProduceCode());//订单号
|
|
|
|
|
sapMaterialPosting.setBwart("261"); //移动类型
|
|
|
|
@ -614,7 +598,9 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
orderList2.add(odsProcureOutOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (sapMaterialPostingList.size()>0){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sapMaterialPostingList.size()>0){//非反冲过账
|
|
|
|
|
R result= remoteSapService.sapMaterialPosting(sapMaterialPostingList);
|
|
|
|
|
OdsProcureOutOrder order =new OdsProcureOutOrder();
|
|
|
|
|
int code= result.getCode();
|
|
|
|
@ -636,6 +622,25 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(sapMaterialPostingFCList.size()>0){//反冲过账
|
|
|
|
|
R result2= remoteSapService.sapBackflushMP(sapMaterialPostingFCList);//x
|
|
|
|
|
int code= result2.getCode();
|
|
|
|
|
OdsProcureOutOrder order =new OdsProcureOutOrder();
|
|
|
|
|
String msg= result2.getMsg();
|
|
|
|
|
order.setUserDefined11(msg);
|
|
|
|
|
if (code==200){//过账成功
|
|
|
|
|
Map map=new HashMap();
|
|
|
|
|
map= (Map) result2.getData();
|
|
|
|
|
String userDefined9= (String) map.get("MATERIALDOCUMENT");
|
|
|
|
|
order.setUserDefined9(userDefined9);
|
|
|
|
|
order.setUserDefined10("2");//成功
|
|
|
|
|
odsProcureOutOrderMapper.updateOdsProcureOutOrderByids(order,orderList2FC);
|
|
|
|
|
}else {//
|
|
|
|
|
order.setUserDefined9("");
|
|
|
|
|
order.setUserDefined10("3");//失败
|
|
|
|
|
odsProcureOutOrderMapper.updateOdsProcureOutOrderByids(order,orderList2FC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|