k94314517
2024-12-11 23ac7615c09cd6a1f9e6e91875f0b8448a749191
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package com.doumee.cloud.admin;
 
import com.alibaba.fastjson.JSONObject;
import com.doumee.api.BaseController;
import com.doumee.config.annotation.LoginNoRequired;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.utils.Constants;
import com.doumee.core.wms.model.request.WmsActionNoticeRequest;
import com.doumee.core.wms.model.request.WmsBaseRequest;
import com.doumee.core.wms.model.request.WmsInboundNoticeRequest;
import com.doumee.core.wms.model.request.WmsOutboundNoticeRequest;
import com.doumee.core.wms.model.response.WmsBaseResponse;
import com.doumee.service.business.third.WmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;
 
/**
 * @author 江蹄蹄
 * @date 2023/11/30 15:33
 */
@Api(tags = "WMS平台数据推送接口")
@RestController
@Slf4j
@LoginNoRequired
@RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/wms")
public class WmsPushCloudController extends BaseController {
 
    @Autowired
    private WmsService wmsService;
 
    @ApiOperation("【WMS】推送入库单通知任务")
    @PostMapping("/push/inboundNotice")
    @LoginNoRequired
    public WmsBaseResponse inboundNotice(@RequestBody WmsBaseRequest<WmsInboundNoticeRequest> param) {
        int success = Constants.ZERO;
        WmsBaseResponse result =null;
        try {
            result = wmsService.inboundNotice(param);
            wmsService.computjobTotalNum(param.getJobIdList());
        }catch (BusinessException e){
            log.error("【WMS】推送入库单通知任务===失败:"+e.getMessage());
            success = Constants.ONE;
        }catch (Exception e){
            log.error("【WMS】推送入库单通知任务===失败:"+e.getMessage());
            e.printStackTrace();
            success = Constants.ONE;
        }finally {
            wmsService.saveInterfaceLog("/wms/push/inboundNotice", "推送入库单通知任务",JSONObject.toJSONString(param),
                    success, JSONObject.toJSONString(result),Constants.ONE);
        }
        return result;
    }
 
    @ApiOperation("【WMS】推送出库单通知任务")
    @LoginNoRequired
    @PostMapping("/push/outboundNotice")
    public WmsBaseResponse outboundNotice(@RequestBody WmsBaseRequest<WmsOutboundNoticeRequest> param) {
        int success = Constants.ZERO;
        WmsBaseResponse result =null;
        try {
            result = wmsService.outboundNotice(param);
            wmsService.computjobTotalNum(param.getJobIdList());
        }catch (BusinessException e){
            log.error("【WMS】推送出库单通知任务===失败:"+e.getMessage());
            success = Constants.ONE;
        }catch (Exception e){
            log.error("【WMS】推送出库单通知任务===失败:"+e.getMessage());
            e.printStackTrace();
            success = Constants.ONE;
        }finally {
            wmsService.saveInterfaceLog("/wms/push/outboundNotice", "推送出库单通知任务",JSONObject.toJSONString(param),success
                    , JSONObject.toJSONString(result),Constants.ONE);
        }
 
        return result;
    }
    @ApiOperation("【WMS】推送取消入库单通知任务")
    @LoginNoRequired
    @PostMapping("/push/cancelInbound")
    public WmsBaseResponse cancelInbound(@RequestBody WmsBaseRequest<WmsActionNoticeRequest> param) {
        int success = Constants.ZERO;
        WmsBaseResponse result =null;
        try {
            result = wmsService.cancelInbound(param);
        }catch (BusinessException e){
            log.error("【WMS】推送取消入库单通知任务===失败:"+e.getMessage());
            success = Constants.ONE;
        }catch (Exception e){
            log.error("【WMS】推送取消入库单通知任务===失败:"+e.getMessage());
            e.printStackTrace();
            success = Constants.ONE;
        }finally {
            wmsService.saveInterfaceLog("/wms/push/cancelInbound", "推送取消入库单通知任务",JSONObject.toJSONString(param),
                    success, JSONObject.toJSONString(result),Constants.ONE);
        }
        return result;
    }
    @ApiOperation("【WMS】推送取消出库单通知任务")
    @LoginNoRequired
    @PostMapping("/push/cancelOutbound")
    public WmsBaseResponse cancelOutbound(@RequestBody WmsBaseRequest<WmsActionNoticeRequest> param) {
        int success = Constants.ZERO;
        WmsBaseResponse result =null;
        try {
            result = wmsService.cancelOutbound(param);
        }catch (BusinessException e){
            log.error("【WMS】推送取消出库单通知任务===失败:"+e.getMessage());
            success = Constants.ONE;
        }catch (Exception e){
            log.error("【WMS】推送取消出库单通知任务===失败:"+e.getMessage());
            e.printStackTrace();
            success = Constants.ONE;
        }finally {
            wmsService.saveInterfaceLog("/wms/push/cancelOutbound", "推送取消出库单通知任务",
                    JSONObject.toJSONString(param),  success, JSONObject.toJSONString(result),Constants.ONE);
        }
        return result;
    }
    @ApiOperation("【WMS】推送出入库作业完成通知任务")
    @LoginNoRequired
    @PostMapping("/push/doneTask")
    public WmsBaseResponse doneTask(@RequestBody WmsBaseRequest<WmsActionNoticeRequest> param) {
        int success = Constants.ZERO;
        WmsBaseResponse result = null;
        try {
            result = wmsService.doneTask(param);
        }catch (BusinessException e){
            log.error("【WMS】推送出入库作业完成通知任务===失败:"+e.getMessage());
            success = Constants.ONE;
        }catch (Exception e){
            log.error("【WMS】推送出入库作业完成通知任务===失败:"+e.getMessage());
            e.printStackTrace();
            success = Constants.ONE;
        }finally {
            wmsService.saveInterfaceLog("/wms/push/doneTask", "推送出入库作业完成通知任务",JSONObject.toJSONString(param),
                    success, JSONObject.toJSONString(result),Constants.ONE);
        }
        return result;
    }
 
}