MesNotEmptyContainerController.java
3.25 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
package com.huaheng.api.mes.controller;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.huaheng.api.mes.domain.MesMaterial;
import com.huaheng.api.mes.service.mesNotEmptyContainerService.NotEmptyContainerService;
import com.huaheng.common.exception.service.ServiceException;
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 io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/API/WMS/v2")
public class MesNotEmptyContainerController extends BaseController {
@Resource
private NotEmptyContainerService notEmptyContainerService;
/**
* 生成物料入库任务(整盘入库)
* @return
* @Param taskNo mes下发任务号
* containerCode 容器编码
* vehicleNo 载具编码
* vehicleSpec 载具规格
* mesMaterialList 物料信息
*/
@PostMapping("/receipt")
@Transactional(rollbackFor = Exception.class)
@ApiOperation("MES下发物料入库")
@ApiLogger(apiName = "MES下发物料入库", from="MES")
public AjaxResult receipt(String taskNo, String containerCode, String vehicleNo, String vehicleSpec, List<MesMaterial> mesMaterialList){
if(StringUtils.isEmpty(taskNo)){
throw new ServiceException("任务号不能为空!");
}
if(StringUtils.isEmpty(containerCode)){
throw new ServiceException("容器号不能为空!");
}
if(StringUtils.isEmpty(vehicleNo)){
throw new ServiceException("载具编码不能为空!");
}
if(StringUtils.isEmpty(vehicleSpec)){
throw new ServiceException("载具规格不能为空!");
}
if(CollectionUtils.isEmpty(mesMaterialList)){
throw new ServiceException("物料信息不能为空!");
}
return notEmptyContainerService.receipt(taskNo, containerCode, vehicleNo, vehicleSpec, mesMaterialList);
}
/**
* 生成物料出库任务(整盘出库)
* @return
* @Param taskNo mes下发任务号
* toPort 出库口
* mesMaterialList 物料信息
*/
@PostMapping("/shipment")
@Transactional(rollbackFor = Exception.class)
@ApiOperation("MES下发物料出库")
@ApiLogger(apiName = "MES下发物料出库", from="MES")
public AjaxResult receipt(String taskNo, String toPort, List<MesMaterial> mesMaterialList){
if(StringUtils.isEmpty(taskNo)){
throw new ServiceException("任务号不能为空!");
}
if(StringUtils.isEmpty(toPort)){
throw new ServiceException("出库口不能为空!");
}
if(CollectionUtils.isEmpty(mesMaterialList)){
throw new ServiceException("物料信息不能为空!");
}
return notEmptyContainerService.shipment(taskNo, toPort, mesMaterialList);
}
}