import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InstockDetailVO, InstockDetailForm, InstockDetailQuery } from '@/api/wms/instockDetail/types';

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

export const listInstockDetail = (query) => {
  return request({
    url: '/wms/instockDetail/list',
    method: 'get',
    params: query
  });
};


export const getMaterialListVo = (query) => {
 return request({
   url: '/wms/baseMaterialInfo/materialList',
   method: 'get',
   params: query
 });
};
export const getMaterailCount = (query) => {
  return request({
    url: '/wms/inventory/materailCount',
    method: 'get',
    params: query
  });
 };

/**
 * 查询入库单-物料详细
 * @param instockDetailId
 */
export const getInstockDetail = (instockDetailId: string | number): AxiosPromise<InstockDetailVO> => {
  return request({
    url: '/wms/instockDetail/' + instockDetailId,
    method: 'get'
  });
};

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

/**
 * 修改入库单-物料
 * @param data
 */
export const updateInstockDetail = (data: InstockDetailForm) => {
  return request({
    url: '/wms/instockDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除入库单-物料
 * @param instockDetailId
 */
export const delInstockDetail = (instockDetailId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/instockDetail/removeInstockDetail/' + instockDetailId,
    method: 'delete'
  });
};
