Blame view

src/main/java/com/huaheng/api/mes/controller/MesController.java 25.8 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传的载具和盛具码是反的,此处交换载具与盛具的值 反着入参
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
        }
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 为空");
        }
180
        if (StringUtils.isEmpty(list) || list.isEmpty()) {
181
            return AjaxResult.error("materialDataList 为空");
肖超群 authored
182
        }
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
        }
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
        }
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
        String taskNo = mesOverStationDto.getTaskNo();
        String vehicleCode = mesOverStationDto.getVehicleCode();
267
        Double solidifyTime = mesOverStationDto.getSolidifyTime();
268
269
270
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("containerCode 为空");
        }
271
        if (StringUtils.isEmpty(fromPort)) {
272
            return AjaxResult.error("fromPort 为空");
273
        }
274
        if (StringUtils.isEmpty(toPort)) {
275
            return AjaxResult.error("toPort 为空");
276
277
278
279
280
281
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
282
        }
283
        if (Objects.isNull(solidifyTime)) {
284
            return AjaxResult.error("solidifyTime 为空");
285
        }
286
287
288
        // 交换载具盛具的值,MES给的与WMS的是反的
        mesOverStationDto.setContainerCode(vehicleCode);
        mesOverStationDto.setVehicleCode(containerCode);
289
290
291
292
        return handleMultiProcess(() -> mesService.createOverStation(mesOverStationDto));
    }

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

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

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

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

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

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

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

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

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

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

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

    /**
591
592
593
594
595
596
597
598
599
600
     * 获取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);
    }
601
602

    /**
603
     * /退库
604
     */
605
606
    @Log(title = "清/退库", action = BusinessType.INSERT)
    @ApiOperation("清/退库")
607
    @ApiLogger(apiName = "同步物料信息", from="MES")
608
609
610
611
612
613
    @PostMapping("/clearStock")
    public AjaxResult clearStock(@RequestBody ClearStockDto clearStockDto) {
        return mesService.clearStock(clearStockDto);
    }

    /**
614
615
616
617
618
619
620
621
622
623
624
     * 在制品/产出品出库
     */
    @Log(title = "在制品/产出品出库", action = BusinessType.INSERT)
    @ApiOperation("在制品/产出品出库")
    @ApiLogger(apiName = "在制品/产出品出库", from="MES")
    @PostMapping("/productShipment")
    public AjaxResult productShipment(@RequestBody ProductShipmentDto productShipmentDto) {
        return mesService.productShipmentDto(productShipmentDto);
    }

    /**
625
626
627
628
629
     * 查询空库位
     */
    @Log(title = "查询空库位", action = BusinessType.INSERT)
    @ApiOperation("查询空库位")
    @ApiLogger(apiName = "查询空库位", from="MES")
630
    @GetMapping("/queryEmptyLocation")
631
    public AjaxResult<List<EmptyLocationDto>> queryEmptyLocation() {
632
        return mesService.queryEmptyLocation();
633
634
635
    }

    /**
636
     * 查询药量
pengyongcheng authored
637
638
639
640
641
642
643
644
645
646
     */
    @Log(title = "查询药量", action = BusinessType.INSERT)
    @ApiOperation("查询药量")
    @ApiLogger(apiName = "查询药量", from="MES")
    @GetMapping("/queryPowder")
    public AjaxResult<?> queryPowder() {
        return mesService.queryPowder();
    }

    /**
647
     * 查询固化时间
648
649
650
651
652
653
654
655
656
657
     */
    @Log(title = "查询固化时间", action = BusinessType.INSERT)
    @ApiOperation("查询固化时间")
    @ApiLogger(apiName = "查询固化时间", from="MES")
    @PostMapping("/querySolidifyTime")
    public AjaxResult<?> querySolidifyTime(@RequestBody QuerySolidifyTimeDto querySolidifyTimeDto) {
        return mesService.querySolidifyTime(querySolidifyTimeDto);
    }

    /**
658
659
660
661
662
     * 同步物料信息
     */
    @Log(title = "同步物料信息", action = BusinessType.INSERT)
    @ApiOperation("同步物料信息")
    @ApiLogger(apiName = "同步物料信息", from="MES")
663
    @PostMapping("/syncMaterial")
664
665
    public AjaxResult syncMaterial(@RequestBody List<SyncMaterialDto> syncMaterialDtoList) {
        return mesService.syncMaterial(syncMaterialDtoList);
666
667
668
669
670
671
672
673
674
    }

    /**
     * 同步供应商信息
     */
    @Log(title = "同步供应商信息", action = BusinessType.INSERT)
    @ApiOperation("同步供应商信息")
    @ApiLogger(apiName = "同步供应商信息", from="MES")
    @PostMapping("/syncSupplier")
675
676
    public AjaxResult syncSupplier(@RequestBody List<SyncSupplierDto> syncSupplierDtoList) {
        return mesService.syncSupplier(syncSupplierDtoList);
677
678
679
680
681
682
683
684
685
    }

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