From f531a7a3ee28d76316ea8803a5be48168c520823 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 20 九月 2023 09:46:18 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/LiftThread.java              |    4 +
 src/main/java/com/zy/common/utils/NyLiftUtils.java            |   60 +++++++++++++++
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java   |   87 ++++++++++++---------
 src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java   |   52 +++++++++++--
 src/main/java/com/zy/core/model/LiftSlave.java                |    9 ++
 src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java |   10 ++
 6 files changed, 178 insertions(+), 44 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index bd38850..45ab344 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1247,7 +1247,7 @@
         //鏌ヨ搴撲綅绉昏浆宸ヤ綔妗�
         List<WrkMast> wrkMasts1 = wrkMastMapper.selectLocToLocWrkMast();
         for (WrkMast wrkMast : wrkMasts1) {
-            if (wrkMast.getSourceLocNo().equals(wrkMast.getLocNo())) {
+            if (Utils.getLev(wrkMast.getSourceLocNo()) == Utils.getLev(wrkMast.getLocNo())) {
                 boolean step1 = this.locToLocExecuteStep1(wrkMast);//鍚屾ゼ灞傚簱浣嶇Щ杞�
                 if (!step1) {
                     continue;
@@ -1366,10 +1366,14 @@
             }
 
             //鑾峰彇绌挎杞︽渶杩戜笖绌洪棽鐨勬彁鍗囨満杈撻�佺珯鐐�
-            BasDevp liftSta = shuttleDispatchUtils.getRecentLiftSta(shuttleThread.getSlave().getId());
+            LiftStaProtocol liftSta = shuttleDispatchUtils.getRecentLiftSta(shuttleThread.getSlave().getId());
             if (liftSta == null) {
                 return false;//娌℃湁鍙敤涓旂┖闂茬殑杈撻�佺珯鐐�
             }
+            //婧愮珯
+            Integer sourceStaNo = liftSta.getStaNo();
+            //鎻愬崌鏈哄彿*100+鐩爣妤煎眰=鐩爣绔欑偣
+            Integer staNo = liftSta.getLiftNo() * 100 + Utils.getLev(wrkMast.getLocNo());//鐩爣绔�
 
             //灏忚溅宸叉姷杈炬簮搴撲綅锛屽皢璐х墿鎼繍鍒拌緭閫佺珯鐐�
             NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getSourceLocNo(), liftSta.getLocNo());
@@ -1387,7 +1391,8 @@
             assignCommand.setNodes(result.getNodes());//璺緞鑺傜偣
 
             wrkMast.setWrkSts(22L);//21.鐢熸垚鍑哄簱浠诲姟 => 22.灏忚溅鎼繍涓�
-            wrkMast.setLiftNo(liftSta.getLiftNo());//璁剧疆鎻愬崌鏈哄彿
+            wrkMast.setSourceStaNo(sourceStaNo);//婧愮珯
+            wrkMast.setStaNo(staNo);//鐩爣绔�
             wrkMast.setModiTime(new Date());
             if (wrkMastMapper.updateById(wrkMast) > 0) {
                 //涓嬪彂浠诲姟
@@ -1427,16 +1432,16 @@
                 return false;
             }
 
-            //鑾峰彇婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
-            BasDevp sourceBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getSourceLocNo()), liftProtocol.getLiftNo().intValue());
-            //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐�
-            BasDevp targetBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getLocNo()), liftProtocol.getLiftNo().intValue());
-            if (sourceBasDevp == null || targetBasDevp == null) {
-                return false;//缂哄皯绔欑偣淇℃伅
+            //婧愮珯
+            Integer sourceStaNo = wrkMast.getSourceStaNo();
+            //鐩爣绔�
+            Integer staNo = wrkMast.getStaNo();
+            if (sourceStaNo == null || staNo == null) {
+                return false;//婧愮珯鎴栫洰鏍囩珯涓虹┖
             }
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
-            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, sourceBasDevp.getDevNo(), targetBasDevp.getDevNo(), wrkMast.getWrkNo());
+            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, sourceStaNo, staNo, wrkMast.getWrkNo());
 
             ArrayList<NyLiftCommand> commands = new ArrayList<>();
             commands.add(liftCommand);
@@ -1515,6 +1520,7 @@
             assignCommand.setNodes(result.getNodes());//璺緞鑺傜偣
 
             wrkMast.setWrkSts(5L);//4.鎻愬崌鏈烘惉杩愬畬鎴� => 5.灏忚溅鎼繍涓�
