import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PsmStorageVO, PsmStorageForm, PsmStorageQuery } from '@/api/wms/psmStorage/types';

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

export const listPsmStorage = (query?: PsmStorageQuery): AxiosPromise<PsmStorageVO[]> => {
  return request({
    url: '/wms/psmStorage/list',
    method: 'get',
    params: query
  });
};
/**
 * 查询过期成品库存列表
 */
export const expiredList = (query?: PsmStorageQuery): AxiosPromise<PsmStorageVO[]> => {
  return request({
    url: '/wms/psmStorage/expiredList',
    method: 'get',
    params: query
  });
};
/**
 * 查询将要过期成品库存列表
 */
export const expiringList = (query?: PsmStorageQuery): AxiosPromise<PsmStorageVO[]> => {
  return request({
    url: '/wms/psmStorage/expiringList',
    method: 'get',
    params: query
  });
};


/**
 * 查询成品库存详细
 * @param objid
 */
export const getPsmStorage = (objid: string | number): AxiosPromise<PsmStorageVO> => {
  return request({
    url: '/wms/psmStorage/' + objid,
    method: 'get'
  });
};

/**
 * 新增成品库存
 * @param data
 */
export const addPsmStorage = (data: PsmStorageForm) => {
  return request({
    url: '/wms/psmStorage',
    method: 'post',
    data: data
  });
};

/**
 * 修改成品库存
 * @param data
 */
export const updatePsmStorage = (data: PsmStorageForm) => {
  return request({
    url: '/wms/psmStorage',
    method: 'put',
    data: data
  });
};

/**
 * 删除成品库存
 * @param objid
 */
export const delPsmStorage = (objid: string | number | Array<string | number>) => {
  return request({
    url: '/wms/psmStorage/' + objid,
    method: 'delete'
  });
};


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