From 98e770854e82da88d24cdb482f75a4bdfa763a5f Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Tue, 31 Dec 2024 14:48:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E6=8A=BD=E5=B1=89=E5=90=8E=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E5=AE=8C=E6=88=90=E4=B8=8E=E5=8F=96=E6=B6=88=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E3=80=82=E8=87=AA=E5=8A=A8=E9=80=80=E5=87=BA=E9=80=9A?= =?UTF-8?q?=E8=BF=87promise=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DrawerAddDrugWindowViewModel.cs | 4 +-- .../DrawerTakeDrugWindowViewModel.cs | 4 +-- DM_Weight/ViewModels/HomeWindowViewModel.cs | 2 +- DM_Weight/ViewModels/MainWindowViewModel.cs | 29 +++++++++++-------- 4 files changed, 22 insertions(+), 17 deletions(-) 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); + }); } }