import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OutStockDetailsForm, OutStockDetailsQuery, OutStockDetailsVO } from '@/api/wms/outStockDetails/types';

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

export const listOutStockDetails = (query?: OutStockDetailsQuery): AxiosPromise<OutStockDetailsVO[]> => {
  return request({
    url: '/wms/outStockDetails/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询出库单明细详细
 * @param outStockDetailsId
 */
export const getOutStockDetails = (outStockDetailsId: string | number): AxiosPromise<OutStockDetailsVO> => {
  return request({
    url: '/wms/outStockDetails/' + outStockDetailsId,
    method: 'get'
  });
};

/**
 * 新增出库单明细
 * @param data
 */
export const addOutStockDetails = (data: OutStockDetailsForm) => {
  return request({
    url: '/wms/outStockDetails',
    method: 'post',
    data: data
  });
};

/**
 * 修改出库单明细
 * @param data
 */
export const updateOutStockDetails = (data: OutStockDetailsForm) => {
  return request({
    url: '/wms/outStockDetails',
    method: 'put',
    data: data
  });
};

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

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

export function countUnOutStockDetails(query) {
  return request({
    url: '/wms/outStockDetails/countUnOutStockDetails',
    method: 'get',
    params: query
  });
}
