From fed17b9162273d70043f7d5e9061bc7afd17c6ef Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 27 七月 2023 16:36:19 +0800
Subject: [PATCH] 地图显示

---
 src/main/java/com/zy/common/utils/NavigatePositionConvert.java |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
index 28a2324..47d2b93 100644
--- a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
+++ b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
@@ -1,8 +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;
+import com.zy.asrs.utils.Utils;
 
 /**
  * 搴撲綅缂栧彿鍜孉*绠楁硶鐨剎y杞磋浆鎹㈠伐鍏风被
@@ -32,17 +35,23 @@
         return Short.parseShort(sb.toString());
     }
 
+    //xyz杞磋浆搴撲綅鍙�
+    public static String xyzToLocNo(int x, int y, int z) {
+        String locNo = Utils.getLocNo(x, y, z);
+        return locNo;
+    }
+
     //xyz杞磋浆鍧愭爣缂栧彿
     public static Short xyToPosition(int x, int y, int z) {
         StringBuffer sb = new StringBuffer();
-        sb.append(x);
         if (x < 10) {
-            sb.append("00");
-        } else if (x < 100) {
             sb.append("0");
         }
+        sb.append(x);
 
         if (y < 10) {
+            sb.append("00");
+        }else if (y < 100) {
             sb.append("0");
         }
         sb.append(y);
@@ -51,9 +60,20 @@
             sb.append("0");
         }
         sb.append(z);
-        String position = sb.toString();
+        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());
     }
 

--
Gitblit v1.9.1