From 0f2eaeeb387850acfede95c5c061b5392dae8688 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期三, 28 六月 2023 16:58:25 +0800 Subject: [PATCH] 寻路算法和避障 --- src/main/java/com/zy/common/utils/NavigatePositionConvert.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 56 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java index fe443b0..be0be98 100644 --- a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java +++ b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java @@ -1,5 +1,11 @@ package com.zy.common.utils; +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; + /** * 搴撲綅缂栧彿鍜孉*绠楁硶鐨剎y杞磋浆鎹㈠伐鍏风被 */ @@ -15,6 +21,55 @@ return newPosition; } + //xy杞磋浆鍧愭爣缂栧彿 + public static Short xyToPosition(int x, int y) { + StringBuffer sb = new StringBuffer(); + sb.append(x); + if (x < 10) { + sb.append("00"); + } else if (x < 100) { + sb.append("0"); + } + sb.append(y); + return Short.parseShort(sb.toString()); + } + + //xyz杞磋浆鍧愭爣缂栧彿 + public static Short xyToPosition(int x, int y, int z) { + StringBuffer sb = new StringBuffer(); + if (x < 10) { + sb.append("0"); + } + sb.append(x); + + if (y < 10) { + sb.append("00"); + }else if (y < 100) { + sb.append("0"); + } + sb.append(y); + + if (z < 10) { + sb.append("0"); + } + sb.append(z); + String position = sb.toString();//搴撲綅鍙� + + //搴撲綅鍙疯浆灏忚溅浜岀淮鐮� + LocMastService locMastService = SpringUtils.getBean(LocMastService.class); + LocMast locMast = locMastService.queryByLoc(position); + if (locMast == null) { + //褰撳墠搴撲綅鍙锋煡涓嶅埌锛屽彲鑳芥槸绔欑偣搴撲綅鍙� + BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); + BasDevp basDevp = basDevpService.queryByLocNo(position); + if (basDevp == null) { + return null; + } + return Short.parseShort(basDevp.getQrCodeValue()); + } + return Short.parseShort(locMast.getQrCodeValue()); + } + //杞崲琛屽彿锛屽疄闄呬腑鏈�搴曞眰鍙兘鏄涓�琛岋紝鍦ㄦ暟缁勪腑鏈�搴曞眰鏄渶鍚庝竴琛岋紝鍥犳闇�瑕佽繘琛岃浆鎹㈡墠鍙互鍖归厤鏁版嵁 public static int covertRow(int row) { NavigateMapData mapData = new NavigateMapData(); @@ -25,7 +80,7 @@ } public static int[] coverPosition(int col,int row) { - return new int[]{row, col}; + return new int[]{col, row}; } } -- Gitblit v1.9.1