+            wrkMast.setLiftNo(null);//閲婃斁鎻愬崌鏈�
             wrkMast.setModiTime(new Date());
             if (wrkMastMapper.updateById(wrkMast) > 0) {
                 //涓嬪彂浠诲姟
@@ -2217,14 +2223,14 @@
                 return false;
             }
 
-            //鑾峰彇鐩爣杈撻�佺珯
-            BasDevp basDevp = basDevpService.selectById(wrkMast.getStaNo());
-            if (basDevp == null) {
-                return false;//鎵句笉鍒拌緭閫佺珯鐐�
+            //鑾峰彇婧愯緭閫佺珯
+            LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getSourceStaNo());
+            if (liftSta == null) {
+                return false;//鎵句笉鍒扮珯鐐�
             }
 
             //鑾峰彇灏忚溅鍒拌緭閫佺珯鐐硅璧板懡浠�
-            NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), basDevp.getLocNo());
+            NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo());
             List<NyShuttleHttpCommand> commands = result.getCommands();
 
             ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
@@ -2259,14 +2265,20 @@
 
         //灏忚溅绉诲姩鍒版彁鍗囨満涓�  103.灏忚溅绉诲姩鑷崇珯鐐瑰畬鎴� ==> 104.灏忚溅杩佸叆鎻愬崌鏈轰腑
         if (wrkMast.getWrkSts() == 103) {
+            //鑾峰彇婧愮珯
+            LiftStaProtocol sourceLiftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getSourceStaNo());
+            if (sourceLiftSta == null) {
+                return false;//鎵句笉鍒扮珯鐐�
+            }
+
             //鑾峰彇鐩爣杈撻�佺珯
-            BasDevp basDevp = basDevpService.selectById(wrkMast.getStaNo());
-            if (basDevp == null) {
-                return false;//鎵句笉鍒拌緭閫佺珯鐐�
+            LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getStaNo());
+            if (liftSta == null) {
+                return false;//鎵句笉鍒扮珯鐐�
             }
 
             //鑾峰彇鎻愬崌鏈烘暟鎹�
-            BasLift basLift = basLiftService.selectById(basDevp.getLiftNo());
+            BasLift basLift = basLiftService.selectById(liftSta.getLiftNo());
             if (basLift == null) {
                 return false;//娌℃湁鎻愬崌鏈烘暟鎹�
             }
@@ -2281,7 +2293,7 @@
                 return false;//褰撳墠鎻愬崌鏈哄瓨鍦ㄦ湭瀹屾垚浠诲姟锛岀瓑寰呬笅涓�娆¤疆璇�
             }
 
-            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, basDevp.getLiftNo());
+            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftSta.getLiftNo());
             if (liftThread == null) {
                 return false;
             }
@@ -2313,10 +2325,8 @@
                 //鎻愬崌鏈轰笉鍦ㄥ皬杞︽ゼ灞�
                 //璋冨害鎻愬崌鏈�
 
-                //鑾峰彇婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
-                BasDevp sourceBasDevp = basDevpService.selectByLevAndLiftNo(liftProtocol.getLev().intValue(), liftProtocol.getLiftNo().intValue());
-                //鑾峰彇鎻愬崌鏈哄懡浠�
-                NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, sourceBasDevp.getDevNo(), basDevp.getDevNo(), wrkMast.getWrkNo());
+                //鑾峰彇鎻愬崌鏈哄懡浠わ紝璋冨害鎻愬崌鏈哄埌婧愮珯浣嶇疆
+                NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, sourceLiftSta.getStaNo(), sourceLiftSta.getStaNo(), wrkMast.getWrkNo());
 
                 ArrayList<NyLiftCommand> commands = new ArrayList<>();
                 commands.add(liftCommand);
@@ -2349,7 +2359,7 @@
             }
 
             //绔欑偣鑺傜偣
-            NavigateNode staNode = NavigatePositionConvert.locNoToNode(basDevp.getLocNo());
+            NavigateNode staNode = NavigatePositionConvert.locNoToNode(sourceLiftSta.getLocNo());
 
             //鎻愬崌鏈鸿妭鐐�
             NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY());
@@ -2414,6 +2424,11 @@
                 return false;//鎻愬崌鏈轰护鐗屽拰褰撳墠灏忚溅涓嶄竴鑷达紝绂佹娲惧彂
             }
 
+            //鍒ゆ柇鎻愬崌鏈哄唴鏄惁鏈夊皬杞�
+            if (!liftProtocol.getHasCar()) {
+                return false;//鎻愬崌鏈哄唴鏃犲皬杞�
+            }
+
             //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
             NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo());
             if (shuttleThread == null) {
@@ -2434,16 +2449,16 @@
                 return false;
             }
 
