From df8d94a8aba651ef299e2728a5dbd3f420b1302a Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 22 四月 2025 10:31:03 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java | 82 ++++++++++++++++++++++++++++++++++------
1 files changed, 69 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
index d8d6497..0fe2dd8 100644
--- a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
+++ b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
@@ -1,8 +1,14 @@
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;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NavigateNode;
@@ -45,6 +51,8 @@
private NavigateUtils navigateUtils;
@Autowired
private ConfigService configService;
+ @Autowired
+ private BasShuttleService basShuttleService;
/**
* 璋冨害杞﹁締-璋冨害鎸囧畾绌挎杞�
@@ -57,18 +65,6 @@
* 璋冨害杞﹁締
*/
public boolean dispatchShuttle(Integer wrkNo, String locNo) {
- //妫�娴嬬洰鏍囧簱浣嶇粍鏄惁瀛樺湪灏忚溅锛屽瀛樺湪灏忚溅鍒欑洿鎺ユ寚瀹氳杞�
- WrkMast wrkMast = wrkMastService.selectByWorkNo(wrkNo);
- if (wrkMast != null) {
- String targetLocNo = wrkMast.getIoType() < 100 ? wrkMast.getLocNo() : wrkMast.getSourceLocNo();
- List<String> groupLoc = Utils.getGroupLoc(targetLocNo);
- Integer groupShuttleNo = Utils.checkGroupLocHasShuttle(groupLoc);
- if (groupShuttleNo != null) {
- //瀛樺湪灏忚溅锛岀洿鎺ヨ皟搴﹁杞�
- return shuttleMoveGenerate(wrkNo, locNo, groupShuttleNo);
- }
- }
-
ArrayList<ShuttleThread> sameLev = new ArrayList<>();//鐩稿悓妤煎眰鐨勭┛姊溅
ArrayList<ShuttleThread> diffLev = new ArrayList<>();//涓嶅悓妤煎眰鐨勭┛姊溅
@@ -86,6 +82,13 @@
if (!shuttleThread.isIdle()) {
continue;//灏忚溅蹇欑涓�
+ }
+
+ BasShuttle basShuttle = basShuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", shuttle.getId()));
+ if (basShuttle != null) {
+ if (basShuttle.getStatus() == 0) {
+ continue;//灏忚溅琚鐢�
+ }
}
int currentLev = Utils.getLev(shuttleProtocol.getCurrentLocNo());//灏忚溅褰撳墠灞傞珮
@@ -236,7 +239,7 @@
News.info("{}鍙峰皬杞︼紝瀛樺湪鍏朵粬宸ヤ綔妗d换鍔★紝绛夊緟鎵ц瀹屾垚鍐嶇敓鎴愭柊鐨勪换鍔�", shuttleNo);
return false;
}else {
- if (!mainWrkMast.getShuttleNo().equals(shuttleNo)) {
+ if (!shuttleNo.equals(mainWrkMast.getShuttleNo())) {
News.info("{}鍙峰皬杞︼紝瀛樺湪鍏朵粬宸ヤ綔妗d换鍔★紝绛夊緟鎵ц瀹屾垚鍐嶇敓鎴愭柊鐨勪换鍔�", shuttleNo);
return false;
}
@@ -296,6 +299,36 @@
}
/**
+ * 灏忚溅闆嗗悎
+ */
+ 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();
+ if(Cools.isEmpty(idleLoc)) {
+ continue;
+ }
+
+ boolean result = shuttleMoveGenerate(null, idleLoc, basShuttle.getShuttleNo());
+
+ ShuttleGatherResult gatherResult = new ShuttleGatherResult();
+ gatherResult.setShuttleNo(basShuttle.getShuttleNo());
+ gatherResult.setIdleLoc(idleLoc);
+ gatherResult.setResult(result);
+ list.add(gatherResult);
+ }
+ return list;
+ }
+
+ /**
* 妫�娴嬬洰鏍囨ゼ灞傝溅鏁伴噺鏄惁灏忎簬鍏佽鐨勬渶澶ф暟閲�
* true: 灏忎簬鏈�澶ф暟閲� false: 澶т簬鎴栫瓑浜庢渶澶ф暟閲�
*/
@@ -313,6 +346,16 @@
ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+ continue;
+ }
+
+ //灏忚溅鏈夊厖鐢典换鍔�
+ if (shuttleThread.isCharging()) {
+ continue;
+ }
+
+ //灏忚溅鏁呴殰璺宠繃
+ if (shuttleThread.isFault()) {
continue;
}
@@ -387,6 +430,15 @@
continue;
}
+ //鍒ゆ柇褰撳墠灞傛槸鍚︽棤鎵樼洏
+ if (forkLiftStaProtocol.getHasTray()) {
+ continue;
+ }
+
+ if (forkLiftStaProtocol.getHasCar()) {
+ continue;
+ }
+
//鍒ゆ柇鐩爣妤煎眰绔欑偣鏄惁鏃犳墭鐩�
ForkLiftStaProtocol targetLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(slave.getId(), targetLev);
if (targetLiftStaProtocol == null) {
@@ -397,6 +449,10 @@
continue;//鏈夋墭鐩樿烦杩�
}
+ if (targetLiftStaProtocol.getHasCar()) {
+ continue;
+ }
+
list.add(forkLiftStaProtocol);
}
--
Gitblit v1.9.1