From 89f70f154bf778afb0d5b45455f1a0929aec4817 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期三, 17 一月 2024 14:23:02 +0800
Subject: [PATCH] 更新合并
---
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 0eb3b69..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
@@ -223,7 +223,15 @@
if (s7PLC==null)
return null;
// List<String> addresslist = GetAddressList(address, count, 16);
- return s7PLC.readByte(address,count);
+
+ try {
+ return s7PLC.readByte(address, count);
+ }catch (Exception e) {
+ // 澶勭悊寮傚父
+ System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
+ return null;
+ }
+
}
/**
@@ -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