package com.fjhx.victoriatourist.controller.stock;

import com.fjhx.wms.entity.stock.dto.StockDto;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.stock.vo.StockTransferVo;
import com.fjhx.victoriatourist.entity.stock.dto.StockTransferSelectDto;
import com.fjhx.victoriatourist.entity.stock.dto.StockTransferDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.victoriatourist.service.stock.StockTransferService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 调仓记录 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-17
 */
@RestController
@RequestMapping("/stockTransfer")
public class StockTransferController {

    @Autowired
    private StockTransferService stockTransferService;

    /**
     * 调仓记录分页
     */
    @PostMapping("/page")
    public Page<StockTransferVo> page(@RequestBody StockTransferSelectDto dto) {
        return stockTransferService.getPage(dto);
    }

    /**
     * 调仓记录明细
     */
    @PostMapping("/detail")
    public StockTransferVo detail(@RequestBody BaseSelectDto dto) {
        return stockTransferService.detail(dto.getId());
    }

    /**
     * 调仓记录新增
     */
    @PostMapping("/add")
    public void add(@RequestBody StockTransferDto stockTransferDto) {
        stockTransferService.add(stockTransferDto);
    }

    /**
     * 调仓记录编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody StockTransferDto stockTransferDto) {
        stockTransferService.edit(stockTransferDto);
    }

    /**
     * 调仓记录删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        stockTransferService.delete(dto.getId());
    }

    @PostMapping("/receive")
    public void receive(@RequestBody StockTransferDto stockTransferDto){
        stockTransferService.receive(stockTransferDto);
    }

    /**
     * 调仓 重构用不是维多利亚的
     */
    @PostMapping("/addSt")
    public void stockTransfer(@RequestBody StockTransferDto stockTransferDto) {
        stockTransferService.stockTransfer(stockTransferDto);
    }

}
