From e67b38c4ed42d78a0ab8235f1adcb7eefc011631 Mon Sep 17 00:00:00 2001 From: wuyouming666 <2265557248@qq.com> Date: 星期五, 05 一月 2024 14:26:17 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes --- springboot-vue3/src/main/java/com/example/springboot/component/S7control.java | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 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 95ebb15..e0a5353 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(); } /** @@ -345,7 +353,7 @@ try { return s7PLC.readTime(address); } catch (Exception e) { - e.printStackTrace(); + System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage()); return null; } } -- Gitblit v1.8.0