package com.fjhx.wms.controller.stock;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.fjhx.common.constant.SourceConstant;
import com.fjhx.wms.entity.stock.dto.StockJournalDto;
import com.fjhx.wms.entity.stock.dto.StockJournalSelectDto;
import com.fjhx.wms.entity.warehouse.po.Warehouse;
import com.fjhx.wms.service.warehouse.WarehouseService;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.wms.entity.stock.vo.StockJournalVo;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.wms.service.stock.StockJournalService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 出入库记录 前端控制器
 * </p>
 *
 * @author
 * @since 2023-03-20
 */
//@DS(SourceConstant.WMS)
@RestController
@RequestMapping("/stockJournal")
public class StockJournalController {

    @Autowired
    private StockJournalService stockJournalService;

    @Autowired
    private WarehouseService warehouseService;

    /**
     * 出入库调仓记录分页
     */
    @PostMapping("/page")
    public Page<StockJournalVo> page(@RequestBody StockJournalSelectDto dto) {
        return stockJournalService.getPage(dto);
    }

    /**
     * 出入库 调仓记录明细
     */
    @PostMapping("/detail")
    public StockJournalVo detail(@RequestBody BaseSelectDto dto) {
        return stockJournalService.detail(dto.getId());
    }

    /**
     * 出入库记录新增
     */
    @PostMapping("/add")
    public void add(@RequestBody StockJournalDto stockJournalDto) {
        stockJournalService.add(stockJournalDto);
    }

    /**
     * 出入库记录编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody StockJournalDto stockJournalDto) {
        stockJournalService.edit(stockJournalDto);
    }

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

}
