| | |
| | | } |
| | | |
| | | /** |
| | | * 搜索避让库位,通过小车号和目标库位 |
| | | * 搜索可用库位,通过小车号和目标库位 |
| | | */ |
| | | public String searchStandByLocNo(Integer shuttleNo, Long hostId, String locNo) { |
| | | 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)); |
| | |
| | | throw new CoolException("小车基础数据不存在"); |
| | | } |
| | | |
| | | String idleLoc = basShuttle.getIdleLoc(); |
| | | if (Cools.isEmpty(idleLoc)) { |
| | | throw new CoolException("小车避让数据不存在"); |
| | | } |
| | | |
| | | int lev = Utils.getLev(locNo);//当前楼层 |
| | | List<String> standbyLoc = JSON.parseArray(idleLoc, String.class); |
| | | if (standbyLoc.isEmpty()) { |
| | | throw new CoolException("避让数据异常"); |
| | | } |
| | | //获取当前层避让位置 |
| | | List<String> currentLevStandByLoc = new ArrayList<>(); |
| | | for (String loc : standbyLoc) { |
| | | if (Utils.getLev(loc) == lev) { |
| | | currentLevStandByLoc.add(loc); |
| | | } |
| | | } |
| | | if (currentLevStandByLoc.isEmpty()) { |
| | | if (locNos.isEmpty()) { |
| | | throw new CoolException("当前层无避让位置"); |
| | | } |
| | | |
| | | int lev = Utils.getLev(currentLocNo); |
| | | |
| | | Integer finalDistance = ShuttleDispatcher.INF; |
| | | String recentLoc = null; |
| | | for (String loc : currentLevStandByLoc) { |
| | | for (String loc : locNos) { |
| | | //当前穿梭车到避让位计算 |
| | | List<NavigateNode> currentShuttlePath = NavigateUtils.calc( |
| | | locNo |
| | | currentLocNo |
| | | , loc |
| | | , NavigationMapType.NORMAL.id |
| | | , Utils.getShuttlePoints(shuttleNo, lev) |