package com.ruoyi.warehouseBusiness.service;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;

import java.util.List;
import java.util.Map;

/**
 * 详情主表Service接口
 *
 * @author ruoyi
 * @date 2020-12-11
 */
public interface ITWarehouseBillsService {
    /**
     * 查询详情主表
     *
     * @param fId 详情主表ID
     * @return 详情主表
     */
    public Map<String, Object> selectTWarehousebillsById(Long fId);

    /**
     * 查询导出所需主表列表
     *
     * @param tWarehousebills 详情主表
     * @return 详情主表集合
     */
    public List<TWarehouseBills> selectTWarehousebillsList(TWarehouseBills tWarehousebills);

    /**
     * 查询详情主表列表
     *
     * @param tWarehousebills 详情主表
     * @return 详情主表集合
     */
    public List<Map<String, Object>> selectWarehouseBusinessList(TWarehouseBills tWarehousebills);

    /**
     * 新增详情主表
     *
     * @param tWarehouseBills       仓库主表
     * @param tWarehousebillsfeesCr 仓库费用付款明细表
     * @param tWarehousebillsfeesDr 仓库费用收款明细表
     * @param tWarehousebillsitems  仓库货物明细表
     * @param loginUser             当前登陆人
     * @param billsType             操作状态
     * @return 结果
     */
    public AjaxResult insertTWarehousebills(String tWarehouseBills, String tWarehousebillsfeesCr, String tWarehousebillsfeesDr,
                                            String tWarehousebillsitems, String tEnclosure, LoginUser loginUser, String billsType);

    /**
     * 修改详情主表
     *
     * @param tWarehousebills 详情主表
     * @return 结果
     */
    public int updateTWarehousebills(TWarehouseBills tWarehousebills);

    /**
     * 批量删除详情主表
     *
     * @param fIds 需要删除的详情主表ID
     * @return 结果
     */
    public int deleteTWarehousebillsByIds(Long[] fIds);

    public AjaxResult queryRemove(Long fId);

    /**
     * 删除详情主表信息
     *
     * @param fId 详情主表ID
     * @return 结果
     */
    public int deleteTWarehousebillsById(Long fId);

    String getWarehouseInStockBillsNo(TWarehouseBills tWarehouseBills);

    String getWarehouseOutStockBillsNo(TWarehouseBills tWarehouseBills);

    /**
     * 撤销入出库
     *
     * @param fId
     * @param loginUser
     * @param billsType
     * @return
     */
    public AjaxResult revokeTWarehousebillsById(Long fId, LoginUser loginUser, String billsType);

    AjaxResult revokeTWarehousebillsById1(String warehouseBills, String warehousebillsitems, String tEnclosure,
                                          String warehousebillsfeesCr, String warehousebillsfeesDr,
                                          LoginUser loginUser, String billsType);

    AjaxResult addCredit(String warehouseBills, String warehousebillsitems, String tEnclosure, String warehousebillsfeesCr,
            String warehousebillsfeesDr, LoginUser loginUser, String billsType);

    /**
     * 出库 、调拨、 货转 确认
     *
     * @param warehouseBills
     * @param warehousebillsitems
     * @param loginUser
     * @param billsType
     * @return
     */
    AjaxResult updateCredit(String warehouseBills, String warehousebillsitems, String tEnclosure, String warehousebillsfeesCr,
                            String warehousebillsfeesDr, LoginUser loginUser, String billsType);

    /**
     * 入库 、 出库  修改 从表状态
     *
     * @param warehouseBills
     * @param warehousebillsitems
     * @param loginUser
     * @param status
     * @return
     */
    AjaxResult waitWarehousing(String warehouseBills, String warehousebillsitems,
                               String tEnclosure, String tWarehousebillsfeesCr, String tWarehousebillsfeesDr,
                               LoginUser loginUser, Long status, String billtystatus);

    /**
     * 计算仓储费
     *
     * @param tWarehouseBills
     * @param loginUser
     * @param billsType
     * @return
     */
    AjaxResult calculateStorageFees(TWarehouseBills tWarehouseBills, LoginUser loginUser, String billsType);

    /**
     * 仓储费计算提交以及暂存
     *
     * @param warehouseBills
     * @param warehouseItems
     * @param warehouseFees
     * @param loginUser
     * @param billsType
     * @return
     */
    AjaxResult insertStorageFee(String warehouseBills, String warehouseItems, String warehouseFees, LoginUser loginUser, String billsType);

    /**
     * 根据id 查询仓储费计算明细
     *
     * @param fId
     * @return
     */
    AjaxResult selectStorageFeeById(Long fId);

    /**
     * 仓库提交方法
     *
     * @param tWarehouseBills       仓库主表
     * @param tWarehousebillsfeesCr 仓库费用付款明细表
     * @param tWarehousebillsfeesDr 仓库费用收款明细表
     * @param tWarehousebillsitems  仓库货物明细表
     * @param loginUser             当前登陆人
     * @param billsType             操作状态
     * @return 结果
     */
    AjaxResult warehouseSubmission(String tWarehouseBills, String tWarehousebillsfeesCr, String tWarehousebillsfeesDr, String tWarehousebillsitems, String tEnclosure, LoginUser loginUser, String billsType);

    /**
     *  导出计算明细
     * @param fId
     * @return
     */
    public List<TWareHouseExcelItems> selectTWarehousebillsItemsList(Long  fId);

    /**
     * 查询出入库汇总列表
     *
     * @param tWarehouseBills 仓储主表
     *      * @return 库存总账集合
     */
    List<Map<String, Object>> selectInventoryList(TWarehouseBills tWarehouseBills);

    public List<TWareHouseItemsExcel> selectTWarehousebillsItemsList(TWarehouseBills tWarehouseBills);

    AjaxResult serialNumber( String billsType);

}
