From e9152bae00b01fc80000d44f726f337084215748 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 21 五月 2025 10:19:18 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/LedThread.java |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/LedThread.java b/src/main/java/com/zy/core/thread/LedThread.java
index acd6f89..6afc79f 100644
--- a/src/main/java/com/zy/core/thread/LedThread.java
+++ b/src/main/java/com/zy/core/thread/LedThread.java
@@ -1,15 +1,14 @@
 package com.zy.core.thread;
 
-import com.alibaba.fastjson.JSON;
-import com.core.common.Cools;
 import com.core.common.SpringUtils;
 import com.zy.asrs.entity.CommandInfo;
 import com.zy.asrs.service.CommandInfoService;
-import com.zy.common.entity.Parameter;
+import com.zy.asrs.service.DeviceErrorService;
 import com.zy.common.model.MatDto;
 import com.zy.core.Slave;
 import com.zy.core.ThreadHandler;
 import com.zy.core.cache.MessageQueue;
+import com.zy.core.enums.CommandStatusType;
 import com.zy.core.enums.SlaveType;
 import com.zy.core.model.Task;
 import com.zy.core.model.command.LedCommand;
@@ -26,7 +25,6 @@
 import onbon.bx05.utils.DisplayStyleFactory;
 
 import java.awt.*;
-import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -116,14 +114,11 @@
             }
             page.newLine("\n");
 
+            //鏇存柊鎸囦护鐘舵��
             CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class);
-            CommandInfo commandInfo = new CommandInfo();
-            commandInfo.setWrkNo(command.getWorkNo());
-            commandInfo.setCommandStatus(1);
-            commandInfo.setStartTime(new Date());
-            commandInfo.setDevice("led");
-            commandInfo.setCommand(JSON.toJSONString(command));
-            commandInfoService.insert(commandInfo);
+            CommandInfo commandInfo = command.getCommandInfo();
+            commandInfo.setCommandStatus(CommandStatusType.COMPLETE.id);
+            commandInfoService.updateById(commandInfo);
         }
 
         // 璁剧疆瀛椾綋
@@ -203,10 +198,13 @@
             screen.turnOn();
         } catch (Exception ignore) {
         }
+        DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
         if (connRes) {
             log.info("led杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+            deviceErrorService.deleteDeviceError("led", slave.getId());
         } else {
             log.error("led杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+            deviceErrorService.addDeviceError("led", slave.getId(), "led杩炴帴澶辫触");
         }
         return connRes;
     }

--
Gitblit v1.9.1