Blame view

src/main/java/com/huaheng/api/mes/controller/MesController.java 22.3 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;
6
import com.huaheng.common.utils.DateUtils;
肖超群 authored
7
8
9
10
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;
11
import com.huaheng.framework.web.domain.AjaxResultMES;
肖超群 authored
12
13
14
15
16
17
import com.huaheng.pc.task.taskHeader.service.WorkTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

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

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

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

    /**
     * 生成空托盘入库任务
36
     * 7 料点呼叫移走空载具
37
     *
肖超群 authored
38
39
40
41
     * @return
     */
    @PostMapping("/receiptEmptyContainer")
    @ApiOperation("生成空托盘入库任务")
周峰 authored
42
    @ApiLogger(apiName = "7 生成空托盘入库任务", from = "MES")
肖超群 authored
43
    @ResponseBody
44
45
    public AjaxResult receiptEmptyContainer(@RequestBody MesEmptyContainer mesEmptyContainer) {
        String taskNo = mesEmptyContainer.getTaskNo();
46
        String orderCode = mesEmptyContainer.getOrderCode();
47
        String fromPort = mesEmptyContainer.getFromPort();
48
49
50
51
52
        // 交换载具和盛具的值
        String containerTypeCode = mesEmptyContainer.getVehicleTypeCode();
        String containerCode = mesEmptyContainer.getVehicleCode();
        String vehicleTypeCode = mesEmptyContainer.getContainerTypeCode();
        String vehicleCode = mesEmptyContainer.getContainerCode();
53
        boolean isEmptyVehBack = mesEmptyContainer.getIsEmptyVehBack() == 1;
54
        if (StringUtils.isEmpty(containerCode)) {
55
            return AjaxResult.error("vehicleCode 为空");
56
        }
57
58
59
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
60
61
        if (StringUtils.isEmpty(containerTypeCode)) {
            return AjaxResult.error("containerTypeCode 为空");
62
63
64
65
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
66
67
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
68
        }
69
        if (!isEmptyVehBack && StringUtils.isEmpty(vehicleTypeCode)) {
70
            return AjaxResult.error("containerTypeCode 为空");
71
        }
72
        if (!isEmptyVehBack && StringUtils.isEmpty(vehicleCode)) {
73
            return AjaxResult.error("containerCode 为空");
74
        }
75
        // 因MES传的载具和盛具码是反的,此处交换载具与盛具的值 反着入参
76
        return handleMultiProcess(() -> workTaskService.createEmptyIn(
77
                taskNo, fromPort, orderCode, containerCode, vehicleCode, null));
肖超群 authored
78
79
80
    }

    /**
周峰 authored
81
     * 5 MES下发空托盘出库
82
     *
肖超群 authored
83
84
85
86
     * @return
     */
    @PostMapping("/shipmentEmptyContainer")
    @ApiOperation("MES下发空托盘出库")
周峰 authored
87
    @ApiLogger(apiName = "5 MES下发空托盘出库", from = "MES")
肖超群 authored
88
89
    public AjaxResult shipmentEmptyContainer(@RequestBody MesEmptyContainer mesEmptyContainer) {
        String taskNo = mesEmptyContainer.getTaskNo();
90
        String orderCode = mesEmptyContainer.getOrderCode();
肖超群 authored
91
        String toPort = mesEmptyContainer.getToPort();
92
        String containerTypeCode = mesEmptyContainer.getContainerTypeCode();
93
94
        String vehicleTypeCode = mesEmptyContainer.getVehicleTypeCode();
        if (StringUtils.isEmpty(containerTypeCode)) {
95
            return AjaxResult.error("containerTypeCode 为空");
肖超群 authored
96
        }
97
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
98
99
            return AjaxResult.error("taskNo 为空");
        }
100
        if (StringUtils.isEmpty(toPort)) {
肖超群 authored
101
102
            return AjaxResult.error("toPort 为空");
        }
103
104
        if (StringUtils.isEmpty(vehicleTypeCode)) {
            return AjaxResult.error("vehicleTypeCode 为空");
肖超群 authored
105
        }
106
107
108
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
109
110
111
112
113
114
        // 载具与盛具和MES那边定义是反的,故WMS交换值
        String temp = containerTypeCode;
        containerTypeCode = vehicleTypeCode;
        vehicleTypeCode = temp;
        String finalContainerTypeCode = containerTypeCode;
        String finalVehicleTypeCode = vehicleTypeCode;
