From 3ca9c0654a81f0670e8005e405615da9f84edcc4 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 24 六月 2024 10:36:47 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java | 44 +++++++++++++++++++++++++++++++++-----------
1 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
index 85004c5..9648ec7 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -20,6 +20,7 @@
import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
import com.zy.asrs.wcs.rcs.service.DeviceService;
+import com.zy.asrs.wcs.rcs.thread.LiftThread;
import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
import com.zy.asrs.wcs.system.entity.Dict;
import com.zy.asrs.wcs.system.service.DictService;
@@ -86,6 +87,21 @@
continue;
}
+ BasShuttle basShuttle = basShuttleService.getOne(new LambdaQueryWrapper<BasShuttle>()
+ .eq(BasShuttle::getShuttleNo, device.getDeviceNo())
+ .eq(BasShuttle::getHostId, device.getHostId()));
+ if (basShuttle == null) {
+ continue;//灏忚溅鍩虹鏁版嵁涓嶅瓨鍦�
+ }
+
+ if (!Cools.isEmpty(basShuttle.getDisableLev())) {
+ List<Integer> disableLev = JSON.parseArray(basShuttle.getDisableLev(), Integer.class);
+ //妫�鏌ュ皬杞︽槸鍚︾鐢ㄨ妤煎眰
+ if (disableLev.contains(Utils.getLev(locNo))) {
+ continue;//灏忚溅绂佺敤璇ユゼ灞傝烦杩囪杞�
+ }
+ }
+
//妫�娴嬫槸鍚﹀瓨鍦ㄥ厖鐢典换鍔�
Task taskCharge = taskService.selectChargeWorking(Integer.valueOf(device.getDeviceNo()));
if (taskCharge != null) {
@@ -111,10 +127,12 @@
continue;
}
- Device recentTransferLift = Utils.getRecentTransferLift(locNo, Integer.parseInt(device.getDeviceNo()));
- if (recentTransferLift == null) {
+ //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑绌洪棽鍙崲灞傛彁鍗囨満
+ LiftThread liftThread = liftDispatcher.searchIdleLift(locNo, task.getHostId(), true);
+ if (liftThread == null) {
continue;
}
+ Device recentTransferLift = liftThread.getDevice();
//鑾峰彇灏忚溅妤煎眰鎻愬崌鏈哄緟鏈轰綅
ShuttleStandby shuttleStandby = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
@@ -143,7 +161,7 @@
}
// 鎸傝浇浠诲姟鏉冮噸
- List<Task> tasks = taskService.selectWorkingByShuttle(Integer.valueOf(device.getDeviceNo()));
+ List<Task> tasks = taskService.selectWorkingByShuttle(Integer.valueOf(device.getDeviceNo()), null);
if (!Cools.isEmpty(tasks)) {
currDistance += tasks.size() * WEIGHT;
}
@@ -284,20 +302,24 @@
}
int lev = Utils.getLev(locNo);//褰撳墠妤煎眰
- JSONArray standbyLoc = JSON.parseArray(idleLoc);
- if (lev > standbyLoc.size()) {
+ List<String> standbyLoc = JSON.parseArray(idleLoc, String.class);
+ if (standbyLoc.isEmpty()) {
throw new CoolException("閬胯鏁版嵁寮傚父");
}
-
- Object object = standbyLoc.get(lev - 1);
- List<String> locs = JSON.parseArray(object.toString(), String.class);
- if (locs.isEmpty()) {
- throw new CoolException("閬胯鏁版嵁涓虹┖");
+ //鑾峰彇褰撳墠灞傞伩璁╀綅缃�
+ List<String> currentLevStandByLoc = new ArrayList<>();
+ for (String loc : standbyLoc) {
+ if (Utils.getLev(loc) == lev) {
+ currentLevStandByLoc.add(loc);
+ }
+ }
+ if (currentLevStandByLoc.isEmpty()) {
+ throw new CoolException("褰撳墠灞傛棤閬胯浣嶇疆");
}
Integer finalDistance = ShuttleDispatcher.INF;
String recentLoc = null;
- for (String loc : locs) {
+ for (String loc : currentLevStandByLoc) {
//褰撳墠绌挎杞﹀埌閬胯浣嶈绠�
List<NavigateNode> currentShuttlePath = NavigateUtils.calc(
locNo
--
Gitblit v1.9.1