From bf089236f2d2350dc515dbecf04178861d1f5089 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期一, 17 十一月 2025 13:12:27 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java | 45 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
index aa97604..5a1e9e3 100644
--- a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
+++ b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
@@ -1,9 +1,11 @@
package com.zy.core.dispatcher;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.domain.ShuttleGatherResult;
+import com.zy.asrs.domain.param.ShuttleGatherParam;
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.BasShuttleService;
@@ -55,14 +57,14 @@
/**
* 璋冨害杞﹁締-璋冨害鎸囧畾绌挎杞�
*/
- public boolean dispatchShuttle(Integer wrkNo, String locNo, Integer shuttleNo) {
+ public synchronized boolean dispatchShuttle(Integer wrkNo, String locNo, Integer shuttleNo) {
return shuttleMoveGenerate(wrkNo, locNo, shuttleNo);
}
/**
* 璋冨害杞﹁締
*/
- public boolean dispatchShuttle(Integer wrkNo, String locNo) {
+ public synchronized boolean dispatchShuttle(Integer wrkNo, String locNo) {
ArrayList<ShuttleThread> sameLev = new ArrayList<>();//鐩稿悓妤煎眰鐨勭┛姊溅
ArrayList<ShuttleThread> diffLev = new ArrayList<>();//涓嶅悓妤煎眰鐨勭┛姊溅
@@ -166,9 +168,16 @@
//褰撳墠绌挎杞﹀簱浣嶅彿
String currentLocNo = shuttleProtocol.getCurrentLocNo();
int currentLev = Utils.getLev(currentLocNo);
- List<WrkMast> wrkMasts1 = wrkMastService.selectNoShuttleWrkByLev(currentLev);//鍒ゆ柇褰撳墠绌挎杞︽ゼ灞傛槸鍚︽湁寰呭垎閰嶈溅杈嗙殑浠诲姟锛屽鏋滄湁鍒欎笉鍒嗛厤杩欒締杞�
+ //鍒ゆ柇褰撳墠妤煎眰鏄惁鏈変换鍔★紝濡傛灉鏈夊垯涓嶅垎閰嶈繖杈嗚溅
+ List<WrkMast> wrkMasts1 = wrkMastService.selectWrkByLev(currentLev);
+ int currentLevTaskCount = wrkMasts1.size();
+ for (WrkMast wrkMast : wrkMasts1) {
+ if (wrkMast.getIoType() == WrkIoType.SHUTTLE_CHARGE.id) {
+ currentLevTaskCount--;
+ }
+ }
int shuttleCount = this.getShuttleCountByLev(currentLev);//鑾峰彇绌挎杞︽ゼ灞傝溅杈嗘暟閲�
- if (!wrkMasts1.isEmpty() && shuttleCount <= 1) {
+ if (currentLevTaskCount > 0 && shuttleCount <= 1) {
//瀛樺湪鍏朵粬浠诲姟涓斿彲鐢ㄥ皬杞︽暟閲忓皬浜庣瓑浜�1锛岃烦杩囪繖杈嗚溅
continue;
}
@@ -200,7 +209,7 @@
* 灏忚溅杩佺Щ浠诲姟鐢熸垚
*/
@Transactional
- public boolean shuttleMoveGenerate(Integer wrkNo, String locNo, Integer shuttleNo) {
+ public synchronized boolean shuttleMoveGenerate(Integer wrkNo, String locNo, Integer shuttleNo) {
Date now = new Date();
//鑾峰彇鍥涘悜绌挎杞︾嚎绋�
ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
@@ -237,7 +246,7 @@
News.info("{}鍙峰皬杞︼紝瀛樺湪鍏朵粬宸ヤ綔妗d换鍔★紝绛夊緟鎵ц瀹屾垚鍐嶇敓鎴愭柊鐨勪换鍔�", shuttleNo);
return false;
}else {
- if (!mainWrkMast.getShuttleNo().equals(shuttleNo)) {
+ if (!shuttleNo.equals(mainWrkMast.getShuttleNo())) {
News.info("{}鍙峰皬杞︼紝瀛樺湪鍏朵粬宸ヤ綔妗d换鍔★紝绛夊緟鎵ц瀹屾垚鍐嶇敓鎴愭柊鐨勪换鍔�", shuttleNo);
return false;
}
@@ -299,8 +308,15 @@
/**
* 灏忚溅闆嗗悎
*/
- public List<ShuttleGatherResult> shuttleGather() {
- List<BasShuttle> basShuttles = basShuttleService.selectList(new EntityWrapper<BasShuttle>().eq("status", 1));
+ public List<ShuttleGatherResult> shuttleGather(ShuttleGatherParam param) {
+ Wrapper<BasShuttle> wrapper = new EntityWrapper<BasShuttle>().eq("status", 1);
+ if (param != null) {
+ if (!param.getShuttleNos().isEmpty()) {
+ wrapper.in("shuttle_no", param.getShuttleNos());
+ }
+ }
+
+ List<BasShuttle> basShuttles = basShuttleService.selectList(wrapper);
List<ShuttleGatherResult> list = new ArrayList<>();
for (BasShuttle basShuttle : basShuttles) {
String idleLoc = basShuttle.getIdleLoc();
@@ -421,6 +437,15 @@
continue;
}
+ //鍒ゆ柇褰撳墠灞傛槸鍚︽棤鎵樼洏
+ if (forkLiftStaProtocol.getHasTray()) {
+ continue;
+ }
+
+ if (forkLiftStaProtocol.getHasCar()) {
+ continue;
+ }
+
//鍒ゆ柇鐩爣妤煎眰绔欑偣鏄惁鏃犳墭鐩�
ForkLiftStaProtocol targetLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(slave.getId(), targetLev);
if (targetLiftStaProtocol == null) {
@@ -431,6 +456,10 @@
continue;//鏈夋墭鐩樿烦杩�
}
+ if (targetLiftStaProtocol.getHasCar()) {
+ continue;
+ }
+
list.add(forkLiftStaProtocol);
}
--
Gitblit v1.9.1