package com.ruoyi.warehouseBusiness.mapper;


import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.ruoyi.approvalFlow.domain.AuditItems;
import com.ruoyi.reportManagement.domain.SingleAnalysisExcel;
import com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel;
import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
import com.ruoyi.reportManagement.dto.TWarehousebill;
import com.ruoyi.shipping.excel.DeriveInventoryExcel;
import com.ruoyi.shipping.excel.SingleVoyageByShipExcel;
import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
import com.ruoyi.warehouseBusiness.domain.dto.WarehousebillsDTO;
import com.ruoyi.warehouseBusiness.domain.vo.WarehouseBillsVO;
import com.ruoyi.warehouseBusiness.excel.StorageDetail;
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 TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
    /**
     * 查询详情主表
     *
     * @param fId 详情主表ID
     * @return 详情主表
     */
    public TWarehouseBills selectTWarehousebillsById(Long fId);

    /**
     * 查询对仓库物详情的列表
     *
     * @param tWarehousebills 详情主表
     * @return 结果
     */
    public List<Map<String, Object>> selectWarehouseBusinessList(TWarehouseBills tWarehousebills);

    public List<Map<String, Object>> selectWarehouseBusinessList1(TWarehouseBills tWarehousebills);

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

    /**
     * 新增详情主表
     *
     * @param tWarehousebills 详情主表
     * @return 结果
     */
    public int insertTWarehousebills(TWarehouseBills tWarehousebills);

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

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

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

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

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

    /**
     * 根据主表id 更新库存主表对应状态
     *
     * @param fettle 对应状态
     * @param fPid   主表id
     * @return 结果
     */
    int warehouseFollowUpdate(@Param("fPid") Long fPid, @Param("fettle") Long fettle, @Param("auditItem") Date auditItem);

    /**
     * 根据主表id 更新库存主表对应状态
     *
     * @param auditItems
     * @return 结果
     */
    int warehouseApprovalUpdate(@Param("auditItem") AuditItems auditItems, @Param("fettle") long fettle);

    /**
     * 查询详情主表列表
     *
     * @param fid
     * @return 详情主表集合
     */
    public List<TWareHouseExcelItems> selectTWarehousebillsItemsList(@Param("fId") Long fid);

    /**
     * 查询入库信息
     */
    public List<StorageDetail> selectInStockDetail(@Param("fId") Long fId);

    /**
     * 查询非入库信息
     */
    public List<StorageDetail> selectNotInStockDetail(@Param("fId") Long fId, @Param("billType") String billType);

    /**
     * 查询库存信息
     */
    public List<StorageDetail> selectInventoryDetail(@Param("fId") Long fId);

    List<Map<String, Object>> selectInventorySJRKList(TWarehouseBills tWarehousebills);

    List<Map<String, Object>> selectInventorySJCKList(TWarehouseBills tWarehousebills);

    public List<TWareHouseItemsExcel> selectTWarehousebillsItemList(TWarehouseBills tWarehouseBills);

    public List<Map<String, Object>> selectDetailedList(TWarehousebill tWarehousebill);

    /**
     * 根据提单号在当天时出现多少次
     *
     * @param warehouseBills 提单号
     * @return 结果
     */
    public int selectContainMblno(TWarehouseBills warehouseBills);

    /**
     * 凯和订单查询
     *
     * @param tWarehouseBills
     * @return
     */
    public List<TWarehouseBills> webVersionOrderList(TWarehouseBills tWarehouseBills);

    /**
     * 后台管理系统查询订单
     *
     * @return
     */
    public List<Map<String, Object>> ruoYiVersionOrderList(TWarehouseBills tWarehouseBills);

    /**
     * 后台管理系统查询订单
     *
     * @return
     */
    public List<Map<String, Object>> ruoYiVersionOrderList1(TWarehouseBills tWarehouseBills);

    /**
     * 根据id获取订单信息
     *
     * @param tWarehouseBills
     * @return
     */
    public List<TWarehouseBills> webVersionOrderById(TWarehouseBills tWarehouseBills);

    /**
     * 查询提单号的唯一性
     *
     * @param tWarehouseBills
     * @return
     */
    public TWarehouseBills selectTWarehousebillsfMblno(TWarehouseBills tWarehouseBills);

    /**
     * app 查询业务主表信息
     *
     * @param warehousebills
     * @return
     */
    public List<Map<String, Object>> selectAppStockList(TWarehouseBills warehousebills);

    /**
     * app 根据主表id查询主表对应明细列表数据
     *
     * @param warehouseBills
     * @return
     */
    public List<Map<String, Object>> selectWarehouseItemListById(TWarehouseBills warehouseBills);

    /**
     * 查询单票分析信息
     *
     * @param singleAnalysisExcel 查询条件
     * @return 结果
     */
    public List<SingleAnalysisExcel> selectSingleAnalysis(SingleAnalysisExcel singleAnalysisExcel);

    /**
     * 查询单票分析费用信息
     *
     * @param singleAnalysisExcel
     * @return
     */
    public List<SingleAnalysisFeesExcel> selectSingleAnalysisFees(SingleAnalysisExcel singleAnalysisExcel);

    /**
     * 凯和根据船名航次导出清单
     *
     * @param tWarehouseBills
     * @return
     */
    public List<DeriveInventoryExcel> deriveInventory(TWarehouseBills tWarehouseBills);

    /**
     * 批量查询凯和订单的船名航次信息
     *
     * @param fIds
     * @return
     */
    public List<TWarehouseBills> selectTWarehousebillsByIds(Long[] fIds);

    /**
     * 批量修改船名航次
     *
     * @param fIds           订单ID
     * @param fVessel        船名
     * @param fVoyage        航次
     * @param fCargoPlanning 是否配船
     * @param fLoadportid    起运港
     * @param fDestportid    目的港
     * @param fLaneid        航线
     * @return
     */
    public int updateTWarehousebillsByIds(@Param("fIds") Long[] fIds,
                                          @Param("fVessel") Long fVessel,
                                          @Param("fVoyage") Long fVoyage,
                                          @Param("fCargoPlanning") Long fCargoPlanning,
                                          @Param("fLoadportid") Long fLoadportid,
                                          @Param("fDestportid") Long fDestportid,
                                          @Param("fLaneid") Integer fLaneid);

    /**
     * 凯和单航次配船
     *
     * @param tWarehouseBills 主表
     * @return
     */
    public List<SingleVoyageByShipExcel> singleVoyageByShip(TWarehouseBills tWarehouseBills);

    /**
     * 根据明细集合 查询仓库主表信息
     *
     * @param itemId 明细id
     * @return
     */
    TWarehouseBills selectByItemId(@Param("id") Long itemId);

    /**
     * 根据提单号与箱型查询是否在业务日期重复录入了
     *
     * @param warehousebillsDTO 查询条件
     * @return
     */
    int selectByMblnoOrCntrnoCount(@Param("dto") WarehousebillsDTO warehousebillsDTO);

    /**
     * 根据提单号查询
     *
     * @param id 库存总账id
     * @return
     */
    List<WarehouseBillsVO> selectWhgenlegDetailById(Long id);

    /**
     *  计算仓储费列表
     * @param tWarehousebills
     * @return
     */
    List<Map<String, Object>> selecStorageFeeList(TWarehouseBills tWarehousebills);
}
