From 123a6f57a1e52980b323de65e5642148e4348ff3 Mon Sep 17 00:00:00 2001
From: yxFwq <1>
Date: 星期二, 10 六月 2025 15:04:53 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/RgvThread.java |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/RgvThread.java b/src/main/java/com/zy/core/thread/RgvThread.java
index f40cf84..4c7cdcf 100644
--- a/src/main/java/com/zy/core/thread/RgvThread.java
+++ b/src/main/java/com/zy/core/thread/RgvThread.java
@@ -101,6 +101,15 @@
     private void readStatusRgv() {
         while (true) {
             try {
+                if(!connectRgv){
+                    try {
+                        Thread.sleep(1000L);
+                    } catch (Exception e){
+
+                    }
+                    initRgv();
+                    continue;
+                }
                 Thread.sleep(50);
                 readStatus();
 
@@ -123,6 +132,14 @@
     private void taskIssued() {
         while (true) {
             try {
+                if(!connectRgv){
+                    try {
+                        Thread.sleep(1000L);
+                    } catch (Exception e){
+
+                    }
+                    continue;
+                }
                 int step = 1;
                 Task task = MessageQueue.poll(SlaveType.Rgv, slave.getId());
                 if (task != null) {
@@ -355,7 +372,7 @@
 
         if (command.getAckFinish1() == 0 && command.getAckFinish2() == 0) {
             short commandFinish = 3;  //宸ヤ綅1銆�2浠诲姟鍚屾椂鍐欏叆
-            Thread.sleep(100L);
+            Thread.sleep(50L);
             result = siemensNet.Write("DB100.20", commandFinish);
         }
 
@@ -380,8 +397,8 @@
         } catch (Exception ignore) {}
 
         if (result != null && result.IsSuccess) {
-            Thread.sleep(200);
-            this.readStatus();
+//            Thread.sleep(200);
+//            this.readStatus();
             log.info("RGV 鍛戒护涓嬪彂[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
             OutputQueue.RGV.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
             return true;
@@ -416,7 +433,7 @@
 
         if (command.getAckFinish1() == 0) {
             short commandFinish = 1;  //宸ヤ綅1浠诲姟鍐欏叆
-            Thread.sleep(100L);
+            Thread.sleep(20L);
             result = siemensNet.Write("DB100.20", commandFinish);
         }
 
@@ -441,8 +458,8 @@
         } catch (Exception ignore) {}
 
         if (result != null && result.IsSuccess) {
-            Thread.sleep(200);
-            this.readStatus();
+//            Thread.sleep(200);
+//            this.readStatus();
             log.info("RGV 宸ヤ綅1鍛戒护涓嬪彂[id:{}] >>>>> {}", slave.getId(), JSON.toJSONString(command));
             OutputQueue.RGV.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 宸ヤ綅1鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSONString(command)));
             return true;
@@ -475,7 +492,7 @@
 
         if (command.getAckFinish2() == 0) {
             short commandFinish = 2;  //宸ヤ綅2浠诲姟鍐欏叆
-            Thread.sleep(100L);
+            Thread.sleep(20L);
             result = siemensNet.Write("DB100.20", commandFinish);
         }
 
@@ -500,8 +517,8 @@
         } catch (Exception ignore) {}
 
         if (result != null && result.IsSuccess) {
-            Thread.sleep(200);
-            this.readStatus();
+//            Thread.sleep(200);
+//            this.readStatus();
             log.info("RGV 宸ヤ綅2鍛戒护涓嬪彂[id:{}] >>>>> {}", slave.getId(), JSON.toJSONString(command));
             OutputQueue.RGV.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 宸ヤ綅2鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSONString(command)));
             return true;

--
Gitblit v1.9.1