Warenwirtschaft: F-04 — Rezeptur-Phase an Verbrauchszeilen, keine Vervielfachung beim Wiederöffnen
production_ingredients.recipe_phase_id; Formular sendet die Phase je Zeile, Vorbelegung je Rohstoff|Phase. Altbestand ohne Phase wird nur einmal eingesetzt. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
859b1f083d
commit
104671e929
8 changed files with 109 additions and 3 deletions
|
|
@ -41,6 +41,7 @@ class StoreProductionRequest extends FormRequest
|
|||
'ingredient_lines.*.ingredient_id' => ['nullable', 'integer', 'exists:ingredients,id'],
|
||||
'ingredient_lines.*.batch_key' => ['nullable', 'string', 'max:120'],
|
||||
'ingredient_lines.*.stock_entry_id' => ['nullable', 'integer', 'exists:stock_entries,id'],
|
||||
'ingredient_lines.*.recipe_phase_id' => ['nullable', 'integer', 'exists:recipe_phases,id'],
|
||||
'ingredient_lines.*.quantity_used' => ['nullable', 'string'],
|
||||
'outputs' => ['nullable', 'array'],
|
||||
'outputs.*.product_id' => ['nullable', 'integer', 'exists:products,id'],
|
||||
|
|
@ -63,6 +64,8 @@ class StoreProductionRequest extends FormRequest
|
|||
// AP-27: Das Formular übergibt Chargen (batch_key); Einzel-Einträge (stock_entry_id) bleiben unterstützt.
|
||||
'ingredient_lines.*.batch_key' => ['required_without:ingredient_lines.*.stock_entry_id', 'nullable', 'string', 'max:120'],
|
||||
'ingredient_lines.*.stock_entry_id' => ['required_without:ingredient_lines.*.batch_key', 'nullable', 'integer', 'exists:stock_entries,id'],
|
||||
// F-04: Phase der Rezepturzeile — nur zur Vorbelegung beim Wiederöffnen.
|
||||
'ingredient_lines.*.recipe_phase_id' => ['nullable', 'integer', 'exists:recipe_phases,id'],
|
||||
// Audit H-2: Vorzeichen-/Zahlprüfung — negative Zeilen konnten sich
|
||||
// in der Summenprüfung gegenseitig aufheben und Bestand aufblähen.
|
||||
'ingredient_lines.*.quantity_used' => ['required', 'string', function (string $attribute, mixed $value, \Closure $fail) {
|
||||
|
|
@ -120,6 +123,7 @@ class StoreProductionRequest extends FormRequest
|
|||
$out = [
|
||||
'ingredient_id' => (int) $line['ingredient_id'],
|
||||
'quantity_used' => $line['quantity_used'] ?? null,
|
||||
'recipe_phase_id' => ! empty($line['recipe_phase_id']) ? (int) $line['recipe_phase_id'] : null,
|
||||
];
|
||||
if (! empty($line['batch_key'])) {
|
||||
$out['batch_key'] = (string) $line['batch_key'];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue