From dcdfc93b50febf61301832d91dfcddcfa1ca5403 Mon Sep 17 00:00:00 2001 From: 1 <1@123> Date: 星期三, 14 五月 2025 14:06:36 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/LedThread.java | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 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..eb46bc6 100644 --- a/src/main/java/com/zy/core/thread/LedThread.java +++ b/src/main/java/com/zy/core/thread/LedThread.java @@ -5,11 +5,13 @@ import com.core.common.SpringUtils; import com.zy.asrs.entity.CommandInfo; import com.zy.asrs.service.CommandInfoService; +import com.zy.asrs.service.DeviceErrorService; import com.zy.common.entity.Parameter; 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; @@ -110,20 +112,17 @@ if(idx >= 0){ strQty.substring(0,idx); } - page.newLine(matDto.getMaknx() + "[鏁伴噺" + strQty +"]"); + page.newLine(matDto.getMaktx() + "[鏁伴噺" + strQty +"]"); // page.newLine(matDto.getMaknx() + "銆愭暟閲�" + matDto.getCount() +"銆�"); } } 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,11 +202,19 @@ screen.turnOn(); } catch (Exception ignore) { } - if (connRes) { - log.info("led杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); - } else { - log.error("led杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); + try{ + 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杩炴帴澶辫触"); + } + } catch (Exception e){ + log.error("e:"+e.getMessage()); } + return connRes; } -- Gitblit v1.9.1