| | |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | | import com.zy.asrs.domain.path.StationPathResolvedPolicy; |
| | | import com.zy.asrs.domain.vo.StationCycleCapacityVo; |
| | | import com.zy.asrs.domain.vo.StationCycleLoopVo; |
| | | import com.zy.asrs.entity.*; |
| | |
| | | private BasStationService basStationService; |
| | | @Autowired |
| | | private StationCycleCapacityService stationCycleCapacityService; |
| | | @Autowired |
| | | private StationPathPolicyService stationPathPolicyService; |
| | | |
| | | //执行输送站点入库任务 |
| | | public synchronized void stationInExecute() { |
| | | try { |
| | | DispatchLimitConfig limitConfig = getDispatchLimitConfig(); |
| | | DispatchLimitConfig baseLimitConfig = getDispatchLimitConfig(null, null); |
| | | int[] currentStationTaskCountRef = new int[]{countCurrentStationTask()}; |
| | | LoadGuardState loadGuardState = buildLoadGuardState(limitConfig); |
| | | LoadGuardState loadGuardState = buildLoadGuardState(baseLimitConfig); |
| | | |
| | | List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | DispatchLimitConfig limitConfig = getDispatchLimitConfig(stationProtocol.getStationId(), targetStationId); |
| | | LoopHitResult loopHitResult = findPathLoopHit(limitConfig, stationProtocol.getStationId(), targetStationId, loadGuardState); |
| | | |
| | | if (isDispatchBlocked(limitConfig, currentStationTaskCountRef[0], loadGuardState, loopHitResult.isThroughLoop())) { |
| | |
| | | //执行堆垛机输送站点出库任务 |
| | | public synchronized void crnStationOutExecute() { |
| | | try { |
| | | DispatchLimitConfig limitConfig = getDispatchLimitConfig(); |
| | | DispatchLimitConfig baseLimitConfig = getDispatchLimitConfig(null, null); |
| | | int[] currentStationTaskCountRef = new int[]{countCurrentStationTask()}; |
| | | LoadGuardState loadGuardState = buildLoadGuardState(limitConfig); |
| | | LoadGuardState loadGuardState = buildLoadGuardState(baseLimitConfig); |
| | | |
| | | List<WrkMast> wrkMasts = wrkMastService.list(new QueryWrapper<WrkMast>() |
| | | .eq("wrk_sts", WrkStsType.OUTBOUND_RUN_COMPLETE.sts) |
| | |
| | | true |
| | | ); |
| | | |
| | | DispatchLimitConfig limitConfig = getDispatchLimitConfig(stationProtocol.getStationId(), moveStaNo); |
| | | LoopHitResult loopHitResult = findPathLoopHit(limitConfig, stationProtocol.getStationId(), moveStaNo, loadGuardState); |
| | | |
| | | if (isDispatchBlocked(limitConfig, currentStationTaskCountRef[0], loadGuardState, loopHitResult.isThroughLoop())) { |
| | |
| | | redisUtil.expire(RedisKeyType.STATION_CYCLE_LOAD_RESERVE.key, LOOP_LOAD_RESERVE_EXPIRE_SECONDS); |
| | | } |
| | | |
| | | private DispatchLimitConfig getDispatchLimitConfig() { |
| | | private DispatchLimitConfig getDispatchLimitConfig(Integer startStationId, Integer endStationId) { |
| | | DispatchLimitConfig config = new DispatchLimitConfig(); |
| | | Object systemConfigMapObj = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key); |
| | | if (!(systemConfigMapObj instanceof Map)) { |
| | | return config; |
| | | if (systemConfigMapObj instanceof Map) { |
| | | Map<?, ?> systemConfigMap = (Map<?, ?>) systemConfigMapObj; |
| | | config.circleMaxLoadLimit = parseLoadLimit(getConfigValue(systemConfigMap, "circleMaxLoadLimit"), config.circleMaxLoadLimit); |
| | | String loopModeValue = getConfigValue(systemConfigMap, "circleLoopModeEnable"); |
| | | if (isBlank(loopModeValue)) { |
| | | loopModeValue = getConfigValue(systemConfigMap, "circleModeEnable"); |
| | | } |
| | | if (isBlank(loopModeValue)) { |
| | | loopModeValue = getConfigValue(systemConfigMap, "isCircleMode"); |
| | | } |
| | | config.loopModeEnable = parseBoolean(loopModeValue, config.loopModeEnable); |
| | | } |
| | | Map<?, ?> systemConfigMap = (Map<?, ?>) systemConfigMapObj; |
| | | |
| | | config.circleMaxLoadLimit = parseLoadLimit(getConfigValue(systemConfigMap, "circleMaxLoadLimit"), config.circleMaxLoadLimit); |
| | | String loopModeValue = getConfigValue(systemConfigMap, "circleLoopModeEnable"); |
| | | if (isBlank(loopModeValue)) { |
| | | loopModeValue = getConfigValue(systemConfigMap, "circleModeEnable"); |
| | | if (stationPathPolicyService != null && startStationId != null && endStationId != null) { |
| | | try { |
| | | StationPathResolvedPolicy resolvedPolicy = stationPathPolicyService.resolvePolicy(startStationId, endStationId); |
| | | if (resolvedPolicy != null && resolvedPolicy.getProfileConfig() != null) { |
| | | config.circleMaxLoadLimit = parseLoadLimit(String.valueOf(resolvedPolicy.getProfileConfig().getCircleMaxLoadLimit()), config.circleMaxLoadLimit); |
| | | } |
| | | } catch (Exception ignore) { |
| | | } |
| | | } |
| | | if (isBlank(loopModeValue)) { |
| | | loopModeValue = getConfigValue(systemConfigMap, "isCircleMode"); |
| | | } |
| | | config.loopModeEnable = parseBoolean(loopModeValue, config.loopModeEnable); |
| | | |
| | | return config; |
| | | } |