115
        return handleMultiProcess(() -> workTaskService.shipmentEmptyContainer(
116
                taskNo, orderCode, toPort, finalContainerTypeCode, finalVehicleTypeCode));
肖超群 authored
117
118
119
    }

    /**
周峰 authored
120
     * 1 MES查询库存
121
     *
肖超群 authored
122
123
124
125
     * @return
     */
    @PostMapping("/searchInventory")
    @ApiOperation("MES查询库存")
周峰 authored
126
    @ApiLogger(apiName = "1 MES查询库存", from = "MES")
127
    public AjaxResultMES searchInventory(@RequestBody MesSearch mesSearch) {
yuxiao authored
128
        String taskNo = mesSearch.getTaskNo();
129
        List<MaterialDataQuery> list = mesSearch.getMaterialDataList();
130
        if (StringUtils.isEmpty(taskNo)) {
131
            return AjaxResultMES.error("taskNo 为空");
yuxiao authored
132
        }
yuxiao authored
133
        if (StringUtils.isEmpty(list)) {
134
            return AjaxResultMES.error("materialDataList 为空");
肖超群 authored
135
        }
136
137
        try {
            return mesService.searchInventory(mesSearch);
138
        } catch (Exception e) {
139
140
            return AjaxResultMES.error(e.getMessage());
        }
141
    }
肖超群 authored
142
143
    /**
周峰 authored
144
     * 2 MES主工单下发
145
     *
146
147
148
149
     * @return
     */
    @PostMapping("/workOrder")
    @ApiOperation("MES主工单下发")
周峰 authored
150
    @ApiLogger(apiName = "2 MES主工单下发", from = "MES")
周峰 authored
151
    public synchronized AjaxResult workOrder(@RequestBody MesWorkOrder workOrder) {
152
        if (StringUtils.isEmpty(workOrder.getTaskNo())) {
153
154
            return AjaxResult.error("taskNo 为空");
        }
155
        if (StringUtils.isEmpty(workOrder.getOrderCode())) {
156
157
            return AjaxResult.error("orderCode 为空");
        }
158
        if (workOrder.getOrderStatus() == null) {
159
160
            return AjaxResult.error("orderStatus 为空");
        }
161
        if (StringUtils.isEmpty(workOrder.getProductCode())) {
162
163
            return AjaxResult.error("productCode 为空");
        }
164
        if (workOrder.getProductQty() == null) {
165
166
            return AjaxResult.error("productQty 为空");
        }
167
        if (StringUtils.isEmpty(workOrder.getPlanStartTime())) {
168
169
            return AjaxResult.error("planStartTime 为空");
        }
170
        if (StringUtils.isEmpty(workOrder.getPlanEndTime())) {
171
172
            return AjaxResult.error("planEndTime 为空");
        }
173
        if (StringUtils.isEmpty(workOrder.getMaterialDataList()) || workOrder.getMaterialDataList().isEmpty()) {
174
            return AjaxResult.error("materialDataList 为空");
175
        }
176
        return mesService.workOrder(workOrder);
肖超群 authored
177
178
179
    }

    /**
180
     * MES工单入库单(弃用)
181
182
     * 已经取消该接口 9
     *
肖超群 authored
183
184
     * @return
     */
185
186

    @Deprecated
肖超群 authored
187
188
    @PostMapping("/receiptOrder")
    @ApiOperation("MES工单入库单")
189
    @ApiLogger(apiName = "MES工单入库单", from = "MES")
肖超群 authored
190
    public AjaxResult receiptOrder(@RequestBody MesOrder mesOrder) {
191
        String orderCode = mesOrder.getOrderCode();
肖超群 authored
192
        String taskNo = mesOrder.getTaskNo();
193
        List<MesOrderMaterial> list = mesOrder.getMaterialDataList();
194
        if (StringUtils.isEmpty(orderCode)) {
肖超群 authored
195
196
            return AjaxResult.error("orderCode 为空");
        }
197
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
198
199
            return AjaxResult.error("taskNo 为空");
        }
200
        if (StringUtils.isEmpty(mesOrder.getChidOrderCode())) {
201
202
            return AjaxResult.error("chidOrderCode 为空");
        }
203
        if (mesOrder.getOrderStatus() == null) {
204
205
            return AjaxResult.error("orderStatus 为空");
        }
206
        if (StringUtils.isEmpty(mesOrder.getReceiptReferCode())) {
207
208
            return AjaxResult.error("receiptReferCode 为空");
        }
209
        if (StringUtils.isEmpty(list) || list.isEmpty()) {
210
            return AjaxResult.error("materialDataList 为空");
肖超群 authored
211
        }
