SAPApiController.java
2.41 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
package com.huaheng.api.sap.controller;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import com.huaheng.api.general.service.ReceiptApiService;
import com.huaheng.api.sap.domain.ZarDomain;
import com.huaheng.api.sap.service.ZarApiService;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.sap.domain.Zarsh;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/zarapi")
@Api(tags = {"入库单接口"}, value = "入库单接口receipt")
public class SAPApiController extends BaseController {
@Resource
private ReceiptApiService receiptApiService;
@Resource
private ZarApiService zarApiService;
/**
* SAP下发任务单据
*/
@Log(title = "SAP下发任务单据", action = BusinessType.INSERT)
@PostMapping("/save")
@ApiOperation("SAP下发任务单据")
@ResponseBody
@ApiLogger(apiName = "SAP下发任务单据", from = "ERP")
public AjaxResult save(@RequestBody ZarDomain zarDomain) {
if (StringUtils.isNull(zarDomain)) {
throw new ServiceException("参数为空");
}
Zarsh zarsh = zarDomain.getZarsh();
if (zarsh == null) {
throw new ServiceException("zarsh参数为空");
}
if (StringUtils.isEmpty(zarsh.getUniqueId())) {
throw new ServiceException("唯一号uniqueId参数为空");
}
// 判断出库、入库,然后在判断是否空托盘出入库
if (StringUtils.isEmpty(zarsh.getLgnum())) {
throw new ServiceException("仓库号为空");
}
if (StringUtils.isEmpty(zarsh.getMFlag())) {
throw new ServiceException("入库出库标志为空");
}
AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = zarApiService.saveSapData(zarDomain);
return ajaxResult;
}
});
return ajaxResult;
}
}