From 6166c4551aa61019413713e8f2ce1aa626dec971 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期二, 01 四月 2025 13:50:07 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java |  158 ++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 122 insertions(+), 36 deletions(-)

diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
index e49c524..99f715d 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -866,28 +866,11 @@
                         // 妫�楠屾柟鍚�
                         if (!lastDirection.equals(workDirection)) {
                             throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
-                            // turn
-//                            actionList.add(new Action(
-//                                    null,    // 缂栧彿
-//                                    task.getBusId(),    // 鎬荤嚎
-//                                    task.getId(),    // 浠诲姟
-//                                    null,    // 鍔ㄤ綔鍙�
-//                                    null,    // 浼樺厛绾�
-//                                    ActionTypeType.TurnCorner.desc,    // 鍚嶇О
-//                                    mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D,    // 灞炴�у��
-//                                    lastCode.getData(),    // 鍦伴潰鐮�
-//                                    String.valueOf(workDirection),   // 鍔ㄤ綔鍙傛暟
-//                                    ActionTypeType.TurnCorner.val(),    // 鍔ㄤ綔绫诲瀷
-//                                    actionPrepareSts,    // 鍔ㄤ綔杩涘害
-//                                    agvId,    // AGV
-//                                    now    // 宸ヤ綔鏃堕棿
-//                            ));
-//                            lastDirection = workDirection;
                         }
                         // 璐ф灦鍙栬揣
                         Loc oriLoc = locService.getById(task.getOriLoc());
                         // 璁$畻宸﹀彸鏂瑰悜
