From 71e1b54b35f36624dd21d40bed975811668cae09 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期五, 17 十月 2025 16:45:00 +0800
Subject: [PATCH] 1

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 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 1ea8950..661a69c 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
@@ -1131,7 +1131,7 @@
                         // 妫�楠屾柟鍚�
                         FuncSta chargeFuncSta = funcStaService.query(lastCode.getId(), FuncStaType.CHARGE.toString());
                         Double chargeDirection = Double.parseDouble(chargeFuncSta.getAngle());
-                        if (!lastDirection.equals(chargeDirection)) {
+                        if (!lastDirection.equals(chargeDirection)&&lastCode.getCornerBool()) {
                             actionList.add(new Action(
                                     null,    // 缂栧彿
                                     null,    // 鎬荤嚎
@@ -1288,7 +1288,6 @@
     }
 
 
-
     /**
      * 鏍规嵁鍒嗙墖鐢熸垚鍔ㄤ綔 ( 杞﹁締鍙兘宸茬粡鍋氳繃涓�浜涗换鍔′簡,姝e湪绛夊緟涓嬩竴娈典换鍔� )
      */
@@ -1322,11 +1321,14 @@
                 throw new CoolException("AGV[" + agvNo + "]瀹氫綅鍋忕Щ...");
             }
 
-            String lastCorner = null;
-            for (int i =  pathList.size(); i <0; i++) {
-                Code nextCode = codeService.getCacheByData(pathList.get(i - 1));
-                if (nextCode!=null&&nextCode.getCornerBool()){
-                    lastCorner =pathList.get(i - 1);
+            //String lastCorner = null;
+            Integer index = -1;
+            boolean corner = false;
+            for (int i = pathList.size(); i < 0; i++) {
+                Code nextCode = codeService.getCacheByData(pathList.get(i));
+                if (nextCode != null && nextCode.getCornerBool()) {
+                    //lastCorner = pathList.get(i);
+                    index = i;
                 }
             }
 
@@ -1350,19 +1352,21 @@
                         if (i == 0) {
                             continue;
                         }
-
                         String next = pathListPart.get(i);
-
                         Code nextCode = codeService.getCacheByData(next);
-                        Double nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
+                        Double nextDirection;
 
                         boolean reverse = false;
-                        if (lastCorner.equals(lastCode)){
-                            // DOTO
+                        if (index >= i) {
+                            // DOTO 娣诲姞杞集
+                            Code endCode = codeService.getCacheByData(pathList.get(pathList.size() - 1));
+                            nextDirection = mapService.calculateDirection(lastCode, endCode, angleOffsetVal);
+                            reverse = true;
+                        } else {
+                            nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
 
-                        }else {
                             // 绗竴姝ワ細濡傛灉涓嬩竴涓柟鍚戞濂芥槸浣滀笟鏂瑰悜鐨勭浉鍙嶆柟鍚戯紝鍒欓噸缃笅涓�涓柟鍚戜负浣滀笟鏂瑰悜锛屾爣璁� reverse = true
-                            if (nextDirection.equals((workDirection + 180) % 360)) {
+                            if (!nextDirection.equals((workDirection+180) % 360)) {
                                 nextDirection = workDirection;
                                 reverse = true;
                             }
@@ -1708,7 +1712,7 @@
                         // 妫�楠屾柟鍚�
                         FuncSta chargeFuncSta = funcStaService.query(lastCode.getId(), FuncStaType.CHARGE.toString());
                         Double chargeDirection = Double.parseDouble(chargeFuncSta.getAngle());
-                        if (!lastDirection.equals(chargeDirection)) {
+                        if (!lastDirection.equals(chargeDirection) && lastCode.getCornerBool()) {
                             actionList.add(new Action(
                                     null,    // 缂栧彿
                                     null,    // 鎬荤嚎
@@ -1851,7 +1855,7 @@
 
             log.info("{}鍙稟gv鍔ㄤ綔缁勮瀹屾垚锛屾寚浠ゆ暟閲忥細{}", agvNo, newActionList.size());
         } catch (Exception e) {
-            log.error("mainService.generateAction", e);
+            log.error("mainService.generateActionV2", e);
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 
             if (!Cools.isEmpty(pathList)) {
@@ -1860,7 +1864,7 @@
                 mapDataDispatcher.clearDynamicMatrixByCodeList(null, codeMatrixIdxList);
             }
 
-            throw new RuntimeException("generateAction method caught an exception, rolling back transaction.", e);
+            throw new RuntimeException("generateActionV2 method caught an exception, rolling back transaction.", e);
         }
     }
 

--
Gitblit v1.9.1