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.listV2.dto.InvoiceProjectDTO;
import com.zfire.mall.manager.bean.pick.PickManagerBean;
import com.zfire.mall.manager.bean.reserved.*;
import com.zfire.mall.manager.bean.reserved.ReservedOrderBean;
import com.zfire.mall.manager.bean.ship.*;
import com.zfire.mall.manager.plus.entity.DisplaceOrderItem;
import com.zfire.mall.manager.plus.entity.EnginOrderItem;
import com.zfire.mall.manager.plus.entity.RetailOrder;
import com.zfire.mall.manager.plus.entity.RetailOrderItem;
import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

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


    @SqlParser(filter = true)
    IPage<ReservedBean> list(IPage page,
                             @Param("createBy") String createBy,
                             @Param("updateBy") String updateBy,
                             @Param("id") String id,
                             @Param("status") Integer status,
                             @Param("correspondId") String correspondId,
                             @Param("customerName")String customerName,
                             @Param("orderId")String orderId,
                             @Param("specification")String specification,
                             @Param("startTime")String startTime,
                             @Param("endTime")String endTime,
                             @Param("customerNumber")String customerNumber,
                             @Param("materialCode")String materialCode,
                             @Param("materialName")String materialName,
                             @Param("customerId") String customerId,
                             @Param("adminUserId") String adminUserId);

    @SqlParser(filter = true)
    ReservedDetail detail(String id);

    @SqlParser(filter = true)
    IPage<ReservedOrderBean> listOrder(IPage page,
                                       @Param("materialOldNumber")String materialOldNumber,
                                       @Param("customerName")String customerName,
                                       @Param("orderId")String orderId,
                                       @Param("specification")String specification,
                                       @Param("mainName")String mainName,
                                       @Param("orderType")String orderType,
                                       @Param("customerNumber")String customerNumber,
                                       @Param("materialCode")String materialCode,
                                       @Param("materialName")String materialName,
                                       @Param("customerId") String customerId,
                                       @Param("serviceIds") List<String> serviceIds,
                                       @Param("k3CategoryIds") List<String> k3CategoryIds);


    List<RetailOrderItem> getAutomaticRetailOrder(Date number);

    List<DisplaceOrderItem> getDisplaceOrder(Date number);

    List<EnginOrderItem> getEnginOrderItem(Date number);

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

    List<StockPositionStock> listStockPosition(String customerId);

    List<ReservedOrderBean> listOrderReserved(@Param("today") Date today,
                                              @Param("type") List<String> type);

    @SqlParser(filter = true)
    IPage<ReservedBeanVO> listV2(Page page, @Param("ex") ZfireParamBean zfireParamBean, @Param("customerId")String customerId);

    @SqlParser(filter = true)
    Integer listCountV2(@Param("ex") ZfireParamBean zfireParamBean, @Param("customerId")String customerId);

    @SqlParser(filter = true)
    Integer listOrderCount(
                           @Param("materialOldNumber")String materialOldNumber,
                           @Param("customerName")String customerName,
                           @Param("orderId")String orderId,
                           @Param("specification")String specification,
                           @Param("mainName")String mainName,
                           @Param("orderType")String orderType,
                           @Param("customerNumber")String customerNumber,
                           @Param("materialCode")String materialCode,
                           @Param("materialName")String materialName,
                           @Param("customerId") String customerId,
                           @Param("serviceIds") List<String> serviceIds,
                           @Param("k3CategoryIds") List<String> k3CategoryIds);
}
