import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PsmStorePlaceVO, PsmStorePlaceForm, PsmStorePlaceQuery } from '@/api/wms/psmStorePlace/types';

/**
 * 查询成品库位管理列表
 * @param query
 * @returns {*}
 */

export const listPsmStorePlace = (query?: PsmStorePlaceQuery): AxiosPromise<PsmStorePlaceVO[]> => {
  return request({
    url: '/wms/psmStorePlace/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询成品库位管理详细
 * @param storePlaceId
 */
export const getPsmStorePlace = (storePlaceId: string | number): AxiosPromise<PsmStorePlaceVO> => {
  return request({
    url: '/wms/psmStorePlace/' + storePlaceId,
    method: 'get'
  });
};

/**
 * 新增成品库位管理
 * @param data
 */
export const addPsmStorePlace = (data: PsmStorePlaceForm) => {
  return request({
    url: '/wms/psmStorePlace',
    method: 'post',
    data: data
  });
};

/**
 * 修改成品库位管理
 * @param data
 */
export const updatePsmStorePlace = (data: PsmStorePlaceForm) => {
  return request({
    url: '/wms/psmStorePlace',
    method: 'put',
    data: data
  });
};

/**
 * 删除成品库位管理
 * @param storePlaceId
 */
export const delPsmStorePlace = (storePlaceId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/psmStorePlace/' + storePlaceId,
    method: 'delete'
  });
};


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