From a36cfef04df2bd4931e0eacab1bf9cda57b24863 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 20 十月 2023 16:07:35 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/NyShuttleThread.java | 92 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 84 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/NyShuttleThread.java b/src/main/java/com/zy/core/thread/NyShuttleThread.java
index 23a86ea..9ad6f5a 100644
--- a/src/main/java/com/zy/core/thread/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -35,6 +35,7 @@
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
/**
@@ -386,8 +387,11 @@
return false;
}
+ checkIOSta(commands, commandStep);//妫�娴嬪皬杞︽槸鍚﹁繘鍑烘彁鍗囨満杈撻�佺珯
+
NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(shuttleProtocol.getCurrentLocNo()));
+ boolean isLock = false;//鏄惁瑙i攣璺緞
//鍙栧嚭鍛戒护
NyShuttleHttpCommand command = null;
if (commandStep < commands.size()) {
@@ -403,13 +407,15 @@
if (shuttleProtocol.getPoint().equals(target)) {
//涓婁竴鏉℃寚浠ょ殑鐩爣浣嶇疆鍜屽綋鍓嶅皬杞︿綅缃浉鍚岋紝鍒欒瀹氫笂涓�鏉′换鍔″畬鎴�
lastCommand.setComplete(true);
- //瑙i攣閿佸畾璺緞锛屼笂涓�鏉¤矾寰勫拰褰撳墠璺緞
+ //瑙i攣閿佸畾璺緞锛屼笂涓�鏉¤矾寰�
List<NavigateNode> nodes = lastCommand.getNodes();
- if (command != null && command.getNodes() != null) {
- nodes.addAll(command.getNodes());
- }
+// //瑙i攣褰撳墠璺緞
+// if (command != null && command.getNodes() != null) {
+// nodes.addAll(command.getNodes());
+// }
if (nodes != null) {
navigateMapData.writeNavigateNodeToRedisMap(nodes, false);//瑙i攣璺緞
+ isLock = true;//瑙i攣杩囪矾寰�
}
}
}else {
@@ -467,15 +473,25 @@
if (command.getRequest().getBody().get("requestType").equals("move")) {
ArrayList<int[]> whiteList = new ArrayList<>();//璁剧疆鑺傜偣鐨勭櫧鍚嶅崟
- if (wrkMast != null && (wrkMast.getIoType() > 100 && wrkMast.getIoType() < 200)) {
+ if (wrkMast != null && ((wrkMast.getIoType() > 100 && wrkMast.getIoType() < 200) || wrkMast.getIoType() == 11)) {
//鍑哄簱浠诲姟锛屼笉妫�娴嬮鑺傜偣
int[] startArr = NavigatePositionConvert.positionToXY(wrkMast.getSourceLocNo());//寮�濮嬭妭鐐�
whiteList.add(startArr);
}
- //妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋
- if (!checkPath(command.getNodes(), nextNodes, whiteList)) {
- return false;
+ //瑙i攣杩囪矾寰勶紝鍙娴嬩笅涓�娈佃矾寰勬槸鍚﹀彲璧�(褰撳墠璺緞宸茬粡琚攣瀹氭棤闇�鍐嶆娴�)
+ if (isLock) {
+ //鍙娴嬩笅涓�娈佃矾寰勬槸鍚﹀彲璧�(褰撳墠璺緞宸茬粡琚攣瀹氭棤闇�鍐嶆娴�)
+ //妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋
+ if (!checkPath(nextNodes == null ? command.getNodes() : nextNodes, null, whiteList)) {
+ return false;
+ }
+ }else {
+ //妫�娴嬪綋鍓嶈矾寰勫拰涓嬩竴娈佃矾寰�
+ //妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋
+ if (!checkPath(command.getNodes(), nextNodes, whiteList)) {
+ return false;
+ }
}
//閿佸畾璺緞锛岄攣瀹氬綋鍓嶈矾寰勫拰涓嬩竴姝ヨ矾寰�
@@ -790,4 +806,64 @@
}
}
+ //妫�娴嬪皬杞︽槸鍚﹁繘鍑烘彁鍗囨満杈撻�佺珯
+ public void checkIOSta(List<NyShuttleHttpCommand> commands, int commandStep) {
+ if (commandStep != 0) {
+ NyShuttleHttpCommand lastCommand = commands.get(commandStep - 1);//涓婁竴姝ュ懡浠�
+ if (lastCommand.getRequest().getBody().get("requestType").equals("move")) {
+ //妫�娴嬭捣鐐规槸鍚︿负鎻愬崌鏈鸿緭閫佺珯鐐�
+ NyShuttleProtocol.NyShuttlePointClass start = JSON.parseObject(lastCommand.getRequest().getBody().get("start").toString(), NyShuttleProtocol.NyShuttlePointClass.class);
+ int[] startPoint = NavigatePositionConvert.NyXyzToWCSXyz(start.getX(), start.getY(), start.getZ());
+ if (startPoint[0] == 13 && (startPoint[1] == 22 || startPoint[1] == 38 || startPoint[1] == 57)) {
+ //杈撻�佺珯鐐逛綅缃�
+
+ int liftNo;
+ if (startPoint[1] == 22) {
+ liftNo = 1;
+ } else if (startPoint[1] == 38) {
+ liftNo = 2;
+ } else {
+ liftNo = 3;
+ }
+
+ HashMap<String, Object> data = new HashMap<>();
+ data.put("lev", startPoint[2]);
+ data.put("status", false);//鍑鸿緭閫佺珯
+
+ //涓嬪彂浠诲姟
+ MessageQueue.offer(SlaveType.Lift, liftNo, new Task(4, data));
+ }
+ }
+ }
+
+ if (commands.size() == commandStep) {
+ return;
+ }
+ NyShuttleHttpCommand command = commands.get(commandStep);//褰撳墠鍛戒护
+ if (command.getRequest().getBody().get("requestType").equals("move")) {
+ NyShuttleProtocol.NyShuttlePointClass target = JSON.parseObject(command.getRequest().getBody().get("target").toString(), NyShuttleProtocol.NyShuttlePointClass.class);
+ int[] targetPoint = NavigatePositionConvert.NyXyzToWCSXyz(target.getX(), target.getY(), target.getZ());
+ //妫�娴嬬洰鏍囦綅缃槸鍚︿负鎻愬崌鏈鸿緭閫佺珯鐐�
+ if (targetPoint[0] == 13 && (targetPoint[1] == 22 || targetPoint[1] == 38 || targetPoint[1] == 57)) {
+ //杈撻�佺珯鐐逛綅缃�
+
+ int liftNo;
+ if (targetPoint[1] == 22) {
+ liftNo = 1;
+ } else if (targetPoint[1] == 38) {
+ liftNo = 2;
+ } else {
+ liftNo = 3;
+ }
+
+ HashMap<String, Object> data = new HashMap<>();
+ data.put("lev", targetPoint[2]);
+ data.put("status", true);//杩涜緭閫佺珯
+
+ //涓嬪彂浠诲姟
+ MessageQueue.offer(SlaveType.Lift, liftNo, new Task(4, data));
+ }
+ }
+ }
+
}
--
Gitblit v1.9.1