import request from '@/utils/request';

//获取列表
export const getPutMeshWorkOrderByPage = (params) => {
  return request({
    url: '/aps/team_networking_task/ListPage',
    method: 'post',
    data: params,
    params: {
      pageNum: params.current,
      pageSize: params.size,
    },
  })
}
//获取列表
export const getPutMeshWorkOrderByList = async (data) => {
  const res = await request({
    url: '/aps/team_networking_task/ListPage',
    method: 'post',
    params: {
      pageNum: data.pageNum,
      pageSize: data.pageSize,
    },
    data: data,
  })
  if (res.data.code == 0) {
    return res.data.data;
  }
}
//组网任务表
export const getPutMeshWorkOrderByGwPage = (params) => {
  return request({
    url: '/aps/team_networking_task/ListGWPage',
    method: 'post',
    data: params,
    params: {
      pageNum: params.current,
      pageSize: params.size,
    },
  })
}
//组网排程表
export const ListPageBG = (params) => {
  return request({
    url: '/aps/team_networking_task/ListPageBG',
    method: 'post',
    data: params,
    params: {
      pageNum: params.current,
      pageSize: params.size,
    },
  })
}
//小车编组
export const ListEnter = (params) => {
  return request({
    url: '/aps/team_networking_task/ListEnter',
    method: 'post',
    data: params,
    params: {
      pageNum: params.current,
      pageSize: params.size,
    },
  })
}
// 入窑撤回
export const revokeWork = (params) => {
  return request.post('/aps/team_networking_task/revokeWork',params)
}
// 删除
export const deletePutMeshWorkOrder = (params) => {
  return request({
    url: '/api/blade-mes/putMes/deletePutMeshWorkOrder',
    method: 'post',
    params,
  })
}

// 导出
export const getScheduleWorkOrderExport = (params) => {
  return request({
    responseType: 'blob',
    url: '/api/blade-mes/scheduleWorkOrder/getScheduleWorkOrderExport',
    method: 'get',
    params,
  })
}

// 报工
export const putMesSubmit = (params) => {
  return request.post('/aps/team_networking_task/workTask',params)
}
// 撤回
export const workFallback = (params) => {
  return request.post('/aps/team_networking_task/workFallback',params)
}

// 下模
export const saddleMarginDie = (params) => {
  return request.post('/aps/team_networking_task/lowerMold',params)
}

// 报工
export const onekeyGetFambeState = (params) => {
  return request({
    url: '/aps/fam_be/List',
    method: 'post',
    data:params,
  })
}

// 判断/调整
export const saveCuttingWorkOrder = (data) => {
  return request({
    url: '/api/blade-mes/cuttingWorkOrder/saveCuttingWorkOrder',
    method: 'post',
    data,
  })
}

export const getOnekeyWorkReportByPage = (params) => {
  return request({
    url: '/aps/team_networking_task/ListAJPage',
    method: 'post',
    data: params,
    // params,
  })
}

export const getCuttingIntoKiln = (params) => {
  return request({
    url: '/api/blade-mes/onekey/getCuttingIntoKiln',
    method: 'post',
    data: params,
  })
}

export const ToOnekeyFambe = (data) => {
  return request({
    url: '/aps/team_networking_task/enterKiln',
    method: 'post',
    data,
  })
}

// 报废接口
export const onekeyScrap = (params) => {
  return request({
    url: '/aps/team_networking_task/cuttingWork',
    method: 'post',
    data:params,
  })
}

// 编辑界面接口
export const getFambeByPage = (params) => {
  return request({
    url: '/aps/team_networking_task/queryKiln/'+params.id,
    method: 'get',
  })
}
// 编辑接口
export const saveFambeWorkOrder = (data) => {
  return request({
    url: 'aps/team_networking_task/turnReach',
    method: 'post',
    data,
  })
}

// 编辑接口
export const ealingKiln = (data) => {
  return request({
    url: '/aps/team_networking_task/sealingKiln',
    method: 'post',
    data,
  })
}

// 编辑要移入进的窑列表
export const getFambeNo = (params) => {
  return request({
    url: '/api/blade-mes/onekey/getFambeNo',
    method: 'post',
    params,
  })
}