212
        return handleMultiProcess(() -> mesService.receiptOrder(mesOrder));
肖超群 authored
213
214
215
    }

    /**
周峰 authored
216
     * 3 MES工单领料单出库单
217
     *
肖超群 authored
218
219
220
     * @return
     */
    @PostMapping("/shipmentOrder")
yuxiao authored
221
    @ApiOperation("MES工单领料单出库单")
周峰 authored
222
    @ApiLogger(apiName = "3 MES工单领料单出库单", from = "MES")
223
224
    public AjaxResult shipmentOrder(@RequestBody MesShipmentOrder mesOrder) {
        String orderCode = mesOrder.getOrderCode();
肖超群 authored
225
226
        String taskNo = mesOrder.getTaskNo();
        BigDecimal orderQty = mesOrder.getOrderQty();
227
        if (StringUtils.isEmpty(orderCode)) {
肖超群 authored
228
229
            return AjaxResult.error("orderCode 为空");
        }
230
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
231
232
            return AjaxResult.error("taskNo 为空");
        }
233
        if (StringUtils.isEmpty(mesOrder.getChidOrderCode())) {
周鸿 authored
234
            return AjaxResult.error("childOrderCode 为空");
235
236
237
238
        }
        if (StringUtils.isEmpty(mesOrder.getProductCode())) {
            return AjaxResult.error("productCode 为空");
        }
239
        if (StringUtils.isNull(mesOrder.getShipmentReferStatus())) {
240
241
            return AjaxResult.error("shipmentReferStatus 为空");
        }
242
243
244
        if (StringUtils.isEmpty(mesOrder.getShipmentReferCode())) {
            return AjaxResult.error("shipmentReferCode 为空");
        }
245
        if (orderQty == null) {
肖超群 authored
246
247
            return AjaxResult.error("orderQty 为空");
        }
周鸿 authored
248
        if (StringUtils.isEmpty(mesOrder.getMaterialDataList())) {
249
            return AjaxResult.error("materialDataList 为空");
250
        }
251
        return handleMultiProcess(() -> mesService.shipmentOrder(mesOrder));
肖超群 authored
252
253
254
255
    }

    /**
     * MES成品出库
256
     *
肖超群 authored
257
258
259
260
     * @return
     */
    @PostMapping("/shipmentProduct")
    @ApiOperation("MES成品出库")
261
    @ApiLogger(apiName = "MES成品出库", from = "MES")
262
    public AjaxResult shipmentProduct(@RequestBody MesShipmentProduct mesShipmentProduct) {
肖超群 authored
263
        String containerCode = mesShipmentProduct.getContainerCode();
264
265
        String fromPort = mesShipmentProduct.getFromPort();
        String toPort = mesShipmentProduct.getToPort();
肖超群 authored
266
        String taskNo = mesShipmentProduct.getTaskNo();
267
268
        String vehicleCode = mesShipmentProduct.getVehicleCode();
        String orderCode = mesShipmentProduct.getOrderCode();
269
        if (StringUtils.isEmpty(containerCode)) {
肖超群 authored
270
271
            return AjaxResult.error("containerCode 为空");
        }
272
273
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
肖超群 authored
274
        }
275
276
        if (StringUtils.isEmpty(toPort)) {
            return AjaxResult.error("toPort 为空");
肖超群 authored
277
        }
278
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
279
280
            return AjaxResult.error("taskNo 为空");
        }
281
282
283
284
285
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
286
        }
287
        return handleMultiProcess(() -> mesService.shipmentProduct(mesShipmentProduct));
肖超群 authored
288
289
290
    }

    /**
291
292
293
294
295
296
297
298
299
     * 工位之间载具流转 11
     *
     * @return
     */
    @PostMapping("/overStation")
    @ApiOperation("MES载具流转")
    @ApiLogger(apiName = "MES载具流转", from = "MES")
    public AjaxResult overStation(@RequestBody MesOverStationDto mesOverStationDto) {
        String containerCode = mesOverStationDto.getContainerCode();
300
301
        String fromPort = mesOverStationDto.getFromPort();
        String toPort = mesOverStationDto.getToPort();
302
303
304
305
306
307
        String taskNo = mesOverStationDto.getTaskNo();
        String vehicleCode = mesOverStationDto.getVehicleCode();
        String orderCode = mesOverStationDto.getOrderCode();
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("containerCode 为空");
        }
