MobilePutawayController.java
5.58 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
package com.huaheng.mobile.receipt;
import com.alibaba.fastjson.JSONException;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.common.utils.Wrappers;
import com.huaheng.api.wcs.domain.WcsTask;
import com.huaheng.common.utils.security.ShiroUtils;
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.pc.config.container.domain.Container;
import com.huaheng.pc.config.container.service.ContainerService;
import com.huaheng.pc.config.location.domain.Location;
import com.huaheng.pc.config.location.service.LocationService;
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 io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
*
* @author Enzo Cotter
* @date 2019/12/16
*/
@RestController
@RequestMapping("/mobile/putaway/execute")
@Api(tags = {"手机收货上架"}, value = "手机收货上架MobilePutawayController")
public class MobilePutawayController {
@Resource
private TaskHeaderService taskService;
@Resource
private LocationService locationService;
@Resource
private ContainerService containerService;
@PostMapping("/createReceiptTask")
@ApiOperation("手机扫描容器收货上架")
@Log(title = "手机扫描容器收货上架", action = BusinessType.OTHER)
public AjaxResult createReceiptTask(@RequestBody @ApiParam(value="容器号") Map<String, String> param) throws Exception {
if (param.get("containerCode") == null || param.get("containerCode").trim().length() < 1) {
throw new JSONException("容器号(containerCode)不能为空");
}
AjaxResult retResult = taskService.mobileCreateReceiptTask(param.get("containerCode"), "L10-27-01");
return retResult;
}
@PostMapping("/getLocationFromContainer")
@ApiOperation("手机扫描容器获得库位号")
@Log(title = "手机扫描容器获得库位号", action = BusinessType.OTHER)
// @ApiLogger(apiName = "手机扫描容器获得库位号")
public AjaxResult getLocationFromContainer(@RequestBody @ApiParam(value="容器号") Map<String, String> param) throws Exception {
if (param.get("containerCode") == null || param.get("containerCode").trim().length() < 1) {
throw new JSONException("容器号(containerCode)不能为空");
}
String containerCode = param.get("containerCode");
String companyCode = param.get("companyCode");
LambdaQueryWrapper<Container> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Container::getWarehouseCode, ShiroUtils.getWarehouseCode())
// .eq(Container::getCompanyCode, companyCode)
.eq(Container::getCode,containerCode);
Container container = containerService.getOne(queryWrapper);
if(container == null) {
return AjaxResult.error("容器不匹配");
}
return AjaxResult.success("获取成功",container.getLocationCode());
}
@PostMapping("/createQuickTask")
@ApiOperation("手机扫描容器收货上架")
@Log(title = "手机扫描容器收货上架", action = BusinessType.OTHER)
public AjaxResult createQuickTask(@RequestBody @ApiParam(value="容器号") Map<String, String> param) throws Exception {
if (param.get("containerCode") == null || param.get("containerCode").trim().length() < 1) {
throw new JSONException("容器号(containerCode)不能为空");
}
AjaxResult retResult = taskService.createQuickTask(param.get("containerCode"));
if(!retResult.hasErr()){
List<String> data = (List<String>) retResult.getData();
String s = data.get(0);
return AjaxResult.success().setData(s);
}
return retResult;
}
@PostMapping("/scanLocationCode")
@ApiOperation("手机扫描库位收货上架")
@Log(title = "手机扫描库位收货上架", action = BusinessType.OTHER)
public AjaxResult scanLocationCode(@RequestBody @ApiParam(value="库位编码") Map<String, String> param) throws Exception {
if (param.get("locationCode") == null || param.get("locationCode").trim().length() < 1) {
throw new JSONException("库位号(locationCode)不能为空");
}
AjaxResult retResult = taskService.completeTask(param.get("locationCode"));
return retResult;
}
@PostMapping("/createReplenishTask")
@ApiOperation("手机扫描容器创建补充入库任务")
@Log(title = "手机扫描容器创建补充入库任务", action = BusinessType.OTHER)
// @ApiLogger(apiName = "非立库无表单创建任务")
public AjaxResult createReplenishTask(@RequestBody @ApiParam(value="容器号") Map<String, String> param) throws Exception {
if (param.get("containerCode") == null || param.get("containerCode").trim().length() < 1) {
throw new JSONException("容器号(containerCode)不能为空");
}
AjaxResult retResult = taskService.createReplenishTask(param.get("containerCode"), 1);
return retResult;
}
}