OutInfo.java
8.1 KB
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
package com.myproject.bean.update.qisda;
import com.myproject.bean.BaseMongoBean;
import com.myproject.util.StorageConstants;
import org.springframework.data.annotation.Transient;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
* DN单信息
*/
public class OutInfo extends BaseMongoBean {
public OutInfo(){
}
public OutInfo(OutItem outItem){
this.action = outItem.getAction();
this.hSerial = outItem.gethSerial();
this.so = outItem.getSo();
this.soseq = outItem.getSoseq();
this.refno = outItem.getRefno();
this.sdate = outItem.getSdate();
this.mdate = outItem.getMdate();
}
/**
* 动作(首盘,分盘,补料盘,急料,指定料,单独出库)
*/
private String action;
/**
* 需求单号
*/
private String hSerial;
/**
* 工单
*/
private String so;
/**
* 工单序号
*/
private String soseq;
/**
* 备料单号
*/
private String refno;
/**
* 建议出仓时间
*/
private Date sdate;
/**
* 必须出仓日期
*/
private Date mdate;
/**
* 任务数量
*/
private int taskNum;
/**
* 绑定状态:0=未绑定 1=绑定缺料 2=绑定OK
*/
private int bindStatus = StorageConstants.BIND_STATUS.NO_BIND;
/**
* 发料状态: 0=未发料 1=发料缺料 2=发料OK(需求单完成):首盘和补料,发料与需求单一致为发料OK, 分盘料出库后又入库即真实绑定与需求量一致为发料OK, 紧急料出库数量与需求数量一致为发料OK
*/
private int sendStatus = StorageConstants.SEND_STATUS.NEW;
/**
* 出仓料盘数量
*/
private int outReelNum;
/**
* 任务完成数量(放上料架)
*/
private int taskFinishNum;
/**
* 第一次执行的时间,如果为0表示未执行过,如果小于0表示要优先执行,越小越优先
*/
private long firstExecuteTime;
@Transient
private Map<String, OutItem> outItemMap = new HashMap<>();
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String gethSerial() {
return hSerial;
}
public void sethSerial(String hSerial) {
this.hSerial = hSerial;
}
public Date getMdate() {
return mdate;
}
public void setMdate(Date mdate) {
this.mdate = mdate;
}
public String getRefno() {
return refno;
}
public void setRefno(String refno) {
this.refno = refno;
}
public Date getSdate() {
return sdate;
}
public void setSdate(Date sdate) {
this.sdate = sdate;
}
public String getSo() {
return so;
}
public void setSo(String so) {
this.so = so;
}
public int getOutReelNum() {
return outReelNum;
}
public void setOutReelNum(int outReelNum) {
this.outReelNum = outReelNum;
}
public int getTaskNum() {
return taskNum;
}
public void setTaskNum(int taskNum) {
this.taskNum = taskNum;
}
public List<OutItem> getOutItems() {
return new ArrayList<>(outItemMap.values());
}
public void updateOutItems(List<OutItem> outItems) {
for (OutItem outItem : outItems) {
updateItem(outItem);
}
}
public OutItem findOutItem(int slotSeq){
for (OutItem outItem : getOutItems()) {
if(outItem.getSlotlocation() == slotSeq){
return outItem;
}
}
return null;
}
public OutItem findOutItemById(String outItemId){
return outItemMap.get(outItemId);
}
/**
* 分盘需求单
*/
public boolean isReelCutAction(){
return getAction().contains("分盘");
}
/**
* 紧急料或指定料或单独出库料
* @return
*/
public boolean isUrgentAction(){
return getAction().contains("急料") || getAction().contains("指定料") || getAction().contains("单独出库");
}
/**
* 首盘需求单
*/
public boolean isFirstReelAction(){
return getAction().contains("首盘");
}
/**
* 补料需求单
*/
public boolean isTailAction(){
return getAction().contains("补料");
}
public int getTaskFinishNum() {
return taskFinishNum;
}
public void setTaskFinishNum(int taskFinishNum) {
this.taskFinishNum = taskFinishNum;
}
/**
* 获取出库顺序,第一个为F,中间的为M,最后一个为L
*/
public String getOutLatest(){
if(taskNum == 1){
return "L";
}
if(outReelNum == 1){
return "F";
}
if(outReelNum >= taskNum){
return "L";
}
return "M";
}
/**
* 放上料架顺序
*/
public String getShelfLatest(){
if(taskNum == 1){
return "L";
}
if(taskFinishNum == 1){
return "F";
}
if(taskFinishNum >= taskNum){
return "L";
}
return "M";
}
public int getBindStatus() {
return bindStatus;
}
public void setBindStatus(int bindStatus) {
this.bindStatus = bindStatus;
}
/**
* 真实绑定OK
*/
public boolean isRealBindOk(){
return this.bindStatus == StorageConstants.BIND_STATUS.REAL_BIND_OK;
}
public boolean isRealBindLess(){
return this.bindStatus == StorageConstants.BIND_STATUS.REAL_BIND_LESS;
}
public int getSendStatus() {
return sendStatus;
}
/**
* 是否发料完成(不缺料)
*/
public boolean isSendEnd(){
return sendStatus == StorageConstants.SEND_STATUS.SEND_OK;
}
/**
* 是否已关闭
*/
public boolean isClosed(){
return sendStatus == StorageConstants.SEND_STATUS.CLOSED;
}
/**
* 是否本次任务执行完成
*/
public boolean isTaskEnd(){
return taskNum > 0 && taskFinishNum >= taskNum;
}
/**
* 是否正在执行
*/
public boolean isExecuting(){
return sendStatus == StorageConstants.SEND_STATUS.EXECUTING;
}
/**
* 是否是新的需求单
*/
public boolean isNew(){
return sendStatus == StorageConstants.SEND_STATUS.NEW;
}
/**
* 是否是发料缺料的需求单
*/
public boolean isSendLess(){
return sendStatus == StorageConstants.SEND_STATUS.SEND_LESS;
}
/**
* 是否是需要优先执行的
*/
public boolean isPriority(){
return firstExecuteTime < 0;
}
public void setSendStatus(int sendStatus) {
this.sendStatus = sendStatus;
}
public void updateItem(OutItem item){
outItemMap.put(item.getId(),item);
}
public Map<String, OutItem> getOutItemMap() {
return outItemMap;
}
public void setOutItemMap(Map<String, OutItem> outItemMap) {
this.outItemMap = outItemMap;
}
public String getSoseq() {
return soseq;
}
public void setSoseq(String soseq) {
this.soseq = soseq;
}
public long getFirstExecuteTime() {
return firstExecuteTime;
}
public void setFirstExecuteTime(long firstExecuteTime) {
this.firstExecuteTime = firstExecuteTime;
}
public boolean updateExecuteTime(long executeTime){
if(this.firstExecuteTime <= 0){
setFirstExecuteTime(executeTime);
return true;
}
return false;
}
@Override
public String toString() {
return "OutInfo{" +
"action='" + action + '\'' +
", hSerial='" + hSerial + '\'' +
", so='" + so + '\'' +
", refno='" + refno + '\'' +
", sdate=" + sdate +
", mdate=" + mdate +
", taskNum=" + taskNum +
", bindStatus=" + bindStatus +
", sendStatus=" + sendStatus +
", outReelNum=" + outReelNum +
", taskFinishNum=" + taskFinishNum +
'}';
}
}