#
Junjie
2024-10-16 0f5a5a759221bde50ace126eae797326837f5f72
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigatePositionConvert.java
@@ -15,14 +15,15 @@
        String locNo = Utils.getLocNo(x, y, z);
        //库位号转小车二维码
        LocService locMastService = SpringUtils.getBean(LocService.class);
        Loc locMast = locMastService.getOne(new LambdaQueryWrapper<Loc>()
        LocService locService = SpringUtils.getBean(LocService.class);
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
                .eq(Loc::getLocNo, locNo)
                .eq(Loc::getHostId, hostId));
        if (locMast == null) {
                .eq(Loc::getHostId, hostId)
                .eq(Loc::getStatus, 1));
        if (loc == null) {
            return null;
        }
        return locMast.getCode();
        return loc.getCode();
    }
    //坐标编号转xy轴
@@ -37,14 +38,27 @@
    //WCS系统库位号转路径算法节点
    public static NavigateNode locNoToNode(String locNo) {
        int col = Integer.parseInt(locNo.substring(0, 2));
        int row = Integer.parseInt(locNo.substring(2, 5));
        int col = Utils.getRow(locNo);
        int row = Utils.getBay(locNo);
        int[] newPosition = coverPosition(col,row);
        NavigateNode node = new NavigateNode(col, row);
        NavigateNode node = new NavigateNode(newPosition[0], newPosition[1]);
        node.setZ(Utils.getLev(locNo));
        return node;
    }
    //小车条形码转路径算法节点
    public static NavigateNode codeToNode(String code, Long hostId) {
        LocService locService = SpringUtils.getBean(LocService.class);
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
                .eq(Loc::getCode, code)
                .eq(Loc::getHostId, hostId)
                .eq(Loc::getStatus, 1));
        NavigateNode node = new NavigateNode(loc.getRow(), loc.getBay());
        node.setZ(loc.getLev());
        return node;
    }
    //路径算法节点转WCS系统库位号
    public static String nodeToLocNo(NavigateNode node) {
        return xyzToLocNo(node.getX(), node.getY(), node.getZ());