From a120dc6724d90d80cf9adc7b02d11eaedc5ca021 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期一, 11 九月 2023 17:40:43 +0800
Subject: [PATCH] Merge branch 'master' of ssh://10.153.19.150:29418/CanadaMes

---
 springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java |   83 ++++++++++++++++++++---------------------
 1 files changed, 40 insertions(+), 43 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
index b8382f2..68fc478 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -1,65 +1,62 @@
 package com.example.springboot.component;
 
 import java.util.List;
+import com.example.springboot.service.SpianService;
+import com.example.springboot.mapper.AlarmMapper;
 
-import javax.websocket.Session;
-
-import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONObject;
 
 public class PlcHold extends Thread {
+
+  private AlarmMapper alarmMapper;
+
+  private SpianService spianService;
+
   @Override
   public void run() {
+    
     while (this != null) {
       try {
 
-        Thread.sleep(10000);
+        Thread.sleep(500);
       } catch (InterruptedException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
-      List<Boolean> bitlist = S7control.getinstance().ReadBits("DB2.0.0", 100);
+      spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
+      //spianService.selectout("112");
+  
+      //鍒ゆ柇杩涚墖璇锋眰 
+       List<Short> datas1List=S7control.getinstance().ReadWord("DB106.24", 1);
+       List<Short> datas1ListState=S7control.getinstance().ReadWord("DB106.8", 1);
+      if(datas1List!=null &&datas1ListState!=null){
+          //鑾峰彇prc杩涚墖璇锋眰鏁版嵁
+       boolean exist = datas1List.contains((short)1); 
+       //鑾峰彇杩涚墖杞︾姸鎬�
+       boolean exist1 = datas1ListState.contains((short)0); 
+      //杩涚墖璇锋眰涓�1鏃�
+       if(exist=true){
+        //褰撹繘鐗囪溅绌洪棽鏃�
+        if(exist1=true){
+        //鑾峰彇杩涚墖id
+        List<Short> datas1ListID=S7control.getinstance().ReadWord("DB106.26", 13);
+        //鑾峰彇鐜荤拑id    
+        for(Short list1:datas1ListID){
+            spianService.selectAll((short)list1);
+        }
+      }
 
-      List<Short> paramlist = S7control.getinstance().ReadWord("DB100.6", 1);
+     
+        
+        
+        //System.out.println(exist);
+      }
+    }
+            
+          
 
+      
       // 鏌ヨ鏁版嵁搴�
       // 鎺ㄩ�佸埌鍓嶇
-
-      // Parameter
-      JSONObject jsonObject = new JSONObject();
-      jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, });
-      WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
-      if (sendwServer != null) {
-        sendwServer.sendMessage(jsonObject.toString());
-      }
-
-      // Action
-      // JSONObject jsonObject2 = new JSONObject();
-      // jsonObject2.append("acion",
-      // new short[] { 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-      // 1, 1, 1, 0, 0, });
-      // WebSocketServer sendwServer2 = WebSocketServer.sessionMap.get("Action");
-      // if (sendwServer2 != null) {
-      // sendwServer2.sendMessage(jsonObject2.toString());
-      // }
-
-      // Sign
-      JSONObject jsonObject3 = new JSONObject();
-      jsonObject3.append("sig",
-          new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0,
-              1, });
-      WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign");
-      if (sendwServer3 != null) {
-        sendwServer3.sendMessage(jsonObject3.toString());
-      }
-
-      // State
-      JSONObject jsonObject4 = new JSONObject();
-      jsonObject4.append("sta", new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, });
-      WebSocketServer sendwServer4 = WebSocketServer.sessionMap.get("State");
-      if (sendwServer4 != null) {
-        sendwServer4.sendMessage(jsonObject4.toString());
-      }
 
     }
   }

--
Gitblit v1.8.0