#
Junjie
2 天以前 73ce8bebcc5d14f3fb62a19ee677abfcdfc776b4
src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
@@ -129,7 +129,7 @@
                //当前穿梭车库位号
                String currentLocNo = shuttleProtocol.getCurrentLocNo();
                //当前穿梭车线程到目标地点距离
                List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)), null);//搜索空闲穿梭车,使用正常通道地图
                List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, new ArrayList<NavigationMapType>(){{add(NavigationMapType.NORMAL);}}, Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)), null);//搜索空闲穿梭车,使用正常通道地图
                if (currentShuttlePath == null) {
                    continue;
                }
@@ -174,7 +174,7 @@
                    int currentLev = Utils.getLev(currentLocNo);
                    //判断当前楼层是否有任务,如果有则不分配这辆车
                    List<WrkMast> wrkMasts1 = wrkMastService.selectWrkByLev(currentLev);
                    int shuttleCount = this.getShuttleCountByLev(currentLev);//获取穿梭车楼层车辆数量
                    int shuttleCount = this.getShuttleEnableUseCountByLev(currentLev);//获取穿梭车楼层车辆数量
                    if (!wrkMasts1.isEmpty() && shuttleCount <= 1) {
                        //存在其他任务且可用小车数量小于等于1,跳过这辆车
                        continue;
@@ -498,7 +498,7 @@
            String locNo = forkLiftStaProtocol.getLocNo();//站点库位号
            //当前穿梭车线程到目标地点距离
            List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)), null);//使用正常通道地图
            List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.getMapTypes(NavigationMapType.NORMAL), Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)), null);//使用正常通道地图
            if (currentShuttlePath == null) {
                continue;
            }
@@ -528,7 +528,7 @@
    /**
     * 获取楼层可用小车数量
     */
    public int getShuttleCountByLev(int lev) {
    public int getShuttleEnableUseCountByLev(int lev) {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        int count = 0;
@@ -561,4 +561,36 @@
        return count;
    }
    /**
     * 获取楼层小车数量
     */
    public int getShuttleCountByLev(int lev) {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        int count = 0;
        for (DeviceConfig device : shuttleList) {
            //获取四向穿梭车线程
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            if (shuttleThread == null) {
                continue;
            }
            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
            if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
                continue;
            }
            if (shuttleProtocol.getCurrentLocNo() == null) {
                continue;
            }
            if (Utils.getLev(shuttleProtocol.getCurrentLocNo()) == lev) {
                //同一楼层可用小车
                count++;
                continue;
            }
        }
        return count;
    }
}