Offene Chargen mit Zielmenge korrigieren

This commit is contained in:
gitea_admin committed 2026-09-08 09:18:31 +02:00
1 parent 584d941c03
commit 28fa29f294
3 files changed
+27 -2

No files matched your search

+4 -2
View File
@@ -343,6 +343,8 @@ function update_stock_lot_traceability(
"SELECT COALESCE(SUM(CASE
WHEN move_type = 'in' THEN qty
WHEN move_type = 'out' THEN -qty
WHEN move_type = 'adjustment' AND to_location_id IS NOT NULL AND from_location_id IS NULL THEN qty
WHEN move_type = 'adjustment' AND from_location_id IS NOT NULL AND to_location_id IS NULL THEN -qty
ELSE 0
END), 0)
FROM stock_move
@@ -351,8 +353,8 @@ function update_stock_lot_traceability(
$balanceStmt->execute([':lot_id' => $lotId]);
$quantityDelta = $targetQty - (float) $balanceStmt->fetchColumn();
$receiptQty = $quantityDelta > 0 ? $quantityDelta : 0.0;
$outQty = $quantityDelta < 0 ? abs($quantityDelta) : 0.0;
$adjustmentQty = 0.0;
$outQty = 0.0;
$adjustmentQty = $quantityDelta < 0 ? $quantityDelta : 0.0;
}
if (($adjustmentQty !== 0.0 || $outQty > 0) && (string) $before['status'] !== 'current' && $targetQty === null) {