From 314729da5f6f84a6112344a2210aadfeeb2bac0c Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 21 四月 2025 10:35:43 +0800
Subject: [PATCH] #出库找待机位优化
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java | 79 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
index 71b7906..cd23078 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -19,6 +19,7 @@
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
import com.zy.asrs.wcs.core.entity.Motion;
+import com.zy.asrs.wcs.rcs.entity.Device;
import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol;
@@ -59,6 +60,8 @@
private LiftAction liftAction;
@Autowired
private LiftDispatcher liftDispatcher;
+ @Autowired
+ private ShuttleDispatcher shuttleDispatcher;
// 璁$畻
public Boolean accept(Motion motion) {
@@ -71,7 +74,7 @@
if (null == shuttleProtocol) {
return false;
}
-
+ Device shuttleDevice = shuttleThread.getDevice();
if (!shuttleThread.isIdle(new ExecuteSupport() {
@Override
public Boolean judgement() {
@@ -162,7 +165,7 @@
// return false;
// }
- shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
+ shuttleCommands = this.shuttleInOutLiftCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO;
break;
case SHUTTLE_MOVE_TO_LIFT://杩涙彁鍗囨満
@@ -223,6 +226,21 @@
case SHUTTLE_UPDATE_LOCATION://灏忚溅鍧愭爣鏇存柊
shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_UPDATE_LOCATION;
shuttleCommands.add(shuttleThread.getUpdateLocationCommand(motion.getTaskNo(), motion.getTarget()));
+ break;
+ case SHUTTLE_MOVE_STANDBY://绌挎杞︾Щ鍔ㄥ埌寰呮満浣�
+ shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO;
+
+ //鑾峰彇鍏ㄩ儴寰呮満浣�
+ List<String> standbyLocs = JSON.parseArray(motion.getTemp(), String.class);
+ //鑾峰彇鍙敤寰呮満浣�
+ String shuttleFromLiftStandbyLoc = shuttleDispatcher.searchAvailableLocNo(Integer.valueOf(shuttleDevice.getDeviceNo()), shuttleDevice.getHostId(), shuttleThread.getStatus().getCurrentLocNo(), standbyLocs);
+ shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), shuttleFromLiftStandbyLoc, NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
+
+ //鏇存柊鍔ㄤ綔鍙敤寰呮満浣�
+ motion.setTarget(shuttleFromLiftStandbyLoc);
+ motion.setUpdateTime(new Date());
+ motionService.updateById(motion);
+
break;
default:
throw new CoolException(motion.getMotionCtgEl() + "娌℃湁鎸囧畾浠诲姟浣滀笟娴佺▼锛侊紒锛�");
@@ -450,5 +468,62 @@
return commands;
}
+ public synchronized List<ShuttleCommand> shuttleInOutLiftCommand(String startLocNo, String endLocNo, Integer mapType, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
+ NavigateNode startNode = NavigatePositionConvert.locNoToNode(startLocNo);
+ NavigateNode endNode = NavigatePositionConvert.locNoToNode(endLocNo);
+ List<NavigateNode> unlockPath = new ArrayList<>();
+ unlockPath.add(startNode);
+ unlockPath.add(endNode);
+
+ ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+
+ //鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹�/瑙i攣
+ boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(endLocNo), shuttleProtocol.getShuttleNo(), unlockPath, false);//鎵�浣跨敤鐨勮矾寰勮繘琛岃В閿�
+ if (!lockResult) {
+ News.error("{} dash {} can't find unlock path!", startLocNo, endLocNo);
+ return null;//瑙i攣澶辫触
+ }
+
+
+ //鑾峰彇灏忚溅绉诲姩閫熷害
+ Integer runSpeed = Optional.ofNullable(basShuttleService.getOne(new LambdaQueryWrapper<BasShuttle>().eq(BasShuttle::getDeviceId, assignCommand.getDeviceId())).getRunSpeed()).orElse(1000);
+ Long hostId = shuttleThread.getDevice().getHostId();
+ List<NavigateNode> nodeList = NavigateUtils.calc(startLocNo, endLocNo, mapType, Utils.getShuttlePoints(Integer.parseInt(shuttleThread.getDevice().getDeviceNo()), Utils.getLev(startLocNo)));
+ if (nodeList == null) {
+ News.error("{} dash {} can't find navigate path!", startLocNo, endLocNo);
+ return null;
+ }
+
+ List<NavigateNode> allNode = new ArrayList<>();
+ for (NavigateNode node : nodeList) {
+ allNode.add(node.clone());
+ }
+
+ List<ShuttleCommand> commands = new ArrayList<>();
+ //鑾峰彇鍒嗘璺緞
+ ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(nodeList);
+ //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
+ for (ArrayList<NavigateNode> nodes : data) {
+ //寮�濮嬭矾寰�
+ NavigateNode startPath = nodes.get(0);
+
+ //鐩爣璺緞
+ NavigateNode endPath = nodes.get(nodes.size() - 1);
+ Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+ //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+ String startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ(), hostId);
+ //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+ String distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ(), hostId);
+ //鑾峰彇绉诲姩鍛戒护
+ ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes);
+ command.setNodes(nodes);//灏嗚璧拌妭鐐规坊鍔犲埌姣忎竴姝ュ懡浠や腑
+ commands.add(command);
+ }
+
+ assignCommand.setNodes(allNode);//褰撳墠浠诲姟鎵�鍗犵敤鐨勮妭鐐筶ist
+
+ return commands;
+ }
+
}
--
Gitblit v1.9.1