RcsController.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
83
84
85
86
87
88
89
90
package com.huaheng.api.rcs.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.api.acs.domain.AgvTaskCS;
import com.huaheng.api.acs.service.AgvTaskCSService;
import com.huaheng.api.mes.domain.AcsTask;
import com.huaheng.api.mes.service.MesService;
import com.huaheng.api.rcs.service.RcsService;
import com.huaheng.common.constant.QuantityConstant;
import com.huaheng.common.support.Convert;
import com.huaheng.common.utils.Wrappers;
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.location.service.LocationService;
import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService;
import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
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 org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* rcs任务执行反馈控制器
* @author xcq
*/
@RestController
@RequestMapping("/api/rcs")
@Api(tags = {"rcs任务执行反馈接口"}, value = "rcs任务执行反馈接口")
public class RcsController extends BaseController {
@Resource
private LocationService locationService;
@Resource
private InventoryHeaderService inventoryHeaderService;
@Resource
private TaskHeaderService taskHeaderService;
@Resource
private RcsService rcsService;
@Resource
private MesService mesService;
@ApiOperation(value="ACS上报任务状态", notes="ACS上报任务状态")
@PostMapping(value = "/updateAGVTask")
@ResponseBody
// @ApiLogger(apiName = "ACS上报任务状态", from = "ACS")
public AjaxResult updateAGVTask(@RequestBody AcsTask temp ){
TaskHeader taskHeader = taskHeaderService.getById(temp.getTaskNo());
if (taskHeader == null){
return AjaxResult.error("根据id"+temp.getTaskNo()+"查询任务失败!");
}
if (QuantityConstant.TASK_STATUS_COMPLETED == taskHeader.getStatus()){
return AjaxResult.success("入库任务已经完成,请勿重复提交!");
}
// RCS取消任务
if (QuantityConstant.TASK_STATUS_CANCEL == temp.getStatus()){
return taskHeaderService.cancelTask(Convert.toIntArray(taskHeader.getId().toString()));
}
// AGV任务执行状态
if (QuantityConstant.AGV_TASK_STATUS_EXECUTE == temp.getStatus()){
taskHeader.setStatus(QuantityConstant.AGV_TASK_STATUS_EXECUTE);
taskHeaderService.updateById(taskHeader);
return AjaxResult.success("任务状态更新成功!");
}
// 完成换站任务
if (taskHeader.getTaskType() == QuantityConstant.TASK_TYPE_OVER_STATION){
taskHeader.setStatus(QuantityConstant.AGV_TASK_STATUS_COMPLETE);
taskHeaderService.updateById(taskHeader);
return AjaxResult.success("任务状态更新成功!");
}
// AGV任务完成状态
if (QuantityConstant.AGV_TASK_STATUS_COMPLETE == temp.getStatus()){
AjaxResult result = taskHeaderService.completeTaskByWMS(Convert.toIntArray(String.valueOf(taskHeader.getId())), null);
if (result.hasErr()){
return result;
}
if (taskHeader.getTaskType() == QuantityConstant.TASK_TYPE_WHOLERECEIPT || taskHeader.getTaskType() == QuantityConstant.TASK_TYPE_TRANSFER){
return mesService.inventoryConversion(taskHeader.getToLocation());
}
}
return AjaxResult.success("任务状态更新成功!");
}
}