diff --git a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs index a1a065c..836a689 100644 --- a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs +++ b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs @@ -256,6 +256,22 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any(); + if (bDrawer) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs); enumerator = enumerable.GetEnumerator(); enumerator.MoveNext(); diff --git a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs index 36150cb..87408ac 100644 --- a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs +++ b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs @@ -508,6 +508,22 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any(); + if (bDrawer) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } if (AddChannels == null || AddChannels.Count <= 0) { AlertMsg alertMsg = new AlertMsg diff --git a/DM_Weight/ViewModels/CheckStockWindowViewModel.cs b/DM_Weight/ViewModels/CheckStockWindowViewModel.cs index 2e46b39..43ae471 100644 --- a/DM_Weight/ViewModels/CheckStockWindowViewModel.cs +++ b/DM_Weight/ViewModels/CheckStockWindowViewModel.cs @@ -111,6 +111,21 @@ namespace DM_Weight.ViewModels { get => new DelegateCommand((DrawerNo) => { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + if (Convert.ToInt32(DrawerNo) > 2) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } this.DrawerNo = Convert.ToInt32(DrawerNo); RequestData(); }, (DrawerNo) => Status == 0 diff --git a/DM_Weight/ViewModels/DestoryEmptyDialogViewModel.cs b/DM_Weight/ViewModels/DestoryEmptyDialogViewModel.cs index 9640260..e7e490b 100644 --- a/DM_Weight/ViewModels/DestoryEmptyDialogViewModel.cs +++ b/DM_Weight/ViewModels/DestoryEmptyDialogViewModel.cs @@ -199,6 +199,21 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + if (_ChannelStock.DrawerNo>2) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } Status = 1; //_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉"); diff --git a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs index 253454d..5178512 100644 --- a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs @@ -125,6 +125,21 @@ namespace DM_Weight.ViewModels { get => new DelegateCommand(() => { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + if (DrawerNo>2) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } Status = 1; try diff --git a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs index 05b61e9..bc679c8 100644 --- a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs @@ -135,6 +135,21 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + if (DrawerNo>2) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } Status = 1; //_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉"); diff --git a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs index 5976aeb..6a41ccc 100644 --- a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs @@ -175,6 +175,22 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any(); + if (bDrawer) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } enumerator.MoveNext(); Status = 1; OpenOneByOne(); diff --git a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs index 807a007..744790d 100644 --- a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs @@ -250,6 +250,22 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any(); + if (bDrawer) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs); enumerator = enumerable.GetEnumerator(); enumerator.MoveNext(); diff --git a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs index 28f9012..e8be25e 100644 --- a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs @@ -245,6 +245,22 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any(); + if (bDrawer) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs); enumerator = enumerable.GetEnumerator(); enumerator.MoveNext(); diff --git a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs index 2d518de..5e1cfe4 100644 --- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs @@ -247,6 +247,24 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any(); + if (bDrawer) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } + enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs); enumerator = enumerable.GetEnumerator(); enumerator.MoveNext(); @@ -271,7 +289,7 @@ namespace DM_Weight.ViewModels { if (!strNames.Contains(name)) { - strNames += name+";"; + strNames += name + ";"; } } int sumQuantity = channelStocks.Sum(cs => cs.TakeQuantity); @@ -420,7 +438,7 @@ namespace DM_Weight.ViewModels CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), InvoiceNo = "日结存" }).ExecuteCommand(); - if(iDayResult<=0) + if (iDayResult <= 0) { logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}"); } @@ -428,7 +446,7 @@ namespace DM_Weight.ViewModels //修改凌晨生成的日结存与总结存数据 AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable() .Where(ab => ab.MachineId.Equals(it.MachineId)) - .Where(ab => ab.Type == 4) + .Where(ab => ab.Type == 4) .Where(ab => ab.DrugId == it.DrugId) .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First(); if (accountBookG2Total != null) diff --git a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs index 3ae3979..463c906 100644 --- a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs @@ -191,6 +191,22 @@ namespace DM_Weight.ViewModels { get => new DelegateCommand(() => { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any(); + if (bDrawer) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } if (ChannelStock != null) { Status = 1; diff --git a/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs b/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs index f1164ae..55e5830 100644 --- a/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs @@ -211,6 +211,21 @@ namespace DM_Weight.ViewModels { get => new DelegateCommand(() => { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + if (ChannelStock.DrawerNo>2) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } if (ChannelStock != null) { if (Status == 0) diff --git a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs index ea7a474..40aab68 100644 --- a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs @@ -169,6 +169,22 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any(); + if (bDrawer) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } enumerator.MoveNext(); Status = 1; OpenOneByOne(); diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs index 9f8e962..08a0a5a 100644 --- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs @@ -165,6 +165,22 @@ namespace DM_Weight.ViewModels { if (Status == 0) { + if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员") + { + //查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开,其他6层管理员才能开 + bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any(); + if (bDrawer) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "当前用户没有打开抽屉的权限!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } + + } enumerator.MoveNext(); Status = 1; OpenOneByOne(); diff --git a/DM_Weight/Views/AddToJiaoJieWindow.xaml b/DM_Weight/Views/AddToJiaoJieWindow.xaml index c2e1020..1cd6dd5 100644 --- a/DM_Weight/Views/AddToJiaoJieWindow.xaml +++ b/DM_Weight/Views/AddToJiaoJieWindow.xaml @@ -148,6 +148,7 @@ + diff --git a/DM_Weight/Views/ReturnEmptyWindow.xaml b/DM_Weight/Views/ReturnEmptyWindow.xaml index f435895..504cd56 100644 --- a/DM_Weight/Views/ReturnEmptyWindow.xaml +++ b/DM_Weight/Views/ReturnEmptyWindow.xaml @@ -51,7 +51,7 @@ />