package com.zy.core.utils.station.model;
|
|
import com.zy.asrs.entity.BasDevp;
|
import com.zy.asrs.entity.WrkMast;
|
import com.zy.core.model.protocol.StationProtocol;
|
import com.zy.core.thread.StationThread;
|
import com.zy.core.utils.station.StationTaskIdleTrack;
|
|
import java.util.Collections;
|
import java.util.List;
|
|
public final class RerouteContext {
|
private final RerouteSceneType sceneType;
|
private final BasDevp basDevp;
|
private final StationThread stationThread;
|
private final StationProtocol stationProtocol;
|
private final WrkMast wrkMast;
|
private final List<Integer> outOrderStationIds;
|
private final Double pathLenFactor;
|
private final String dispatchScene;
|
private Integer dispatchDeviceNo;
|
private boolean useRunBlockCommand;
|
private boolean checkSuppressDispatch;
|
private boolean requireOutOrderDispatchLock;
|
private boolean cancelSessionBeforeDispatch;
|
private boolean resetSegmentCommandsBeforeDispatch;
|
private boolean clearIdleIssuedCommands;
|
private boolean checkRecentDispatch;
|
private String executionLockKey;
|
private int executionLockSeconds;
|
private StationTaskIdleTrack idleTrack;
|
|
private RerouteContext(RerouteSceneType sceneType,
|
BasDevp basDevp,
|
StationThread stationThread,
|
StationProtocol stationProtocol,
|
WrkMast wrkMast,
|
List<Integer> outOrderStationIds,
|
Double pathLenFactor,
|
String dispatchScene) {
|
this.sceneType = sceneType;
|
this.basDevp = basDevp;
|
this.stationThread = stationThread;
|
this.stationProtocol = stationProtocol;
|
this.wrkMast = wrkMast;
|
this.outOrderStationIds = outOrderStationIds == null ? Collections.emptyList() : outOrderStationIds;
|
this.pathLenFactor = pathLenFactor;
|
this.dispatchScene = dispatchScene;
|
this.dispatchDeviceNo = basDevp == null ? null : basDevp.getDevpNo();
|
}
|
|
public static RerouteContext create(RerouteSceneType sceneType,
|
BasDevp basDevp,
|
StationThread stationThread,
|
StationProtocol stationProtocol,
|
WrkMast wrkMast,
|
List<Integer> outOrderStationIds,
|
Double pathLenFactor,
|
String dispatchScene) {
|
return new RerouteContext(sceneType, basDevp, stationThread, stationProtocol, wrkMast, outOrderStationIds, pathLenFactor, dispatchScene);
|
}
|
|
public RerouteContext withDispatchDeviceNo(Integer dispatchDeviceNo) {
|
this.dispatchDeviceNo = dispatchDeviceNo;
|
return this;
|
}
|
|
public RerouteContext withRunBlockCommand() {
|
this.useRunBlockCommand = true;
|
return this;
|
}
|
|
public RerouteContext withSuppressDispatchGuard() {
|
this.checkSuppressDispatch = true;
|
return this;
|
}
|
|
public RerouteContext withOutOrderDispatchLock() {
|
this.requireOutOrderDispatchLock = true;
|
return this;
|
}
|
|
public RerouteContext withCancelSessionBeforeDispatch() {
|
this.cancelSessionBeforeDispatch = true;
|
return this;
|
}
|
|
public RerouteContext withResetSegmentCommandsBeforeDispatch() {
|
this.resetSegmentCommandsBeforeDispatch = true;
|
return this;
|
}
|
|
public RerouteContext clearIdleIssuedCommands(StationTaskIdleTrack idleTrack) {
|
this.clearIdleIssuedCommands = true;
|
this.idleTrack = idleTrack;
|
return this;
|
}
|
|
public RerouteContext withRecentDispatchGuard() {
|
this.checkRecentDispatch = true;
|
return this;
|
}
|
|
public RerouteContext withExecutionLock(String executionLockKey, int executionLockSeconds) {
|
this.executionLockKey = executionLockKey;
|
this.executionLockSeconds = executionLockSeconds;
|
return this;
|
}
|
|
public RerouteSceneType sceneType() {
|
return sceneType;
|
}
|
|
public BasDevp basDevp() {
|
return basDevp;
|
}
|
|
public StationThread stationThread() {
|
return stationThread;
|
}
|
|
public StationProtocol stationProtocol() {
|
return stationProtocol;
|
}
|
|
public WrkMast wrkMast() {
|
return wrkMast;
|
}
|
|
public List<Integer> outOrderStationIds() {
|
return outOrderStationIds;
|
}
|
|
public Double pathLenFactor() {
|
return pathLenFactor;
|
}
|
|
public String dispatchScene() {
|
return dispatchScene;
|
}
|
|
public Integer dispatchDeviceNo() {
|
return dispatchDeviceNo;
|
}
|
|
public boolean useRunBlockCommand() {
|
return useRunBlockCommand;
|
}
|
|
public boolean checkSuppressDispatch() {
|
return checkSuppressDispatch;
|
}
|
|
public boolean requireOutOrderDispatchLock() {
|
return requireOutOrderDispatchLock;
|
}
|
|
public boolean cancelSessionBeforeDispatch() {
|
return cancelSessionBeforeDispatch;
|
}
|
|
public boolean resetSegmentCommandsBeforeDispatch() {
|
return resetSegmentCommandsBeforeDispatch;
|
}
|
|
public boolean clearIdleIssuedCommands() {
|
return clearIdleIssuedCommands;
|
}
|
|
public boolean checkRecentDispatch() {
|
return checkRecentDispatch;
|
}
|
|
public String executionLockKey() {
|
return executionLockKey;
|
}
|
|
public int executionLockSeconds() {
|
return executionLockSeconds;
|
}
|
|
public StationTaskIdleTrack idleTrack() {
|
return idleTrack;
|
}
|
}
|