import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AllocateOrderDetailVO, AllocateOrderDetailForm, AllocateOrderDetailQuery } from '@/api/wms/allocateOrderDetail/types';

/**
 * 查询调拨子列表
 * @param query
 * @returns {*}
 */

export const listAllocateOrderDetail = (query?: AllocateOrderDetailQuery): AxiosPromise<AllocateOrderDetailVO[]> => {
  return request({
    url: '/wms/allocateOrderDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询调拨子详细
 * @param aoDId
 */
export const getAllocateOrderDetail = (aoDId: string | number): AxiosPromise<AllocateOrderDetailVO> => {
  return request({
    url: '/wms/allocateOrderDetail/' + aoDId,
    method: 'get'
  });
};

/**
 * 新增调拨子
 * @param data
 */
export const addAllocateOrderDetail = (data: AllocateOrderDetailForm) => {
  return request({
    url: '/wms/allocateOrderDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改调拨子
 * @param data
 */
export const updateAllocateOrderDetail = (data: AllocateOrderDetailForm) => {
  return request({
    url: '/wms/allocateOrderDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除调拨子
 * @param aoDId
 */
export const delAllocateOrderDetail = (aoDId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/allocateOrderDetail/' + aoDId,
    method: 'delete'
  });
};
