#
zwl
2026-02-09 ad79ba405b2d1ac96423f88f4e8a76c584b9d38a
src/main/java/com/zy/asrs/utils/Utils.java
@@ -11,9 +11,11 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.BasCrnp;
import com.zy.asrs.entity.BasDualCrnp;
import com.zy.asrs.entity.BasStationDevice;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.BasCrnpService;
import com.zy.asrs.service.BasDualCrnpService;
import com.zy.asrs.service.BasStationDeviceService;
import com.zy.asrs.service.WrkMastService;
import com.zy.common.model.NavigateNode;
import com.zy.common.utils.NavigateUtils;
@@ -168,6 +170,18 @@
            NavigateUtils navigateUtils = SpringUtils.getBean(NavigateUtils.class);
            WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class);
            BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);
            BasStationDeviceService basStationDeviceService = SpringUtils.getBean(BasStationDeviceService.class);
            List<BasStationDevice> stationDevices = basStationDeviceService.selectList(new EntityWrapper<BasStationDevice>().eq("station_id", stationId));
            boolean hasConfig = !stationDevices.isEmpty();
            List<Integer> allowedCrnNos = new ArrayList<>();
            if (hasConfig) {
                for (BasStationDevice sd : stationDevices) {
                    if (SlaveType.Crn.toString().equals(sd.getDeviceType())) {
                        allowedCrnNos.add(sd.getDeviceNo());
                    }
                }
            }
            Integer currentCircleTaskCrnNo = null;
            Object object = redisUtil.get(RedisKeyType.CURRENT_CIRCLE_TASK_CRN_NO.key);
@@ -181,8 +195,14 @@
            if (currentCircleTaskCrnNo != null) {
                currentCircleTaskCrnNo = currentCircleTaskCrnNo + 1;
                BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", currentCircleTaskCrnNo));
                List<WrkMast> currentCrnTask = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no", currentCircleTaskCrnNo));
                BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>()
                        .eq("crn_no", currentCircleTaskCrnNo)
                        .eq("in_enable", "Y")
                        .eq("status", 1)
                );
                List<WrkMast> currentCrnTask = wrkMastService.selectList(new EntityWrapper<WrkMast>()
                        .eq("crn_no", currentCircleTaskCrnNo)
                );
                if (currentCrnTask.size() <= 1) {
                    if (basCrnp != null) {
                        List<List<Integer>> rowList = basCrnp.getControlRows$();
@@ -257,12 +277,21 @@
            enabledCrnps.sort(Comparator.comparingInt(o -> map.getOrDefault(o.getCrnNo(), 0)));
            List<Integer> recommendList = new ArrayList<>();
            List<Integer> baseRowList = new ArrayList<>();
            for (BasCrnp basCrnp : enabledCrnps) {
                List<List<Integer>> rowList = basCrnp.getControlRows$();
                for (List<Integer> rows : rowList) {
                    list.addAll(rows);
                    if(allowedCrnNos.contains(basCrnp.getCrnNo())) {
                        recommendList.addAll(rows);
                    }else {
                        baseRowList.addAll(rows);
                    }
                }
            }
            list.addAll(recommendList);
            list.addAll(baseRowList);
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -277,6 +306,18 @@
            NavigateUtils navigateUtils = SpringUtils.getBean(NavigateUtils.class);
            WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class);
            BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class);
            BasStationDeviceService basStationDeviceService = SpringUtils.getBean(BasStationDeviceService.class);
            List<BasStationDevice> stationDevices = basStationDeviceService.selectList(new EntityWrapper<BasStationDevice>().eq("station_id", stationId));
            boolean hasConfig = !stationDevices.isEmpty();
            List<Integer> allowedCrnNos = new ArrayList<>();
            if (hasConfig) {
                for (BasStationDevice sd : stationDevices) {
                    if (SlaveType.Crn.toString().equals(sd.getDeviceType())) {
                        allowedCrnNos.add(sd.getDeviceNo());
                    }
                }
            }
            Wrapper<BasDualCrnp> wrapper = new EntityWrapper<BasDualCrnp>()
                    .eq("in_enable", "Y")
@@ -345,12 +386,21 @@
            enabledCrnps.sort(Comparator.comparingInt(o -> map.getOrDefault(o.getCrnNo(), 0)));
            List<Integer> recommendList = new ArrayList<>();
            List<Integer> baseRowList = new ArrayList<>();
            for (BasDualCrnp basDualCrnp : enabledCrnps) {
                List<List<Integer>> rowList = basDualCrnp.getControlRows$();
                for (List<Integer> rows : rowList) {
                    list.addAll(rows);
                    if(allowedCrnNos.contains(basDualCrnp.getCrnNo())) {
                        recommendList.addAll(rows);
                    }else {
                        baseRowList.addAll(rows);
                    }
                }
            }
            list.addAll(recommendList);
            list.addAll(baseRowList);
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -630,4 +680,38 @@
        return null;
    }
    //将wms库位号转换成wcs库位号
    public static String WMSLocToWCSLoc(String locNo) {
        String row = locNo.substring(0, 2);
        int i = 0;
        for (char c : row.toCharArray()) {
            if (c == '0') {
                i++;
            }else {
                break;
            }
        }
        row = row.substring(i);
        int j = 0;
        String boy = locNo.substring(2, 5);
        for (char c : boy.toCharArray()) {
            if (c == '0') {
                j++;
            }else {
                break;
            }
        }
        boy = boy.substring(j);
        int k = 0;
        String lev = locNo.substring(5);
        for (char c : lev.toCharArray()) {
            if (c == '0') {
                k++;
            }else {
                break;
            }
        }
        lev = lev.substring(k);
        return row + "-" + boy + "-" + lev;
    }
}