WmsApiController.java
4.8 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
package com.huaheng.api.general.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huaheng.api.general.domain.TaskDomain;
import com.huaheng.api.general.domain.TaskOffDomain;
import com.huaheng.api.general.service.TaskService;
import com.huaheng.common.constant.QuantityConstant;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.framework.web.service.ConfigService;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping("/api")
@Api(tags = {"任务下发接口"}, value = "task")
public class WmsApiController {
@Resource
private TaskService taskService;
@Resource
private ConfigService configService;
@Log(title = "任务下发至立库", action = BusinessType.INSERT)
@PostMapping("/WisJobSend")
@ApiOperation("任务下发至立库")
@ResponseBody
@ApiLogger(apiName = "任务下发至立库", from = "集团WMS")
public AjaxResult WisJobSend(@RequestBody TaskDomain taskDomain) {
String value = configService.getKey(QuantityConstant.WMS_ERP_OFF);
if (Integer.valueOf(value)==1)
{
return AjaxResult.error("已关闭对ERP集成");
}
AjaxResult ajaxResult=new AjaxResult();
switch (Integer.valueOf(taskDomain.getTaskType()))
{
case 1:
ajaxResult=taskService.taskAllreceipt(taskDomain);
//入库
break;
case 2:
ajaxResult=taskService.lssueTask(taskDomain);
//整出
break;
case 3:;
ajaxResult=taskService.noProduction(taskDomain);
//补充出
break;
case 4:
ajaxResult=taskService.airflare(taskDomain);
//入库返回
break;
}
return ajaxResult;
}
@Resource
private TaskHeaderService taskHeaderService;
@Log(title = "任务取消", action = BusinessType.INSERT)
@PostMapping("/Taskcancellation")
@ApiOperation("任务取消")
@ResponseBody
@Transactional
@ApiLogger(apiName = "任务取消", from = "集团WMS")
public AjaxResult Taskcancellation(@RequestBody TaskOffDomain taskDomain) {
if (taskDomain == null) {
throw new ServiceException("wms下发任务为空");
}
//1、判断必填字段是否满足
if(taskDomain.getReqID() == null){
throw new ServiceException("wms任务号Id为空");
}
if(taskDomain.getContainerCode() == null){
throw new ServiceException("wms任务容器为空");
}
if(taskDomain.getTaskNo() == null){
throw new ServiceException("wms任务号为空");
}
if(taskDomain.getRequestTime() == null){
throw new ServiceException("wms任务时间为空");
}
LambdaQueryWrapper<TaskHeader> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TaskHeader::getUserDef3, taskDomain.getTaskNo()).eq(TaskHeader::getContainerCode, taskDomain.getContainerCode());
TaskHeader taskHeader = taskHeaderService.getOne(wrapper);
AjaxResult ajaxResult=taskService.taskOff(taskDomain);
return ajaxResult;
}
@Log(title = "呼叫空托盘", action = BusinessType.INSERT)
@PostMapping("/wisCallEmptyContainer")
@ApiOperation("呼叫空托盘")
@ResponseBody
@Transactional
@ApiLogger(apiName = "呼叫空托盘", from = "集团WMS")
public AjaxResult wisCallEmptyContainer(@RequestBody TaskOffDomain taskDomain) {
if (taskDomain == null) {
throw new ServiceException("wms下发任务为空");
}
if(taskDomain.getReqID() == null) {
throw new ServiceException("wms任务号Id为空");
}
if(taskDomain.getContainerType() == null) {
throw new ServiceException("wms任务容器类型为空");
}
if(taskDomain.getTaskNo() == null) {
throw new ServiceException("wms任务号为空");
}
if(taskDomain.getToStnNo() == null) {
throw new ServiceException("wms任务时间为空");
}
return taskService.WisCallEmptyContainer(taskDomain);
}
}