Blame view

src/main/java/com/huaheng/api/wcs/controller/ReceivingHandleController.java 6.79 KB
1
2
package com.huaheng.api.wcs.controller;
3
import com.huaheng.api.wcs.domain.WcsTask;
4
5
6
7
8
9
import com.huaheng.api.wcs.service.receivingHandle.ReceivingHandleService;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerView;
tongzhonghao authored
10
import com.huaheng.pc.task.agvTask.domain.AgvTask;
11
12
13
import com.huaheng.pc.task.agvTask.service.AgvTaskService;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
14
15
16
17
18
19
20
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/API/WMS/v2")
21
public class ReceivingHandleController extends BaseController {
22
23
    @Resource
    private ReceivingHandleService receivingHandleService;
24
25
26
27
    @Resource
    private AgvTaskService agvTaskService;
    @Resource
    private TaskHeaderService taskHeaderService;
28
29

    @PostMapping("/saveWholeContainer")
30
31
    @ApiOperation("WCS组盘")
    @ApiLogger(apiName = "WCS组盘", from = "WCS")
32
    @ResponseBody
童宗豪 authored
33
    public AjaxResult saveWholeContainer(@RequestBody ReceiptContainerView view) {
tongzhonghao authored
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
        String area = view.getArea();
        String rollNumber = view.getRollNumber();
        String containerCode = view.getContainerCode();
        Integer containerDetailNumber = view.getPosition();
        String port = view.getPort();
        if (StringUtils.isEmpty(area)) {
            return AjaxResult.error("库区编号为空");
        }
        if (StringUtils.isEmpty(rollNumber)) {
            return AjaxResult.error("卷号为空");
        }
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("容器号为空");
        }
        if (StringUtils.isNull(containerDetailNumber)) {
            return AjaxResult.error("位置号为空");
        }
        if (StringUtils.isEmpty(port)) {
            return AjaxResult.error("站台为空");
        }
肖超群 authored
54
        AjaxResult ajaxResult = handleMultiProcess("saveWholeContainer", new MultiProcessListener() {
tongzhonghao authored
55
56
57
58
59
60
61
62
63
64
65
66
67
            @Override
            public AjaxResult doProcess() {
                return receivingHandleService.saveWholeContainer(view);
            }
        });
        return ajaxResult;
    }

    @PostMapping("/continueSaveContainer")
    @ApiOperation("是否继续组盘")
    @ApiLogger(apiName = "是否继续组盘", from = "WCS")
    @ResponseBody
    public AjaxResult continueSaveContainer(@RequestBody ReceiptContainerView view) {
68
69
        String area = view.getArea();
        String rollNumber = view.getRollNumber();
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
        String containerCode = view.getContainerCode();
        Integer containerDetailNumber = view.getPosition();
        String port = view.getPort();
        if (StringUtils.isEmpty(area)) {
            return AjaxResult.error("库区编号为空");
        }
        if (StringUtils.isEmpty(rollNumber)) {
            return AjaxResult.error("卷号为空");
        }
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("容器号为空");
        }
        if (StringUtils.isNull(containerDetailNumber)) {
            return AjaxResult.error("位置号为空");
        }
        if (StringUtils.isEmpty(port)) {
            return AjaxResult.error("站台为空");
        }
肖超群 authored
88
        AjaxResult ajaxResult = handleMultiProcess("continueSaveContainer", new MultiProcessListener() {
89
90
91
92
93
94
95
96
            @Override
            public AjaxResult doProcess() {
                return receivingHandleService.saveWholeContainer(view);
            }
        });
        return ajaxResult;
    }
97
    @PostMapping("/wcsContainerHasMaterial")
tongzhonghao authored
98
99
    @ApiOperation("托盘是否有料")
    @ApiLogger(apiName = "托盘是否有料", from = "wcs")
100
101
102
103
104
105
106
107
108
109
110
111
112
113
    @ResponseBody
    public AjaxResult wcsContainerHasMaterial(@RequestBody WcsTask wcsTask) {
        String containerCode = wcsTask.getContainerCode();
        String taskNo = wcsTask.getTaskNo();
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("容器号为空");
        }
        if (StringUtils.isNull(taskNo)) {
            return AjaxResult.error("任务号不能为空");
        }
        AjaxResult ajaxResult = handleMultiProcess("wcsContainerHasMaterial", new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                TaskHeader taskHeader = taskHeaderService.getById(taskNo);
tongzhonghao authored
114
                if (taskHeader == null) {
115
116
                    return AjaxResult.error();
                }
tongzhonghao authored
117
118
119
120
121
122
123
124
125
126
127
128
129
130
                int hasMaterial = 0;
                switch (taskHeader.getTaskType()) {
                    case 100:
                    case 200:
                    case 400:
                    case 300:
                        hasMaterial = 1;
                        break;
                    case 500:
                    case 600:
                        hasMaterial = 2;
                        break;
                    default:
                }
131
132
133
134
135
136
                return AjaxResult.success(hasMaterial);
            }
        });
        return ajaxResult;
    }
tongzhonghao authored
137
    @PostMapping("/acsSaveWholeContainer")
138
    @ApiOperation("源AGV组盘")
tongzhonghao authored
139
    @ApiLogger(apiName = "AGV组盘", from = "acs")
140
    @ResponseBody
tongzhonghao authored
141
    public AjaxResult acsSaveWholeContainer(@RequestBody AgvTask agvTask) {
tongzhonghao authored
142
        String area = agvTask.getArea();
143
144
        Integer taskNo = agvTask.getTaskNo();
        String containerCode = agvTask.getContainerCode();
tongzhonghao authored
145
        String port = agvTask.getToPoint();
146
        if (StringUtils.isEmpty(area)) {
147
148
            return AjaxResult.error("库区编号为空");
        }
149
        if (StringUtils.isEmpty(containerCode)) {
150
151
            return AjaxResult.error("容器号为空");
        }
152
        if (StringUtils.isEmpty(port)) {
tongzhonghao authored
153
154
            return AjaxResult.error("站台为空");
        }
155
156
157
158
        if (StringUtils.isNull(taskNo)) {
            return AjaxResult.error("任务号不能为空");
        }
        AgvTask task = agvTaskService.getAgvTaskByTaskNo(taskNo);
tongzhonghao authored
159
        if (task == null) {
160
            return AjaxResult.error("WMS AGV任务未找到或被删除");
tongzhonghao authored
161
        }
162
肖超群 authored
163
        AjaxResult ajaxResult = handleMultiProcess("acsSaveWholeContainer", new MultiProcessListener() {
164
165
            @Override
            public AjaxResult doProcess() {
tongzhonghao authored
166
167
168
                ReceiptContainerView view = new ReceiptContainerView();
                view.setArea(area);
                view.setPort(port);
169
                view.setRollNumber(task.getLot());
170
                view.setPosition(1);
tongzhonghao authored
171
172
                view.setContainerCode(containerCode);
                return receivingHandleService.acsSaveWholeContainer(view);
173
174
175
176
177
            }
        });
        return ajaxResult;
    }
178
179
}