package com.fjhx.wms.controller.stock;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.wms.entity.stock.dto.StockDto;
import com.fjhx.wms.entity.stock.dto.StockSelectDto;
import com.fjhx.wms.entity.stock.po.Stock;
import com.fjhx.wms.entity.stock.vo.StockVo;
import com.fjhx.wms.service.stock.StockService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
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-20
 */
//@DS(SourceConstant.WMS)
@RestController
@RequestMapping("/stock")
public class StockController {

    @Autowired
    private StockService stockService;

    /**
     * 库存查询
     */
    @PostMapping("/page")
    public Page<StockVo> page(@RequestBody StockSelectDto dto) {
        return stockService.getPage(dto);
    }
    /**
     * 库存明细
     */
    @PostMapping("/detail")
    public Stock detail(@RequestBody StockDto dto) {
        return stockService.detail(dto);
    }

    /**
     * 手动入库
     */
    @PostMapping("/add")
    public void add(@RequestBody StockDto stockDto) {
        stockService.add(stockDto);
    }

    /**
     * 手动出库
     */
    @PostMapping("/edit")
    public void edit(@RequestBody StockDto stockDto) {
        stockService.edit(stockDto);
    }

    /**
     * 库存删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        stockService.delete(dto.getId());
    }

    /**
     * 库存预警
     */
    @PostMapping("/stockWarningPage")
    public Page<StockVo> stockWarningPage(@RequestBody StockSelectDto dto) {
        return stockService.stockWarningPage(dto);
    }

}
