package com.ruoyi.reportManagement.mapper;


import com.ruoyi.reportManagement.domain.TWhgenleg;
import com.ruoyi.reportManagement.domain.vo.WhgenlegVO;
import com.ruoyi.reportManagement.excel.Whgenleg;
import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
import com.ruoyi.warehouseBusiness.domain.vo.CalculateStorageFeesInfoVO;
import org.apache.ibatis.annotations.Param;

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

/**
 * 库存总账Mapper接口
 *
 * @author ruoyi
 * @date 2020-12-11
 */
public interface TWhgenlegMapper {
    /**
     * 查询库存总账
     *
     * @param fId 库存总账ID
     * @return 库存总账
     */
    public TWhgenleg selectTWhgenlegById(Long fId);

    /**
     * 查询库存总账列表
     *
     * @param tWhgenleg 库存总账
     * @return 库存总账集合
     */
    public List<TWhgenleg> selectTWhgenlegList(TWhgenleg tWhgenleg);

    /**
     * 新增库存总账
     *
     * @param tWhgenleg 库存总账
     * @return 结果
     */
    public int insertTWhgenleg(TWhgenleg tWhgenleg);

    /**
     * 修改库存总账
     *
     * @param tWhgenleg 库存总账
     * @return 结果
     */
    public int updateTWhgenleg(TWhgenleg tWhgenleg);

    /**
     * 删除库存总账
     *
     * @param fAccyear 库存总账ID
     * @return 结果
     */
    public int deleteTWhgenlegById(Long fAccyear);

    /**
     * 批量删除库存总账
     *
     * @param fAccyears 需要删除的数据ID
     * @return 结果
     */
    public int deleteTWhgenlegByIds(Long[] fAccyears);

    /**
     * 查询条件库存总账是否存在
     *
     * @param tWhgenleg 库存总账
     * @return 结果
     */
    public TWhgenleg selectTWhgenleg(TWhgenleg tWhgenleg);


    /**
     * 修改库存总账表
     *
     * @param map
     * @return 结果
     */
    public int updateTWhgenlegData(@Param("map") Map<String, Object> map);

    List<Map<String, Object>> selectInventoryList(TWhgenleg tWhgenleg);

    List<Map<String, Object>> selectWhgenlegList(TWhgenleg tWhgenleg);

    List<Map<String, Object>> selectGoodsList();

    List<Map<String, Object>> selectGoodsListWhouse(Long fId);

    List<Map<String, Object>> selectWareHouseList();

    List<Map<String, Object>> selectWareHouseListWhouse(Long fId);

    List<Map<String, Object>> selectCorpsList();

    List<Map<String, Object>> selectCorpsListWhouse(Long fId);

    List<Map<String, Object>> selectDateFQtyblcListList(@Param("map") Map<String, Object> map);

    /**
     * 查询库存总账计算仓储费
     *
     * @param tWarehouseBills
     * @return
     */
    public List<Map<String, Object>> selectStorageFeeItemList(@Param("warehouse") TWarehouseBills tWarehouseBills);
    public List<CalculateStorageFeesInfoVO> selectStorageFeeItemList1(@Param("warehouse") TWarehouseBills tWarehouseBills);

    /**
     * 查询库存总账列表
     *
     * @param tWhgenleg 库存总账
     * @return 库存总账集合
     */
    public List<Map<String, Object>> selectInventoryMapList(TWhgenleg tWhgenleg);

    /**
     * 库存总账导出
     *
     * @param tWhgenleg
     * @return
     */
    List<Whgenleg> selectWhgenlegMessage(TWhgenleg tWhgenleg);

    /**
     * 根据客户id或者提单号查询库存不为0的仓库
     *
     * @param tWhgenleg
     * @return
     */
    public List<Map<String, Object>> getWarehouse(TWhgenleg tWhgenleg);

    /**
     * 根据id查询仓储费计费日期是否发生变化
     *
     * @param ids        id集合
     * @param chargedate 校验日期
     * @return
     */
    int queryChangedByFchargedate(@Param("ids") List<Long> ids, @Param("time")Date chargedate);

    /**
     *  库存总帐入库、出库查询来源明细
     * @param tWhgenleg
     * @return
     */
    List<WhgenlegVO> selectStockDetailsList(TWhgenleg tWhgenleg);

    /**
     *  库存总帐货转、调拨、通关查询来源明细
     * @param tWhgenleg
     * @return
     */
    List<WhgenlegVO> selectOtherDetailsList(TWhgenleg tWhgenleg);

    /**
     * 库存统计
     * @param beginDate 起始时间
     * @param endDate 截止时间
     * @param external 外部用户
     * @return
     */
    public Map<String, Object> stockStatistics(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("external") String external);

    /**
     * 库龄
     * @param external 外部用户
     * @return
     */
    public Map<String, Object> stockDays(@Param("external") String external);
}
