import request from '@/utils/request'

// 创建出库单
export function createOutbound(data) {
  return request({
    url: '/flow/outbound/create',
    method: 'post',
    data: data
  })
}

// 更新出库单
export function updateOutbound(data) {
  return request({
    url: '/flow/outbound/update',
    method: 'put',
    data: data
  })
}

// 删除出库单
export function deleteOutbound(id) {
  return request({
    url: '/flow/outbound/delete?id=' + id,
    method: 'delete'
  })
}

// 获得出库单
export function getOutbound(id) {
  return request({
    url: '/flow/outbound/get?id=' + id,
    method: 'get'
  })
}

// 获得出库单分页
export function getOutboundPage(query) {
  return request({
    url: '/flow/outbound/page',
    method: 'get',
    params: query
  })
}

// 导出出库单 Excel
export function exportOutboundExcel(query) {
  return request({
    url: '/flow/outbound/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 上链
export function outboundUpChain(id) {
  return request({
    url: '/flow/outbound/upChain?id='+id,
    method: 'put',
  })
}

// 冻结
export function outboundFreeze(id) {
  return request({
    url: '/flow/outbound/freeze?id='+id,
    method: 'put',
  })
}

// 激活
export function outboundActive(id) {
  return request({
    url: '/flow/outbound/active?id='+id,
    method: 'put',
  })
}

