From a68bf17ab81df98882e19b79628e6876bb260468 Mon Sep 17 00:00:00 2001
From: zc <zc@123>
Date: 星期三, 18 六月 2025 10:04:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/fyxc_shuttle_wcs' into fyxc_shuttle_wcs

---
 src/main/java/com/zy/core/action/ShuttleAction.java |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/zy/core/action/ShuttleAction.java b/src/main/java/com/zy/core/action/ShuttleAction.java
index 67e1a26..61ed0ff 100644
--- a/src/main/java/com/zy/core/action/ShuttleAction.java
+++ b/src/main/java/com/zy/core/action/ShuttleAction.java
@@ -28,6 +28,7 @@
 import com.zy.core.model.command.ShuttleRedisCommand;
 import com.zy.core.model.protocol.ShuttleProtocol;
 import com.zy.core.thread.ShuttleThread;
+import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -218,8 +219,14 @@
                 // 绯荤粺浠诲姟
                 if (assignCommand.getAuto()) {
                     if (!assignCommand.getCharge()) {
-                        //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
-                        shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
+                        if (command.getMode() == ShuttleCommandModeType.UPDATE_LOCATION.id) {
+                            //鏇存柊鍧愭爣浠诲姟鏃犻渶鎶涘嚭绛夊緟纭
+                            shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+                            shuttleThread.setSyncTaskNo(0);
+                        }else {
+                            //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
+                            shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
+                        }
                     }else {
                         shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING);
                     }
@@ -318,12 +325,29 @@
             return;
         }
 
-        String currentLocNo = shuttleProtocol.getCurrentLocNo();
-        int lev = Utils.getLev(currentLocNo);
+        boolean demoSwitchLev = false;
+        Config demoSwitchLevConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "demoSwitchLev"));
+        if (demoSwitchLevConfig != null) {
+            if (demoSwitchLevConfig.getValue().equals("Y")) {
+                demoSwitchLev = true;
+            }
+        }
+
+        Config demoRunLevConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "demoRunLev"));
+        if (demoRunLevConfig == null) {
+            return;
+        }
+        List<Integer> levList = JSON.parseArray(demoRunLevConfig.getValue(), Integer.class);
+
+        if (!demoSwitchLev) {
+            String currentLocNo = shuttleProtocol.getCurrentLocNo();
+            levList = new ArrayList<>();
+            levList.add(Utils.getLev(currentLocNo));
+        }
 
         LocMast targetLoc = null;
         EntityWrapper<LocMast> wrapper = new EntityWrapper<>();
-        wrapper.eq("lev1", lev);
+        wrapper.in("lev1", levList);
         wrapper.eq("loc_sts", "O");
         wrapper.last("ORDER BY RAND() LIMIT 1");
         for (int i = 0; i < 3; i++) {
@@ -340,6 +364,7 @@
             }
 
             targetLoc = locMast;
+            break;
         }
 
         if(targetLoc == null) {

--
Gitblit v1.9.1