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

/** 接口管理 */
const Api = {
    page: '/api/wms/task/page',
    save: '/api/wms/task/save',
    edit: '/api/wms/task/edit',
    remove: '/api/wms/task/remove',
    removeBatch: '/api/wms/task/removeBatch',
    taskSend: '/api/wms/task/taskSendToWcs',
    taskOver: '/api/wms/task/taskOver',
    taskCancel: '/api/wms/task/taskCancel'
}

/** 任务列表 (分页) */
export const page = data => {
    return request.request({
        url: Api.page,
        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 taskSend = data => {
  return request.request({
    url: Api.taskSend,
    data: data,
    method: 'POST'
  })
}

/** 任务完成 */
export const taskOver = data => {
  return request.request({
    url: Api.taskOver,
    data: data,
    method: 'POST'
  })
}

/** 任务取消 */
export const taskCancel = data => {
  return request.request({
    url: Api.taskCancel,
    data: data,
    method: 'POST'
  })
}