import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SampleDisposalRecordVO, SampleDisposalRecordForm, SampleDisposalRecordQuery } from '@/api/wms/sampleDisposalRecord/types';

/**
 * 查询样品处置记录列表
 * @param query
 * @returns {*}
 */

export const listSampleDisposalRecord = (query?: SampleDisposalRecordQuery): AxiosPromise<SampleDisposalRecordVO[]> => {
  return request({
    url: '/wms/sampleDisposalRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询样品处置记录详细
 * @param sampleRecordId
 */
export const getSampleDisposalRecord = (sampleRecordId: string | number): AxiosPromise<SampleDisposalRecordVO> => {
  return request({
    url: '/wms/sampleDisposalRecord/' + sampleRecordId,
    method: 'get'
  });
};

/**
 * 新增样品处置记录
 * @param data
 */
export const addSampleDisposalRecord = (data: SampleDisposalRecordForm) => {
  return request({
    url: '/wms/sampleDisposalRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改样品处置记录
 * @param data
 */
export const updateSampleDisposalRecord = (data: SampleDisposalRecordForm) => {
  return request({
    url: '/wms/sampleDisposalRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除样品处置记录
 * @param sampleRecordId
 */
export const delSampleDisposalRecord = (sampleRecordId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/sampleDisposalRecord/' + sampleRecordId,
    method: 'delete'
  });
};

/**
 * 下拉框查询样品处置记录列表
 * @param query
 * @returns {*}
 */
export function getWmsSampleDisposalRecordList (query) {
    return request({
        url: '/wms/sampleDisposalRecord/getWmsSampleDisposalRecordList',
        method: 'get',
        params: query
    });
};
