MesController.java
26.9 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
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
package com.huaheng.api.mes.controller;
import com.huaheng.api.mes.domain.*;
import com.huaheng.api.mes.service.MesService;
import com.huaheng.common.constant.QuantityConstant;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.framework.web.domain.AjaxResultMES;
import com.huaheng.pc.task.taskHeader.service.WorkTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
/**
* @author 游杰
*/
@RestController
@RequestMapping("/API/WMS/v2")
public class MesController extends BaseController {
@Resource
private WorkTaskService workTaskService;
@Resource
private MesService mesService;
/**
* 生成空托盘入库任务
* 7 料点呼叫移走空载具
*
* @return
*/
@PostMapping("/receiptEmptyContainer")
@ApiOperation("生成空托盘入库任务")
@ApiLogger(apiName = "7 生成空托盘入库任务", from = "MES")
public AjaxResult receiptEmptyContainer(@RequestBody MesEmptyContainer mesEmptyContainer) {
String taskNo = mesEmptyContainer.getTaskNo();
String orderCode = mesEmptyContainer.getOrderCode();
String fromPort = mesEmptyContainer.getFromPort();
// 交换载具和盛具的值
String containerTypeCode = mesEmptyContainer.getVehicleTypeCode();
String containerCode = mesEmptyContainer.getVehicleCode();
String vehicleTypeCode = mesEmptyContainer.getContainerTypeCode();
String vehicleCode = mesEmptyContainer.getContainerCode();
boolean isEmptyVehBack = mesEmptyContainer.getIsEmptyVehBack() == 1;
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("vehicleCode 为空");
}
if (StringUtils.isEmpty(orderCode)) {
return AjaxResult.error("orderCode 为空");
}
if (StringUtils.isEmpty(containerTypeCode)) {
return AjaxResult.error("containerTypeCode 为空");
}
if (StringUtils.isEmpty(taskNo)) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(fromPort)) {
return AjaxResult.error("fromPort 为空");
}
if (!isEmptyVehBack && StringUtils.isEmpty(vehicleTypeCode)) {
return AjaxResult.error("containerTypeCode 为空");
}
if (!isEmptyVehBack && StringUtils.isEmpty(vehicleCode)) {
return AjaxResult.error("containerCode 为空");
}
// 因MES传的载具和盛具码是反的,此处交换载具与盛具的值 反着入参
return handleMultiProcess(() -> workTaskService.createEmptyIn(
taskNo, fromPort, orderCode, containerCode, vehicleCode, null));
}
/**
* 5 MES下发空托盘出库
*
* @return
*/
@PostMapping("/shipmentEmptyContainer")
@ApiOperation("MES下发空托盘出库")
@ApiLogger(apiName = "5 MES下发空托盘出库", from = "MES")
public AjaxResult shipmentEmptyContainer(@RequestBody MesEmptyContainer mesEmptyContainer) {
String taskNo = mesEmptyContainer.getTaskNo();
String orderCode = mesEmptyContainer.getOrderCode();
String toPort = mesEmptyContainer.getToPort();
String containerTypeCode = mesEmptyContainer.getContainerTypeCode();
String vehicleTypeCode = mesEmptyContainer.getVehicleTypeCode();
if (StringUtils.isEmpty(containerTypeCode)) {
return AjaxResult.error("containerTypeCode 为空");
}
if (StringUtils.isEmpty(taskNo)) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(toPort)) {
return AjaxResult.error("toPort 为空");
}
if (StringUtils.isEmpty(vehicleTypeCode)) {
return AjaxResult.error("vehicleTypeCode 为空");
}
if (StringUtils.isEmpty(orderCode)) {
return AjaxResult.error("orderCode 为空");
}
// 载具与盛具和MES那边定义是反的,故WMS交换值
String temp = containerTypeCode;
containerTypeCode = vehicleTypeCode;
vehicleTypeCode = temp;
String finalContainerTypeCode = containerTypeCode;
String finalVehicleTypeCode = vehicleTypeCode;
return handleMultiProcess(() -> workTaskService.shipmentEmptyContainer(
taskNo, orderCode, toPort, finalContainerTypeCode, finalVehicleTypeCode));
}
/**
* 1 MES查询库存
*
* @return
*/
@PostMapping("/searchInventory")
@ApiOperation("MES查询库存")
@ApiLogger(apiName = "1 MES查询库存", from = "MES")
public AjaxResultMES searchInventory(@RequestBody MesSearch mesSearch) {
String taskNo = mesSearch.getTaskNo();
List<MaterialDataQuery> list = mesSearch.getMaterialDataList();
if (StringUtils.isEmpty(taskNo)) {
return AjaxResultMES.error("taskNo 为空");
}
if (StringUtils.isEmpty(list)) {
return AjaxResultMES.error("materialDataList 为空");
}
try {
return mesService.searchInventory(mesSearch);
} catch (Exception e) {
return AjaxResultMES.error(e.getMessage());
}
}
/**
* 2 MES主工单下发
*
* @return
*/
@PostMapping("/workOrder")
@ApiOperation("MES主工单下发")
@ApiLogger(apiName = "2 MES主工单下发", from = "MES")
public synchronized AjaxResult workOrder(@RequestBody MesWorkOrder workOrder) {
if (StringUtils.isEmpty(workOrder.getTaskNo())) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(workOrder.getOrderCode())) {
return AjaxResult.error("orderCode 为空");
}
if (workOrder.getOrderStatus() == null) {
return AjaxResult.error("orderStatus 为空");
}
if (StringUtils.isEmpty(workOrder.getProductCode())) {
return AjaxResult.error("productCode 为空");
}
if (workOrder.getProductQty() == null) {
return AjaxResult.error("productQty 为空");
}
if (StringUtils.isEmpty(workOrder.getPlanStartTime())) {
return AjaxResult.error("planStartTime 为空");
}
if (StringUtils.isEmpty(workOrder.getPlanEndTime())) {
return AjaxResult.error("planEndTime 为空");
}
if (StringUtils.isEmpty(workOrder.getMaterialDataList()) || workOrder.getMaterialDataList().isEmpty()) {
return AjaxResult.error("materialDataList 为空");
}
return mesService.workOrder(workOrder);
}
/**
* MES工单入库单(弃用)
* 已经取消该接口 9
*
* @return
*/
@Deprecated
@PostMapping("/receiptOrder")
@ApiOperation("MES工单入库单")
@ApiLogger(apiName = "MES工单入库单", from = "MES")
public AjaxResult receiptOrder(@RequestBody MesOrder mesOrder) {
String orderCode = mesOrder.getOrderCode();
String taskNo = mesOrder.getTaskNo();
List<MesOrderMaterial> list = mesOrder.getMaterialDataList();
if (StringUtils.isEmpty(orderCode)) {
return AjaxResult.error("orderCode 为空");
}
if (StringUtils.isEmpty(taskNo)) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(mesOrder.getChidOrderCode())) {
return AjaxResult.error("chidOrderCode 为空");
}
if (mesOrder.getOrderStatus() == null) {
return AjaxResult.error("orderStatus 为空");
}
if (StringUtils.isEmpty(mesOrder.getReceiptReferCode())) {
return AjaxResult.error("receiptReferCode 为空");
}
if (StringUtils.isEmpty(list) || list.isEmpty()) {
return AjaxResult.error("materialDataList 为空");
}
return handleMultiProcess(() -> mesService.receiptOrder(mesOrder));
}
/**
* 3 MES工单领料单出库单
*
* @return
*/
@PostMapping("/shipmentOrder")
@ApiOperation("MES工单领料单出库单")
@ApiLogger(apiName = "3 MES工单领料单出库单", from = "MES")
public AjaxResult shipmentOrder(@RequestBody MesShipmentOrder mesOrder) {
String orderCode = mesOrder.getOrderCode();
String taskNo = mesOrder.getTaskNo();
BigDecimal orderQty = mesOrder.getOrderQty();
if (StringUtils.isEmpty(orderCode)) {
return AjaxResult.error("orderCode 为空");
}
if (StringUtils.isEmpty(taskNo)) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(mesOrder.getChidOrderCode())) {
return AjaxResult.error("childOrderCode 为空");
}
if (StringUtils.isEmpty(mesOrder.getProductCode())) {
return AjaxResult.error("productCode 为空");
}
if (StringUtils.isNull(mesOrder.getShipmentReferStatus())) {
return AjaxResult.error("shipmentReferStatus 为空");
}
if (StringUtils.isEmpty(mesOrder.getShipmentReferCode())) {
return AjaxResult.error("shipmentReferCode 为空");
}
if (orderQty == null) {
return AjaxResult.error("orderQty 为空");
}
if (StringUtils.isEmpty(mesOrder.getMaterialDataList())) {
return AjaxResult.error("materialDataList 为空");
}
return handleMultiProcess(() -> mesService.shipmentOrder(mesOrder));
}
/**
* MES成品出库
*
* @return
*/
@PostMapping("/shipmentProduct")
@ApiOperation("MES成品出库")
@ApiLogger(apiName = "MES成品出库", from = "MES")
public AjaxResult shipmentProduct(@RequestBody MesShipmentProduct mesShipmentProduct) {
String containerCode = mesShipmentProduct.getContainerCode();
String fromPort = mesShipmentProduct.getFromPort();
String toPort = mesShipmentProduct.getToPort();
String taskNo = mesShipmentProduct.getTaskNo();
String vehicleCode = mesShipmentProduct.getVehicleCode();
String orderCode = mesShipmentProduct.getOrderCode();
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("containerCode 为空");
}
if (StringUtils.isEmpty(fromPort)) {
return AjaxResult.error("fromPort 为空");
}
if (StringUtils.isEmpty(toPort)) {
return AjaxResult.error("toPort 为空");
}
if (StringUtils.isEmpty(taskNo)) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(vehicleCode)) {
return AjaxResult.error("vehicleCode 为空");
}
if (StringUtils.isEmpty(orderCode)) {
return AjaxResult.error("orderCode 为空");
}
return handleMultiProcess(() -> mesService.shipmentProduct(mesShipmentProduct));
}
/**
* 工位之间载具流转 11
*
* @return
*/
@PostMapping("/overStation")
@ApiOperation("MES载具流转")
@ApiLogger(apiName = "MES载具流转", from = "MES")
public AjaxResult overStation(@RequestBody MesOverStationDto mesOverStationDto) {
String containerCode = mesOverStationDto.getContainerCode();
String fromPort = mesOverStationDto.getFromPort();
String toPort = mesOverStationDto.getToPort();
String taskNo = mesOverStationDto.getTaskNo();
String vehicleCode = mesOverStationDto.getVehicleCode();
String orderCode = mesOverStationDto.getOrderCode();
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("containerCode 为空");
}
if (StringUtils.isEmpty(fromPort)) {
return AjaxResult.error("fromPort 为空");
}
if (StringUtils.isEmpty(toPort)) {
return AjaxResult.error("toPort 为空");
}
if (StringUtils.isEmpty(taskNo)) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(vehicleCode)) {
return AjaxResult.error("vehicleCode 为空");
}
if (StringUtils.isEmpty(orderCode)) {
return AjaxResult.error("orderCode 为空");
}
// 交换载具盛具的值,MES给的与WMS的是反的
mesOverStationDto.setContainerCode(vehicleCode);
mesOverStationDto.setVehicleCode(containerCode);
return handleMultiProcess(() -> mesService.createOverStation(mesOverStationDto));
}
/**
* MES物料入库
* 6 料点呼叫移走物料
*
* @return
*/
@PostMapping("/receipt")
@ApiOperation("MES物料入库")
@ApiLogger(apiName = "6 MES物料入库", from = "MES")
public AjaxResult receipt(@RequestBody MesReceipt mesReceipt) {
String taskNo = mesReceipt.getTaskNo();
//设置入库单类型为半成品入库
mesReceipt.setReceiptType(QuantityConstant.RECEIPT_TYPE_SEMI);
String orderCode = mesReceipt.getOrderCode();
String containerType = mesReceipt.getContainerTypeCode();
String containerCode = mesReceipt.getContainerCode();
String fromPort = mesReceipt.getFromPort();
String vehicleCode = mesReceipt.getVehicleCode();
String vehicleTypeCode = mesReceipt.getVehicleTypeCode();
List<MaterialData> materialDataList = mesReceipt.getMaterialDataList();
if (StringUtils.isEmpty(taskNo)) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(orderCode)) {
return AjaxResult.error("orderCode 为空");
}
if (StringUtils.isEmpty(containerType)) {
return AjaxResult.error("containerType 为空");
}
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("containerCode 为空");
}
if (StringUtils.isEmpty(fromPort)) {
return AjaxResult.error("fromPort 为空");
}
if (StringUtils.isEmpty(vehicleCode)) {
return AjaxResult.error("vehicleCode 为空");
}
if (StringUtils.isEmpty(vehicleTypeCode)) {
return AjaxResult.error("vehicleTypeCode 为空");
}
if (StringUtils.isEmpty(materialDataList)) {
return AjaxResult.error("materialDataList 为空");
}
HashMap<String, String> quTest = new HashMap<>();
for (MaterialData data : mesReceipt.getMaterialDataList()) {
if (data.getLocationNoX() == -1 || data.getLocationNoY() == -1) {
return AjaxResult.error("请填写xy信息");
}
String key = data.getLocationNoX() + " " + data.getLocationNoY();
if (quTest.get(key) == null) {
quTest.put(key, key);
} else {
return AjaxResult.error("坐标重复: " + key);
}
}
// 交换载具盛具的值,MES给的与WMS的是反的
mesReceipt.setContainerCode(vehicleCode);
mesReceipt.setContainerTypeCode(vehicleTypeCode);
mesReceipt.setVehicleCode(containerCode);
mesReceipt.setVehicleTypeCode(containerType);
return handleMultiProcess(() -> mesService.receipt(mesReceipt));
}
/**
* 10余料回库
*
* @return
*/
@PostMapping("/rawReceipt")
@ApiOperation("余料回库")
@ApiLogger(apiName = "10 余料回库", from = "MES")
public AjaxResult rawReceipt(@RequestBody MesReceipt mesReceipt) {
//mes调用接口时,代表入库单类型为余料退库
mesReceipt.setReceiptType(QuantityConstant.RECEIPT_TYPE_BACK);
String taskNo = mesReceipt.getTaskNo();
String containerType = mesReceipt.getContainerTypeCode();
String containerCode = mesReceipt.getContainerCode();
String fromPort = mesReceipt.getFromPort();
String vehicleCode = mesReceipt.getVehicleCode();
String vehicleTypeCode = mesReceipt.getVehicleTypeCode();
List<MaterialData> materialData = mesReceipt.getMaterialDataList();
HashMap<String, String> quTest = new HashMap<>();
for (MaterialData data : mesReceipt.getMaterialDataList()) {
if (data.getLocationNoX() == -1 || data.getLocationNoY() == -1) {
return AjaxResult.error("请填写xy信息");
}
String key = data.getLocationNoX() + " " + data.getLocationNoY();
if (quTest.get(key) == null) {
quTest.put(key, key);
} else {
return AjaxResult.error("坐标重复: " + key);
}
}
if (StringUtils.isEmpty(taskNo)) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(containerType)) {
return AjaxResult.error("containerType 为空");
}
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("containerCode 为空");
}
if (StringUtils.isEmpty(fromPort)) {
return AjaxResult.error("fromPort 为空");
}
if (StringUtils.isEmpty(vehicleCode)) {
return AjaxResult.error("vehicleCode 为空");
}
if (StringUtils.isEmpty(vehicleTypeCode)) {
return AjaxResult.error("vehicleTypeCode 为空");
}
if (StringUtils.isEmpty(materialData)) {
return AjaxResult.error("materialData 为空");
}
// 交换载具盛具的值,MES给的与WMS的是反的
mesReceipt.setContainerCode(vehicleCode);
mesReceipt.setContainerTypeCode(vehicleTypeCode);
mesReceipt.setVehicleCode(containerCode);
mesReceipt.setVehicleTypeCode(containerType);
return handleMultiProcess(() -> mesService.receipt(mesReceipt));
}
/**
* 原材料入库
*
* @return
*/
@PostMapping("/wmsReceipt")
@ApiOperation("原材料入库")
@ApiLogger(apiName = "原材料入库", from = "wms-pc")
public AjaxResult wmsReceipt(@RequestBody MesReceipt mesReceipt) {
//wms调用接口时,代表入库单类型为原材料入库
mesReceipt.setReceiptType(QuantityConstant.RECEIPT_TYPE_RAW);
String taskNo = mesReceipt.getTaskNo();
String orderCode = mesReceipt.getOrderCode();
String vehicleCode = mesReceipt.getVehicleCode();
String vehicleTypeCode = mesReceipt.getVehicleTypeCode();
List<MaterialData> materialData = mesReceipt.getMaterialDataList();
HashMap<String, String> quTest = new HashMap<>();
// 通用盛具不做校验
if (!QuantityConstant.VEHICLE_TYPE_COMMON.equals(vehicleTypeCode)) {
for (MaterialData data : mesReceipt.getMaterialDataList()) {
if (data.getLocationNoX() == -1 || data.getLocationNoY() == -1) {
return AjaxResult.error("请填写xy信息");
}
String key = data.getLocationNoX() + " " + data.getLocationNoY();
if (quTest.get(key) == null) {
quTest.put(key, key);
} else {
return AjaxResult.error("坐标重复: " + key);
}
}
}
if (StringUtils.isEmpty(taskNo)) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(vehicleCode)) {
return AjaxResult.error("vehicleCode 为空");
}
if (StringUtils.isEmpty(vehicleTypeCode)) {
return AjaxResult.error("vehicleTypeCode 为空");
}
if (StringUtils.isEmpty(materialData)) {
return AjaxResult.error("materialData 为空");
}
if (StringUtils.isEmpty(orderCode)) {
return AjaxResult.error("orderCode 为空");
}
return handleMultiProcess(() -> mesService.wmsReceipt(mesReceipt));
}
/**
* 物料出库
* 4 料点呼叫送物料
*
* @return
*/
@PostMapping("/shipment")
@ApiOperation("物料出库")
@ApiLogger(apiName = "4 物料出库", from = "MES")
public AjaxResult shipment(@RequestBody MesShipment mesShipment) {
if (StringUtils.isEmpty(mesShipment.getTaskNo())) {
return AjaxResult.error("taskNo 为空");
}
if (StringUtils.isEmpty(mesShipment.getOrderCode())) {
return AjaxResult.error("orderCode 为空");
}
if (StringUtils.isEmpty(mesShipment.getShipmentReferCode())) {
return AjaxResult.error("shipmentReferCode 为空");
}
if (StringUtils.isEmpty(mesShipment.getToPort())) {
return AjaxResult.error("toPort 为空");
}
if (mesShipment.getVehicleinsert() == null) {
return AjaxResult.error("vehicleinsert 为空");
}
if (StringUtils.isEmpty(mesShipment.getMaterialDataList())) {
return AjaxResult.error("materialData 为空");
}
if (mesShipment.getSequenceCount() <= 0) {
return AjaxResult.error("sequenceCount 为空");
}
if (StringUtils.isEmpty(mesShipment.getSequenceGroup())) {
return AjaxResult.error("sequenceGroup 为空");
}
return handleMultiProcess(() -> mesService.shipment(mesShipment));
}
/**
* 入库回传
*/
@PostMapping("/backReceipt")
@ApiLogger(from = "WMS", to = "MES", apiName = "入库回传")
public AjaxResult backReceipt(Integer id) {
if (StringUtils.isNull(id)) {
return AjaxResult.error("id不能为空");
}
return mesService.backReceipt(id);
}
/**
* 出库回传
*/
@PostMapping("/backShipment")
@ApiLogger(from = "WMS", to = "MES", apiName = "出库回传")
public AjaxResult backShipment(String id) {
if (StringUtils.isEmpty(id)) {
return AjaxResult.error("id不能为空");
}
return mesService.backShipment(id);
}
/**
* 工位之间载具流转回传
*/
@PostMapping("/backChangeStation")
@ApiLogger(from = "WMS", to = "MES", apiName = "工位之间载具流转回传")
public AjaxResult backEmpty(String id) {
if (StringUtils.isEmpty(id)) {
return AjaxResult.error("任务id不能为空");
}
return mesService.backChangeStation(id);
}
/**
* MES质检查询
*/
@PostMapping("/searchInventoryByQC")
@ApiOperation("MES质检抽样查询")
@ApiLogger(apiName = "MES质检抽样查询", from = "MES")
public AjaxResultMES searchInventoryByQC(@RequestBody MesSearchRequestByQCDto mesSearchRequestByQCDto) {
String taskNo = mesSearchRequestByQCDto.getTaskNo();
String orderCode = mesSearchRequestByQCDto.getOrderCode();
String materialCode = mesSearchRequestByQCDto.getMaterialCode();
if (StringUtils.isEmpty(taskNo)) {
return AjaxResultMES.error("taskNo 为空");
}
if (StringUtils.isEmpty(orderCode)) {
return AjaxResultMES.error("orderCode 为空");
}
if (StringUtils.isEmpty(materialCode)) {
return AjaxResultMES.error("materialCode 为空");
}
try {
return mesService.searchInventoryByQC(mesSearchRequestByQCDto);
} catch (Exception e) {
return AjaxResultMES.error(e.getMessage());
}
}
/**
* MES质检抽样出库
*/
@PostMapping("/shipmentByQC")
@ApiOperation("MES质检抽样出库")
@ApiLogger(apiName = "MES质检抽样出库", from = "MES")
public AjaxResultMES shipmentByQC(@RequestBody MesShipmentByQCDto mesShipmentByQCDto) {
String taskNo = mesShipmentByQCDto.getTaskNo();
String orderCode = mesShipmentByQCDto.getOrderCode();
String shipmentReferCode = mesShipmentByQCDto.getShipmentReferCode();
List<String> locationCode = mesShipmentByQCDto.getLocationCodeList();
String toPort = mesShipmentByQCDto.getToPort();
if (StringUtils.isEmpty(taskNo)) {
return AjaxResultMES.error("taskNo 为空");
}
if (StringUtils.isEmpty(shipmentReferCode)) {
return AjaxResultMES.error("shipmentReferCode 为空");
}
if (StringUtils.isEmpty(locationCode)) {
return AjaxResultMES.error("locationCode 为空");
}
if (StringUtils.isEmpty(orderCode)) {
return AjaxResultMES.error("orderCode 为空");
}
if (StringUtils.isEmpty(toPort)) {
return AjaxResultMES.error("toPort 为空");
}
try {
return mesService.shipmentByQC(mesShipmentByQCDto);
} catch (Exception e) {
return AjaxResultMES.error(e.getMessage());
}
}
/**
* MES质检抽样余料回库
*/
@PostMapping("/receiptByQC")
@ApiOperation("MES质检抽样余料回库")
@ApiLogger(apiName = "MES质检抽样余料回库", from = "MES")
public AjaxResultMES receiptByQC(@RequestBody MesReceiptByQCDto mesReceiptByQCDto) {
String taskNo = mesReceiptByQCDto.getTaskNo();
Integer sipType = mesReceiptByQCDto.getSipType();
String fromPort = mesReceiptByQCDto.getFromPort();
String orderCode = mesReceiptByQCDto.getOrderCode();
String containerCode = mesReceiptByQCDto.getContainerCode();
String containerTypeCode = mesReceiptByQCDto.getContainerTypeCode();
String vehicleCode = mesReceiptByQCDto.getVehicleCode();
String vehicleTypeCode = mesReceiptByQCDto.getVehicleTypeCode();
List<MaterialData> materialDataList = mesReceiptByQCDto.getMaterialDataList();
if (StringUtils.isEmpty(taskNo)) {
return AjaxResultMES.error("taskNo 为空");
}
if (StringUtils.isNull(sipType)) {
return AjaxResultMES.error("sipType 为空");
}
if (StringUtils.isEmpty(fromPort)) {
return AjaxResultMES.error("fromPort 为空");
}
if (StringUtils.isEmpty(orderCode)) {
return AjaxResultMES.error("orderCode 为空");
}
if (StringUtils.isEmpty(containerCode)) {
return AjaxResultMES.error("containerCode 为空");
}
if (StringUtils.isEmpty(containerTypeCode)) {
return AjaxResultMES.error("toPort 为空");
}
if (StringUtils.isEmpty(vehicleCode)) {
return AjaxResultMES.error("vehicleCode 为空");
}
if (StringUtils.isEmpty(vehicleTypeCode)) {
return AjaxResultMES.error("vehicleTypeCode 为空");
}
if (StringUtils.isEmpty(materialDataList)) {
return AjaxResultMES.error("materialDataList 为空");
}
try {
return mesService.receiptByQC(mesReceiptByQCDto);
} catch (Exception e) {
return AjaxResultMES.error(e.getMessage());
}
}
}