Warenwirtschaft: AP-43 — Produktion zwischenspeichern (Entwurf) + „abschließen"
Der Speicher-Button heißt jetzt „Produktion abschließen"; daneben gibt es „Zwischenspeichern (Entwurf)". Ein Entwurf sichert den Stand ohne Pflichtfeld- und ohne Bestandsprüfung und bucht KEINEN Bestand (Roh-/Produkt-/Verpackung). Erst „abschließen" prüft vollständig und bucht. - Migration: productions.status (default 'completed'; Bestand ist bereits gebucht). - Production-Model: STATUS_DRAFT/COMPLETED, isDraft(), scopeBooked(). - InventoryService: Entwürfe fallen aus allen Verbrauchs-/Bestandsjoins heraus (status != draft an den 4 productions-Joins). - ProductionService store()/updateProduction() bekommen $draft: Entwurf überspringt Rezeptur-/Mengen-/Bestandsprüfung + Buchungen, sichert nur vollständige Chargen-Zeilen (filterCompleteLines) und die angegebenen Outputs. Ein abgeschlossene Produktion kann NICHT zurück in den Entwurf (sonst verwaisen die Buchungen) — Guard wirft ValidationException. - StoreProductionRequest: save_mode=draft => nur Kopfdaten Pflicht, Chargen/ Ergebnis optional; validatedPayload filtert unvollständige Zeilen/Outputs. - Controller: Entwurf löst Chargen tolerant auf (nicht auflösbare Chargen werden übersprungen, Entwurf ist immer speicherbar) und leitet zur Bearbeitung zurück. - Views: create/edit „abschließen" + „Zwischenspeichern"-Button (nur solange Entwurf); Entwurf-Badge in Liste + Bearbeiten-Kopf. Tests: 5 neue (kein Produktbestand, kein Rohstoffverbrauch, Abschluss bucht, Rück-Entwurf verboten, HTTP-Entwurf ohne Ergebnis ok / Abschluss erzwingt Ergebnis). Migration auf Dev-/Live-DB. Suite 336 grün. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
3d19f743b1
commit
abd202a02e
10 changed files with 445 additions and 44 deletions
|
|
@ -9,7 +9,9 @@
|
|||
@csrf
|
||||
@include('admin.inventory.productions._form_fields', ['isEdit' => false])
|
||||
|
||||
<button type="submit" class="btn btn-primary" id="btn-submit-production">{{ __('Produktion speichern') }}</button>
|
||||
<button type="submit" name="save_mode" value="complete" class="btn btn-primary" id="btn-submit-production">{{ __('Produktion abschließen') }}</button>
|
||||
{{-- AP-43: Zwischenspeichern als Entwurf — ohne Pflichtfeld-/Bestandsprüfung, bucht keinen Bestand. --}}
|
||||
<button type="submit" name="save_mode" value="draft" class="btn btn-outline-primary" id="btn-save-draft" formnovalidate>{{ __('Zwischenspeichern (Entwurf)') }}</button>
|
||||
<a href="{{ route('admin.inventory.productions.index') }}" class="btn btn-outline-secondary">{{ __('Abbrechen') }}</a>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
@extends('layouts.layout-2')
|
||||
|
||||
@section('content')
|
||||
<h4 class="font-weight-bold py-2 mb-2">{{ __('Produktion bearbeiten') }} #{{ $model->id }}</h4>
|
||||
<h4 class="font-weight-bold py-2 mb-2">
|
||||
{{ __('Produktion bearbeiten') }} #{{ $model->id }}
|
||||
@if ($model->isDraft())
|
||||
<span class="badge badge-warning align-middle ml-1">{{ __('Entwurf') }}</span>
|
||||
@endif
|
||||
</h4>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
|
@ -10,7 +15,11 @@
|
|||
@method('PUT')
|
||||
@include('admin.inventory.productions._form_fields', ['isEdit' => true])
|
||||
|
||||
<button type="submit" class="btn btn-primary" id="btn-submit-production">{{ __('Produktion speichern') }}</button>
|
||||
<button type="submit" name="save_mode" value="complete" class="btn btn-primary" id="btn-submit-production">{{ __('Produktion abschließen') }}</button>
|
||||
{{-- AP-43: „Zwischenspeichern" nur solange die Produktion noch nicht gebucht ist (Entwurf). --}}
|
||||
@if ($model->isDraft())
|
||||
<button type="submit" name="save_mode" value="draft" class="btn btn-outline-primary" id="btn-save-draft" formnovalidate>{{ __('Zwischenspeichern (Entwurf)') }}</button>
|
||||
@endif
|
||||
<a href="{{ route('admin.inventory.productions.show', $model) }}" class="btn btn-outline-secondary">{{ __('Abbrechen') }}</a>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,12 @@
|
|||
@endif
|
||||
</td>
|
||||
<td data-sort="{{ $row->produced_at?->timestamp ?? 0 }}">{{ $row->produced_at?->format('d.m.Y') }}</td>
|
||||
<td><span class="wawi-item-name">{{ $row->product?->name ?? '—' }}</span></td>
|
||||
<td>
|
||||
<span class="wawi-item-name">{{ $row->product?->name ?? '—' }}</span>
|
||||
@if($row->isDraft())
|
||||
<span class="badge badge-warning ml-1">{{ __('Entwurf') }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{-- AP-28: reale Outputs statt Planungs-Stückzahl --}}
|
||||
@if($row->outputs->isNotEmpty())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue