Blame view

src/main/java/com/huaheng/api/mes/controller/MesController.java 26.9 KB
肖超群 authored
1
2
3
4
package com.huaheng.api.mes.controller;

import com.huaheng.api.mes.domain.*;
import com.huaheng.api.mes.service.MesService;
5
import com.huaheng.common.constant.QuantityConstant;
肖超群 authored
6
7
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
8
9
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
肖超群 authored
10
11
12
13
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.task.taskHeader.service.WorkTaskService;
import io.swagger.annotations.ApiOperation;
14
import org.springframework.web.bind.annotation.*;
肖超群 authored
15
16

import javax.annotation.Resource;
17
import java.util.HashMap;
肖超群 authored
18
import java.util.List;
19
import java.util.Objects;
肖超群 authored
20
21
22
23
24
25
26
27
28
29
30
31
32
33

/**
 * @author 游杰
 */
@RestController
@RequestMapping("/API/WMS/v2")
public class MesController extends BaseController {

    @Resource
    private WorkTaskService workTaskService;
    @Resource
    private MesService mesService;

    /**
pengyongcheng authored
34
     * 空盛具入库
肖超群 authored
35
36
     */
    @PostMapping("/receiptEmptyContainer")
pengyongcheng authored
37
38
    @ApiOperation("空盛具入库")
    @ApiLogger(apiName = "空盛具入库", from = "MES")
39
40
    public AjaxResult receiptEmptyContainer(@RequestBody MesEmptyContainer mesEmptyContainer) {
        String taskNo = mesEmptyContainer.getTaskNo();
41
        String fromPort = mesEmptyContainer.getFromPort();
42
43
44
        // 交换载具和盛具的值
        String containerCode = mesEmptyContainer.getVehicleCode();
        String vehicleCode = mesEmptyContainer.getContainerCode();
45
        if (StringUtils.isEmpty(containerCode)) {
46
            return AjaxResult.error("vehicleCode 为空");
47
48
49
50
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
51
52
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
53
        }
54
        /*if (!isEmptyVehBack && StringUtils.isEmpty(vehicleCode)) {
55
            return AjaxResult.error("containerCode 为空");
56
        }*/
57
        // 因MES传的载具和盛具码是反的,此处交换载具与盛具的值 反着入参
pengyongcheng authored
58
        return handleMultiProcess(() -> workTaskService.createEmptyIn(
59
                taskNo, fromPort, containerCode, vehicleCode, null));
肖超群 authored
60
61
62
    }

    /**
63
     * 空盛具出库
肖超群 authored
64
65
     */
    @PostMapping("/shipmentEmptyContainer")
66
67
    @ApiOperation("空盛具出库")
    @ApiLogger(apiName = "空盛具出库", from = "MES")
肖超群 authored
68
69
    public AjaxResult shipmentEmptyContainer(@RequestBody MesEmptyContainer mesEmptyContainer) {
        String taskNo = mesEmptyContainer.getTaskNo();
70
        String orderCode = mesEmptyContainer.getOrderCode();
肖超群 authored
71
        String toPort = mesEmptyContainer.getToPort();
72
        String vehicleTypeCode = mesEmptyContainer.getVehicleTypeCode();
73
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
74
75
            return AjaxResult.error("taskNo 为空");
        }
76
        if (StringUtils.isEmpty(toPort)) {
肖超群 authored
77
78
            return AjaxResult.error("toPort 为空");
        }
79
        if (StringUtils.isEmpty(vehicleTypeCode)) {
80
            return AjaxResult.error("containerTypeCode 为空");
肖超群 authored
81
        }
pengyongcheng authored
82
        return handleMultiProcess(() -> workTaskService.shipmentEmptyContainer(
83
                taskNo, orderCode, toPort, vehicleTypeCode));
肖超群 authored
84
85
86
    }

    /**
87
     * 查询库存
肖超群 authored
88
89
     */
    @PostMapping("/searchInventory")
90
91
    @ApiOperation("查询库存")
    @ApiLogger(apiName = "查询库存", from = "MES")
92
    public AjaxResult searchInventory(@RequestBody MesSearch mesSearch) {
yuxiao authored
93
        String taskNo = mesSearch.getTaskNo();
94
        if (StringUtils.isEmpty(taskNo)) {
95
            return AjaxResult.error("taskNo 为空");
yuxiao authored
96
        }
97
98
        try {
            return mesService.searchInventory(mesSearch);
99
        } catch (Exception e) {
100
            return AjaxResult.error(e.getMessage());
101
        }
102
    }
肖超群 authored
103
104
    /**
105
     * 主工单下发
106
107
     */
    @PostMapping("/workOrder")
108
109
    @ApiOperation("主工单下发")
    @ApiLogger(apiName = "主工单下发", from = "MES")
110
    public AjaxResult workOrder(@RequestBody MesWorkOrder workOrder) {
111
        if (StringUtils.isEmpty(workOrder.getTaskNo())) {
112
113
            return AjaxResult.error("taskNo 为空");
        }
114
        if (StringUtils.isEmpty(workOrder.getOrderCode())) {
115
116
            return AjaxResult.error("orderCode 为空");
        }
117
118
119
120
121
122
        if (StringUtils.isEmpty(workOrder.getBatchNumber())) {
            return AjaxResult.error("batchNumber 为空");
        }
        if (StringUtils.isEmpty(workOrder.getOrderNumber())) {
            return AjaxResult.error("orderNumber 为空");
        }
123
        if (workOrder.getOrderStatus() == null) {
124
125
            return AjaxResult.error("orderStatus 为空");
        }
126
        if (StringUtils.isEmpty(workOrder.getMaterialDataList()) || workOrder.getMaterialDataList().isEmpty()) {
127
            return AjaxResult.error("materialDataList 为空");
128
        }
129
        return mesService.workOrder(workOrder);
肖超群 authored
130
131
    }
132
133
134
    /**
     * 工单状态同步
     */
135
136
    @PostMapping("/syncWorkOrder")
    @ApiOperation("工单状态同步")
137
    @ApiLogger(apiName = "工单状态同步", from = "MES")
138
139
140
141
142
143
144
145
146
147
148
149
150
    public AjaxResult syncWorkOrder(@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 为空");
        }
        return mesService.syncWorkOrder(workOrder);
    }
肖超群 authored
151
    /**
152
     * MES工单入库单(弃用)
153
154
     * 已经取消该接口 9
     *
肖超群 authored
155
156
     * @return
     */
pengyongcheng authored
157
    /*@Deprecated
肖超群 authored
158
159
    @PostMapping("/receiptOrder")
    @ApiOperation("MES工单入库单")
160
    @ApiLogger(apiName = "MES工单入库单", from = "MES")
肖超群 authored
161
    public AjaxResult receiptOrder(@RequestBody MesOrder mesOrder) {
162
        String orderCode = mesOrder.getOrderCode();
肖超群 authored
163
        String taskNo = mesOrder.getTaskNo();
164
        List<MesOrderMaterial> list = mesOrder.getMaterialDataList();
165
        if (StringUtils.isEmpty(orderCode)) {
肖超群 authored
166
167
            return AjaxResult.error("orderCode 为空");
        }
168
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
169
170
            return AjaxResult.error("taskNo 为空");
        }
171
        if (StringUtils.isEmpty(mesOrder.getChidOrderCode())) {
172
173
            return AjaxResult.error("chidOrderCode 为空");
        }
174
        if (mesOrder.getOrderStatus() == null) {
175
176
            return AjaxResult.error("orderStatus 为空");
        }
177
        if (StringUtils.isEmpty(mesOrder.getReceiptReferCode())) {
178
179
            return AjaxResult.error("receiptReferCode 为空");
        }
pengyongcheng authored
180
        if (StringUtils.isEmpty(list) || list.isEmpty()) {
181
            return AjaxResult.error("materialDataList 为空");
肖超群 authored
182
        }
pengyongcheng authored
183
        return handleMultiProcess(() -> mesService.receiptOrder(mesOrder));
pengyongcheng authored
184
    }*/
