| | |
| | | wrkMast.setModiTime(now); |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | wrkAnalysisService.markInboundStationStart(wrkMast, now); |
| | | offerDevpCommandWithDedup(basDevp.getDevpNo(), command, "stationInExecute"); |
| | | boolean offered = offerDevpCommandWithDedup(basDevp.getDevpNo(), command, "stationInExecute"); |
| | | if (offered && stationMoveCoordinator != null) { |
| | | stationMoveCoordinator.recordDispatch( |
| | | wrkMast.getWrkNo(), |
| | | stationProtocol.getStationId(), |
| | | "stationInExecute", |
| | | command, |
| | | false |
| | | ); |
| | | } |
| | | News.info("输送站点入库命令下发成功,站点号={},工作号={},命令数据={}", stationId, wrkMast.getWrkNo(), JSON.toJSONString(command)); |
| | | redisUtil.set(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId, "lock", 5); |
| | | loadGuardState.reserveLoopTask(loopHitResult.getLoopNo()); |
| | |
| | | wrkMast.setSystemMsg(""); |
| | | wrkMast.setIoTime(new Date()); |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | offerDevpCommandWithDedup(stationObjModel.getDeviceNo(), command, "dualCrnStationOutExecute"); |
| | | boolean offered = offerDevpCommandWithDedup(stationObjModel.getDeviceNo(), command, "dualCrnStationOutExecute"); |
| | | if (offered && stationMoveCoordinator != null) { |
| | | stationMoveCoordinator.recordDispatch( |
| | | wrkMast.getWrkNo(), |
| | | stationProtocol.getStationId(), |
| | | "dualCrnStationOutExecute", |
| | | command, |
| | | false |
| | | ); |
| | | } |
| | | notifyUtils.notify(String.valueOf(SlaveType.Devp), stationObjModel.getDeviceNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.STATION_OUT_TASK_RUN, null); |
| | | News.info("输送站点出库命令下发成功,站点号={},工作号={},命令数据={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command)); |
| | | redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId(), "lock", 5); |
| | |
| | | pathLenFactor, |
| | | "checkStationRunBlock_reroute" |
| | | ).withRunBlockCommand() |
| | | .withSuppressDispatchGuard() |
| | | .withCancelSessionBeforeDispatch() |
| | | .withResetSegmentCommandsBeforeDispatch(); |
| | | executeSharedReroute(context); |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (stationProtocol.isRunBlock()) { |
| | | continue; |
| | | } |
| | | |
| | | if (!stationProtocol.getStationId().equals(stationProtocol.getTargetStaNo())) { |
| | | continue; |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | StationCommand circleCommand = getWatchCircleCommand(stationProtocol.getTaskNo()); |
| | | if (circleCommand == null) { |
| | | continue; |
| | | } |
| | | if (!stationProtocol.getStationId().equals(circleCommand.getTargetStaNo())) { |
| | | if (!isWatchingCircleArrival(stationProtocol.getTaskNo(), stationProtocol.getStationId())) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | && stationMoveCoordinator != null |
| | | && stationMoveCoordinator.shouldSuppressDispatch(taskNo, stationId, plan.command())) { |
| | | return RerouteExecutionResult.skip("dispatch-suppressed"); |
| | | } |
| | | if (context.sceneType() == RerouteSceneType.RUN_BLOCK_REROUTE |
| | | && shouldSkipRunBlockRerouteForExistingSession(taskNo, stationId, plan.command())) { |
| | | News.info("输送站点堵塞重规划命中已生效同路径路线,已跳过重复下发。站点号={},工作号={},目标站={}", |
| | | stationId, |
| | | taskNo, |
| | | plan.command().getTargetStaNo()); |
| | | return RerouteExecutionResult.skip("run-block-same-path"); |
| | | } |
| | | if (context.requireOutOrderDispatchLock() |
| | | && !tryAcquireOutOrderDispatchLock(taskNo, stationId)) { |
| | |
| | | return !Objects.equals(stationId, session.getCurrentRouteTargetStationId()); |
| | | } |
| | | |
| | | private boolean shouldSkipRunBlockRerouteForExistingSession(Integer wrkNo, |
| | | Integer stationId, |
| | | StationCommand candidateCommand) { |
| | | if (stationMoveCoordinator == null |
| | | || wrkNo == null || wrkNo <= 0 |
| | | || stationId == null |
| | | || candidateCommand == null) { |
| | | return false; |
| | | } |
| | | StationMoveSession session = stationMoveCoordinator.loadSession(wrkNo); |
| | | if (session == null) { |
| | | return false; |
| | | } |
| | | boolean protectedStatus = session.isActive() || StationMoveSession.STATUS_BLOCKED.equals(session.getStatus()); |
| | | if (!protectedStatus) { |
| | | return false; |
| | | } |
| | | boolean sameDispatchStation = Objects.equals(stationId, session.getCurrentStationId()) |
| | | || Objects.equals(stationId, session.getDispatchStationId()); |
| | | if (!sameDispatchStation) { |
| | | return false; |
| | | } |
| | | String candidateSignature = stationMoveCoordinator.buildPathSignature(candidateCommand); |
| | | return !isBlank(candidateSignature) && Objects.equals(candidateSignature, session.getPathSignature()); |
| | | } |
| | | |
| | | private boolean isWatchingCircleArrival(Integer wrkNo, Integer stationId) { |
| | | if (stationMoveCoordinator != null) { |
| | | StationMoveSession session = stationMoveCoordinator.loadSession(wrkNo); |