import request from '@/utils/request'

// 查询库存单据列表
export function listBill(data) {
  return request({
    url: '/wisdom/bill/list',
    method: 'POST',
    data: data
  })
}

// 新增库存单据
export function addBill(data) {
  return request({
    url: '/wisdom/bill/add',
    method: 'post',
    data: data
  })
}

// 修改库存单据
export function updateBill(data) {
  return request({
    url: '/wisdom/bill/update',
    method: 'post',
    data: data
  })
}

// 查询库存单据明细列表
export function listStock(id) {
  return request({
    url: '/wisdom/record/listByBillNo/' + id,
    method: 'get'
  })
}

// 添加单条库存单据
export function appendBill(data) {
  return request({
    url: '/wisdom/bill/append',
    method: 'post',
    data: data
  })
}

// 删除库存单据
export function delBill(data) {
  return request({
    url: '/wisdom/bill/delete',
    method: 'delete',
    data: data
  })
}

// 移库
export function moveRecord(data) {
  return request({
    url: '/inventory/move/add',
    method: 'post',
    data: data
  })
}

// 修改库存单据明细内容
export function updateRecord(data) {
  return request({
    url: '/wisdom/record/update',
    method: 'post',
    data: data
  })
}

// 撤销入库
export function backoutRecord(data) {
  return request({
    url: '/wisdom/record/rollback',
    method: 'post',
    data: data
  })
}

// 一键入库
export function recordFinish(data) {
  return request({
    url: '/wisdom/record/finish',
    method: 'post',
    data: data
  })
}

// 一键删除预入库
export function recordRemove(data) {
  return request({
    url: '/wisdom/record/delete',
    method: 'delete',
    data: data
  })
}


























// 删除库存单据
// export function delBill(id) {
//   return request({
//     url: '/wisdom/bill/' + id,
//     method: 'delete'
//   })
// }

// 查询库存单据详细
// export function getBill(id) {
//   return request({
//     url: '/wisdom/bill/' + id,
//     method: 'get'
//   })
// }

// 查询库存单据明细详细
export function getStock(id) {
  return request({
    url: '/wisdom/stock/' + id,
    method: 'get'
  })
}

// 新增库存单据明细
export function addStock(data) {
  return request({
    url: '/wisdom/stock',
    method: 'post',
    data: data
  })
}

// 修改库存单据明细
export function updateStock(data) {
  return request({
    url: '/wisdom/stock',
    method: 'put',
    data: data
  })
}

// 删除库存单据明细
export function delStock(id) {
  return request({
    url: '/wisdom/stock/' + id,
    method: 'delete'
  })
}
