zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/ShuttleStandby.java
@@ -1,8 +1,9 @@ package com.zy.asrs.wcs.core.entity; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.annotation.TableLogic; import java.text.SimpleDateFormat; import java.util.Date; import java.util.*; import com.zy.asrs.wcs.system.entity.Host; import com.zy.asrs.wcs.system.entity.User; @@ -242,5 +243,14 @@ return null; } public List<String> getStandbyLoc$() { ArrayList<String> list = new ArrayList<>(); if (this.standbyLoc != null) { List<String> standbyLocs = JSON.parseArray(this.standbyLoc, String.class); list.addAll(standbyLocs); } return list; } } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -478,7 +478,9 @@ String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); //穿梭车出提升机后小车待机位 String shuttleFromLiftStandbyLoc = shuttleStandbyFrom.getStandbyLoc(); List<String> standbyLocs = shuttleStandbyFrom.getStandbyLoc$();//获取全部待机位 //获取可用待机位 String shuttleFromLiftStandbyLoc = shuttleDispatcher.searchAvailableLocNo(Integer.valueOf(shuttleDevice.getDeviceNo()), shuttleDevice.getHostId(), shuttleThread.getStatus().getCurrentLocNo(), standbyLocs); //获取出库任务类型 TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -344,6 +344,51 @@ } /** * 搜索可用库位,通过小车号和目标库位 */ 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: 大于或等于最大数量 */