springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
@@ -37,13 +37,21 @@ } return instance; } /** * 关闭西门子s7通讯连接 */ 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; } }