import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InventoryCheckVO, InventoryCheckForm, InventoryCheckQuery } from '@/api/wms/inventoryCheck/types';

/**
 * 查询库存盘点列表
 * @param query
 * @returns {*}
 */

export const listInventoryCheck = (query?: InventoryCheckQuery): AxiosPromise<InventoryCheckVO[]> => {
  return request({
    url: '/wms/inventoryCheck/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询库存盘点详细
 * @param inventoryCheckId
 */
export const getInventoryCheck = (inventoryCheckId: string | number): AxiosPromise<InventoryCheckVO> => {
  return request({
    url: '/wms/inventoryCheck/' + inventoryCheckId,
    method: 'get'
  });
};

/**
 * 新增库存盘点
 * @param data
 */
export const addInventoryCheck = (data: InventoryCheckForm) => {
  return request({
    url: '/wms/inventoryCheck',
    method: 'post',
    data: data
  });
};

/**
 * 修改库存盘点
 * @param data
 */
export const updateInventoryCheck = (data: InventoryCheckForm) => {
  return request({
    url: '/wms/inventoryCheck',
    method: 'put',
    data: data
  });
};

/**
 * 删除库存盘点
 * @param inventoryCheckId
 */
export const delInventoryCheck = (inventoryCheckId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/inventoryCheck/' + inventoryCheckId,
    method: 'delete'
  });
};


/**
 * 下拉框查询库存盘点列表
 * @param query
 * @returns {*}
 */
export function getInventoryCheckList (query) {
    return request({
        url: '/wms/inventoryCheck/getInventoryCheckList',
        method: 'get',
        params: query
    });
};
