diff --git a/Elwig/Services/DeliveryService.cs b/Elwig/Services/DeliveryService.cs index 5940afd..20dd656 100644 --- a/Elwig/Services/DeliveryService.cs +++ b/Elwig/Services/DeliveryService.cs @@ -444,6 +444,7 @@ namespace Elwig.Services { var date = DateOnly.ParseExact(vm.Date!, "dd.MM.yyyy"); int? newLnr = (deliveryNew || dateHasChanged) ? await ctx.NextLNr(date) : null; + string? newLsNr = (newLnr != null) ? Utils.GenerateLsNr(date, vm.Branch!.ZwstId, newLnr.Value) : null; string? newTimeString = null; if (partNew && timeIsDefault) { @@ -459,7 +460,7 @@ namespace Elwig.Services { TimeString = newTimeString ?? oldDelivery?.TimeString, LNr = newLnr ?? oldDelivery!.LNr, ZwstId = vm.Branch!.ZwstId, - LsNr = vm.LsNr!, + LsNr = newLsNr ?? vm.LsNr!, MgNr = (int)vm.MgNr!, Comment = string.IsNullOrEmpty(vm.Comment) ? null : vm.Comment, };