肖超群 authored
185
186

    /**
pengyongcheng authored
187
     * 3 MES工单领料单出库单 (弃用)
188
     *
肖超群 authored
189
190
     * @return
     */
pengyongcheng authored
191
    /*@PostMapping("/shipmentOrder")
yuxiao authored
192
    @ApiOperation("MES工单领料单出库单")
周峰 authored
193
    @ApiLogger(apiName = "3 MES工单领料单出库单", from = "MES")
194
195
    public AjaxResult shipmentOrder(@RequestBody MesShipmentOrder mesOrder) {
        String orderCode = mesOrder.getOrderCode();
肖超群 authored
196
197
        String taskNo = mesOrder.getTaskNo();
        BigDecimal orderQty = mesOrder.getOrderQty();
198
        if (StringUtils.isEmpty(orderCode)) {
肖超群 authored
199
200
            return AjaxResult.error("orderCode 为空");
        }
201
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
202
203
            return AjaxResult.error("taskNo 为空");
        }
204
        if (StringUtils.isEmpty(mesOrder.getChidOrderCode())) {
周鸿 authored
205
            return AjaxResult.error("childOrderCode 为空");
206
207
208
209
        }
        if (StringUtils.isEmpty(mesOrder.getProductCode())) {
            return AjaxResult.error("productCode 为空");
        }
210
        if (orderQty == null) {
肖超群 authored
211
212
            return AjaxResult.error("orderQty 为空");
        }
周鸿 authored
213
        if (StringUtils.isEmpty(mesOrder.getMaterialDataList())) {
214
            return AjaxResult.error("materialDataList 为空");
215
        }
pengyongcheng authored
216
        return handleMultiProcess(() -> mesService.shipmentOrder(mesOrder));
pengyongcheng authored
217
    }*/
肖超群 authored
218
219

    /**
pengyongcheng authored
220
     * MES成品出库(弃用)
221
     *
肖超群 authored
222
223
     * @return
     */
pengyongcheng authored
224
    /*@PostMapping("/shipmentProduct")
肖超群 authored
225
    @ApiOperation("MES成品出库")
226
    @ApiLogger(apiName = "MES成品出库", from = "MES")
227
    public AjaxResult shipmentProduct(@RequestBody MesShipmentProduct mesShipmentProduct) {
肖超群 authored
228
        String containerCode = mesShipmentProduct.getContainerCode();
229
230
        String fromPort = mesShipmentProduct.getFromPort();
        String toPort = mesShipmentProduct.getToPort();
肖超群 authored
231
        String taskNo = mesShipmentProduct.getTaskNo();
232
233
        String vehicleCode = mesShipmentProduct.getVehicleCode();
        String orderCode = mesShipmentProduct.getOrderCode();
234
        if (StringUtils.isEmpty(containerCode)) {
肖超群 authored
235
236
            return AjaxResult.error("containerCode 为空");
        }
237
238
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
肖超群 authored
239
        }
240
241
        if (StringUtils.isEmpty(toPort)) {
            return AjaxResult.error("toPort 为空");
肖超群 authored
242
        }
243
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
244
245
            return AjaxResult.error("taskNo 为空");
        }
246
247
248
249
250
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
251
        }
pengyongcheng authored
252
        return handleMultiProcess(() -> mesService.shipmentProduct(mesShipmentProduct));
pengyongcheng authored
253
    }*/
肖超群 authored
254
255

    /**
256
     * 载具流转
257
258
     */
    @PostMapping("/overStation")
259
260
    @ApiOperation("载具流转")
    @ApiLogger(apiName = "载具流转", from = "MES")
