From b63790fa580ea78777f16bff6bc79373d675dd10 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 21 八月 2025 16:50:47 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/action/LiftAction.java |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/core/action/LiftAction.java b/src/main/java/com/zy/core/action/LiftAction.java
index 1c2f1c4..81a20b7 100644
--- a/src/main/java/com/zy/core/action/LiftAction.java
+++ b/src/main/java/com/zy/core/action/LiftAction.java
@@ -8,6 +8,7 @@
 import com.zy.common.utils.RedisUtil;
 import com.zy.core.News;
 import com.zy.core.cache.SlaveConnection;
+import com.zy.core.enums.LiftProtocolStatusType;
 import com.zy.core.enums.LiftTaskModeType;
 import com.zy.core.enums.RedisKeyType;
 import com.zy.core.enums.SlaveType;
@@ -121,6 +122,45 @@
             redisCommand.setCommandStep(commandStep);
             // 鏇存柊redis鏁版嵁
             redisUtil.set(RedisKeyType.LIFT_WORK_FLAG.key + taskNo, JSON.toJSONString(redisCommand));
+        }else {
+            if (!liftThread.isDeviceIdle()) {
+                return false;
+            }
+
+            LiftCommand lastCommand = commands.get(commandStep - 1);
+            if (lastCommand.getMode() == LiftTaskModeType.PICK_PUT.id) {
+                if (liftProtocol.getLev() == lastCommand.getPut()) {
+                    lastCommand.setComplete(true);
+                }
+            } else if (lastCommand.getMode() == LiftTaskModeType.SHUTTLE_SWITCH.id) {
+                if (liftProtocol.getLev() == lastCommand.getPut()) {
+                    lastCommand.setComplete(true);
+                }
+            } else if (lastCommand.getMode() == LiftTaskModeType.MOVE.id) {
+                if (liftProtocol.getLev() == lastCommand.getPut()) {
+                    lastCommand.setComplete(true);
+                }
+            }
+
+            //浠诲姟鏁版嵁淇濆瓨鍒皉edis
+            redisUtil.set(RedisKeyType.LIFT_WORK_FLAG.key + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+
+            if (!lastCommand.getComplete()) {
+                //涓婁竴鏉′换鍔℃湭瀹屾垚锛岀姝笅鍙戝懡浠�
+                return false;
+            }
+
+            //鍒ゆ柇鏄惁涓烘渶鍚庝竴鏉″懡浠や笖鍛戒护鎵ц瀹屾垚锛屾姏鍑虹瓑寰呯‘璁ょ姸鎬�
+            LiftCommand endCommand = commands.get(commands.size() - 1);
+            if (endCommand.getComplete()) {
+                //宸叉墽琛屽畬鎴�
+                //鍒犻櫎redis
+                redisUtil.del(RedisKeyType.LIFT_WORK_FLAG.key + redisCommand.getWrkNo());
+
+                //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
+                liftThread.setProtocolStatus(LiftProtocolStatusType.WAITING);
+                News.info("鎻愬崌鏈轰换鍔℃墽琛屼笅鍙戝畬鎴愭墽琛岀粨鏉燂紝鎻愬崌鏈哄彿={}锛屼换鍔℃暟鎹�={}", redisCommand.getLiftNo(), JSON.toJSON(redisCommand));
+            }
         }
 
         return true;

--
Gitblit v1.9.1