| | |
| | | && currentBatchSeq.equals(wrkMast.getBatchSeq()); |
| | | } |
| | | if (toTarget) { |
| | | if (!hasReachableOutReleaseSlot(currentStationId, wrkMast.getStaNo())) { |
| | | return null; |
| | | } |
| | | return new OutOrderDispatchDecision(wrkMast.getStaNo(), false); |
| | | } |
| | | |
| | |
| | | |
| | | 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; |
| | | } |
| | |
| | | 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; |