import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseLocationVO, BaseLocationForm, BaseLocationQuery } from '@/api/wms/baseLocation/types';

/**
 * 查询库位基础信息列表
 * @param query
 * @returns {*}
 */

export const listBaseLocation = (query?: BaseLocationQuery): AxiosPromise<BaseLocationVO[]> => {
  return request({
    url: '/wms/baseLocation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询库位基础信息详细
 * @param locationId
 */
export const getBaseLocation = (locationId: string | number): AxiosPromise<BaseLocationVO> => {
  return request({
    url: '/wms/baseLocation/' + locationId,
    method: 'get'
  });
};

/**
 * 新增库位基础信息
 * @param data
 */
export const addBaseLocation = (data: BaseLocationForm) => {
  return request({
    url: '/wms/baseLocation',
    method: 'post',
    data: data
  });
};

/**
 * 修改库位基础信息
 * @param data
 */
export const updateBaseLocation = (data: BaseLocationForm) => {
  return request({
    url: '/wms/baseLocation',
    method: 'put',
    data: data
  });
};

/**
 * 删除库位基础信息
 * @param locationId
 */
export const delBaseLocation = (locationId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/baseLocation/' + locationId,
    method: 'delete'
  });
};


/**
 * 下拉框查询库位基础信息列表
 * @param query
 * @returns {*}
 */
export function getBaseLocationList (query) {
    return request({
        url: '/wms/baseLocation/getWmsBaseLocationList',
        method: 'get',
        params: query
    });
}
export function getWmsBaseLocationVoList (query) {
  return request({
      url: '/wms/baseLocation/getWmsBaseLocationVoList',
      method: 'get',
      params: query
  });
}
