import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WmsShippingDetailsForm, WmsShippingDetailsQuery, WmsShippingDetailsVO } from '@/api/wms/wmsShippingDetails/types';

/**
 * 查询发货单明细列表
 * @param query
 * @returns {*}
 */

export const listWmsShippingDetails = (query?: WmsShippingDetailsQuery): AxiosPromise<WmsShippingDetailsVO[]> => {
  return request({
    url: '/wms/wmsShippingDetails/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询发货单明细详细
 * @param shippingDetailsId
 */
export const getWmsShippingDetails = (shippingDetailsId: string | number): AxiosPromise<WmsShippingDetailsVO> => {
  return request({
    url: '/wms/wmsShippingDetails/' + shippingDetailsId,
    method: 'get'
  });
};

/**
 * 新增发货单明细
 * @param data
 */
export const addWmsShippingDetails = (data: WmsShippingDetailsForm) => {
  return request({
    url: '/wms/wmsShippingDetails',
    method: 'post',
    data: data
  });
};

/**
 * 修改发货单明细
 * @param data
 */
export const updateWmsShippingDetails = (data: WmsShippingDetailsForm) => {
  return request({
    url: '/wms/wmsShippingDetails',
    method: 'put',
    data: data
  });
};

/**
 * 删除发货单明细
 * @param shippingDetailsId
 */
export const delWmsShippingDetails = (shippingDetailsId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/wmsShippingDetails/' + shippingDetailsId,
    method: 'delete'
  });
};

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