| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | public void submitCrnStationOutTasks(MainProcessLane lane, long minIntervalMs) { |
| | | List<WrkMast> wrkMasts = wrkMastService.list(new QueryWrapper<WrkMast>() |
| | | .eq("wrk_sts", WrkStsType.OUTBOUND_RUN_COMPLETE.sts) |
| | | .isNotNull("crn_no")); |
| | | .isNotNull("crn_no") |
| | | .orderByAsc("io_time", "wrk_no")); |
| | | MainProcessLane pendingConfirmLane = resolveStationOutPendingConfirmLane(lane); |
| | | LinkedHashSet<Integer> sourceStationIdSet = new LinkedHashSet<>(); |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | Integer laneKey = wrkMast == null ? null : wrkMast.getSourceStaNo(); |
| | | if (laneKey == null) { |
| | | laneKey = wrkMast == null ? null : wrkMast.getWrkNo(); |
| | | if (wrkMast == null || wrkMast.getWrkNo() == null) { |
| | | continue; |
| | | } |
| | | mainProcessTaskSubmitter.submitKeyedSerialTask( |
| | | lane, |
| | | laneKey, |
| | | "crnStationOutExecute", |
| | | pendingConfirmLane, |
| | | wrkMast.getWrkNo(), |
| | | "confirmPendingCrnStationOutDispatch", |
| | | minIntervalMs, |
| | | () -> crnStationOutExecute(wrkMast) |
| | | () -> stationOutboundDispatchProcessor.confirmPendingCrnStationOutDispatch(wrkMast) |
| | | ); |
| | | if (wrkMast.getSourceStaNo() != null) { |
| | | sourceStationIdSet.add(wrkMast.getSourceStaNo()); |
| | | } |
| | | } |
| | | for (Integer sourceStationId : sourceStationIdSet) { |
| | | mainProcessTaskSubmitter.submitKeyedSerialTask( |
| | | lane, |
| | | sourceStationId, |
| | | "dispatchNextCrnStationOutTask", |
| | | minIntervalMs, |
| | | () -> stationOutboundDispatchProcessor.dispatchNextCrnStationOutTask(sourceStationId) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | private MainProcessLane resolveStationOutPendingConfirmLane(MainProcessLane lane) { |
| | | if (lane == MainProcessLane.FAKE_STATION_OUT) { |
| | | return MainProcessLane.FAKE_STATION_OUT_PENDING_CONFIRM; |
| | | } |
| | | return MainProcessLane.STATION_OUT_PENDING_CONFIRM; |
| | | } |
| | | |
| | | public void submitDualCrnStationOutTasks(long minIntervalMs) { |
| | | submitDualCrnStationOutTasks(MainProcessLane.DUAL_STATION_OUT, minIntervalMs); |
| | | } |