TaskHeaderController.java
5.27 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
package com.huaheng.pc.task.taskHeader.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huaheng.common.support.Convert;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.framework.web.page.PageDomain;
import com.huaheng.framework.web.page.TableDataInfo;
import com.huaheng.framework.web.page.TableSupport;
import com.huaheng.pc.config.material.service.MaterialService;
import com.huaheng.pc.config.warehouse.domain.Warehouse;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.mapper.TaskHeaderMapper;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Controller
@RequestMapping("/task/taskHeader")
public class TaskHeaderController extends BaseController {
private String prefix = "task/taskHeader";
@RequiresPermissions("task:taskHeader:view")
@GetMapping()
public String taskHeader(HttpServletRequest request, ModelMap mmap) {
String InternalTaskType= request.getParameter("InternalTaskType");
mmap.put("InternalTaskType",InternalTaskType);
return prefix + "/taskHeader";
}
@Resource
private TaskHeaderService taskHeaderService;
/**
* 查询任务列表
*/
@RequiresPermissions("task:taskHeader:list")
@Log(title = "任务-上架任务", operating = "查看任务列表", action = BusinessType.GRANT)
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TaskHeader taskHeader,@ApiParam(name="InternalTaskType",value="类型") Integer InternalTaskType,
@ApiParam(name="createdBegin",value="类型") String createdBegin,@ApiParam(name="createdEnd",value="类型") String createdEnd) {
LambdaQueryWrapper<TaskHeader> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(TaskHeader::getWarehouseCode,ShiroUtils.getWarehouseCode())
.in(TaskHeader::getCompanyCode,ShiroUtils.getCompanyCodeList())
.eq(StringUtils.isNotNull(InternalTaskType),TaskHeader::getInternalTaskType,InternalTaskType)
.eq(StringUtils.isNotNull(taskHeader.getInternalTaskType()),TaskHeader::getInternalTaskType,taskHeader.getInternalTaskType())
.eq(StringUtils.isNotNull(taskHeader.getId()),TaskHeader::getId,taskHeader.getId())
.eq(StringUtils.isNotEmpty(taskHeader.getContainerCode()),TaskHeader::getContainerCode,taskHeader.getContainerCode())
.eq(StringUtils.isNotEmpty(taskHeader.getToLocation()),TaskHeader::getToLocation,taskHeader.getToLocation())
.gt(StringUtils.isNotEmpty(createdBegin),TaskHeader::getCreated,createdBegin)
.lt(StringUtils.isNotEmpty(createdEnd),TaskHeader::getCreated,createdEnd);
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
/**
* 使用分页查询
*/
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
Page<TaskHeader> page = new Page<>(pageNum, pageSize);
IPage<TaskHeader> iPage = taskHeaderService.page(page, lambdaQueryWrapper);
return getMpDataTable(iPage.getRecords(), iPage.getTotal());
} else {
List<TaskHeader> list = taskHeaderService.list(lambdaQueryWrapper);
return getDataTable(list);
}
}
/**
* 下发任务
*/
@RequiresPermissions("task:taskHeader:execute")
@Log(title = "任务-任务管理", operating = "下发立库任务", action = BusinessType.UPDATE)
@PostMapping( "/execute")
@ResponseBody
public AjaxResult execute(String taskId)
{
if (StringUtils.isEmpty(taskId))
return AjaxResult.error("taskId不能为空");
AjaxResult ajaxResult = taskHeaderService.sendTaskToWcs(Convert.toIntArray(taskId));
return ajaxResult;
}
/**
* 完成任务
*/
@RequiresPermissions("task:taskHeader:complete")
@Log(title = "任务-任务管理", operating = "PC完成立库任务", action = BusinessType.UPDATE)
@PostMapping( "/completeTaskByWMS")
@ResponseBody
public AjaxResult completeTaskByWMS(String taskId) throws Exception {
if (StringUtils.isEmpty(taskId))
return AjaxResult.error("taskId不能为空");
return taskHeaderService.completeTaskByWMS(Convert.toIntArray(taskId));
}
}