261
262
    public AjaxResult overStation(@RequestBody MesOverStationDto mesOverStationDto) {
        String containerCode = mesOverStationDto.getContainerCode();
263
264
        String fromPort = mesOverStationDto.getFromPort();
        String toPort = mesOverStationDto.getToPort();
265
266
267
268
269
        String taskNo = mesOverStationDto.getTaskNo();
        String vehicleCode = mesOverStationDto.getVehicleCode();
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("containerCode 为空");
        }
270
        if (StringUtils.isEmpty(fromPort)) {
271
            return AjaxResult.error("fromPort 为空");
272
        }
273
        if (StringUtils.isEmpty(toPort)) {
274
            return AjaxResult.error("toPort 为空");
275
276
277
278
279
280
281
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
282
283
284
        // 交换载具盛具的值,MES给的与WMS的是反的
        mesOverStationDto.setContainerCode(vehicleCode);
        mesOverStationDto.setVehicleCode(containerCode);
285
286
287
288
        return handleMultiProcess(() -> mesService.createOverStation(mesOverStationDto));
    }

    /**
pengyongcheng authored
289
     * 物料入库
肖超群 authored
290
291
     */
    @PostMapping("/receipt")
292
293
    @ApiOperation("物料入库")
    @ApiLogger(apiName = "物料入库", from = "MES")
肖超群 authored
294
295
    public AjaxResult receipt(@RequestBody MesReceipt mesReceipt) {
        String taskNo = mesReceipt.getTaskNo();
296
        String orderCode = mesReceipt.getOrderCode();
肖超群 authored
297
        String containerCode = mesReceipt.getContainerCode();
pengyongcheng authored
298
        String fromPort = mesReceipt.getFromPort();
299
        String vehicleCode = mesReceipt.getVehicleCode();
300
        List<ReceiptMaterialData> materialDataList = mesReceipt.getReceiptMaterialDataList();
肖超群 authored
301
302
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
303
304
            return AjaxResult.error("taskNo 为空");
        }
305
306
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
肖超群 authored
307
        }
308
        if (StringUtils.isEmpty(containerCode)) {
肖超群 authored
309
310
            return AjaxResult.error("containerCode 为空");
        }
pengyongcheng authored
311
312
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
肖超群 authored
313
        }
314
315
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
肖超群 authored
316
        }
317
318
319
        if (StringUtils.isEmpty(mesReceipt.getReceiptType())) {
            return AjaxResult.error("receiptType 为空");
        }
320
321
        if (StringUtils.isEmpty(materialDataList)) {
            return AjaxResult.error("materialDataList 为空");
322
        }
323
        HashMap<String, String> quTest = new HashMap<>();
324
        for (ReceiptMaterialData data : mesReceipt.getReceiptMaterialDataList()) {
325
326
327
            if (data.getLocationNoX() == null || data.getLocationNoY() == null) {
                return AjaxResult.error("物料信息坐标为空");
            }
328
            if (data.getLocationNoX() == -1 || data.getLocationNoY() == -1) {
329
                return AjaxResult.error("物料信息坐标错误");
330
331
332
333
334
335
336
337
            }
            String key = data.getLocationNoX() + "  " + data.getLocationNoY();
            if (quTest.get(key) == null) {
                quTest.put(key, key);
            } else {
                return AjaxResult.error("坐标重复: " + key);
            }
        }
338
339
340
        // 交换载具盛具的值,MES给的与WMS的是反的
        mesReceipt.setContainerCode(vehicleCode);
        mesReceipt.setVehicleCode(containerCode);
pengyongcheng authored
341
        return handleMultiProcess(() -> mesService.receipt(mesReceipt));
342
343
344
    }

    /**
345
     * 余料回库(弃用)
346
347
348
     *
     * @return
     */
