From 35c489d86b027462dca8bdd06e5fb6dc066fa428 Mon Sep 17 00:00:00 2001
From: cl <418351270@qq.com>
Date: 星期四, 11 七月 2024 09:36:46 +0800
Subject: [PATCH] 修改参数采集

---
 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
index 7342035..f36100c 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -160,9 +160,10 @@
                         Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//浜у搧绫诲瀷
                         if (ObjectUtil.isNotNull(productTypeObjcet)){
                             String productType = productTypeObjcet.toString();//浜у搧绫诲瀷
+                            String materialCode = Constants.materialMap.get(productType);
                             CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> {
                                 //璋冪敤宸ュ巶MES锛屼繚瀛樺埌鏁版嵁搴�,骞朵笖灏嗗伐鍗曚紶缁橮LC (鐩墠涓存椂鐢ㄨ鏂规硶锛�
-                                receivingWorkOrders(thoroughfare, device);
+                                receivingWorkOrders(thoroughfare, device,materialCode);
                             });
 
                             miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build());
@@ -227,7 +228,7 @@
             log.error(e.getMessage());
         }
     }
-    public void receivingWorkOrders(String thoroughfare ,String device) {
+/*    public void receivingWorkOrders(String thoroughfare ,String device) {
         String paramProductNum = "";
         try {
 
@@ -252,21 +253,21 @@
                 //灏嗕骇鍝丼N鍙戦�佸埌鍓嶅彴
                 productNum = "productNum,"+ productNum;
                 WebSocketUsers.sendMessageToUserByText(map.get(device), productNum);
-            }/*else{
+            }*//*else{
                 miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(2).build());//娌℃湁瑕佺敓浜х殑宸ュ崟
-            }*/
+            }*//*
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
-    }
+    }*/
 
-   /* public void receivingWorkOrders(String thoroughfare ,String device)
+    public void receivingWorkOrders(String thoroughfare ,String device ,String materialCode)
     {
         String paramProductNum = "";
         try {
             // 鏌ヨ鏈�鏂扮殑宸ュ崟淇℃伅
             OmProductionOrdeInfo lastOrder = omProductionOrdeInfoService.getLastOrder();
-            String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), "MOP100");
+            String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), "M1OP100",materialCode);
             JSONObject jsonObject = new JSONObject(orderJsonString);
             // 浠嶫SONObject涓幏鍙杁ata瀵硅薄
             JSONObject dataObject = jsonObject.getJSONObject("data");
@@ -297,7 +298,7 @@
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
-    }*/
+    }
 
     /**
      * 璇诲彇鐢佃姱鐮�

--
Gitblit v1.9.3