From 74b671586f4e43bf31f73a3786f863336078aafc Mon Sep 17 00:00:00 2001 From: MarcoE Date: Wed, 22 Jul 2026 13:06:49 +0200 Subject: [PATCH 1/3] Fix duplicazione scheda quando si modificava --- .../Components/SingleElements/Modal/ModalFormScheda.razor | 3 +-- SteUp.Shared/Core/Dto/SaveRequestDto.cs | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor b/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor index 06cf54d..1d12fb1 100644 --- a/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor +++ b/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor @@ -288,6 +288,7 @@ new SaveRequestDto { LocalIdScheda = Scheda.Id, + ActivityId = Scheda.ActivityId, ActivityTypeId = Scheda.ActivityTypeId, CodJfas = Scheda.CodJfas, CodMdep = CodMdep, @@ -296,8 +297,6 @@ PersonaRif = Scheda.Responsabile, Barcodes = Scheda.Articoli.ConvertAll(x => x.Barcode), Scandeza = (ScadenzaEnum)Scheda.Scadenza, - // Aggancia la scheda all'ispezione GIA esistente sul server (se sincronizzata), - // altrimenti null e il server la crea. Evita di creare una nuova ispezione a ogni salvataggio. ParentActivityId = SteupDataService.InspectionPageState.Ispezione.ActivityId } ); diff --git a/SteUp.Shared/Core/Dto/SaveRequestDto.cs b/SteUp.Shared/Core/Dto/SaveRequestDto.cs index 7abc596..7b46e21 100644 --- a/SteUp.Shared/Core/Dto/SaveRequestDto.cs +++ b/SteUp.Shared/Core/Dto/SaveRequestDto.cs @@ -8,6 +8,9 @@ public class SaveRequestDto [JsonPropertyName("localIdScheda")] public int? LocalIdScheda { get; set; } + [JsonPropertyName("activityId")] + public string? ActivityId { get; set; } + [JsonPropertyName("codMdep")] public string? CodMdep { get; set; } From 5ec7468b1c78fc774a53577b6bc730f966f164d4 Mon Sep 17 00:00:00 2001 From: MarcoE Date: Wed, 22 Jul 2026 14:50:09 +0200 Subject: [PATCH 2/3] Fix scanner barcode per i plu --- .../Android/Core/HoneywellScannerService.cs | 30 +++++++- .../Core/BarcodeReader/BarcodeManager.cs | 30 ++++++-- .../Core/BarcodeReader/Dto/BarcodeScanDto.cs | 6 +- .../Core/BarcodeReader/Enum/BarcodeType.cs | 75 +++++++++++++++++++ 4 files changed, 133 insertions(+), 8 deletions(-) create mode 100644 SteUp.Shared/Core/BarcodeReader/Enum/BarcodeType.cs diff --git a/SteUp.Maui/Platforms/Android/Core/HoneywellScannerService.cs b/SteUp.Maui/Platforms/Android/Core/HoneywellScannerService.cs index c154f76..70ad78a 100644 --- a/SteUp.Maui/Platforms/Android/Core/HoneywellScannerService.cs +++ b/SteUp.Maui/Platforms/Android/Core/HoneywellScannerService.cs @@ -1,6 +1,7 @@ using Android.OS; using Com.Honeywell.Aidc; using SteUp.Shared.Core.BarcodeReader.Dto; +using SteUp.Shared.Core.BarcodeReader.Enum; namespace SteUp.Maui.Core.System; @@ -87,13 +88,40 @@ public partial class HoneywellScannerService var dto = new BarcodeScanDto { StringValue = e.BarcodeData, - Type = e.CodeId, + Type = MapCodeId(e.CodeId), Name = e.CodeId }; OnScanSuccessful?.Invoke(dto); } + // Honeywell restituisce il simbologia tramite un Code ID di un solo carattere (getCodeId), + // non un enum. Lo mappiamo su BarcodeType. Ai fini dell'app conta distinguere + // EAN13 / CODE128 / EAN128 (vedi BarcodeManager.IsEanPeso); il resto è best-effort. + private static BarcodeType MapCodeId(string? codeId) => codeId switch + { + "a" => BarcodeType.CODABAR, + "b" => BarcodeType.CODE39, + "c" => BarcodeType.UPCA, + "d" => BarcodeType.EAN13, + "D" => BarcodeType.EAN8, + "e" => BarcodeType.INTERLEAVED_2OF5, + "E" => BarcodeType.UPCE, + "g" => BarcodeType.MSI, + "h" => BarcodeType.CODE11, + "i" => BarcodeType.CODE93, + "j" => BarcodeType.CODE128, // Code 128 e GS1-128 condividono il Code ID 'j' + "I" => BarcodeType.EAN128, // alcune generazioni riportano GS1-128 come 'I' + "r" => BarcodeType.PDF417, + "R" => BarcodeType.MICRO_PDF417, + "s" => BarcodeType.QR, + "w" => BarcodeType.DATAMATRIX, + "x" => BarcodeType.MAXICODE, + "y" => BarcodeType.GS1_DATABAR_14, + "z" => BarcodeType.AZTEC, + _ => BarcodeType.NIL + }; + private static Dictionary GetDefaultProperties() => new() { { BarcodeReader.PropertyEan8Enabled, true }, diff --git a/SteUp.Shared/Core/BarcodeReader/BarcodeManager.cs b/SteUp.Shared/Core/BarcodeReader/BarcodeManager.cs index 3ec73de..ea9009e 100644 --- a/SteUp.Shared/Core/BarcodeReader/BarcodeManager.cs +++ b/SteUp.Shared/Core/BarcodeReader/BarcodeManager.cs @@ -1,5 +1,8 @@ using CommunityToolkit.Mvvm.Messaging; +using Microsoft.Maui.Devices.Sensors; using SteUp.Shared.Core.BarcodeReader.Contracts; +using SteUp.Shared.Core.BarcodeReader.Dto; +using SteUp.Shared.Core.BarcodeReader.Enum; using SteUp.Shared.Core.Messages.Scanner; namespace SteUp.Shared.Core.BarcodeReader; @@ -19,14 +22,31 @@ public class BarcodeManager( scanner.Register( onScanSuccessful: dto => { - messenger.Send(new NewScannerMessage(dto.StringValue)); + var stringValue = dto.StringValue; + + if (IsEanPeso(dto)) + stringValue = DecodeEanPeso(stringValue); + + messenger.Send(new NewScannerMessage(stringValue)); }, - onScanFailed: ex => - { - messenger.Send(new ErrorScannerMessage(ex.Message)); - } + onScanFailed: ex => { messenger.Send(new ErrorScannerMessage(ex.Message)); } ); scanner.Init(() => { scanner.ChangeSettings([("TRIGGER_SCAN_MODE", "ONE_SHOT")]); }); } + + private static bool IsEanPeso(BarcodeScanDto barcodeScan) => + (IsEtichetta128(barcodeScan) || IsEan13(barcodeScan)) && barcodeScan.StringValue is { Length: 13 } && + barcodeScan.StringValue.StartsWith('2'); + + private static bool IsEtichetta128(BarcodeScanDto barcodeScan) => + barcodeScan.Type is BarcodeType.CODE128 or BarcodeType.EAN128; + + private static bool IsEan13(BarcodeScanDto barcodeScan) => + barcodeScan.Type == BarcodeType.EAN13; + + private static string DecodeEanPeso(string? barcode) + { + return barcode is not { Length: 13 } ? throw new Exception("Errore durante il parse del barcode (" + barcode + ")") : barcode.Substring(1, 6); + } } \ No newline at end of file diff --git a/SteUp.Shared/Core/BarcodeReader/Dto/BarcodeScanDto.cs b/SteUp.Shared/Core/BarcodeReader/Dto/BarcodeScanDto.cs index 906ffde..8a6d35c 100644 --- a/SteUp.Shared/Core/BarcodeReader/Dto/BarcodeScanDto.cs +++ b/SteUp.Shared/Core/BarcodeReader/Dto/BarcodeScanDto.cs @@ -1,8 +1,10 @@ -namespace SteUp.Shared.Core.BarcodeReader.Dto; +using SteUp.Shared.Core.BarcodeReader.Enum; + +namespace SteUp.Shared.Core.BarcodeReader.Dto; public class BarcodeScanDto { public string? StringValue { get; set; } - public string? Type { get; set; } + public BarcodeType? Type { get; set; } public string? Name { get; set; } } \ No newline at end of file diff --git a/SteUp.Shared/Core/BarcodeReader/Enum/BarcodeType.cs b/SteUp.Shared/Core/BarcodeReader/Enum/BarcodeType.cs new file mode 100644 index 0000000..26a5e10 --- /dev/null +++ b/SteUp.Shared/Core/BarcodeReader/Enum/BarcodeType.cs @@ -0,0 +1,75 @@ +namespace SteUp.Shared.Core.BarcodeReader.Enum; + +public enum BarcodeType +{ + NIL = 0, + AIRLINE_2OF5_13_DIGIT = 1, + AIRLINE_2OF5_15_DIGIT = 2, + AZTEC = 3, + AUSTRALIAN_POSTAL = 4, + BOOKLAND_EAN = 5, + BPO = 6, + CANPOST = 7, + CHINAPOST = 8, + CHINESE_2OF5 = 9, + CODABAR = 10, + CODABLOCK = 11, + CODE11 = 12, + CODE128 = 13, + CODE16K = 14, + CODE32 = 15, + CODE39 = 16, + CODE49 = 17, + CODE93 = 18, + COMPOSITE = 19, + COUPON_CODE = 20, + DATAMATRIX = 21, + DISCRETE_2OF5 = 22, + DUTCH_POSTAL = 23, + EAN128 = 24, + EAN13 = 25, + EAN8 = 26, + GS1_DATABAR_14 = 27, + GS1_DATABAR_EXPANDED = 28, + GS1_DATABAR_LIMITED = 29, + HONGKONG_2OF5 = 30, + IATA_2OF5 = 31, + IDTAG = 32, + INTERLEAVED_2OF5 = 33, + ISBT128 = 34, + JAPANESE_POSTAL = 35, + KOREAN_POSTAL = 36, + MATRIX_2OF5 = 37, + MAXICODE = 38, + MESA = 39, + MICRO_PDF417 = 40, + MICRO_QR = 41, + MSI = 42, + NEC_2OF5 = 43, + OCR = 44, + PDF417 = 45, + PLESSEY = 46, + POSICODE = 47, + POST_US4 = 48, + QR = 49, + STRAIGHT_2OF5 = 50, + STANDARD_2OF5 = 51, + TELEPEN = 52, + TLCODE39 = 53, + TRIOPTIC = 54, + UK_POSTAL = 55, + UPCA = 56, + UPCE = 57, + UPCE1 = 58, + US_PLANET = 59, + US_POSTNET = 60, + USPS_4CB = 61, + RSS = 62, + LABEL = 63, + HANXIN = 64, + GRIDMATRIX = 65, + INFO_MAIL = 66, + INTELLIGENT_MAIL = 67, + SWEDENPOST = 68, + LAST = 69 +} \ No newline at end of file From 55c0e539b12c9ffc83b78ca21dd4bdb148f387cd Mon Sep 17 00:00:00 2001 From: MarcoE Date: Wed, 22 Jul 2026 14:50:54 +0200 Subject: [PATCH 3/3] -> v1.1.1 (5) --- SteUp.Maui/SteUp.Maui.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SteUp.Maui/SteUp.Maui.csproj b/SteUp.Maui/SteUp.Maui.csproj index c840cb9..7fb525a 100644 --- a/SteUp.Maui/SteUp.Maui.csproj +++ b/SteUp.Maui/SteUp.Maui.csproj @@ -30,8 +30,8 @@ it.integry.SteUp - 1.1.0 - 4 + 1.1.1 + 5 15.0