import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HourlyOutputByHourVO } from '@/api/mes/prodReport/types';


/**
 * 生产计划完成率报表
 */
export const listPlanCompletionRateReport = (query): AxiosPromise<[]> => {
  return request({
    url: '/mes/prodReport/planCompletionRateReport',
    method: 'get',
    params: query
  });
};

/**
 * 生产计划完成率对比报表
 */
export const listPlanCompletionContrastReport = (query): AxiosPromise<[]> => {
  return request({
    url: '/mes/prodReport/planCompletionContrastReport',
    method: 'get',
    params: query
  });
};

// 大屏设计-生产计划完成率
export const designPlanCompletionRate = (query): AxiosPromise<[]> => {
  return request({
    url: '/mes/prodReport/designPlanCompletionRate',
    method: 'get',
    params: query
  });
};

// 大屏设计-日产量信息
export const designDailyOutputInformation = (query): AxiosPromise<[]> => {
  return request({
    url: '/mes/prodReport/designDailyOutputInformation',
    method: 'get',
    params: query
  });
};

/**
 * 报工工时数据报表（分页）
 */
export const listWorkHourReport = (query): AxiosPromise<[]> => {
  return request({
    url: '/mes/prodReport/workHourReport',
    method: 'get',
    params: query
  });
};

/**
 * 报工工时数据报表（导出）
 */
export const exportWorkHourReport = (query) => {
  return request({
    url: '/mes/prodReport/workHourReport/export',
    method: 'post',
    params: query,
    responseType: 'blob'
  });
};

/**
 * 班组作业情况报表（分页）
 */
export const listTeamWorkReport = (query): AxiosPromise<[]> => {
  return request({
    url: '/mes/prodReport/teamWorkReport',
    method: 'get',
    params: query
  });
};

/**
 * 班组作业情况报表（导出）
 */
export const exportTeamWorkReport = (query) => {
  return request({
    url: '/mes/prodReport/teamWorkReport/export',
    method: 'post',
    params: query,
    responseType: 'blob'
  });
};

/**
 * 在制品跟踪报表（分页）
 */
export const listWipTrackingReport = (query): AxiosPromise<[]> => {
  return request({
    url: '/mes/prodReport/wipTrackingReport',
    method: 'get',
    params: query
  });
};

/**
 * 在制品跟踪报表（导出）
 */
export const exportWipTrackingReport = (query) => {
  return request({
    url: '/mes/prodReport/wipTrackingReport/export',
    method: 'post',
    params: query,
    responseType: 'blob'
  });
};

/**
 * 设备产量统计报表
 */
export const yieldSummaryByMachine = (query): AxiosPromise<[]> => {
  return request({
    url: '/mes/prodReport/yieldSummaryByMachine',
    method: 'get',
    params: query
  });
};


/**
 * 设备产量统计报表
 */
export const yieldTrendByDate = (query): AxiosPromise<[]> => {
  return request({
    url: '/mes/prodReport/yieldTrendByDate',
    method: 'get',
    params: query
  });
};

/**
 * 小时产量统计（按结束时间小时分桶）
 */
export const hourlyOutputByHour = (query): AxiosPromise<HourlyOutputByHourVO[]> => {
  return request({
    url: '/mes/prodReport/hourlyOutputByHour',
    method: 'get',
    params: query
  });
};

/**
 * 小时产量统计导出
 */
export const exportHourlyOutputByHour = (query) => {
  return request({
    url: '/mes/prodReport/hourlyOutputByHour/export',
    method: 'post',
    params: query,
    responseType: 'blob'
  });
};
