TaskFinishServiceImpl.java
3.45 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
package com.huaheng.api.wcs.service.taskFinish;
import com.huaheng.api.acs.service.AgvTaskCSService;
import com.huaheng.api.wcs.domain.TaskFinishDomain;
import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService;
import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService;
import com.huaheng.common.constant.QuantityConstant;
import com.huaheng.common.support.Convert;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.container.service.ContainerService;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@Service
public class TaskFinishServiceImpl implements TaskFinishService {
@Resource
private TaskHeaderService taskHeaderService;
@Resource
private EmptyOutHandleService emptyOutHandleService;
@Resource
private OverrideHandleService overrideHandleService;
@Resource
private ContainerService containerService;
@Resource
private LocationService locationService;
@Resource
private AgvTaskCSService agvTaskService;
//任务完成
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult completeTaskByWCS(TaskFinishDomain taskFinishDomain) {
AjaxResult ajaxResult = new AjaxResult();
if (StringUtils.isEmpty(taskFinishDomain.getTaskNo())) {
return AjaxResult.error("任务号为空");
}
if (StringUtils.isEmpty(taskFinishDomain.getWarehouseCode())) {
return AjaxResult.error("仓库号为空");
}
TaskHeader taskHeader = taskHeaderService.getById(taskFinishDomain.getTaskNo());
if (taskHeader == null) {
return AjaxResult.success("wms系统没有此任务号:" + taskFinishDomain.getTaskNo());
}
String warehouseCode = taskHeader.getWarehouseCode();
//1、空出处理
if (taskFinishDomain.getIsEmptyOut() == 1) {
taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
boolean result = taskHeaderService.updateById(taskHeader);
if (!result) {
return AjaxResult.error("空出处理,修改任务状态失败");
}
return AjaxResult.success(result);
}
String[] weight = new String[1];
if (StringUtils.isNotEmpty(taskFinishDomain.getWeight())) {
weight = Convert.toStrArray(taskFinishDomain.getWeight());
}
//任务完成
// try{
//
// } catch (Exception e) {
// e.printStackTrace();
// }
ajaxResult = taskHeaderService.completeTaskByWMS(Convert.toIntArray(taskFinishDomain.getTaskNo()), weight);
boolean foldFlag = taskFinishDomain.isFoldFlag();
if (foldFlag) {
String containerCode = taskHeader.getContainerCode();
String locationCode = taskHeader.getFromLocation();
containerService.updateLocationCodeAndStatus(containerCode,
"", QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
locationService.updateContainerCodeAndStatus(locationCode, "",
QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
}
return ajaxResult;
}
}