From 63b01db83d9aad8a15276b4236a9a22e4aeef065 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 05 五月 2026 12:30:59 +0800
Subject: [PATCH] # Agent数据分析V3.0.1.7

---
 src/main/java/com/zy/core/plugin/store/StoreInTaskGenerationService.java |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/core/plugin/store/StoreInTaskGenerationService.java b/src/main/java/com/zy/core/plugin/store/StoreInTaskGenerationService.java
index ab90be5..5eb4023 100644
--- a/src/main/java/com/zy/core/plugin/store/StoreInTaskGenerationService.java
+++ b/src/main/java/com/zy/core/plugin/store/StoreInTaskGenerationService.java
@@ -33,6 +33,7 @@
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Service
@@ -69,7 +70,7 @@
             }
 
             StoreInTaskContext earlyContext = buildContext(basDevp, stationObjModel);
-            if (earlyContext == null || !handleErrorStationBack(earlyContext)) {
+            if (earlyContext == null || !handleErrorStationBack(policy, earlyContext)) {
                 return;
             }
 
@@ -188,7 +189,7 @@
         }
     }
 
-    private boolean handleErrorStationBack(StoreInTaskContext context) {
+    private boolean handleErrorStationBack(StoreInTaskPolicy policy, StoreInTaskContext context) {
         StationProtocol stationProtocol = context.getStationProtocol();
         if (stationProtocol == null) {
             return false;
@@ -255,6 +256,12 @@
             return false;
         }
         stationCommandDispatcher.dispatch(context.getBasDevp().getDevpNo(), command, "store-in-task", "station-back");
+        String errorMsg = Cools.isEmpty(stationProtocol.getErrorMsg()) ? "鏈煡寮傚父" : stationProtocol.getErrorMsg();
+        String warning = "鏉$爜绔欏紓甯搁��鍥烇紝鎶ヨ淇℃伅锛�" + errorMsg;
+        if (!Cools.isEmpty(stationProtocol.getSystemWarning())) {
+            warning = stationProtocol.getSystemWarning() + ";" + warning;
+        }
+        policy.setSystemWarning(context, warning);
         News.info("{}鎵爜绔欏紓甯革紝宸查��鍥炶嚦{},鏉$爜绔欑姸鎬侊細{}", stationProtocol.getTaskNo(),
                 backStation.getStationId(), JSON.toJSONString(stationProtocol));
         redisUtil.set(RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId(),
@@ -329,13 +336,13 @@
                 request.getBarcode(), request.getSourceStaNo(), result.getResponse(), result.getMessage());
         redisUtil.set(policy.getGenerateLockKey(context), "lock", policy.getRetryLockSeconds(context));
         policy.onApplyFailed(context, result);
-        triggerStationBackOnApplyFailed(context, request, result);
+        triggerStationBackOnApplyFailed(policy, context, request, result);
     }
 
     /**
      * WMS 鐢宠鍏ュ簱澶辫触鍚庯紝璐х墿浠嶅仠鐣欏湪鎵爜绔欙紝姝ゆ椂琛ュ彂閫�鍥炲埌鍏ュ簱绔欑殑杈撻�佸懡浠わ紝閬垮厤璐х墿闀挎湡婊炵暀銆�
      */
-    private void triggerStationBackOnApplyFailed(StoreInTaskContext context,
+    private void triggerStationBackOnApplyFailed(StoreInTaskPolicy policy, StoreInTaskContext context,
                                                  InTaskApplyRequest request,
                                                  InTaskApplyResult result) {
         if (context == null || context.getStationThread() == null || context.getStationObjModel() == null) {
@@ -406,6 +413,12 @@
         }
 
         redisUtil.set(lockKey, "lock", APPLY_FAIL_STATION_BACK_LOCK_SECONDS);
+        String currentWarning = stationProtocol.getSystemWarning();
+        String backWarning = "WMS鍏ュ簱澶辫触锛屽凡閫�鍥炲叆搴撶珯";
+        if (!Cools.isEmpty(currentWarning)) {
+            backWarning = currentWarning + ";" + backWarning;
+        }
+        policy.setSystemWarning(context, backWarning);
         News.warn("WMS鍏ュ簱澶辫触锛屽凡瑙﹀彂璐х墿閫�鍥炲叆搴撶珯銆俠arcode={}锛宻tationId={}锛宐ackStationId={}锛寃arning={}",
                 request == null ? null : request.getBarcode(),
                 currentStationId,

--
Gitblit v1.9.1