import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InstockRecordVO, InstockRecordForm, InstockRecordQuery } from '@/api/wms/instockRecord/types';

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

export const listInstockRecord = (query?: InstockRecordQuery): AxiosPromise<InstockRecordVO[]> => {
  return request({
    url: '/wms/instockRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询入库记录详细
 * @param instockRecordId
 */
export const getInstockRecord = (instockRecordId: string | number): AxiosPromise<InstockRecordVO> => {
  return request({
    url: '/wms/instockRecord/' + instockRecordId,
    method: 'get'
  });
};

/**
 * 新增入库记录
 * @param data
 */
export const addInstockRecord = (data: InstockRecordForm) => {
  return request({
    url: '/wms/instockRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改入库记录
 * @param data
 */
export const updateInstockRecord = (data: InstockRecordForm) => {
  return request({
    url: '/wms/instockRecord',
    method: 'put',
    data: data
  });
};

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