From b977364facab9c6bf1b92f9815100b15a30443ff Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 08 五月 2024 17:00:07 +0800
Subject: [PATCH] 修改plc连接报警条件

---
 springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 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 7e7d35b..7773370 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
@@ -23,16 +23,16 @@
 
   @Override
   public void run() {
-
+    spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
+      spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
+      
+      jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
     while (this != null) {
       try {
         spianService.result=new ArrayList<>();
         Thread.sleep(300);
         // if (S7control.getinstance().CheckConnected() == false) {
-      spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
-      spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
       
-      jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
       // 鏍规嵁鐜荤拑id鑾峰彇璁㈠崟鍙�,鍗曠嫭鏁版嵁婧�
       
       // try {
@@ -167,13 +167,14 @@
       north_glass_buffer1 glass2 =new north_glass_buffer1();
 
       try {
-        if(queueid1.toString()!=""){
-          glass1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIdplchold(queueid1.toString(),"","");// D01鐜荤拑淇℃伅
+        if(Plchome.dbconnected==true){
+          if(queueid1.toString()!=""){
+            glass1 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIdplchold(queueid1.toString(),"","");// D01鐜荤拑淇℃伅
+          }
+          if(queueid2.toString()!=""){
+            glass2 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIdplchold(queueid2.toString(),"","");// D02鐜荤拑淇℃伅
+          }
         }
-        if(queueid2.toString()!=""){
-          glass2 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIdplchold(queueid2.toString(),"","");// D02鐜荤拑淇℃伅
-        }
-        
       } catch (SQLException e) {
         e.printStackTrace();
       }

--
Gitblit v1.8.0