import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OutstockDetailVO, OutstockDetailForm, OutstockDetailQuery } from '@/api/wms/outstockDetail/types';

/**
 * 查询出库单-物料列表
 * @param query
 * @returns {*}
 */

export const listOutstockDetail = (query?: OutstockDetailQuery): AxiosPromise<OutstockDetailVO[]> => {
  return request({
    url: '/wms/outstockDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询出库单-物料详细
 * @param outstockDetailId
 */
export const getOutstockDetail = (outstockDetailId: string | number): AxiosPromise<OutstockDetailVO> => {
  return request({
    url: '/wms/outstockDetail/' + outstockDetailId,
    method: 'get'
  });
};

/**
 * 新增出库单-物料
 * @param data
 */
export const addOutstockDetail = (data: OutstockDetailForm) => {
  return request({
    url: '/wms/outstockDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改出库单-物料
 * @param data
 */
export const updateOutstockDetail = (data: OutstockDetailForm) => {
  return request({
    url: '/wms/outstockDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除出库单-物料
 * @param outstockDetailId
 */
export const delOutstockDetail = (outstockDetailId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/outstockDetail/detailRemove/' + outstockDetailId,
    method: 'delete'
  });
};
