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

// 查询物料管理-物料清单列表
export function listWarehouse(query) {
  return request({
    url: '/tongzhou/warehouse/warehouse/list',
    method: 'get',
    params: query
  })
}

// 查询物料管理-物料清单详细
export function getWarehouse(id) {
  return request({
    url: '/tongzhou/warehouse/warehouse/' + id,
    method: 'get'
  })
}

// 新增物料管理-物料清单
export function addWarehouse(data) {
  return request({
    url: '/tongzhou/warehouse/warehouse',
    method: 'post',
    data: data
  })
}

// 修改物料管理-物料清单
export function updateWarehouse(data) {
  return request({
    url: '/tongzhou/warehouse/warehouse',
    method: 'put',
    data: data
  })
}

// 删除物料管理-物料清单
export function delWarehouse(id) {
  return request({
    url: '/tongzhou/warehouse/warehouse/' + id,
    method: 'delete'
  })
}

// 导出物料管理-物料清单
export function downloadWarehouse(data) {
  download(
      '/tongzhou/warehouse/warehouse/export',
      data,
      `warehouse_${new Date().getTime()}.xlsx`)
}
