From 9825ca9fb40954a2a4044b4c224486a2f813d243 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期四, 31 七月 2025 17:58:34 +0800
Subject: [PATCH] art:订单BOM接口、订单工序接口调试

---
 src/main/java/org/jeecg/modules/sap/service/impl/SAPServiceImpl.java |   99 ++++++++++++++++++++++++++-----------------------
 1 files changed, 53 insertions(+), 46 deletions(-)

diff --git a/src/main/java/org/jeecg/modules/sap/service/impl/SAPServiceImpl.java b/src/main/java/org/jeecg/modules/sap/service/impl/SAPServiceImpl.java
index 665b844..0d14e0e 100644
--- a/src/main/java/org/jeecg/modules/sap/service/impl/SAPServiceImpl.java
+++ b/src/main/java/org/jeecg/modules/sap/service/impl/SAPServiceImpl.java
@@ -1,46 +1,53 @@
-package org.jeecg.modules.sap.service.impl;
-
-import com.sap.conn.jco.JCoDestination;
-import com.sap.conn.jco.JCoFunction;
-import com.sap.conn.jco.JCoParameterList;
-import com.sap.conn.jco.JCoRepository;
-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;
-    @SneakyThrows
-    @Override
-    public String test() {
-        JCoDestination destination = connectionManager.getDestination();
-        JCoRepository repository = destination.getRepository();
-        JCoFunction function = repository.getFunction("ZPPF_022");
-
-        if (function == null) {
-            throw new RuntimeException("RFC 鍑芥暟妯″潡 ZPPF_022 鏈壘鍒帮紒");
-        }
-
-        // 璁剧疆杈撳叆鍙傛暟
-        JCoParameterList input = function.getImportParameterList();
-        input.setValue("ZTAB_WERKS", Collections.singletonList("2301")); //鍙傛暟鍚嶉渶涓� SAP 鍑芥暟瀹氫箟涓�鑷�
-
-        // 鎵ц璋冪敤
-        function.execute(destination);
-
-        // 鑾峰彇杈撳嚭鍙傛暟
-        JCoParameterList output = function.getExportParameterList();
-//        String materialName = output.getString("MATERIAL_NAME"); // 鍙傛暟鍚嶉渶涓� SAP 鍑芥暟瀹氫箟涓�鑷�
-
-        return "";
-    }
-}
+//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;
+//    }
+//}

--
Gitblit v1.9.3