-            //鑾峰彇婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
-            BasDevp sourceBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getSourceLocNo()), liftProtocol.getLiftNo().intValue());
-            //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐�
-            BasDevp targetBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getLocNo()), liftProtocol.getLiftNo().intValue());
-            if (sourceBasDevp == null || targetBasDevp == null) {
+            //鑾峰彇婧愮珯
+            LiftStaProtocol sourceLiftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getSourceStaNo());
+            //鑾峰彇鐩爣绔�
+            LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getStaNo());
+            if (sourceLiftSta == null || liftSta == null) {
                 return false;//缂哄皯绔欑偣淇℃伅
             }
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
-            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, sourceBasDevp.getDevNo(), targetBasDevp.getDevNo(), wrkMast.getWrkNo());
+            NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, sourceLiftSta.getStaNo(), liftSta.getStaNo(), wrkMast.getWrkNo());
 
             ArrayList<NyLiftCommand> commands = new ArrayList<>();
             commands.add(liftCommand);
@@ -2515,10 +2530,10 @@
                 return false;
             }
 
-            //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐�
-            BasDevp targetBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getLocNo()), liftProtocol.getLiftNo().intValue());
-            if (targetBasDevp == null) {
-                return false;//缂哄皯绔欑偣淇℃伅
+            //鑾峰彇鐩爣绔�
+            LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getStaNo());
+            if (liftSta == null) {
+                return false;//鎵句笉鍒扮珯鐐�
             }
 
             //鑾峰彇鎻愬崌鏈烘暟鎹�
@@ -2534,7 +2549,7 @@
 
             List<NyShuttleHttpCommand> commands = new ArrayList<>();
             //鑾峰彇灏忚溅鍑烘彁鍗囨満琛岃蛋鍛戒护
-            NyShuttleHttpCommand moveCommand = NyHttpUtils.getInOutLiftCommand(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), liftNode, NavigatePositionConvert.locNoToNode(targetBasDevp.getLocNo()), false);
+            NyShuttleHttpCommand moveCommand = NyHttpUtils.getInOutLiftCommand(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), liftNode, NavigatePositionConvert.locNoToNode(liftSta.getLocNo()), false);
             commands.add(moveCommand);//娣诲姞灏忚溅杩佸嚭鎻愬崌鏈哄懡浠�
 
             ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
diff --git a/src/main/java/com/zy/common/utils/NyLiftUtils.java b/src/main/java/com/zy/common/utils/NyLiftUtils.java
index acc99be..93cc8da 100644
--- a/src/main/java/com/zy/common/utils/NyLiftUtils.java
+++ b/src/main/java/com/zy/common/utils/NyLiftUtils.java
@@ -1,6 +1,15 @@
 package com.zy.common.utils;
 
+import com.core.common.SpringUtils;
+import com.zy.core.cache.SlaveConnection;
+import com.zy.core.enums.SlaveType;
+import com.zy.core.model.LiftSlave;
 import com.zy.core.model.command.NyLiftCommand;
