From cc5b5daacf92ac5601370c50463237b34b7ba78f Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 02 四月 2026 18:57:54 +0800
Subject: [PATCH] #预调度堆垛机2
---
src/main/java/com/zy/asrs/task/InboundCrnMoveDispatchScheduler.java | 65 ++------------------------------
1 files changed, 4 insertions(+), 61 deletions(-)
diff --git a/src/main/java/com/zy/asrs/task/InboundCrnMoveDispatchScheduler.java b/src/main/java/com/zy/asrs/task/InboundCrnMoveDispatchScheduler.java
index 0be9284..fcb9863 100644
--- a/src/main/java/com/zy/asrs/task/InboundCrnMoveDispatchScheduler.java
+++ b/src/main/java/com/zy/asrs/task/InboundCrnMoveDispatchScheduler.java
@@ -18,8 +18,6 @@
import com.zy.core.enums.WrkStsType;
import com.zy.core.model.StationObjModel;
import com.zy.core.model.protocol.StationProtocol;
-import com.zy.core.move.StationMoveCoordinator;
-import com.zy.core.move.StationMoveSession;
import com.zy.core.thread.StationThread;
import com.zy.core.utils.CrnOperateProcessUtils;
import com.zy.common.utils.RedisUtil;
@@ -32,7 +30,6 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Set;
import java.util.stream.Collectors;
@Component
@@ -43,7 +40,6 @@
private final CommonService commonService;
private final BasCrnpService basCrnpService;
private final CrnOperateProcessUtils crnOperateProcessUtils;
- private final StationMoveCoordinator stationMoveCoordinator;
private final RedisUtil redisUtil;
public InboundCrnMoveDispatchScheduler(WrkMastService wrkMastService,
@@ -51,14 +47,12 @@
CommonService commonService,
BasCrnpService basCrnpService,
CrnOperateProcessUtils crnOperateProcessUtils,
- StationMoveCoordinator stationMoveCoordinator,
RedisUtil redisUtil) {
this.wrkMastService = wrkMastService;
this.basStationService = basStationService;
this.commonService = commonService;
this.basCrnpService = basCrnpService;
this.crnOperateProcessUtils = crnOperateProcessUtils;
- this.stationMoveCoordinator = stationMoveCoordinator;
this.redisUtil = redisUtil;
}
@@ -124,18 +118,8 @@
News.info("妫�娴嬪埌浠呮湁鍏ュ簱浠诲姟锛屽凡瑙﹀彂鍫嗗灈鏈虹洿鎺ョЩ鍔ㄥ埌鍏ュ簱浠诲姟鍙栬揣浣嶇瓑寰咃紝宸ヤ綔鍙�={}锛屽爢鍨涙満鍙�={}锛屽彇璐т綅={}",
wrkMast.getWrkNo(), crnNo, inboundPickupLocNo);
}
- return;
- }
-
- StationMoveSession session = stationMoveCoordinator == null ? null : stationMoveCoordinator.loadSession(wrkMast.getWrkNo());
- if (!isInboundCrnMoveDispatchWindow(wrkMast, session)) {
- return;
- }
-
- boolean dispatched = crnOperateProcessUtils.dispatchCrnMove(crnNo, inboundPickupLocNo);
- if (dispatched) {
- News.info("鍏ュ簱浠诲姟鍗冲皢鍒拌揪鍙栬揣浣嶏紝宸茶Е鍙戝爢鍨涙満棰勭Щ杞︼紝宸ヤ綔鍙�={}锛屽爢鍨涙満鍙�={}锛屽彇璐т綅={}",
- wrkMast.getWrkNo(), crnNo, inboundPickupLocNo);
+ } else {
+ News.taskInfo(wrkMast.getWrkNo(), "褰撳墠瀛樺湪闃诲鍏ュ簱棰勭Щ杞︾殑鍑哄簱浠诲姟锛屾殏涓嶈Е鍙戝爢鍨涙満棰勭Щ杞�");
}
}
@@ -180,32 +164,12 @@
return true;
}
- String activeBatch = resolveActiveOutboundBatch(pendingOutboundTasks);
- if (Cools.isEmpty(activeBatch)) {
- return true;
- }
-
return pendingOutboundTasks.stream()
.filter(this::isBatchTaskWithSeq)
.filter(task -> isWithinCurrentBatchExecuteWindow(task, pendingOutboundTasks))
.filter(this::isCrnMoveBlockingOutboundTask)
- .anyMatch(task -> Objects.equals(activeBatch, task.getBatch()));
- }
-
- private String resolveActiveOutboundBatch(List<WrkMast> pendingOutboundTasks) {
- if (pendingOutboundTasks == null || pendingOutboundTasks.isEmpty()) {
- return null;
- }
- Set<String> activeBatchSet = pendingOutboundTasks.stream()
- .filter(this::isBatchTaskWithSeq)
- .filter(task -> !Objects.equals(task.getWrkSts(), WrkStsType.NEW_OUTBOUND.sts))
- .map(WrkMast::getBatch)
- .filter(batch -> !Cools.isEmpty(batch))
- .collect(Collectors.toSet());
- if (activeBatchSet.size() != 1) {
- return null;
- }
- return activeBatchSet.iterator().next();
+ .findAny()
+ .isPresent();
}
private boolean isBatchTaskWithSeq(WrkMast wrkMast) {
@@ -261,26 +225,5 @@
} catch (Exception ignore) {
return defaultValue;
}
- }
-
- private boolean isInboundCrnMoveDispatchWindow(WrkMast wrkMast, StationMoveSession session) {
- if (wrkMast == null || session == null || !session.isActive() || wrkMast.getStaNo() == null) {
- return false;
- }
- List<Integer> fullPathStationIds = session.getFullPathStationIds();
- Integer currentStationId = session.getCurrentStationId();
- if (fullPathStationIds == null || fullPathStationIds.isEmpty() || currentStationId == null) {
- return false;
- }
- int currentIndex = fullPathStationIds.lastIndexOf(currentStationId);
- if (currentIndex < 0 || currentIndex >= fullPathStationIds.size() - 1) {
- return false;
- }
- int remainingStationCount = fullPathStationIds.size() - currentIndex - 1;
- if (remainingStationCount != 1) {
- return false;
- }
- Integer nextStationId = fullPathStationIds.get(currentIndex + 1);
- return Objects.equals(nextStationId, wrkMast.getStaNo());
}
}
--
Gitblit v1.9.1