| | |
| | | if (basDevp == null || basDevp.getDevpNo() == null || stationId == null) { |
| | | return; |
| | | } |
| | | if (shouldSkipRunBlockStation(basDevp, stationId)) { |
| | | return; |
| | | } |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if (stationThread == null) { |
| | | return; |
| | |
| | | redisUtil.set(RedisKeyType.CHECK_STATION_RUN_BLOCK_LIMIT_.key + stationProtocol.getTaskNo(), "lock", 30); |
| | | |
| | | if (shouldUseRunBlockDirectReassign(wrkMast, stationProtocol.getStationId(), runBlockReassignLocStationList)) { |
| | | executeRunBlockDirectReassign(basDevp, stationThread, stationProtocol, wrkMast); |
| | | if (stationMoveCoordinator != null) { |
| | | stationMoveCoordinator.withTaskDispatchLock(stationProtocol.getTaskNo(), |
| | | () -> { |
| | | executeRunBlockDirectReassign(basDevp, stationThread, stationProtocol, wrkMast); |
| | | return null; |
| | | }); |
| | | } else { |
| | | executeRunBlockDirectReassign(basDevp, stationThread, stationProtocol, wrkMast); |
| | | } |
| | | return; |
| | | } |
| | | |
| | |
| | | && !containsStation(basDevp.getOutStationList$(), stationId); |
| | | } |
| | | |
| | | private boolean shouldSkipRunBlockStation(BasDevp basDevp, Integer stationId) { |
| | | if (basDevp == null || stationId == null) { |
| | | return false; |
| | | } |
| | | return containsStation(basDevp.getBarcodeStationList$(), stationId) |
| | | || containsStation(basDevp.getInStationList$(), stationId); |
| | | } |
| | | |
| | | private boolean containsStation(List<StationObjModel> stationList, Integer stationId) { |
| | | if (stationList == null || stationList.isEmpty() || stationId == null) { |
| | | return false; |
| | |
| | | return RerouteExecutionResult.skip("out-order-lock"); |
| | | } |
| | | |
| | | if (context.cancelSessionBeforeDispatch() && stationMoveCoordinator != null) { |
| | | stationMoveCoordinator.markCancelPending(taskNo, "reroute_pending"); |
| | | } |
| | | |
| | | if (runBlockReroute) { |
| | | if (context.cancelSessionBeforeDispatch() && stationMoveCoordinator != null) { |
| | | stationMoveCoordinator.cancelSession(taskNo); |
| | | } |
| | | if (context.resetSegmentCommandsBeforeDispatch()) { |
| | | stationDispatchRuntimeStateSupport.signalSegmentReset(taskNo, STATION_MOVE_RESET_WAIT_MS); |
| | | } |
| | | } |
| | | |
| | | if (!runBlockReroute |
| | | && context.cancelSessionBeforeDispatch() && stationMoveCoordinator != null) { |
| | | stationMoveCoordinator.cancelSession(taskNo); |
| | | } |
| | | if (!isBlank(context.executionLockKey()) |
| | | && !stationDispatchRuntimeStateSupport.tryAcquireLock(context.executionLockKey(), context.executionLockSeconds())) { |
| | | return RerouteExecutionResult.skip("scene-lock"); |
| | | } |
| | | if (!runBlockReroute && context.resetSegmentCommandsBeforeDispatch()) { |
| | | if (context.resetSegmentCommandsBeforeDispatch()) { |
| | | stationDispatchRuntimeStateSupport.signalSegmentReset(taskNo, STATION_MOVE_RESET_WAIT_MS); |
| | | } |
| | | |
| | |
| | | boolean offered = offerDevpCommandWithDedup(context.dispatchDeviceNo(), plan.command(), plan.dispatchScene()); |
| | | if (!offered) { |
| | | return RerouteExecutionResult.skip("dispatch-dedup"); |
| | | } |
| | | if (context.cancelSessionBeforeDispatch() && stationMoveCoordinator != null) { |
| | | stationMoveCoordinator.markCancelPending(taskNo, "reroute_pending"); |
| | | stationMoveCoordinator.cancelSession(taskNo); |
| | | } |
| | | |
| | | applyRerouteDispatchEffects(context, plan, clearedCommandCount); |
| | |
| | | currentTaskBufferCommandCount); |
| | | return; |
| | | } |
| | | if (stationMoveCoordinator != null) { |
| | | stationMoveCoordinator.cancelSession(wrkMast.getWrkNo()); |
| | | } |
| | | String response = wmsOperateUtils.applyReassignTaskLocNo(wrkMast.getWrkNo(), stationProtocol.getStationId()); |
| | | if (Cools.isEmpty(response)) { |
| | | News.taskError(wrkMast.getWrkNo(), "请求WMS重新分配库位接口失败,接口未响应!!!response:{}", response); |
| | |
| | | return; |
| | | } |
| | | if (stationMoveCoordinator != null) { |
| | | stationMoveCoordinator.markCancelPending(wrkMast.getWrkNo(), "reroute_pending"); |
| | | stationMoveCoordinator.cancelSession(wrkMast.getWrkNo()); |
| | | stationMoveCoordinator.recordDispatch( |
| | | wrkMast.getWrkNo(), |
| | | stationProtocol.getStationId(), |