import request from '@/utils/request'

//领料申请-列表
export function getListLeaseApply(query) {
  return request({
    url: '/material/lease_apply_info/list',
    method: 'get',
    params: query,
  })
}

// 领料申请-新增
export function addApplyInfo(data) {
  return request({
    url: '/material/lease_apply_info',
    method: 'post',
    data: data,
  })
}

// 领料申请-编辑
export function updateApplyInfo(data) {
  return request({
    url: '/material/lease_apply_info',
    method: 'put',
    data: data,
  })
}

// 领料申请-详情信息
export function getApplyInfo(id,query) {
  return request({
    url: '/material/lease_apply_info/' + id,
    method: 'get',
    params: query
  })
}

// 领料站领料单-详情信息
export function getClzApplyInfo(id,query) {
  return request({
    url: '/material/lease_apply_info/getClz/' + id,
    method: 'get',
    params: query
  })
}

// 领料申请租赁单位下拉框
export function getListUnite(data) {
  return request({
    url: '/material/select/getMaterialUnitList',
    method: 'post',
    data: data,
  })
}
//领料申请租赁单位下拉框
export function getAgreementUnitListApi(data) {
  return request({
    url: '/material/select/getAgreementUnitList',
    method: 'post',
    data: data,
  })
}

// 项目部-下拉
export function getListDepartApi(data) {
  return request({
    url: '/material/select/getDepartList',
    method: 'post',
    data: data,
  })
}

// 单位-下拉
export function getMaterialUnitListApi(data) {
  return request({
    url: '/material/select/getMaterialUnitList',
    method: 'post',
    data: data,
  })
}

// 领料申请租赁单位下拉框
export function getUnitProDepList(data) {
  return request({
    url: '/material/select/getUnitProDepList',
    method: 'post',
    data: data,
  })
}

export function getUnitListLeaseApi(data) {
  return request({
    url: '/material/select/getUnitListLease',
    method: 'post',
    data
  })
}

// 班组领料人-下拉
export function getListLeasePersonApi(data) {
  return request({
    url: '/material/select/getUnitListLeasePerson',
    method: 'post',
    data
  })
}


// 领料申请-获取库存信息
export function getPendingOutNumByTypeId(typeId) {
  return request({
    url: '/material/leaseTask/getPendingOutNumByTypeId/' + typeId,
    method: 'get',
  })
}

// 领料申请租赁工程下拉框
export function getListProject(data) {
  return request({
    url: '/material/select/getMaterialProjectList',
    method: 'post',
    data: data,
  })
}

// 工程下拉
export function getMaterialProjectListApi(data) {
  return request({
    url: '/material/select/getMaterialProjectList',
    method: 'post',
    data: data,
  })
}

// 领用申请工程下拉
export function getLeaseProjectListApi(data) {
  return request({
    url: '/material/select/getLeaseProjectList',
    method: 'post',
    data,
  })
}

// 领料申请获取协议单id
export function getAgreement(data) {
  return request({
    url: '/material/select/getAgreementInfoById',
    method: 'post',
    data: data,
  })
}

// 领料申请-删除
export function applyRemove(ids) {
  return request({
    url: '/material/lease_apply_info/' + ids,
    method: 'delete',
  })
}

// 领料申请-发布
export function applySend(data) {
  return request({
    url: '/material/lease_apply_info/publish',
    method: 'post',
    data: data,
  })
}

// 领用申请发布-终止
export function applyEnd(data) {
  return request({
    url: '/material/leaseTask/endPublish',
    method: 'post',
    data: data,
  })
}

// 领料申请-批量发布
export function applySendAll(data) {
  return request({
    url: '/material/lease_apply_info/publishBatch',
    method: 'post',
    data: data,
  })
}

//新购到货-二级列表详情
export function getPurchaseCheckInfo(query) {
  return request({
    url: '/material/purchase_check_info/getInfo',
    method: 'get',
    params: query,
  })
}

// 新购到货-新增
export function addPurchaseCheckInfo(data) {
  return request({
    url: '/material/purchase_check_info',
    method: 'post',
    data: data,
  })
}

// 新购到货-编辑
export function updatePurchaseCheckInfo(data) {
  return request({
    url: '/material/purchase_check_info',
    method: 'put',
    data: data,
  })
}

// 新购到货--删除
export function purchaseCheckInfoRemove(ids) {
  return request({
    url: '/material/purchase_check_info/' + ids,
    method: 'post',
  })
}



// 上传报告附件
export function uploadPurchaseFile(data) {
  return request({
    url: '/material/bm_file_info',
    method: 'post',
    data: data
  })
}


// 出库检验单-详情信息
export function getCheckInfo(data) {
  return request({
    url: '/material/lease_apply_info/getInfo',
    method: 'get',
    params: data
  })
}


export function getProjectList(data) {
  return request({
    url: '/material/material_maMachine/getProjectList',
    method: 'get',
    params: data,
  })
}

export function getDepartNameList(data) {
  return request({
    url: '/material/material_maMachine/getDepartNameList',
    method: 'get',
    params: data,
  })
}

//领料查询-列表
export function getListLeaseQuery(query) {
  return request({
    url: '/material/lease_apply_info/queryList',
    method: 'get',
    params: query,
  })
}
