From 0eacf47294055d7c292999b3167cbaf6938e50cc Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 12 六月 2024 16:56:26 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigatePositionConvert.java | 56 +++++++++++++++++++++++---------------------------------
1 files changed, 23 insertions(+), 33 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigatePositionConvert.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigatePositionConvert.java
index a44bd3d..9b2bdad 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigatePositionConvert.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigatePositionConvert.java
@@ -12,47 +12,24 @@
public class NavigatePositionConvert {
public static String xyToPosition(int x, int y, int z, Long hostId) {
- 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();//搴撲綅鍙�
+ String locNo = Utils.getLocNo(x, y, z);
//搴撲綅鍙疯浆灏忚溅浜岀淮鐮�
- LocService locMastService = SpringUtils.getBean(LocService.class);
- Loc locMast = locMastService.getOne(new LambdaQueryWrapper<Loc>()
- .eq(Loc::getLocNo, position)
- .eq(Loc::getHostId, hostId));
- if (locMast == null) {
-// //褰撳墠搴撲綅鍙锋煡涓嶅埌锛屽彲鑳芥槸绔欑偣搴撲綅鍙�
-// BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
-// BasDevp basDevp = basDevpService.queryByLocNo(position);
-// if (basDevp == null) {
-// return null;
-// }
-// return Short.parseShort(basDevp.getQrCodeValue());
+ LocService locService = SpringUtils.getBean(LocService.class);
+ Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
+ .eq(Loc::getLocNo, locNo)
+ .eq(Loc::getHostId, hostId)
+ .eq(Loc::getStatus, 1));
+ if (loc == null) {
return null;
}
- return locMast.getCode();
+ return loc.getCode();
}
//鍧愭爣缂栧彿杞瑇y杞�
public static int[] positionToXY(String position) {
- int col = Integer.parseInt(position.substring(0, 2));
- int row = Integer.parseInt(position.substring(2, 5));
+ int col = Utils.getRow(position);
+ int row = Utils.getBay(position);
int[] newPosition = coverPosition(col,row);
//杩斿洖x鍜寉
// return new int[]{row, col};
@@ -69,6 +46,19 @@
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;
+ }
+
//璺緞绠楁硶鑺傜偣杞琖CS绯荤粺搴撲綅鍙�
public static String nodeToLocNo(NavigateNode node) {
return xyzToLocNo(node.getX(), node.getY(), node.getZ());
--
Gitblit v1.9.1