From 5da24caea93040d9f6b95c9b88d80a0f951a93ad Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期二, 06 一月 2026 08:42:31 +0800
Subject: [PATCH] 1

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java |   42 ++++++++++++++++++------------------------
 1 files changed, 18 insertions(+), 24 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 e15e2a2..2c07e57 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
@@ -799,8 +799,7 @@
                         // 绗竴姝ワ細濡傛灉涓嬩竴涓柟鍚戞濂芥槸浣滀笟鏂瑰悜鐨勭浉鍙嶆柟鍚戯紝鍒欓噸缃笅涓�涓柟鍚戜负浣滀笟鏂瑰悜锛屾爣璁� reverse = true
                         boolean reverse = false;
                         if (nextDirection.equals((workDirection + 180) % 360)) {
-                            if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
-                            // if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
+                            if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                 reverse = false;
                                 lastDirection = nextDirection;
                             } else {
@@ -827,8 +826,7 @@
                                     nextDirection = lastDirection;
                                     reverse = true;
                                 } else {
-                                    if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
-                                    // if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
+                                    if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                         // turn
                                         reverse = false;
                                         actionList.add(new Action(
@@ -854,9 +852,9 @@
                                                 180);
                                     } else {
                                         Double turnDirection = nextDirection;
-                                        if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
+                                        if (turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) {
                                             turnDirection = 180.0;
-                                            nextDirection = turnDirection;
+                                            reverse = false;
                                         }
                                         // turn
                                         actionList.add(new Action(
@@ -879,14 +877,13 @@
                                                 lastCode.getData(),
                                                 lastCode.getCornerBool(),
                                                 nextDirection,
-                                                lastDirection);
+                                                nextDirection);
                                     }
                                     lastDirection = nextDirection;
                                 }
                             } else {
                                 // if (isStation && lastCode.getData().equals("00000050")) {
-                                if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
-                                // if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && lastCode.getData().equals("00000080"))) {
+                                if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                     // turn
                                     reverse = false;
                                     actionList.add(new Action(
@@ -905,7 +902,6 @@
                                             now    // 宸ヤ綔鏃堕棿
                                     ));
 
-                                    reverse = false;
                                     log.info("3TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
                                             posType,
                                             lastCode.getData(),
@@ -975,21 +971,19 @@
                 if (first) {
                     if (Cools.isEmpty(actionList) || !actionList.get(0).getActionType().equals(ActionTypeType.TurnCorner.val())) {
                         Double turnDirection = workDirection;
-                        Code nextCode = codeService.getCacheByData(lastCode.getData());
-                        boolean reverse = true;
-//                        Double nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
-                        // if (isStation && turnCodes.contains(lastCode.getData())) {
-                        if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
-                        // if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(lastCode.getData()))) {
-                            turnDirection = workDirection + 180.0;
-                            reverse = false;
-                        }
-                        // run
-                        ActionTypeType actionType = ActionTypeType.StraightAheadTurnable;
-                        if (reverse) {
-                            actionType = ActionTypeType.StraightBackTurnable;
+                        Code nextCode = null;
+                        //娣诲姞鍒ゆ柇鏄惁瀛樺湪涓嬩竴涓湴鐮�
+                        int index = pathList.indexOf(lastCode.getData());
+                        if (index != -1 && index + 1 < pathList.size()) {
+                            String nextCodeData = pathList.get(index + 1);
+                            nextCode = codeService.getCacheByData(nextCodeData);
+                        } else {
+                            nextCode = codeService.getCacheByData(lastCode.getData());
                         }
 
+                        if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
+                            turnDirection = workDirection + 180.0;
+                        }
                         if (lastCode.getCornerBool()) {
                             // turn
                             actionList.add(new Action(
@@ -998,7 +992,7 @@
                                     task.getId(),    // 浠诲姟
                                     null,    // 鍔ㄤ綔鍙�
                                     null,    // 浼樺厛绾�
-                                    actionType.desc,    // 鍚嶇О
+                                    ActionTypeType.TurnCorner.desc,    // 鍚嶇О
                                     mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D,    // 灞炴�у��
                                     lastCode.getData(),    // 鍦伴潰鐮�
                                     String.valueOf(turnDirection),   // 鍔ㄤ綔鍙傛暟

--
Gitblit v1.9.1