From 7a3b50af32dce3c806a6e520043a714594f3acff Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 25 十月 2023 19:59:26 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/utils/Utils.java |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index 1966c36..afd653a 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -20,6 +20,7 @@
 import com.zy.common.utils.NavigatePositionConvert;
 import com.zy.common.utils.NavigateUtils;
 import com.zy.common.utils.ShuttleDispatchUtils;
+import com.zy.core.DevpThread;
 import com.zy.core.Slave;
 import com.zy.core.cache.MessageQueue;
 import com.zy.core.cache.SlaveConnection;
@@ -32,15 +33,13 @@
 import com.zy.core.model.command.ShuttleCommand;
 import com.zy.core.model.protocol.NyShuttleProtocol;
 import com.zy.core.model.protocol.ShuttleProtocol;
+import com.zy.core.model.protocol.StaProtocol;
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.NyShuttleThread;
 import com.zy.core.thread.ShuttleThread;
 
 import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
 
 /**
  * Created by vincent on 2020/8/27
@@ -547,4 +546,51 @@
         return null;
     }
 
+    //閫氳繃鎻愬崌鏈哄彿鍜屾ゼ灞傝幏鍙栧嚭鍏ュ簱妯″紡
+    public static Integer getOutInModelByLift(Integer liftNo, Integer lev) {
+        ArrayList<Integer> lev1 = new ArrayList<Integer>() {{
+            add(100);add(103);
+            add(105);
+        }};
+        ArrayList<Integer> lev2 = new ArrayList<Integer>() {{
+            add(200);add(203);
+            add(205);
+        }};
+        ArrayList<Integer> lev3 = new ArrayList<Integer>() {{
+            add(341);add(346);
+        }};
+
+        Integer staNo = null;
+        if (lev <= 4) {
+            staNo = lev1.get(liftNo - 1);
+        } else if (lev >= 5 && lev <= 7) {
+            staNo = lev2.get(liftNo - 1);
+        } else if ((lev >=8 && lev <= 10) && liftNo != 1) {
+            staNo = lev3.get(liftNo - 2);
+        }
+
+        if (staNo != null) {
+            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+            StaProtocol staProtocol = devpThread.getStation().get(staNo);
+            if (staProtocol == null) {
+                return null;
+            }
+
+            if (staNo == 100 || staNo == 200) {//1鍙锋彁鍗囨満100绔欏拰200绔欓粯璁ゅ叏鏄嚭搴撴ā寮�
+                return 2;//鍑哄簱妯″紡
+            }
+
+            if (staNo == 341) {
+                return 1;//341绔欓粯璁ゅ彧鑳藉叆搴撴ā寮�
+            }
+
+            if (staProtocol.getOutInModel() == null) {
+                return null;//娌℃湁鍑哄叆搴撲俊鍙�
+            }
+
+            return staProtocol.getOutInModel().intValue();
+        }
+        return null;
+    }
+
 }

--
Gitblit v1.9.1