import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OutstockRecordVO, OutstockRecordForm, OutstockRecordQuery } from '@/api/wms/outstockRecord/types';

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

export const listOutstockRecord = (query?: OutstockRecordQuery): AxiosPromise<OutstockRecordVO[]> => {
  return request({
    url: '/wms/outstockRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询出库记录详细
 * @param outstockRecordId
 */
export const getOutstockRecord = (outstockRecordId: string | number): AxiosPromise<OutstockRecordVO> => {
  return request({
    url: '/wms/outstockRecord/' + outstockRecordId,
    method: 'get'
  });
};

/**
 * 新增出库记录
 * @param data
 */
export const addOutstockRecord = (data: OutstockRecordForm) => {
  return request({
    url: '/wms/outstockRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改出库记录
 * @param data
 */
export const updateOutstockRecord = (data: OutstockRecordForm) => {
  return request({
    url: '/wms/outstockRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除出库记录
 * @param outstockRecordId
 */
export const delOutstockRecord = (outstockRecordId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/outstockRecord/' + outstockRecordId,
    method: 'delete'
  });
};


/**
 * 下拉框查询出库记录列表
 * @param query
 * @returns {*}
 */
export function getOutstockRecordList (query) {
    return request({
        url: '/wms/outstockRecord/getOutstockRecordList',
        method: 'get',
        params: query
    });
};
