import request from '@/utils/request'
import { downFile } from '@/utils/request'

/**
* 质检管理/质检记录表分页查询
* @param {查询条件} data
*/
export function listQaInspectRecord(query) {
  return request({
    url: 'business/QaInspectRecord/list',
    method: 'get',
    params: query,
  })
}
export function reportQaInspectRecord(query) {
  return request({
    url: 'business/QaInspectRecord/report',
    method: 'get',
    params: query,
  })
}
//获取合格率
export function GetPercentOfPass(query) {
  return request({
    url: 'business/QaInspectRecord/PercentOfPass',
    method: 'get',
    params: query,
  })
}
//查询质检完成，未完成入库的交验单号
export function QueryCheckedSapDeliverData(query) {
  return request({
    url: 'business/QaInspectRecord/QueryCheckedSapDeliverData',
    method: 'post',
    data: query,
  })
}
//根据交验单号 查询已质检完成的交验单明细
export function QueryCheckedSapDeliverDtlData(query) {
  return request({
    url: 'business/QaInspectRecord/QueryCheckedSapDeliverDtlData',
    method: 'post',
    params: query
  })
}
//添加质检记录，并更新对应的交验单明细
export function AddSapDeliverDtlInspectResult(data) {
  return request({
    url: 'business/QaInspectRecord/AddSapDeliverDtlInspectResult',
    method: 'post',
    data: data,
  })
}
/**
* 新增质检管理/质检记录表
* @param data
*/
export function addQaInspectRecord(data) {
  return request({
    url: 'business/QaInspectRecord',
    method: 'post',
    data: data,
  })
}

/**
* 修改质检管理/质检记录表
* @param data
*/
export function updateQaInspectRecord(data) {
  return request({
    url: 'business/QaInspectRecord',
    method: 'PUT',
    data: data,
  })
}

/**
* 获取质检管理/质检记录表详情
* @param {Id}
*/
export function getQaInspectRecord(id) {
  return request({
    url: 'business/QaInspectRecord/' + id,
    method: 'get'
  })
}

/**
* 删除质检管理/质检记录表
* @param {主键} pid
*/
export function delQaInspectRecord(pid) {
  return request({
    url: 'business/QaInspectRecord/' + pid,
    method: 'delete'
  })
}

// 清空质检管理/质检记录表
export function clearQaInspectRecord() {
  return request({
    url: 'business/QaInspectRecord/clean',
    method: 'delete'
  })
}

// 导出质检管理/质检记录表
export async function exportQaInspectRecord(query) {
  await downFile('business/QaInspectRecord/export', { ...query })
}

