From 1d520bffcd63cb8389c9cdf719c3cf7e7c4af567 Mon Sep 17 00:00:00 2001
From: jianghaiyue <jianghaiyue@zkyt.com>
Date: 星期四, 30 十月 2025 10:20:28 +0800
Subject: [PATCH] 优化更新
---
algo-zkd/src/main/java/com/algo/service/RemainingPathProcessor.java | 37 ++++++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/algo-zkd/src/main/java/com/algo/service/RemainingPathProcessor.java b/algo-zkd/src/main/java/com/algo/service/RemainingPathProcessor.java
index 0c411d6..273244d 100644
--- a/algo-zkd/src/main/java/com/algo/service/RemainingPathProcessor.java
+++ b/algo-zkd/src/main/java/com/algo/service/RemainingPathProcessor.java
@@ -193,8 +193,16 @@
String currentDirection = currentCode.getDirection();
String nextDirection = nextCode.getDirection();
- if (!currentDirection.equals(nextDirection)) {
- stayTime += config.getTurnTime(currentDirection, nextDirection);
+ if (currentDirection != null && nextDirection != null) {
+ if (!currentDirection.equals(nextDirection)) {
+ stayTime += config.getTurnTime(currentDirection, nextDirection);
+ }
+ } else {
+ if (pathIndex == agv.getCurrentPathIndex()) {
+ System.out.println("AGV " + agv.getAgvId() +
+ " 鐨勫墿浣欒矾寰勪腑direction瀛楁涓簄ull");
+ }
+ stayTime += 0.5;
}
}
@@ -208,7 +216,7 @@
stayTime += 2.0; // 鏀捐揣闇�瑕�2绉�
break;
case "3": // 鍏呯數
- stayTime += 10.0; // 鍏呯數鍋滈潬闇�瑕�10绉�
+ stayTime += 100.0; // 鍏呯數鍋滈潬
break;
default:
stayTime += 1.0; // 鍏朵粬鍔ㄤ綔闇�瑕�1绉�
@@ -402,11 +410,26 @@
connectedPath.setAgvId(agv.getAgvId());
connectedPath.setCodeList(remainingCodes);
- // 鐢熸垚鏂扮殑娈佃惤ID
- String segId = agv.getAgvId() + "_CONNECTED_" + System.currentTimeMillis();
- if (newPath != null && newPath.getSegId() != null) {
- segId = newPath.getSegId() + "_EXTENDED";
+ // 浣跨敤鍓╀綑璺緞鐨勫師濮媠egId
+ String segId = remainingPath.getSegId();
+
+ if (segId != null && !segId.trim().isEmpty()) {
+ // 濡傛灉鏈夋柊璺緞杩炴帴锛屽湪鍘焥egId鍩虹涓婃坊鍔犳墿灞曟爣璁�
+ if (newPath != null && newPath.getCodeList() != null && !newPath.getCodeList().isEmpty()) {
+ // 妫�鏌ユ槸鍚﹀凡缁忔湁鎵╁睍鏍囪锛岄伩鍏嶉噸澶嶆坊鍔�
+ if (!segId.endsWith("_EXTENDED")) {
+ segId = segId + "_EXTENDED";
+ }
+ }
+ } else {
+ // 濡傛灉鍘熷璺緞娌℃湁segId锛屾牴鎹儏鍐电敓鎴�
+ if (newPath != null && newPath.getSegId() != null && !newPath.getSegId().trim().isEmpty()) {
+ segId = newPath.getSegId() + "_EXTENDED";
+ } else {
+ segId = agv.getAgvId() + "_CONNECTED_" + System.currentTimeMillis();
+ }
}
+
connectedPath.setSegId(segId);
return connectedPath;
--
Gitblit v1.9.1