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/trace/StationTaskTraceRegistry.java | 12 +++++++-----
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java | 40 ++++++++++++++++++++++++----------------
src/main/webapp/views/watch/stationTrace.html | 5 ++++-
3 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/src/main/java/com/zy/core/trace/StationTaskTraceRegistry.java b/src/main/java/com/zy/core/trace/StationTaskTraceRegistry.java
index 98768c3..1751be6 100644
--- a/src/main/java/com/zy/core/trace/StationTaskTraceRegistry.java
+++ b/src/main/java/com/zy/core/trace/StationTaskTraceRegistry.java
@@ -642,7 +642,7 @@
&& !loopAlertText.trim().isEmpty();
String nextType = active ? loopAlertType : null;
String nextText = active ? loopAlertText.trim() : null;
- Integer nextCount = active ? loopAlertCount : null;
+ Integer nextCount = loopAlertCount != null && loopAlertCount > 0 ? loopAlertCount : null;
boolean changed = !Objects.equals(this.loopAlertActive, active)
|| !Objects.equals(this.loopAlertType, nextType)
|| !Objects.equals(this.loopAlertText, nextText)
@@ -810,13 +810,15 @@
}
private void appendLoopHintDetails(Map<String, Object> details) {
- if (details == null || !Boolean.TRUE.equals(this.loopAlertActive) || this.loopAlertCount == null || this.loopAlertCount <= 2) {
+ if (details == null || this.loopAlertCount == null || this.loopAlertCount <= 0) {
return;
}
- details.put("loopAlertActive", Boolean.TRUE);
- details.put("loopAlertType", this.loopAlertType);
- details.put("loopAlertText", this.loopAlertText);
details.put("loopAlertCount", this.loopAlertCount);
+ if (Boolean.TRUE.equals(this.loopAlertActive)) {
+ details.put("loopAlertActive", Boolean.TRUE);
+ details.put("loopAlertType", this.loopAlertType);
+ details.put("loopAlertText", this.loopAlertText);
+ }
}
private boolean acceptTraceVersion(Integer incomingTraceVersion) {
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) {
diff --git a/src/main/webapp/views/watch/stationTrace.html b/src/main/webapp/views/watch/stationTrace.html
index 10a59d3..02f8cca 100644
--- a/src/main/webapp/views/watch/stationTrace.html
+++ b/src/main/webapp/views/watch/stationTrace.html
@@ -429,6 +429,9 @@
褰撳墠绔�: {{ orDash(item.currentStationId) }}<br>
鐩爣绔�: {{ orDash(item.finalTargetStationId) }}<br>
鍒嗘: {{ orDash(item.issuedSegmentCount) }} / {{ orDash(item.totalSegmentCount) }}<br>
+ <template v-if="item.loopAlertCount">
+ 缁曞湀绱: {{ item.loopAlertCount }}<br>
+ </template>
<template v-if="item.loopAlertActive && item.loopAlertText">
鎻愮ず: {{ item.loopAlertText }}<br>
</template>
@@ -498,7 +501,7 @@
</div>
<div class="trace-summary-item">
<div class="trace-summary-label">缁曞湀绱</div>
- <div class="trace-summary-value">{{ selectedTrace.loopAlertActive ? orDash(selectedTrace.loopAlertCount) : '--' }}</div>
+ <div class="trace-summary-value">{{ selectedTrace.loopAlertCount != null ? selectedTrace.loopAlertCount : '--' }}</div>
</div>
</div>
--
Gitblit v1.9.1