| | |
| | | } |
| | | |
| | | /** |
| | | * 搜索可用库位,通过小车号和目标库位 |
| | | */ |
| | | public String searchAvailableLocNo(Integer shuttleNo, Long hostId, String currentLocNo, List<String> locNos) { |
| | | BasShuttle basShuttle = basShuttleService.getOne(new LambdaQueryWrapper<BasShuttle>() |
| | | .eq(BasShuttle::getShuttleNo, shuttleNo) |
| | | .eq(BasShuttle::getHostId, hostId)); |
| | | if (basShuttle == null) { |
| | | throw new CoolException("小车基础数据不存在"); |
| | | } |
| | | |
| | | if (locNos.isEmpty()) { |
| | | throw new CoolException("当前层无避让位置"); |
| | | } |
| | | |
| | | int lev = Utils.getLev(currentLocNo); |
| | | |
| | | Integer finalDistance = ShuttleDispatcher.INF; |
| | | String recentLoc = null; |
| | | for (String loc : locNos) { |
| | | //当前穿梭车到避让位计算 |
| | | List<NavigateNode> currentShuttlePath = NavigateUtils.calc( |
| | | currentLocNo |
| | | , loc |
| | | , NavigationMapType.NORMAL.id |
| | | , Utils.getShuttlePoints(shuttleNo, lev) |
| | | );//使用正常通道地图 |
| | | if (currentShuttlePath == null) { |
| | | continue; |
| | | } |
| | | |
| | | Integer currDistance = NavigateUtils.getOriginPathAllDistance(currentShuttlePath);//计算当前路径行走总距离 |
| | | if (currDistance < finalDistance) { |
| | | finalDistance = currDistance; |
| | | recentLoc = loc; |
| | | } |
| | | } |
| | | |
| | | if (recentLoc == null) { |
| | | throw new CoolException("搜索避让位置失败"); |
| | | } |
| | | |
| | | return recentLoc; |
| | | } |
| | | |
| | | /** |
| | | * 检测目标楼层车数量是否小于允许的最大数量 |
| | | * true: 小于最大数量 false: 大于或等于最大数量 |
| | | */ |