|
|
@@ -22,12 +22,14 @@ public enum ScannerMode
|
|
|
Delivery = 2,
|
|
|
Setout = 4,
|
|
|
ManufacturingPacket = 8,
|
|
|
- Product = 16
|
|
|
+ Product = 16,
|
|
|
+
|
|
|
+ All = ScannerMode.Equipment | ScannerMode.Delivery | ScannerMode.Setout | ScannerMode.ManufacturingPacket | ScannerMode.Product
|
|
|
}
|
|
|
|
|
|
public partial class ScannerViewModel : ModuleViewModel
|
|
|
{
|
|
|
- public override string Title => "Equipment Scanner";
|
|
|
+ public override string Title => "Scanner";
|
|
|
|
|
|
[ObservableProperty]
|
|
|
private bool _cameraEnabled;
|
|
|
@@ -43,6 +45,9 @@ public partial class ScannerViewModel : ModuleViewModel
|
|
|
|
|
|
private (ScannerMode Mode, Func<BarcodeResult, Task<IScanResult?>> Func)[] Modes;
|
|
|
|
|
|
+ [ObservableProperty]
|
|
|
+ private bool _scannerVisible = true;
|
|
|
+
|
|
|
public ScannerViewModel()
|
|
|
{
|
|
|
Modes = [
|
|
|
@@ -110,7 +115,7 @@ public partial class ScannerViewModel : ModuleViewModel
|
|
|
{
|
|
|
var results = new List<IScanResult>();
|
|
|
var modes = Modes.Where(x => Mode.HasFlag(x.Mode)).ToArray();
|
|
|
- foreach(var barcode in result)
|
|
|
+ foreach(var barcode in result.ToArray())
|
|
|
{
|
|
|
var tasks = modes.ToArray(x => x.Func(barcode));
|
|
|
await Task.WhenAll(tasks);
|
|
|
@@ -118,11 +123,15 @@ public partial class ScannerViewModel : ModuleViewModel
|
|
|
}
|
|
|
if(results.Count == 1)
|
|
|
{
|
|
|
+ Vibration.Vibrate();
|
|
|
await results[0].Continue();
|
|
|
}
|
|
|
else if(results.Count > 1)
|
|
|
{
|
|
|
+ Vibration.Vibrate();
|
|
|
+ ScannerVisible = false;
|
|
|
var choice = await OptionDialog.Execute("Choose Item:", results.ToArray(x => x.Name));
|
|
|
+ ScannerVisible = true;
|
|
|
var selected = choice is not null ? results.FirstOrDefault(x => x.Name == choice) : null;
|
|
|
if(selected is not null)
|
|
|
{
|
|
|
@@ -177,7 +186,6 @@ public partial class ScannerViewModel : ModuleViewModel
|
|
|
|
|
|
private Task OpenSetout(SetoutShell shell)
|
|
|
{
|
|
|
- Vibration.Vibrate();
|
|
|
Navigation.Navigate<ManufacturingDesignDetailsViewModel>(model =>
|
|
|
{
|
|
|
model.Shell = shell;
|
|
|
@@ -206,7 +214,6 @@ public partial class ScannerViewModel : ModuleViewModel
|
|
|
|
|
|
private Task OpenManufacturingPacket(ManufacturingPacketShell shell)
|
|
|
{
|
|
|
- Vibration.Vibrate();
|
|
|
Navigation.Navigate<ManufacturingPacketDetailsViewModel>(model =>
|
|
|
{
|
|
|
model.Shell = shell;
|
|
|
@@ -242,7 +249,6 @@ public partial class ScannerViewModel : ModuleViewModel
|
|
|
|
|
|
private Task OpenDelivery(DeliveryShell shell)
|
|
|
{
|
|
|
- Vibration.Vibrate();
|
|
|
Navigation.Navigate<DeliveryViewModel>(model =>
|
|
|
{
|
|
|
model.Delivery = shell;
|
|
|
@@ -277,7 +283,6 @@ public partial class ScannerViewModel : ModuleViewModel
|
|
|
|
|
|
private Task OpenEquipment(EquipmentShell shell)
|
|
|
{
|
|
|
- Vibration.Vibrate();
|
|
|
Navigation.Navigate<EquipmentDetailsViewModel>(model =>
|
|
|
{
|
|
|
model.Shell = shell;
|