package com.fjhx.victoriatourist.controller.purchase;

import com.fjhx.wms.entity.stock.dto.StockWaitDetailsDto;
import com.fjhx.wms.entity.stock.dto.StockWaitDto;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.purchase.vo.PurchaseBackVo;
import com.fjhx.victoriatourist.entity.purchase.dto.PurchaseBackSelectDto;
import com.fjhx.victoriatourist.entity.purchase.dto.PurchaseBackDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.victoriatourist.service.purchase.PurchaseBackService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 采购退货 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-05-19
 */
@RestController
@RequestMapping("/purchaseBack")
public class PurchaseBackController {

    @Autowired
    private PurchaseBackService purchaseBackService;

    /**
     * 采购退货分页
     */
    @PostMapping("/page")
    public Page<PurchaseBackVo> page(@RequestBody PurchaseBackSelectDto dto) {
        return purchaseBackService.getPage(dto);
    }

    /**
     * 采购退货明细
     */
    @PostMapping("/detail")
    public PurchaseBackVo detail(@RequestBody BaseSelectDto dto) {
        return purchaseBackService.detail(dto.getId());
    }

    /**
     * 采购退货新增
     */
    @PostMapping("/add")
    public void add(@RequestBody PurchaseBackDto purchaseBackDto) {
        purchaseBackService.add(purchaseBackDto);
    }

    /**
     * 采购退货待出库出库
     */
    @PostMapping("/backOut")
    public void backOut(@RequestBody StockWaitDetailsDto stockWaitDetailsDto) {
        purchaseBackService.backOut(stockWaitDetailsDto);
    }

    /**
     * 采购退货待出库 批量
     */
    @PostMapping("/backOuts")
    public void backOuts(@RequestBody StockWaitDto stockWaitDto) {
        purchaseBackService.backOuts(stockWaitDto);
    }

}
