package com.ruoyi.web.controller.business;

import java.util.List;
import com.ruoyi.framework.web.service.DictService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.TMiStock;
import com.ruoyi.business.service.ITMiStockService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 空托盘库存表Controller
 *
 * @author wms
 * @date 2022-05-29
 */
@Controller
@RequestMapping("/business/emptyReport")
public class EmptyStockController extends BaseController
{
    private String prefix = "business/stockReport";

    @Autowired
    private ITMiStockService tMiStockService;

    @Autowired
    private  DictService dict;

    @RequiresPermissions("business:emptyReport:view")
    @GetMapping()
    public String stock(ModelMap mmap)
    {
        mmap.put("tMiStock", new TMiStock());
        return prefix + "/emptyReport";
    }

    /**
     * 查询空托盘库存
     */
    @RequiresPermissions("business:emptyReport:list")
    @PostMapping("/empty")
    @ResponseBody
    public TableDataInfo empty(TMiStock tMiStock)
    {
        startPage();
        List<TMiStock> list = tMiStockService.selectStockEmpty(tMiStock);
        return getDataTable(list);
    }

    /**
     * 导出库存列表
     */
    @RequiresPermissions("business:emptyReport:export")
    @Log(title = "空托盘库存表", businessType = BusinessType.EXPORT)
    @PostMapping("/emptyExport")
    @ResponseBody
    public AjaxResult emptyExport(TMiStock tMiStock)
    {
        List<TMiStock> list = tMiStockService.selectStockEmpty(tMiStock);
        ExcelUtil<TMiStock> util = new ExcelUtil<TMiStock>(TMiStock.class);
        return util.exportExcel(list, "空托盘库存表");
    }

    /**
     * 状态说明弹框
     */
    @GetMapping("/stsDescribe")
    public String stsDescribe()
    {
        return prefix + "/stsdescribe";
    }
}
