import request from '@/utils/request'

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

// 工程下拉选
export function getProjectList(data) {
  return request({
    url: '/material/select/getMaterialProjectList',
    method: 'post',
    data: data,
  })
}
// 往来单位下拉选
export function getUnitList(data) {
  return request({
    url: '/material/select/getMaterialUnitList',
    method: 'post',
    data: data,
  })
}

// 分公司-下拉
export function getImpUnitNameListApi(data) {
  return request({
    url: '/material/select/getImpUnitNameList',
    method: 'get',
    params: data,
  })
}

// 往来单位下拉选,过滤掉班组
// 往来单位下拉选
export function getUnitListFilterTeam(data) {
  return request({
    url: '/material/select/getUnitListFilterTeam',
    method: 'post',
    data: data,
  })
}


// 协议
export function getAgreementInfoById(data) {
  return request({
    url: '/material/select/getAgreementInfoById',
    method: 'post',
    data: data,
  })
}

// 可退料设备类型-根据协议查询
export function getDeviceTreeByAgreementId(data) {
  return request({
    url: '/material/select/getUseTypeTree',
    method: 'post',
    data: data,
  })
}


// 退料新增
export function addBackApply(data) {
  return request({
    url: '/material/back_apply_info',
    method: 'post',
    data: data,
  })
}

// 退料--删除
export function backApplyRemove(data) {
  return request({
    url: '/material/back_apply_info/deleteById',
    method: 'post',
    data: data
  })
}

// 查询详情
export function getBackApplyInfo(id) {
  return request({
    url: '/material/back_apply_info/' + id,
    method: 'get'
  })
}

// 查询材料站退料详情
export function getBackApplyInfoClz(id) {
  return request({
    url: '/material/back_apply_info/clz/' + id,
    method: 'get'
  })
}

// 退料新增
export function editBackApply(data) {
  return request({
    url: '/material/back_apply_info/edit',
    method: 'post',
    data: data,
  })
}

// 退料提交
export function submitBackApply(data) {
  return request({
    url: '/material/back_apply_info/submitBackApply',
    method: 'post',
    data: data,
  })
}


//新增编辑-编码类型-获取所有编码
export function getMachineById(query) {
  return request({
    url: '/material/back_apply_info/getMachineById',
    method: 'get',
    params: query,
  })
}

// 更新打印状态
export function updatePrintStatus(id) {
  return request({
    url: '/material/back_apply_info/editPrint',
    method: 'post',
    data: {id: id},
  })
}


//退料查询
export function getBackQueryList(query) {
  return request({
    url: '/material/back_apply_info/getBackQueryList',
    method: 'get',
    params: query,
  })
}

export function getBackApplyQueryList(query) {
  return request({
    url: '/material/back_apply_info/queryList',
    method: 'get',
    params: query,
  })
}

