|
1
2
|
package com.huaheng.api.acs.controller;
|
|
3
4
5
6
7
8
|
import java.math.BigDecimal;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;
|
|
9
|
import com.alibaba.fastjson.JSON;
|
|
10
11
|
import com.huaheng.api.acs.domain.AcsStatus;
import com.huaheng.api.acs.service.AcsService;
|
|
12
13
14
|
import com.huaheng.common.constant.QuantityConstant;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.http.OkHttpUtils;
|
|
15
16
17
|
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
|
|
18
19
20
21
|
import com.huaheng.pc.config.address.service.AddressService;
import com.huaheng.pc.sap.domain.WeightRollNumberInfo;
import com.huaheng.pc.sap.service.WeightRollNumberInfoService;
|
|
22
|
import io.swagger.annotations.ApiOperation;
|
|
23
24
|
@RestController
|
|
25
|
@RequestMapping("/agv")
|
|
26
27
28
29
|
public class AcsController extends BaseController {
@Resource
private AcsService acsService;
|
|
30
31
32
33
|
@Resource
private WeightRollNumberInfoService weightRollNumberInfoService;
private AddressService addressService;
|
|
34
|
|
|
35
|
/**
|
|
36
37
|
* status 20 任务执行中;
* 50 取货完成;
|
|
38
|
* 90 任务完成;
|
|
39
|
* @param acsStatus
|
|
40
41
|
* @return
*/
|
|
42
|
@PostMapping("/notifyAGVTask")
|
|
43
44
|
@ApiOperation("更新AGV状态")
@ResponseBody
|
|
45
|
@ApiLogger(apiName = "更新AGV状态", from = "acs")
|
|
46
|
public AjaxResult notifyAGVTask(@RequestBody AcsStatus acsStatus) {
|
|
47
48
49
|
AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
|
|
50
|
AjaxResult ajaxResult = acsService.notifyAGVTask(acsStatus);
|
|
51
52
53
|
return ajaxResult;
}
});
|
|
54
|
return ajaxResult;
|
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
}
/**
* status 20 任务执行中;
* 50 取货完成;
* 90 任务完成;
* @param acsStatus
* @return
*/
@PostMapping("/bindContainer")
@ApiOperation("玻璃布物料绑定托盘")
@ResponseBody
@ApiLogger(apiName = "玻璃布物料绑定托盘", from = "acs")
public AjaxResult bindContainer(@RequestBody AcsStatus acsStatus) {
AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
|
|
72
73
|
AjaxResult ajaxResult = acsService.bindContainer(acsStatus);
return ajaxResult;
|
|
74
75
76
|
}
});
return ajaxResult;
|
|
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
|
@PostMapping("/pushWeightRollNumber")
@ApiOperation("推送卷号重量信息")
@ResponseBody
@ApiLogger(apiName = "推送卷号重量信息", from = "acs")
public AjaxResult pushWeightRollNumber(@RequestBody WeightRollNumberInfo weightRollNumberInfo) {
String rollNumber = weightRollNumberInfo.getRollNumber();
BigDecimal weight = weightRollNumberInfo.getWeight();
String area = weightRollNumberInfo.getArea();
String warehouseCode = weightRollNumberInfo.getWarehouseCode();
if (StringUtils.isEmpty(area)) {
return AjaxResult.error("area不为空:");
}
if (StringUtils.isEmpty(warehouseCode)) {
return AjaxResult.error("warehouseCode不为空:");
}
if (StringUtils.isEmpty(rollNumber)) {
return AjaxResult.error("卷号不为空:");
}
if (weight.compareTo(BigDecimal.ZERO) <= 0) {
return AjaxResult.error("重量不为空:");
}
AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
boolean save = weightRollNumberInfoService.save(weightRollNumberInfo);
|
|
105
106
|
String bodypost = null;
try {
|
|
107
108
|
String url = addressService.selectAddress(QuantityConstant.WEIGHT_ROLLNUMBER_URL, weightRollNumberInfo.getWarehouseCode(),
weightRollNumberInfo.getArea());
|
|
109
110
111
112
113
114
115
116
117
|
String param = JSON.toJSONString(weightRollNumberInfo);
bodypost = OkHttpUtils.bodypost(url, param);
weightRollNumberInfo.setSend(1);
weightRollNumberInfoService.updateById(weightRollNumberInfo);
} catch (Exception e) {
e.printStackTrace();
} finally {
return AjaxResult.toAjax(save).setData(bodypost);
}
|
|
118
119
120
121
122
|
}
});
return ajaxResult;
}
|
|
123
|
}
|