| | |
| | | if (wrkMast1 != null) { |
| | | wrkMast1.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | wrkMastMapper.updateById(wrkMast1); |
| | | return true; |
| | | } |
| | | break; |
| | | } |
| | |
| | | } |
| | | }else { |
| | | //同一楼层,没有空闲穿梭车,只能从其他楼层调度 |
| | | //寻找离任务最近的穿梭车 |
| | | for (NyShuttleThread shuttleThread : diffLev) { |
| | | //寻找离任务楼层最近的穿梭车(不考虑跨楼层小车移动距离) |
| | | |
| | | //当前穿梭车库位号 |
| | | String currentLocNo = shuttleThread.getShuttleProtocol().getCurrentLocNo(); |
| | | int currentLev = Utils.getLev(currentLocNo); |
| | | List<WrkMast> wrkMasts1 = wrkMastService.selectNoShuttleWrkByLev(currentLev);//判断当前穿梭车楼层是否有待分配车辆的任务,如果有则不分配这辆车 |
| | | if (wrkMasts1.size() > 0) { |
| | | //存在其他任务,跳过这辆车 |
| | | continue; |
| | | } |
| | | //获取任务 |
| | | WrkMast wrkMast1 = wrkMastMapper.selectByWorkNo(wrkNo); |
| | | |
| | | //当前穿梭车线程到当前车子所在楼层的提升机口距离 |
| | | List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, Utils.levToOutInStaLocNo(currentLev), NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleThread.getSlave().getId(), currentLev));//搜索空闲穿梭车,使用正常通道地图 |
| | | if (currentShuttlePath == null) { |
| | | continue; |
| | | } |
| | | if (wrkMast1 != null) { |
| | | int lev = Utils.getLev(wrkMast1.getLocNo());//目标楼层 |
| | | int recentValue = 99999;//最小差值 |
| | | for (NyShuttleThread shuttleThread : diffLev) { |
| | | //当前穿梭车库位号 |
| | | String currentLocNo = shuttleThread.getShuttleProtocol().getCurrentLocNo(); |
| | | int currentLev = Utils.getLev(currentLocNo); |
| | | List<WrkMast> wrkMasts1 = wrkMastService.selectNoShuttleWrkByLev(currentLev);//判断当前穿梭车楼层是否有待分配车辆的任务,如果有则不分配这辆车 |
| | | if (wrkMasts1.size() > 0) { |
| | | //存在其他任务,跳过这辆车 |
| | | continue; |
| | | } |
| | | |
| | | Integer currentAllDistance = NavigateUtils.getOriginPathAllDistance(currentShuttlePath);//计算当前路径行走总距离 |
| | | if (currentAllDistance < recentAllDistance) { |
| | | //如果当前楼层的车路径更小,则更新最近穿梭车 |
| | | recentShuttle = shuttleThread; |
| | | recentAllDistance = currentAllDistance; |
| | | //ABS(目标楼层 - 当前楼层) 得到差距,取最小差值 |
| | | int currentValue = Math.abs(lev - currentLev); |
| | | if (currentValue < recentValue) { |
| | | //如果当前楼层的车路径更小,则更新最近穿梭车 |
| | | recentShuttle = shuttleThread; |
| | | recentValue = currentValue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if (wrkCharge.getWrkSts() == 53) { |
| | | toCharge = true;//充电结束,允许生成移库任务 |
| | | } |
| | | |
| | | if (!toCharge) { |
| | | //不是去充电桩且存在充电任务,禁止生成新的移动任务 |
| | | return false; |