zhangcl 2 өдөр өмнө
parent
commit
324643f65b

+ 38 - 33
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/sap/SapController.java

@@ -102,10 +102,10 @@ public class SapController {
             }
             // 设置输入参数   暂时只同步2025年的数据
             JCoParameterList input = function.getImportParameterList();
-            input.setValue("I_WERKS", "6011");
+            input.setValue("I_WERKS", "6006");
             // 暂时只设置同步 2025年后的 领料单 2025年之前的领料单 手动入库
-            input.setValue("I_DATUM_F", "2025-07-01"); // 开始日期
-            input.setValue("I_DATUM_T", "2025-08-31"); // 结束日期
+            input.setValue("I_DATUM_F", "2025-06-15"); // 开始日期
+            input.setValue("I_DATUM_T", "2025-12-31"); // 结束日期
 
             // 执行 RFC 调用
             function.execute(destination);
@@ -122,6 +122,7 @@ public class SapController {
             if (headTable != null && headTable.getNumRows() > 0) {
                 for (int i = 0; i < headTable.getNumRows(); i++) {
                     headTable.setRow(i);
+                    String TXTMD = headTable.getString("TXTMD");
                     System.out.println(String.format("行号 %d: 工厂=%s, 名称 1=%s, 领料/退料编号=%s, 领料/退料单名称=%s, " +
                                     "日期=%tT, 项目定义=%s, WBS 元素=%s, 描述=%s, 所属项目部=%s, 所属项目部描述=%s, 成本中心=%s, 成本中心描述=%s\n",
                             i,
@@ -145,36 +146,39 @@ public class SapController {
             if (itemTable != null && itemTable.getNumRows() > 0) {
                 for (int i = 0; i < itemTable.getNumRows(); i++) {
                     itemTable.setRow(i);
-                    /* System.out.println(String.format("行号 %d: 工厂编号=%s, 领料/退料编号=%s, 物料编码=%s, 物料描述=%s, " +
-                                    "物料数量=%s, 基本单位=%s, 特殊库存=%s, 移动原因=%s, 原因=%s, 库存地点编码=%s, 库存地点描述=%s, 库存仓位=%s, 批次=%s, 转入工厂=%s\n" +
-                                    "备注=%s, 物料凭证编号=%s, 物料凭证年度=%s, 行项目号=%s, 本位币金额(单价)=%s, 货币码=%s, 交易后库存数量 - 以输入单位计=%s, 本位币库存总价值=%s, 价格控制标识=%s, 移动平均价或标准价=%s\n",
-                            i,
-                            itemTable.getString("WERKS"),       // 工厂编号
-                            itemTable.getString("ZLTNO"),       // 领料/退料编号
-                            itemTable.getString("MATNR"),       // 物料编码
-                            itemTable.getString("MAKTX"),       // 物料描述
-                            itemTable.getBigDecimal("MENGE"),   // 物料数量
-                            itemTable.getString("MEINS"),       // 基本单位
-                            itemTable.getString("SOBKZ"),       // 特殊库存
-                            itemTable.getString("GRUND"),       // 移动原因
-                            itemTable.getString("GRTXT"),       // 原因
-                            itemTable.getString("LGORT"),       // 库存地点编码
-                            itemTable.getString("LGOBE"),       // 库存地点描述
-                            itemTable.getString("LGPBE"),       // 库存仓位
-                            itemTable.getString("CHARG"),       // 批次
-                            itemTable.getString("WERKS_ZR"),    // 转入工厂
-                            itemTable.getString("BEIZHU"),      // 备注
-                            // 无文档描述
-                            itemTable.getString("MBLNR"),       // 物料凭证编号
-                            itemTable.getString("MJAHR"),       // 物料凭证年度
-                            itemTable.getString("ZEILE"),       // 行项目号
-                            itemTable.getBigDecimal("DMBTR"),   // 本位币金额(单价)
-                            itemTable.getString("WAERS"),       // 货币码
-                            itemTable.getBigDecimal("LBKUM"),   // 交易后库存数量 - 以输入单位计
-                            itemTable.getBigDecimal("SALK3"),   // 本位币库存总价值
-                            itemTable.getString("VPRSV"),       // 价格控制标识
-                            itemTable.getBigDecimal("VERPR")    // 移动平均价或标准价
-                    )); */
+                    String MATNR = itemTable.getString("MATNR");
+                    if ("2000000040".equals(MATNR)) {
+                        System.out.println(String.format("行号 %d: 工厂编号=%s, 领料/退料编号=%s, 物料编码=%s, 物料描述=%s, " +
+                                        "物料数量=%s, 基本单位=%s, 特殊库存=%s, 移动原因=%s, 原因=%s, 库存地点编码=%s, 库存地点描述=%s, 库存仓位=%s, 批次=%s, 转入工厂=%s\n" +
+                                        "备注=%s, 物料凭证编号=%s, 物料凭证年度=%s, 行项目号=%s, 本位币金额(单价)=%s, 货币码=%s, 交易后库存数量 - 以输入单位计=%s, 本位币库存总价值=%s, 价格控制标识=%s, 移动平均价或标准价=%s\n",
+                                i,
+                                itemTable.getString("WERKS"),       // 工厂编号
+                                itemTable.getString("ZLTNO"),       // 领料/退料编号
+                                itemTable.getString("MATNR"),       // 物料编码
+                                itemTable.getString("MAKTX"),       // 物料描述
+                                itemTable.getBigDecimal("MENGE"),   // 物料数量
+                                itemTable.getString("MEINS"),       // 基本单位
+                                itemTable.getString("SOBKZ"),       // 特殊库存
+                                itemTable.getString("GRUND"),       // 移动原因
+                                itemTable.getString("GRTXT"),       // 原因
+                                itemTable.getString("LGORT"),       // 库存地点编码
+                                itemTable.getString("LGOBE"),       // 库存地点描述
+                                itemTable.getString("LGPBE"),       // 库存仓位
+                                itemTable.getString("CHARG"),       // 批次
+                                itemTable.getString("WERKS_ZR"),    // 转入工厂
+                                itemTable.getString("BEIZHU"),      // 备注
+                                // 无文档描述
+                                itemTable.getString("MBLNR"),       // 物料凭证编号
+                                itemTable.getString("MJAHR"),       // 物料凭证年度
+                                itemTable.getString("ZEILE"),       // 行项目号
+                                itemTable.getBigDecimal("DMBTR"),   // 本位币金额(单价)
+                                itemTable.getString("WAERS"),       // 货币码
+                                itemTable.getBigDecimal("LBKUM"),   // 交易后库存数量 - 以输入单位计
+                                itemTable.getBigDecimal("SALK3"),   // 本位币库存总价值
+                                itemTable.getString("VPRSV"),       // 价格控制标识
+                                itemTable.getBigDecimal("VERPR")    // 移动平均价或标准价
+                        ));
+                    }
                 }
             }
 
@@ -221,6 +225,7 @@ public class SapController {
                     tempMaterial.setMATKL(otItabTable.getString("MATKL"));
                     tempMaterial.setWGBEZ(otItabTable.getString("WGBEZ"));
                     tempMaterial.setLVORM(otItabTable.getString("LVORM"));
+                    tempMaterial.setLVORM(otItabTable.getString("MEINS"));
                     sapMaterials.add(tempMaterial);
                     System.out.println(String.format("行号 %d: 物料编码=%s, 物料描述=%s, 物料类型=%s, 物料类型描述=%s, 物料组=%s, 物料组描述=%s, 集团级的DF=%s, 单位=%s\n",
                             i,