import request from '@/utils/request';

// 获取库存余额列表
export async function getStatementPage(params) {
  const res = await request.get(`/wms/statement/page`, {
    params
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 获取库存余额列表
export async function exportStockExcel(params) {
  const res = await request.post(`/wms/statement/exportStockExcel`, params, {
    responseType: 'blob'
  });
  return res.data;
}

// 库存余额导出记录表
export async function getStatementLogPage(params) {
  const res = await request.get(`/wms/statementLog/page`, {
    params
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 库存余额筛选列表
export async function getStockPage(params) {
  const res = await request.get(`/wms/statistics/page`, {
    params
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 收发明细表
export async function sendReceiveExcel(params) {
  const res = await request.post(`/wms/statement/sendReceiveExcel`, params, {
    responseType: 'blob'
  });
  return res.data;
}

// 收发汇总表
export async function sendReceiveGatherExcel(params) {
  const queryString = new URLSearchParams(params).toString();
  const res = await request.get(
    `/wms/statistics/getReportForms?${queryString}`
  );
  console.log('res', res);
  return res.data.data;
}

// 收发明细表-详情
export async function outintwoPage(params) {
  const res = await request.post(`/wms/statement/sendReceiveDetail`, 
    params
  );
  console.log(res);

  return res.data;
}
