package vip.xiaonuo.warehouse.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.purchase.entity.vo.PurchaseContractVo;
import vip.xiaonuo.purchase.param.PurchaseOrderParam;
import vip.xiaonuo.purchase.service.IPurchaseContractService;
import vip.xiaonuo.warehouse.entity.WarehouseOutStock;
import vip.xiaonuo.warehouse.entity.WarehouseStock;
import vip.xiaonuo.warehouse.entity.WarehouseStockVo;
import vip.xiaonuo.warehouse.entity.vo.WarehouseStockSecondVo;
import vip.xiaonuo.warehouse.param.WarehouseStockParam;
import vip.xiaonuo.warehouse.param.WarehouseStockSecondParam;
import vip.xiaonuo.warehouse.param.WarehouseStockTailParam;
import vip.xiaonuo.warehouse.service.IWarehouseStockService;

import java.util.List;

/**
 * <p>
 * 仓库库存变化 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-28
 */

@Api(tags = "仓库库存控制器")
@ApiSupport(author = "wang", order = 1)
@RestController
@Validated
public class WarehouseStockController {

    @Autowired
    private IWarehouseStockService stockService;


    @ApiOperationSupport(order = 1)
    @ApiOperation("仓库指标")
    @PostMapping("/warehouse-stock/getOneTail")
    public CommonResult<WarehouseStockVo> getList(@RequestBody WarehouseStockTailParam stockParam) {
        return CommonResult.data(stockService.getOneTail(stockParam));
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation("库存趋势分析")
    @PostMapping("/warehouse-stock/listStockChange")
    public CommonResult<List<WarehouseStock>> listStockChange(@RequestBody WarehouseStockParam stockParam) {
        return CommonResult.data(stockService.listStockChange(stockParam));
    }

    @ApiOperationSupport(order = 3)
    @ApiOperation("出库数量分析")
    @PostMapping("/warehouse-stock/listStockOut")
    public CommonResult<List<WarehouseOutStock>> listStockOut(@RequestBody WarehouseStockParam stockParam) {
        return CommonResult.data(stockService.listStockOut(stockParam));
    }

    @ApiOperationSupport(order = 4)
    @ApiOperation("二级页面")
    @PostMapping("/warehouse-stock/getSecond")
    public CommonResult<WarehouseStockSecondVo> getSecond(@RequestBody WarehouseStockSecondParam stockParam) {
        return CommonResult.data(stockService.getSecond(stockParam));
    }
}
