From 1ef1063281497f32fcfa4f14b07d99399c0bb765 Mon Sep 17 00:00:00 2001
From: jinglun-cloud <jinglun2019@foxmail.com>
Date: 星期四, 07 五月 2026 15:04:17 +0800
Subject: [PATCH] refactor(设备运动): 重构条码设备运动逻辑,提取运动常量并优化代码结构

---
 src/main/java/com/zy/core/utils/station/StationDispatchRuntimeStateSupport.java |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/core/utils/station/StationDispatchRuntimeStateSupport.java b/src/main/java/com/zy/core/utils/station/StationDispatchRuntimeStateSupport.java
index 5356fd2..0f2f324 100644
--- a/src/main/java/com/zy/core/utils/station/StationDispatchRuntimeStateSupport.java
+++ b/src/main/java/com/zy/core/utils/station/StationDispatchRuntimeStateSupport.java
@@ -137,11 +137,19 @@
         return tryAcquireLock(RedisKeyType.STATION_OUT_ORDER_DISPATCH_LIMIT_.key + wrkNo + "_" + stationId, seconds);
     }
 
-    public boolean tryAcquireRunBlockDirectReassignLock(Integer wrkNo, Integer stationId, int seconds) {
+    public boolean hasRunBlockDirectReassignLimit(Integer wrkNo, Integer stationId) {
         if (wrkNo == null || wrkNo <= 0 || stationId == null) {
-            return true;
+            return false;
         }
-        return tryAcquireLock(RedisKeyType.STATION_RUN_BLOCK_DIRECT_REASSIGN_LIMIT_.key + wrkNo + "_" + stationId, seconds);
+        return redisUtil != null
+                && redisUtil.get(RedisKeyType.STATION_RUN_BLOCK_DIRECT_REASSIGN_LIMIT_.key + wrkNo + "_" + stationId) != null;
+    }
+
+    public void recordRunBlockDirectReassignLimit(Integer wrkNo, Integer stationId, int seconds) {
+        if (wrkNo == null || wrkNo <= 0 || stationId == null || redisUtil == null || seconds <= 0) {
+            return;
+        }
+        redisUtil.set(RedisKeyType.STATION_RUN_BLOCK_DIRECT_REASSIGN_LIMIT_.key + wrkNo + "_" + stationId, "lock", seconds);
     }
 
     public void signalSegmentReset(Integer taskNo, long waitMs) {

--
Gitblit v1.9.1