|
1
2
3
4
5
6
|
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;
|
|
7
|
import com.huaheng.common.support.Convert;
|
|
8
|
import com.huaheng.common.utils.StringUtils;
|
|
9
|
import com.huaheng.common.utils.security.ShiroUtils;
|
|
10
11
12
|
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.controller.BaseController;
|
|
13
|
import com.huaheng.framework.web.domain.AjaxResult;
|
|
14
15
16
17
18
|
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;
|
|
19
20
21
|
import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail;
import com.huaheng.pc.task.taskDetail.domain.TaskDetail;
import com.huaheng.pc.task.taskDetail.service.TaskDetailService;
|
|
22
23
24
|
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.mapper.TaskHeaderMapper;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
|
|
25
|
import io.swagger.annotations.ApiParam;
|
|
26
27
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
|
|
28
29
|
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
|
|
30
31
|
import javax.annotation.Resource;
|
|
32
|
import javax.servlet.http.HttpServletRequest;
|
|
33
34
35
36
37
38
39
40
41
|
import java.util.List;
@Controller
@RequestMapping("/task/taskHeader")
public class TaskHeaderController extends BaseController {
|
|
42
43
44
45
46
47
|
@Resource
private TaskHeaderService taskHeaderService;
|
|
48
49
|
private String prefix = "task/taskHeader";
|
|
50
|
|
|
51
52
|
@RequiresPermissions("task:taskHeader:view")
@GetMapping()
|
|
53
|
public String taskHeader(HttpServletRequest request, ModelMap mmap) {
|
|
54
|
String InternalTaskType= request.getParameter("InternalTaskType");
|
|
55
|
mmap.put("InternalTaskType",InternalTaskType);
|
|
56
57
58
59
60
61
62
63
64
65
|
return prefix + "/taskHeader";
}
/**
* 查询任务列表
*/
@RequiresPermissions("task:taskHeader:list")
@Log(title = "任务-上架任务", operating = "查看任务列表", action = BusinessType.GRANT)
@PostMapping("/list")
@ResponseBody
|
|
66
|
public TableDataInfo list(TaskHeader taskHeader,@ApiParam(name="InternalTaskType",value="类型") Integer InternalTaskType,
|
|
67
|
@ApiParam(name="createdBegin",value="类型") String createdBegin,@ApiParam(name="createdEnd",value="类型") String createdEnd) {
|
|
68
|
LambdaQueryWrapper<TaskHeader> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
|
69
70
|
lambdaQueryWrapper.eq(TaskHeader::getWarehouseCode,ShiroUtils.getWarehouseCode())
.in(TaskHeader::getCompanyCode,ShiroUtils.getCompanyCodeList())
|
|
71
|
.eq(StringUtils.isNotNull(InternalTaskType),TaskHeader::getInternalTaskType,InternalTaskType)
|
|
72
73
|
.eq(StringUtils.isNotNull(taskHeader.getId()),TaskHeader::getId,taskHeader.getId())
.eq(StringUtils.isNotEmpty(taskHeader.getContainerCode()),TaskHeader::getContainerCode,taskHeader.getContainerCode())
|
|
74
|
.eq(StringUtils.isNotEmpty(taskHeader.getToLocation()),TaskHeader::getToLocation,taskHeader.getToLocation())
|
|
75
|
.gt(StringUtils.isNotEmpty(createdBegin),TaskHeader::getCreated,createdBegin)
|
|
76
77
|
.lt(StringUtils.isNotEmpty(createdEnd),TaskHeader::getCreated,createdEnd)
.orderByDesc(TaskHeader::getId);
|
|
78
|
|
|
79
80
81
82
83
84
85
86
87
|
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);
|
|
88
89
90
91
92
|
List<TaskHeader> iPages = iPage.getRecords();
if(InternalTaskType == 700){
iPages = taskHeaderService.preferenceRealize(iPages) ;
}
return getMpDataTable(iPages, iPage.getTotal());
|
|
93
94
|
} else {
List<TaskHeader> list = taskHeaderService.list(lambdaQueryWrapper);
|
|
95
96
97
|
if(InternalTaskType == 700){
list = taskHeaderService.preferenceRealize(list);
}
|
|
98
99
100
101
|
return getDataTable(list);
}
}
|
|
102
103
104
|
/**
* 下发任务
*/
|
|
105
|
@RequiresPermissions("task:taskHeader:execute")
|
|
106
107
108
109
110
111
112
113
114
115
116
|
@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;
}
|
|
117
118
119
|
/**
* 完成任务
*/
|
|
120
|
@RequiresPermissions("task:taskHeader:complete")
|
|
121
122
123
124
125
126
127
128
129
|
@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));
}
|
|
130
|
|
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
/**
* 删除立库任务
*/
@RequiresPermissions("task:taskHeader:remove")
@Log(title = "任务-任务管理", operating = "删除立库任务", action = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
if (StringUtils.isEmpty(ids))
return AjaxResult.error("taskId不能为空");
AjaxResult ajaxResult = taskHeaderService.cancelTask(Convert.toIntArray(ids));
return ajaxResult;
}
|
|
147
148
|
}
|