308
        if (StringUtils.isEmpty(fromPort)) {
309
            return AjaxResult.error("fromPort 为空");
310
        }
311
        if (StringUtils.isEmpty(toPort)) {
312
            return AjaxResult.error("toPort 为空");
313
314
315
316
317
318
319
320
321
322
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
323
324
325
        // 交换载具盛具的值,MES给的与WMS的是反的
        mesOverStationDto.setContainerCode(vehicleCode);
        mesOverStationDto.setVehicleCode(containerCode);
326
327
328
329
        return handleMultiProcess(() -> mesService.createOverStation(mesOverStationDto));
    }

    /**
肖超群 authored
330
     * MES物料入库
331
332
     * 6 料点呼叫移走物料
     *
肖超群 authored
333
334
335
336
     * @return
     */
    @PostMapping("/receipt")
    @ApiOperation("MES物料入库")
周峰 authored
337
    @ApiLogger(apiName = "6 MES物料入库", from = "MES")
肖超群 authored
338
339
    public AjaxResult receipt(@RequestBody MesReceipt mesReceipt) {
        String taskNo = mesReceipt.getTaskNo();
周峰 authored
340
341
        //设置入库单类型为半成品入库
        mesReceipt.setReceiptType(QuantityConstant.RECEIPT_TYPE_SEMI);
342
        String orderCode = mesReceipt.getOrderCode();
343
        String containerType = mesReceipt.getContainerTypeCode();
肖超群 authored
344
        String containerCode = mesReceipt.getContainerCode();
pengyongcheng authored
345
        String fromPort = mesReceipt.getFromPort();
346
347
        String vehicleCode = mesReceipt.getVehicleCode();
        String vehicleTypeCode = mesReceipt.getVehicleTypeCode();
348
        List<MaterialData> materialDataList = mesReceipt.getMaterialDataList();
肖超群 authored
349
350
        if (StringUtils.isEmpty(taskNo)) {
肖超群 authored
351
352
            return AjaxResult.error("taskNo 为空");
        }
353
354
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
肖超群 authored
355
        }
356
357
        if (StringUtils.isEmpty(containerType)) {
            return AjaxResult.error("containerType 为空");
肖超群 authored
358
        }
359
        if (StringUtils.isEmpty(containerCode)) {
肖超群 authored
360
361
            return AjaxResult.error("containerCode 为空");
        }
pengyongcheng authored
362
363
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
肖超群 authored
364
        }
365
366
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
肖超群 authored
367
        }
368
369
370
        if (StringUtils.isEmpty(vehicleTypeCode)) {
            return AjaxResult.error("vehicleTypeCode 为空");
        }
371
372
        if (StringUtils.isEmpty(materialDataList)) {
            return AjaxResult.error("materialDataList 为空");
373
        }
374
375
376
377
378
379
380
381
382
383
384
385
        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);
            }
        }
386
387
388
389
390
        // 交换载具盛具的值,MES给的与WMS的是反的
        mesReceipt.setContainerCode(vehicleCode);
        mesReceipt.setContainerTypeCode(vehicleTypeCode);
        mesReceipt.setVehicleCode(containerCode);
        mesReceipt.setVehicleTypeCode(containerType);
391
        return handleMultiProcess(() -> mesService.receipt(mesReceipt));
392
393
394
    }

    /**
周峰 authored
395
     * 10余料回库
396
397
398
399
     *
     * @return
     */
    @PostMapping("/rawReceipt")
400
    @ApiOperation("余料回库")
周峰 authored
401
    @ApiLogger(apiName = "10 余料回库", from = "MES")
402
    public AjaxResult rawReceipt(@RequestBody MesReceipt mesReceipt) {
403
404
405
        //mes调用接口时,代表入库单类型为余料退库
        mesReceipt.setReceiptType(QuantityConstant.RECEIPT_TYPE_BACK);
406
407
        String taskNo = mesReceipt.getTaskNo();
408
409
        String containerType = mesReceipt.getContainerTypeCode();
        String containerCode = mesReceipt.getContainerCode();
pengyongcheng authored
410
        String fromPort = mesReceipt.getFromPort();
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
        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 为空");
        }
pengyongcheng authored
435
436
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
437
438
439
440
441
442
443
444
445
446
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(vehicleTypeCode)) {
            return AjaxResult.error("vehicleTypeCode 为空");
        }
        if (StringUtils.isEmpty(materialData)) {
            return AjaxResult.error("materialData 为空");
        }
