TransmissionLineInteractionController.java
3.77 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
package com.huaheng.api.wcs.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huaheng.api.acs.domain.AgvTask;
import com.huaheng.api.acs.service.AcsService;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.agv.domain.AgvPort;
import com.huaheng.pc.agv.service.IAgvPortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
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 java.util.Map;
@RestController
@RequestMapping("/transmissionLine")
public class TransmissionLineInteractionController {
@Autowired
private AcsService acsService;
@Autowired
private IAgvPortService iAgvPortService;
@PostMapping("/getContainerCode")
@ApiLogger(apiName = "wcs输送线交互点位请求托盘",from = "wcs",to = "wms")
public AjaxResult wcsGetContainerCode(@RequestBody Map map){
// if(!StringUtils.isEmpty(map.get("port"))){
// String linePort = map.get("port").toString();
// LambdaQueryWrapper<AgvPort> queryWrapper = Wrappers.lambdaQuery();
// queryWrapper.eq(AgvPort::getLinePort, linePort).orderByAsc(AgvPort::getType).last("limit 1");
// AgvPort agvPort = iAgvPortService.getOne(queryWrapper);
// if(StringUtils.isEmpty(agvPort)){
// return AjaxResult.error("点位错误,不存在");
// }
// AgvTask agvTask = acsService.getOne(new LambdaQueryWrapper<AgvTask>().eq(AgvTask::getToPort, agvPort.getCode()).orderByDesc(AgvTask::getId).last("limit 1"));
// if(!StringUtils.isEmpty(agvTask)){
// return AjaxResult.success("成功").setData(agvTask.getContainerCode());
// }
// }else {
// return AjaxResult.error("请求体不对");
// }
// return AjaxResult.error("请求错误");
return AjaxResult.success("成功").setData("S00693");
}
@PostMapping("/setContainerCode")
@ApiLogger(apiName = "wcs输送线交互点位托盘到达",from = "wcs",to = "wms")
@Transactional(rollbackFor = Exception.class)
public AjaxResult wcsSetContainerCode(@RequestBody Map map){
// if(!StringUtils.isEmpty(map.get("port"))){
// String linePort = map.get("port").toString();
// LambdaQueryWrapper<AgvPort> queryWrapper = Wrappers.lambdaQuery();
// queryWrapper.eq(AgvPort::getLinePort, linePort).orderByAsc(AgvPort::getType).last("limit 1");
// AgvPort agvPort = iAgvPortService.getOne(queryWrapper);
// if(StringUtils.isEmpty(agvPort)){
// return AjaxResult.error("点位错误,不存在");
// }
// if(!StringUtils.isEmpty(map.get("containerCode"))){
// String containerCode = map.get("containerCode").toString();
// try {
// iAgvPortService.setContainerCode(agvPort.getCode(),containerCode);
// return AjaxResult.success("接收到了");
// }catch (Exception e) {
// throw new RuntimeException("反正报错了,你看着办吧");
// }
// }
// }else {
// return AjaxResult.error("请求体不对");
// }
// return AjaxResult.error("请求错误");
return AjaxResult.success("接收到了");
}
}