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.StockWaitDetailsDto;
import com.fjhx.wms.entity.stock.dto.StockWaitDto;
import com.fjhx.wms.entity.stock.dto.StockWaitSelectDto;
import com.fjhx.wms.entity.stock.vo.StockWaitVo;
import com.fjhx.wms.service.stock.StockWaitService;
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-22
 */
@DS(SourceConstant.WMS)
@RestController
@RequestMapping("/stockWait")
public class StockWaitController {

    @Autowired
    private StockWaitService stockWaitService;

    /**
     * 待出入库分页
     */
    @PostMapping("/page")
    public Page<StockWaitVo> page(@RequestBody StockWaitSelectDto dto) {
        return stockWaitService.getPage(dto);
    }

    /**
     * 待出入库分页 维多利亚
     */
    @PostMapping("/pageByWdly")
    public Page<StockWaitVo> pageByWdly(@RequestBody StockWaitSelectDto dto) {
        return stockWaitService.getPageByWdly(dto);
    }

    /**
     * 待出入库明细
     */
    @PostMapping("/detail")
    public StockWaitVo detail(@RequestBody BaseSelectDto dto) {
        return stockWaitService.detail(dto.getId());
    }

    /**
     * 待出入库明细 维多利亚
     */
    @PostMapping("/detailByWdly")
    public StockWaitVo detailByWdly(@RequestBody BaseSelectDto dto) {
        return stockWaitService.detailByWdly(dto.getId());
    }

    /**
     * 待出入库新增
     */
    @PostMapping("/add")
    public void add(@RequestBody StockWaitDetailsDto stockWaitDetailsDto) {
        stockWaitService.add(stockWaitDetailsDto);
    }

    /**
     * 待出入库新增 维多利亚
     */
    @PostMapping("/addByWdly")
    public void addByWdly(@RequestBody StockWaitDto stockWaitDto) {
        stockWaitService.addByWdly(stockWaitDto);
    }


    /**
     * 待出入库编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody StockWaitDto stockWaitDto) {
        stockWaitService.edit(stockWaitDto);
    }

    /**
     * 待出入库删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        stockWaitService.delete(dto.getId());
    }

    /**
     * 结束入库
     */
    @PostMapping("/endInStock")
    public void endInStock(@RequestBody StockWaitSelectDto dto) {
        stockWaitService.endInStock(dto.getId());
    }

}
