ShipmentApiController.java 2.55 KB
package com.huaheng.api.general.controller;


import com.huaheng.api.general.domain.ShipmentDomain;
import com.huaheng.api.general.service.ShipmentApiService;
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.domain.AjaxResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/shipmentApi")
@Api(tags = {"出库单接口"}, value = "出库单接口shipment")
public class ShipmentApiController {

    @Resource
    private ShipmentApiService shipmentApiService;

    /**
     * 同步出库单
     */
    @Log(title = "出库单添加", action = BusinessType.INSERT)
    @PostMapping("/shipment")
    @ApiLogger(apiName = "添加出库单", from = "ERP")
    public AjaxResult shipment(@RequestBody ShipmentDomain shipmentDomain) {
        return shipmentApiService.shipment(shipmentDomain);
    }

    /**
     * 取消出库单
     */
    @Log(title = "出库-出库单 ", operating = "删除出库单", action = BusinessType.UPDATE)
    @PostMapping("/delete")
    @ApiLogger(apiName = "删除出库单", from = "ERP")
    public AjaxResult delete(@RequestBody List<String> referCodeList) {
        if (referCodeList == null || referCodeList.isEmpty()) {
            return AjaxResult.error("单号列表为空");
        }
        return shipmentApiService.delete(referCodeList);
    }

    /**
     * 取消出库单
     */
    @Log(title = "出库-出库单 ", operating = "出库单删除", action = BusinessType.UPDATE)
    @PostMapping("/remove")
    @ApiLogger(apiName = "取消出库单", from = "ERP")
    public AjaxResult remove(@RequestBody List<String> shipmentCodeList) {
        if (shipmentCodeList == null || shipmentCodeList.isEmpty()) {
            return AjaxResult.error("出库单号列表为空");
        }
        return shipmentApiService.remove(shipmentCodeList);
    }

    /**
     * 出库单查询
     */
    @Log(title = "出库-出库单 ", operating = "查询出库单", action = BusinessType.UPDATE)
    @GetMapping("/search")
    @ApiLogger(apiName = "查询出库单", from = "ERP")
    public AjaxResult search(@RequestParam String shipmentCode,
                             @RequestParam String companyCode,
                             @RequestParam String warehouseCode) {
        return shipmentApiService.search(shipmentCode, companyCode, warehouseCode);
    }
}