import request from '@/utils/request'

export function getWarehouseList(query) {
  return request({
    url: '/inm/warehouse/',
    method: 'get',
    params: query
  })
}
export function createWarehouse(data) {
  return request({
    url: '/inm/warehouse/',
    method: 'post',
    data
  })
}
export function updateWarehouse(id, data) {
  return request({
    url: `/inm/warehouse/${id}/`,
    method: 'put',
    data
  })
}
export function deleteWarehouse(id, data) {
  return request({
    url: `/inm/warehouse/${id}/`,
    method: 'delete',
    data
  })
}
//物料
export function getInventoryList(query) {
  return request({
    url: '/inm/inventory/',
    method: 'get',
    params: query
  })
}
export function createInventory(data) {
  return request({
    url: '/inm/fifo/in_pur/',
    method: 'post',
    data
  })
}
//仓库对应的物料
export function getfifodetailList(query) {
  return request({
    url: '/inm/fifoitem/',
    method: 'get',
    params: query
  })
}

//出入库记录
export function getfifoList(query) {
  return request({
    url: '/inm/fifo/',
    method: 'get',
    params: query
  })
}
//出入库记录删除
export function deleteFifoitem(id, data) {
  return request({
    url: `/inm/fifoitem/${id}/`,
    method: 'delete',
    data
  })
}

//物料批次
export function getmaterialbatchList(query) {
  return request({
    url: '/inm/materialbatch/',
    method: 'get',
    params: query
  })
}


//库存审核
export function audit(id, data) {
  return request({
    url: `/inm/fifo/${id}/audit/`,
    method: 'post',
    data
  })
}
//出入库检测
export function createTestrecord(data) {
  return request({
    url: '/inm/fifoitem/test/',
    method: 'post',
    data
  })
}

//半成品库存
export function getiproductList(query) {
  return request({
    url: '/inm/iproduct/',
    method: 'get',
    params: query
  })
}

//军检
//军检
export function saleMtest(id, data) {
  return request({
    url: `/inm/iproduct/${id}/mtest/`,
    method: 'POST',
    data
  })
}