修改创建SAP创建订单后返回的数据结构,增加子订单信息。

highway
Yangwl 1 year ago
parent 2a5cb29acd
commit 3d1e9452b6

@ -2,7 +2,6 @@ package com.op.sap.controller;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.web.controller.BaseController;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
@ -202,7 +201,7 @@ public class SapController extends BaseController {
@PostMapping("/sapCreateOrder")
@Log(title = "生产订单创建接口", businessType = BusinessType.SAP)
public R<List<String>> SapCreateOrder(@RequestBody List<SapCreateOrder> sapCreateOrderList){
public R<List<Map<String, String>>> SapCreateOrder(@RequestBody List<SapCreateOrder> sapCreateOrderList){
return sapOrderService.SapCreateOrder(sapCreateOrderList);
}

@ -1,7 +1,6 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.common.core.web.domain.AjaxResult;
import com.op.system.api.domain.sap.SapCreateOrder;
import com.op.system.api.domain.sap.SapRFW;
@ -9,6 +8,7 @@ import com.op.system.api.domain.sap.SapShopOrderQuery;
import com.op.system.api.model.SapProOrder;
import java.util.List;
import java.util.Map;
/**
* 20238
@ -27,7 +27,7 @@ public interface SapOrderService {
* @param sapCreateOrderList
* @return
*/
R<List<String>> SapCreateOrder(List<SapCreateOrder> sapCreateOrderList);
R<List<Map<String, String>>> SapCreateOrder(List<SapCreateOrder> sapCreateOrderList);
/**
*

@ -50,6 +50,7 @@ public class SapItemSyncImpl implements SapItemSyncService {
JCoDestination dest = SAPConnUtils.connect();
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMMR_MES_MAT_GET");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
@ -186,6 +187,7 @@ public class SapItemSyncImpl implements SapItemSyncService {
baseProduct.setUpdateBy(SecurityUtils.getUsername());
sapBaseProductList.add(baseProduct);
}
//this.importProducts(sapBaseProductList)
return R.ok(this.importProducts(sapBaseProductList));
}catch (Exception e){
return R.fail(e.getMessage());

@ -18,7 +18,9 @@ import com.sap.conn.jco.*;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@ -141,7 +143,7 @@ public class SapOrderServiceImpl implements SapOrderService {
}
@Override
public R<List<String>> SapCreateOrder(List<SapCreateOrder> sapCreateOrderList) {
public R<List<Map<String, String>>> SapCreateOrder(List<SapCreateOrder> sapCreateOrderList) {
String L_MSG=null;
try {
//获取连接
@ -154,9 +156,9 @@ public class SapOrderServiceImpl implements SapOrderService {
// 配置传入参数
JCoParameterList jCoParameterList = func.getImportParameterList();
List<String> LV_ORDER_NUM_List=new ArrayList<>();
if (sapCreateOrderList!=null && sapCreateOrderList.size()>0){
List<Map<String,String>> LV_ORDER_NUM_List=new ArrayList<>();
for (SapCreateOrder sapCreateOrder:sapCreateOrderList){
jCoParameterList.setValue("P_WERKS",sapCreateOrder.getWerks());
jCoParameterList.setValue("P_AUFPAR",sapCreateOrder.getAufpar());
@ -169,17 +171,24 @@ public class SapOrderServiceImpl implements SapOrderService {
System.out.println(J);
L_MSG= func.getExportParameterList().getString("L_MSG");
String LV_ORDER_NUMBER= func.getExportParameterList().getString("LV_ORDER_NUMBER");
if (!StringUtils.isEmpty(LV_ORDER_NUMBER)){
LV_ORDER_NUM_List.add(LV_ORDER_NUMBER);
}else {
return R.fail(L_MSG);
JCoTable LT_ZGD=func.getTableParameterList().getTable("LT_ZGD");
System.out.println(LT_ZGD);
//DynamicDataSourceContextHolder.push("ds_1000");//controller已经完成切换
for (int i = 0; i <LT_ZGD.getNumRows(); i++) {
LT_ZGD.setRow(i);
Map map=new HashMap();
String LEAD_AUFNR = LT_ZGD.getString("LEAD_AUFNR");
String AUFNR = LT_ZGD.getString("AUFNR");
map.put("LEAD_AUFNR",LEAD_AUFNR);
map.put("AUFNR",AUFNR);
LV_ORDER_NUM_List.add(map);
}
}
return R.ok(LV_ORDER_NUM_List,L_MSG);
}else {
return R.fail("接收的数据为空");
}
}catch (Exception e){
return R.fail(L_MSG);
}

Loading…
Cancel
Save