Warenwirtschaft: OPT-3 Index-Limits + OPT-4 show()-Refactoring

- Wareneingang-/Produktions-Uebersicht: Eingegangene auf 500 gedeckelt
  (offene Bestellungen immer vollstaendig), ?all=1 + Hinweis-Link;
  ungenutzte User-Eager-Loads entfernt
- RawMaterialStockController::show() entschlackt: Chargen-Restmengen (FEFO)
  und offene Bestellungen im InventoryService, letzter Netto-Preis je
  Lieferant als Window-Function-Query im StockEntryRepository

Tests: RawMaterialStockTest +2, volle Suite 186 gruen, 663 Assertions

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-06 12:23:20 +00:00
parent 209ea467eb
commit e47d848d3d
10 changed files with 165 additions and 75 deletions

View file

@ -8,14 +8,17 @@ use Illuminate\Database\Eloquent\Collection;
class ProductionRepository
{
/**
* Neueste zuerst, gedeckelt auf $limit (OPT-3); null = alle.
*
* @return Collection<int, Production>
*/
public function listForIndex(): Collection
public function listForIndex(?int $limit = 500): Collection
{
return Production::query()
->with(['product', 'location'])
->orderByDesc('produced_at')
->orderByDesc('id')
->when($limit !== null, fn ($q) => $q->limit($limit))
->get();
}
}