Warenwirtschaft: AP-37 — Rohstoffbestand „Enthalten in" nicht mehr doppelt
Jedes Produkt trägt einen Rohstoff i. d. R. in zwei product_ingredients-Zeilen (recipe_type manufacturer + product); die belongsToMany-Relation Ingredient::products lieferte das Produkt dadurch doppelt in der „Enthalten in"-Box. In RawMaterialStockController::show() die Produktliste nach ID dedupliziert (setRelation), wovon auch der abgeleitete Produktbestand profitiert. Reine Anzeige-Korrektur, Pivot-Daten unangetastet. Test ergänzt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5c5078bf64
commit
00be848604
2 changed files with 34 additions and 0 deletions
|
|
@ -88,6 +88,12 @@ class RawMaterialStockController extends Controller
|
|||
'products' => fn ($q) => $q->where('active', true),
|
||||
]);
|
||||
|
||||
// AP-37: Jedes Produkt hat i. d. R. zwei product_ingredients-Zeilen
|
||||
// (recipe_type „manufacturer" + „product"), wodurch die belongsToMany-
|
||||
// Relation dasselbe Produkt doppelt liefert. Für die „Enthalten in"-Anzeige
|
||||
// (und den darauf basierenden Produktbestand) nach Produkt-ID deduplizieren.
|
||||
$ingredient->setRelation('products', $ingredient->products->unique('id')->values());
|
||||
|
||||
// AP-27: Chargen je batch_number zusammengeführt (jeder Einkauf bleibt eigener stock_entry).
|
||||
$chargeGroups = $this->inventoryService->chargeGroupsForIngredient($ingredient->id);
|
||||
// Audit H-1: Kopfwert aus der Gesamt-Aggregation (zieht auch Ausschuss
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue