From eb4ea056ddd2502fdb6f49a2ad0a01836b7e71fa Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 17 十月 2024 14:40:14 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java
index 0c2e1c6..7e5b117 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java
@@ -22,6 +22,7 @@
 import com.zy.asrs.wcs.rcs.cache.OutputQueue;
 import com.zy.asrs.wcs.rcs.entity.Device;
 import com.zy.asrs.wcs.rcs.entity.DeviceDataLog;
+import com.zy.asrs.wcs.rcs.model.CommandResponse;
 import com.zy.asrs.wcs.rcs.model.enums.LiftProtocolStatusType;
 import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol;
 import com.zy.asrs.wcs.rcs.service.DeviceDataLogService;
@@ -252,19 +253,21 @@
     }
 
     @Override
-    public boolean move(LiftCommand command) {
+    public CommandResponse move(LiftCommand command) {
         return write(command);
     }
 
     @Override
-    public boolean palletInOut(LiftCommand command) {
+    public CommandResponse palletInOut(LiftCommand command) {
         return write(command);
     }
 
-    private boolean write(LiftCommand command) {
+    private CommandResponse write(LiftCommand command) {
+        CommandResponse response = new CommandResponse(false);
         if (null == command) {
             News.error("鎻愬崌鏈哄啓鍏ュ懡浠や负绌�");
-            return false;
+            response.setMessage("鎻愬崌鏈哄啓鍏ュ懡浠や负绌�");
+            return response;
         }
 
         List<Short> shorts = JSON.parseArray(command.getBody(), Short.class);
@@ -278,27 +281,30 @@
             liftProtocol.setSendTime(System.currentTimeMillis());//鎸囦护涓嬪彂鏃堕棿
             News.info("鎻愬崌鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", device.getId(), JSON.toJSON(command));
             OutputQueue.LIFT.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), device.getId(), JSON.toJSON(command)));
-            return true;
+            response.setMessage(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), device.getId(), JSON.toJSON(command)));
+            response.setResult(true);
+            return response;
         } else {
             OutputQueue.LIFT.offer(MessageFormat.format("銆恵0}銆戝啓鍏ユ彁鍗囨満plc鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}],娆℃暟锛歿}", DateUtils.convert(new Date()), device.getId(), device.getIp(), device.getPort()));
             News.error("鍐欏叆鎻愬崌鏈簆lc鏁版嵁澶辫触 ===>> [id:{}] [ip:{}] [port:{}]", device.getId(), device.getIp(), device.getPort());
-            return false;
+            response.setMessage(MessageFormat.format("銆恵0}銆戝啓鍏ユ彁鍗囨満plc鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}],娆℃暟锛歿}", DateUtils.convert(new Date()), device.getId(), device.getIp(), device.getPort()));
+            return response;
         }
     }
 
     @Override
-    public boolean lock(LiftCommand command) {
-        return true;
+    public CommandResponse lock(LiftCommand command) {
+        return new CommandResponse(true);
     }
 
     @Override
-    public boolean unlock(LiftCommand command) {
-        return true;
+    public CommandResponse unlock(LiftCommand command) {
+        return new CommandResponse(true);
     }
 
     @Override
-    public boolean reset(LiftCommand command) {
-        return false;
+    public CommandResponse reset(LiftCommand command) {
+        return new CommandResponse(false);
     }
 
     @Override

--
Gitblit v1.9.1