#
Junjie
2 天以前 6cf4a3e2ba925e75b60f13bb8ebc5e92d37809b2
src/main/java/com/zy/common/utils/NavigatePositionConvert.java
@@ -1,9 +1,8 @@
package com.zy.common.utils;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.service.BasDevpService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NavigateNode;
@@ -12,6 +11,34 @@
 * 库位编号和A*算法的xy轴转换工具类
 */
public class NavigatePositionConvert {
    public static String xyToPosition(int x, int y, int z) {
        String locNo = Utils.getLocNo(x, y, z);
        //库位号转小车二维码
        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
                .eq("loc_no", locNo)
                .eq("status", 1));
        if (locMast == null) {
            return null;
        }
        return locMast.getQrCodeValue();
    }
    //小车条形码转路径算法节点
    public static NavigateNode codeToNode(String code) {
        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
                .eq("qr_code_value", code)
                .eq("status", 1));
        if (locMast == null) {
            return null;
        }
        NavigateNode node = new NavigateNode(locMast.getRow1(), locMast.getBay1());
        node.setZ(locMast.getLev1());
        return node;
    }
    //坐标编号转xy轴
    public static int[] positionToXY(String position) {
@@ -73,4 +100,10 @@
        return new int[]{col, row};
    }
    public static boolean equalsNode(NavigateNode node1, NavigateNode node2) {
        if(node1.getX() ==  node2.getX() && node1.getY() == node2.getY() && node1.getZ() == node2.getZ()) {
            return true;
        }
        return false;
    }
}