|
@@ -41,7 +41,6 @@ public class SapController {
|
|
function.execute(destination);
|
|
function.execute(destination);
|
|
|
|
|
|
// 获取输出参数
|
|
// 获取输出参数
|
|
-
|
|
|
|
JCoParameterList output = function.getTableParameterList();
|
|
JCoParameterList output = function.getTableParameterList();
|
|
JCoTable etStockTable = function.getTableParameterList().getTable("ET_STOCK");
|
|
JCoTable etStockTable = function.getTableParameterList().getTable("ET_STOCK");
|
|
// JCoParameterList output = function.getExportParameterList();
|
|
// JCoParameterList output = function.getExportParameterList();
|
|
@@ -162,37 +161,41 @@ public class SapController {
|
|
//
|
|
//
|
|
try {
|
|
try {
|
|
JCoDestination destination = sapConnector.getDestination();
|
|
JCoDestination destination = sapConnector.getDestination();
|
|
- JCoFunction function = destination.getRepository().getFunction("ZPMS_002");
|
|
|
|
|
|
+ JCoFunction function = destination.getRepository().getFunction("ZPMS_005");
|
|
|
|
|
|
// 设置输入参数
|
|
// 设置输入参数
|
|
JCoParameterList input = function.getImportParameterList();
|
|
JCoParameterList input = function.getImportParameterList();
|
|
- input.setValue("IV_WERKS", "6011");
|
|
|
|
|
|
+ input.setValue("IV_LAEDA", ""); // 上次更改的日期
|
|
|
|
+ input.setValue("IV_MATNR", ""); // 物料编号
|
|
|
|
+ input.setValue("IV_MAKTX", ""); // 物料描述
|
|
|
|
|
|
// 执行 RFC 调用
|
|
// 执行 RFC 调用
|
|
function.execute(destination);
|
|
function.execute(destination);
|
|
|
|
|
|
// 获取输出参数
|
|
// 获取输出参数
|
|
-
|
|
|
|
JCoParameterList output = function.getTableParameterList();
|
|
JCoParameterList output = function.getTableParameterList();
|
|
- JCoTable etStockTable = function.getTableParameterList().getTable("ET_STOCK");
|
|
|
|
- // JCoParameterList output = function.getExportParameterList();
|
|
|
|
|
|
+ JCoTable otItabTable = function.getTableParameterList().getTable("OT_ITAB");
|
|
if (CollUtil.isNotEmpty(output)) {
|
|
if (CollUtil.isNotEmpty(output)) {
|
|
output.forEach(material -> {
|
|
output.forEach(material -> {
|
|
System.out.println(material.getName());
|
|
System.out.println(material.getName());
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if (etStockTable != null && etStockTable.getNumRows() > 0) {
|
|
|
|
- for (int i = 0; i < etStockTable.getNumRows(); i++) {
|
|
|
|
- etStockTable.setRow(i);
|
|
|
|
- System.out.println(String.format("行号 %d: 工厂=%s, 物料=%s, 数量=%s\n",
|
|
|
|
|
|
+ if (otItabTable != null && otItabTable.getNumRows() > 0) {
|
|
|
|
+ for (int i = 0; i < otItabTable.getNumRows(); i++) {
|
|
|
|
+ otItabTable.setRow(i);
|
|
|
|
+ System.out.println(String.format("行号 %d: 物料编码=%s, 物料描述=%s, 物料类型=%s, 物料类型描述=%s, 物料组=%s, 物料组描述=%s, 集团级的DF=%s\n",
|
|
i,
|
|
i,
|
|
- etStockTable.getString("WERKS"),
|
|
|
|
- etStockTable.getString("MATNR"),
|
|
|
|
- etStockTable.getString("LABST")
|
|
|
|
|
|
+ otItabTable.getString("MATNR"), // 物料编码
|
|
|
|
+ otItabTable.getString("MAKTX"), // 物料描述
|
|
|
|
+ otItabTable.getString("MTART"), // 物料类型
|
|
|
|
+ otItabTable.getString("MTBEZ"), // 物料类型描述
|
|
|
|
+ otItabTable.getString("MATKL"), // 物料组
|
|
|
|
+ otItabTable.getString("WGBEZ"), // 物料组描述
|
|
|
|
+ otItabTable.getString("LVORM") // 集团级的DF
|
|
));
|
|
));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return "Material Info: " + output.getString("ET_STOCK");
|
|
|
|
|
|
+ return "Material Info: " + output.getString("OT_ITAB");
|
|
} catch (JCoException e) {
|
|
} catch (JCoException e) {
|
|
return "Error calling SAP Material Master Data: " + e.getMessage();
|
|
return "Error calling SAP Material Master Data: " + e.getMessage();
|
|
}
|
|
}
|