import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OutstockOrderVO, OutstockOrderForm, OutstockOrderQuery } from '@/api/wms/outstockOrder/types';

/**
 * 查询出库单列表
 * @param query
 * @returns {*}
 */

export const listOutstockOrder = (query?: OutstockOrderQuery): AxiosPromise<OutstockOrderVO[]> => {
  return request({
    url: '/wms/outstockOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询出库单详细
 * @param outstockId
 */
export const getOutstockOrder = (outstockId: string | number): AxiosPromise<OutstockOrderVO> => {
  return request({
    url: '/wms/outstockOrder/' + outstockId,
    method: 'get'
  });
};

/**
 * 新增出库单
 * @param data
 */
export const addOutstockOrder = (data: OutstockOrderForm) => {
  return request({
    url: '/wms/outstockOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改出库单
 * @param data
 */
export const updateOutstockOrder = (data: OutstockOrderForm) => {
  return request({
    url: '/wms/outstockOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除出库单
 * @param outstockId
 */
export const delOutstockOrder = (outstockId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/outstockOrder/' + outstockId,
    method: 'delete'
  });
};
