WaiguanShipmentService.java
3.03 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
package com.huaheng.api.wcs.service;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huaheng.api.wcs.domain.WaiguanShipmentDomain;
import com.huaheng.api.wcs.domain.WaiguanShipmentReturn;
import com.huaheng.common.constant.QuantityConstant;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.task.taskDetail.domain.TaskDetail;
import com.huaheng.pc.task.taskDetail.service.TaskDetailService;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
@Service
public class WaiguanShipmentService {
@Resource
private TaskHeaderService taskHeaderService;
@Resource
private TaskDetailService taskDetailService;
/**
* 外观仓2楼出库通知wcs
*/
public AjaxResult getTaskByContainerCode(WaiguanShipmentDomain domain) {
String containerCode = domain.getContainerCode();
String port = domain.getPort();
if (StringUtils.isEmpty(containerCode)) {
return AjaxResult.error("容器号为空");
}
if (StringUtils.isEmpty(port)) {
// return AjaxResult.error("站台为空");
}
LambdaQueryWrapper<TaskHeader> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(TaskHeader::getZoneCode, "F");
lambdaQueryWrapper.eq(TaskHeader::getContainerCode, containerCode);
lambdaQueryWrapper.eq(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED);
lambdaQueryWrapper.eq(TaskHeader::getInternalTaskType, QuantityConstant.TASK_INTENERTYPE_SHIPMENT);
lambdaQueryWrapper.last("limit 1");
lambdaQueryWrapper.orderByDesc(TaskHeader::getId);
TaskHeader taskHeader = taskHeaderService.getOne(lambdaQueryWrapper);
if (taskHeader == null) {
return AjaxResult.error("找不到该容器" + containerCode + "的出库任务");
}
LambdaQueryWrapper<TaskDetail> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TaskDetail::getTaskId, taskHeader.getId());
List<TaskDetail> list = taskDetailService.list(wrapper);
List<WaiguanShipmentReturn> returnlist = new ArrayList<>();
for (TaskDetail taskDetail : list) {
WaiguanShipmentReturn waiguanShipmentReturn = new WaiguanShipmentReturn();
waiguanShipmentReturn.setContainerCode(taskHeader.getContainerCode());
waiguanShipmentReturn.setMaterialCode(taskDetail.getMaterialCode());
waiguanShipmentReturn.setQty(taskDetail.getQty());
waiguanShipmentReturn.setRollNumber(taskDetail.getRollNumber());
waiguanShipmentReturn.setPort(taskHeader.getPort());
returnlist.add(waiguanShipmentReturn);
}
return AjaxResult.success("查询成功").setData(returnlist);
}
}