| | |
| | | return true; |
| | | } |
| | | |
| | | List<WrkMast> unfinishedBatchWrkMasts = listUnfinishedBatchWrkMasts(wrkMast.getBatch()); |
| | | if (hasMissingBatchSeq(unfinishedBatchWrkMasts)) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "批次:{} 存在未配置批次序号的未完成任务,暂不允许堆垛机出库", wrkMast.getBatch()); |
| | | return false; |
| | | } |
| | | |
| | | if (!isWithinBatchExecuteWindow(wrkMast, unfinishedBatchWrkMasts, batchRunningLimit)) { |
| | | Integer windowStartSeq = unfinishedBatchWrkMasts.get(0).getBatchSeq(); |
| | | Integer windowEndSeq = unfinishedBatchWrkMasts.get(Math.min(batchRunningLimit, unfinishedBatchWrkMasts.size()) - 1).getBatchSeq(); |
| | | News.taskInfo(wrkMast.getWrkNo(), |
| | | "批次:{} 当前严格执行窗口序号为[{}-{}],当前序号={},暂不允许堆垛机出库", |
| | | wrkMast.getBatch(), |
| | | windowStartSeq, |
| | | windowEndSeq, |
| | | wrkMast.getBatchSeq()); |
| | | return false; |
| | | } |
| | | |
| | | long batchRunningCount = wrkMastService.count(new QueryWrapper<WrkMast>() |
| | | .eq("io_type", WrkIoType.OUT.id) |
| | | .eq("batch", wrkMast.getBatch()) |
| | |
| | | return true; |
| | | } |
| | | |
| | | private List<WrkMast> listUnfinishedBatchWrkMasts(String batch) { |
| | | if (Cools.isEmpty(batch)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return wrkMastService.list(new QueryWrapper<WrkMast>() |
| | | .eq("io_type", WrkIoType.OUT.id) |
| | | .eq("batch", batch) |
| | | .notIn("wrk_sts", |
| | | WrkStsType.COMPLETE_OUTBOUND.sts, |
| | | WrkStsType.SETTLE_OUTBOUND.sts) |
| | | .orderByAsc("batch_seq") |
| | | .orderByAsc("wrk_no")); |
| | | } |
| | | |
| | | private boolean hasMissingBatchSeq(List<WrkMast> wrkMasts) { |
| | | if (wrkMasts == null || wrkMasts.isEmpty()) { |
| | | return false; |
| | | } |
| | | for (WrkMast item : wrkMasts) { |
| | | if (item == null || Cools.isEmpty(item.getBatchSeq())) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private boolean isWithinBatchExecuteWindow(WrkMast wrkMast, List<WrkMast> unfinishedBatchWrkMasts, int batchRunningLimit) { |
| | | if (wrkMast == null || unfinishedBatchWrkMasts == null || unfinishedBatchWrkMasts.isEmpty()) { |
| | | return true; |
| | | } |
| | | int windowSize = Math.min(batchRunningLimit, unfinishedBatchWrkMasts.size()); |
| | | for (int i = 0; i < windowSize; i++) { |
| | | WrkMast current = unfinishedBatchWrkMasts.get(i); |
| | | if (current != null && wrkMast.getWrkNo().equals(current.getWrkNo())) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private boolean isOutboundStationTaskLimitReached() { |
| | | int stationMaxTaskCount = getSystemConfigInt("stationMaxTaskCountLimit", 30); |
| | | if (stationMaxTaskCount <= 0) { |