-                        agvDirectionType = mapService.calculateAgvWorkDirection(oriLoc, lastCode);
+                        agvDirectionType = mapService.calculateAgvWorkDirectionByShelf(oriLoc, lastCode);
                         actionList.add(new Action(
                                 null,    // 缂栧彿
                                 task.getBusId(),    // 鎬荤嚎
@@ -925,23 +908,6 @@
                         // 妫�楠屾柟鍚�
                         if (!lastDirection.equals(workDirection)) {
                             throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
-//                            // turn
-//                            actionList.add(new Action(
-//                                    null,    // 缂栧彿
-//                                    task.getBusId(),    // 鎬荤嚎
-//                                    task.getId(),    // 浠诲姟
-//                                    null,    // 鍔ㄤ綔鍙�
-//                                    null,    // 浼樺厛绾�
-//                                    ActionTypeType.TurnCorner.desc,    // 鍚嶇О
-//                                    mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D,    // 灞炴�у��
-//                                    lastCode.getData(),    // 鍦伴潰鐮�
-//                                    String.valueOf(workDirection),   // 鍔ㄤ綔鍙傛暟
-//                                    ActionTypeType.TurnCorner.val(),    // 鍔ㄤ綔绫诲瀷
-//                                    actionPrepareSts,    // 鍔ㄤ綔杩涘害
-//                                    agvId,    // AGV
-//                                    now    // 宸ヤ綔鏃堕棿
-//                            ));
-//                            lastDirection = workDirection;
                         }
                         // 鏆傚瓨鐐瑰彇璐ц揣
                         actionList.add(new Action(
@@ -963,7 +929,7 @@
                         // 璐ф灦鏀捐揣
                         Loc destLoc = locService.getById(task.getDestLoc());
                         // 璁$畻宸﹀彸鏂瑰悜
-                        agvDirectionType = mapService.calculateAgvWorkDirection(destLoc, lastCode);
+                        agvDirectionType = mapService.calculateAgvWorkDirectionByShelf(destLoc, lastCode);
                         actionList.add(new Action(
                                 null,    // 缂栧彿
                                 task.getBusId(),    // 鎬荤嚎
@@ -981,8 +947,128 @@
                         ));
                         break;
                     case ORI_STA:
+                        // 绔欑偣鍙栬揣
+                        Sta oriSta = staService.getById(task.getOriSta());
+                        Double oriStaWorkDirection = mapService.getStaAngle(oriSta, workDirection);
+                        // 妫�楠屾柟鍚�
+                        if (!lastDirection.equals(oriStaWorkDirection)) {
+                            if (!lastCode.getCornerBool()) {
+                                throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
+                            }
+                            // turn
+                            actionList.add(new Action(
+                                    null,    // 缂栧彿
+                                    task.getBusId(),    // 鎬荤嚎
+                                    task.getId(),    // 浠诲姟
+                                    null,    // 鍔ㄤ綔鍙�
+                                    null,    // 浼樺厛绾�
+                                    ActionTypeType.TurnCorner.desc,    // 鍚嶇О
+                                    mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D,    // 灞炴�у��
+                                    lastCode.getData(),    // 鍦伴潰鐮�
+                                    String.valueOf(oriStaWorkDirection),   // 鍔ㄤ綔鍙傛暟
+                                    ActionTypeType.TurnCorner.val(),    // 鍔ㄤ綔绫诲瀷
+                                    actionPrepareSts,    // 鍔ㄤ綔杩涘害
+                                    agvId,    // AGV
+                                    now    // 宸ヤ綔鏃堕棿
+                            ));
+                            lastDirection = oriStaWorkDirection;
+                        }
+                        // 璁$畻璐у弶宸ヤ綔鏂瑰悜
+                        agvDirectionType = mapService.calculateAgvWorkDirectionByStation(oriSta, lastCode);
+                        actionList.add(new Action(
+                                null,    // 缂栧彿
+                                task.getBusId(),    // 鎬荤嚎
+                                task.getId(),    // 浠诲姟
+                                null,    // 鍔ㄤ綔鍙�
+                                null,    // 浼樺厛绾�
+                                ActionTypeType.ReadyTakeFromShelvesLoc.desc,    // 鍚嶇О
+                                (double) agvDirectionType.val,    // 灞炴�у��
+                                lastCode.getData(),    // 鍦伴潰鐮�
+                                String.valueOf(oriSta.getOffset()),   // 鍔ㄤ綔鍙傛暟
+                                ActionTypeType.ReadyTakeFromShelvesLoc.val(),    // 鍔ㄤ綔绫诲瀷
+                                actionPrepareSts,    // 鍔ㄤ綔杩涘害
+                                agvId,    // AGV
+                                now    // 宸ヤ綔鏃堕棿
+                        ));
+                        // 鏆傚瓨鐐规斁璐�
+                        assert backpackType != null;
+                        actionList.add(new Action(
+                                null,    // 缂栧彿
+                                task.getBusId(),    // 鎬荤嚎
+                                task.getId(),    // 浠诲姟
+                                null,    // 鍔ㄤ綔鍙�
+                                null,    // 浼樺厛绾�
+                                ActionTypeType.ReadyReleaseToAgvSite.desc,    // 鍚嶇О
+                                (double) backpackType.lev,    // 灞炴�у��
+                                lastCode.getData(),    // 鍦伴潰鐮�
+                                String.valueOf(backpackType.height),   // 鍔ㄤ綔鍙傛暟
+                                ActionTypeType.ReadyReleaseToAgvSite.val(),    // 鍔ㄤ綔绫诲瀷
+                                actionPrepareSts,    // 鍔ㄤ綔杩涘害
+                                agvId,    // AGV
+                                now    // 宸ヤ綔鏃堕棿
+                        ));
                         break;
                     case DEST_STA:
+                        // 绔欑偣鏀捐揣
+                        Sta destSta = staService.getById(task.getDestSta());
+                        Double destStaWorkDirection = mapService.getStaAngle(destSta, workDirection);
+                        // 妫�楠屾柟鍚�
+                        if (!lastDirection.equals(destStaWorkDirection)) {
+                            if (!lastCode.getCornerBool()) {
+                                throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
+                            }
+                            // turn
+                            actionList.add(new Action(
+                                    null,    // 缂栧彿
+                                    task.getBusId(),    // 鎬荤嚎
+                                    task.getId(),    // 浠诲姟
+                                    null,    // 鍔ㄤ綔鍙�
+                                    null,    // 浼樺厛绾�
+                                    ActionTypeType.TurnCorner.desc,    // 鍚嶇О
+                                    mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D,    // 灞炴�у��
+                                    lastCode.getData(),    // 鍦伴潰鐮�
+                                    String.valueOf(destStaWorkDirection),   // 鍔ㄤ綔鍙傛暟
+                                    ActionTypeType.TurnCorner.val(),    // 鍔ㄤ綔绫诲瀷
+                                    actionPrepareSts,    // 鍔ㄤ綔杩涘害
+                                    agvId,    // AGV
+                                    now    // 宸ヤ綔鏃堕棿
+                            ));
+                            lastDirection = destStaWorkDirection;
+                        }
+                        // 鏆傚瓨鐐瑰彇璐�
+                        assert backpackType != null;
+                        actionList.add(new Action(
+                                null,    // 缂栧彿
+                                task.getBusId(),    // 鎬荤嚎
+                                task.getId(),    // 浠诲姟
+                                null,    // 鍔ㄤ綔鍙�
+                                null,    // 浼樺厛绾�
+                                ActionTypeType.ReadyTakeFromAgvSite.desc,    // 鍚嶇О
+                                (double) backpackType.lev,    // 灞炴�у��
+                                lastCode.getData(),    // 鍦伴潰鐮�
+                                String.valueOf(backpackType.height),   // 鍔ㄤ綔鍙傛暟
+                                ActionTypeType.ReadyTakeFromAgvSite.val(),    // 鍔ㄤ綔绫诲瀷
+                                actionPrepareSts,    // 鍔ㄤ綔杩涘害
+                                agvId,    // AGV
+                                now    // 宸ヤ綔鏃堕棿
+                        ));
+                        // 璁$畻璐у弶宸ヤ綔鏂瑰悜
+                        agvDirectionType = mapService.calculateAgvWorkDirectionByStation(destSta, lastCode);
+                        actionList.add(new Action(
+                                null,    // 缂栧彿
+                                task.getBusId(),    // 鎬荤嚎
+                                task.getId(),    // 浠诲姟
+                                null,    // 鍔ㄤ綔鍙�
+                                null,    // 浼樺厛绾�
+                                ActionTypeType.ReadyReleaseToShelvesLoc.desc,    // 鍚嶇О
+                                (double) agvDirectionType.val,    // 灞炴�у��
+                                lastCode.getData(),    // 鍦伴潰鐮�
+                                String.valueOf(destSta.getOffset()),   // 鍔ㄤ綔鍙傛暟
+                                ActionTypeType.ReadyReleaseToShelvesLoc.val(),    // 鍔ㄤ綔绫诲瀷
+                                actionPrepareSts,    // 鍔ㄤ綔杩涘害
+                                agvId,    // AGV
+                                now    // 宸ヤ綔鏃堕棿
+                        ));
                         break;
                     case TO_CHARGE:
                         // 妫�楠屾柟鍚�

--
Gitblit v1.9.1