Warenwirtschaft: AP-35 + AP-39 — Produktionsmengen auf Füllgewicht + ±5 % Abwiegen

AP-35 (Mengenberechnung): Die Hersteller-Rezeptur ist in Prozent hinterlegt; die
Sollmengen skalieren jetzt auf das Füllgewicht statt fest auf ~100 g. Neuer
Faktor recipeGramScale = Füllgewicht/100. Basis = neues, optionales Produkt-Feld
"fill_weight" (g); ist es leer, gilt bei ml-Produkten (unit=1) die Füllmenge
(contents_total) als Gramm (1 g/ml). Ohne Massenbasis (z. B. Stück-Produkte)
bleibt es beim Altverhalten (Anteil = Gramm), sodass Bestandsprodukte/Tests
unverändert rechnen. Skala wird an die Maske durchgereicht (recipe_gram_scale),
damit Client und Server identisch rechnen (Service + 4 JS-Stellen).

AP-39 (Abwiegen): Die Ist-Menge je INCI muss nicht mehr aufs Gramm passen —
assertLinesMatchRecipe erlaubt ±5 % (kleiner absoluter Sockel), gebucht wird der
reale Ist-Wert. Status-Ampel in der Maske: Orange = nichts eingetragen,
Grün = eingetragen und ±5 %, Rot = >5 % daneben (Zahlendreher-Schutz).

Migration add_fill_weight_to_products auf Dev-/Live-DB ausgeführt (nullable).
Product fillable/cast + Produktformular-Feld ergänzt. 5 Tests, Suite 310 grün.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-08-27 14:36:52 +00:00
parent d60947c34d
commit 744b36cdcb
6 changed files with 238 additions and 11 deletions

View file

@ -530,6 +530,11 @@
<label class="form-label" for="contents_total">{{ __('Gesamter Inhalt (ml / g) als Zahl') }}</label>
{{ Form::text('contents_total', $product->contents_total, ['placeholder' => __('Bsp: 150'), 'class' => 'form-control', 'id' => 'contents_total']) }}
</div>
<div class="form-group col-sm-3">
<label class="form-label" for="fill_weight">{{ __('Füllgewicht (g) – für Produktion') }}</label>
{{ Form::text('fill_weight', $product->fill_weight, ['placeholder' => __('leer = Menge = Gramm (1 g/ml)'), 'class' => 'form-control', 'id' => 'fill_weight']) }}
<small class="form-text text-muted">{{ __('Basis für die Rezeptur-Mengenberechnung (Prozent × Füllgewicht).') }}</small>
</div>
<div class="form-group col-sm-2">
<label class="form-label" for="contents">{{ __('Grundpreis Einheit') }}</label>
{{ Form::select('unit', $product->unitTypes, $product->unit, ['data-live-search' => 'false', 'class' => 'selectpicker', 'id' => 'unit']) }}