import axios from "../../utils/axios";

// 权限管理

// 获取列表
export function filterList(query) {
    return axios({
        url: "/spms/inv/warehouse/filter",
        method: "get",
        params: query
    });
}

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

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


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

// 删除
export function deleteWarehouse(data) {
    return axios({
        url: "/spms/inv/warehouse/delete",
        method: "post",
        data: data
    });
}
export function disableWarehouse(data) {
    return axios({
        url: "/spms/inv/warehouse/disable",
        method: "post",
        data: data
    });
}

//加载仓库字典关联用户数据
export function warehouseUserList(query) {
    return axios({
        url: '/warehouse/inout/warehouseUserList',
        method: 'get',
        params: query
    });
}

//加载仓库字段关联单据类型数据
export function warehouseBussinessTypeList(query) {
    return axios({
        url: '/warehouse/inout/warehouseBussniessTypeList',
        method: 'get',
        params: query
    });
}

//添加用户
export function saveWarehouseUser(query) {
    return axios({
        url: '/warehouse/inout/saveWarehouseUser',
        method: 'post',
        data: query
    });
}

//添加单据类型
export function saveWarehouseBussinessType(query) {
    return axios({
        url: '/warehouse/inout/saveWarehouseBussinessType',
        method: 'post',
        data: query
    });
}

//设置主管
export function updateDirector(query) {
    return axios({
        url: '/warehouse/inout/updateDirector',
        method: 'post',
        params: query
    });
}

export function deleteWarehouseUser(params) {
    return axios({
        url: '/warehouse/inout/delWarehouseUser',
        method: 'post',
        params: params
    });
}

export function deleteWarehouseBussinessType(params) {
    return axios({
        url: '/warehouse/inout/delWarehouseBussinessType',
        method: 'post',
        params: params
    });
}

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

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

//查询第三方系统和仓库数据关联信息
export function getThrsysDetail(params) {
    return axios({
        url: "/udi/inv/warehouse/thridSys/detail",
        method: "get",
        params: params
    });
}

//替换单据条码
export function replaceCodes(data) {
    return axios({
        url: "/warehouse/inout/replaceCodes",
        method: "post",
        data: data
    })
}
