import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InStockDetailsForm, InStockDetailsQuery, InStockDetailsVO } from '@/api/wms/inStockDetails/types';

/**
 * 查询入库单明细列表
 * @param query
 * @returns {*}
 */

export const listInStockDetails = (query?: InStockDetailsQuery): AxiosPromise<InStockDetailsVO[]> => {
  return request({
    url: '/wms/inStockDetails/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询入库单明细详细
 * @param inStockDetailsId
 */
export const getInStockDetails = (inStockDetailsId: string | number): AxiosPromise<InStockDetailsVO> => {
  return request({
    url: '/wms/inStockDetails/' + inStockDetailsId,
    method: 'get'
  });
};

/**
 * 新增入库单明细
 * @param data
 */
export const addInStockDetails = (data: InStockDetailsForm) => {
  return request({
    url: '/wms/inStockDetails',
    method: 'post',
    data: data
  });
};

/**
 * 修改入库单明细
 * @param data
 */
export const updateInStockDetails = (data: InStockDetailsForm) => {
  return request({
    url: '/wms/inStockDetails',
    method: 'put',
    data: data
  });
};

/**
 * 删除入库单明细
 * @param inStockDetailsId
 */
export const delInStockDetails = (inStockDetailsId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/inStockDetails/' + inStockDetailsId,
    method: 'delete'
  });
};

/**
 * 下拉框查询入库单明细列表
 * @param query
 * @returns {*}
 */
export function getWmsInStockDetailsList(query) {
  return request({
    url: '/wms/inStockDetails/getWmsInStockDetailsList',
    method: 'get',
    params: query
  });
}
