From 77bef18c6d0970c72df159f380fd06d176a8df43 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 01 八月 2023 15:52:20 +0800
Subject: [PATCH] 小车进提升机检测方案
---
src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java | 4 +-
src/main/java/com/zy/core/thread/NyShuttleThread.java | 56 +++++++++++++++-------------
src/main/java/com/zy/common/utils/NavigatePositionConvert.java | 8 +++
3 files changed, 39 insertions(+), 29 deletions(-)
diff --git a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
index 135fc0d..c3a8435 100644
--- a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
+++ b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
@@ -33,8 +33,14 @@
return node;
}
- //鐗涚溂鍧愭爣杞琖CS搴撲綅鍙�
+ //WCS鍧愭爣杞琖CS搴撲綅鍙�
public static String xyzToLocNo(int x, int y, int z) {
+ String locNo = Utils.getLocNo(x, y, z);
+ return locNo;
+ }
+
+ //鐗涚溂鍧愭爣杞琖CS搴撲綅鍙�
+ public static String nyXyzToLocNo(int x, int y, int z) {
int[] ints = NyXyzToWCSXyz(x, y, z);
String locNo = Utils.getLocNo(ints[0],ints[1],ints[2]);
return locNo;
diff --git a/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java b/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
index 9fefa15..6904bbc 100644
--- a/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
@@ -375,7 +375,7 @@
if (this.getPoint() == null) {
return "";
}
- return NavigatePositionConvert.xyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ());
+ return NavigatePositionConvert.nyXyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ());
}
public String getCoord$() {
@@ -386,7 +386,7 @@
}
public void setPoint(NyShuttlePointClass point) {
- String locNo = NavigatePositionConvert.xyzToLocNo(point.getX(), point.getY(), point.getZ());
+ String locNo = NavigatePositionConvert.nyXyzToLocNo(point.getX(), point.getY(), point.getZ());
this.point = point;
this.currentLocNo = locNo;
}
diff --git a/src/main/java/com/zy/core/thread/NyShuttleThread.java b/src/main/java/com/zy/core/thread/NyShuttleThread.java
index ddd71bb..7fc995a 100644
--- a/src/main/java/com/zy/core/thread/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -5,6 +5,7 @@
import com.core.common.DateUtils;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.*;
+import com.zy.asrs.mapper.WrkMastMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
@@ -410,20 +411,6 @@
}else {
//宸叉墽琛屽畬鎴�
-// if (redisCommand.getLiftSecurityMk()) {
-// //鏇鹃攣瀹氳繃鎻愬崌鏈猴紝闇�瑕佽繘琛岃В閿�
-// if (liftProtocol != null) {
-// liftProtocol.setSecurityMk(false);
-// }
-// }
-
-// String locNo = shuttleProtocol.getLocNo() == null ? shuttleProtocol.getSourceLocNo() : shuttleProtocol.getLocNo();
-// if (locNo != null) {
-// //瑙i櫎閿佸畾鐨勫簱浣嶈矾寰�
-// NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(locNo));
-// navigateMapData.writeNavigateNodeToRedisMap(redisCommand.getAssignCommand().getNodes(), false);
-// }
-
//鍒犻櫎redis
redisUtil.del("shuttle_wrk_no_" + redisCommand.getWrkNo());
@@ -451,8 +438,33 @@
return false;
}
+ ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
+ //褰撳墠姝ュ簭
+ int commandStep = redisCommand.getCommandStep();
+
+ //妫�娴嬫槸鍚﹀瓨鍦ㄦ彁鍗囨満鍙g殑鎸囦护
+ List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands();
+ if (commands.isEmpty()) {
+ return false;
+ }
+ NyShuttleHttpCommand command = commands.get(commandStep);//褰撳墠鍛戒护
+ if (!command.getMsgType().equals("intoLift")) {
+ return true;//涓嶆槸鍏ユ彁鍗囨満鍛戒护锛岀洿鎺ユ斁琛�
+ }
+
+ //鑾峰彇璧风偣(杈撻�佺珯鐐�)
+ NyShuttleProtocol.NyShuttlePointClass start = JSON.parseObject(command.getRequest().getBody().get("start").toString(), NyShuttleProtocol.NyShuttlePointClass.class);
+ //灏嗙墰鐪煎潗鏍囪浆鎹㈡垚WCS搴撲綅鍙�
+ String startLocNo = NavigatePositionConvert.nyXyzToLocNo(start.getX(), start.getY(), start.getZ());
+
+ BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
+ BasDevp basDevp = basDevpService.queryByLocNo(startLocNo);
+ if (basDevp == null) {
+ return false;//鏌ヤ笉鍒扮珯鐐癸紝绂佹涓嬪彂
+ }
+
//鎷垮埌鎻愬崌鏈虹嚎绋�
- LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1);
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, basDevp.getLiftNo());
if (liftThread == null) {
return false;
}
@@ -460,21 +472,13 @@
if (liftProtocol == null) {
return false;
}
-
- ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
- //褰撳墠姝ュ簭
- int commandStep = redisCommand.getCommandStep();
-
- //妫�娴嬫槸鍚﹀瓨鍦ㄦ彁鍗囨満鍙g殑鎸囦护
- List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands();
- if (commands.size() == 0) {
+ if (!liftProtocol.isIdle()) {
return false;
}
- if (!commands.get(commandStep).getMsgType().equals("move")) {
- return true;//涓嶆槸琛岃蛋鍛戒护锛岀洿鎺ユ斁琛�
+ if (liftProtocol.getLev().intValue() == Utils.getLev(shuttleProtocol.getCurrentLocNo())) {
+ return true;//鎻愬崌鏈鸿揪鍒板皬杞︽ゼ灞傦紝鏀捐
}
-
return false;//榛樿涓嶆斁琛�
}
--
Gitblit v1.9.1