Commit e23d7924 authored by 姜春辉's avatar 姜春辉

增加登记前管理员刷卡确认操作,管理员卡在Logic插件配置文件中配置

parent 769ff595
......@@ -4,7 +4,9 @@ using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows;
......@@ -19,9 +21,49 @@ namespace GS.Terminal.VisitorSelfService
{
DispatcherHelper.Initialize();
}
///<summary>
/// 该函数设置由不同线程产生的窗口的显示状态
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="cmdShow">指定窗口如何显示。查看允许值列表,请查阅ShowWlndow函数的说明部分</param>
/// <returns>如果函数原来可见,返回值为非零;如果函数原来被隐藏,返回值为零</returns>
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
/// <summary>
/// 该函数将创建指定窗口的线程设置到前台,并且激活该窗口。键盘输入转向该窗口,并为用户改各种可视的记号。
/// 系统给创建前台窗口的线程分配的权限稍高于其他线程。
/// </summary>
/// <param name="hWnd">将被激活并被调入前台的窗口句柄</param>
/// <returns>如果窗口设入了前台,返回值为非零;如果窗口未被设入前台,返回值为零</returns>
[DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
private const int SW_SHOWNOMAL = 1;
internal static void HandleRunningInstance(Process instance)
{
ShowWindowAsync(instance.MainWindowHandle, SW_SHOWNOMAL);//显示
SetForegroundWindow(instance.MainWindowHandle);//当到最前端
}
protected override void OnStartup(StartupEventArgs e)
{
#region 检查重复启动
Process[] pro = Process.GetProcesses();
var process = pro.Where(p => p.ProcessName.Equals(Process.GetCurrentProcess().ProcessName));
int n = process.Count();
if (n > 1)
{
MessageBox.Show("程序已经启动,请勿重复启动", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
HandleRunningInstance(process.FirstOrDefault());
Current.Shutdown();
return;
}
#endregion
Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
AddonRuntime addonRuntime = new AddonRuntime();
addonRuntime.Start();
......
......@@ -51,5 +51,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
......@@ -7,6 +7,7 @@
<Key Caption="心跳端口" Name="HeartPort" Value="18083"/>
<Key Caption="重复登记提示" Name="RepeatMessage" Value="你已经完成确认,欢迎进入海信大厦"/>
<Key Caption="远程认证地址" Name="FaceWebSocket" Value="ws://192.168.1.7:15055/face/sdk2?persontype=访客"/>
<Key Caption="管理员卡片" Name="AdminCard" Value="EEEE,FFF,AAAAA,DDDDD" />
</Dict>
<Dict Caption="识别方式配置" Name="authenticationconfig">
<Key Caption="人脸识别" Name="EnableFace" Value="false"/>
......
......@@ -9,6 +9,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ViewModels.Pages.AppointmentDetailPage;
......@@ -18,13 +19,26 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
Corebase<ViewModel>
{
private IViewModel _ExitView;
private CancellationTokenSource _ConfirmCTS;
private Task _ConfirmTask;
public override void Init()
{
VM.OnExitClick += VM_OnExitClick;
VM.OnConfirmYesClick += VM_OnConfirmYesClick;
VM.OnConfirmNoClick += VM_OnConfirmNoClick;
VM.OnSubmitClick += VM_OnSubmitClick;
}
private void VM_OnConfirmNoClick()
{
if (_ConfirmCTS != null)
{
_ConfirmCTS.Cancel();
while (_ConfirmTask.Status == TaskStatus.Running)
Task.Delay(100).Wait();
}
}
private void VM_OnSubmitClick(AppointmentItem obj)
{
if (obj != null && obj.todayvisittimes > 0)
......@@ -35,6 +49,32 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
}
else
{
//判断是否需要确认
if (!string.IsNullOrEmpty(LocalSetting.AddonDefaultConfig.AdminCard))
{
VM.ConfirmYesEnable = false;
_ConfirmCTS = new CancellationTokenSource();
_ConfirmTask = Task.Run(async () =>
{
while (!_ConfirmCTS.IsCancellationRequested)
{
var cardNum = DeviceManager.SerialReaderTouch();
if (!string.IsNullOrEmpty(cardNum))
{
if (LocalSetting.AddonDefaultConfig.AdminCard.Contains(cardNum))
{
VM.ConfirmYesEnable = true;
break;
}
else
{
MainShell.ShowPrompt("无效卡");
}
}
await Task.Delay(100);
}
}, _ConfirmCTS.Token);
}
VM.ShowConfirm = true;
}
}
......@@ -116,11 +156,14 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
return false;
}
private void VM_OnExitClick()
{
ThirdAddon.LogicShell.ShowView(_ExitView ?? vmLocator.MenuPage);
VM.Reset();
_ExitView = null;
VM.ShowConfirm = false;
VM_OnConfirmNoClick();
}
string _secondcardid = "";
byte[] _secondcardphoto = null;
......
......@@ -14,7 +14,7 @@ namespace GS.Terminal.VisitorSelfService.Logic
AppConfig = LocalSettingLoader.Load<AppConfig>(Program._Context);
ServiceList = LocalSettingLoader.Load<ServiceList>(Program._Context);
AddonDefaultConfig = LocalSettingLoader.Load<AddonDefaultConfig>(Program._Context);
AuthenticationConfig= LocalSettingLoader.Load<AuthenticationConfig>(Program._Context);
AuthenticationConfig = LocalSettingLoader.Load<AuthenticationConfig>(Program._Context);
}
public static AddonDefaultConfig AddonDefaultConfig { get; }
public static AppConfig AppConfig { get; }
......@@ -38,6 +38,7 @@ namespace GS.Terminal.VisitorSelfService.Logic
public int HeartPort { get; set; }
public bool DisableVideoDetect { get; set; }
public string FaceWebSocket { get; set; }
public string AdminCard { get; set; }
public string DictName => "defaultconfig";
}
......
......@@ -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 = "0819.16";
internal static string _logicVersion = "0914.10";
public void Start(IAddonContext Context)
{
......
......@@ -48,5 +48,10 @@ namespace GS.Terminal.VisitorSelfService.Logic.ThirdAddon
{
return _DeviceTiggerService?.CallGPIO(arg);
}
public static string SerialReaderTouch()
{
return _DeviceTiggerService?.SerialReaderTouch();
}
}
}
......@@ -90,6 +90,14 @@ namespace ViewModels.Pages.AppointmentDetailPage
set { _ShowConfirm = value; RaisePropertyChanged("ShowConfirm"); }
}
private bool _ConfirmYesEnable;
public bool ConfirmYesEnable
{
get { return _ConfirmYesEnable; }
set { _ConfirmYesEnable = value; RaisePropertyChanged("ConfirmYesEnable"); }
}
public RelayCommand ShowExtendInfoCommand => new RelayCommand(() =>
{
......@@ -154,10 +162,11 @@ namespace ViewModels.Pages.AppointmentDetailPage
{
OnSubmitClick?.Invoke(Appointment);
});
public event Action OnConfirmNoClick;
public RelayCommand ConfirmClose => new RelayCommand(() =>
{
ShowConfirm = false;
OnConfirmNoClick?.Invoke();
});
public event Action<AppointmentItem> OnConfirmYesClick;
public RelayCommand ConfirmYes => new RelayCommand(() =>
......
......@@ -159,12 +159,15 @@
<RowDefinition/>
<RowDefinition Height="160"/>
</Grid.RowDefinitions>
<TextBlock Text="确定提交到访信息?" FontSize="48"
<StackPanel VerticalAlignment="Center">
<TextBlock Text="确定提交到访信息?" FontSize="48"
HorizontalAlignment="Center" VerticalAlignment="Center"
TextWrapping="Wrap"/>
<TextBlock Text="请联系您身边的工作人员帮您确认" Foreground="#f96400" HorizontalAlignment="Center" FontSize="28" Margin="0,20,0,0"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<gs:ImageButtonFix Command="{Binding ConfirmClose}" Width="360" Height="160" Image="/Views;component/Resources/confirm-no.png"/>
<gs:ImageButtonFix Command="{Binding ConfirmYes}" Width="360" Height="160" Image="/Views;component/Resources/confirm-yes.png"/>
<gs:ImageButtonFix Command="{Binding ConfirmYes}" IsEnabled="{Binding ConfirmYesEnable}" Width="360" Height="160" Image="/Views;component/Resources/confirm-yes.png"/>
</StackPanel>
</Grid>
</Border>
......
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