#
Junjie
1 天以前 c4b6b51afdd3374735ed5f358457987eaa6e476f
src/main/java/com/zy/common/utils/NavigatePositionConvert.java
@@ -6,6 +6,9 @@
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NavigateNode;
import com.zy.core.enums.RedisKeyType;
import java.util.HashMap;
/**
 * 库位编号和A*算法的xy轴转换工具类
@@ -14,7 +17,12 @@
    public static String xyToPosition(int x, int y, int z) {
        String locNo = Utils.getLocNo(x, y, z);
        String code = null;
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        Object object = redisUtil.get(RedisKeyType.POINT_MAP.key);
        if(object == null) {
        //库位号转小车二维码
        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
@@ -23,11 +31,23 @@
        if (locMast == null) {
            return null;
        }
        return locMast.getQrCodeValue();
            code = locMast.getQrCodeValue();
        }else {
            HashMap<String, String> cache = (HashMap<String, String>) object;
            code = cache.get(locNo);
        }
        return code;
    }
    //小车条形码转路径算法节点
    public static NavigateNode codeToNode(String code) {
        NavigateNode node = null;
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        Object object = redisUtil.get(RedisKeyType.LOC_MAP.key);
        if (object == null) {
        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
                .eq("qr_code_value", code)
@@ -35,8 +55,15 @@
        if (locMast == null) {
            return null;
        }
        NavigateNode node = new NavigateNode(locMast.getRow1(), locMast.getBay1());
            node = new NavigateNode(locMast.getRow1(), locMast.getBay1());
        node.setZ(locMast.getLev1());
        } else {
            HashMap<String, String> cache = (HashMap<String, String>) object;
            String locNo = cache.get(code);
            node = new NavigateNode(Utils.getRow(locNo), Utils.getBay(locNo));
            node.setZ(Utils.getLev(locNo));
        }
        return node;
    }