新火炬后端单体项目初始化代码
zhangherong
7 天以前 9825ca9fb40954a2a4044b4c224486a2f813d243
art:订单BOM接口、订单工序接口调试
已添加6个文件
已修改6个文件
540 ■■■■ 文件已修改
db/双林新火炬MES数据库设计.pdma.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/controller/SAPTestController.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/dto/OrderBomDTO.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/dto/OrderProcessDTO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/service/OrderBomSync.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/service/OrderProcessSync.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/service/ProductionOrderSync.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/service/SAPService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/service/impl/OrderBomSyncImpl.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/service/impl/OrderProcessSyncImpl.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/service/impl/ProductionOrderSyncImpl.java 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/sap/service/impl/SAPServiceImpl.java 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
db/Ë«ÁÖлð¾æMESÊý¾Ý¿âÉè¼Æ.pdma.json
@@ -4,7 +4,7 @@
  "avatar": "",
  "version": "4.9.2",
  "createdTime": "2025-3-10 16:38:19",
  "updatedTime": "2025-7-30 14:19:17",
  "updatedTime": "2025-7-31 10:26:58",
  "dbConns": [],
  "profile": {
    "default": {
@@ -11305,7 +11305,7 @@
        {
          "defKey": "work_order_status",
          "defName": "工单状态",
          "comment": "新建、发布、重发布",
          "comment": "新建、已发布、重发布",
          "type": "",
          "len": "",
          "scale": "",
src/main/java/org/jeecg/modules/sap/controller/SAPTestController.java
@@ -4,8 +4,9 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.sap.service.OrderBomSync;
import org.jeecg.modules.sap.service.OrderProcessSync;
import org.jeecg.modules.sap.service.ProductionOrderSync;
import org.jeecg.modules.sap.service.SAPService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -18,22 +19,56 @@
@RequestMapping("/sap/client")
@Slf4j
public class SAPTestController {
    @Autowired
    private SAPService sapService;
    //新火炬工厂编码
    private static final String factoryCode = "2301";
    //标准生产订单
    private static final String orderTypeCode1 = "Z001";
    //返工订单  æš‚时不用
    private static final String orderTypeCode2 = "Z002";
    //八分厂调度员
    //    private static final String productionManager = "012";
    private static final String productionManager = "010";
    //生产订单状态 CRTD æ–°å»ºï¼ŒREL ä¸‹è¾¾ï¼ŒTECO å…³é—­  å®žé™…上,只有REL状态的工单才可以进行操作
    private static final String orderStatus = "REL";
    private static final String createTime = "20250508";
    private static final String updateTime = "20250101";
//    @Autowired
//    private SAPService sapService;
    @Autowired
    private ProductionOrderSync productionOrderSync;
    @Autowired
    private OrderBomSync orderBomSync;
    @Autowired
    private OrderProcessSync orderProcessSync;
    @ApiOperation(value = "SAP集成测试-测试接口", notes = "SAP集成测试-测试接口")
    @GetMapping("/test")
    public Result<?> test() {
        String test = sapService.test();
        return Result.ok(test);
    }
//    @ApiOperation(value = "SAP集成测试-测试接口", notes = "SAP集成测试-测试接口")
//    @GetMapping("/test")
//    public Result<?> test() {
//        String test = sapService.test();
//        return Result.ok(test);
//    }
    @ApiOperation(value = "SAP集成测试-生产订单同步接口", notes = "SAP集成测试-生产订单同步接口")
    @GetMapping("/syncProductionOrder")
    public Result<?> syncProductionOrder() throws Exception {
        Map<String, Object> resultMap = productionOrderSync.syncProductionOrder();
        Map<String, Object> resultMap = productionOrderSync.syncProductionOrder(factoryCode, orderTypeCode1, productionManager, orderStatus, createTime, null);
        return Result.ok(resultMap);
    }
    @ApiOperation(value = "SAP集成测试-订单BOM同步", notes = "SAP集成测试-订单BOM同步")
    @GetMapping("/syncOrderBom")
    public Result<?> syncOrderBom() throws Exception {
        String orderCode = "10706312,10706988,10708077,10708078,10708825,10711404,10711404,10711543";
        Map<String, Object> resultMap = orderBomSync.syncOrderBom(factoryCode, orderCode);
        return Result.ok(resultMap);
    }
    @ApiOperation(value = "SAP集成测试-订单工序同步", notes = "SAP集成测试-订单工序同步")
    @GetMapping("/syncOrderProcess")
    public Result<?> syncOrderProcess() throws Exception {
        String orderCode = "10706312,10706988,10708077,10708078,10708825,10711404,10711404,10711543";
        Map<String, Object> resultMap = orderProcessSync.syncOrderProcess(factoryCode, orderCode);
        return Result.ok(resultMap);
    }
}
src/main/java/org/jeecg/modules/sap/dto/OrderBomDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package org.jeecg.modules.sap.dto;
import lombok.Data;
@Data
public class OrderBomDTO {
    /** è®¢å•号 */
    private String AUFNR;
    /** ç‰©æ–™å· */
    private String MATNR;
    /** å·¥åŽ‚ç¼–å· */
    private String WERKS;
    /** ç‰©æ–™æè¿°ï¼ˆçŸ­æ–‡æœ¬ï¼‰  */
    private String MAKTX;
    /** éœ€æ±‚量 */
    private String BDMNG;
    /** MEINS */
    private String MEINS;
}
src/main/java/org/jeecg/modules/sap/dto/OrderProcessDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package org.jeecg.modules.sap.dto;
import lombok.Data;
@Data
public class OrderProcessDTO {
    /** è®¢å•号 */
    private String AUFNR;
    /** ç‰©æ–™å·  */
    private String MATNR;
    /** æ“ä½œ/活动编号  */
    private String VORNR;
    /** å·¥åºçŸ­æ–‡æœ¬  */
    private String LTXA1;
    /** å·¥åŽ‚ */
    private String WERKS;
    /** æŽ§åˆ¶ç   */
    private String STEUS;
}
src/main/java/org/jeecg/modules/sap/service/OrderBomSync.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
package org.jeecg.modules.sap.service;
import java.util.Map;
public interface OrderBomSync {
    /**
     * åŒæ­¥è®¢å•BOM数据
     * @return
     * @throws Exception
     */
    Map<String, Object> syncOrderBom(String factoryCode, String orderCode) throws Exception;
}
src/main/java/org/jeecg/modules/sap/service/OrderProcessSync.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
package org.jeecg.modules.sap.service;
import java.util.Map;
public interface OrderProcessSync {
    /**
     * åŒæ­¥è®¢å•工序数据
     * @return
     * @throws Exception
     */
    Map<String, Object> syncOrderProcess(String factoryCode, String orderCode) throws Exception;
}
src/main/java/org/jeecg/modules/sap/service/ProductionOrderSync.java
@@ -6,5 +6,5 @@
    /**
     * åŒæ­¥ç”Ÿæˆè®¢å•
     */
    Map<String, Object> syncProductionOrder() throws Exception;
    Map<String, Object> syncProductionOrder(String factoryCode, String orderTypeCode, String productionManager, String orderStatus, String createTime, String updateTime) throws Exception;
}
src/main/java/org/jeecg/modules/sap/service/SAPService.java
@@ -1,5 +1,5 @@
package org.jeecg.modules.sap.service;
public interface SAPService {
    String test();
}
//package org.jeecg.modules.sap.service;
//
//public interface SAPService {
//    String test();
//}
src/main/java/org/jeecg/modules/sap/service/impl/OrderBomSyncImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,91 @@
package org.jeecg.modules.sap.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.sap.conn.jco.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.aspect.annotation.ApiLog;
import org.jeecg.common.constant.ApiLogCategoryEnum;
import org.jeecg.config.sap.SapRfcConnectionManager;
import org.jeecg.modules.sap.FunctionConst;
import org.jeecg.modules.sap.dto.OrderBomDTO;
import org.jeecg.modules.sap.service.OrderBomSync;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class OrderBomSyncImpl implements OrderBomSync {
    @Autowired
    private SapRfcConnectionManager connectionManager;
    @Override
    @ApiLog(apiName = "订单BOM同步(ZPPF_033_3)", apiCategory = ApiLogCategoryEnum.SAP)
    public Map<String, Object> syncOrderBom(String factoryCode, String orderCode) throws Exception {
        Map<String, Object> resultMap = new HashMap<>();
        JCoDestination destination = connectionManager.getDestination();
        JCoRepository repository = destination.getRepository();
        JCoFunction function = repository.getFunction(FunctionConst.ZPPF_033_3);
        if (function == null) {
            throw new RuntimeException("RFC å‡½æ•° ZPPF_033_3 æœªæ‰¾åˆ°ï¼");
        }
        // è®¾ç½®è¾“入参数
        List<JSONObject> items = new ArrayList<>();
        if(StringUtils.isNotBlank(factoryCode)){
            //新火炬
            JCoParameterList importParameterList = function.getImportParameterList();
            importParameterList.setValue("WERKS", factoryCode);
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("WERKS", factoryCode);
            items.add(item);
        }
        if(StringUtils.isNotBlank(orderCode)) {
            //新火炬
            JCoTable AUFNRTable = function.getTableParameterList().getTable("ZTAB_AUFNR");
            String[] split = orderCode.split(",");
            for(String code : split){
                AUFNRTable.appendRow();
                AUFNRTable.setValue("AUFNR", code);
            }
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("AUFNR", orderCode);
            items.add(item);
        }
        // æ‰§è¡Œè°ƒç”¨
        function.execute(destination);
        //获取返回结果
        String zmess = function.getExportParameterList().getValue("ZMESS").toString();
        String ztype = function.getExportParameterList().getValue("ZTYPE").toString();//S æ ‡è¯† æˆåŠŸ
        // èŽ·å–è¾“å‡ºå‚æ•°
        JCoTable outputTable = function.getTableParameterList().getTable("ZTAB_OUT");
        int numRows = outputTable.getNumRows();
        List<OrderBomDTO> resultList = new ArrayList<>();
        OrderBomDTO dto;
        for (int i = 0; i < numRows; i++) {
            outputTable.setRow(i);
            dto = new OrderBomDTO();
            dto.setAUFNR(outputTable.getString("AUFNR"));
            dto.setMATNR(outputTable.getString("MATNR"));
            dto.setWERKS(outputTable.getString("WERKS"));
            dto.setMAKTX(outputTable.getString("MAKTX"));
            dto.setBDMNG(outputTable.getString("BDMNG"));
            dto.setMEINS(outputTable.getString("MEINS"));
            //添加结果集
            resultList.add(dto);
            log.info(dto.toString());
        }
        resultMap.put("zmess", zmess);
        resultMap.put("ztype", ztype);
        resultMap.put("importParameters", items);
        resultMap.put("result", resultList);
        return resultMap;
    }
}
src/main/java/org/jeecg/modules/sap/service/impl/OrderProcessSyncImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,93 @@
package org.jeecg.modules.sap.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.sap.conn.jco.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.aspect.annotation.ApiLog;
import org.jeecg.common.constant.ApiLogCategoryEnum;
import org.jeecg.config.sap.SapRfcConnectionManager;
import org.jeecg.modules.sap.FunctionConst;
import org.jeecg.modules.sap.dto.OrderBomDTO;
import org.jeecg.modules.sap.dto.OrderProcessDTO;
import org.jeecg.modules.sap.service.OrderProcessSync;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@Slf4j
public class OrderProcessSyncImpl implements OrderProcessSync {
    @Autowired
    private SapRfcConnectionManager connectionManager;
    @Override
    @ApiLog(apiName = "产品工艺路线同步(ZPPF_033_2)", apiCategory = ApiLogCategoryEnum.SAP)
    public Map<String, Object> syncOrderProcess(String factoryCode, String orderCode) throws Exception {
        Map<String, Object> resultMap = new HashMap<>();
        JCoDestination destination = connectionManager.getDestination();
        JCoRepository repository = destination.getRepository();
        JCoFunction function = repository.getFunction(FunctionConst.ZPPF_033_2);
        if (function == null) {
            throw new RuntimeException("RFC å‡½æ•° ZPPF_033_2 æœªæ‰¾åˆ°ï¼");
        }
        // è®¾ç½®è¾“入参数
        List<JSONObject> items = new ArrayList<>();
        if(StringUtils.isNotBlank(factoryCode)){
            //新火炬
            JCoTable WERKSTable = function.getTableParameterList().getTable("ZTAB_WERKS");
            String[] split = factoryCode.split(",");
            for(String code : split){
                WERKSTable.appendRow();
                WERKSTable.setValue("WERKS", code);
            }
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("WERKS", factoryCode);
            items.add(item);
        }
        if(StringUtils.isNotBlank(orderCode)) {
            //新火炬
            JCoTable AUFNRTable = function.getTableParameterList().getTable("ZTAB_AUFNR");
            String[] split = orderCode.split(",");
            for(String code : split){
                AUFNRTable.appendRow();
                AUFNRTable.setValue("AUFNR", code);
            }
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("AUFNR", orderCode);
            items.add(item);
        }
        // æ‰§è¡Œè°ƒç”¨
        function.execute(destination);
        //获取返回结果
        String zmess = function.getExportParameterList().getValue("ZMESS").toString();
        String ztype = function.getExportParameterList().getValue("ZTYPE").toString();//S æ ‡è¯† æˆåŠŸ
        // èŽ·å–è¾“å‡ºå‚æ•°
        JCoTable outputTable = function.getTableParameterList().getTable("ZTAB_OUT");
        int numRows = outputTable.getNumRows();
        List<OrderProcessDTO> resultList = new ArrayList<>();
        OrderProcessDTO dto;
        for (int i = 0; i < numRows; i++) {
            outputTable.setRow(i);
            dto = new OrderProcessDTO();
            dto.setAUFNR(outputTable.getString("AUFNR"));
            dto.setMATNR(outputTable.getString("MATNR"));
            dto.setWERKS(outputTable.getString("WERKS"));
            dto.setVORNR(outputTable.getString("VORNR"));
            dto.setLTXA1(outputTable.getString("LTXA1"));
            dto.setSTEUS(outputTable.getString("STEUS"));
            //添加结果集
            resultList.add(dto);
            log.info(dto.toString());
        }
        resultMap.put("zmess", zmess);
        resultMap.put("ztype", ztype);
        resultMap.put("importParameters", items);
        resultMap.put("result", resultList);
        return resultMap;
    }
}
src/main/java/org/jeecg/modules/sap/service/impl/ProductionOrderSyncImpl.java
@@ -6,6 +6,7 @@
import com.sap.conn.jco.JCoRepository;
import com.sap.conn.jco.JCoTable;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.aspect.annotation.ApiLog;
import org.jeecg.common.constant.ApiLogCategoryEnum;
import org.jeecg.config.sap.SapRfcConnectionManager;
@@ -26,25 +27,13 @@
@Service
@Slf4j
public class ProductionOrderSyncImpl implements ProductionOrderSync {
    //新火炬工厂编码
    private static final String factoryCode = "2301";
    //标准生产订单
    private static final String orderTypeCode1 = "Z001";
    //返工订单  æš‚时不用
    private static final String orderTypeCode2 = "Z002";
    //八分厂调度员
//    private static final String productionManager = "012";
    private static final String productionManager = "010";
    //生产订单状态 CRTD æ–°å»ºï¼ŒREL ä¸‹è¾¾ï¼ŒTECO å…³é—­  å®žé™…上,只有REL状态的工单才可以进行操作
    private static final String orderStatus = "REL";
    @Autowired
    private SapRfcConnectionManager connectionManager;
    @Override
    @ApiLog(apiName = "生产订单同步接口(ZPPF_033_1)", apiCategory = ApiLogCategoryEnum.SAP)
    public Map<String, Object> syncProductionOrder() throws Exception {
    @ApiLog(apiName = "生产订单同步(ZPPF_033_1)", apiCategory = ApiLogCategoryEnum.SAP)
    public Map<String, Object> syncProductionOrder(String factoryCode, String orderTypeCode, String productionManager, String orderStatus, String createTime, String updateTime) throws Exception {
        Map<String, Object> resultMap = new HashMap<>();
        JCoDestination destination = connectionManager.getDestination();
        JCoRepository repository = destination.getRepository();
@@ -57,37 +46,74 @@
//            JCoTable AUFNRTable = function.getTableParameterList().getTable("ZTAB_AUFNR");
        List<JSONObject> items = new ArrayList<>();
        //订单类型 æ ‡å‡†ç”Ÿäº§è®¢å•
        JCoTable AUARTTable = function.getTableParameterList().getTable("ZTAB_AUART");
        AUARTTable.appendRow();
        AUARTTable.setValue("AUART", orderTypeCode1);
        //组装请求参数
        JSONObject item1 = new JSONObject();
        item1.put("AUART", orderTypeCode1);
        items.add(item1);
        //八分厂调度
        JCoTable FEVORTable = function.getTableParameterList().getTable("ZTAB_FEVOR");
        FEVORTable.appendRow();
        FEVORTable.setValue("FEVOR", productionManager);
        //组装请求参数
        JSONObject item2 = new JSONObject();
        item2.put("FEVOR", productionManager);
        items.add(item2);
        //新火炬
        JCoTable WERKSTable = function.getTableParameterList().getTable("ZTAB_WERKS");
        WERKSTable.appendRow();
        WERKSTable.setValue("WERKS", factoryCode);
        //组装请求参数
        JSONObject item3 = new JSONObject();
        item3.put("WERKS", factoryCode);
        items.add(item3);
        //订单状态
        JCoTable TXT04Table = function.getTableParameterList().getTable("ZTAB_TXT04");
        TXT04Table.appendRow();
        TXT04Table.setValue("TXT04", orderStatus);
        //组装请求参数
        JSONObject item4 = new JSONObject();
        item4.put("TXT04", orderStatus);
        items.add(item4);
        if(StringUtils.isNotBlank(orderTypeCode)){
            JCoTable AUARTTable = function.getTableParameterList().getTable("ZTAB_AUART");
            String[] split = orderTypeCode.split(",");
            for(String code : split){
                AUARTTable.appendRow();
                AUARTTable.setValue("AUART", code);
            }
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("AUART", orderTypeCode);
            items.add(item);
        }
        if(StringUtils.isNotBlank(productionManager)){
            JCoTable FEVORTable = function.getTableParameterList().getTable("ZTAB_FEVOR");
            String[] split = productionManager.split(",");
            for(String code : split){
                FEVORTable.appendRow();
                FEVORTable.setValue("FEVOR", code);
            }
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("FEVOR", productionManager);
            items.add(item);
        }
        if(StringUtils.isNotBlank(factoryCode)){
            //新火炬
            JCoTable WERKSTable = function.getTableParameterList().getTable("ZTAB_WERKS");
            String[] split = factoryCode.split(",");
            for(String code : split){
                WERKSTable.appendRow();
                WERKSTable.setValue("WERKS", code);
            }
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("WERKS", factoryCode);
            items.add(item);
        }
        if(StringUtils.isNotBlank(orderStatus)) {
            //新火炬
            JCoTable TXT04Table = function.getTableParameterList().getTable("ZTAB_TXT04");
            String[] split = orderStatus.split(",");
            for(String code : split){
                TXT04Table.appendRow();
                TXT04Table.setValue("TXT04", code);
            }
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("TXT04", orderStatus);
            items.add(item);
        }
        if(StringUtils.isNotBlank(createTime)){
            JCoTable UDATETable = function.getTableParameterList().getTable("ZTAB_UDATE");
            UDATETable.appendRow();
            UDATETable.setValue("LOW", createTime);
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("ZTAB_UDATE_LOW", createTime);
            items.add(item);
        }
        if(StringUtils.isNotBlank(updateTime)){
            JCoTable LAEDATable = function.getTableParameterList().getTable("ZTAB_LAEDA");
            LAEDATable.appendRow();
            LAEDATable.setValue("LOW", updateTime);
            //组装请求参数
            JSONObject item = new JSONObject();
            item.put("ZTAB_LAEDA_LOW", updateTime);
            items.add(item);
        }
        // æ‰§è¡Œè°ƒç”¨
        function.execute(destination);
        //获取返回结果
src/main/java/org/jeecg/modules/sap/service/impl/SAPServiceImpl.java
@@ -1,53 +1,53 @@
package org.jeecg.modules.sap.service.impl;
import com.sap.conn.jco.*;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.config.sap.SapRfcConnectionManager;
import org.jeecg.modules.sap.service.SAPService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Collections;
@Service
@Slf4j
public class SAPServiceImpl implements SAPService {
    @Autowired
    private SapRfcConnectionManager connectionManager;
    @Override
    public String test()  {
        JCoDestination destination = connectionManager.getDestination();
        try {
            JCoRepository repository = destination.getRepository();
            JCoFunction function = repository.getFunction("ZPPF_022");
            if (function == null) {
                throw new RuntimeException("RFC å‡½æ•°æ¨¡å— ZPPF_022 æœªæ‰¾åˆ°ï¼");
            }
            // è®¾ç½®è¾“入参数
            JCoTable inputTable = function.getTableParameterList().getTable("ZTAB_WERKS");
            inputTable.appendRow();
            inputTable.setValue("WERKS", "2301"); //参数名需与 SAP å‡½æ•°å®šä¹‰ä¸€è‡´
            // æ‰§è¡Œè°ƒç”¨
            function.execute(destination);
            // èŽ·å–è¾“å‡ºå‚æ•°
            JCoTable outputTable = function.getTableParameterList().getTable("ZTAB_AUFNR");
            int numRows = outputTable.getNumRows();
            for (int i = 0; i < numRows; i++) {
                outputTable.setRow(i);
                log.info("Row {} : {}", i, outputTable.getString("AUFNR"));
            }
            return String.valueOf(numRows);
        } catch (JCoException e) {
            log.error(e.getMessage(), e);
        }
        return null;
    }
}
//package org.jeecg.modules.sap.service.impl;
//
//import com.sap.conn.jco.*;
//import lombok.SneakyThrows;
//import lombok.extern.slf4j.Slf4j;
//import org.jeecg.config.sap.SapRfcConnectionManager;
//import org.jeecg.modules.sap.service.SAPService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.Arrays;
//import java.util.Collections;
//
//@Service
//@Slf4j
//public class SAPServiceImpl implements SAPService {
//    @Autowired
//    private SapRfcConnectionManager connectionManager;
//
//    @Override
//    public String test()  {
//        JCoDestination destination = connectionManager.getDestination();
//        try {
//            JCoRepository repository = destination.getRepository();
//            JCoFunction function = repository.getFunction("ZPPF_022");
//
//            if (function == null) {
//                throw new RuntimeException("RFC å‡½æ•°æ¨¡å— ZPPF_022 æœªæ‰¾åˆ°ï¼");
//            }
//
//            // è®¾ç½®è¾“入参数
//            JCoTable inputTable = function.getTableParameterList().getTable("ZTAB_WERKS");
//            inputTable.appendRow();
//            inputTable.setValue("WERKS", "2301"); //参数名需与 SAP å‡½æ•°å®šä¹‰ä¸€è‡´
//
//            // æ‰§è¡Œè°ƒç”¨
//            function.execute(destination);
//
//            // èŽ·å–è¾“å‡ºå‚æ•°
//            JCoTable outputTable = function.getTableParameterList().getTable("ZTAB_AUFNR");
//            int numRows = outputTable.getNumRows();
//            for (int i = 0; i < numRows; i++) {
//                outputTable.setRow(i);
//                log.info("Row {} : {}", i, outputTable.getString("AUFNR"));
//            }
//
//            return String.valueOf(numRows);
//        } catch (JCoException e) {
//            log.error(e.getMessage(), e);
//        }
//        return null;
//    }
//}