import request from '@/utils/request'

// 查询检验规则维护列表
export function listCheckrule(query) {
  return request({
    url: '/qms/checkrule/list',
    method: 'get',
    params: query
  })
}

// 查询检验规则维护详细
export function getCheckrule(checkRuleId) {
  return request({
    url: '/qms/checkrule/' + checkRuleId,
    method: 'get'
  })
}

// 新增检验规则维护
export function addCheckrule(data) {
  return request({
    url: '/qms/checkrule',
    method: 'post',
    data: data
  })
}

// 修改检验规则维护
export function updateCheckrule(data) {
  return request({
    url: '/qms/checkrule',
    method: 'put',
    data: data
  })
}

// 删除检验规则维护
export function delCheckrule(checkRuleId) {
  return request({
    url: '/qms/checkrule/' + checkRuleId,
    method: 'delete'
  })
}

// 查询检验项目
export function getCheckProjects() {
  return request({
    url: '/qms/checkrule/getCheckProjects',
    method: 'get'
  })
}





// 查询检验规则未配置物料信息列表
export function selectMaterialInfos4AllocateCheckRule(query) {
  return request({
    url: '/qms/checkrule/selectMaterialInfos4AllocateCheckRule',
    method: 'get',
    params: query
  })
}

// 查询已选择规则明细(物料)
export function selectCheckRuleDetailList(query) {
  return request({
    url: '/qms/checkrule/selectCheckRuleDetailList',
    method: 'get',
    params: query
  })
}

// 配置检验规则明细（物料）
export function allocateCheckRuleDetails(data) {
  return request({
    url: '/qms/checkrule/allocateCheckRuleDetails',
    method: 'put',
    data: data
  })
}

// 删除检验规则配置的物料信息
export function unallocateCheckRuleDetails(data) {
  return request({
    url: '/qms/checkrule/unallocateCheckRuleDetails',
    method: 'post',
    data: data
  })
}