+import com.zy.core.model.protocol.LiftStaProtocol;
+import com.zy.core.properties.SlaveProperties;
+import com.zy.core.thread.LiftThread;
+
+import javax.swing.*;
 
 /**
  * 鐗涚溂鎻愬崌鏈哄伐鍏风被
@@ -20,4 +29,55 @@
         return command;
     }
 
+    //鑾峰彇鎻愬崌鏈虹珯鐐�
+    public static LiftStaProtocol getLiftStaByStaNo(Integer staNo) {
+        SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
+        for (LiftSlave liftSlave : slaveProperties.getLift()) {
+            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftSlave.getId());
+            if (liftThread == null) {
+                return null;
+            }
+
+            for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
+                if (liftStaProtocol.getStaNo() == staNo) {
+                    return liftStaProtocol;
+                }
+            }
+        }
+
+        return null;
+    }
+
+    //鑾峰彇鎻愬崌鏈虹珯鐐�
+    public static LiftStaProtocol getLiftStaByStaNo(Integer liftNo, Integer staNo) {
+        LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftNo);
+        if (liftThread == null) {
+            return null;
+        }
+
+        for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
+            if (liftStaProtocol.getStaNo() == staNo) {
+                return liftStaProtocol;
+            }
+        }
+
+        return null;
+    }
+
+    //鑾峰彇鎻愬崌鏈虹珯鐐�
+    public static LiftStaProtocol getLiftStaByLev(Integer liftNo, Integer lev) {
+        LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftNo);
+        if (liftThread == null) {
+            return null;
+        }
+
+        for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
+            if (liftStaProtocol.getLev() == lev) {
+                return liftStaProtocol;
+            }
+        }
+
+        return null;
+    }
+
 }
diff --git a/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java b/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
index 8ed3392..f428467 100644
--- a/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
+++ b/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
@@ -18,6 +18,7 @@
 import com.zy.core.model.LiftSlave;
 import com.zy.core.model.ShuttleSlave;
 import com.zy.core.model.protocol.LiftProtocol;
+import com.zy.core.model.protocol.LiftStaProtocol;
 import com.zy.core.model.protocol.NyShuttleProtocol;
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.LiftThread;
@@ -111,6 +112,7 @@
                 if (currentAllDistance < recentAllDistance) {
                     //濡傛灉褰撳墠妤煎眰鐨勮溅璺緞鏇村皬锛屽垯鏇存柊鏈�杩戠┛姊溅
                     recentShuttle = shuttleThread;
+                    recentAllDistance = currentAllDistance;
                 }
             }
         }else {
@@ -137,6 +139,7 @@
                 if (currentAllDistance < recentAllDistance) {
                     //濡傛灉褰撳墠妤煎眰鐨勮溅璺緞鏇村皬锛屽垯鏇存柊鏈�杩戠┛姊溅
                     recentShuttle = shuttleThread;
+                    recentAllDistance = currentAllDistance;
                 }
             }
         }
@@ -188,15 +191,18 @@
             return false;
         }
 
-        Integer staNo = null;
+        Integer sourceStaNo = null;//灏忚溅鎹㈠眰婧愮珯鐐�
+        Integer staNo = null;//灏忚溅鎹㈠眰鐩爣绔欑偣
         if (Utils.getLev(locNo) != shuttleProtocol.getPoint().getZ()) {
             //鐩爣搴撲綅鍜屽皬杞﹀簱浣嶅浜庝笉鍚屼竴妤煎眰锛岄渶瑕侀�氳繃鎻愬崌鏈鸿皟搴�
             //鑾峰彇绌挎杞︽渶杩戜笖绌洪棽鐨勬彁鍗囨満杈撻�佺珯鐐�
-            BasDevp liftSta = this.getRecentLiftSta(shuttleNo);
+            LiftStaProtocol liftSta = this.getRecentLiftSta(shuttleNo);
             if (liftSta == null) {
                 return false;//娌℃湁鍙敤涓旂┖闂茬殑杈撻�佺珯鐐�
             }
-            staNo = liftSta.getDevNo();
+            sourceStaNo = liftSta.getStaNo();//婧愮珯鐐�
+            //鎻愬崌鏈哄彿*100+鐩爣妤煎眰=鐩爣绔欑偣
+            staNo = liftSta.getLiftNo() * 100 + Utils.getLev(locNo);//鐩爣绔�
         }
 
         // 鑾峰彇宸ヤ綔鍙�
@@ -211,6 +217,7 @@
         wrkMast.setShuttleNo(shuttleNo);//绌挎杞﹀彿
         wrkMast.setSourceLocNo(shuttleProtocol.getCurrentLocNo()); // 婧愬簱浣� => 灏忚溅褰撳墠搴撲綅鍙�
         wrkMast.setLocNo(locNo); // 鐩爣搴撲綅
+        wrkMast.setSourceStaNo(sourceStaNo);//婧愮珯
         wrkMast.setStaNo(staNo);//鐩爣绔�
         wrkMast.setPicking("N"); // 鎷f枡
         wrkMast.setExitMk("N"); // 閫�鍑�
@@ -236,7 +243,7 @@
     /**
      * 鑾峰彇绌挎杞︽渶杩戜笖绌洪棽鐨勬彁鍗囨満杈撻�佺珯鐐�
      */
