Package com.deusto.coffeestack.service
Interface AjusteService
- All Known Implementing Classes:
AjusteServiceImpl
public interface AjusteService
Service responsible for registering inventory adjustments
(mermas, roturas, positive and negative adjustments).
-
Method Summary
Modifier and TypeMethodDescriptionReturns all registered movements, most recent first.listarMovimientosFiltrados(Long insumoId, TipoMovimiento tipo, LocalDateTime desde, LocalDateTime hasta) Returns movements filtered by optional criteria, most recent first.listarMovimientosPorInsumo(Long insumoId) Returns all movements for batches of a given insumo, most recent first.registrarAjuste(AjusteRequest request, String usuarioLogin) Registers a stock movement, updates the affected batch's current quantity, and persists an audit record.reportePorMotivo(TipoMovimiento tipo, LocalDateTime desde, LocalDateTime hasta) Genera el reporte de movimientos agrupado por motivo y tipo, con el número de incidencias y la cantidad total acumulada por cada combinación.
-
Method Details
-
registrarAjuste
Registers a stock movement, updates the affected batch's current quantity, and persists an audit record.- Parameters:
request- the adjustment detailsusuarioLogin- login of the authenticated user performing the action- Returns:
- the persisted movement as a response DTO
- Throws:
NotFoundException- if the lote does not existIllegalArgumentException- if cantidad exceeds available stock for negative movements
-
listarMovimientos
List<MovimientoResponse> listarMovimientos()Returns all registered movements, most recent first. -
listarMovimientosPorInsumo
Returns all movements for batches of a given insumo, most recent first.- Throws:
NotFoundException- if the insumo does not exist
-
listarMovimientosFiltrados
List<MovimientoResponse> listarMovimientosFiltrados(Long insumoId, TipoMovimiento tipo, LocalDateTime desde, LocalDateTime hasta) Returns movements filtered by optional criteria, most recent first.- Parameters:
insumoId- restrict to a specific insumo (nullable)tipo- restrict to a specific movement type (nullable)desde- lower bound on fechaHora, inclusive (nullable)hasta- upper bound on fechaHora, inclusive (nullable)
-
reportePorMotivo
List<ReporteMotivoResponse> reportePorMotivo(TipoMovimiento tipo, LocalDateTime desde, LocalDateTime hasta) Genera el reporte de movimientos agrupado por motivo y tipo, con el número de incidencias y la cantidad total acumulada por cada combinación. Pensado para que el propietario detecte patrones de desperdicio y enfoque mejoras de proceso (issue #24).- Parameters:
tipo- restringe a un tipo concreto (nullable: incluye todos)desde- inicio del rango, inclusivo (nullable)hasta- fin del rango, inclusivo (nullable)- Returns:
- filas ordenadas por cantidad total descendente
-