// 查询釜号状态
export const getFambeKettle = (params) => {
  return request({
    url: '/api/blade-mes/onekey/getFambeKettle',
    method: 'post',
    params,
  })
}

// 一键入釜
export const ToOnekeyKettle = (data) => {
  return request({
    url: '/aps/team_networking_task/enterKettle',
    method: 'post',
    data,
  })
}

// 获取“预计剩余蒸养时间”
export const oneKeyGetTime = (data) => {
  let fd = new FormData()
  fd.append('cateName', data)
  return request({
    url: '/api/blade-base/productCate/getTime',
    method: 'post',
    data: fd,
  })
}

// 查询质检号状态
export const getFambeQuality = (params) => {
  return request({
    url: '/api/blade-mes/onekey/getFambeQuality',
    method: 'post',
    params,
  })
}

//  一键出釜
export const ToOnekeyQuality = (params) => {
  return request({
    url: '/api/blade-mes/onekey/ToOnekeyQuality',
    method: 'post',
    params,
  })
}
// 获取质检弹窗表格1数据
export const queryKilnXCH = (id) => {
  return request({
    url: '/aps/team_networking_task/queryKilnXCH/'+id,
    method: 'get',
  })
}
// 获取质检弹窗表格1数据
export const getQualityDetails = (id) => {
  return request({
    url: '/aps/quality_details_work_order/listFBN/'+id,
    method: 'get',
  })
}
// 获取质检弹窗表格2数据
export const getQualityDetails2 = id => {
  return request({
    url: '/aps/quality_details_work_order/list/'+id,
    method: 'get',
  
  })
}

// 获取质检弹窗 - 入库仓库下拉选项列表
export const getDepotList = (data) => {
  return request({
    url: '/api/blade-base/depot/list',
    method: 'post',
    data: data,
  })
}

// 质检弹窗 - 暂存/提交
export const qualitySubmits = (data, type, fambeNo, newFambeNo) => {
  return request({
    url: '/aps/quality_details_work_order/add',
    method: 'post',
    data,
  })
}
//转道
export const qualityTestingTurnReach = (data) => {
  return request({
    url: '/aps/team_networking_task/qualityTestingTurnReach',
    method: 'post',
    data,
  })
}
//提交1
export const enterWarehouse = (data) => {
  return request({
    url: '/aps/team_networking_task/enterWarehouse',
    method: 'post',
    data,
  })
}
//提交2
export const qualityEnterWarehouse = (data) => {
  return request({
    url: '/aps/quality_details_work_order/enterWarehouse',
    method: 'post',
    data,
  })
}
//窑状态
export const relieveKiln = (data) => {
  return request({
    url: '/aps/team_networking_task/relieveKiln',
    method: 'post',
    data,
  })
}

// 获取质检统计数据
export const queryCount = (params) => {
  return request({
    url: '/aps/quality_details_work_order/queryCount/'+params,
    method: 'get',
  })
}


// 获取浇注数据
export const getPouring = (params) => {
  return request({
    url: '/api/blade-rcm/pl/getTeamGroup',
    method: 'post',
    params,
  })
}

// 查询转道号
export const getFambeChange = (params) => {
  return request({
    url: '/api/blade-mes/onekey/getFambeChange',
    method: 'post',
    params,
  })
}

// 查询可转的道号
export const getNewFambeNo = (params) => {
  return request({
    url: '/api/blade-mes/onekey/getNewFambeNo',
    method: 'post',
    params,
  })
}

// 切割任务表 - 终止操作
export const onekeyStop = (params) => {
  return request({
    url: '/api/blade-mes/onekey/rest',
    method: 'post',
    params,
  })
}
//不合格特征维护列表
export const selectFailTraitPage = (params,data) => {
  return request({
    url: '/api/blade-quality/failTrait/selectFailTraitPage',
    method: 'post',
    params,
    data
  })
}
export const getAutoclaveBITwo = () => {
  return request({
      url: '/api/blade-rcm/autoclave/getBITwo',
      method: 'get',
  })
}
//w温湿度BI近七天
export const getThermometerBITwo = () => {
  return request({
      url: '/api/blade-rcm/thermometer/getBITwo',
      method: 'get',
  })
}