447
448
449
450
451
452

        // 交换载具盛具的值,MES给的与WMS的是反的
        mesReceipt.setContainerCode(vehicleCode);
        mesReceipt.setContainerTypeCode(vehicleTypeCode);
        mesReceipt.setVehicleCode(containerCode);
        mesReceipt.setVehicleTypeCode(containerType);
453
454
455
456
457
458
459
460
461
462
463
464
465
        return handleMultiProcess(() -> mesService.receipt(mesReceipt));
    }

    /**
     * 原材料入库
     *
     * @return
     */
    @PostMapping("/wmsReceipt")
    @ApiOperation("原材料入库")
    @ApiLogger(apiName = "原材料入库", from = "wms-pc")
    public AjaxResult wmsReceipt(@RequestBody MesReceipt mesReceipt) {
466
467
        //wms调用接口时,代表入库单类型为原材料入库
        mesReceipt.setReceiptType(QuantityConstant.RECEIPT_TYPE_RAW);
468
469
        String taskNo = mesReceipt.getTaskNo();
470
        String orderCode = mesReceipt.getOrderCode();
471
472
        String vehicleCode = mesReceipt.getVehicleCode();
        String vehicleTypeCode = mesReceipt.getVehicleTypeCode();
473
        List<MaterialData> materialData = mesReceipt.getMaterialDataList();
474
        HashMap<String, String> quTest = new HashMap<>();
475
476
477
478
479
480
481
482
483
484
485
486
        // 通用盛具不做校验
        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);
                }
487
488
            }
        }
489
490
491
492
493
494
495
496
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(vehicleTypeCode)) {
            return AjaxResult.error("vehicleTypeCode 为空");
肖超群 authored
497
        }
周鸿 authored
498
        if (StringUtils.isEmpty(materialData)) {
肖超群 authored
499
500
            return AjaxResult.error("materialData 为空");
        }
501
502
503
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
504
        return handleMultiProcess(() -> mesService.wmsReceipt(mesReceipt));
肖超群 authored
505
    }
506
507
508

    /**
     * 物料出库
周峰 authored
509
     * 4 料点呼叫送物料
510
     *
511
512
513
514
     * @return
     */
    @PostMapping("/shipment")
    @ApiOperation("物料出库")
周峰 authored
515
    @ApiLogger(apiName = "4 物料出库", from = "MES")
516
517
518
519
520
521
522
523
524
525
526
527
528
    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 为空");
        }
529
        if (mesShipment.getVehicleinsert() == null) {
530
            return AjaxResult.error("vehicleinsert 为空");
531
        }
周鸿 authored
532
        if (StringUtils.isEmpty(mesShipment.getMaterialDataList())) {
533
534
            return AjaxResult.error("materialData 为空");
        }
周峰 authored
535
536
537
538
        if (mesShipment.getSequenceCount() <= 0) {
            return AjaxResult.error("sequenceCount 为空");
        }
539
        if (StringUtils.isEmpty(mesShipment.getSequenceGroup())) {
周峰 authored
540
541
            return AjaxResult.error("sequenceGroup 为空");
        }
542
        return handleMultiProcess(() -> mesService.shipment(mesShipment));
543
    }
544
545

    /**
546
     * 入库回传
547
548
549
550
     */
    @PostMapping("/backReceipt")
    @ResponseBody
    @ApiLogger(from = "WMS", to = "MES", apiName = "入库回传")
551
552
    public AjaxResult backReceipt(Integer id) {
        if (StringUtils.isNull(id)) {
553
554
555
556
557
558
            return AjaxResult.error("id不能为空");
        }
        return mesService.backReceipt(id);
    }

    /**
559
     * 出库回传
560
     */
561
    @PostMapping("/backShipment")
562
563
    @ResponseBody
    @ApiLogger(from = "WMS", to = "MES", apiName = "出库回传")
564
    public AjaxResult backShipment(String id) {
565
566
567
568
569
570
571
        if (StringUtils.isEmpty(id)) {
            return AjaxResult.error("id不能为空");
        }
        return mesService.backShipment(id);
    }

    /**
572
     * 工位之间载具流转回传
573
     */
574
    @PostMapping("/backChangeStation")
575
    @ResponseBody
576
    @ApiLogger(from = "WMS", to = "MES", apiName = "工位之间载具流转回传")
577
    public AjaxResult backEmpty(String id) {
578
        if (StringUtils.isEmpty(id)) {
579
            return AjaxResult.error("任务id不能为空");
580
        }
581
        return mesService.backChangeStation(id);
582
    }
肖超群 authored
583
}