skyouc
2024-12-21 c635d78b479510ebe2556a420948effcd30a0731
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.zy.asrs.wms.apis.wcs.controller;
 
import com.zy.asrs.framework.common.R;
import com.zy.asrs.wms.apis.wcs.entity.request.ContainerArrivedParam;
import com.zy.asrs.wms.apis.wcs.entity.request.ConveyorStarParam;
import com.zy.asrs.wms.apis.wcs.entity.request.TasksStatusCallbackParam;
import com.zy.asrs.wms.apis.wcs.services.WcsApiService;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@RequestMapping("/openapi/")
@RestController
public class WcsApiController {
 
    @Autowired
    private WcsApiService wcsApiService;
 
 
    /***
     * 容器到达接收
     * @param arrivedParam
     * @return
     */
    @PostMapping("/container/arrived")
    public R containerArrivedNotify(@RequestBody ContainerArrivedParam arrivedParam) {
 
        if (StringUtil.isNullOrEmpty(arrivedParam.getContainerCode())) {
            return R.error("容器编码不能为空!!");
        }
        if (StringUtil.isNullOrEmpty(arrivedParam.getSlotCode())) {
            return R.error("输送线节点编码不能为空!!");
        }
 
        return wcsApiService.containerArrivedNotify(arrivedParam);
 
    }
 
 
    /**
     * ESS上报任务状态接口
     * @param callbackParam
     * @return
     */
    @PostMapping("/receive/tasks/status")
    public R receiveTaskStatus(@RequestBody TasksStatusCallbackParam callbackParam) {
        if (StringUtil.isNullOrEmpty(callbackParam.getEventType())) {
            if (StringUtil.isNullOrEmpty(callbackParam.getContainerCode())) {
                return R.error("容器编码不能为空!!");
            }
            if (StringUtil.isNullOrEmpty(callbackParam.getTaskCode())) {
                return R.error("任务编码不能为空!!");
            }
            boolean result = wcsApiService.receiveTaskStatus(callbackParam);
        } else {
            return R.error("上报事件类型不能为空!!");
        }
 
        return R.success();
    }
 
 
//    /**
//     * 下发点对点搬运任务
//     * @param
//     * @return
//     */
//    @PostMapping("/carry")
//    public R publishTaskOfCarry() {
//        PublishTasksReponse reponse = wcsApiService.publishTaskOfCarry();
//        if (reponse.getCode() == 0) {
//            return R.ok(reponse.getData());
//        } else {
//            return R.error(reponse.getMsg());
//        }
//    }
 
}