import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PsmInStockVO, PsmInStockForm, PsmInStockQuery } from '@/api/wms/psmInStock/types';

/**
 * 查询成品入库记录列表
 * @param query
 * @returns {*}
 */

export const listPsmInStock = (query?: PsmInStockQuery): AxiosPromise<PsmInStockVO[]> => {
  return request({
    url: '/wms/psmInStock/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询成品入库记录详细
 * @param inStockId
 */
export const getPsmInStock = (inStockId: string | number): AxiosPromise<PsmInStockVO> => {
  return request({
    url: '/wms/psmInStock/' + inStockId,
    method: 'get'
  });
};

/**
 * 新增成品入库记录
 * @param data
 */
export const addPsmInStock = (data: PsmInStockForm) => {
  return request({
    url: '/wms/psmInStock',
    method: 'post',
    data: data
  });
};

/**
 * 修改成品入库记录
 * @param data
 */
export const updatePsmInStock = (data: PsmInStockForm) => {
  return request({
    url: '/wms/psmInStock',
    method: 'put',
    data: data
  });
};

/**
 * 删除成品入库记录
 * @param inStockId
 */
export const delPsmInStock = (inStockId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/psmInStock/' + inStockId,
    method: 'delete'
  });
};


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