package com.zfire.mall.manager.commonmapper.stock;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zfire.mall.manager.bean.k3.StockPositionStock;
import com.zfire.mall.manager.bean.pick.PickManagerBean;
import com.zfire.mall.manager.bean.ship.RetreatDocumentBean;
import com.zfire.mall.manager.bean.ship.RetreatDocumentDetail;
import com.zfire.mall.manager.bean.ship.ShipDocumentBean;
import com.zfire.mall.manager.bean.ship.ShipDocumentDetail;
import com.zfire.mall.manager.bean.stock.*;
import com.zfire.mall.manager.plus.entity.StockCustomer;
import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * @author chang
 */
@Mapper
public interface StockCommonMapper {


/*    @SqlParser(filter = true)
    IPage<StockBean> list(IPage page,
                          @Param("name") String name,
                          @Param("materialName")String materialName,
                          @Param("materialNumber")String materialNumber,
                          @Param("specification")String specification,
                          @Param("mainNumber")String mainNumber);*/

    @SqlParser(filter = true)
    Integer selectInvoiceCount( @Param("correspondId")String correspondId,
                                @Param("materialId")String materialId);

    @SqlParser(filter = true)
    IPage<StockBean> list(IPage page,
                          @Param("correspondId")List<String> correspondId,
                          @Param("stockId")String stockId,
                          @Param("categoryId")List<String> categoryId,
                          @Param("materialOldNumber")String materialOldNumber,
                          @Param("materialName")String materialName,
                          @Param("materialNumber")String materialNumber,
                          @Param("specification")String specification,
                          @Param("mainNumber")String mainNumber);


    @SqlParser(filter = true)
    Integer countAll( @Param("correspondId")String correspondId,
                      @Param("materialId")String materialId);

    Integer countReserved( @Param("correspondId")String correspondId,
                           @Param("materialId")String materialId);

    IPage<StockPositionStock> listStock(IPage page,
                                        @Param("name") String name,
                                        @Param("stockName")String stockName,
                                        @Param("adminUserId")String adminUserId,
                                        @Param("type")Integer type
                                        );

    Integer resverdNumber(@Param("correspondId")String correspondId,
                          @Param("materialId")String materialId,
                          @Param("orderId")String orderId,
                          @Param("customerId")String customerId);

    Integer resverdCustomerNumber(@Param("correspondId")String correspondId,
                          @Param("materialId")String materialId,
                          @Param("orderId")String orderId,
                          @Param("customerId")String customerId);

    Integer resverdCustomerNumberRe(@Param("correspondId")String correspondId,
                                  @Param("materialId")String materialId,
                                  @Param("orderId")String orderId,
                                  @Param("customerId")String customerId);

    Integer resverdAllStockNumber(@Param("correspondId")String correspondId,
                                  @Param("materialId")String materialId);


    Integer resverdAllStockNumberRE(@Param("correspondId")String correspondId,
                                  @Param("materialId")String materialId);

    Integer sumKingDeeNumber(@Param("correspondId")String correspondId,
                             @Param("materialId")String materialId);

    Integer stockHintUnit(@Param("correspondId")String correspondId,
                          @Param("materialId")String materialId,
                          @Param("startOfDay")Date startOfDay,
                          @Param("endOfDay")Date endOfDay);

    Integer stockHintTower(@Param("correspondId")String correspondId,
                           @Param("materialId")String materialId,
                           @Param("startTime")Date startOfDay,
                           @Param("endTime")Date endOfDay);

    IPage<StockBeanToDay> listStockToDay(IPage page,
                                         @Param("correspondId")List<String> correspondId,
                                         @Param("categoryId")List<String> categoryId,
                                         @Param("materialOldNumber")String materialOldNumber,
                                         @Param("materialName")String materialName,
                                         @Param("materialNumber")String materialNumber,
                                         @Param("specification")String specification,
                                         @Param("adminUserId")String adminUserId,
                                         @Param("categoryList")List<String> categoryList
    );

    List<StockBean> sumKingDeeNumberList(@Param("correspondId")List<String> correspondId);

    List<StockBean> sumKingDeeNumberAdequateList(@Param("correspondId")List<String>  correspondId);