349
    /*@PostMapping("/rawReceipt")
350
    @ApiOperation("余料回库")
351
    @ApiLogger(apiName = "余料回库", from = "MES")
352
    public AjaxResult rawReceipt(@RequestBody MesReceipt mesReceipt) {
353
pengyongcheng authored
354
355
        //mes调用接口时,代表入库单类型为余料退库
        mesReceipt.setReceiptType(QuantityConstant.RECEIPT_TYPE_BACK);
356
pengyongcheng authored
357
        String taskNo = mesReceipt.getTaskNo();
358
        String containerCode = mesReceipt.getContainerCode();
pengyongcheng authored
359
        String fromPort = mesReceipt.getFromPort();
360
        String vehicleCode = mesReceipt.getVehicleCode();
361
        List<ReceiptMaterialData> materialData = mesReceipt.getReceiptMaterialDataList();
362
        HashMap<String, String> quTest = new HashMap<>();
363
        for (ReceiptMaterialData data : mesReceipt.getReceiptMaterialDataList()) {
364
365
366
            Integer locationNoY = data.getLocationNoY();
            Integer locationNoX = data.getLocationNoX();
            if (locationNoX == null || locationNoY == null) {
367
368
                return AjaxResult.error("物料信息坐标为空");
            }
369
            if (locationNoX == -1 || locationNoY == -1) {
370
                return AjaxResult.error("物料信息坐标错误");
371
            }
372
            String key = locationNoX + "  " + locationNoY;
373
374
375
376
377
378
379
380
381
382
383
384
            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(containerCode)) {
            return AjaxResult.error("containerCode 为空");
        }
pengyongcheng authored
385
386
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
387
388
389
390
391
392
393
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(materialData)) {
            return AjaxResult.error("materialData 为空");
        }
394
395
396
397

        // 交换载具盛具的值,MES给的与WMS的是反的
        mesReceipt.setContainerCode(vehicleCode);
        mesReceipt.setVehicleCode(containerCode);
398
        return handleMultiProcess(() -> mesService.receipt(mesReceipt));
399
    }*/
400
401
402
403
404
405
406
407

    /**
     * 原材料入库
     *
     * @return
     */
    @PostMapping("/wmsReceipt")
    public AjaxResult wmsReceipt(@RequestBody MesReceipt mesReceipt) {
pengyongcheng authored
408
409
        //wms调用接口时,代表入库单类型为原材料入库
        mesReceipt.setReceiptType(QuantityConstant.RECEIPT_TYPE_RAW);
410
pengyongcheng authored
411
        String taskNo = mesReceipt.getTaskNo();
412
        String orderCode = mesReceipt.getOrderCode();
413
414
        String orderNumber = mesReceipt.getOrderNumber();
        String batchNumber = mesReceipt.getBatchNumber();
415
        List<ReceiptMaterialData> materialData = mesReceipt.getReceiptMaterialDataList();
416
417
418
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
周鸿 authored
419
        if (StringUtils.isEmpty(materialData)) {
肖超群 authored
420
421
            return AjaxResult.error("materialData 为空");
        }
422
423
424
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
425
426
427
428
429
430
        if (StringUtils.isEmpty(orderNumber)) {
            return AjaxResult.error("orderNumber 为空");
        }
        if (StringUtils.isEmpty(batchNumber)) {
            return AjaxResult.error("batchNumber 为空");
        }
431
        return handleMultiProcess(() -> mesService.wmsReceipt(mesReceipt));
肖超群 authored
432
    }
433
434
435
436
437
438

    /**
     * 物料出库
     */
    @PostMapping("/shipment")
    @ApiOperation("物料出库")
439
    @ApiLogger(apiName = "物料出库", from = "MES")
440
441
442
443
444
445
446
447
448
449
    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.getToPort())) {
            return AjaxResult.error("toPort 为空");
        }
pengyongcheng authored
450
        if (StringUtils.isEmpty(mesShipment.getShipmentMaterialDataList())) {
451
452
            return AjaxResult.error("materialData 为空");
        }
周峰 authored
453
454
455
456
        if (mesShipment.getSequenceCount() <= 0) {
            return AjaxResult.error("sequenceCount 为空");
        }
457
        if (StringUtils.isEmpty(mesShipment.getSequenceGroup())) {
周峰 authored
458
459
            return AjaxResult.error("sequenceGroup 为空");
        }
