#
Junjie
1 天以前 c34f9c17fde14f78b3663803e9776d438e8481b9
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) {