Blame view

src/main/java/com/huaheng/api/sap/controller/SAPApiController.java 2.41 KB
1
2
package com.huaheng.api.sap.controller;
3
4
5
import javax.annotation.Resource;

import org.springframework.web.bind.annotation.*;
6
7
8
9

import com.huaheng.api.general.service.ReceiptApiService;
import com.huaheng.api.sap.domain.ZarDomain;
import com.huaheng.api.sap.service.ZarApiService;
10
11
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.common.utils.StringUtils;
12
13
14
15
16
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;
17
18
import com.huaheng.pc.sap.domain.Zarsh;
19
20
21
22
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
23
@RequestMapping("/api/zarapi")
24
@Api(tags = {"入库单接口"}, value = "入库单接口receipt")
25
public class SAPApiController extends BaseController {
26
27
28
29
30
31
32

    @Resource
    private ReceiptApiService receiptApiService;
    @Resource
    private ZarApiService zarApiService;

    /**
33
     * SAP下发任务单据
34
     */
周鸿 authored
35
    @Log(title = "SAP下发任务单据", action = BusinessType.INSERT)
36
    @PostMapping("/save")
37
    @ApiOperation("SAP下发任务单据")
38
    @ResponseBody
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    @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.isNull(zarsh.getMFlag())) {
            throw new ServiceException("入库出库标志为空");
        }
58
59
60
61
62
63
64
65
66
67
68
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                AjaxResult ajaxResult = zarApiService.saveSapData(zarDomain);
                return ajaxResult;
            }
        });
        return ajaxResult;
    }

}