Fix scanner barcode per i plu
This commit is contained in:
@@ -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<string, Java.Lang.Object> GetDefaultProperties() => new()
|
||||
{
|
||||
{ BarcodeReader.PropertyEan8Enabled, true },
|
||||
|
||||
Reference in New Issue
Block a user