package cn.estsh.i3plus.ext.mes.api.busi;

import cn.estsh.i3plus.ext.mes.pojo.bean.*;
import cn.estsh.i3plus.ext.mes.pojo.model.*;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import io.swagger.annotations.ApiOperation;

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

/**
 * @Author: wangjie
 * @CreateDate: 2021/01/19 15:06 下午
 * @Description: 报表
 **/
public interface ISxReportFormService {

    /**
     * 条码履历报表
     * @param produceSnTravelExt 查询条件
     * @param pager 分页条件
     * @return 条码履历分页集合
     */
    @ApiOperation(value = "条码履历报表", notes = "条码履历报表")
    ListPager<MesProduceSnTravelExt> queryProduceSnTravelExtByPager(MesProduceSnTravelExt produceSnTravelExt, Pager pager);

    /**
     * 正常工单包装条码查询报表
     * @param model 查询条件
     * @param pager 分页条件
     * @return  正常工单包装条码分页集合
     */
    @ApiOperation(value = "正常工单包装条码查询报表", notes = "正常工单包装条码查询报表")
    ListPager<SxPackSnReportModel> queryStandardWorkOrderPackSnPager(SxPackSnReportModel model, Pager pager);

    /**
     * 返工工单包装条码查询报表
     * @param model 查询条件
     * @param pager 分页条件
     * @return  返工工单包装条码分页集合
     */
    @ApiOperation(value = "返工工单包装条码查询报表", notes = "返工工单包装条码查询报表")
    ListPager<SxPackSnReportModel> queryRepairWorkOrderPackSnPager(SxPackSnReportModel model, Pager pager);

    /**
     * 正常工单条码
     * @param model 查询条件
     * @param pager 分页条件
     * @return 正常工单条码分页集合
     */
    @ApiOperation(value = "正常工单条码", notes = "正常工单条码")
    ListPager<ProduceSnExtModel> queryStandardWorkOrderSnPager(ProduceSnExtModel model, Pager pager);

    /**
     * 返工工单条码
     * @param model 查询条件
     * @param pager 分页条件
     * @return 返工工单条码分页集合
     */
    @ApiOperation(value = "返工工单条码", notes = "返工工单条码")
    ListPager<ProduceSnRepairModel> queryRepairWorkOrderSnPager(ProduceSnRepairModel model, Pager pager);

    /**
     * 非作业时间明细
     *
     * @param model 查询条件
     * @param pager 分页条件
     * @return 非作业时间明细分页信息
     */
    @ApiOperation(value = "非作业时间明细", notes = "非作业时间明细")
    ListPager<UnWorkTimeDetailModel> queryUnWorkTimeDetailPager(UnWorkTimeDetailModel model, Pager pager);

    /**
     * 非作业时间汇总
     *
     * @param model 查询条件
     * @return 非作业时间汇总信息
     */
    @ApiOperation(value = "非作业时间汇总", notes = "非作业时间汇总")
    List<UnWorkTimeStatisticsModel> queryUnWorkTimeStatistics(UnWorkTimeStatisticsModel model);

    /**
     * 作业时间月绩
     *
     * @param model 查询条件
     * @return 作业时间月绩信息
     */
    @ApiOperation(value = "作业时间月绩", notes = "作业时间月绩")
    List<UnWorkTimeStatisticsModel> queryWorkTimeMonthlyPerformance(UnWorkTimeStatisticsModel model);

    /**
     * 非作业时间类别统计
     *
     * @param model 查询条件
     * @return 非作业时间类别统计信息
     */
    @ApiOperation(value = "非作业时间类别统计", notes = "非作业时间类别统计")
    List<UnWorkTimeStatisticsModel> queryUnWorkTimeCategoryStatistics(UnWorkTimeStatisticsModel model);

    /**
     * 达成率一览表
     *
     * @param model 查询条件
     * @return 达成率一览表数据
     */
    @ApiOperation(value = "达成率一览表", notes = "达成率一览表")
    List<CompleteRateChartModel> queryAttainmentRateChart(CompleteRateChartModel model);

    /**
     * 完结率一览表
     *
     * @param model 查询条件
     * @return 完结率一览表数据
     */
    @ApiOperation(value = "完结率一览表", notes = "完结率一览表")
    List<CompleteRateChartModel> queryCompleteRateChart(CompleteRateChartModel model);

    /**
     * @param replacementTravel
     * @param pager
     * @return {@link ListPager<MesReplacementTravel>}
     */
    @ApiOperation("换件作业报表")
    ListPager<MesReplacementTravel> queryReplacementTravel(MesReplacementTravel replacementTravel, Pager pager);

    /**
     * @param pager
     * @return {@link ListPager<MesRepairTask>}
     */
    @ApiOperation("维修记录报表")
    ListPager<MesRepairRecordExt> queryRepairTask(MesRepairRecordExt repairRecordExt, Pager pager);

    /**
     * @param jobBooking
     * @param pager
     * @return {@link ListPager<MesContainerJobBooking>}
     */
    @ApiOperation("数据录入报表")
    ListPager<MesContainerJobBooking> queryJobBooking(MesContainerJobBooking jobBooking, Pager pager);

    /**
     * 计算百分比,保留2位小数
     * @param d1 被除数
     * @param d2 除数
     * @return 百分比
     */
    @ApiOperation(value = "计算百分比,保留2位小数", notes = "计算百分比,保留2位小数")
    String getRateDecimalTwo(Double d1, Double d2);

    /**
     *
     * @param modelList
     * @param model
     */
    void packUnWorkTimeStatisticsWorkTime(List<UnWorkTimeStatisticsModel> modelList, UnWorkTimeStatisticsModel model);

    Map<String, List<UnWorkTimeStatisticsModel>> packUnWorkTimeStatisticsMap(List<UnWorkTimeStatisticsModel> modelList, Integer dimension);

    void packWorkTimeStatisticsResult(UnWorkTimeStatisticsModel result, String[] keyArr, Integer dimension, UnWorkTimeStatisticsModel model);

    Double getTotalServiceTime(List<UnWorkTimeStatisticsModel> modelList);

    Double getTotalUnWorkTime(List<UnWorkTimeStatisticsModel> modelList, Integer prodType);

    Double getTotalStandardWorkTime(Map<String, List<UnWorkTimeStatisticsModel>> outPutStatisticsMap, String key);

    Double getLoseWorkTime(Double totalWorkTime, Double totalStandardWorkTime);

    List<UnWorkTimeStatisticsModel> sortWorkTimeStatisticsResult(List<UnWorkTimeStatisticsModel> resultList, Integer dimension);

}
