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

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

/** 货位列表 (分页) */
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 generateLoc = data => {
    return request.request({
        url: Api.generateLoc,
        params: data,
        method: 'POST'
    })
}

/** 根据节点编号获取节点信息 */
export const getNodeByCode = data => {
    return request.request({
        url: Api.getNodeByCode,
        params: data,
        method: 'GET'
    })
}
