Continuidad de reportes Frontend. Se sigue..
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import apiClient from '../apiClient';
|
||||
import type { ExistenciaPapelDto } from '../../models/dtos/Reportes/ExistenciaPapelDto';
|
||||
import type { MovimientoBobinasDto } from '../../models/dtos/Reportes/MovimientoBobinasDto';
|
||||
import type { MovimientoBobinasPorEstadoResponseDto } from '../../models/dtos/Reportes/MovimientoBobinasPorEstadoResponseDto';
|
||||
import type { ListadoDistribucionGeneralResponseDto } from '../../models/dtos/Reportes/ListadoDistribucionGeneralResponseDto';
|
||||
import type { ListadoDistribucionCanillasResponseDto } from '../../models/dtos/Reportes/ListadoDistribucionCanillasResponseDto';
|
||||
|
||||
interface GetExistenciaPapelParams {
|
||||
fechaDesde: string; // yyyy-MM-dd
|
||||
@@ -40,13 +44,102 @@ const getExistenciaPapel = async (params: GetExistenciaPapelParams): Promise<Exi
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getMovimientoBobinas = async (params: {
|
||||
fechaDesde: string;
|
||||
fechaHasta: string;
|
||||
idPlanta: number;
|
||||
}): Promise<MovimientoBobinasDto[]> => {
|
||||
const response = await apiClient.get<MovimientoBobinasDto[]>('/reportes/movimiento-bobinas', { params });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
// ... Aquí irán los métodos para otros reportes ...
|
||||
const getMovimientoBobinasPdf = async (params: {
|
||||
fechaDesde: string;
|
||||
fechaHasta: string;
|
||||
idPlanta: number;
|
||||
}): Promise<Blob> => {
|
||||
const response = await apiClient.get('/reportes/movimiento-bobinas/pdf', {
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getMovimientoBobinasEstado = async (params: {
|
||||
fechaDesde: string;
|
||||
fechaHasta: string;
|
||||
idPlanta: number;
|
||||
}): Promise<MovimientoBobinasPorEstadoResponseDto> => { // <- Devuelve el DTO combinado
|
||||
const response = await apiClient.get<MovimientoBobinasPorEstadoResponseDto>('/reportes/movimiento-bobinas-estado', { params });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getMovimientoBobinasEstadoPdf = async (params: {
|
||||
fechaDesde: string;
|
||||
fechaHasta: string;
|
||||
idPlanta: number;
|
||||
}): Promise<Blob> => {
|
||||
const response = await apiClient.get('/reportes/movimiento-bobinas-estado/pdf', {
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getListadoDistribucionGeneral = async (params: {
|
||||
idPublicacion: number;
|
||||
fechaDesde: string; // YYYY-MM-DD (primer día del mes)
|
||||
fechaHasta: string; // YYYY-MM-DD (último día del mes)
|
||||
}): Promise<ListadoDistribucionGeneralResponseDto> => {
|
||||
const response = await apiClient.get<ListadoDistribucionGeneralResponseDto>('/reportes/listado-distribucion-general', { params });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getListadoDistribucionGeneralPdf = async (params: {
|
||||
idPublicacion: number;
|
||||
fechaDesde: string;
|
||||
fechaHasta: string;
|
||||
}): Promise<Blob> => {
|
||||
const response = await apiClient.get('/reportes/listado-distribucion-general/pdf', {
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getListadoDistribucionCanillas = async (params: {
|
||||
idPublicacion: number;
|
||||
fechaDesde: string;
|
||||
fechaHasta: string;
|
||||
}): Promise<ListadoDistribucionCanillasResponseDto> => {
|
||||
const response = await apiClient.get<ListadoDistribucionCanillasResponseDto>('/reportes/listado-distribucion-canillas', { params });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
|
||||
const getListadoDistribucionCanillasPdf = async (params: {
|
||||
idPublicacion: number;
|
||||
fechaDesde: string;
|
||||
fechaHasta: string;
|
||||
}): Promise<Blob> => {
|
||||
const response = await apiClient.get('/reportes/listado-distribucion-canillas/pdf', {
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const reportesService = {
|
||||
getExistenciaPapel,
|
||||
getExistenciaPapelPdf,
|
||||
// ...
|
||||
getMovimientoBobinas,
|
||||
getMovimientoBobinasPdf,
|
||||
getMovimientoBobinasEstado,
|
||||
getMovimientoBobinasEstadoPdf,
|
||||
getListadoDistribucionGeneral,
|
||||
getListadoDistribucionGeneralPdf,
|
||||
getListadoDistribucionCanillas,
|
||||
getListadoDistribucionCanillasPdf
|
||||
};
|
||||
|
||||
export default reportesService;
|
||||
Reference in New Issue
Block a user