import request from '../request.js';

/** 接口管理 */
const Api = {
    list: '/api/wms/loc/list',
    page: '/api/wms/loc/page',
    save: '/api/wms/loc/save',
    edit: '/api/wms/loc/edit',
    remove: '/api/wms/loc/remove',
    removeBatch: '/api/wms/loc/removeBatch',
    wmsLocDict: '/api/wms/locGenerator/getWmsLocDict',
    changeLocStatus: '/api/wms/loc/changeLocStatus',
    changeLocStoreStatus: '/api/wms/loc/changeLocStoreStatus',
}

/** 货位列表 (分页) */
export const page = data => {
    return request.request({
        url: Api.page,
        params: data,
        method: 'GET'
    })
}

/** 货位列表 */
export const list = data => {
    return request.request({
        url: Api.list,
        params: data,
        method: 'GET'
    })
}

/** 保存 */
export const save = data => {
    return request.request({
        url: Api.save,
        data: data,
        method: 'POST'
    })
}

/** 修改 */
export const edit = data => {
    return request.request({
        url: Api.edit,
        data: data,
        method: 'PUT'
    })
}

/** 删除 */
export const remove = data => {
    return request.request({
        url: Api.remove,
        params: data,
        method: 'DELETE'
    })
}

/** 批量删除 */
export const removeBatch = data => {
    return request.request({
        url: Api.removeBatch,
        params: data,
        method: 'DELETE'
    })
}

/** 获取货位字典 */
export const wmsLocDict = data => {
    return request.request({
        url: Api.wmsLocDict,
        params: data,
        method: 'GET'
    })
}

/** 变更位置状态 */
export const changeLocStatus = data => {
    return request.request({
        url: Api.changeLocStatus,
        data: data,
        method: 'PUT'
    })
}

/** 变更存储状态 */
export const changeLocStoreStatus = data => {
    return request.request({
        url: Api.changeLocStoreStatus,
        data: data,
        method: 'PUT'
    })
}
