From 7677ec6038c661951fcd74a2acfce65f2e83a01e Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 26 十二月 2023 09:26:03 +0800
Subject: [PATCH] 修改复位倒计时为全局弹出

---
 springboot-vue3/src/main/java/com/example/springboot/component/S7control.java |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
index 12cfa1b..0eb3b69 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
@@ -37,13 +37,21 @@
         }
         return instance;
     }
-
+    
     /**
      * 鍏抽棴瑗块棬瀛恠7閫氳杩炴帴
      */
     public void CloseS7client() {
         if (s7PLC == null)
             s7PLC.close();
+            s7PLC.checkConnected();
+    }
+
+    /**
+     * s7閫氳杩炴帴鐘舵��
+     */
+    public boolean CheckConnected() {
+        return s7PLC.checkConnected();
     }
 
     /**
@@ -331,11 +339,29 @@
     }
 
 //璇诲彇鏃堕棿
-    public Long readtime(String address) {
-        if (s7PLC==null)
-            return null;
+public Long readtime(String address) {
+    if (s7PLC == null)
+        return null;
+    try {
         return s7PLC.readTime(address);
+    } catch (Exception e) {
+        e.printStackTrace();
+        return null;
     }
+}
+
+
+    public void writetime(String address, long datas) {
+        if (s7PLC == null)
+            return;
+
+
+        s7PLC.writeTime(address, datas); // 灏嗘暟鎹啓鍏ュ崟涓湴鍧�
+    }
+
+
+
+
 
     private int extractAddressNumber(String address) {
         String numberStr = address.replaceAll("\\D+", ""); // 浣跨敤姝e垯琛ㄨ揪寮忔彁鍙栨暟瀛楅儴鍒�

--
Gitblit v1.8.0