import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeliveryNoteVO, DeliveryNoteForm, DeliveryNoteQuery } from '@/api/wms/deliveryNote/types';

/**
 * 查询送货单管理列表
 * @param query
 * @returns {*}
 */

export const listDeliveryNote = (query?: DeliveryNoteQuery): AxiosPromise<DeliveryNoteVO[]> => {
  return request({
    url: '/wms/deliveryNote/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询送货单管理详细
 * @param deliveryNoteId
 */
export const getDeliveryNote = (deliveryNoteId: string | number): AxiosPromise<DeliveryNoteVO> => {
  return request({
    url: '/wms/deliveryNote/' + deliveryNoteId,
    method: 'get'
  });
};

/**
 * 新增送货单管理
 * @param data
 */
export const addDeliveryNote = (data: DeliveryNoteForm) => {
  return request({
    url: '/wms/deliveryNote',
    method: 'post',
    data: data
  });
};

/**
 * 修改送货单管理
 * @param data
 */
export const updateDeliveryNote = (data: DeliveryNoteForm) => {
  return request({
    url: '/wms/deliveryNote',
    method: 'put',
    data: data
  });
};

/**
 * 删除送货单管理
 * @param deliveryNoteId
 */
export const delDeliveryNote = (deliveryNoteId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/deliveryNote/' + deliveryNoteId,
    method: 'delete'
  });
};
