Commit 769ff595 authored by 姜春辉's avatar 姜春辉

优化登记流程

parent 612a66f7
......@@ -91,10 +91,6 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
try
{
var result = JsonConvert.DeserializeObject<FaceValidateResult>(e.Message);
if (result != null)
{
MainShell.ShowPrompt($"score:{result.score}");
}
if (result?.result != null &&
result.score >= LocalSetting.AddonDefaultConfig.FaceMinValue)
{
......@@ -198,8 +194,8 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
{
if (result == 1)
_faceWebSocket?.Send(_currentFeature, 0, _currentFeature.Length);
else
MainShell.ShowPrompt($"面部识别失败,正在重试...");
//else
// MainShell.ShowPrompt($"面部识别失败,正在重试...");
}
}
}
......@@ -221,6 +217,11 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
ShowView();
}
public void Alert(string msg, Action callback)
{
VM.Alert(msg, callback);
}
private void VM_OnNavigateOut()
{
_AuthSuccessCallback = null;
......@@ -229,6 +230,8 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
ThirdAddon.FaceRecognization.UnRegistOutPutMatEvent(VideoOut);
_waiter.Reset();
MainShell.RemoveWindowKeyUp(WindowKeyUp);
VM.ShowAlert = false;
VM.AlertMessage = "";
}
private void VM_OnNavigateInto()
......@@ -282,21 +285,33 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
private async void _SecondCardRead()
{
int faildTimes = 0;
while (!_CTS.IsCancellationRequested)
{
_waiter.WaitOne();
var readResult =
ThirdAddon.DeviceManager.CallDeviceByTypeWithDynamic("Second", "true");
DeviceManager.CallDeviceByTypeWithDynamic("Second", "true");
if (readResult != null)
{
string cardid = readResult.cardid;
if (string.IsNullOrEmpty(cardid))
{
MainShell.ShowPrompt("二代证读取异常,请重新刷二代证");
faildTimes++;
Program._Context.Logger.Error($"未读取到二代证芯片号{readResult.number}", null);
if (faildTimes >= 10)
{
//连续10次读取失败,终止尝试,提示错误
VM.Alert("二代证读取失败,请尝试其他认证方式", () =>
{
VM_OnExitClick();
});
_waiter.Reset();
}
await Task.Delay(200);
continue;
}
faildTimes = 0;
//读二代证大概有600到700毫秒的延迟,所以回调前再次验证一下验证方式是否变更
if (VM.AuthMode == ViewModels.Pages.AuthenticationPage.AuthenticationMode.IdCard)
{
......
using GS.Terminal.VisitorSelfService.LocalDB;
using GS.Terminal.VisitorSelfService.Logic.Remote.Models;
using GS.Terminal.VisitorSelfService.Logic.ThirdAddon;
using GS.Unitive.Framework.Data.Xpo;
using System;
......@@ -17,6 +18,18 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
{
VM.OnMenuItemClick += VM_OnMenuItemClick;
VM.OnNavigateInto += VM_OnNavigateInto;
//凌晨刷新本地统计
RefreshSummaryTask();
}
private void RefreshSummaryTask()
{
Task.Run(async () =>
{
await Task.Delay(DateTime.Today.AddDays(1).AddMinutes(1) - DateTime.Now);
await Summary();
RefreshSummaryTask();
});
}
private void VM_OnNavigateInto(LogicShell.Interface.IViewModel obj)
......@@ -48,7 +61,12 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
//((dynamic)data).cardid 身份证芯片号
//((dynamic)data).poto 身份证照片
MainShell.ShowLoading("正在查找");
var findResult = await Find(mode == AuthenticationMode.IdCard ? ((dynamic)data).number : data.ToString(), mode);
var findResult = new List<Appointment>();
await Task.WhenAll(Task.Run(async () =>
{
findResult = await Find(mode == AuthenticationMode.IdCard ? ((dynamic)data).number : data.ToString(), mode);
}), Task.Delay(1500));//增加最低等待时间
MainShell.HideLoading();
if (findResult?.Count > 0)
{
......@@ -58,7 +76,12 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
}
else
{
MainShell.ShowPrompt($"没有找到有效的预约单");
//MainShell.ShowPrompt($"没有找到有效的预约单");
Handlers.GetHandler<AuthenticationPageHandler>()?.Alert("没有找到有效的预约单", () =>
{
ShowView();
});
return true;
}
return findResult?.Count > 0;
}
......@@ -77,15 +100,15 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
return true;
}
private void Summary()
private async Task Summary()
{
Task.Run(() =>
{
var session = Program._ObjectSpace.Session;
var query = session.Query<自助登记流水>();
var count = query.Count(ss => ss.CreationTime.Date == DateTime.Now.Date);
VM.TodayPerson = count;
});
await Task.Run(() =>
{
var session = Program._ObjectSpace.Session;
var query = session.Query<自助登记流水>();
var count = query.Count(ss => ss.CreationTime.Date == DateTime.Now.Date);
VM.TodayPerson = count;
});
}
}
}
......@@ -18,7 +18,7 @@ namespace GS.Terminal.VisitorSelfService.Logic
internal static IAddonContext _Context;
internal static IObjectSpace _ObjectSpace;
internal static Locator vmLocator;
internal static string _logicVersion = "0815.11";
internal static string _logicVersion = "0819.16";
public void Start(IAddonContext Context)
{
......
......@@ -86,6 +86,35 @@ namespace ViewModels.Pages.AuthenticationPage
set { _EnableQRCode = value; RaisePropertyChanged("EnableQRCode"); }
}
private bool _ShowAlert;
public bool ShowAlert
{
get { return _ShowAlert; }
set { _ShowAlert = value; RaisePropertyChanged("ShowAlert"); }
}
private string _AlertMessage;
public string AlertMessage
{
get { return _AlertMessage; }
set { _AlertMessage = value; RaisePropertyChanged("AlertMessage"); }
}
private event Action AlertCloseCallback;
public RelayCommand CloseAlertCommand => new RelayCommand(() =>
{
ShowAlert = false;
try { AlertCloseCallback?.Invoke(); } catch { }
AlertMessage = "";
});
public void Alert(string msg, Action closeCallback)
{
AlertMessage = msg;
AlertCloseCallback = closeCallback;
ShowAlert = true;
}
public void Reset()
......
......@@ -33,5 +33,21 @@
Command="{Binding ExitCommand}"
Width="250" Height="60" Content="退出" Foreground="#2a2b2d" FontSize="24" Focusable="False"/>
</Grid>
<Border Background="Transparent" Visibility="{Binding ShowAlert, Converter={StaticResource BooleanToVisibilityConverter}}">
<Border Height="420" Background="White"
BorderThickness="6" CornerRadius="15" BorderBrush="#f1f1f1"
Margin="50,0,50,50" Padding="50">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="140"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding AlertMessage}" FontSize="48"
HorizontalAlignment="Center" VerticalAlignment="Center"
TextWrapping="Wrap"/>
<gs:ImageButton Command="{Binding CloseAlertCommand}" Grid.Row="1" Width="320" ImgPath="/Views;component/Resources/btn_ikonw.png"/>
</Grid>
</Border>
</Border>
</Grid>
</Page>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment