From 3ac9f524f1f751015a3882f08d631233208953dc Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期二, 30 一月 2024 08:57:36 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/ScaleThread.java |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/ScaleThread.java b/src/main/java/com/zy/core/thread/ScaleThread.java
index 2c9a212..0dcae31 100644
--- a/src/main/java/com/zy/core/thread/ScaleThread.java
+++ b/src/main/java/com/zy/core/thread/ScaleThread.java
@@ -6,6 +6,7 @@
 import com.core.common.SpringUtils;
 import com.zy.asrs.entity.BasDevp;
 import com.zy.asrs.service.BasDevpService;
+import com.zy.asrs.service.DeviceErrorService;
 import com.zy.core.Slave;
 import com.zy.core.ThreadHandler;
 import com.zy.core.cache.OutputQueue;
@@ -83,6 +84,7 @@
 
     @Override
     public boolean connect() {
+
         try {
             close();  //1.涓诲姩閲婃斁杩炴帴 //2.鏌愪簺鏈嶅姟鍣ㄥ鎸囧畾ip鏈夐摼璺暟闄愬埗
             socket = new Socket();
@@ -92,9 +94,13 @@
             dataOutputStream = new DataOutputStream(socket.getOutputStream());
             dataInputStream = new DataInputStream(socket.getInputStream());
 //            log.info("鏉$爜鎵弿浠繛鎺ユ垚鍔� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+            deviceErrorService.deleteDeviceError("scale", slave.getId());
         } catch (Exception e) {
             socket = null;
             log.error("纾呯Г杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+            deviceErrorService.addDeviceError("scale", slave.getId(), "纾呯Г杩炴帴澶辫触");
             return false;
         }
         return true;

--
Gitblit v1.9.1