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 |    8 +++++---
 1 files changed, 5 insertions(+), 3 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 f448c8e..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 {
@@ -196,7 +196,7 @@
                     &&"寮�宸�".equals(machine.getState())
                     &&taskingCount.size()<machine.getMaxTaskCount())){
                 //Machine loadMachine=machineMapper.selectById(2L);
-                LineConfiguration lineConfigurationBefore=lineConfigurationService.machineLineConfigurationBefore(machine);
+                LineConfiguration lineConfigurationBefore=lineConfigurationService.machineLineConfigurationBeforeEdg(machine);
                 Machine loadMachine=machineMapper.selectById(lineConfigurationBefore.getMachineId());
                 Tasking tasking;
                 String scan_id="";
@@ -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