|
1
2
|
package com.huaheng.api.wcs.controller;
|
|
3
4
5
6
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.api.wcs.domain.TaskFinishDomain;
import com.huaheng.api.wcs.domain.WCSInfo;
import com.huaheng.api.wcs.domain.WcsTask;
|
|
7
8
9
10
11
12
|
import com.huaheng.api.wcs.service.receivingHandle.ReceivingHandleService;
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 com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerView;
|
|
13
|
import com.huaheng.pc.task.agvTask.domain.AgvTask;
|
|
14
15
16
|
import com.huaheng.pc.task.agvTask.service.AgvTaskService;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
|
|
17
18
19
20
|
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
|
|
21
|
import java.util.List;
|
|
22
23
24
|
@RestController
@RequestMapping("/API/WMS/v2")
|
|
25
|
public class ReceivingHandleController extends BaseController {
|
|
26
27
|
@Resource
private ReceivingHandleService receivingHandleService;
|
|
28
29
30
31
|
@Resource
private AgvTaskService agvTaskService;
@Resource
private TaskHeaderService taskHeaderService;
|
|
32
33
|
@PostMapping("/saveWholeContainer")
|
|
34
35
|
@ApiOperation("WCS组盘")
@ApiLogger(apiName = "WCS组盘", from = "WCS")
|
|
36
|
@ResponseBody
|
|
37
|
public AjaxResult saveWholeContainer(@RequestBody ReceiptContainerView view) {
|
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
String area = view.getArea();
String rollNumber = view.getRollNumber();
String containerCode = view.getContainerCode();
Integer containerDetailNumber = view.getPosition();
String port = view.getPort();
if (StringUtils.isEmpty(area)) {
return AjaxResult.error("库区编号为空");
}
if (StringUtils.isEmpty(rollNumber)) {
return AjaxResult.error("卷号为空");
}
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("容器号为空");
}
if (StringUtils.isNull(containerDetailNumber)) {
return AjaxResult.error("位置号为空");
}
if (StringUtils.isEmpty(port)) {
return AjaxResult.error("站台为空");
}
|
|
58
|
AjaxResult ajaxResult = handleMultiProcess("saveWholeContainer", new MultiProcessListener() {
|
|
59
60
61
62
63
64
65
66
67
68
69
70
71
|
@Override
public AjaxResult doProcess() {
return receivingHandleService.saveWholeContainer(view);
}
});
return ajaxResult;
}
@PostMapping("/continueSaveContainer")
@ApiOperation("是否继续组盘")
@ApiLogger(apiName = "是否继续组盘", from = "WCS")
@ResponseBody
public AjaxResult continueSaveContainer(@RequestBody ReceiptContainerView view) {
|
|
72
73
|
String area = view.getArea();
String rollNumber = view.getRollNumber();
|
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
String containerCode = view.getContainerCode();
Integer containerDetailNumber = view.getPosition();
String port = view.getPort();
if (StringUtils.isEmpty(area)) {
return AjaxResult.error("库区编号为空");
}
if (StringUtils.isEmpty(rollNumber)) {
return AjaxResult.error("卷号为空");
}
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("容器号为空");
}
if (StringUtils.isNull(containerDetailNumber)) {
return AjaxResult.error("位置号为空");
}
if (StringUtils.isEmpty(port)) {
return AjaxResult.error("站台为空");
}
|
|
92
|
AjaxResult ajaxResult = handleMultiProcess("continueSaveContainer", new MultiProcessListener() {
|
|
93
94
95
96
97
98
99
100
|
@Override
public AjaxResult doProcess() {
return receivingHandleService.saveWholeContainer(view);
}
});
return ajaxResult;
}
|
|
101
|
@PostMapping("/wcsContainerHasMaterial")
|
|
102
103
|
@ApiOperation("托盘是否有料")
@ApiLogger(apiName = "托盘是否有料", from = "wcs")
|
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
@ResponseBody
public AjaxResult wcsContainerHasMaterial(@RequestBody WcsTask wcsTask) {
String containerCode = wcsTask.getContainerCode();
String taskNo = wcsTask.getTaskNo();
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("容器号为空");
}
if (StringUtils.isNull(taskNo)) {
return AjaxResult.error("任务号不能为空");
}
AjaxResult ajaxResult = handleMultiProcess("wcsContainerHasMaterial", new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
TaskHeader taskHeader = taskHeaderService.getById(taskNo);
if(taskHeader == null){
return AjaxResult.error();
}
|
|
121
|
int hasMaterial = taskHeader.getTaskType() == 300 ? 0 : 1;
|
|
122
123
124
125
126
127
|
return AjaxResult.success(hasMaterial);
}
});
return ajaxResult;
}
|
|
128
|
@PostMapping("/acsSaveWholeContainer")
|
|
129
|
@ApiOperation("源AGV组盘")
|
|
130
|
@ApiLogger(apiName = "AGV组盘", from = "acs")
|
|
131
|
@ResponseBody
|
|
132
|
public AjaxResult acsSaveWholeContainer(@RequestBody AgvTask agvTask) {
|
|
133
|
String area = agvTask.getArea();
|
|
134
135
|
Integer taskNo = agvTask.getTaskNo();
String containerCode = agvTask.getContainerCode();
|
|
136
|
String port = agvTask.getToPoint();
|
|
137
|
if (StringUtils.isEmpty(area)) {
|
|
138
139
|
return AjaxResult.error("库区编号为空");
}
|
|
140
|
if (StringUtils.isEmpty(containerCode)) {
|
|
141
142
|
return AjaxResult.error("容器号为空");
}
|
|
143
|
if (StringUtils.isEmpty(port)) {
|
|
144
145
|
return AjaxResult.error("站台为空");
}
|
|
146
147
148
149
150
151
|
if (StringUtils.isNull(taskNo)) {
return AjaxResult.error("任务号不能为空");
}
AgvTask task = agvTaskService.getAgvTaskByTaskNo(taskNo);
if(task == null){
return AjaxResult.error("WMS AGV任务未找到或被删除");
|
|
152
|
}
|
|
153
|
|
|
154
|
AjaxResult ajaxResult = handleMultiProcess("acsSaveWholeContainer", new MultiProcessListener() {
|
|
155
156
|
@Override
public AjaxResult doProcess() {
|
|
157
158
159
|
ReceiptContainerView view = new ReceiptContainerView();
view.setArea(area);
view.setPort(port);
|
|
160
|
view.setRollNumber(task.getLot());
|
|
161
|
view.setPosition(1);
|
|
162
163
|
view.setContainerCode(containerCode);
return receivingHandleService.acsSaveWholeContainer(view);
|
|
164
165
166
167
168
|
}
});
return ajaxResult;
}
|
|
169
170
|
|
|
171
|
}
|