OutInfo.java
11.4 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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
package com.myproject.bean.update.qisda;
import com.myproject.bean.BaseMongoBean;
import com.myproject.util.StorageConstants;
import org.apache.logging.log4j.util.Strings;
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.line = outItem.getLine();
this.refno = outItem.getRefno();
this.sdate = outItem.getSdate();
Date needOutDate = new Date();
if(this.sdate.after(needOutDate)){
needOutDate = this.sdate;
}
this.taskNeedOutDate = needOutDate;
this.mdate = outItem.getMdate();
this.endOutInfo = outItem.isTheEndOutInfo();
}
/**
* 动作(首盘,分盘,补料盘,急料,指定料,单独出库)
*/
private String action;
/**
* 需求单号
*/
private String hSerial;
/**
* 工单
*/
private String so;
/**
* 工单序号
*/
private String soseq;
/**
* 备料单号
*/
private String refno;
/**
* 建议出仓时间
*/
private Date sdate;
/**
* 必须出仓日期
*/
private Date mdate;
/**
* 任务数量
*/
private int taskNum;
/**
* 累计任务数量
*/
private int totalTaskNum;
/**
* 预估出库料盘数量
*/
private int totalBindNum;
/**
* 产线位置
*/
private String line;
/**
* 绑定状态: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;
/**
* 上次任务完成时间
*/
private long taskEndTime;
/**
* 需求单应该出库时间,通常为建议时间,当收到时间在建议时间之后,使用收到时间
*/
private Date taskNeedOutDate;
/**
* 是否为工单的最后一个需求单
*/
private boolean endOutInfo = false;
@Transient
private String lineBindShelfInfo = "";
@Transient
private Map<String, OutItem> outItemMap = new HashMap<>();
public Set<String> getMergehSerials() {
return mergehSerials;
}
public void setMergehSerials(Set<String> mergehSerials) {
this.mergehSerials = mergehSerials;
}
private Set<String> mergehSerials=new HashSet<>();
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("单独出库") || isCheckAction();
}
public boolean isPnAction(){
return getAction().contains("PN");
}
/**
* 首盘需求单
*/
public boolean isFirstReelAction(){
return getAction().contains("首盘");
}
/**
* 补料需求单
*/
public boolean isTailAction(){
return getAction().contains("补料");
}
/**
* 是否是预补料需求单
* @return
*/
public boolean isPreTailAction(){
return getAction().contains("预补料");
}
/**
* 盘点出库需求单
*/
public boolean isCheckAction(){
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(String status){
if("E".equalsIgnoreCase(status)){
if(taskNum == 1){
return "EL";
}
if(taskFinishNum >= taskNum){
return "EL";
}
return "E";
}
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 updateFirstExecuteTime(long executeTime){
if(this.firstExecuteTime <= 0){
setFirstExecuteTime(executeTime);
return true;
}
return false;
}
public long getTaskEndTime() {
return taskEndTime;
}
public void setTaskEndTime(long taskEndTime) {
this.taskEndTime = taskEndTime;
}
public Date getFirstExecuteDate(){
if(firstExecuteTime > 0){
return new Date(firstExecuteTime);
}
return null;
}
public Date getTaskEndDate(){
if(taskEndTime > 0){
return new Date(taskEndTime);
}
return null;
}
public int getTotalTaskNum() {
return totalTaskNum;
}
public void setTotalTaskNum(int totalTaskNum) {
this.totalTaskNum = totalTaskNum;
}
public String getLine() {
return line;
}
public void setLine(String line) {
this.line = line;
}
public int getTotalBindNum() {
return totalBindNum;
}
public void setTotalBindNum(int totalBindNum) {
this.totalBindNum = totalBindNum;
}
public Date getTaskNeedOutDate() {
return taskNeedOutDate;
}
public void setTaskNeedOutDate(Date taskNeedOutDate) {
this.taskNeedOutDate = taskNeedOutDate;
}
public boolean isEndOutInfo() {
return endOutInfo;
}
public void setEndOutInfo(boolean endOutInfo) {
this.endOutInfo = endOutInfo;
}
public String getLineBindShelfInfo() {
return lineBindShelfInfo;
}
public void setLineBindShelfInfo(String lineBindShelfInfo) {
this.lineBindShelfInfo = lineBindShelfInfo;
}
@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 +
'}';
}
}