Package com.deusto.coffeestack.service
Interface StockService
- All Known Implementing Classes:
StockServiceImpl
public interface StockService
Service responsible for stock consultation per insumo and per batch (lote).
Business rules implemented:
- Total stock = sum of
cantidadActualacross all lotes of an insumo. - Shortage risk = total stock < insumo's
stockMinimoAlerta.
-
Method Summary
Modifier and TypeMethodDescriptiongetCoberturaTodosInsumos(int ventanaDias) Returns the estimated coverage days for every registered insumo.getStockDetalladoPorInsumo(Long insumoId) Returns the detailed stock for a single insumo, including its batch breakdown.Returns the stock summary for every registered insumo.
-
Method Details
-
getStockDetalladoPorInsumo
Returns the detailed stock for a single insumo, including its batch breakdown.- Parameters:
insumoId- the ID of the insumo- Returns:
- stock detail with lote breakdown and shortage risk flag
- Throws:
NotFoundException- if the insumo does not exist
-
getStockTodosInsumos
List<StockInsumoResponse> getStockTodosInsumos()Returns the stock summary for every registered insumo. -
getCoberturaTodosInsumos
Returns the estimated coverage days for every registered insumo.Coverage days = total stock / average daily consumption computed over the given
ventanaDiaswindow. If consumption is zero the result isDouble.POSITIVE_INFINITYand the risk level is set toOK.- Parameters:
ventanaDias- sampling window in days (must be >= 1)
-