From 653b17eac39c339774cd46291a9345493b253a1f Mon Sep 17 00:00:00 2001
From: admin <15939171744@163.com>
Date: 星期四, 11 七月 2024 10:35:18 +0800
Subject: [PATCH] 100-1工位 接收工单 人工操作页面优化

---
 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 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 ec95828..4c46dec 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,8 +228,7 @@
             log.error(e.getMessage());
         }
     }
-    public void receivingWorkOrders(String thoroughfare ,String device)
-    {
+/*    public void receivingWorkOrders(String thoroughfare ,String device) {
         String paramProductNum = "";
         try {
 
@@ -241,7 +241,7 @@
                 String orderNum = orderList.get(0).getWorkOrderNo();
                 //涓嬪彂浜у搧妯$粍鐮�
                 miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build());
-                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(productNum).build());
+                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(orderNum).build());
                 //miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build());
 
                 //鏇存柊宸ュ崟鐘舵�佷负鎵ц涓�
@@ -253,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(), "M1OP100");
+            String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), "M1OP100",materialCode);
             JSONObject jsonObject = new JSONObject(orderJsonString);
             // 浠嶫SONObject涓幏鍙杁ata瀵硅薄
             JSONObject dataObject = jsonObject.getJSONObject("data");
@@ -280,6 +280,7 @@
                 omProductionOrdeInfo.setProductNum(dataObject.getStr("productNum"));
                 omProductionOrdeInfo.setStationCode(dataObject.getStr("stationCode"));
                 omProductionOrdeInfo.setMaterialCode(dataObject.getStr("materialCode"));
+                omProductionOrdeInfo.setPlanQty(Long.valueOf(dataObject.getStr("plannedQuantity")));
                 omProductionOrdeInfo.setOnlineCompletionMark("0");
                 omProductionOrdeInfo.setSfResult("0");
                 omProductionOrdeInfo.setProductCode(dataObject.getStr("model"));
@@ -298,7 +299,7 @@
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
-    }*/
+    }
 
     /**
      * 璇诲彇鐢佃姱鐮�

--
Gitblit v1.9.3