diff --git a/SteUp.Maui/SteUp.Maui.csproj b/SteUp.Maui/SteUp.Maui.csproj
index 96ca097..99fb7f2 100644
--- a/SteUp.Maui/SteUp.Maui.csproj
+++ b/SteUp.Maui/SteUp.Maui.csproj
@@ -30,8 +30,8 @@
it.integry.SteUp
- 1.2.3
- 9
+ 1.2.4
+ 10
15.0
@@ -116,12 +116,12 @@
-
-
+
+
-
+
diff --git a/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor b/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor
index 5e3de39..f1c9f65 100644
--- a/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor
+++ b/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor
@@ -896,29 +896,32 @@
var modal = await WithChildDialog(() => Dialog.OpenSelectArt(articoli));
+ // Gli articoli si aggiungono sul thread della UI, come fanno le scansioni:
+ // toccare Scheda.Articoli da qui mentre arriva una lettura (o mentre la
+ // lista viene disegnata) puo' far perdere articoli.
await InvokeAsync(() =>
{
OnLoading = false;
TextLoading = null;
+ if (modal is { Canceled: false, Data: List articoliSelezionati })
+ {
+ // Quelli gia' sparati non si aggiungono di nuovo.
+ Scheda.Articoli.InsertRange(0, articoliSelezionati
+ .DistinctBy(x => x.Barcode)
+ .Where(x => !ContainsBarcode(x.Barcode))
+ .Select(x => new SchedaArticolo
+ {
+ Barcode = x.Barcode,
+ Descrizione = x.Descrizione
+ })
+ );
+
+ RecalcDirty();
+ }
+
StateHasChanged();
});
-
- if (modal is { Canceled: false, Data: List articoliSelezionati })
- {
- Scheda.Articoli.InsertRange(0, articoliSelezionati.ConvertAll(x => new SchedaArticolo
- {
- Barcode = x.Barcode,
- Descrizione = x.Descrizione
- })
- );
-
- await InvokeAsync(() =>
- {
- RecalcDirty();
- StateHasChanged();
- });
- }
});
}
@@ -984,7 +987,7 @@
try
{
if (value is null) return;
- if (Scheda.Articoli.Any(x => x.Barcode.Equals(value))) return;
+ if (ContainsBarcode(value)) return;
await InvokeAsync(() =>
{
@@ -999,6 +1002,11 @@
OnLoading = false;
StateHasChanged();
+ // Il controllo va ripetuto sul barcode restituito: il server puo' rispondere
+ // con un barcode diverso da quello letto (lo stesso gia' scelto dalla griglia),
+ // e due letture ravvicinate superano entrambe il controllo iniziale.
+ if (art != null && ContainsBarcode(art.Barcode)) return;
+
if (art != null)
{
Scheda.Articoli.Insert(0, new SchedaArticolo
@@ -1032,6 +1040,8 @@
private void OnErrorScan(string? value) => OnError(new Exception(value), value);
+ private bool ContainsBarcode(string barcode) => Scheda.Articoli.Any(x => x.Barcode.Equals(barcode));
+
#endregion
private void OnError(Exception? e, string? errorMessage)
diff --git a/SteUp.Shared/SteUp.Shared.csproj b/SteUp.Shared/SteUp.Shared.csproj
index 297ae74..6107cce 100644
--- a/SteUp.Shared/SteUp.Shared.csproj
+++ b/SteUp.Shared/SteUp.Shared.csproj
@@ -11,13 +11,13 @@
-
+
-
+
diff --git a/SteUp.Web/SteUp.Web.csproj b/SteUp.Web/SteUp.Web.csproj
index 56b2975..8a71632 100644
--- a/SteUp.Web/SteUp.Web.csproj
+++ b/SteUp.Web/SteUp.Web.csproj
@@ -7,7 +7,7 @@
-
+