#
Junjie
16 小时以前 fd5f427018a1d308da9fcb4104c9f5340419ee78
#
1个文件已修改
60 ■■■■■ 已修改文件
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -786,6 +786,9 @@
                    && currentBatchSeq.equals(wrkMast.getBatchSeq());
        }
        if (toTarget) {
            if (!hasReachableOutReleaseSlot(currentStationId, wrkMast.getStaNo())) {
                return null;
            }
            return new OutOrderDispatchDecision(wrkMast.getStaNo(), false);
        }
@@ -847,8 +850,8 @@
        try {
            List<NavigateNode> nodes = navigateUtils.calcByStationId(currentStationId, finalTargetStationId);
            for (int i = nodes.size() - 1; i >= 0; i--) {
                Integer stationId = getStationIdFromNode(nodes.get(i));
            for (NavigateNode node : nodes) {
                Integer stationId = getStationIdFromNode(node);
                if (stationId == null) {
                    continue;
                }
@@ -863,6 +866,59 @@
        return finalTargetStationId;
    }
    private boolean hasReachableOutReleaseSlot(Integer currentStationId,
                                               Integer finalTargetStationId) {
        if (currentStationId == null || finalTargetStationId == null) {
            return true;
        }
        try {
            List<NavigateNode> nodes = navigateUtils.calcByStationId(currentStationId, finalTargetStationId);
            if (nodes == null || nodes.isEmpty()) {
                return true;
            }
            for (NavigateNode node : nodes) {
                Integer stationId = getStationIdFromNode(node);
                if (stationId == null || Objects.equals(stationId, currentStationId)) {
                    continue;
                }
                if (!isPathStationBlocked(stationId)) {
                    return true;
                }
            }
            return false;
        } catch (Exception ignore) {
            return true;
        }
    }
    private boolean isPathStationBlocked(Integer stationId) {
        if (stationId == null) {
            return true;
        }
        BasStation basStation = basStationService.getOne(new QueryWrapper<BasStation>().eq("station_id", stationId));
        if (basStation == null) {
            return true;
        }
        StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo());
        if (stationThread == null) {
            return true;
        }
        StationProtocol stationProtocol = stationThread.getStatusMap().get(stationId);
        if (stationProtocol == null) {
            return true;
        }
        return !stationProtocol.isAutoing()
                || stationProtocol.isLoading()
                || (stationProtocol.getTaskNo() != null && stationProtocol.getTaskNo() > 0);
    }
    private Integer resolveNextCircleOrderTarget(Integer currentStationId, List<Integer> orderedOutStationList) {
        if (currentStationId == null || orderedOutStationList == null || orderedOutStationList.size() <= 1) {
            return null;