Pārlūkot izejas kodu

pms 保养工单BOM bug

zhangcl 2 mēneši atpakaļ
vecāks
revīzija
f1ad1a3daf

+ 17 - 14
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/sap/SapController.java

@@ -41,7 +41,6 @@ public class SapController {
             function.execute(destination);
 
             // 获取输出参数
-
             JCoParameterList output = function.getTableParameterList();
             JCoTable etStockTable = function.getTableParameterList().getTable("ET_STOCK");
             // JCoParameterList output = function.getExportParameterList();
@@ -162,37 +161,41 @@ public class SapController {
         //
         try {
             JCoDestination destination = sapConnector.getDestination();
-            JCoFunction function = destination.getRepository().getFunction("ZPMS_002");
+            JCoFunction function = destination.getRepository().getFunction("ZPMS_005");
 
             // 设置输入参数
             JCoParameterList input = function.getImportParameterList();
-            input.setValue("IV_WERKS", "6011");
+            input.setValue("IV_LAEDA", ""); // 上次更改的日期
+            input.setValue("IV_MATNR", ""); // 物料编号
+            input.setValue("IV_MAKTX", ""); // 物料描述
 
             // 执行 RFC 调用
             function.execute(destination);
 
             // 获取输出参数
-
             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)) {
                 output.forEach(material -> {
                     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,
-                            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) {
             return "Error calling SAP Material Master Data: " + e.getMessage();
         }

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainworkorder/IotMainWorkOrderServiceImpl.java

@@ -784,6 +784,7 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
             tempBom.setLastRunningKilometers(bom.getTotalMileage());
             tempBom.setLastNaturalDate(LocalDateTimeUtil.now());
             tempBom.setDeviceCategoryId(bom.getAssetClass());
+            tempBom.setStatus(1);
             workOrderBomDOS.add(tempBom);
         });
         iotMainWorkOrderBomMapper.insertBatch(workOrderBomDOS);

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainworkorderbommaterial/IotMainWorkOrderBomMaterialServiceImpl.java

@@ -113,7 +113,7 @@ public class IotMainWorkOrderBomMaterialServiceImpl implements IotMainWorkOrderB
         }
         // 查询设备所属部门下的所有子部门列表
         Set<Long> ids = new HashSet<>();
-        ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
+        ids = deptService.getChildDeptIdListFromCache(device.getDeptId());
         ids.add(device.getDeptId());
         // 查询设备所属部门关联的SAP工厂 成本中心 库存地点
         List<DeptSapOrgRespDTO> sapOrgS = deptSapOrgApi.getSapOrgListByDeptIds(ids);