- @if (SelectedShippingItem != null && SelectedShippingItem.ProductId.GetValueOrDefault(0) > 0)
+ @if (SelectedShippingItem is { ProductId: > 0 })
{
@SelectedShippingItem.Name
diff --git a/FruitBankHybrid.Shared/Pages/MeasuringIn.razor.cs b/FruitBankHybrid.Shared/Pages/MeasuringIn.razor.cs
index 549fc4f..093b7b8 100644
--- a/FruitBankHybrid.Shared/Pages/MeasuringIn.razor.cs
+++ b/FruitBankHybrid.Shared/Pages/MeasuringIn.razor.cs
@@ -26,11 +26,12 @@ namespace FruitBankHybrid.Shared.Pages
private List NotMeasuredShippings { get; set; } = null!;
private Shipping? SelectedShipping { get; set; }
- private ShippingDocument? SelectedShippingDocument { get; set; }
+ //private ShippingDocument? SelectedShippingDocument { get; set; }
private ShippingItem? SelectedShippingItem { get; set; }
protected bool BtnSaveEnabled { get; set; }
+ private List? _shippingItemsDataSource;
private List _measuringDates = null!;
protected override async Task OnInitializedAsync()
@@ -52,6 +53,9 @@ namespace FruitBankHybrid.Shared.Pages
SelectedShipping = NotMeasuredShippings.FirstOrDefault();
}
+ private static List? GetShippingItemsDataSource(Shipping? shipping)
+ => shipping?.ShippingDocuments?.SelectMany(sd => sd.ShippingItems!).OrderBy(si => si.Name).ToList() ?? null;
+
private async Task OnMeasuringDateChanged(DateTime selectedDateTime)
=> await RefreshShippingsFromDb(selectedDateTime);
@@ -67,12 +71,12 @@ namespace FruitBankHybrid.Shared.Pages
private void OnSelectedShippingChanged(SelectedDataItemChangedEventArgs eventArgs)
{
- SelectedShippingDocument = eventArgs.DataItem?.ShippingDocuments?.FirstOrDefault();
- }
+ var shipping = eventArgs.DataItem;
- private void OnSelectedShippingDocumentChanged(SelectedDataItemChangedEventArgs eventArgs)
- {
- SelectedShippingItem = eventArgs.DataItem?.ShippingItems?.FirstOrDefault();
+ PrepareShippingItems(shipping);
+
+ _shippingItemsDataSource = GetShippingItemsDataSource(shipping);
+ SelectedShippingItem = _shippingItemsDataSource?.FirstOrDefault();
}
private void OnSelectedShippingItemChanged(SelectedDataItemChangedEventArgs eventArgs)
@@ -86,31 +90,14 @@ namespace FruitBankHybrid.Shared.Pages
return;
}
- SelectedShippingDocument!.IsAllMeasured = SelectedShippingDocument.ShippingItems?.All(si => si.IsMeasured) ?? false;
+ //SelectedShippingDocument!.IsAllMeasured = SelectedShippingDocument.ShippingItems?.All(si => si.IsMeasured) ?? false;
+ shippingItem.ShippingDocument!.IsAllMeasured = shippingItem.ShippingDocument.ShippingItems?.All(si => si.IsMeasured) ?? false;
SelectedShipping!.IsAllMeasured = SelectedShipping.ShippingDocuments?.All(sd => sd.IsAllMeasured) ?? false;
var shippingDate = _measuringDates.FirstOrDefault(shipping => shipping.ShippingId == SelectedShipping.Id);
if (shippingDate != null) shippingDate.IsMeasured = SelectedShipping.IsAllMeasured;
- MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(shippingItem);
-
- //_logger.Info($"{shippingItem.ProductDto?.Tare}");
- shippingItem.ShippingItemPallets ??= new List(shippingItem.PalletsOnDocument);
- //if (shippingItem.ShippingItemPallets.Count >= shippingItem.PalletsOnDocument) return;
-
- for (var i = shippingItem.ShippingItemPallets.Count; i < shippingItem.PalletsOnDocument; i++)
- shippingItem.ShippingItemPallets.Add(new ShippingItemPallet
- {
- ShippingItemId = shippingItem.Id,
- PalletWeight = shippingItem.Pallet?.Weight ?? 0,
- TareWeight = shippingItem.ProductDto?.Tare?? 0,
-
- CreatorId = LoggedInModel.CustomerDto?.Id,
- ModifierId = LoggedInModel.CustomerDto?.Id
- });
-
- //if (shippingItem.Id == SelectedShippingItem?.Id) return;
- //await RefreshSelectedShippingItemMeasuredValuesFromDb(shippingItem.Id);
+ //PrepareShippingItems(SelectedShipping);
}
private async Task RefreshSelectedShippingItemMeasuredValuesFromDb(int shippingItemId)
@@ -120,7 +107,7 @@ namespace FruitBankHybrid.Shared.Pages
private void RefreshSelectedShippingItemMeasuredValuesFromDb(ShippingItem? shippingItemFromDb)
{
- if (SelectedShipping == null || SelectedShippingDocument == null || shippingItemFromDb == null) return;
+ if (SelectedShipping == null || SelectedShippingItem?.ShippingDocument == null || shippingItemFromDb == null) return;
//SelectedShippingItem.MeasuredQuantity = shippingItemFromDb.MeasuredQuantity;
//SelectedShippingItem.MeasuredNetWeight = shippingItemFromDb.MeasuredNetWeight;
@@ -128,7 +115,9 @@ namespace FruitBankHybrid.Shared.Pages
//SelectedShippingItem.IsMeasurable = shippingItemFromDb.IsMeasurable;
//SelectedShippingItem.IsMeasured = shippingItemFromDb.IsMeasured;
- SelectedShippingDocument.ShippingItems!.UpdateCollection(shippingItemFromDb, false);
+ SelectedShippingItem.ShippingDocument.ShippingItems?.UpdateCollection(shippingItemFromDb, false);
+ _shippingItemsDataSource?.UpdateCollection(shippingItemFromDb, false);
+
SelectedShippingItem = shippingItemFromDb;
StateHasChanged();
@@ -171,5 +160,36 @@ namespace FruitBankHybrid.Shared.Pages
//Nem végezhető el a mérés, nincs megadva a ProductId! Jelezze a vezetőségnek...
}
+ private void PrepareShippingItems(Shipping? shipping)
+ {
+ if (shipping?.ShippingDocuments == null) return;
+
+ foreach (var shippingShippingDocument in shipping.ShippingDocuments)
+ {
+ shippingShippingDocument.Shipping = shipping;
+ if (shippingShippingDocument.ShippingItems == null) continue;
+
+ foreach (var shippingItem in shippingShippingDocument.ShippingItems)
+ {
+ shippingItem.ShippingDocument = shippingShippingDocument;
+ MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(shippingItem);
+
+ shippingItem.ShippingItemPallets ??= new List(shippingItem.MeasuringCount);
+
+ for (var i = shippingItem.ShippingItemPallets.Count; i < shippingItem.MeasuringCount; i++)
+ {
+ shippingItem.ShippingItemPallets.Add(new ShippingItemPallet
+ {
+ ShippingItemId = shippingItem.Id,
+ PalletWeight = shippingItem.Pallet?.Weight ?? 0,
+ TareWeight = shippingItem.ProductDto?.Tare ?? 0,
+
+ CreatorId = LoggedInModel.CustomerDto?.Id,
+ ModifierId = LoggedInModel.CustomerDto?.Id
+ });
+ }
+ }
+ }
+ }
}
}
diff --git a/FruitBankHybrid.Shared/Services/SignalRs/FruitBankSignalRClient.cs b/FruitBankHybrid.Shared/Services/SignalRs/FruitBankSignalRClient.cs
index 6b09d7d..8436090 100644
--- a/FruitBankHybrid.Shared/Services/SignalRs/FruitBankSignalRClient.cs
+++ b/FruitBankHybrid.Shared/Services/SignalRs/FruitBankSignalRClient.cs
@@ -111,11 +111,11 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
public Task?> GetProductDtos()
=> GetAllAsync>(SignalRTags.GetProductDtos);
- public Task?> GetAllMeasuringProductDtos()
- => GetAllAsync>(SignalRTags.GetAllMeasuringProductDtos);
+ //public Task?> GetAllMeasuringProductDtos()
+ // => GetAllAsync>(SignalRTags.GetAllMeasuringProductDtos);
- public Task GetMeasuringProductDtoById(int productId)
- => GetByIdAsync(SignalRTags.GetMeasuringProductDtoById, productId);
+ public Task GetProductDtoById(int productId)
+ => GetByIdAsync(SignalRTags.GetMeasuringProductDtoById, productId);
#endregion Product
diff --git a/FruitBankHybrid.Web.Client/FruitBankHybrid.Web.Client.csproj b/FruitBankHybrid.Web.Client/FruitBankHybrid.Web.Client.csproj
index f453b39..7080fbe 100644
--- a/FruitBankHybrid.Web.Client/FruitBankHybrid.Web.Client.csproj
+++ b/FruitBankHybrid.Web.Client/FruitBankHybrid.Web.Client.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/FruitBankHybrid.Web/FruitBankHybrid.Web.csproj b/FruitBankHybrid.Web/FruitBankHybrid.Web.csproj
index ee14c32..da166b6 100644
--- a/FruitBankHybrid.Web/FruitBankHybrid.Web.csproj
+++ b/FruitBankHybrid.Web/FruitBankHybrid.Web.csproj
@@ -17,8 +17,8 @@
-
-
+
+
diff --git a/FruitBankHybrid/FruitBankHybrid.csproj b/FruitBankHybrid/FruitBankHybrid.csproj
index 9964a36..c4bbcc5 100644
--- a/FruitBankHybrid/FruitBankHybrid.csproj
+++ b/FruitBankHybrid/FruitBankHybrid.csproj
@@ -1,89 +1,94 @@
-
- net9.0-android;net9.0-ios
- $(TargetFrameworks);net9.0-windows10.0.19041.0
+
+ net9.0-android;net9.0-ios
+ $(TargetFrameworks);net9.0-windows10.0.19041.0
- Exe
- FruitBankHybrid
- true
- true
- enable
- false
- enable
+ Exe
+ FruitBankHybrid
+ true
+ true
+ enable
+ false
+ enable
-
- FruitBank Measuring
+
+ FruitBank Measuring
-
- com.companyname.blazorapp.1
+
+ com.companyname.blazorapp.1
-
- 1.0
- 1
+
+ 1.0
+ 1
-
- None
+
+ None
- 15.0
- 15.0
- 24.0
- 10.0.17763.0
- 10.0.17763.0
-
-
-
- true
-
-
-
- true
-
+ 15.0
+ 15.0
+ 33.0
+ 10.0.17763.0
+ 10.0.17763.0
+
-
-
-
-
-
+
+ false
+
-
-
-
+
+ true
+
-
-
+
+ true
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
- ..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll
-
-
- ..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.dll
-
-
- ..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll
-
-
+
+
+ ..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll
+
+
+ ..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.dll
+
+
+ ..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll
+
+