Blame view

src/main/java/com/huaheng/api/wcs/controller/ReceivingHandleController.java 6.27 KB
1
2
3
4
5
6
7
8
package com.huaheng.api.wcs.controller;

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
9
import com.huaheng.pc.task.agvTask.domain.AgvTask;
10
11
12
13
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
tongzhonghao authored
14
import java.util.List;
15
16
17

@RestController
@RequestMapping("/API/WMS/v2")
18
public class ReceivingHandleController extends BaseController {
19
20
21
22
    @Resource
    private ReceivingHandleService receivingHandleService;

    @PostMapping("/saveWholeContainer")
23
24
    @ApiOperation("WCS组盘")
    @ApiLogger(apiName = "WCS组盘", from = "WCS")
25
    @ResponseBody
童宗豪 authored
26
    public AjaxResult saveWholeContainer(@RequestBody ReceiptContainerView view) {
tongzhonghao authored
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
        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("站台为空");
        }
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                return receivingHandleService.saveWholeContainer(view);
            }
        });
        return ajaxResult;
    }

    @PostMapping("/continueSaveContainer")
    @ApiOperation("是否继续组盘")
    @ApiLogger(apiName = "是否继续组盘", from = "WCS")
    @ResponseBody
    public AjaxResult continueSaveContainer(@RequestBody ReceiptContainerView view) {
61
62
        String area = view.getArea();
        String rollNumber = view.getRollNumber();
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
        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("站台为空");
        }
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                return receivingHandleService.saveWholeContainer(view);
            }
        });
        return ajaxResult;
    }
tongzhonghao authored
90
    @PostMapping("/acsSaveWholeContainer")
tongzhonghao authored
91
92
    @ApiOperation("AGV组盘")
    @ApiLogger(apiName = "AGV组盘", from = "acs")
93
    @ResponseBody
tongzhonghao authored
94
    public AjaxResult acsSaveWholeContainer(@RequestBody AgvTask agvTask) {
tongzhonghao authored
95
96
        String area = agvTask.getArea();
        List<String> rollNumbers = agvTask.getRollNumbers();
tongzhonghao authored
97
        String containerCode = agvTask.getPalletNo();
tongzhonghao authored
98
99
        List<Integer> positions = agvTask.getPositions();
        String port = agvTask.getToPoint();
100
        if (StringUtils.isEmpty(area)) {
101
102
            return AjaxResult.error("库区编号为空");
        }
tongzhonghao authored
103
        if (rollNumbers.isEmpty()) {
104
105
            return AjaxResult.error("卷号为空");
        }
106
        if (StringUtils.isEmpty(containerCode)) {
107
108
            return AjaxResult.error("容器号为空");
        }
109
        if (StringUtils.isEmpty(port)) {
tongzhonghao authored
110
111
            return AjaxResult.error("站台为空");
        }
tongzhonghao authored
112
113
114
        if(positions.size() != rollNumbers.size()){
            return AjaxResult.error("批次 数量与位置 数量不一致");
        }
115
116
117
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
tongzhonghao authored
118
119
120
121
122
123
124
                ReceiptContainerView view = new ReceiptContainerView();
                view.setArea(area);
                view.setRollNumbers(rollNumbers);
                view.setPositions(positions);
                view.setPort(port);
                view.setContainerCode(containerCode);
                return receivingHandleService.acsSaveWholeContainer(view);
125
126
127
128
129
            }
        });
        return ajaxResult;
    }
130
131
132
133
134
135
136
137
138
    /**
     * 没有使用!!!!!!!!!!!!!!!!!
     * 没有使用!!!!!!!!!!!!!!!!!
     * 没有使用!!!!!!!!!!!!!!!!!
     * 没有使用!!!!!!!!!!!!!!!!!
     *
     * @param view
     * @return
     */
童宗豪 authored
139
140
    @PostMapping("/getPosition")
    @ApiOperation("获取入库物料托盘位置")
141
    @ApiLogger(apiName = "获取入库物料托盘位置", from = "WCS")
童宗豪 authored
142
143
144
145
146
    @ResponseBody
    public AjaxResult getPosition(@RequestBody ReceiptContainerView view) {
        String area = view.getArea();
        String rollNumber = view.getRollNumber();
        String containerCode = view.getContainerCode();
147
        if (StringUtils.isEmpty(area)) {
童宗豪 authored
148
149
            return AjaxResult.error("库区编号为空");
        }
150
        if (StringUtils.isEmpty(rollNumber)) {
童宗豪 authored
151
152
            return AjaxResult.error("卷号为空");
        }
153
        if (StringUtils.isEmpty(containerCode)) {
童宗豪 authored
154
155
156
157
158
159
160
161
162
163
164
            return AjaxResult.error("容器号为空");
        }
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                return receivingHandleService.getPosition(view);
            }
        });
        return ajaxResult;
    }
165
}