Warenwirtschaft: N-04 — Verpackungsvorschau zeigt bei unveränderten Ergebnissen den gespeicherten Snapshot
Bearbeitungsformular gebuchter Produktionen liefert Snapshot und Ergebnissummen; die Vorschau folgt derselben Regel wie die Speicherung (F-05) und weist auf eine Neuberechnung hin, sobald sich Produktsummen ändern. Tests N-01/N-02/N-04. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
313c6277ce
commit
9acb05380a
4 changed files with 182 additions and 1 deletions
|
|
@ -155,8 +155,22 @@ class ProductionController extends Controller
|
|||
|
||||
$defaultLocationId = $production->location_id;
|
||||
|
||||
// N-04 (Nachprüfung 08.09.2026): Bei gebuchter Produktion zeigt die Vorschau den
|
||||
// gespeicherten Verpackungs-Snapshot, solange die Ergebnissummen unverändert sind
|
||||
// (dieselbe Regel wie ProductionService::updateProduction, F-05).
|
||||
$production->loadMissing('productionPackagings.packagingItem');
|
||||
$packagingSnapshot = $production->isDraft() ? [] : $production->productionPackagings
|
||||
->map(fn ($row) => ['name' => $row->packagingItem?->name ?? ('#'.$row->packaging_item_id), 'pieces' => (int) $row->quantity_used])
|
||||
->values()->all();
|
||||
$initialOutputTotals = [];
|
||||
foreach ($production->outputs as $output) {
|
||||
$initialOutputTotals[(int) $output->product_id] = ($initialOutputTotals[(int) $output->product_id] ?? 0) + (int) $output->quantity;
|
||||
}
|
||||
|
||||
return view('admin.inventory.productions.edit', [
|
||||
'model' => $production,
|
||||
'packagingSnapshot' => $packagingSnapshot,
|
||||
'initialOutputTotals' => $initialOutputTotals,
|
||||
...$this->productCatalogs($production),
|
||||
'locations' => Location::query()->where('active', true)->orderBy('name')->get(),
|
||||
'defaultLocationId' => $defaultLocationId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue