ReceivingHandleController.java
6.79 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
package com.huaheng.api.wcs.controller;
import com.huaheng.api.wcs.domain.WcsTask;
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;
import com.huaheng.pc.task.agvTask.domain.AgvTask;
import com.huaheng.pc.task.agvTask.service.AgvTaskService;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping("/API/WMS/v2")
public class ReceivingHandleController extends BaseController {
@Resource
private ReceivingHandleService receivingHandleService;
@Resource
private AgvTaskService agvTaskService;
@Resource
private TaskHeaderService taskHeaderService;
@PostMapping("/saveWholeContainer")
@ApiOperation("WCS组盘")
@ApiLogger(apiName = "WCS组盘", from = "WCS")
@ResponseBody
public AjaxResult saveWholeContainer(@RequestBody ReceiptContainerView view) {
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("站台为空");
}
AjaxResult ajaxResult = handleMultiProcess("saveWholeContainer", new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
return receivingHandleService.saveWholeContainer(view);
}
});
return ajaxResult;
}
@PostMapping("/continueSaveContainer")
@ApiOperation("是否继续组盘")
@ApiLogger(apiName = "是否继续组盘", from = "WCS")
@ResponseBody
public AjaxResult continueSaveContainer(@RequestBody ReceiptContainerView view) {
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("站台为空");
}
AjaxResult ajaxResult = handleMultiProcess("continueSaveContainer", new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
return receivingHandleService.saveWholeContainer(view);
}
});
return ajaxResult;
}
@PostMapping("/wcsContainerHasMaterial")
@ApiOperation("托盘是否有料")
@ApiLogger(apiName = "托盘是否有料", from = "wcs")
@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();
}
int hasMaterial = 0;
switch (taskHeader.getTaskType()) {
case 100:
case 200:
case 400:
case 300:
hasMaterial = 1;
break;
case 500:
case 600:
hasMaterial = 2;
break;
default:
}
return AjaxResult.success(hasMaterial);
}
});
return ajaxResult;
}
@PostMapping("/acsSaveWholeContainer")
@ApiOperation("源AGV组盘")
@ApiLogger(apiName = "AGV组盘", from = "acs")
@ResponseBody
public AjaxResult acsSaveWholeContainer(@RequestBody AgvTask agvTask) {
String area = agvTask.getArea();
Integer taskNo = agvTask.getTaskNo();
String containerCode = agvTask.getContainerCode();
String port = agvTask.getToPoint();
if (StringUtils.isEmpty(area)) {
return AjaxResult.error("库区编号为空");
}
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("容器号为空");
}
if (StringUtils.isEmpty(port)) {
return AjaxResult.error("站台为空");
}
if (StringUtils.isNull(taskNo)) {
return AjaxResult.error("任务号不能为空");
}
AgvTask task = agvTaskService.getAgvTaskByTaskNo(taskNo);
if (task == null) {
return AjaxResult.error("WMS AGV任务未找到或被删除");
}
AjaxResult ajaxResult = handleMultiProcess("acsSaveWholeContainer", new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
ReceiptContainerView view = new ReceiptContainerView();
view.setArea(area);
view.setPort(port);
view.setRollNumber(task.getLot());
view.setPosition(1);
view.setContainerCode(containerCode);
return receivingHandleService.acsSaveWholeContainer(view);
}
});
return ajaxResult;
}
}