From 766d5e2f27f90e096b4ce5ecfe28878b774efb10 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期一, 12 一月 2026 16:37:56 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 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 dbcc983..42b4ba1 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
@@ -945,10 +945,13 @@
String next = pathListPart.get(i);
Code nextCode = codeService.getCacheByData(next);
+ // 杞﹀ご鏈濆墠鐨勪笅涓�涓璧版柟鍚�
Double nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
// 鍙嶅悜瑙�
final double oppLastDir = (lastDirection + 180) % 360;
+ // 鏄惁鍊掗��琛岃蛋
+ boolean reverse = false;
// 宸烽亾閫昏緫
if (!laneBuilder.isInitialized()) {
@@ -957,21 +960,16 @@
LaneDto lastLaneDto = laneBuilder.search(lastCode.getData());
LaneDto nextLaneDto = laneBuilder.search(nextCode.getData());
// 杩涘叆宸烽亾瑙掑害
- Double laneDir = laneService.getLaneDirection(nextLaneDto);
- // 绗竴娆¤繘鍏ユ宸烽亾
- boolean firstEnteringLane = null != laneDir && (
- lastLaneDto == null
- || !Objects.equals(lastLaneDto.getHashCode(), nextLaneDto.getHashCode())
- );
-
- boolean reverse = false;
+ Double lastLaneDir = laneService.getLaneDirection(lastLaneDto);
+ Double nextLaneDir = laneService.getLaneDirection(nextLaneDto);
// 宸烽亾寮哄埗杞集锛屼紭鍏堢骇 > workDirection
- if (firstEnteringLane) {
-// final double oppLaneDir = (laneDir + 180) % 360;
- if (!lastDirection.equals(laneDir)) {
+ if (null != nextLaneDir) {
+ nextDirection = nextLaneDir;
+
+ if (!lastDirection.equals(nextDirection)) {
if (!lastCode.getCornerBool()) {
- throw new CoolException(agvNo + "鍙峰皬杞﹁繘鍏ュ贩閬撻渶璋冩暣鏂瑰悜涓� " + laneDir + "掳锛岃鎺ㄨ嚦杞集鐐规墜鍔ㄨ皟鏁�");
+ throw new CoolException(agvNo + "鍙峰皬杞﹁繘鍏ュ贩閬撻渶璋冩暣鏂瑰悜涓� " + nextDirection + "掳锛岃鎺ㄨ嚦杞集鐐规墜鍔ㄨ皟鏁�");
}
// turn
actionList.add(new Action(
@@ -983,13 +981,21 @@
ActionTypeType.TurnCorner.desc, // 鍚嶇О
(double) mapService.spinDirection(lastCode).val, // 灞炴�у��
lastCode.getData(), // 鍦伴潰鐮�
- String.valueOf(laneDir), // 鍔ㄤ綔鍙傛暟
+ String.valueOf(nextDirection), // 鍔ㄤ綔鍙傛暟
ActionTypeType.TurnCorner.val(), // 鍔ㄤ綔绫诲瀷
actionPrepareSts, // 鍔ㄤ綔杩涘害
agvId, // AGV
now // 宸ヤ綔鏃堕棿
));
- lastDirection = laneDir;
+ lastDirection = nextDirection;
+ }
+ } else if (null != lastLaneDir) {
+ nextDirection = lastLaneDir;
+
+ if (!lastDirection.equals(nextDirection)) {
+ if (!lastCode.getCornerBool()) {
+ throw new CoolException(agvNo + "鍙峰皬杞︾寮�宸烽亾闇�璋冩暣鏂瑰悜涓� " + nextDirection + "掳锛岃鎺ㄨ嚦杞集鐐规墜鍔ㄨ皟鏁�");
+ }
}
} else {
--
Gitblit v1.9.1