import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PsmAreaVO, PsmAreaForm, PsmAreaQuery } from '@/api/wms/psmArea/types';

/**
 * 查询成品库区列表
 * @param query
 * @returns {*}
 */

export const listPsmArea = (query?: PsmAreaQuery): AxiosPromise<PsmAreaVO[]> => {
  return request({
    url: '/system/psmArea/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询成品库区详细
 * @param areaId
 */
export const getPsmArea = (areaId: string | number): AxiosPromise<PsmAreaVO> => {
  return request({
    url: '/system/psmArea/' + areaId,
    method: 'get'
  });
};

/**
 * 新增成品库区
 * @param data
 */
export const addPsmArea = (data: PsmAreaForm) => {
  return request({
    url: '/system/psmArea',
    method: 'post',
    data: data
  });
};

/**
 * 修改成品库区
 * @param data
 */
export const updatePsmArea = (data: PsmAreaForm) => {
  return request({
    url: '/system/psmArea',
    method: 'put',
    data: data
  });
};

/**
 * 删除成品库区
 * @param areaId
 */
export const delPsmArea = (areaId: string | number | Array<string | number>) => {
  return request({
    url: '/system/psmArea/' + areaId,
    method: 'delete'
  });
};


/**
 * 下拉框查询成品库区列表
 * @param query
 * @returns {*}
 */
export function getWmsPsmAreaList (query) {
    return request({
        url: '/system/psmArea/getWmsPsmAreaList',
        method: 'get',
        params: query
    });
};
