import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InventoryCheckRecordVO, InventoryCheckRecordForm, InventoryCheckRecordQuery } from '@/api/wms/inventoryCheckRecord/types';

/**
 * 查询盘点记录和调整工单列表
 * @param query
 * @returns {*}
 */

export const listInventoryCheckRecord = (query?: InventoryCheckRecordQuery): AxiosPromise<InventoryCheckRecordVO[]> => {
  return request({
    url: '/wms/inventoryCheckRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询盘点记录和调整工单详细
 * @param icRecordId
 */
export const getInventoryCheckRecord = (icRecordId: string | number): AxiosPromise<InventoryCheckRecordVO> => {
  return request({
    url: '/wms/inventoryCheckRecord/' + icRecordId,
    method: 'get'
  });
};

/**
 * 新增盘点记录和调整工单
 * @param data
 */
export const addInventoryCheckRecord = (data: InventoryCheckRecordForm) => {
  return request({
    url: '/wms/inventoryCheckRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改盘点记录和调整工单
 * @param data
 */
export const updateInventoryCheckRecord = (data: InventoryCheckRecordForm) => {
  return request({
    url: '/wms/inventoryCheckRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除盘点记录和调整工单
 * @param icRecordId
 */
export const delInventoryCheckRecord = (icRecordId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/inventoryCheckRecord/' + icRecordId,
    method: 'delete'
  });
};


/**
 * 下拉框查询盘点记录和调整工单列表
 * @param query
 * @returns {*}
 */
export function getInventoryCheckRecordList (query) {
    return request({
        url: '/wms/inventoryCheckRecord/getInventoryCheckRecordList',
        method: 'get',
        params: query
    });
};
