LkTaskMenuControlletr.java
6.42 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
package com.huaheng.pc.task.LkMenuTask;
import com.huaheng.common.constant.QuantityConstant;
import com.huaheng.common.exception.service.ServiceException;
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.TableDataInfo;
import com.huaheng.pc.config.container.domain.Container;
import com.huaheng.pc.config.container.service.ContainerService;
import com.huaheng.pc.task.taskDetail.domain.TaskDetail;
import com.huaheng.pc.task.taskDetail.service.TaskDetailService;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
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 java.math.BigDecimal;
import java.util.List;
@Controller
@RequestMapping("/task/lkMenuTask")
public class LkTaskMenuControlletr extends BaseController {
@Resource
private TaskDetailService taskDetailService;
@Resource
private TaskHeaderService taskHeaderService;
@Resource
private ContainerService containerService;
private String prefix = "task/lkMenuTask";
@RequiresPermissions("task:lkMenuTask:view")
@GetMapping()
public String locationStatus()
{
return prefix + "/lkMenu";
}
/**
* 更换容器
*/
@GetMapping("/replaceContainer/{code}/{ids}")
public String replaceContainer(@PathVariable("code") String code, @PathVariable("ids") String ids, ModelMap map){
if (StringUtils.isEmpty(code) && StringUtils.isEmpty(ids)){
throw new ServiceException("没有任务明细行");
}
Container container = containerService.getContainerByCode(code);
map.put("container", container);
map.put("ids", ids);
return prefix+"/containerSelection";
}
@PostMapping("/getContainerList")
@ResponseBody
public TableDataInfo getContainerList(String code) {
if (StringUtils.isEmpty(code)){
return null;
}
Container container = containerService.getContainerByCode(code);
Container query = new Container();
// 状态为空
query.setStatus("empty");
// 仓库编码一致
query.setWarehouseCode(container.getWarehouseCode());
// 货主编码一致
query.setCompanyCode(container.getCompanyCode());
// u8仓库保持一致
query.setUWarehouseCode(container.getUWarehouseCode());
// 大小保持一致
query.setContainerType(container.getContainerType());
// 状态一致
query.setEnable(container.getEnable());
// 删除状态一致
// query.setDeleted(container.getDeleted());
List<Container> list = containerService.selectEmptyList(query);
if (list.size() > 1){
list.removeIf(item -> code.contains(item.getCode()));
}
return getDataTable(list);
}
/**
* 获取当前托盘要完成的任务
* *
*/
@ResponseBody
@PostMapping("/getLkTasks")
@RequiresPermissions("task:lkMenuTask:list")
@Log(title = "LK任务-任务管理", operating ="任务显示", action = BusinessType.OTHER)
public List<TaskDetail> getLkTasks(String containerCode){
TaskDetail taskDetail =new TaskDetail();
taskDetail.setContainerCode(containerCode);
taskDetail.setWarehouseCode(ShiroUtils.getWarehouseCode());
taskDetail.setStatus(1);
taskDetail.setNumber(1);
Container container = new Container();
container.setCode(containerCode);
container = containerService.selectFirstEntity(container);
if(container == null){
return null;
}
/*if(container.getContainerType().equals(QuantityConstant.CONTAINER_TYPEC)){
taskDetail.setZoneCode(QuantityConstant.ZONECODE_XC);
}else {
taskDetail.setZoneCode(QuantityConstant.ZONECODE_LK);
}*/
List<TaskDetail> taskDetails =taskDetailService.selectListEntityUndone(taskDetail);
if(taskDetails!=null){
for(TaskDetail item :taskDetails) {
taskDetailService.updateByInventory(item);
}
}
return taskDetails;
}
/**
* LK任务界面中完成任务
*/
@RequiresPermissions("task:lkMenuTask:list")
@Log(title = "LK任务-任务管理", operating = "PC完成LK任务", action = BusinessType.UPDATE)
@PostMapping( "/completeTaskByLK")
@ResponseBody
public AjaxResult completeTaskByLK(Integer id, String num){
if(id==null){
return AjaxResult.error("没有任务");
}
TaskDetail taskDetail =taskDetailService.getById(id);
taskDetail.setNumber(2);
if(num==null){
taskDetailService.updateById(taskDetail);
}else {
BigDecimal number=new BigDecimal(num);
if(number.compareTo(taskDetail.getQty())>0){
return AjaxResult.error("完成数量大于任务数量");
}else if(number.compareTo(taskDetail.getQty())==0){
taskDetailService.updateById(taskDetail);
}else {
// taskDetailService.updateTask(taskDetail,number);
taskDetailService.updateById(taskDetail);
}
}
return AjaxResult.success("成功");
}
/**
* 更换容器提交
*/
@Log(title = "更换容器提交", operating = "更换容器提交", action = BusinessType.UPDATE)
@PostMapping( "/submitComplete")
@ResponseBody
public AjaxResult submitComplete(String ids, String code){
return taskDetailService.updateTaskDetail(ids, code);
}
/**
* 补充入库
*/
@GetMapping("/replenIn")
public String replenIn(){
return prefix+"/replenIn";
}
/**
* 补充入库
*/
@RequiresPermissions("task:lkMenuTask:list")
@Log(title = "LK任务-任务管理", operating = "PC补充入库", action = BusinessType.UPDATE)
@PostMapping( "/replenIn")
@ResponseBody
public AjaxResult replenIn(String containerCode){
return taskHeaderService.replenIn(containerCode);
}
}