pengyongcheng authored
460
        return handleMultiProcess(() -> mesService.shipment(mesShipment));
461
    }
462
463

    /**
464
     * 入库回传
465
466
     */
    @PostMapping("/backReceipt")
467
468
    public AjaxResult backReceipt(Integer id) {
        if (StringUtils.isNull(id)) {
469
470
471
472
473
474
            return AjaxResult.error("id不能为空");
        }
        return mesService.backReceipt(id);
    }

    /**
475
     * 出库回传
476
     */
477
    @PostMapping("/backShipment")
478
479
    public AjaxResult backShipment(Integer id) {
        if (Objects.isNull(id)) {
480
481
482
483
484
485
            return AjaxResult.error("id不能为空");
        }
        return mesService.backShipment(id);
    }

    /**
486
     * 换站回传
487
     */
488
    @PostMapping("/backChangeStation")
489
490
    public AjaxResult backEmpty(Integer id) {
        if (Objects.isNull(id)) {
491
            return AjaxResult.error("任务id不能为空");
492
        }
493
        return mesService.backChangeStation(id);
494
    }
495
496

    /**
497
     * 质检抽样查询(取消)
498
499
     */
    @PostMapping("/searchInventoryByQC")
500
501
    @ApiOperation("质检抽样查询")
    @ApiLogger(apiName = "质检抽样查询", from = "MES")
502
    public AjaxResult searchInventoryByQC(@RequestBody MesSearchRequestByQCDto mesSearchRequestByQCDto) {
503
504
505
        String taskNo = mesSearchRequestByQCDto.getTaskNo();
        String orderCode = mesSearchRequestByQCDto.getOrderCode();
        String materialCode = mesSearchRequestByQCDto.getMaterialCode();
506
        if (StringUtils.isEmpty(taskNo)) {
507
            return AjaxResult.error("taskNo 为空");
508
509
        }
        if (StringUtils.isEmpty(orderCode)) {
510
            return AjaxResult.error("orderCode 为空");
511
        }
512
        if (StringUtils.isEmpty(materialCode)) {
513
            return AjaxResult.error("materialCode 为空");
514
515
        }
        try {
516
            return mesService.searchInventoryByQC(mesSearchRequestByQCDto);
517
        } catch (Exception e) {
518
            return AjaxResult.error(e.getMessage());
519
520
        }
    }
521
522

    /**
523
     * 质检抽样出库
524
525
     */
    @PostMapping("/shipmentByQC")
526
527
    @ApiOperation("质检抽样出库")
    @ApiLogger(apiName = "质检抽样出库", from = "MES")
528
    public AjaxResult shipmentByQC(@RequestBody MesShipmentByQCDto mesShipmentByQCDto) {
529
530
531
        String taskNo = mesShipmentByQCDto.getTaskNo();
        String toPort = mesShipmentByQCDto.getToPort();
        if (StringUtils.isEmpty(taskNo)) {
532
            return AjaxResult.error("taskNo 为空");
533
534
        }
        if (StringUtils.isEmpty(toPort)) {
535
            return AjaxResult.error("toPort 为空");
536
537
538
539
        }
        try {
            return mesService.shipmentByQC(mesShipmentByQCDto);
        } catch (Exception e) {
540
            return AjaxResult.error(e.getMessage());
541
542
        }
    }
543
544

    /**
545
     * 质检抽样入库
546
547
     */
    @PostMapping("/receiptByQC")
548
549
    @ApiOperation("质检抽样入库")
    @ApiLogger(apiName = "质检抽样入库", from = "MES")
