Warenwirtschaft: F-03 — Entwurf sichert Chargenzeilen verlustfrei

Entwürfe speichern batch_key roh (stock_entry_id nullable), keine Auflösung
und keine Filterung unfertiger Zeilen mehr beim Zwischenspeichern. Eine nicht
mehr verfügbare Charge wird im Formular markiert statt alle Zeilen zu verwerfen.
Ergebniszeilen dürfen im Entwurf ohne Stückzahl bleiben. Auflösung, Prüfung und
Buchung erst beim Abschluss.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-09-08 10:53:36 +00:00
parent 73512897ee
commit 859b1f083d
10 changed files with 200 additions and 41 deletions

View file

@ -85,24 +85,21 @@ class ProductionController extends Controller
}
/**
* AP-27/AP-43: Chargen-Zeilen auf Einzel-Wareneingänge auflösen. Im Entwurf
* darf das Auflösen scheitern (Charge nicht verfügbar) — dann bleiben nur die
* bereits konkret gewählten Wareneingänge erhalten, der Entwurf ist immer speicherbar.
* AP-27: Chargen-Zeilen auf Einzel-Wareneingänge auflösen (nur beim Abschluss).
* Prüfung 08.09.2026 F-03: Im Entwurf wird nicht aufgelöst — die Zeilen werden
* roh (batch_key) gesichert, damit eine nicht mehr verfügbare Charge nicht den
* gesamten Arbeitsstand verwirft. Aufgelöst und geprüft wird erst beim Abschluss.
*
* @param array<int, array<string, mixed>> $lines
* @return array<int, array<string, mixed>>
*/
private function expandLines(array $lines, int $locationId, ?int $excludeProductionId, bool $isDraft): array
{
if (! $isDraft) {
return $this->productionService->expandBatchLines($lines, $locationId, $excludeProductionId);
if ($isDraft) {
return $lines;
}
try {
return $this->productionService->expandBatchLines($lines, $locationId, $excludeProductionId);
} catch (ValidationException) {
return array_values(array_filter($lines, fn ($l) => (int) ($l['stock_entry_id'] ?? 0) > 0));
}
return $this->productionService->expandBatchLines($lines, $locationId, $excludeProductionId);
}
/**