#
Junjie
16 小时以前 8a1f312d9f7842bb02c97b200e017926f0af63a5
src/main/java/com/zy/asrs/utils/Utils.java
@@ -1,5 +1,7 @@
package com.zy.asrs.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Arith;
import com.core.common.Cools;
@@ -84,7 +86,7 @@
        return null;
    }
    //获取除白名单外的指定楼层全部穿梭车xy坐标点
    //获取穿梭车xy坐标点
    public static int[] getShuttlePoint(Integer shuttleNo) {
        //获取穿梭车所在节点位置
        ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
@@ -145,6 +147,34 @@
            list.add(xyPosition);
        }
        return list;
    }
    public static ShuttleThread searchShuttle(String locNo) {
        DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class);
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig device : shuttleList) {
            //获取穿梭车所在节点位置
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            if (shuttleThread == null) {
                continue;
            }
            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
            if (shuttleProtocol == null) {
                continue;
            }
            String currentLocNo = shuttleProtocol.getCurrentLocNo();
            if (currentLocNo == null) {
                continue;
            }
            if (currentLocNo.equals(locNo)) {
                return shuttleThread;
            }
        }
        return null;
    }
    //检测楼层是否有可用穿梭车
@@ -265,4 +295,16 @@
        return recentLocNo;
    }
    public static boolean isJSON(String value) {
        try {
            JSONObject jsonData = JSON.parseObject(value);
            if (jsonData == null) {
                return false;
            }
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}