package com.fjhx.wms.controller.stock;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.common.constant.SourceConstant;
import com.fjhx.wms.entity.stock.dto.StockCheckDto;
import com.fjhx.wms.entity.stock.dto.StockCheckSelectDto;
import com.fjhx.wms.entity.stock.vo.StockCheckVo;
import com.fjhx.wms.service.stock.StockCheckService;
import com.ruoyi.common.core.domain.BaseSelectDto;
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;


/**
 * <p>
 * 库存盘点 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-03-22
 */
//@DS(SourceConstant.WMS)
@RestController
@RequestMapping("/stockCheck")
public class StockCheckController {

    @Autowired
    private StockCheckService stockCheckService;

    /**
     * 库存盘点分页
     */
    @PostMapping("/page")
    public Page<StockCheckVo> page(@RequestBody StockCheckSelectDto dto) {
        return stockCheckService.getPage(dto);
    }

    /**
     * 库存盘点明细
     */
    @PostMapping("/detail")
    public StockCheckVo detail(@RequestBody BaseSelectDto dto) {
        return stockCheckService.detail(dto.getId());
    }

    /**
     * 库存盘点新增
     */
    @PostMapping("/add")
    public void add(@Validated @RequestBody StockCheckDto stockCheckDto) {
        stockCheckService.add(stockCheckDto);
    }

}
