From ccbf73034e8a7c5867d3b58e115013527283ee76 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期五, 26 十二月 2025 15:35:19 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java |   68 +++++++++++++++++-----------------
 1 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java
index 8f6a78e..9142b9c 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java
@@ -13,6 +13,7 @@
 import com.zy.acs.manager.common.exception.BusinessException;
 import com.zy.acs.manager.core.service.*;
 import com.zy.acs.manager.core.service.astart.MapDataDispatcher;
+import com.zy.acs.manager.core.service.astart.domain.DynamicNode;
 import com.zy.acs.manager.manager.entity.*;
 import com.zy.acs.manager.manager.enums.*;
 import com.zy.acs.manager.manager.service.*;
@@ -72,6 +73,8 @@
     private AvoidWaveCalculator avoidWaveCalculator;
     @Autowired
     private PatrolService patrolService;
+    @Autowired
+    private StaReserveService staReserveService;
 
     @PreAuthorize("hasAuthority('manager:agv:update')")
     @OperationLog("Locate All Agv")
@@ -87,10 +90,27 @@
     @PostMapping("/patrol/batch/startup")
     public synchronized R patrolBatchStartup() {
         List<Agv> list = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val));
+        DynamicNode[][] dynamicMatrix = mapDataDispatcher.getDynamicMatrix(MapDataDispatcher.MAP_DEFAULT_LEV);
         int result = 0;
         for (Agv agv : list) {
-            patrolService.startupPatrol(agv.getUuid());
-            result++;
+            String agvNo = agv.getUuid();
+
+            boolean inMap = false;
+            label: for (int i = 0; i < dynamicMatrix.length; i++) {
+                for (int j = 0; j < dynamicMatrix[i].length; j++) {
+                    DynamicNode dynamicNode = dynamicMatrix[i][j];
+                    String vehicle = dynamicNode.getVehicle();
+                    if (agvNo.equals(vehicle)) {
+                        inMap = true;
+                        break label;
+                    }
+                }
+            }
+
+            if (inMap) {
+                patrolService.startupPatrol(agvNo);
+                result++;
+            }
         }
         return R.ok().add(result);
     }
@@ -173,7 +193,7 @@
                     oriLoc = locService.getById(param.getStartLocNo());
                 }
                 if (!Cools.isEmpty(param.getStartLocNoStr())) {
-                    oriLoc = locService.selecatByLocNo(param.getStartLocNoStr());
+                    oriLoc = locService.selectByLocNo(param.getStartLocNoStr());
                 }
                 if (null == oriLoc) {
                     return R.error();
@@ -192,7 +212,7 @@
                     destLoc = locService.getById(param.getEndLocNo());
                 }
                 if (!Cools.isEmpty(param.getEndLocNoStr())) {
-                    destLoc = locService.selecatByLocNo(param.getEndLocNoStr());
+                    destLoc = locService.selectByLocNo(param.getEndLocNoStr());
                 }
                 if (null == destLoc) {
                     return R.error();
@@ -220,7 +240,7 @@
                     oriLoc = locService.getById(param.getStartLocNo());
                 }
                 if (!Cools.isEmpty(param.getStartLocNoStr())) {
-                    oriLoc = locService.selecatByLocNo(param.getStartLocNoStr());
+                    oriLoc = locService.selectByLocNo(param.getStartLocNoStr());
                 }
                 if (null == oriLoc) {
                     return R.error();
@@ -244,13 +264,8 @@
                 if (null == destSta) {
                     return R.error();
                 }
-                if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
-                    throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 涓嶆槸鏃犺揣鐘舵��");
-                }
-                destSta.setStaSts(StaStsType.READY_RELEASE.val());
-                destSta.setUpdateTime(now);
-                if (!staService.updateById(destSta)) {
-                    throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 淇敼绔欑偣鐘舵�佸け璐�");
+                if (null == staReserveService.reserveStaIn(destSta, task, 1)) {
+                    throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 棰勭害澶辫触");
                 }
 
                 // task
@@ -272,13 +287,8 @@
                 if (null == oriSta) {
                     return R.error();
                 }
-                if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
-                    throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 涓嶆槸鏈夎揣鐘舵��");
-                }
-                oriSta.setStaSts(StaStsType.READY_TAKE.val());
-                oriSta.setUpdateTime(now);
-                if (!staService.updateById(oriSta)) {
-                    throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 淇敼绔欑偣鐘舵�佸け璐�");
+                if (null == staReserveService.reserveStaOut(oriSta, task, 1)) {
+                    throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 棰勭害澶辫触");
                 }
 
                 // destLoc
@@ -286,7 +296,7 @@
                     destLoc = locService.getById(param.getEndLocNo());
                 }
                 if (!Cools.isEmpty(param.getEndLocNoStr())) {
-                    destLoc = locService.selecatByLocNo(param.getEndLocNoStr());
+                    destLoc = locService.selectByLocNo(param.getEndLocNoStr());
                 }
                 if (null == destLoc) {
                     return R.error();
@@ -319,13 +329,8 @@
                 if (null == oriSta) {
                     return R.error();
                 }
-                if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
-                    throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 涓嶆槸鏈夎揣鐘舵��");
-                }
-                oriSta.setStaSts(StaStsType.READY_TAKE.val());
-                oriSta.setUpdateTime(now);
-                if (!staService.updateById(oriSta)) {
-                    throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 淇敼绔欑偣鐘舵�佸け璐�");
+                if (null == staReserveService.reserveStaOut(oriSta, task, 1)) {
+                    throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 棰勭害澶辫触");
                 }
 
                 // destSta
@@ -338,13 +343,8 @@
                 if (null == destSta) {
                     return R.error();
                 }
-                if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
-                    throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 涓嶆槸鏃犺揣鐘舵��");
-                }
-                destSta.setStaSts(StaStsType.READY_RELEASE.val());
-                destSta.setUpdateTime(now);
-                if (!staService.updateById(destSta)) {
-                    throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 淇敼绔欑偣鐘舵�佸け璐�");
+                if (null == staReserveService.reserveStaIn(destSta, task, 1)) {
+                    throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 棰勭害澶辫触");
                 }
 
                 // task

--
Gitblit v1.9.1