import request from "@/utils/request";

/**
 * 根据当前用户所拥有的数据权限
 *    查询库位列表数据
 */
export function getStorageList(query) {
  return request({
    url: "/system/storage/getStorageList",
    method: "get",
    params: query,
  });
}

/**
 * 根据当前用户所拥有的数据权限
 *    查询库位列表数据
 */
export function getStorageAreaList(query) {
  return request({
    url: "/system/location/getStorageAreaList",
    method: "get",
    params: query,
  });
}

// 查询库位列表数据
export function listPosition(query) {
  return request({
    url: "/system/location/list",
    method: "get",
    params: query,
  });
}

// 查询库存列表
export function countList(query) {
  return request({
    url: "/system/stock/countList",
    method: "get",
    params: query,
  });
}
//发送抽盘
export function sendCp(goodsIds) {
  return request({
    url: '/system/LargeScreen/stocks?pageNum=1&pageSize=100&whCode=FJQR01&type=3&matCode=' + goodsIds,
    method: 'get'
  })
}

// 统计库存列表
export function listStock(query) {
  return request({
    url: "/system/stock/list",
    method: "get",
    params: query,
  });
}
export function listTotal(query) {
  return request({
    url: "/system/stock/lists",
    method: "get",
    params: query,
  });
}


// 查询库存详细
export function getStock(stockId) {
  return request({
    url: "/system/stock/" + stockId,
    method: "get",
  });
}
// 根据仓库编号等条件查询库存总数
export function queryTotal(query) {
  return request({
    url: "/system/stock/queryTotal",
    method: "get",
    params: query,
  });
}


// 新增库存
export function addStock(data) {
  return request({
    url: "/system/stock",
    method: "post",
    data: data,
  });
}

// 修改库存
export function updateStock(data) {
  return request({
    url: "/system/stock",
    method: "put",
    data: data,
  });
}

// 删除库存
export function delStock(stockId) {
  return request({
    url: "/system/stock/" + stockId,
    method: "delete",
  });
}

export function frozen(stockId) {
  return request({
    url: "/system/stock/frozen/" + stockId,
    method: "get",
  });
}

export function thaw(stockId) {
  return request({
    url: "/system/stock/thaw/" + stockId,
    method: "get",
  });
}
