#
Junjie
11 小时以前 802e2b36bb16d3f169b00652ccc65fd361082451
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -523,9 +523,17 @@
                                continue;
                            }
                            StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), moveStaNo, 0);
                            StationCommand command = stationThread.getRunBlockRerouteCommand(
                                    wrkMast.getWrkNo(),
                                    stationProtocol.getStationId(),
                                    moveStaNo,
                                    0
                            );
                            if (command == null) {
                                News.taskInfo(wrkMast.getWrkNo(), "获取输送线命令失败");
                                News.taskInfo(wrkMast.getWrkNo(),
                                        "输送站点堵塞重规划未找到可下发路线,当前站点={},目标站点={}",
                                        stationProtocol.getStationId(),
                                        moveStaNo);
                                continue;
                            }
@@ -731,15 +739,23 @@
        if (!shouldApplyOutOrder(wrkMast, outOrderStationIds)) {
            return new OutOrderDispatchDecision(wrkMast.getStaNo(), false);
        }
        Integer dispatchStationId = resolveDispatchOutOrderTarget(
                wrkMast.getSourceStaNo(),
                wrkMast.getStaNo(),
                outOrderStationIds
        );
        if (dispatchStationId == null) {
            return null;
        }
        if (isCurrentOutOrderDispatchStation(currentStationId, wrkMast, outOrderStationIds)) {
            return resolveCurrentOutOrderDispatchDecision(currentStationId, wrkMast, outOrderStationIds);
        }
        Integer moveStaNo = resolveDispatchOutOrderTarget(currentStationId, wrkMast.getStaNo(), outOrderStationIds, true);
        if (moveStaNo == null) {
            return null;
        if (!Objects.equals(dispatchStationId, wrkMast.getStaNo())
                && isCurrentOutOrderStation(currentStationId, outOrderStationIds)
                && isWatchingCircleArrival(wrkMast.getWrkNo(), currentStationId)) {
            return new OutOrderDispatchDecision(dispatchStationId, true);
        }
        return new OutOrderDispatchDecision(moveStaNo, false);
        return new OutOrderDispatchDecision(dispatchStationId, false);
    }
    private OutOrderDispatchDecision resolveCurrentOutOrderDispatchDecision(Integer currentStationId,
@@ -782,14 +798,18 @@
        if (seq == null) {
            toTarget = currentBatchSeq.equals(wrkMast.getBatchSeq());
        } else {
            toTarget = Integer.valueOf(seq + 1).equals(wrkMast.getBatchSeq())
                    && currentBatchSeq.equals(wrkMast.getBatchSeq());
            toTarget = Integer.valueOf(seq + 1).equals(wrkMast.getBatchSeq());
        }
        if (toTarget) {
            if (!hasReachableOutReleaseSlot(currentStationId, wrkMast.getStaNo())) {
            if (hasReachableOutReleaseSlot(currentStationId, wrkMast.getStaNo())) {
                return new OutOrderDispatchDecision(wrkMast.getStaNo(), false);
            }
            Integer circleTarget = resolveNextCircleOrderTarget(currentStationId, outOrderStationIds);
            if (circleTarget == null) {
                News.taskInfo(wrkMast.getWrkNo(), "目标站当前不可进,且未找到可执行的下一排序检测点,当前站点={}", currentStationId);
                return null;
            }
            return new OutOrderDispatchDecision(wrkMast.getStaNo(), false);
            return new OutOrderDispatchDecision(circleTarget, true);
        }
        Integer circleTarget = resolveNextCircleOrderTarget(currentStationId, outOrderStationIds);
@@ -813,9 +833,23 @@
    private boolean isCurrentOutOrderDispatchStation(Integer currentStationId,
                                                     WrkMast wrkMast,
                                                     List<Integer> outOrderStationIds) {
        if (!shouldApplyOutOrder(wrkMast, outOrderStationIds) || currentStationId == null) {
            return false;
        }
        Integer dispatchStationId = resolveDispatchOutOrderTarget(
                wrkMast.getSourceStaNo(),
                wrkMast.getStaNo(),
                outOrderStationIds
        );
        return dispatchStationId != null
                && !Objects.equals(dispatchStationId, wrkMast.getStaNo())
                && Objects.equals(currentStationId, dispatchStationId);
    }
    private boolean isCurrentOutOrderStation(Integer currentStationId,
                                             List<Integer> outOrderStationIds) {
        return currentStationId != null
                && shouldApplyOutOrder(wrkMast, outOrderStationIds)
                && !Objects.equals(currentStationId, wrkMast.getStaNo())
                && outOrderStationIds != null
                && outOrderStationIds.contains(currentStationId);
    }
@@ -824,10 +858,7 @@
                                        List<Integer> outOrderStationIds,
                                        OutOrderDispatchDecision dispatchDecision,
                                        StationCommand command) {
        if (dispatchDecision == null || command == null) {
            return;
        }
        if (!isCurrentOutOrderDispatchStation(currentStationId, wrkMast, outOrderStationIds)) {
        if (dispatchDecision == null || command == null || !shouldApplyOutOrder(wrkMast, outOrderStationIds)) {
            return;
        }
        if (dispatchDecision.isCircle()) {
@@ -837,25 +868,24 @@
        }
    }
    private Integer resolveDispatchOutOrderTarget(Integer currentStationId,
    private Integer resolveDispatchOutOrderTarget(Integer sourceStationId,
                                                  Integer finalTargetStationId,
                                                  List<Integer> outOrderList,
                                                  boolean skipCurrentStation) {
                                                  List<Integer> outOrderList) {
        if (finalTargetStationId == null) {
            return null;
        }
        if (currentStationId == null || outOrderList == null || outOrderList.isEmpty()) {
        if (sourceStationId == null || outOrderList == null || outOrderList.isEmpty()) {
            return finalTargetStationId;
        }
        try {
            List<NavigateNode> nodes = navigateUtils.calcByStationId(currentStationId, finalTargetStationId);
            for (NavigateNode node : nodes) {
                Integer stationId = getStationIdFromNode(node);
            List<NavigateNode> nodes = navigateUtils.calcByStationId(sourceStationId, finalTargetStationId);
            for (int i = nodes.size() - 1; i >= 0; i--) {
                Integer stationId = getStationIdFromNode(nodes.get(i));
                if (stationId == null) {
                    continue;
                }
                if (skipCurrentStation && currentStationId.equals(stationId)) {
                if (Objects.equals(stationId, finalTargetStationId)) {
                    continue;
                }
                if (outOrderList.contains(stationId)) {