-    public BasDevp getRecentLiftSta(Integer shuttleNo) {
+    public LiftStaProtocol getRecentLiftSta(Integer shuttleNo) {
         //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
         NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
         if (shuttleThread == null) {
@@ -247,6 +254,9 @@
             return null;
         }
 
+        //鑾峰彇灏忚溅鍚屼竴妤煎眰鐨勭珯鐐�
+        ArrayList<LiftStaProtocol> list = new ArrayList<>();
+        int lev = Utils.getLev(shuttleProtocol.getCurrentLocNo());//灏忚溅妤煎眰
         for (LiftSlave slave : slaveProperties.getLift()) {
             LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, slave.getId());
             if (liftThread == null) {
@@ -260,14 +270,40 @@
                 continue;
             }
 
-            BasDevp basDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(shuttleProtocol.getCurrentLocNo()), slave.getId());
-            if (basDevp == null) {
+            LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(slave.getId(), lev);
+            if (liftStaProtocol == null) {
                 continue;
             }
-            return basDevp;
+
+            list.add(liftStaProtocol);
         }
 
-        return null;
+        if (list.isEmpty()) {
+            return null;
+        }
+
+        String currentLocNo = shuttleProtocol.getCurrentLocNo();//灏忚溅浣嶇疆
+        Integer recentAllDistance = 9999999;
+        LiftStaProtocol recentSta = null;//鏈�杩戠珯鐐�
+        //鎼滅储璺濈灏忚溅鏈�杩戠殑绔欑偣
+        for (LiftStaProtocol liftStaProtocol : list) {
+            Integer staNo = liftStaProtocol.getStaNo();//绔欑偣鍙�
+            String locNo = liftStaProtocol.getLocNo();//绔欑偣搴撲綅鍙�
+
+            //褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
+            List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)));//浣跨敤姝e父閫氶亾鍦板浘
+            if (currentShuttlePath == null) {
+                continue;
+            }
+            Integer currentAllDistance = NavigateUtils.getOriginPathAllDistance(currentShuttlePath);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+            if (currentAllDistance < recentAllDistance) {
+                //濡傛灉褰撳墠妤煎眰鐨勮溅璺緞鏇村皬锛屽垯鏇存柊鏈�杩戠珯鐐�
+                recentSta = liftStaProtocol;
+                recentAllDistance = currentAllDistance;
+            }
+        }
+
+        return recentSta;
     }
 
 }
diff --git a/src/main/java/com/zy/core/model/LiftSlave.java b/src/main/java/com/zy/core/model/LiftSlave.java
index f431b96..6070ea0 100644
--- a/src/main/java/com/zy/core/model/LiftSlave.java
+++ b/src/main/java/com/zy/core/model/LiftSlave.java
@@ -14,6 +14,12 @@
     //鎻愬崌鏈虹珯鐐�
     private List<Sta> sta = new ArrayList<>();
 
+    //杈撻�佺珯鐐规帓
+    private Integer staRow;
+
+    //杈撻�佺珯鐐瑰垪
+    private Integer staBay;
+
     @Data
     public static class Sta {
 
@@ -23,6 +29,9 @@
         // 灞�
         private Integer lev;
 
+        // 鎻愬崌鏈哄彿
+        private Integer liftNo;
+
     }
 
 }
diff --git a/src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java b/src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java
index 27feebb..1bb4b1a 100644
--- a/src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java
@@ -84,4 +84,14 @@
      */
     private Integer lev;
 
+    /**
+     * 绔欑偣搴撲綅鍙�
+     */
+    private String locNo;
+
+    /**
+     * 鎻愬崌鏈哄彿
+     */
+    private Integer liftNo;
+
 }
diff --git a/src/main/java/com/zy/core/thread/LiftThread.java b/src/main/java/com/zy/core/thread/LiftThread.java
index 816e9f4..83f3c8d 100644
--- a/src/main/java/com/zy/core/thread/LiftThread.java
+++ b/src/main/java/com/zy/core/thread/LiftThread.java
@@ -13,6 +13,7 @@
 import com.zy.asrs.mapper.WrkMastMapper;
 import com.zy.asrs.service.BasLiftOptService;
 import com.zy.asrs.service.BasLiftService;
+import com.zy.asrs.utils.Utils;
 import com.zy.common.utils.RedisUtil;
 import com.zy.core.News;
 import com.zy.core.ThreadHandler;
@@ -55,6 +56,9 @@
             LiftStaProtocol liftStaProtocol = new LiftStaProtocol();
             liftStaProtocol.setStaNo(sta.getStaNo());//绔欑偣鍙�
             liftStaProtocol.setLev(sta.getLev());//绔欑偣妤煎眰
+            String locNo = Utils.getLocNo(this.slave.getStaRow(), this.slave.getStaBay(), sta.getLev());
+            liftStaProtocol.setLocNo(locNo);//绔欑偣搴撲綅鍙�
+            liftStaProtocol.setLiftNo(sta.getLiftNo());//鎻愬崌鏈哄彿
             liftStaProtocols.add(liftStaProtocol);
         }
 

--
Gitblit v1.9.1