gruene-seele/app/Models/ProductionOutput.php
Kevin Adametz 99a6c92e6c Warenwirtschaft: AP-28 Neue Produktions-Maske + Produktionsergebnis
- production_outputs (Migration inkl. idempotentem Backfill): eine Produktion
  kann mehrere Output-Produkte erzeugen (z. B. 40x50 ml + 50x5 ml)
- ProductStockService bucht je Output-Produkt (idempotenter Diff, append-only);
  die geplante Stückzahl bucht nichts mehr, entfernte Outputs werden rückgebucht
- ProductionService store/update mit outputs[] (leer = Fallback auf Planung
  inkl. suggestedBatchNumber — Backfill-Semantik, Alt-Aufrufer stabil)
- Maske: INCI-Liste (Alternativname/Qualität/Anteil/Gramm/Regal), Chargen-
  Erfassung nach Rezeptur-Phasen mit Notiz + Status-Ampel, Produktionsergebnis-
  Repeater mit Chargen-Nr.-Vorbelegung (Präfix + ttmmjj), Planungs-Hinweis
- Show: Produktionsergebnis-Karte; Index: Ergebnis-Spalte
- Hinweise-Doku + Plan V6.0 §6 fortgeschrieben (nächster Schritt: AP-13)

Tests: ProductionOutputTest (8 neu); Suite 201 grün, 731 Assertionen

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 14:02:54 +00:00

49 lines
1 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* AP-28: Eine Ergebniszeile einer Produktion (Produkt + produzierte Stückzahl
* + Chargen-Nr.). Der Produktbestand bucht aus diesen Zeilen, nicht aus der
* geplanten Stückzahl der Produktion.
*/
class ProductionOutput extends Model
{
protected $fillable = [
'production_id',
'product_id',
'quantity',
'batch_number',
'pos',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'quantity' => 'integer',
'pos' => 'integer',
];
}
/**
* @return BelongsTo<Production, $this>
*/
public function production(): BelongsTo
{
return $this->belongsTo(Production::class);
}
/**
* @return BelongsTo<Product, $this>
*/
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
}