import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AllocateOrderVO, AllocateOrderForm, AllocateOrderQuery } from '@/api/wms/allocateOrder/types';

/**
 * 查询调拨工单列表
 * @param query
 * @returns {*}
 */

export const listAllocateOrder = (query?: AllocateOrderQuery): AxiosPromise<AllocateOrderVO[]> => {
  return request({
    url: '/wms/allocateOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询调拨工单详细
 * @param aoId
 */
export const getAllocateOrder = (aoId: string | number): AxiosPromise<AllocateOrderVO> => {
  return request({
    url: '/wms/allocateOrder/' + aoId,
    method: 'get'
  });
};

/**
 * 新增调拨工单
 * @param data
 */
export const addAllocateOrder = (data: AllocateOrderForm) => {
  return request({
    url: '/wms/allocateOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改调拨工单
 * @param data
 */
export const updateAllocateOrder = (data: AllocateOrderForm) => {
  return request({
    url: '/wms/allocateOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除调拨工单
 * @param aoId
 */
export const delAllocateOrder = (aoId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/allocateOrder/' + aoId,
    method: 'delete'
  });
};
