取药添加二次验证,各取药页面修改、设置页面修改、添加二次验证页面
This commit is contained in:
parent
74a0f77a86
commit
3a0b4a82e4
|
|
@ -55,6 +55,8 @@
|
||||||
<add key="machineNumber" value="1"/>
|
<add key="machineNumber" value="1"/>
|
||||||
<!-- 指纹机ip -->
|
<!-- 指纹机ip -->
|
||||||
<add key="fingerIp" value="192.168.1.201"/>
|
<add key="fingerIp" value="192.168.1.201"/>
|
||||||
|
<!-- 是否二次验证 0否1是-->
|
||||||
|
<add key="secondCheck" value="0"/>
|
||||||
|
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
@ -205,6 +205,10 @@ namespace DM_Weight
|
||||||
|
|
||||||
containerRegistry.RegisterForNavigation<ShowMessageDialog, ShowMessageDialogViewModel>();
|
containerRegistry.RegisterForNavigation<ShowMessageDialog, ShowMessageDialogViewModel>();
|
||||||
|
|
||||||
|
//公共类
|
||||||
|
containerRegistry.RegisterSingleton<CommonClass>();
|
||||||
|
//二次验证登录
|
||||||
|
containerRegistry.RegisterForNavigation<SecondCheckDialog, SecondCheckDialogViewModel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ namespace DM_Weight.Models
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 药品对应批号库存
|
/// 药品对应批号库存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "manunoQuantity")]
|
//[SugarColumn(ColumnName = "manunoQuantity")]
|
||||||
public int? ManunoQuantity { get; set; }
|
//public int? ManunoQuantity { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ using DM_Weight.util;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
|
@ -35,25 +36,28 @@ namespace DM_Weight.ViewModels
|
||||||
get => _channelStocks;
|
get => _channelStocks;
|
||||||
set => SetProperty(ref _channelStocks, value);
|
set => SetProperty(ref _channelStocks, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly DateTime Jan1st1970 = new DateTime
|
private static readonly DateTime Jan1st1970 = new DateTime
|
||||||
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
CommonClass _commonClass;
|
||||||
|
|
||||||
|
IDialogService _dialogService;
|
||||||
public DrawerTakeDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
public DrawerTakeDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator, CommonClass commonClass, IDialogService dialogService)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
_commonClass = commonClass;
|
||||||
|
_dialogService = dialogService;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
{
|
{
|
||||||
if(msg.WindowName == "DrawerTakeDrugWindow")
|
if (msg.WindowName == "DrawerTakeDrugWindow")
|
||||||
{
|
{
|
||||||
switch (msg.EventType)
|
switch (msg.EventType)
|
||||||
{
|
{
|
||||||
|
|
@ -91,7 +95,7 @@ namespace DM_Weight.ViewModels
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _status;
|
private int _status;
|
||||||
|
|
@ -127,14 +131,39 @@ namespace DM_Weight.ViewModels
|
||||||
}, (DrawerNo) => Status == 0
|
}, (DrawerNo) => Status == 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
private DelegateCommand _openDrawer;
|
||||||
|
public DelegateCommand OpenDrawer => _openDrawer ??= new DelegateCommand(OpenDrawerMethod);
|
||||||
public DelegateCommand OpenDrawer
|
bool secondCheckFlag = true;
|
||||||
|
private async void OpenDrawerMethod()
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
//如果二次验证开启则需要二次验证
|
||||||
|
int loginCheck = Convert.ToInt32(_commonClass.ReadAppSetting("secondCheck"));
|
||||||
|
if (loginCheck == 1)
|
||||||
{
|
{
|
||||||
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "SecondCheckDialog", null, CheckDoDialogResult, "RootDialog");
|
||||||
|
if (secondCheckFlag)
|
||||||
|
{
|
||||||
|
Status = 1;
|
||||||
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
|
||||||
|
List<ChannelStock> singleChannels = ChannelStocks.FindAll(it => it.BoardType != 1);
|
||||||
|
|
||||||
|
_portUtil.WindowName = "DrawerTakeDrugWindow";
|
||||||
|
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
|
||||||
|
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
|
||||||
|
_portUtil.DrawerNo = DrawerNo;
|
||||||
|
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal, () => _portUtil.Start());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
Status = 1;
|
Status = 1;
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
|
@ -145,13 +174,24 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
|
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
|
||||||
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
|
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
|
||||||
_portUtil.DrawerNo = DrawerNo;
|
_portUtil.DrawerNo = DrawerNo;
|
||||||
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal, () => _portUtil.Start())
|
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal, () => _portUtil.Start());
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
}
|
||||||
|
private void CheckDoDialogResult(IDialogResult dialogResult)
|
||||||
|
{
|
||||||
|
// 委托 被动执行 被子窗口执行
|
||||||
|
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
|
||||||
|
if (dialogResult.Result == ButtonResult.OK)
|
||||||
|
{
|
||||||
|
secondCheckFlag = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
secondCheckFlag = false;
|
||||||
|
}
|
||||||
|
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _isFinishClick = false;
|
private bool _isFinishClick = false;
|
||||||
|
|
||||||
// 完成按钮
|
// 完成按钮
|
||||||
|
|
@ -198,7 +238,7 @@ namespace DM_Weight.ViewModels
|
||||||
ColNo = it.ColNo,
|
ColNo = it.ColNo,
|
||||||
DrugId = it.DrugId,
|
DrugId = it.DrugId,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ?DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture):null,
|
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
|
|
@ -246,7 +286,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,11 @@ namespace DM_Weight.ViewModels
|
||||||
private DelegateCommand _rowSelected;
|
private DelegateCommand _rowSelected;
|
||||||
|
|
||||||
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
||||||
|
CommonClass _commonClass;
|
||||||
public InvoiceOutWindowViewModel(IDialogService DialogService)
|
public InvoiceOutWindowViewModel(IDialogService DialogService, CommonClass commonClass)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
|
_commonClass = commonClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
||||||
|
|
@ -162,17 +163,37 @@ namespace DM_Weight.ViewModels
|
||||||
public List<Invoice> Invoices { get { return _invoices; } set { SetProperty(ref _invoices, value); } }
|
public List<Invoice> Invoices { get { return _invoices; } set { SetProperty(ref _invoices, value); } }
|
||||||
|
|
||||||
public bool KeepAlive => false;
|
public bool KeepAlive => false;
|
||||||
|
bool secondCheckFlag = true;
|
||||||
public async void OpenOrderDialog()
|
public async void OpenOrderDialog()
|
||||||
{
|
{
|
||||||
if (SelectedInvoice != null && SelectedInvoice.Status == 0)
|
if (SelectedInvoice != null && SelectedInvoice.Status == 0)
|
||||||
{
|
{
|
||||||
// 此处延时1毫秒,等待页面渲染
|
//如果二次验证开启则需要二次验证
|
||||||
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
int loginCheck = Convert.ToInt32(_commonClass.ReadAppSetting("secondCheck"));
|
||||||
DialogParameters dialogParameters = new DialogParameters();
|
if (loginCheck == 1)
|
||||||
dialogParameters.Add("invoice", SelectedInvoice);
|
{
|
||||||
DialogServiceExtensions.ShowDialogHost(_dialogService, "InvoiceTakeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
// 此处延时1毫秒,等待页面渲染
|
||||||
RequestData();
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "SecondCheckDialog", null, CheckDoDialogResult, "RootDialog");
|
||||||
|
if (secondCheckFlag)
|
||||||
|
{
|
||||||
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
dialogParameters.Add("invoice", SelectedInvoice);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "InvoiceTakeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
|
RequestData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
dialogParameters.Add("invoice", SelectedInvoice);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "InvoiceTakeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
|
RequestData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,7 +204,20 @@ namespace DM_Weight.ViewModels
|
||||||
RequestData();
|
RequestData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
private void CheckDoDialogResult(IDialogResult dialogResult)
|
||||||
|
{
|
||||||
|
// 委托 被动执行 被子窗口执行
|
||||||
|
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
|
||||||
|
if (dialogResult.Result == ButtonResult.OK)
|
||||||
|
{
|
||||||
|
secondCheckFlag = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
secondCheckFlag = false;
|
||||||
|
}
|
||||||
|
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
||||||
|
}
|
||||||
private void DoDialogResult(IDialogResult dialogResult)
|
private void DoDialogResult(IDialogResult dialogResult)
|
||||||
{
|
{
|
||||||
// 委托 被动执行 被子窗口执行
|
// 委托 被动执行 被子窗口执行
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ using Prism.Events;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public class OrderTakeDrugWindowViewModel: BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
public class OrderTakeDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
|
|
||||||
private int _pageNum = 1;
|
private int _pageNum = 1;
|
||||||
|
|
@ -65,15 +65,17 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
IDialogService _dialogService;
|
IDialogService _dialogService;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
CommonClass _commonClass;
|
||||||
|
|
||||||
private DelegateCommand _rowSelected;
|
private DelegateCommand _rowSelected;
|
||||||
|
|
||||||
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
||||||
|
|
||||||
public OrderTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator)
|
public OrderTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator, CommonClass commonClass)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
_commonClass = commonClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
||||||
|
|
@ -133,7 +135,10 @@ namespace DM_Weight.ViewModels
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询条件 处方日期
|
/// 查询条件 处方日期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OrderDate { get { return _orderDate; } set
|
public string OrderDate
|
||||||
|
{
|
||||||
|
get { return _orderDate; }
|
||||||
|
set
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(value))
|
if (!String.IsNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
|
|
@ -143,7 +148,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
SetProperty(ref _orderDate, value);
|
SetProperty(ref _orderDate, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestData();
|
RequestData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -153,7 +158,8 @@ namespace DM_Weight.ViewModels
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询条件 查询字段值
|
/// 查询条件 查询字段值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? SearchValue {
|
public string? SearchValue
|
||||||
|
{
|
||||||
get { return _searchValue; }
|
get { return _searchValue; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|
@ -167,30 +173,69 @@ namespace DM_Weight.ViewModels
|
||||||
public List<OrderInfo> OrderInfos { get { return _orderInfos; } set { SetProperty(ref _orderInfos, value); } }
|
public List<OrderInfo> OrderInfos { get { return _orderInfos; } set { SetProperty(ref _orderInfos, value); } }
|
||||||
|
|
||||||
public bool KeepAlive => false;
|
public bool KeepAlive => false;
|
||||||
|
bool secondCheckFlag = true;
|
||||||
public async void OpenOrderDialog()
|
public async void OpenOrderDialog()
|
||||||
{
|
{
|
||||||
if (SelectedOrder != null && SelectedOrder.DmStatus == 0 && SelectedOrder.CancelFlag == 0 && SelectedOrder.HisDispFlag == 0)
|
if (SelectedOrder != null && SelectedOrder.DmStatus == 0 && SelectedOrder.CancelFlag == 0 && SelectedOrder.HisDispFlag == 0)
|
||||||
{
|
{
|
||||||
// 此处延时1毫秒,等待页面渲染
|
//如果二次验证开启则需要二次验证
|
||||||
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
int loginCheck = Convert.ToInt32(_commonClass.ReadAppSetting("secondCheck"));
|
||||||
DialogParameters dialogParameters = new DialogParameters();
|
if (loginCheck == 1)
|
||||||
dialogParameters.Add("orderInfo", SelectedOrder);
|
{
|
||||||
DialogServiceExtensions.ShowDialogHost(_dialogService, "OrderTakeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
dialogParameters.Add("secondCheck", SelectedOrder);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "SecondCheckDialog", dialogParameters, CheckDoDialogResult, "RootDialog");
|
||||||
|
if (secondCheckFlag)
|
||||||
|
{
|
||||||
|
if (SelectedOrder != null && SelectedOrder.DmStatus == 0 && SelectedOrder.CancelFlag == 0 && SelectedOrder.HisDispFlag == 0)
|
||||||
|
{
|
||||||
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
DialogParameters dialogParametersTake = new DialogParameters();
|
||||||
|
dialogParametersTake.Add("orderInfo", SelectedOrder);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "OrderTakeDialog", dialogParametersTake, DoDialogResult, "RootDialog");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
dialogParameters.Add("orderInfo", SelectedOrder);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "OrderTakeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
private void CheckDoDialogResult(IDialogResult dialogResult)
|
||||||
|
{
|
||||||
|
// 委托 被动执行 被子窗口执行
|
||||||
|
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
|
||||||
|
if (dialogResult.Result == ButtonResult.OK)
|
||||||
|
{
|
||||||
|
secondCheckFlag = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
secondCheckFlag = false;
|
||||||
|
}
|
||||||
|
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoDialogResult(IDialogResult dialogResult)
|
private void DoDialogResult(IDialogResult dialogResult)
|
||||||
{
|
{
|
||||||
// 委托 被动执行 被子窗口执行
|
// 委托 被动执行 被子窗口执行
|
||||||
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
|
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
|
||||||
//if(dialogResult.Result == ButtonResult.OK)
|
if (dialogResult.Result == ButtonResult.OK)
|
||||||
//{
|
{
|
||||||
SelectedOrder = null;
|
SelectedOrder = null;
|
||||||
RequestData();
|
RequestData();
|
||||||
//}
|
}
|
||||||
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,7 +271,7 @@ namespace DM_Weight.ViewModels
|
||||||
.GroupBy(oi => oi.OrderDate)
|
.GroupBy(oi => oi.OrderDate)
|
||||||
.Select(oi => oi)
|
.Select(oi => oi)
|
||||||
.ToPageList(PageNum, PageSize, ref totalCount);
|
.ToPageList(PageNum, PageSize, ref totalCount);
|
||||||
//.ToList();
|
//.ToList();
|
||||||
OrderInfos = queryData;
|
OrderInfos = queryData;
|
||||||
TotalCount = totalCount;
|
TotalCount = totalCount;
|
||||||
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
|
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,332 @@
|
||||||
|
using DM_Weight.Finger;
|
||||||
|
using DM_Weight.Models;
|
||||||
|
using DM_Weight.msg;
|
||||||
|
using DM_Weight.Port;
|
||||||
|
using DM_Weight.util;
|
||||||
|
using log4net;
|
||||||
|
using log4net.Core;
|
||||||
|
using log4net.Repository.Hierarchy;
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Regions;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
public class SecondCheckDialogViewModel : BindableBase, IRegionMemberLifetime, IDialogAware
|
||||||
|
{
|
||||||
|
public bool KeepAlive => false;
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(LoginWindowViewModel));
|
||||||
|
|
||||||
|
private string username;
|
||||||
|
private string password;
|
||||||
|
|
||||||
|
private Boolean _loginBtnEnable = true;
|
||||||
|
|
||||||
|
IRegionManager _regionManager;
|
||||||
|
|
||||||
|
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
|
||||||
|
private string firstLogin = ConfigurationManager.AppSettings["firstLogin"]?.ToString() ?? "operator";
|
||||||
|
|
||||||
|
public bool SingleLogin
|
||||||
|
{
|
||||||
|
get => _commonClass.ReadAppSetting("loginMode") == "1";
|
||||||
|
//get => loginMode == 1;
|
||||||
|
}
|
||||||
|
public bool MultiLogin
|
||||||
|
{
|
||||||
|
//get => loginMode == 2;
|
||||||
|
get => _commonClass.ReadAppSetting("loginMode") == "2";
|
||||||
|
}
|
||||||
|
private FingerprintUtil _fingerprintUtil;
|
||||||
|
|
||||||
|
private PortUtil _portUtil;
|
||||||
|
|
||||||
|
public Boolean LoginBtnEnable { get { return _loginBtnEnable; } set { SetProperty(ref _loginBtnEnable, value); } }
|
||||||
|
public string Password { get { return password; } set { SetProperty(ref password, value); } }
|
||||||
|
|
||||||
|
public string Username { get { return username; } set { SetProperty(ref username, value); } }
|
||||||
|
|
||||||
|
|
||||||
|
public bool DrawerPortMsg
|
||||||
|
{
|
||||||
|
get => !_portUtil.drawerSerial.IsOpen;
|
||||||
|
}
|
||||||
|
public bool CanBusPortMsg
|
||||||
|
{
|
||||||
|
get => _portUtil._canBusExsit && !_portUtil.canBusSerial.IsOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _fingerMsg;
|
||||||
|
|
||||||
|
public bool FingerMsg
|
||||||
|
{
|
||||||
|
get => _fingerMsg;
|
||||||
|
set => SetProperty(ref _fingerMsg, value);
|
||||||
|
}
|
||||||
|
private DelegateCommand? _loginCommand;
|
||||||
|
|
||||||
|
private DelegateCommand? _exitCommand;
|
||||||
|
|
||||||
|
public DelegateCommand LoginCommand =>
|
||||||
|
_loginCommand ??= new DelegateCommand(Login);
|
||||||
|
|
||||||
|
public DelegateCommand ExitCommand =>
|
||||||
|
_exitCommand ??= new DelegateCommand(Exit);
|
||||||
|
|
||||||
|
public string Title => throw new NotImplementedException();
|
||||||
|
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
CommonClass _commonClass;
|
||||||
|
public SecondCheckDialogViewModel(IEventAggregator eventAggregator, CommonClass commonClass, PortUtil portUtil)
|
||||||
|
{
|
||||||
|
_portUtil = portUtil;
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
|
_commonClass = commonClass;
|
||||||
|
}
|
||||||
|
void Login()
|
||||||
|
{
|
||||||
|
LoginBtnEnable = false;
|
||||||
|
if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
|
||||||
|
{
|
||||||
|
if (Username.Equals("hkcadmin") && Password.Equals("hkc123"))
|
||||||
|
{
|
||||||
|
ObservableCollection<PremissionDm> defaultAll = RoleManagerWindowViewModel.defaultAll;
|
||||||
|
PremissionDm[] a = new PremissionDm[defaultAll.Count];
|
||||||
|
Array.Copy(defaultAll.ToArray(), 0, a, 0, defaultAll.Count);
|
||||||
|
a[4].Children.Add(new PremissionDm()
|
||||||
|
{
|
||||||
|
Id = 54,
|
||||||
|
PremissionName = "调试页面",
|
||||||
|
PremissionPath = "DebugWindow",
|
||||||
|
});
|
||||||
|
//添加参数,键值对格式
|
||||||
|
keys.Add("operator", new UserList()
|
||||||
|
{
|
||||||
|
UserName = Username,
|
||||||
|
Nickname = "华康测试账号",
|
||||||
|
Id = 9999,
|
||||||
|
Role = new RoleDm()
|
||||||
|
{
|
||||||
|
Id = 9999,
|
||||||
|
RoleName = "hkcadmin",
|
||||||
|
Permissions = a.ToList()
|
||||||
|
},
|
||||||
|
});
|
||||||
|
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
||||||
|
|
||||||
|
.Includes<RoleDm>(u => u.Role)
|
||||||
|
.InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
|
||||||
|
.First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
||||||
|
if (userList == null)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "无此用户",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
Username = "";
|
||||||
|
Password = "";
|
||||||
|
}
|
||||||
|
else if (userList.Role == null)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "用户还未设置权限,请联系管理员",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
Username = "";
|
||||||
|
Password = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (userList.PassWord == MD5.GetMD5Hash(Password))
|
||||||
|
{
|
||||||
|
|
||||||
|
SetUser(userList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "密码错误",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
Password = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "请输入账号或密码",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
LoginBtnEnable = true;
|
||||||
|
}
|
||||||
|
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
|
||||||
|
{
|
||||||
|
continuationCallback(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
private NavigationParameters keys = new NavigationParameters();
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
void SetUser(UserList user)
|
||||||
|
{
|
||||||
|
// 单人登录模式
|
||||||
|
if (SingleLogin)
|
||||||
|
{
|
||||||
|
//添加参数,键值对格式
|
||||||
|
keys.Add("operator", user);
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
||||||
|
}
|
||||||
|
// 双人登录模式
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果已经录入了发药人,已经有一个用户登录
|
||||||
|
if (keys.ContainsKey("operator"))
|
||||||
|
{
|
||||||
|
if (keys.GetValue<UserList>("operator").Id != user.Id)
|
||||||
|
{
|
||||||
|
keys.Add("reviewer", user);
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "该发药人账号已登录,请输入不同账号",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果已经录入了审核人, 已经有一个用户登录
|
||||||
|
else if (keys.ContainsKey("reviewer"))
|
||||||
|
{
|
||||||
|
if (keys.GetValue<UserList>("reviewer").Id != user.Id)
|
||||||
|
{
|
||||||
|
keys.Add("operator", user);
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "该审核人账号已登录,请输入不同账号",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 第一个用户登录
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (firstLogin.Equals("operator"))
|
||||||
|
{
|
||||||
|
keys.Add("operator", user);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
keys.Add("reviewer", user);
|
||||||
|
}
|
||||||
|
Username = string.Empty;
|
||||||
|
Password = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Exit()
|
||||||
|
{
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
}
|
||||||
|
void LoginEvent(FingerprintMsg msg)
|
||||||
|
{
|
||||||
|
logger.Info(msg.ToString());
|
||||||
|
if (msg.Message.Equals("CONNECT"))
|
||||||
|
{
|
||||||
|
FingerMsg = !msg.Result;
|
||||||
|
}
|
||||||
|
if (LoginBtnEnable)
|
||||||
|
{
|
||||||
|
if (msg.Message.Equals("LOGIN"))
|
||||||
|
{
|
||||||
|
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
||||||
|
|
||||||
|
.Includes<RoleDm>(u => u.Role)
|
||||||
|
.First(u => u.Id == msg.Id);
|
||||||
|
|
||||||
|
if (userList == null)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "无此用户",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
Username = "";
|
||||||
|
Password = "";
|
||||||
|
}
|
||||||
|
else if (userList.Role == null)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "用户还未设置权限,请联系管理员",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
Username = "";
|
||||||
|
Password = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetUser(userList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
_eventAggregator.GetEvent<FingerprintEvent>().Unsubscribe(LoginEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
FingerMsg = false;
|
||||||
|
_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
IDialogService _dialogService;
|
IDialogService _dialogService;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
CommonClass _commonClass;
|
||||||
public static List<OrderTakeSelect> StaticSelects = new()
|
public static List<OrderTakeSelect> StaticSelects = new()
|
||||||
{
|
{
|
||||||
new OrderTakeSelect
|
new OrderTakeSelect
|
||||||
|
|
@ -45,10 +45,11 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public SelfTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator)
|
public SelfTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator, CommonClass commonClass)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
_eventAggregator= eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
_commonClass = commonClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -99,12 +100,38 @@ namespace DM_Weight.ViewModels
|
||||||
public List<ChannelStock> ChannelStocks { get { return _channelStocks; } set { SetProperty(ref _channelStocks, value); } }
|
public List<ChannelStock> ChannelStocks { get { return _channelStocks; } set { SetProperty(ref _channelStocks, value); } }
|
||||||
|
|
||||||
|
|
||||||
public DelegateCommand OpenSelfDialog
|
private DelegateCommand _openSelfDialog;
|
||||||
|
public DelegateCommand OpenSelfDialog => _openSelfDialog ??= new DelegateCommand(OpenSelfDialogMethod);
|
||||||
|
bool secondCheckFlag = true;
|
||||||
|
public async void OpenSelfDialogMethod()
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
List<ChannelStock> takeChannels = ChannelStocks.FindAll(it => it.TakeQuantity > 0).ToList();
|
||||||
|
if (takeChannels.Count > 0)
|
||||||
{
|
{
|
||||||
List<ChannelStock> takeChannels = ChannelStocks.FindAll(it => it.TakeQuantity > 0).ToList();
|
|
||||||
if (takeChannels.Count > 0)
|
//如果二次验证开启则需要二次验证
|
||||||
|
int loginCheck = Convert.ToInt32(_commonClass.ReadAppSetting("secondCheck"));
|
||||||
|
if (loginCheck == 1)
|
||||||
|
{
|
||||||
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "SecondCheckDialog", null, CheckDoDialogResult, "RootDialog");
|
||||||
|
if (secondCheckFlag)
|
||||||
|
{
|
||||||
|
takeChannels.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if ((a.DrawerNo - b.DrawerNo) == 0)
|
||||||
|
{
|
||||||
|
return a.ColNo - b.ColNo;
|
||||||
|
}
|
||||||
|
return a.DrawerNo - b.DrawerNo;
|
||||||
|
});
|
||||||
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
dialogParameters.Add("ChannelStocks", takeChannels);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "SelfTakeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
takeChannels.Sort((a, b) =>
|
takeChannels.Sort((a, b) =>
|
||||||
{
|
{
|
||||||
|
|
@ -118,19 +145,31 @@ namespace DM_Weight.ViewModels
|
||||||
dialogParameters.Add("ChannelStocks", takeChannels);
|
dialogParameters.Add("ChannelStocks", takeChannels);
|
||||||
DialogServiceExtensions.ShowDialogHost(_dialogService, "SelfTakeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "SelfTakeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
Message = "请填写取药数量",
|
||||||
{
|
Type = MsgType.ERROR
|
||||||
Message = "请填写取药数量",
|
};
|
||||||
Type = MsgType.ERROR
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
};
|
}
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
}
|
||||||
}
|
private void CheckDoDialogResult(IDialogResult dialogResult)
|
||||||
|
{
|
||||||
});
|
// 委托 被动执行 被子窗口执行
|
||||||
|
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
|
||||||
|
if (dialogResult.Result == ButtonResult.OK)
|
||||||
|
{
|
||||||
|
secondCheckFlag = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
secondCheckFlag = false;
|
||||||
|
}
|
||||||
|
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoDialogResult(IDialogResult dialogResult)
|
private void DoDialogResult(IDialogResult dialogResult)
|
||||||
{
|
{
|
||||||
// 委托 被动执行 被子窗口执行
|
// 委托 被动执行 被子窗口执行
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,37 @@ namespace DM_Weight.ViewModels
|
||||||
get => _firstLogin; set => SetProperty(ref _firstLogin, value);
|
get => _firstLogin; set => SetProperty(ref _firstLogin, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//二次验证开
|
||||||
|
private bool _secondLoginOpen=true;
|
||||||
|
public bool SecondLoginOpen
|
||||||
|
{
|
||||||
|
get => _secondLoginOpen; set => SetProperty(ref _secondLoginOpen, value);
|
||||||
|
}
|
||||||
|
//二次验证关
|
||||||
|
private bool _secondLoginClose = true;
|
||||||
|
public bool SecondLoginClose
|
||||||
|
{
|
||||||
|
get => _secondLoginClose; set => SetProperty(ref _secondLoginClose, value);
|
||||||
|
}
|
||||||
|
|
||||||
public SettingWindowViewModel()
|
public SettingWindowViewModel()
|
||||||
{
|
{
|
||||||
FirstLogin = ReadAppSetting("firstLogin"); //ConfigurationManager.AppSettings["firstLogin"] ?? "operator";
|
FirstLogin = ReadAppSetting("firstLogin"); //ConfigurationManager.AppSettings["firstLogin"] ?? "operator";
|
||||||
_defaultLoginMode = ReadAppSetting("loginMode");
|
_defaultLoginMode = ReadAppSetting("loginMode");
|
||||||
_defaultFirstLogin = ReadAppSetting("firstLogin");
|
_defaultFirstLogin = ReadAppSetting("firstLogin");
|
||||||
_loginMode= _defaultLoginMode.Equals("2");
|
_loginMode = _defaultLoginMode.Equals("2");
|
||||||
|
int SecondLogin = Convert.ToInt32(ReadAppSetting("secondCheck"));
|
||||||
|
if (SecondLogin == 1)
|
||||||
|
{
|
||||||
|
SecondLoginOpen = true;
|
||||||
|
SecondLoginClose = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SecondLoginOpen = false;
|
||||||
|
SecondLoginClose = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DelegateCommand ResetConfigCommand
|
public DelegateCommand ResetConfigCommand
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
|
|
@ -67,6 +89,23 @@ namespace DM_Weight.ViewModels
|
||||||
_configuration.Save();
|
_configuration.Save();
|
||||||
ConfigurationManager.RefreshSection("firstLogin");
|
ConfigurationManager.RefreshSection("firstLogin");
|
||||||
}
|
}
|
||||||
|
if(SecondLoginOpen)
|
||||||
|
{
|
||||||
|
Configuration _configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||||
|
_configuration.AppSettings.Settings["secondCheck"].Value = "1";
|
||||||
|
_configuration.Save();
|
||||||
|
ConfigurationManager.RefreshSection("secondCheck");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Configuration _configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||||
|
_configuration.AppSettings.Settings["secondCheck"].Value = "0";
|
||||||
|
_configuration.Save();
|
||||||
|
ConfigurationManager.RefreshSection("secondCheck");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
|
//手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,206 @@
|
||||||
|
<UserControl x:Class="DM_Weight.Views.Dialog.SecondCheckDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||||
|
TextElement.FontWeight="Regular"
|
||||||
|
TextElement.FontSize="13"
|
||||||
|
TextOptions.TextFormattingMode="Ideal"
|
||||||
|
TextOptions.TextRenderingMode="Auto"
|
||||||
|
FontFamily="{DynamicResource MaterialDesignFont}"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
MinWidth="880"
|
||||||
|
MinHeight="615"
|
||||||
|
Width="Auto"
|
||||||
|
Height="Auto">
|
||||||
|
<UserControl.Background>
|
||||||
|
<ImageBrush ImageSource="/Images/body-bg.jpg" Stretch="Fill"/>
|
||||||
|
</UserControl.Background>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
<!--<i:Interaction.Triggers>
|
||||||
|
<i:KeyTrigger Key="Enter">
|
||||||
|
<i:InvokeCommandAction Command="{Binding LoginCommand}" />
|
||||||
|
</i:KeyTrigger>
|
||||||
|
</i:Interaction.Triggers>-->
|
||||||
|
<Grid.RowDefinitions >
|
||||||
|
<RowDefinition Height="2*"></RowDefinition>
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
<RowDefinition Height="6*"></RowDefinition>
|
||||||
|
<RowDefinition Height="3*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="17*"/>
|
||||||
|
<ColumnDefinition Width="66*"/>
|
||||||
|
<ColumnDefinition Width="17*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<materialDesign:Card Margin="16" Grid.Row="2" Grid.Column="1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="7*"/>
|
||||||
|
<ColumnDefinition Width="5*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid Grid.Column="0">
|
||||||
|
<Grid.RowDefinitions >
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
<RowDefinition Height="2*"></RowDefinition>
|
||||||
|
<RowDefinition Height="2*"></RowDefinition>
|
||||||
|
<RowDefinition Height="7*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="1"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontSize="28"
|
||||||
|
Foreground="#31ccec"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Text="二次验证">
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="2"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontSize="14"
|
||||||
|
Foreground="#31ccec"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Text="验证方式1:账号密码验证">
|
||||||
|
</TextBlock>
|
||||||
|
<Grid Grid.Row="3" >
|
||||||
|
<Grid.RowDefinitions >
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="4*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
x:Name="account"
|
||||||
|
Text="{Binding Username, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
AcceptsReturn="False"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
materialDesign:HintAssist.Hint="账号" />
|
||||||
|
<PasswordBox
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
x:Name="PasswordBox"
|
||||||
|
materialDesign:PasswordBoxAssist.Password="{Binding Password, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedPasswordBox}"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
materialDesign:HintAssist.Hint="密码" />
|
||||||
|
<StackPanel Grid.Row="2"
|
||||||
|
Grid.Column="1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="2*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="2*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button
|
||||||
|
Grid.Column="1"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedButton}"
|
||||||
|
materialDesign:ButtonAssist.CornerRadius="5"
|
||||||
|
Command="{ Binding LoginCommand }"
|
||||||
|
Background="#42a5f5"
|
||||||
|
BorderBrush="#42a5f5" Cursor="Hand" IsDefault="True" Content="验证"/>
|
||||||
|
<Button
|
||||||
|
Grid.Column="3"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedLightButton}"
|
||||||
|
Background="#7986cb"
|
||||||
|
BorderBrush="#7986cb"
|
||||||
|
materialDesign:ButtonAssist.CornerRadius="5" Cursor="Hand" IsCancel="true"
|
||||||
|
Command="{ Binding ExitCommand }" >
|
||||||
|
<TextBlock Foreground="{DynamicResource MaterialDesignPaper}" Text="取消" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="1">
|
||||||
|
|
||||||
|
<Grid.Background>
|
||||||
|
<ImageBrush ImageSource="/Images/finger-bg-r.png" Stretch="Fill"/>
|
||||||
|
</Grid.Background>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="3*"></RowDefinition>
|
||||||
|
<RowDefinition Height="2*"></RowDefinition>
|
||||||
|
<RowDefinition Height="7*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0"></StackPanel>
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="1"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="{DynamicResource MaterialDesignPaper}"
|
||||||
|
Text="验证方式2:屏幕外右侧指纹验证">
|
||||||
|
</TextBlock>
|
||||||
|
<StackPanel Grid.Row="2"></StackPanel>
|
||||||
|
<StackPanel Grid.Row="3" Visibility="{Binding SingleLogin, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
|
<materialDesign:PackIcon
|
||||||
|
Kind="Fingerprint"
|
||||||
|
Foreground="{DynamicResource MaterialDesignPaper}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Width="75"
|
||||||
|
Height="75"
|
||||||
|
/>
|
||||||
|
</StackPanel>
|
||||||
|
<Grid Grid.Row="3" Visibility="{Binding MultiLogin, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="{DynamicResource MaterialDesignPaper}"
|
||||||
|
Grid.Column="1" Text="发药人:" />
|
||||||
|
<TextBlock
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="{DynamicResource MaterialDesignPaper}"
|
||||||
|
Grid.Row="0" Grid.Column="2" Text="{Binding Operator.Nickname}" />
|
||||||
|
<TextBlock
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="{DynamicResource MaterialDesignPaper}"
|
||||||
|
Grid.Row="1" Grid.Column="1" Text="审核人:" />
|
||||||
|
<TextBlock
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="{DynamicResource MaterialDesignPaper}"
|
||||||
|
Grid.Row="1" Grid.Column="2" Text="{Binding Reviewer.Nickname}" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</materialDesign:Card>
|
||||||
|
<StackPanel Orientation="Vertical" Grid.Row="3" Grid.Column="2">
|
||||||
|
<TextBlock Visibility="{Binding DrawerPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="抽屉串口连接失败" />
|
||||||
|
<TextBlock Visibility="{Binding CanBusPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="can总线串口连接失败" />
|
||||||
|
<TextBlock Visibility="{Binding FingerMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="指纹机连接失败" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace DM_Weight.Views.Dialog
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// SecondCheckDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class SecondCheckDialog : UserControl
|
||||||
|
{
|
||||||
|
public SecondCheckDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -33,6 +33,16 @@
|
||||||
Style="{StaticResource MaterialDesignChoiceChipPrimaryListBox}"
|
Style="{StaticResource MaterialDesignChoiceChipPrimaryListBox}"
|
||||||
IsEnabled="{Binding Path=IsChecked, ElementName=MaterialDesignFilledTextBoxEnabledComboBox}">
|
IsEnabled="{Binding Path=IsChecked, ElementName=MaterialDesignFilledTextBoxEnabledComboBox}">
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
<TextBlock TextAlignment="Center" Text="二次登录:"/>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<RadioButton IsChecked="{Binding SecondLoginOpen}" Margin="16 4 16 0"
|
||||||
|
Style="{StaticResource MaterialDesignUserForegroundRadioButton}"
|
||||||
|
Content="开启" />
|
||||||
|
<RadioButton IsChecked="{Binding SecondLoginClose}" Margin="16 4 16 0"
|
||||||
|
Style="{StaticResource MaterialDesignUserForegroundRadioButton}"
|
||||||
|
Content="关闭" />
|
||||||
|
</StackPanel>
|
||||||
<Button Margin="12" Grid.ColumnSpan="2" Content="保存" Command="{Binding ResetConfigCommand}" />
|
<Button Margin="12" Grid.ColumnSpan="2" Content="保存" Command="{Binding ResetConfigCommand}" />
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace DM_Weight.util
|
||||||
|
{
|
||||||
|
public class CommonClass
|
||||||
|
{
|
||||||
|
//手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
|
||||||
|
public string ReadAppSetting(string key)
|
||||||
|
{
|
||||||
|
string xPath = "/configuration/appSettings//add[@key='" + key + "']";
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
string exeFileName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
|
||||||
|
doc.Load(exeFileName + ".dll.config");
|
||||||
|
XmlNode node = doc.SelectSingleNode(xPath);
|
||||||
|
return node.Attributes["value"].Value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue