import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WmsAllocateTaskVO, WmsAllocateTaskForm, WmsAllocateTaskQuery } from '@/api/wms/wmsAllocateTask/types';

/**
 * 查询调拨打印列表
 * @param query
 * @returns {*}
 */

export const listWmsAllocateTask = (query?: WmsAllocateTaskQuery): AxiosPromise<WmsAllocateTaskVO[]> => {
  return request({
    url: '/wms/wmsAllocateTask/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询调拨打印详细
 * @param allocateTaskId
 */
export const getWmsAllocateTask = (allocateTaskId: string | number): AxiosPromise<WmsAllocateTaskVO> => {
  return request({
    url: '/wms/wmsAllocateTask/' + allocateTaskId,
    method: 'get'
  });
};

/**
 * 新增调拨打印
 * @param data
 */
export const addWmsAllocateTask = (data: WmsAllocateTaskForm) => {
  return request({
    url: '/wms/wmsAllocateTask',
    method: 'post',
    data: data
  });
};

/**
 * 修改调拨打印
 * @param data
 */
export const updateWmsAllocateTask = (data: WmsAllocateTaskForm) => {
  return request({
    url: '/wms/wmsAllocateTask',
    method: 'put',
    data: data
  });
};

/**
 * 删除调拨打印
 * @param allocateTaskId
 */
export const delWmsAllocateTask = (allocateTaskId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/wmsAllocateTask/' + allocateTaskId,
    method: 'delete'
  });
};


/**
 * 下拉框查询调拨打印列表
 * @param query
 * @returns {*}
 */
export function getWmsAllocateTaskList (query) {
    return request({
        url: '/wms/wmsAllocateTask/getWmsAllocateTaskList',
        method: 'get',
        params: query
    });
};