550
    public AjaxResult receiptByQC(@RequestBody MesReceiptByQCDto mesReceiptByQCDto) {
551
        String taskNo = mesReceiptByQCDto.getTaskNo();
552
        Integer materialInspectStatus = mesReceiptByQCDto.getMaterialInspectStatus();
553
554
555
556
        String fromPort = mesReceiptByQCDto.getFromPort();
        String orderCode = mesReceiptByQCDto.getOrderCode();
        String containerCode = mesReceiptByQCDto.getContainerCode();
        String vehicleCode = mesReceiptByQCDto.getVehicleCode();
557
        List<ReceiptMaterialData> materialDataList = mesReceiptByQCDto.getMaterialDataList();
558
        if (StringUtils.isEmpty(taskNo)) {
559
            return AjaxResult.error("taskNo 为空");
560
        }
561
        if (StringUtils.isNull(materialInspectStatus)) {
562
            return AjaxResult.error("materialStatus 为空");
563
564
        }
        if (StringUtils.isEmpty(fromPort)) {
565
            return AjaxResult.error("fromPort 为空");
566
567
        }
        if (StringUtils.isEmpty(orderCode)) {
568
            return AjaxResult.error("orderCode 为空");
569
570
        }
        if (StringUtils.isEmpty(containerCode)) {
571
            return AjaxResult.error("containerCode 为空");
572
573
        }
        if (StringUtils.isEmpty(vehicleCode)) {
574
            return AjaxResult.error("vehicleCode 为空");
575
576
        }
        if (StringUtils.isEmpty(materialDataList)) {
577
            return AjaxResult.error("materialDataList 为空");
578
579
580
581
        }
        try {
            return mesService.receiptByQC(mesReceiptByQCDto);
        } catch (Exception e) {
582
            return AjaxResult.error(e.getMessage());
583
584
        }
    }
pengyongcheng authored
585
586

    /**
587
     * 挪料(弃用)
pengyongcheng authored
588
     */
589
    /*@PostMapping("/movingMaterial")
pengyongcheng authored
590
591
    @ApiOperation("MES挪料")
    @ApiLogger(apiName = "MES挪料", from = "MES")
592
    public AjaxResult movingMaterial(@RequestBody MesMovingMaterialDto mesMovingMaterialDto) {
pengyongcheng authored
593
        if (Objects.isNull(mesMovingMaterialDto)) {
594
            return AjaxResult.error("挪料对象 mesMovingMaterialDto 为空");
pengyongcheng authored
595
596
597
598
599
600
        }
        String sourceOrderCode = mesMovingMaterialDto.getSourceOrderCode();
        String targetOrderCode = mesMovingMaterialDto.getTargetOrderCode();
        String materialCode = mesMovingMaterialDto.getMaterialCode();
        BigDecimal qty = mesMovingMaterialDto.getQty();
        if (StringUtils.isEmpty(sourceOrderCode)) {
601
            return AjaxResult.error("sourceOrderCode 为空");
pengyongcheng authored
602
603
        }
        if (StringUtils.isNull(targetOrderCode)) {
604
            return AjaxResult.error("targetOrderCode 为空");
pengyongcheng authored
605
606
        }
        if (StringUtils.isEmpty(materialCode)) {
607
            return AjaxResult.error("materialCode 为空");
pengyongcheng authored
608
609
        }
        if (Objects.isNull(qty) || qty.compareTo(BigDecimal.ZERO) <= 0) {
610
            return AjaxResult.error("qty 为空或 qty小于等于0");
pengyongcheng authored
611
612
613
614
        }
        try {
            return mesService.movingMaterial(mesMovingMaterialDto);
        } catch (Exception e) {
615
            return AjaxResult.error(e.getMessage());
pengyongcheng authored
616
        }
617
    }*/
618
619
620
621
622
623
624
625
626
627
628
629

    /**
     * 获取MES入库条码
     */
    @Log(title = "入库组盘-获取MES入库追溯码", operating = "获取MES入库追溯码", action = BusinessType.INSERT)
    @GetMapping("/getMesTracingCode")
    public AjaxResult getMesTracingCode(String zs) {
        if (StringUtils.isEmpty(zs)) {
            return AjaxResult.error("追溯码不能为空");
        }
        return mesService.getMesTracingCode(zs);
    }
