#
Junjie
2 天以前 90402710d962aa357062ecb94649e0f277c1dfb3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
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;
    }
}