From 8d58c40af40493bd5f066cbfdb1ffd9f113c22fc Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期三, 03 九月 2025 16:37:21 +0800
Subject: [PATCH] 1.前端推数据使用了最新的webSokect客户现场总是掉线,修改为接口方式 2.设备交互整体增加异常处理以及PLC连接方式改为短连接
---
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineEdging.java | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineEdging.java b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineEdging.java
index 68f44f0..b2e43ba 100644
--- a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineEdging.java
+++ b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineEdging.java
@@ -48,7 +48,7 @@
this.lineConfigurationService = lineConfigurationService;
}
- public void plcStart() {
+ public void plcStart() throws Exception{
Machine machine=machineMapper.selectById(thisMachine.getId());
ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),machine.getFileName());
try {
@@ -325,12 +325,14 @@
}
@Override
public void run() {
- while (this != null) {
+ while (true) {
try {
Thread.sleep(1000);
plcStart();
} catch (InterruptedException e) {
e.printStackTrace();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
}
}
--
Gitblit v1.8.0