From c34f9c17fde14f78b3663803e9776d438e8481b9 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 21 三月 2026 22:30:14 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java | 40 ++++++++++++++++++++++++----------------
1 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
index 5fcdbb4..040a5c6 100644
--- a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
+++ b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -834,7 +834,7 @@
Integer circleTarget = resolveNextCircleOrderTarget(
currentStationId,
outOrderStationIds,
- loopEvaluation.isLargeLoopTriggered()
+ loopEvaluation.getExpectedLoopIssueCount()
);
if (circleTarget == null) {
News.taskInfo(wrkMast.getWrkNo(), "鐩爣绔欏綋鍓嶄笉鍙繘锛屼笖鏈壘鍒板彲鎵ц鐨勪笅涓�鎺掑簭妫�娴嬬偣锛屽綋鍓嶇珯鐐�={}", currentStationId);
@@ -851,7 +851,7 @@
Integer circleTarget = resolveNextCircleOrderTarget(
currentStationId,
outOrderStationIds,
- loopEvaluation.isLargeLoopTriggered()
+ loopEvaluation.getExpectedLoopIssueCount()
);
if (circleTarget == null) {
News.taskInfo(wrkMast.getWrkNo(), "鏈壘鍒板彲鎵ц鐨勪笅涓�鎺掑簭妫�娴嬬偣锛屽綋鍓嶇珯鐐�={}", currentStationId);
@@ -1018,16 +1018,14 @@
private Integer resolveNextCircleOrderTarget(Integer currentStationId,
List<Integer> orderedOutStationList,
- boolean preferLargeCircle) {
+ Integer expectedLoopIssueCount) {
if (currentStationId == null || orderedOutStationList == null || orderedOutStationList.size() <= 1) {
return null;
}
int startIndex = orderedOutStationList.indexOf(currentStationId);
int total = orderedOutStationList.size();
- Integer bestStationId = null;
- int bestPathLength = -1;
- int bestOffset = -1;
+ List<Integer> reachableStationIdList = new ArrayList<>();
for (int offset = 1; offset < total; offset++) {
int candidateIndex = (startIndex + offset + total) % total;
Integer candidateStationId = orderedOutStationList.get(candidateIndex);
@@ -1037,19 +1035,29 @@
try {
List<NavigateNode> path = navigateUtils.calcByStationId(currentStationId, candidateStationId);
if (path != null && !path.isEmpty()) {
- if (!preferLargeCircle) {
- return candidateStationId;
- }
- int pathLength = path.size();
- if (pathLength > bestPathLength || (pathLength == bestPathLength && offset > bestOffset)) {
- bestStationId = candidateStationId;
- bestPathLength = pathLength;
- bestOffset = offset;
- }
+ reachableStationIdList.add(candidateStationId);
}
} catch (Exception ignore) {}
}
- return bestStationId;
+ if (reachableStationIdList.isEmpty()) {
+ return null;
+ }
+ int gradualIndex = resolveGradualCircleTargetIndex(expectedLoopIssueCount, reachableStationIdList.size());
+ return reachableStationIdList.get(gradualIndex);
+ }
+
+ private int resolveGradualCircleTargetIndex(Integer expectedLoopIssueCount, int candidateCount) {
+ if (candidateCount <= 1) {
+ return 0;
+ }
+ if (expectedLoopIssueCount == null || expectedLoopIssueCount <= 2) {
+ return 0;
+ }
+ int gradualIndex = expectedLoopIssueCount - 2;
+ if (gradualIndex < 1) {
+ gradualIndex = 1;
+ }
+ return Math.min(gradualIndex, candidateCount - 1);
}
private boolean tryAcquireOutOrderDispatchLock(Integer wrkNo, Integer stationId) {
--
Gitblit v1.9.1