package vip.xiaonuo.warehouse.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.erp.entity.ErpBdRawMaterial;
import vip.xiaonuo.warehouse.entity.WarehouseMaterialInStock;
import vip.xiaonuo.warehouse.entity.WarehouseMaterialOutStock;
import vip.xiaonuo.warehouse.entity.WarehouseMaterialStock;
import vip.xiaonuo.warehouse.entity.WarehouseStockVo;
import vip.xiaonuo.warehouse.entity.vo.WarehouseMaterialStockVo;
import vip.xiaonuo.warehouse.param.WarehouseMaterialStockParam;
import vip.xiaonuo.warehouse.param.WarehouseMaterialTailParam;
import vip.xiaonuo.warehouse.param.WarehouseStockParam;
import vip.xiaonuo.warehouse.param.WarehouseStockTailParam;
import vip.xiaonuo.warehouse.service.IWarehouseMaterialStockService;

import java.util.List;

/**
 * <p>
 * 仓库原材料库存 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-03-17
 */
@RestController
@Api(tags = "仓库原材料库存")
@ApiSupport(author = "wang", order = 1)
@Validated
public class WarehouseMaterialStockController {

    @Autowired
    private IWarehouseMaterialStockService materialStockService;

    @ApiOperationSupport(order = 1)
    @ApiOperation("仓库原材料库存趋势分析（新）")
    @PostMapping("/warehouse-material-stock/listMaterial")
    public CommonResult<List<WarehouseMaterialStockVo>> listMaterial(@RequestBody WarehouseMaterialStockParam stockParam) {
        return CommonResult.data(materialStockService.listMaterial(stockParam));
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation("仓库原材料库存出库数量分析（新）")
    @PostMapping("/warehouse-material-stock/listMaterialOut")
    public CommonResult<List<WarehouseMaterialOutStock>> listMaterialOut(@RequestBody WarehouseMaterialStockParam stockParam) {
        return CommonResult.data(materialStockService.listMaterialOut(stockParam));
    }

    @ApiOperationSupport(order = 3)
    @ApiOperation("仓库指标弹出出库列表")
    @PostMapping("/warehouse-material-stock/outMaterial")
    public CommonResult<Page<WarehouseMaterialOutStock>> outMaterial(@RequestBody WarehouseMaterialTailParam materialTailParam) {
        return CommonResult.data(materialStockService.outMaterial(materialTailParam));
    }

    @ApiOperationSupport(order = 4)
    @ApiOperation("仓库指标弹出入库列表")
    @PostMapping("/warehouse-material-stock/inMaterial")
    public CommonResult<Page<WarehouseMaterialInStock>> inMaterial(@RequestBody WarehouseMaterialTailParam materialTailParam) {
        return CommonResult.data(materialStockService.inMaterial(materialTailParam));
    }
}
