diff --git a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs index 03bfdeb..6243341 100644 --- a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs @@ -67,6 +67,8 @@ namespace DM_Weight.ViewModels } //保存库存 SaveStock(); + RequestData(); + Status = 0; break; // 数量变化 case EventType.UPDATEQUANTITY: @@ -212,8 +214,6 @@ namespace DM_Weight.ViewModels logger.Info($"库存已更新{it.DrugId},{it.Quantity+it.AddQuantity}"); } }); - RequestData(); - Status = 0; } } catch (Exception ex) diff --git a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs index 07beddd..cfe8b66 100644 --- a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs @@ -73,6 +73,8 @@ namespace DM_Weight.ViewModels } //保存库存 SaveStock(); + RequestData(); + Status = 0; break; // 数量变化 case EventType.UPDATEQUANTITY: @@ -211,8 +213,6 @@ namespace DM_Weight.ViewModels logger.Info($"库存已更新{it.DrugId},{it.Quantity - it.TakeQuantity}"); } }); - RequestData(); - Status = 0; } } catch (Exception ex) diff --git a/DM_Weight/ViewModels/HomeWindowViewModel.cs b/DM_Weight/ViewModels/HomeWindowViewModel.cs index bc47171..b1f7a2e 100644 --- a/DM_Weight/ViewModels/HomeWindowViewModel.cs +++ b/DM_Weight/ViewModels/HomeWindowViewModel.cs @@ -549,7 +549,7 @@ namespace DM_Weight.ViewModels // 无人操作鼠标键盘 if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit) { - logger.Info($"设备30秒内无人操作,用户【{Operator?.Nickname}】自动退出登录,_portUtil.Operate:{_portUtil.Operate},totalSecond:{(DateTime.Now - _portUtil.dateTime).TotalSeconds},lastInputTime:{CheckComputerFreeState.GetLastInputTime()},autoExit:{autoExit}"); + logger.Info($"设备{autoExit}内无人操作,用户【{Operator?.Nickname}】自动退出登录,_portUtil.Operate:{_portUtil.Operate},totalSecond:{(DateTime.Now - _portUtil.dateTime).TotalSeconds},lastInputTime:{CheckComputerFreeState.GetLastInputTime()},autoExit:{autoExit}"); Operator = null; Reviewer = null; diff --git a/DM_Weight/ViewModels/MainWindowViewModel.cs b/DM_Weight/ViewModels/MainWindowViewModel.cs index 7c86ffb..f87514d 100644 --- a/DM_Weight/ViewModels/MainWindowViewModel.cs +++ b/DM_Weight/ViewModels/MainWindowViewModel.cs @@ -17,6 +17,7 @@ using DM_Weight.Views; using Unity; using log4net.Repository.Hierarchy; using log4net; +using System.Windows; namespace DM_Weight.ViewModels { @@ -86,19 +87,23 @@ namespace DM_Weight.ViewModels void doMyPrismEvent2(AlertMsg msg) { - switch (msg.Type) + Application.Current.Dispatcher.BeginInvoke(() => { - case MsgType.INFO: - this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676")); - break; - case MsgType.ERROR: - this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c")); - break; - default: - this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676")); - break; - } - SnackbarMessageQueue.Enqueue(msg.Message); + switch (msg.Type) + { + case MsgType.INFO: + this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676")); + break; + case MsgType.ERROR: + this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c")); + break; + default: + this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676")); + break; + } + + SnackbarMessageQueue.Enqueue(msg.Message); + }); } }