Warenwirtschaft: AP-13 Shop-Bestandsabzug bei Versand (inkl. Sets)
ProductStockService::syncSaleStock(): idempotenter Differenz-Abgleich der Verkaufs-Abgänge (source='sale', Referenz = Bestellung) mit dem Versandstatus — Abzug je Bestellposition bei versendet/abgeschlossen, Sets rekursiv über product_set_items in Einzelprodukte aufgelöst; Zurücksetzen/Storno führt per Gegenbuchung zurück (behebt auch das Doppelabzug-Risiko Versand→Zurücksetzen→ Versand). Andockpunkte: SalesController::store (in der Transaktion) und PaymentReminderService (Auto-Storno per Cron). Verbrauch/Monat zählt Verkaufs-Abgänge automatisch mit (source != production). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
6b8fcadcbf
commit
211aeed384
4 changed files with 373 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ use App\Services\CustomerPriority;
|
|||
use App\Services\Invoice;
|
||||
use App\Services\Payment;
|
||||
use App\Services\PaymentService;
|
||||
use App\Services\ProductStockService;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Request;
|
||||
|
|
@ -485,6 +486,9 @@ class SalesController extends Controller
|
|||
$shopping_order->shopping_order_margin->save();
|
||||
}
|
||||
}
|
||||
|
||||
// AP-13: Verkaufs-Abgänge (Produktbestand) mit dem neuen Versandstatus abgleichen
|
||||
app(ProductStockService::class)->syncSaleStock($shopping_order, auth()->id());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue