import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WmsBaseProductForm, WmsBaseProductQuery, WmsBaseProductVO } from '@/api/wms/wmsBaseProduct/types';

/**
 * 查询海威物料信息列表
 * @param query
 * @returns {*}
 */

export const listWmsBaseProduct = (query?: WmsBaseProductQuery): AxiosPromise<WmsBaseProductVO[]> => {
  return request({
    url: '/wms/wmsBaseProduct/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询海威物料信息详细
 * @param productId
 */
export const getWmsBaseProduct = (productId: string | number): AxiosPromise<WmsBaseProductVO> => {
  return request({
    url: '/wms/wmsBaseProduct/' + productId,
    method: 'get'
  });
};

/**
 * 新增海威物料信息
 * @param data
 */
export const addWmsBaseProduct = (data: WmsBaseProductForm) => {
  return request({
    url: '/wms/wmsBaseProduct',
    method: 'post',
    data: data
  });
};

/**
 * 修改海威物料信息
 * @param data
 */
export const updateWmsBaseProduct = (data: WmsBaseProductForm) => {
  return request({
    url: '/wms/wmsBaseProduct',
    method: 'put',
    data: data
  });
};

/**
 * 删除海威物料信息
 * @param productId
 */
export const delWmsBaseProduct = (productId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/wmsBaseProduct/' + productId,
    method: 'delete'
  });
};

/**
 * 下拉框查询海威物料信息列表
 * @param query
 * @returns {*}
 */
export function getWmsBaseProductList(query) {
  return request({
    url: '/wms/wmsBaseProduct/getWmsBaseProductList',
    method: 'get',
    params: query
  });
}
