CodingController.java
12.7 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
package com.huaheng.api.erp.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huaheng.api.erp.domain.BoxInfo;
import com.huaheng.api.erp.domain.ERPReceipt;
import com.huaheng.api.erp.domain.EmptyZu;
import com.huaheng.api.erp.domain.ShipmentRecord;
import com.huaheng.api.erp.service.CodingService;
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.config.proPackaging.domain.ProPackaging;
import com.huaheng.pc.config.proPackaging.service.IProPackagingService;
import com.huaheng.pc.config.proPackaging.service.impl.ProPackagingServiceImpl;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
WMS和赋码系统交互
* @author 游杰
*/
@RestController
@RequestMapping("/API/WMS/v2")
public class CodingController extends BaseController {
@Resource
private CodingService codingService;
@Resource
private IProPackagingService proPackagingService;
@PostMapping("/receipt")
@ApiOperation("入库组盘信息")
@ResponseBody
@ApiLogger(apiName = "入库组盘信息", from="码垛系统")
public AjaxResult receipt(@RequestBody ERPReceipt erpReceipt) {
if(erpReceipt == null) {
return AjaxResult.error("入库组盘信息为空");
}
String Pack="";
Integer so = 0;
List<String> Box=new ArrayList<>();
for(int i = 0;i<erpReceipt.getListBoxInfo().size();i++)
{
if(Box.contains(erpReceipt.getListBoxInfo().get(i).getBoxCode()))
{
return AjaxResult.error("箱码不能重复!!"+erpReceipt.getListBoxInfo().get(i).getBoxCode());
}
Box.add(erpReceipt.getListBoxInfo().get(i).getBoxCode());
if (Pack.equals(erpReceipt.getListBoxInfo().get(i).getProPackaging())==false)
{
if (StringUtils.isNotEmpty(erpReceipt.getListBoxInfo().get(i).getProPackaging())){
Pack=erpReceipt.getListBoxInfo().get(i).getProPackaging();
}
LambdaQueryWrapper<ProPackaging> proPackagingLambdaQueryWrapper = Wrappers.lambdaQuery();
proPackagingLambdaQueryWrapper.eq(ProPackaging::getName,Pack);
ProPackaging packagingServiceOne = proPackagingService.getOne(proPackagingLambdaQueryWrapper);
if (packagingServiceOne != null){
so=packagingServiceOne.getPieceBox();
}
}
Integer integer = Integer.valueOf(String.valueOf(erpReceipt.getListBoxInfo().get(i).getQty()));
if (erpReceipt.getTotalBoxes()==0)
{
return AjaxResult.error("箱数错误,不该为0");
}
if (erpReceipt.getTotalChips()==0)
{
return AjaxResult.error("片数错误,不该为0");
}
if (!Integer.valueOf(String.valueOf(erpReceipt.getListBoxInfo().get(i).getQty())).equals(so))
{
return AjaxResult.error("片数给的与发来的不对");
}
if (erpReceipt.getListBoxInfo().get(i).getChipInfos().size()!=so)
{
return AjaxResult.error("箱码"+erpReceipt.getListBoxInfo().get(i).getBoxCode()+"所对应的片码不相符合");
}
}
String containerCode = erpReceipt.getContainerCode();
String receiptCode = erpReceipt.getReceiptCode();
String position = erpReceipt.getRequestInCode();
String orderCode = erpReceipt.getOrderCode();
String orderName = erpReceipt.getOrderName();
Integer toalCases= erpReceipt.getTotalChips();
BigDecimal weight = erpReceipt.getPieceWeight();
List<BoxInfo> boxInfoList = erpReceipt.getListBoxInfo();
int stack = erpReceipt.getStack();
int qc = erpReceipt.getQc();
int orderFinish = erpReceipt.getOrderFinish();
int type = erpReceipt.getType();
String k3Code = erpReceipt.getK3Code();
String operatorName = erpReceipt.getOperatorName();
String qualityorName = erpReceipt.getQualityorName();
if(toalCases==0) {
return AjaxResult.error("入库组盘信息,总箱数为空");
}
if(StringUtils.isEmpty(receiptCode)) {
return AjaxResult.error("入库组盘信息,排产订单编码为空");
}
if(StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("入库组盘信息,托盘号为空");
}
if(StringUtils.isEmpty(position)) {
return AjaxResult.error("入库组盘信息,码垛站台位置为空");
}
if(StringUtils.isEmpty(orderCode)) {
return AjaxResult.error("入库组盘信息,订单信息为空");
}
if(StringUtils.isEmpty(orderName)) {
return AjaxResult.error("入库组盘信息,订单名称为空");
}
if(boxInfoList == null) {
return AjaxResult.error("入库组盘信息,箱信息为空");
}
AjaxResult ajaxResult = handleMultiProcess("innerReceipt",new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = codingService.innerReceipt(containerCode,
position, receiptCode, orderCode, orderName, boxInfoList,
stack, qc, orderFinish,weight, type, k3Code, operatorName, qualityorName,toalCases);
return ajaxResult;
}
});
return ajaxResult;
}
@PostMapping("/brickFalling")
@ApiOperation("掉砖pda接口")
@ResponseBody
@ApiLogger(apiName = "掉砖pda接口", from="掉砖pda接口")
public AjaxResult brickFalling(@RequestBody Map<String,String> map) {
String boxCode = map.get("boxCode");
String containerCode = map.get("containerCode");
if(StringUtils.isEmpty(boxCode)) {
return AjaxResult.error("箱码不为空");
}
if(StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("托盘号不为空");
}
AjaxResult ajaxResult = handleMultiProcess("brickFalling",new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = codingService.brickFalling(boxCode,containerCode);
return ajaxResult;
}
});
return ajaxResult;
}
/**
* 替换备货区的 其他地方不能替换 而且在追溯里面也一并替换
*/
@PostMapping("/codeSubstitution")
@ApiOperation("备货区箱码补充")
@ResponseBody
@ApiLogger(apiName = "备货区箱码替换", from="备货区箱码替换")
public AjaxResult codeSubstitution(@RequestBody Map<String,String> map) {
//要被替换掉的初始箱码
String boxCode = map.get("boxCode");
//要替换的箱码
String toBoxCode = map.get("toBoxCode");
//容器号
String containerCode = map.get("containerCode");
if(StringUtils.isEmpty(boxCode)) {
return AjaxResult.error("待箱码不为空");
}
if(StringUtils.isEmpty(toBoxCode)) {
return AjaxResult.error("箱码不为空");
}
if(StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("托盘号不为空");
}
AjaxResult ajaxResult = handleMultiProcess("codeSubstitution",new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = codingService.codeSubstitution(boxCode,toBoxCode,containerCode);
return ajaxResult;
}
});
return ajaxResult;
}
/**
* 备货区插入
*/
@PostMapping("/boxCodeInsert")
@ApiOperation("备货区插入")
@ResponseBody
@ApiLogger(apiName = "备货区插入", from="备货区插入")
public AjaxResult boxCodeInsert(@RequestBody Map<String,String> map) {
//备货区要插那一箱的箱码
String boxCode = map.get("boxCode");
//库里面出来的箱码
String toBoxCode = map.get("toBoxCode");
if(StringUtils.isEmpty(boxCode)) {
return AjaxResult.error("备货区要插那一箱的箱码不为空");
}
if(StringUtils.isEmpty(toBoxCode)) {
return AjaxResult.error("库里面出来的箱码不为空");
}
AjaxResult ajaxResult = handleMultiProcess("codeSubstitution",new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = codingService.boxCodeInsert(boxCode,toBoxCode);
return ajaxResult;
}
});
return ajaxResult;
}
// @PostMapping("/executeP30")
// @ApiOperation("执行去向P30任务")
// @ResponseBody
// @ApiLogger(apiName = "执行去向P30任务", from="执行去向P30任务")
// public AjaxResult executeP30(@RequestBody Map<String,String> map) {
// String boxCode = map.get("boxCode");
// String chipCode = map.get("chipCode");
// if(StringUtils.isEmpty(boxCode)&&StringUtils.isEmpty(chipCode)) {
// return AjaxResult.error("箱码跟片码信息不能都为空");
// }
// AjaxResult ajaxResult = handleMultiProcess("executeP30",new MultiProcessListener() {
// @Override
// public AjaxResult doProcess() {
// AjaxResult ajaxResult = codingService.executeP30(boxCode,chipCode);
// return ajaxResult;
// }
// });
// return ajaxResult;
// }
@PostMapping("/inventory")
@ApiOperation("盘点接口")
@ResponseBody
@ApiLogger(apiName = "盘点接口", from="盘点接口")
public AjaxResult inventory(@RequestBody Map<String,String> map) {
String boxCode = map.get("boxCode");
String containerCode = map.get("containerCode");
if(StringUtils.isEmpty(boxCode)) {
return AjaxResult.error("箱码不为空");
}
if(StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("托盘号不为空");
}
AjaxResult ajaxResult = handleMultiProcess("inventory",new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = codingService.inventory(boxCode,containerCode);
return ajaxResult;
}
});
return ajaxResult;
}
@PostMapping("/searchFleeingGoodsInfo")
@ApiOperation("防串信息查询")
@ResponseBody
@ApiLogger(apiName = "防串信息查询", from="查询历史库存记录")
public AjaxResult searchFleeingGoodsInfo(@RequestBody Map<String,String> map) {
String boxCode = map.get("boxCode");
String chipCode = map.get("chipCode");
if(StringUtils.isEmpty(boxCode)&&StringUtils.isEmpty(chipCode)) {
return AjaxResult.error("箱码跟片码信息不能都为空");
}
AjaxResult ajaxResult = handleMultiProcess("findShipmentRecord",new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = codingService.findShipmentRecord(boxCode,chipCode);
return ajaxResult;
}
});
return ajaxResult;
}
@PostMapping("/requestEmptyContainer")
@ApiOperation("申请空托盘组")
@ResponseBody
@ApiLogger(apiName = "申请空托盘组", from="申请空托盘组")
public AjaxResult requestEmptyContainer(@RequestBody EmptyZu emptyZu) {
String requestInCode = emptyZu.getRequestInCode();
if (requestInCode == null) {
return AjaxResult.error("空托盘组信息,申请位置为空");
}
if (!requestInCode.equals("P3") && !requestInCode.equals("P6")){
return AjaxResult.error("目标站台错误");
}
AjaxResult ajaxResult = handleMultiProcess("requestEmptyContainer",new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = codingService.requestEmptyContainer(requestInCode);
return ajaxResult;
}
});
return ajaxResult;
}
}