630
631

    /**
632
     * /退库
633
     */
634
635
    @Log(title = "清/退库", action = BusinessType.INSERT)
    @ApiOperation("清/退库")
636
    @ApiLogger(apiName = "同步物料信息", from="MES")
637
638
639
640
641
642
    @PostMapping("/clearStock")
    public AjaxResult clearStock(@RequestBody ClearStockDto clearStockDto) {
        return mesService.clearStock(clearStockDto);
    }

    /**
643
644
645
646
647
648
649
650
651
652
653
     * 在制品/产出品出库
     */
    @Log(title = "在制品/产出品出库", action = BusinessType.INSERT)
    @ApiOperation("在制品/产出品出库")
    @ApiLogger(apiName = "在制品/产出品出库", from="MES")
    @PostMapping("/productShipment")
    public AjaxResult productShipment(@RequestBody ProductShipmentDto productShipmentDto) {
        return mesService.productShipmentDto(productShipmentDto);
    }

    /**
654
655
656
657
658
     * 查询空库位
     */
    @Log(title = "查询空库位", action = BusinessType.INSERT)
    @ApiOperation("查询空库位")
    @ApiLogger(apiName = "查询空库位", from="MES")
659
    @GetMapping("/queryEmptyLocation")
660
    public AjaxResult<List<EmptyLocationDto>> queryEmptyLocation() {
661
        return mesService.queryEmptyLocation();
662
663
664
    }

    /**
665
666
667
668
669
670
671
672
673
674
675
     * 查询空库位
     */
    @Log(title = "查询药量", action = BusinessType.INSERT)
    @ApiOperation("查询药量")
    @ApiLogger(apiName = "查询药量", from="MES")
    @GetMapping("/queryPowder")
    public AjaxResult<?> queryPowder() {
        return mesService.queryPowder();
    }

    /**
676
     * 查询固化时间
677
678
679
680
681
682
683
684
685
686
     */
    @Log(title = "查询固化时间", action = BusinessType.INSERT)
    @ApiOperation("查询固化时间")
    @ApiLogger(apiName = "查询固化时间", from="MES")
    @PostMapping("/querySolidifyTime")
    public AjaxResult<?> querySolidifyTime(@RequestBody QuerySolidifyTimeDto querySolidifyTimeDto) {
        return mesService.querySolidifyTime(querySolidifyTimeDto);
    }

    /**
687
688
689
690
691
     * 同步物料信息
     */
    @Log(title = "同步物料信息", action = BusinessType.INSERT)
    @ApiOperation("同步物料信息")
    @ApiLogger(apiName = "同步物料信息", from="MES")
692
    @PostMapping("/syncMaterial")
693
694
    public AjaxResult syncMaterial(@RequestBody List<SyncMaterialDto> syncMaterialDtoList) {
        return mesService.syncMaterial(syncMaterialDtoList);
695
696
697
698
699
700
701
702
703
    }

    /**
     * 同步供应商信息
     */
    @Log(title = "同步供应商信息", action = BusinessType.INSERT)
    @ApiOperation("同步供应商信息")
    @ApiLogger(apiName = "同步供应商信息", from="MES")
    @PostMapping("/syncSupplier")
704
705
    public AjaxResult syncSupplier(@RequestBody List<SyncSupplierDto> syncSupplierDtoList) {
        return mesService.syncSupplier(syncSupplierDtoList);
706
707
708
709
710
711
712
713
714
    }

    /**
     * 同步盛具类型信息
     */
    @Log(title = "同步盛具类型信息", action = BusinessType.INSERT)
    @ApiOperation("同步盛具类型信息")
    @ApiLogger(apiName = "同步盛具类型信息", from="MES")
    @PostMapping("/syncVehicleType")
715
716
    public AjaxResult syncVehicleType(@RequestBody List<SyncVehicleTypeDto> syncVehicleTypeDtoList) {
        return mesService.syncVehicleType(syncVehicleTypeDtoList);
717
    }
肖超群 authored
718
}