Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 963eba1e84 | |||
| 48e55226f3 | |||
| 55c0e539b1 | |||
| 5ec7468b1c | |||
| 74b671586f |
@@ -1,6 +1,7 @@
|
|||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Com.Honeywell.Aidc;
|
using Com.Honeywell.Aidc;
|
||||||
using SteUp.Shared.Core.BarcodeReader.Dto;
|
using SteUp.Shared.Core.BarcodeReader.Dto;
|
||||||
|
using SteUp.Shared.Core.BarcodeReader.Enum;
|
||||||
|
|
||||||
namespace SteUp.Maui.Core.System;
|
namespace SteUp.Maui.Core.System;
|
||||||
|
|
||||||
@@ -87,13 +88,40 @@ public partial class HoneywellScannerService
|
|||||||
var dto = new BarcodeScanDto
|
var dto = new BarcodeScanDto
|
||||||
{
|
{
|
||||||
StringValue = e.BarcodeData,
|
StringValue = e.BarcodeData,
|
||||||
Type = e.CodeId,
|
Type = MapCodeId(e.CodeId),
|
||||||
Name = e.CodeId
|
Name = e.CodeId
|
||||||
};
|
};
|
||||||
|
|
||||||
OnScanSuccessful?.Invoke(dto);
|
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<string, Java.Lang.Object> GetDefaultProperties() => new()
|
private static Dictionary<string, Java.Lang.Object> GetDefaultProperties() => new()
|
||||||
{
|
{
|
||||||
{ BarcodeReader.PropertyEan8Enabled, true },
|
{ BarcodeReader.PropertyEan8Enabled, true },
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
<ApplicationId>it.integry.SteUp</ApplicationId>
|
<ApplicationId>it.integry.SteUp</ApplicationId>
|
||||||
|
|
||||||
<!-- Versions -->
|
<!-- Versions -->
|
||||||
<ApplicationDisplayVersion>1.1.0</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.1.1</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
|
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
|
||||||
<!-- <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">-->
|
<!-- <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">-->
|
||||||
|
|||||||
@@ -288,6 +288,7 @@
|
|||||||
new SaveRequestDto
|
new SaveRequestDto
|
||||||
{
|
{
|
||||||
LocalIdScheda = Scheda.Id,
|
LocalIdScheda = Scheda.Id,
|
||||||
|
ActivityId = Scheda.ActivityId,
|
||||||
ActivityTypeId = Scheda.ActivityTypeId,
|
ActivityTypeId = Scheda.ActivityTypeId,
|
||||||
CodJfas = Scheda.CodJfas,
|
CodJfas = Scheda.CodJfas,
|
||||||
CodMdep = CodMdep,
|
CodMdep = CodMdep,
|
||||||
@@ -296,8 +297,6 @@
|
|||||||
PersonaRif = Scheda.Responsabile,
|
PersonaRif = Scheda.Responsabile,
|
||||||
Barcodes = Scheda.Articoli.ConvertAll(x => x.Barcode),
|
Barcodes = Scheda.Articoli.ConvertAll(x => x.Barcode),
|
||||||
Scandeza = (ScadenzaEnum)Scheda.Scadenza,
|
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
|
ParentActivityId = SteupDataService.InspectionPageState.Ispezione.ActivityId
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
using Microsoft.Maui.Devices.Sensors;
|
||||||
using SteUp.Shared.Core.BarcodeReader.Contracts;
|
using SteUp.Shared.Core.BarcodeReader.Contracts;
|
||||||
|
using SteUp.Shared.Core.BarcodeReader.Dto;
|
||||||
|
using SteUp.Shared.Core.BarcodeReader.Enum;
|
||||||
using SteUp.Shared.Core.Messages.Scanner;
|
using SteUp.Shared.Core.Messages.Scanner;
|
||||||
|
|
||||||
namespace SteUp.Shared.Core.BarcodeReader;
|
namespace SteUp.Shared.Core.BarcodeReader;
|
||||||
@@ -19,14 +22,31 @@ public class BarcodeManager(
|
|||||||
scanner.Register(
|
scanner.Register(
|
||||||
onScanSuccessful: dto =>
|
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 =>
|
onScanFailed: ex => { messenger.Send(new ErrorScannerMessage(ex.Message)); }
|
||||||
{
|
|
||||||
messenger.Send(new ErrorScannerMessage(ex.Message));
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
scanner.Init(() => { scanner.ChangeSettings([("TRIGGER_SCAN_MODE", "ONE_SHOT")]); });
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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 class BarcodeScanDto
|
||||||
{
|
{
|
||||||
public string? StringValue { get; set; }
|
public string? StringValue { get; set; }
|
||||||
public string? Type { get; set; }
|
public BarcodeType? Type { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -8,6 +8,9 @@ public class SaveRequestDto
|
|||||||
[JsonPropertyName("localIdScheda")]
|
[JsonPropertyName("localIdScheda")]
|
||||||
public int? LocalIdScheda { get; set; }
|
public int? LocalIdScheda { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("activityId")]
|
||||||
|
public string? ActivityId { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("codMdep")]
|
[JsonPropertyName("codMdep")]
|
||||||
public string? CodMdep { get; set; }
|
public string? CodMdep { get; set; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user