#
zjj
2024-07-10 c13fe87d70e81d7dcb604f8f1227de8f313cbefc
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -17,6 +17,7 @@
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
import com.zy.asrs.wcs.rcs.entity.Device;
import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
import com.zy.asrs.wcs.rcs.service.DeviceService;
@@ -161,7 +162,7 @@
            }
            // 挂载任务权重
            List<Task> tasks = taskService.selectWorkingByShuttle(Integer.valueOf(device.getDeviceNo()));
            List<Task> tasks = taskService.selectWorkingByShuttle(Integer.valueOf(device.getDeviceNo()), null);
            if (!Cools.isEmpty(tasks)) {
                currDistance += tasks.size() * WEIGHT;
            }
@@ -302,20 +303,24 @@
        }
        int lev = Utils.getLev(locNo);//当前楼层
        JSONArray standbyLoc = JSON.parseArray(idleLoc);
        if (lev > standbyLoc.size()) {
        List<String> standbyLoc = JSON.parseArray(idleLoc, String.class);
        if (standbyLoc.isEmpty()) {
            throw new CoolException("避让数据异常");
        }
        Object object = standbyLoc.get(lev - 1);
        List<String> locs = JSON.parseArray(object.toString(), String.class);
        if (locs.isEmpty()) {
            throw new CoolException("避让数据为空");
        //获取当前层避让位置
        List<String> currentLevStandByLoc = new ArrayList<>();
        for (String loc : standbyLoc) {
            if (Utils.getLev(loc) == lev) {
                currentLevStandByLoc.add(loc);
            }
        }
        if (currentLevStandByLoc.isEmpty()) {
            throw new CoolException("当前层无避让位置");
        }
        Integer finalDistance = ShuttleDispatcher.INF;
        String recentLoc = null;
        for (String loc : locs) {
        for (String loc : currentLevStandByLoc) {
            //当前穿梭车到避让位计算
            List<NavigateNode> currentShuttlePath = NavigateUtils.calc(
                    locNo
@@ -368,6 +373,9 @@
            if (shuttleProtocol == null) {
                continue;
            }
            if (shuttleProtocol.getProtocolStatusType() == ShuttleProtocolStatusType.OFFLINE){
                continue;
            }
            if (Utils.getLev(shuttleProtocol.getCurrentLocNo()) == lev) {
                if (shuttleProtocol.getHasCharge()) {