From 03c3ae747f82ad22c761c79e7b1c0e0031c57d41 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 06 四月 2026 20:28:35 +0800
Subject: [PATCH] #出库站点命令下发

---
 src/main/java/com/zy/core/plugin/GslProcess.java |   64 ++++++++++++++++----------------
 1 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/main/java/com/zy/core/plugin/GslProcess.java b/src/main/java/com/zy/core/plugin/GslProcess.java
index ba7b541..609da19 100644
--- a/src/main/java/com/zy/core/plugin/GslProcess.java
+++ b/src/main/java/com/zy/core/plugin/GslProcess.java
@@ -86,38 +86,6 @@
     }
 
     @Override
-    public boolean matchCandidate(StoreInTaskContext context) {
-        return canRequestStoreIn(context.getStationProtocol());
-    }
-
-    @Override
-    public boolean beforeApply(StoreInTaskContext context) {
-        StationProtocol stationProtocol = context.getStationProtocol();
-        if (stationProtocol.getError() <= 0) {
-            return true;
-        }
-
-        Object lock = redisUtil.get(RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId());
-        if (lock != null) {
-            return false;
-        }
-
-        StationObjModel backStation = context.getStationObjModel().getBackStation();
-        StationCommand command = context.getStationThread().getCommand(StationCommandType.MOVE,
-                commonService.getWorkNo(WrkIoType.STATION_BACK.id),
-                context.getStationObjModel().getStationId(),
-                backStation.getStationId(), 0);
-        if (command == null) {
-            News.taskInfo(stationProtocol.getTaskNo(), "{}宸ヤ綔,鑾峰彇杈撻�佺嚎鍛戒护澶辫触", stationProtocol.getTaskNo());
-            return false;
-        }
-        stationCommandDispatcher.dispatch(context.getBasDevp().getDevpNo(), command, "gsl-process", "station-back");
-        News.taskInfo(stationProtocol.getTaskNo(), "{}鎵爜寮傚父锛屽凡閫�鍥炶嚦{}", backStation.getStationId());
-        redisUtil.set(RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId(), "lock", 10);
-        return true;
-    }
-
-    @Override
     public InTaskApplyRequest buildApplyRequest(StoreInTaskContext context) {
         InTaskApplyRequest request = StoreInTaskPolicy.super.buildApplyRequest(context);
         request.getExtraParams().put("weight", context.getStationProtocol().getWeight());
@@ -192,6 +160,9 @@
                 if (!stationMap.containsKey(stationId)) {
                     continue;
                 }
+                if (!handleErrorStationBack(basDevp, stationThread, stationObjModel, stationMap.get(stationId))) {
+                    continue;
+                }
                 if (!canRequestStoreIn(stationMap.get(stationId))) {
                     continue;
                 }
@@ -203,6 +174,7 @@
 
     private boolean canRequestStoreIn(StationProtocol stationProtocol) {
         return stationProtocol != null
+                && stationProtocol.getError() <= 0
                 && stationProtocol.isAutoing()
                 && stationProtocol.isLoading()
                 && stationProtocol.isInEnable()
@@ -210,4 +182,32 @@
                 && !Cools.isEmpty(stationProtocol.getBarcode());
     }
 
+    private boolean handleErrorStationBack(BasDevp basDevp,
+                                           StationThread stationThread,
+                                           StationObjModel stationObjModel,
+                                           StationProtocol stationProtocol) {
+        if (stationProtocol.getError() <= 0) {
+            return true;
+        }
+
+        Object lock = redisUtil.get(RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId());
+        if (lock != null) {
+            return false;
+        }
+
+        StationObjModel backStation = stationObjModel.getBackStation();
+        StationCommand command = stationThread.getCommand(StationCommandType.MOVE,
+                commonService.getWorkNo(WrkIoType.STATION_BACK.id),
+                stationObjModel.getStationId(),
+                backStation.getStationId(), 0);
+        if (command == null) {
+            News.taskInfo(stationProtocol.getTaskNo(), "{}宸ヤ綔,鑾峰彇杈撻�佺嚎鍛戒护澶辫触", stationProtocol.getTaskNo());
+            return false;
+        }
+        stationCommandDispatcher.dispatch(basDevp.getDevpNo(), command, "gsl-process", "station-back");
+        News.taskInfo(stationProtocol.getTaskNo(), "{}鎵爜寮傚父锛屽凡閫�鍥炶嚦{}", backStation.getStationId());
+        redisUtil.set(RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId(), "lock", 10);
+        return false;
+    }
+
 }

--
Gitblit v1.9.1