Charge aufteilen: Teilmenge mit gleichem MHD an anderen Lagerort umlagern
Bisher liess sich nur die ganze Charge umlagern. Neu: POST /lots/{id}/split zweigt
eine Teilmenge (Basiseinheiten) als neue Charge mit gleichem MHD an einen anderen
Lagerort ab; der Rest bleibt. Reine Umbuchung ohne Bewegungseintrag, Gesamtbestand
unveraendert. Schutz gegen zu grosse Menge und gleichen Zielort.
Web: gemeinsamer SplitLotDialog (Menge in Artikeleinheit + Zielort, zeigt Rest),
Aufteilen-Knopf auf der Chargen-Seite und in der Chargen-Tabelle der Artikelseite.
Neues Split-Icon.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import LocationMinStock from "../components/LocationMinStock";
|
||||
import { DynamicFields, FIELD_TYPES } from "../fields";
|
||||
import ObjektBestand from "../components/ObjektBestand";
|
||||
import Einzelstuecke from "../components/Einzelstuecke";
|
||||
import SplitLotDialog from "../components/SplitLotDialog";
|
||||
import { locationOptions, locationPathById } from "../locationPath";
|
||||
import {
|
||||
daysUntil, expiryRowClass, fmt, fromMonthInput, gebinde, isExpired, relativeExpiry,
|
||||
@@ -1073,6 +1074,7 @@ function LotsCard({ product, lots, locations = [], baseShort, warnDays, isAdmin,
|
||||
const [draft, setDraft] = useState({ quantity: "", best_before: "", precision: "day", location_id: "" });
|
||||
// In welcher Einheit die Menge bearbeitet wird: "unit" oder "package".
|
||||
const [editUnit, setEditUnit] = useState("unit");
|
||||
const [splitLotItem, setSplitLotItem] = useState(null); // Charge, die aufgeteilt wird
|
||||
|
||||
const unitFactor = product?.unit_factor || 1;
|
||||
const unitName = product?.unit_name || baseShort;
|
||||
@@ -1248,6 +1250,10 @@ function LotsCard({ product, lots, locations = [], baseShort, warnDays, isAdmin,
|
||||
</div>
|
||||
) : (
|
||||
<div className="field-inline" style={{ justifyContent: "flex-end" }}>
|
||||
<button className="btn-icon" onClick={() => setSplitLotItem(l)}
|
||||
title="Charge aufteilen und Teil umlagern">
|
||||
<Icon name="split" size={16} />
|
||||
</button>
|
||||
<button className="btn-icon" onClick={() => startEdit(l)} title="Charge bearbeiten">
|
||||
<Icon name="edit" size={16} />
|
||||
</button>
|
||||
@@ -1267,6 +1273,18 @@ function LotsCard({ product, lots, locations = [], baseShort, warnDays, isAdmin,
|
||||
{pkgSize > 0 && (
|
||||
<p className="muted small">1 {pkgLabel} = {fmt(pkgSize)} {baseShort}</p>
|
||||
)}
|
||||
|
||||
{splitLotItem && (
|
||||
<SplitLotDialog
|
||||
lot={splitLotItem}
|
||||
factor={primaryFactor}
|
||||
labelFor={primaryLabel}
|
||||
locations={locations}
|
||||
onClose={() => setSplitLotItem(null)}
|
||||
onDone={onChanged}
|
||||
onError={onError}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user