From bbc577bc32c9b0db6e07fe60b7d066e7a838793d Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 13 六月 2024 16:43:03 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MapRealTimeDataScheduler.java |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MapRealTimeDataScheduler.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MapRealTimeDataScheduler.java
index c452134..7b30f2c 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MapRealTimeDataScheduler.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MapRealTimeDataScheduler.java
@@ -1,6 +1,7 @@
 package com.zy.asrs.wcs.core.map.websocket;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.framework.common.Cools;
 import com.zy.asrs.wcs.core.entity.BasShuttle;
@@ -9,6 +10,7 @@
 import com.zy.asrs.wcs.core.model.NavigateNode;
 import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.core.service.BasShuttleService;
+import com.zy.asrs.wcs.core.utils.NavigateMapUtils;
 import com.zy.asrs.wcs.core.utils.Utils;
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.entity.Device;
@@ -17,6 +19,8 @@
 import com.zy.asrs.wcs.rcs.service.DeviceService;
 import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
 import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
+import com.zy.asrs.wcs.system.entity.Dict;
+import com.zy.asrs.wcs.system.service.DictService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -38,12 +42,17 @@
     private DeviceService deviceService;
     @Autowired
     private BasShuttleService basShuttleService;
+    @Autowired
+    private DictService dictService;
+    @Autowired
+    private NavigateMapUtils navigateMapUtils;
 
     @Scheduled(cron = "0/1 * * * * ? ")
     public void sync() {
         MapWsVo wsVo = new MapWsVo();
         // shuttle
         wsVo.setShuttleVos(syncShuttle());
+        wsVo.setLockPath(getMapLocPath());
         MapWebSocket.broadcast(JSON.toJSONString(wsVo));
     }
 
@@ -92,4 +101,20 @@
         return shuttleVos;
     }
 
+    private List<NavigateNode> getMapLocPath() {
+        List<NavigateNode> navigateNodes = new ArrayList<>();
+        Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>()
+                .eq(Dict::getFlag, "floor-list")
+                .eq(Dict::getStatus, 1));
+        if (dict != null) {
+            for (Object o : JSON.parseArray(dict.getValue())) {
+                JSONObject jsonObject = JSON.parseObject(o.toString());
+                Integer lev = jsonObject.getInteger("value");
+                List<NavigateNode> path = navigateMapUtils.getLockPath(lev);
+                navigateNodes.addAll(path);
+            }
+        }
+        return navigateNodes;
+    }
+
 }

--
Gitblit v1.9.1