UnlockLocationServiceImpl.java
3.08 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
package com.huaheng.api.wcs.service.unlockLocation;
import com.huaheng.api.wcs.domain.TaskFinishDomain;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.container.domain.Container;
import com.huaheng.pc.config.container.service.ContainerService;
import com.huaheng.pc.config.location.domain.Location;
import com.huaheng.pc.config.location.service.LocationService;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @ClassName UnlockLocationServiceImpl
* @Description TODO
* @Author Administrator
* @Date 2019/12/1814:50
*/
@Service
public class UnlockLocationServiceImpl implements UnlockLocationService {
@Autowired
private TaskHeaderService taskService;
@Autowired
private ContainerService containerService;
@Autowired
private LocationService locationService;
@Override
@Transactional
public AjaxResult unlockLocation(TaskFinishDomain taskFinishDomain) {
//查找任务
TaskHeader task = taskService.getById(Integer.valueOf(taskFinishDomain.getTaskNo()));
if (task == null) {
return AjaxResult.error("任务号错误,没有找到该任务");
}
if (task.getStatus() == 100) {
return AjaxResult.success("任务已完成");
}
if (task.getUnlockLocation()==2) {
return AjaxResult.success("任务号已释放库位,不能重复释放");
}
if (task.getTaskType() == 200 || task.getTaskType() == 400 || task.getTaskType() == 700
|| task.getTaskType() == 900) {
//解锁容器
Container container = new Container();
container.setCode(task.getContainerCode());
container.setWarehouseCode(taskFinishDomain.getWarehouseCode());
container = containerService.selectFirstEntity(container);
if (container == null) {
return AjaxResult.error(task.getContainerCode() + "在系统中不存在");
}
//解锁库位
Location location = new Location();
location.setCode(task.getFromLocation());
location.setWarehouseCode(taskFinishDomain.getWarehouseCode());
location = locationService.selectFirstEntity(location);
if (location == null) {
return AjaxResult.error(task.getFromLocation() + "在系统中不存在");
}
// container.setLocationCode("");
// container.setStatus("empty");
// containerService.updateById(container);
location.setContainerCode("");
location.setStatus("empty");
locationService.updateById(location);
}
task.setStatus(30);
task.setUnlockLocation(2);
taskService.updateById(task);
return AjaxResult.success("成功");
}
}