    List<StockBean> selectInvoiceCountList(@Param("correspondId")List<String>  correspondId);

    List<StockBean> countAllList(@Param("correspondId")List<String>  correspondId);

    List<StockBean> countReservedList(@Param("correspondId")List<String>  correspondId);

    IPage<StockCustomerReserved> listCustomer(IPage page,
                                              @Param("categoryId")String categoryId,
                                              @Param("materialName")String materialName,
                                              @Param("materialNumber")String materialNumber,
                                              @Param("specification")String specification,
                                              @Param("customerName")String customerName,
                                              @Param("customerNumber")String customerNumber,
                                              @Param("customerId")String customerId);

    IPage<KingDeePurchaseStockOutBean> listPurchaseOrderOut(IPage page,
                                                            @Param("supplierName")String supplierName,
                                                            @Param("materialOldNumber")String materialOldNumber,
                                                            @Param("billNo")String billNo,
                                                            @Param("materialNumber")String materialNumber,
                                                            @Param("correspondId")List<String> correspondId,
                                                            @Param("specification")String specification,
                                                            @Param("materialName")String materialName,
                                                            @Param("startTime")String startTime,
                                                            @Param("endTime")String endTime);

    IPage<KingDeeOtherStockOutBean> listOtherStockOut(IPage page,
                                                     @Param("materialOldNumber")String materialOldNumber,
                                                     @Param("billNo")String billNo,
                                                     @Param("materialNumber")String materialNumber,
                                                     @Param("correspondId")List<String> correspondId,
                                                     @Param("specification")String specification,
                                                     @Param("materialName")String materialName,
                                                     @Param("startTime")String startTime,
                                                     @Param("endTime")String endTime);

    IPage<KingDeeOtherStockInBean> listOtherStockIn(IPage page,
                                                    @Param("materialOldNumber")String materialOldNumber,
                                                    @Param("billNo")String billNo,
                                                    @Param("materialNumber")String materialNumber,
                                                    @Param("correspondId")List<String> correspondId,
                                                    @Param("specification")String specification,
                                                    @Param("materialName")String materialName,
                                                    @Param("startTime")String startTime,
                                                    @Param("endTime")String endTime);

    /**
     * 产品现存表
     */
    @SqlParser(filter = true)
    IPage<StockBeanToDay> listStockToDayV2(Page page,@Param("ex") ZfireParamBean zfireParamBean, @Param("adminUserId")  String adminUserId);

    /**
     * 经销商现存表
     */
    @SqlParser(filter = true)
    IPage<StockBeanCustomerToDay> listStockToDayCustomerV2(Page page,@Param("ex")  ZfireParamBean zfireParamBean,@Param("adminUserId")  String adminUserId,@Param("categoryList")List<String> categoryList);

    /**
     * 采购退料单
     */
    @SqlParser(filter = true)
    IPage<KingDeePurchaseStockOutVO> listPurchaseOrderOutV2(Page page, @Param("ex")  ZfireParamBean zfireParamBean);


    /**
     * 其他入库单
     */
    @SqlParser(filter = true)
    IPage<KingDeeOtherStockOutVO> listOtherStockOutV2(Page page,@Param("ex")   ZfireParamBean zfireParamBean);


    /**
     * 其他入库单
     */
    @SqlParser(filter = true)
    IPage<KingDeeOtherStockInVO> listOtherStockInV2(Page page,@Param("ex") ZfireParamBean zfireParamBean);


    /**
     * 其他入库单
     */
    @SqlParser(filter = true)
    IPage<StockVO> listV2(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 经销商预留库存
     */
    @SqlParser(filter = true)
    IPage<StockCustomerReserved> listCustomerV2(Page page, @Param("ex")  ZfireParamBean zfireParamBean, String customerId);


    @SqlParser(filter = true)
    StockBean listOne(@Param("correspondId") List<String> strings, @Param("materialId") String materialId);

    @SqlParser(filter = true)
    IPage<StockBeanToCostPrice> listStockToCostPriceV2(Page page,@Param("ex")  ZfireParamBean zfireParamBean,@Param("adminUserId")  String adminUserId);
}
