package com.wms_main.controller.wms;

import com.wms_main.model.dto.query.StockQuery;
import com.wms_main.model.dto.query.StockUpdateQuery;
import com.wms_main.model.dto.response.wms.WmsApiResponse;
import com.wms_main.model.vo.wms.PageVo;
import com.wms_main.model.vo.wms.StockUpdateVo;
import com.wms_main.model.vo.wms.StockVo;
import com.wms_main.service.controller.IStockControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 库存控制类
 */
@RestController
@ResponseBody
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/wms/stock")
public class StockController {
    /**
     * 库存控制类服务
     */
    private final IStockControllerService stockControllerService;

    /**
     * 分页查询库存
     * @param stockQuery 查询参数
     * @return 查询结果
     */
    @PostMapping("/queryStocksByPage")
    public WmsApiResponse<PageVo<StockVo>> queryStocksByPage(@RequestBody StockQuery stockQuery)
    {
        return stockControllerService.queryStocksByPage(stockQuery);
    }

    /**
     * 分页查询库存更新记录
     * @param stockUpdateQuery 查询参数
     * @return 查询结果
     */
    @PostMapping("/queryStockUpdateByPage")
    public WmsApiResponse<PageVo<StockUpdateVo>> queryStockUpdateByPage(@RequestBody StockUpdateQuery stockUpdateQuery)
    {
        return stockControllerService.queryStockUpdateByPage(stockUpdateQuery);
    }
}
