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.shipping.domain.TCntrno;
import com.ruoyi.shipping.excel.SingleVoyageByShipExcel;
import com.ruoyi.system.domain.SysCheckCode;
import com.ruoyi.warehouseBusiness.domain.StorageChargeInsert;
import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
import com.ruoyi.warehouseBusiness.excel.*;
import org.springframework.web.multipart.MultipartFile;

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 fId 详情主表ID
     * @return 详情主表
     */
    public AjaxResult selectTWarehousebills(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 tCntr, String billsType);

    /**
     * 新增仓库主(出入库)
     *
     * @param tWarehousebills 仓库主(出入库)
     * @return 结果
     */
    public int insertTWarehousebills(TWarehouseBills tWarehousebills);

    /**
     * 凯和订单计划暂存
     * @param tWarehousebills 主表信息
     * @param tWarehousebillsCntr 从表信息
     * @return
     */
    public AjaxResult TSPlantMessage(String tWarehousebills,String tWarehousebillsCntr,
                                              String billsType,LoginUser loginUser);
    /**
     * 凯和订单计划提交
     * @param tWarehousebills 主表信息
     * @param tWarehousebillsCntr 从表信息
     * @return
     */
    public AjaxResult submitPlantMessage(String tWarehousebills,String tWarehousebillsCntr,
                                              String billsType,LoginUser loginUser);
    /**
     * 凯和订单配船暂存
     * @param tWarehousebills 主表信息
     * @param tWarehousebillsCntritems 从表信息
     * @return
     */
    public AjaxResult TSMakingMessage(String tWarehousebills,String tWarehousebillsCntritems,
                                     String billsType,LoginUser loginUser);
    /**
     * 凯和订单配船提交
     * @param tWarehousebills 主表信息
     * @param tWarehousebillsCntritems 从表信息
     * @return
     */
    public AjaxResult submitMakingMessage(String tWarehousebills,String tWarehousebillsCntritems,
                                      String billsType,LoginUser loginUser);
    /**
     * 修改详情主表
     *
     * @param tWarehousebills 详情主表
     * @return 结果
     */
    public int updateTWarehousebills(TWarehouseBills tWarehousebills);

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

    public AjaxResult queryRemove(Long fId);

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

    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 tCntr, String billsType);

    AjaxResult addCredit(String warehouseBills, String warehousebillsitems, String tEnclosure, String warehousebillsfeesCr,
            String warehousebillsfeesDr, LoginUser loginUser, String tCntr, 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 tCntr, 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,  String tCntr, Long status, String billtystatus);

    /**
     * 计算仓储费
     *
     * @param tWarehouseBills
     * @param loginUser
     * @param billsType
     * @return
     */
    AjaxResult calculateStorageFees(TWarehouseBills tWarehouseBills, LoginUser loginUser, String billsType);
    /**
     * 计算仓储费
     *
     * @param tWarehouseBillsList
     * @param loginUser
     * @param billsType
     * @return
     */
    AjaxResult calculateStorageFeesList(List<TWarehouseBills> tWarehouseBillsList, 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);
    /**
     * 仓储费计算list提交以及暂存
     *
     * @param storageChargeInsert
     * @param loginUser
     * @return
     */
    AjaxResult insertStorageFeeList(List<StorageChargeInsert> storageChargeInsert, 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 tCntr, 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);

    public int derecognition(Long fId);

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

    /**
     *  app查询入库数量
     */
    public List<Map<String, Object>> selectWarehouseBusinessInStockList(TWarehousebillsitems tWarehousebillsitems);

    AjaxResult waitWarehousingItems(TWarehousebillsitems tWarehousebillsitems);

    AjaxResult addCreditItems(String item , String  attachs);

    public List<InStock> inStockExport(TWarehouseBills tWarehousebills) throws Exception;

    public List<OutStock> outStockExport(TWarehouseBills tWarehousebills) throws Exception;

    public List<StockTransfer> stockTransferExport(TWarehouseBills tWarehousebills) throws Exception;

    public List<GoodsTransfer> goodsTransferExport(TWarehouseBills tWarehousebills) throws Exception;

    public List<StorageFee> storageFeeExport(TWarehouseBills tWarehousebills) throws Exception;

    public AjaxResult saveWarehouse(String item, String information);

    /**
     *  查询提单号是否在一天当中出现多次
     * @param tWarehouseBills   仓库数据
     * @return  结果
     */
    public AjaxResult selectContainMblno(String tWarehouseBills, String billsType);

    /**
     * 凯和网页版查询我的订单
     * @param tWarehouseBills
     * @return
     */
    public List<TWarehouseBills> webVersionOrder(TWarehouseBills tWarehouseBills);
    /**
     * 凯和网页版查询我的订单
     * @param tWarehouseBills
     * @return
     */
    public List<TWarehouseBills> webVersionOrderMessage(TWarehouseBills tWarehouseBills);
    /**
     * 后台管理系统查询订单
     * @return
     */
    public List<Map<String,Object>> ruoYiVersionOrderList(LoginUser loginUser,TWarehouseBills tWarehouseBills);
    /**
     * 网站查询订单
     */
    public List<Map<String,Object>> webVersionOrderMessage(LoginUser loginUser,TWarehouseBills tWarehouseBills);
    /**
     * 根据id获取订单信息
     * @param tWarehouseBills
     * @return
     */
    public List<TWarehouseBills> webVersionOrderDetails(TWarehouseBills tWarehouseBills);

    /**
     * 若依维护订单信息
     * @param tWarehousebills
     * @param tWarehousebillsCntritems
     * @param tWarehousebillsfeesCr
     * @param tWarehousebillsfeesDr
     * @return
     */
    public AjaxResult ruoYiUpdateOrderMessage(String tWarehousebills,String tWarehousebillsCntr,String tWarehousebillsCntritems,
                                              String tWarehousebillsfeesCr,String tWarehousebillsfeesDr,LoginUser loginUser,
                                              String billsType);
    /**
     * 若依维护订单信息
     * @param tWarehousebills
     * @param tWarehousebillsCntritems
     * @param tWarehousebillsfeesCr
     * @param tWarehousebillsfeesDr
     * @return
     */
    public AjaxResult ruoYiSubmitMessage(String tWarehousebills,String tWarehousebillsCntr,String tWarehousebillsCntritems,
                                              String tWarehousebillsfeesCr,String tWarehousebillsfeesDr,LoginUser loginUser,
                                              String billsType);

    public AjaxResult updateOrderMessage(TWarehouseBills tWarehouseBills);
    /**
     *  app 查询列表信息
     * @param warehouseBills
     * @return
     */
    public List<Map<String, Object>> selectAppStockList(TWarehouseBills warehouseBills);

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

    /**
     * 根据明细id查询对应明细表数据
     * @param fId
     * @return
     */
    public AjaxResult selectWarehouseItemDataById(Long fId);

    /**
     * 查询app 添加新行 必要的基础资料
     * @return
     * @param fId
     */
    public AjaxResult getAppBasicInformation(Long fId);

    /**
     * app确认入库、出库、货转
     * @param item      明细数据
     * @param attachs   附件数据
     * @return  结果
     */
    public AjaxResult warehouseOperationConfirmation(String item, String attachs);

    /**
     *  app仓储新行保存业务
     * @param item      明细数据
     * @param attachs   附件数据
     * @return  结果
     */
    public AjaxResult submitWarehouse(String item, String attachs);

    /**
     *  查看集港业务
     * @param fId   集港id
     * @return
     */
    public AjaxResult selectContainerPort(Long fId);

    /**
     *  集港业务保存、提交接口
     * @param tWarehouseBills   主表业务
     * @param feesCr    收费
     * @param feesDr    付费
     * @return
     */
    public AjaxResult saveContainerPort(String tWarehouseBills, String feesCr, String feesDr, String type);

    /**
     *  查询集港业务基础资料
     * @return
     */
    public AjaxResult selectBasicInformation();

    /**
     *  集港业务撤销
     * @param fId       主表id
     * @param type
     * @return
     */
    public AjaxResult revokeContainerPort(Long fId, String type);
    /**
     *  导入Excel生成箱信息
     * @param file  excel
     * @return  结果
     */
    public AjaxResult importCreateCompanyMsg(MultipartFile file) throws Exception;
    /**
     *  导入Excel生成箱信息
     * @param file  excel
     * @return  结果
     */
    public AjaxResult importCreateCompanyMsgNew(MultipartFile file,LoginUser loginUser,Long fId) throws Exception;

    /**
     * 提交仓库主表审批
     * @param tWarehouseBills       主表信息
     * @param tWarehousebillsfeesCr 付款信息
     * @param tWarehousebillsfeesDr 收款信息
     * @param tWarehousebillsitems  仓储明细
     * @param tEnclosure            附件信息
     * @param tCntr                 箱型箱量
     * @param billsType             类型
     * @return  结果
     */
    public AjaxResult submitWarehousingApproval(String tWarehouseBills, String tWarehousebillsfeesCr, String tWarehousebillsfeesDr, String tWarehousebillsitems, String tEnclosure, String tCntr, String billsType);

    /**
     * 撤销已审核通过的接单入库信息
     * @param fId
     * @return
     */
    public AjaxResult withdrawOrdersById(Long fId);

    /**
     *  查询单据是否允许变更
     * @param sysCheckCode
     * @return  结果
     */
    public boolean checkCode(SysCheckCode sysCheckCode);

    /**
     *  导入【入库明细箱信息】Excel
     * @param file  文件
     * @return
     */
    public AjaxResult importLibraryInformation(MultipartFile file);

    /**
     * 计算出库仓储费
     * @param fId
     * @return
     */
    public AjaxResult calculateOutStockFee(Long fId);

    /**
     * 查询仓储仓管员角色用户
     */
    public AjaxResult queryClerkRoleList();

    /**
     * 出入库明细提交审批确认
     */
    public AjaxResult addDetails(Long fId, String billsType,LoginUser loginUser);
    /**
     * 新增仓库主(出入库)
     *
     * @param tWarehousebills 仓库主(出入库)
     * @return 结果
     */
    public AjaxResult getMblno(TWarehouseBills tWarehousebills);
    /**
     * 凯和商务端订单修改，修改完，删除提交审批
     * @param tWarehouseBills 主表信息
     * @param loginUser 操作人信息
     * @return
     */
    public AjaxResult orderExamine(TWarehouseBills tWarehouseBills,LoginUser loginUser);
    /**
     * 凯和商务端运单变更
     * @param tWarehousebills
     * @param tWarehousebillsCntritems
     * @return
     */
    public AjaxResult waybillChanges(String tWarehousebills,String tWarehousebillsCntr,String tWarehousebillsCntritems,
                                              LoginUser loginUser,
                                              String billsType);

    /**
     * 复制运单变更前的数据
     * @param fId
     * @return
     */
    public AjaxResult copyKhOrderMessage(Long fId);

    /**
     * 导出清单
     * @param tWarehouseBills
     * @return
     */
    public AjaxResult exportInventory(TWarehouseBills tWarehouseBills);

    /**
     * 凯和若依端删除订单
     * @param tWarehouseBills
     * @param loginUser
     * @return
     */
    public AjaxResult deleteOrder(TWarehouseBills tWarehouseBills,LoginUser loginUser);

    /**
     * 批量更改订单的船名航次
     * @param fIds 订单ID
     * @param fVessel 船名
     * @param fVoyage 航次
     * @return
     */
    public AjaxResult batchModifyingVesselVoyage(Long[] fIds,Long fVessel,Long fVoyage,Long fCargoPlanning);
    /**
     * 凯和修改订单信息
     *
     * @param tWarehousebills 详情主表
     * @return 结果
     */
    public int updateKaHeOrder(TWarehouseBills tWarehousebills);
    /**
     * 凯和单航次配船
     * @param tWarehouseBills 主表
     * @return
     */
    public List<SingleVoyageByShipExcel> singleVoyageByShip(TWarehouseBills tWarehouseBills);
    /**
     * 单航次配船修改箱动态信息
     * @param tCntrno
     * @return
     */
    public AjaxResult updateBoxMessage(TCntrno tCntrno,LoginUser loginUser);
}
