import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SampleLedgerForm, SampleLedgerQuery, SampleLedgerVO } from '@/api/wms/sampleLedger/types';

/**
 * 查询样品管理列表
 * @param query
 * @returns {*}
 */

export const listSampleLedger = (query?: SampleLedgerQuery): AxiosPromise<SampleLedgerVO[]> => {
  return request({
    url: '/wms/sampleLedger/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询样品管理详细
 * @param sampleLedgerId
 */
export const getSampleLedger = (sampleLedgerId: string | number): AxiosPromise<SampleLedgerVO> => {
  return request({
    url: '/wms/sampleLedger/' + sampleLedgerId,
    method: 'get'
  });
};

/**
 * 新增样品管理
 * @param data
 */
export const addSampleLedger = (data: SampleLedgerForm[]) => {
  return request({
    url: '/wms/sampleLedger',
    method: 'post',
    data: data
  });
};

/**
 * 修改样品管理
 * @param data
 */
export const updateSampleLedger = (data: SampleLedgerForm) => {
  return request({
    url: '/wms/sampleLedger',
    method: 'put',
    data: data
  });
};

/**
 * 删除样品管理
 * @param sampleLedgerId
 */
export const delSampleLedger = (sampleLedgerId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/sampleLedger/' + sampleLedgerId,
    method: 'delete'
  });
};

/**
 * 下拉框查询样品管理列表
 * @param query
 * @returns {*}
 */
export function getWmsSampleLedgerList(query) {
  return request({
    url: '/wms/sampleLedger/getWmsSampleLedgerList',
    method: 'get',
    params: query
  });
}
