import request from '@/utils/request'

// 查询仓库列表
export function listWmswarehouse(query) {
  return request({
    url: '/wms/wmswarehouse/list',
    method: 'get',
    params: query
  })
}

// 查询仓库详细
export function getWmswarehouse(warehouseId) {
  return request({
    url: '/wms/wmswarehouse/' + warehouseId,
    method: 'get'
  })
}

// 新增仓库
export function addWmswarehouse(data) {
  return request({
    url: '/wms/wmswarehouse',
    method: 'post',
    data: data
  })
}

// 修改仓库
export function updateWmswarehouse(data) {
  return request({
    url: '/wms/wmswarehouse',
    method: 'put',
    data: data
  })
}

// 删除仓库
export function delWmswarehouse(warehouseId) {
  return request({
    url: '/wms/wmswarehouse/' + warehouseId,
    method: 'delete'
  })
}


// 查询仓库类别
export function getWarehouseCategories() {
  return request({
    url: '/wms/wmswarehouse/getWarehouseCategories',
    method: 'get'
  })
}


// 查询部门下拉树结构
export function getDeptTreeForWarehouse() {
  return request({
    url: '/system/hwcommon/getDeptTreeForWarehouse',
    method: 'get'
  })
}

// 查询物料信息列表
export function selectMaterialInfos4AllocationWarehouse(query) {
  return request({
    url: '/mes/materialinfo/selectMaterialInfos4AllocationWarehouse',
    method: 'get',
    params: query
  })
}

// 查询已配置物料信息列表
export function selectWmsWarehouseMaterialList(query) {
  return request({
    url: '/wms/wmswarehouse/selectWmsWarehouseMaterialList',
    method: 'get',
    params: query
  })
}


// 保存仓库分配的物料信息列表
export function allocateMaterials(data) {
  return request({
    url: '/wms/wmswarehouse/allocateMaterials',
    method: 'put',
    params: data
  })
}


// 删除仓库分配的物料信息列表
export function unallocateMaterials(data) {
  return request({
    url: '/wms/wmswarehouse/unallocateMaterials',
    method: 'post',
    params: data
  })
}
