| | |
| | | } |
| | | |
| | | StationTaskIdleTrack idleTrack = touchStationTaskIdleTrack(stationProtocol.getTaskNo(), stationProtocol.getStationId()); |
| | | if (shouldSkipIdleRecoverForRecentDispatch(stationProtocol.getTaskNo(), stationProtocol.getStationId())) { |
| | | return; |
| | | } |
| | | if (idleTrack == null || !idleTrack.isTimeout(STATION_IDLE_RECOVER_SECONDS)) { |
| | | return; |
| | | } |
| | |
| | | || Objects.equals(wrkMast.getWrkSts(), WrkStsType.STATION_RUN.sts); |
| | | } |
| | | |
| | | private boolean shouldSkipIdleRecoverForRecentDispatch(Integer taskNo, Integer stationId) { |
| | | if (stationMoveCoordinator == null || taskNo == null || taskNo <= 0 || stationId == null) { |
| | | return false; |
| | | } |
| | | StationMoveSession session = stationMoveCoordinator.loadSession(taskNo); |
| | | if (session == null || !session.isActive() || session.getLastIssuedAt() == null) { |
| | | return false; |
| | | } |
| | | if (!Objects.equals(stationId, session.getCurrentStationId()) |
| | | && !Objects.equals(stationId, session.getDispatchStationId())) { |
| | | return false; |
| | | } |
| | | long elapsedMs = System.currentTimeMillis() - session.getLastIssuedAt(); |
| | | long thresholdMs = STATION_IDLE_RECOVER_SECONDS * 1000L; |
| | | if (elapsedMs >= thresholdMs) { |
| | | return false; |
| | | } |
| | | saveStationTaskIdleTrack(new StationTaskIdleTrack(taskNo, stationId, System.currentTimeMillis())); |
| | | News.info("输送站点任务刚完成命令下发,已跳过停留重算。站点号={},工作号={},距上次下发={}ms,routeVersion={}", |
| | | stationId, taskNo, elapsedMs, session.getRouteVersion()); |
| | | return true; |
| | | } |
| | | |
| | | private void resetSegmentMoveCommandsBeforeReroute(Integer taskNo) { |
| | | if (redisUtil == null || taskNo == null || taskNo <= 0) { |
| | | return; |