From c7b3edb405149d76e0e71d7e754bd46c42b05eb3 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期六, 26 七月 2025 12:24:51 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/action/ShuttleAction.java | 94 ++++++++++++++++++++---------------------------
src/main/java/com/zy/core/enums/RedisKeyType.java | 2 -
2 files changed, 40 insertions(+), 56 deletions(-)
diff --git a/src/main/java/com/zy/core/action/ShuttleAction.java b/src/main/java/com/zy/core/action/ShuttleAction.java
index 2351a00..2fb9616 100644
--- a/src/main/java/com/zy/core/action/ShuttleAction.java
+++ b/src/main/java/com/zy/core/action/ShuttleAction.java
@@ -69,11 +69,6 @@
return false;
}
- //娓呯┖涓嬪彂绱㈠紩
- Set<String> keys = redisUtil.searchKeys(RedisKeyType.SHUTTLE_SEND_COMMAND_INDEX.key + shuttleNo);
- for (String key : keys) {
- redisUtil.del(key);
- }
//Clear Traffic Control
trafficControlThread.forceCancelTrafficControl(shuttleNo);
@@ -214,9 +209,6 @@
shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.WORKING);
- //瀛樺偍涓嬪彂鎸囦护绱㈠紩
- redisUtil.set(RedisKeyType.SHUTTLE_SEND_COMMAND_INDEX.key + shuttleNo + "_" + taskNo + "_" + commandStep, commandStep);
-
commandStep += 1;
//鏇存柊redis鏁版嵁
redisCommand.setCommandStep(commandStep);
@@ -257,69 +249,60 @@
return 0;
}
- //涓婁竴鏉℃寚浠�
- String searchKey = RedisKeyType.SHUTTLE_SEND_COMMAND_INDEX.key + shuttleNo + "_" + redisCommand.getWrkNo() + "_";
- Set<String> keys = redisUtil.searchKeys(searchKey);
- TreeSet<Integer> treeSet = new TreeSet<>();
- for (String key : keys) {
- String[] split = key.split(searchKey);
- treeSet.add(Integer.parseInt(split[1]));
+ boolean supportContinuously = false;
+ int checkIdx = commandStep - 2;
+ if (checkIdx < 0) {
+ checkIdx = commandStep - 1;
}
- if (treeSet.isEmpty()) {
- return 1;
+ ShuttleCommand last2Command = commands.get(checkIdx);
+ if(last2Command.getComplete()){
+ supportContinuously = true;
+ checkIdx = commandStep - 1;
}
- String firstKey = searchKey + treeSet.first();
- Integer lastCommandIdx = (Integer) redisUtil.get(firstKey);
- ShuttleCommand lastCommand = commands.get(lastCommandIdx);
+ ShuttleCommand lastCommand = commands.get(checkIdx);
if (!lastCommand.getComplete()) {
//妫�娴嬫洿鏂板懡浠ゅ畬鎴�
- boolean checked = updateCommandComplete(lastCommandIdx, commands, shuttleNo);
+ boolean checked = updateCommandComplete(checkIdx, commands, shuttleNo);
if (checked) {
- //鍒犻櫎绱㈠紩
- redisUtil.del(firstKey);
-
// 鏇存柊redis鏁版嵁
redisUtil.set(RedisKeyType.SHUTTLE_WORK_FLAG.key + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand, SerializerFeature.DisableCircularReferenceDetect));
}else {
//灏忚溅绉诲姩杩炵画涓嬪彂鎸囦护
if (assignCommand.getShuttleMoveCommandsContinuously()) {
- if (treeSet.size() <= 1) {
- if(commandStep >= commands.size()) {
- return 0;
- }
+ if (!supportContinuously) {
+ return 0;
+ }
- //绉诲姩鎸囦护
- if(lastCommand.getMode() != ShuttleCommandModeType.MOVE.id) {
- return 0;
- }
+ //绉诲姩鎸囦护
+ if(lastCommand.getMode() != ShuttleCommandModeType.MOVE.id) {
+ return 0;
+ }
- List<NavigateNode> nodes = lastCommand.getNodes();
- NavigateNode startNode = nodes.get(0);
- if (!startNode.getLinePartAllowGo()) {//鐩寸嚎娈甸儴鍒嗭紝鍏佽鐩存帴琛岃蛋
- return 0;
- }
+ List<NavigateNode> nodes = lastCommand.getNodes();
+ NavigateNode startNode = nodes.get(0);
+ if (!startNode.getLinePartAllowGo()) {//鐩寸嚎娈甸儴鍒嗭紝鍏佽鐩存帴琛岃蛋
+ return 0;
+ }
- //鐩寸嚎娈垫暟鎹爣璇�
- Long linePartFlag = startNode.getLinePartFlag();
+ //鐩寸嚎娈垫暟鎹爣璇�
+ Long linePartFlag = startNode.getLinePartFlag();
- //鍙栨寚浠�
- ShuttleCommand currentCommand = commands.get(commandStep);
- if(currentCommand.getMode() != ShuttleCommandModeType.MOVE.id) {
- return 0;
- }
+ //鍙栨寚浠�
+ ShuttleCommand currentCommand = commands.get(commandStep);
+ if(currentCommand.getMode() != ShuttleCommandModeType.MOVE.id) {
+ return 0;
+ }
- List<NavigateNode> currentNodes = currentCommand.getNodes();
- NavigateNode currentStartNode = currentNodes.get(0);
- if(!currentStartNode.getLinePartAllowGo()) {//鐩寸嚎娈甸儴鍒嗭紝鍏佽鐩存帴琛岃蛋
- return 0;
- }
+ List<NavigateNode> currentNodes = currentCommand.getNodes();
+ NavigateNode currentStartNode = currentNodes.get(0);
+ if(!currentStartNode.getLinePartAllowGo()) {//鐩寸嚎娈甸儴鍒嗭紝鍏佽鐩存帴琛岃蛋
+ return 0;
+ }
- if(currentStartNode.getLinePartFlag().equals(linePartFlag)) {
- //鏁版嵁鏍囪瘑涓�鑷�
- return 2;//鍏佽灏忚溅绉诲姩杩炵画涓嬪彂鎸囦护
- }
-
+ if(currentStartNode.getLinePartFlag().equals(linePartFlag)) {
+ //鏁版嵁鏍囪瘑涓�鑷�
+ return 2;//鍏佽灏忚溅绉诲姩杩炵画涓嬪彂鎸囦护
}
}
@@ -424,6 +407,9 @@
trafficControlThread.trafficReport(command.getNodesDeepCopy(), shuttleNo, shuttleProtocol.getTaskNo());
String currentLocNo = shuttleProtocol.getCurrentLocNo();
+ if (currentLocNo == null) {
+ return false;
+ }
if (targetPoints.contains(Utils.getRow(currentLocNo) + "-" + Utils.getBay(currentLocNo))) {
command.setComplete(true);
boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(shuttleProtocol.getCurrentLocNo()), shuttleProtocol.getShuttleNo(), nodes, false);//瑙i攣璺緞
diff --git a/src/main/java/com/zy/core/enums/RedisKeyType.java b/src/main/java/com/zy/core/enums/RedisKeyType.java
index 6ea31aa..002f68b 100644
--- a/src/main/java/com/zy/core/enums/RedisKeyType.java
+++ b/src/main/java/com/zy/core/enums/RedisKeyType.java
@@ -14,8 +14,6 @@
FORK_LIFT_PUT_COMPLETE("fork_lift_put_complete_"),
OUT_TASK_PREVIEW_DISPATCH_FORKLIFT("out_task_preview_dispatch_forklift_"),
- //灏忚溅涓嬪彂鎸囦护绱㈠紩
- SHUTTLE_SEND_COMMAND_INDEX("shuttle_send_command_index_"),
//灏忚溅閲嶆柊瑙勫垝璺緞棰戠巼
SHUTTLE_RESTART_CALC_PATH("shuttle_restart_calc_path_"),
--
Gitblit v1.9.1