import axios from "@/utils/request";


export function filterSubAll(query) {
  return axios({
    url: "/spms/sub/inv/warehouse/filter",
    method: "get",
    params: query
  });
}


//获取用户所有关联仓库
export function findInvByUser(query) {
  return axios({
    url: "/spms/inv/warehouse/findByUser",
    method: "get",
    params: query
  });
}

//获取除了自己所有其他仓库
export function findByFrom(query) {
  return axios({
    url: "/spms/inv/warehouse/findByFrom",
    method: "get",
    params: query
  });
}


export function filterSubByInv(query) {
  return axios({
    url: "/spms/inv/warehouse/findByUser",
    method: "get",
    params: query
  });
}


export function findByDeptUser(query) {
  return axios({
    url: "/spms/inv/warehouse/findByDeptUser",
    method: "get",
    params: query
  });
}


export function filterSub(query) {
  return axios({
    url: "/spms/sub/inv/warehouse/filterSub",
    method: "get",
    params: query
  });
}

// 保存
export function saveSubWarehouse(data, formName, method = "post") {
  let url =
    formName !== "edit"
      ? "/spms/sub/inv/warehouse/save"
      : "/spms/sub/inv/warehouse/edit";
  return axios({
    url: url,
    method: method,
    data: data
  });
}

// 删除
export function deleteSubWarehouse(data) {
  return axios({
    url: "/spms/sub/inv/warehouse/delete",
    method: "post",
    data: data
  });
}
//查询第三方系统和仓库数据关联信息
export function getSubThrsysDetail(params) {
  return axios({
    url: "/spms/sub/inv/warehouse/thridSys/detail",
    method: "get",
    params: params
  });
}


//绑定第三方仓库
export function bindThrSubWarehouse(params) {
  return axios({
    url: "/spms/sub/inv/warehouse/bindThrWarehouse",
    method: "post",
    params: params
  });
}

//解绑第三方仓库
export function unbindSubThrWarehouse(params) {
  return axios({
    url: "/spms/sub/inv/warehouse/unbindThrWarehouse",
    method: "post",
    params: params
  });
}

export function getInvWarehouseList(params) {
  return axios({
    url: "/spms/sub/inv/warehouse/filterSubInvList",
    method: "get",
    params: params
  });
}


