From 43412c20ac444392471ea8ea8bc4a93af39efe87 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期一, 19 一月 2026 13:17:27 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 45 insertions(+), 6 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 389c575..4cedd28 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
@@ -75,6 +75,8 @@
     private PatrolService patrolService;
     @Autowired
     private StaReserveService staReserveService;
+    @Autowired
+    private AgvAreaDispatcher agvAreaDispatcher;
 
     @PreAuthorize("hasAuthority('manager:agv:update')")
     @OperationLog("Locate All Agv")
@@ -171,7 +173,7 @@
         task.setPriority(999);
         task.setIoTime(now);
         task.setStartTime(now);
-        task.setMemo("HANDLE");
+        task.setMemo("AUTO");
         if (!taskService.save(task)) {
             throw new BusinessException(task.getSeqNum() + "浠诲姟淇濆瓨澶辫触");
         }
@@ -192,6 +194,9 @@
                 }
                 if (null == endCode) {
                     return R.error();
+                }
+                if (!agvAreaDispatcher.match(agv.getId(), endCode.getId())) {
+                    throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + endCode.getData());
                 }
                 if (!taskService.removeById(task.getId())) {
                     throw new BusinessException("failed to remove task");
@@ -222,6 +227,10 @@
                 if (null == oriLoc) {
                     return R.error();
                 }
+                if (!agvAreaDispatcher.match(agv.getId(), oriLoc.getCode())) {
+//                    throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$());
+                    throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈捐捣濮嬪簱浣嶃��" + oriLoc.getLocNo() + "銆�");
+                }
                 if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                     throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 涓嶆槸鍦ㄥ簱鐘舵��");
                 }
@@ -240,6 +249,10 @@
                 }
                 if (null == destLoc) {
                     return R.error();
+                }
+                if (!agvAreaDispatcher.match(agv.getId(), destLoc.getCode())) {
+//                    throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$());
+                    throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈剧洰鏍囧簱浣嶃��" + destLoc.getLocNo() + "銆�");
                 }
                 if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                     throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 涓嶆槸绌洪棽鐘舵��");
@@ -267,6 +280,10 @@
                 if (null == oriLoc) {
                     return R.error();
                 }
+                if (!agvAreaDispatcher.match(agv.getId(), oriLoc.getCode())) {
+//                    throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$());
+                    throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈捐捣濮嬪簱浣嶃��" + oriLoc.getLocNo() + "銆�");
+                }
                 if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                     throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 涓嶆槸鍦ㄥ簱鐘舵��");
                 }
@@ -286,16 +303,20 @@
                 if (null == destSta) {
                     return R.error();
                 }
+                if (!agvAreaDispatcher.match(agv.getId(), destSta.getCode())) {
+//                    throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destSta.getCode$());
+                    throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈剧洰鏍囩珯鐐广��" + destSta.getStaNo() + "銆�");
+                }
                 if (null == staReserveService.reserveStaIn(destSta, task, 1)) {
                     throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 棰勭害澶辫触");
                 }
-                staReserveService.allocateCallBack(task, agv.getId());
-
                 // task
                 task.setOriLoc(oriLoc.getId());
                 task.setOriCode(oriLoc.getCode());
                 task.setDestSta(destSta.getId());
                 task.setDestCode(destSta.getCode());
+
+                staReserveService.allocateCallBack(task, agv.getId());
                 break;
             case STA_TO_LOC:
                 // oriSta
@@ -308,10 +329,13 @@
                 if (null == oriSta) {
                     return R.error();
                 }
+                if (!agvAreaDispatcher.match(agv.getId(), oriSta.getCode())) {
+//                    throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriSta.getCode$());
+                    throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈捐捣濮嬬珯鐐广��" + oriSta.getStaNo() + "銆�");
+                }
                 if (null == staReserveService.reserveStaOut(oriSta, task, 1)) {
                     throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 棰勭害澶辫触");
                 }
-                staReserveService.allocateCallBack(task, agv.getId());
 
                 // destLoc
                 if (!Cools.isEmpty(param.getEndLocNo())) {
@@ -322,6 +346,10 @@
                 }
                 if (null == destLoc) {
                     return R.error();
+                }
+                if (!agvAreaDispatcher.match(agv.getId(), destLoc.getCode())) {
+//                    throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$());
+                    throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈剧洰鏍囧簱浣嶃��" + destLoc.getLocNo() + "銆�");
                 }
                 if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                     throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 涓嶆槸绌洪棽鐘舵��");
@@ -337,6 +365,8 @@
                 task.setOriCode(oriSta.getCode());
                 task.setDestLoc(destLoc.getId());
                 task.setDestCode(destLoc.getCode());
+
+                staReserveService.allocateCallBack(task, agv.getId());
                 break;
             case STA_TO_STA:
                 // oriSta
@@ -349,10 +379,14 @@
                 if (null == oriSta) {
                     return R.error();
                 }
+                if (!agvAreaDispatcher.match(agv.getId(), oriSta.getCode())) {
+//                    throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriSta.getCode$());
+                    throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈捐捣濮嬬珯鐐广��" + oriSta.getStaNo() + "銆�");
+                }
                 if (null == staReserveService.reserveStaOut(oriSta, task, 1)) {
                     throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 棰勭害澶辫触");
                 }
-                staReserveService.allocateCallBack(task, agv.getId());
+
 
                 // destSta
                 if (!Cools.isEmpty(param.getEndStaNo())) {
@@ -364,16 +398,21 @@
                 if (null == destSta) {
                     return R.error();
                 }
+                if (!agvAreaDispatcher.match(agv.getId(), destSta.getCode())) {
+//                    throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destSta.getCode$());
+                    throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈剧洰鏍囩珯鐐广��" + destSta.getStaNo() + "銆�");
+                }
                 if (null == staReserveService.reserveStaIn(destSta, task, 1)) {
                     throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 棰勭害澶辫触");
                 }
-                staReserveService.allocateCallBack(task, agv.getId());
 
                 // task
                 task.setOriSta(oriSta.getId());
                 task.setOriCode(oriSta.getCode());
                 task.setDestSta(destSta.getId());
                 task.setDestCode(destSta.getCode());
+
+                staReserveService.allocateCallBack(task, agv.getId());
                 break;
             default:
                 break;

--
Gitblit v1.9.1