diff --git a/DM_Weight/App.config b/DM_Weight/App.config index 16114ac..5f7b376 100644 --- a/DM_Weight/App.config +++ b/DM_Weight/App.config @@ -3,7 +3,7 @@ - + - + @@ -28,7 +28,7 @@ - + diff --git a/DM_Weight/App.xaml.cs b/DM_Weight/App.xaml.cs index b66f96f..e080d97 100644 --- a/DM_Weight/App.xaml.cs +++ b/DM_Weight/App.xaml.cs @@ -55,6 +55,15 @@ namespace DM_Weight set => _currentShenUserList = value; } #endregion 当前登录用户的审核人信息 + #region 登录模式,SingleModel=true则为单人登录 + private static bool _singleModel; + public static bool SingleModel + { + get => _singleModel; + set=>_singleModel = value; + } + + #endregion private readonly ILog logger = LogManager.GetLogger(typeof(App)); public App() @@ -133,6 +142,8 @@ namespace DM_Weight // 登录页面 containerRegistry.RegisterForNavigation(); + //值班柜、周转柜选择 + containerRegistry.RegisterForNavigation(); // 布局页面 containerRegistry.RegisterForNavigation(); diff --git a/DM_Weight/Converter/StatusConverter.cs b/DM_Weight/Converter/StatusConverter.cs index 8947a1e..f5ee11d 100644 --- a/DM_Weight/Converter/StatusConverter.cs +++ b/DM_Weight/Converter/StatusConverter.cs @@ -76,6 +76,29 @@ namespace DM_Weight.Converter return Visibility.Collapsed; } } + //显示样式 + if (para.Equals("TakeFinishLoading")) + { + if (status ==4) + { + return true; + } + else + { + return false; + } + } + if(para.Equals("TakeFinishEnable")) + { + if (status ==4) + { + return false; + } + else + { + return true; + } + } return Visibility.Collapsed; } diff --git a/DM_Weight/Models/MachineRecord.cs b/DM_Weight/Models/MachineRecord.cs index 8f41de3..2a900a4 100644 --- a/DM_Weight/Models/MachineRecord.cs +++ b/DM_Weight/Models/MachineRecord.cs @@ -75,7 +75,7 @@ namespace DM_Weight.Models [SugarColumn(ColumnName = "eff_date")] public DateTime? EffDate { get; set; } /// - /// 出库入库类型(1入库2出库31还药32还空瓶) + /// 出库入库类型(1入库 2出库 31还药 32还空瓶 4盘点 5日结存) /// [SugarColumn(ColumnName = "type")] public int Type { get; set; } diff --git a/DM_Weight/Report/GridReportUtil.cs b/DM_Weight/Report/GridReportUtil.cs index 26fc4aa..3272696 100644 --- a/DM_Weight/Report/GridReportUtil.cs +++ b/DM_Weight/Report/GridReportUtil.cs @@ -49,7 +49,17 @@ namespace DM_Weight.Report string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); string SQL = $@"SELECT cl.`row_no` AS drawerNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate, di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity, - cl.`drug_id` AS drugId FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` = '{machine_id}' AND cl.`drawer_type` = 1 ORDER BY cl.`drug_id`"; + cl.`drug_id` AS drugId FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` = '{machine_id}' AND cl.`drawer_type` = 1 "; + if(App.SingleModel) + { + SQL += " and cl.row_no<=8"; + } + else + { + SQL += " and cl.row_no>8"; + } + SQL += " ORDER BY cl.`drug_id`"; + // 加载模板文件 Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "stock_template.grf"); Report.DetailGrid.Recordset.ConnectionString = gridConnectionString; @@ -359,50 +369,6 @@ namespace DM_Weight.Report string SQL = string.Empty; string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); - #region MyRegion - //string strINSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(totalInQuantity) AS StrTotalQuantity FROM - //( - //SELECT - // DISTINCT Manu_No ,sum(IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))) as totalInQuantity - //from dm_machine_record mr - // INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` where mr.machine_id='{machine_id}' - // and IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) >0 - // and DATE_FORMAT(operation_time,'%Y-%m')= '{strDate}' and type in('1,31,4') - //GROUP BY mr.drug_id,mr.manu_no - //) as t"; - //AccountTotalQuantity InQuantityList = SqlSugarHelper.Db.SqlQueryable(strINSql) - // .Select(it => new AccountTotalQuantity()).First(); - - //string strOutSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(TotalOutQuantity) AS StrTotalQuantity FROM - //( - //SELECT - // DISTINCT Manu_No ,SUM(IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0))) AS TotalOutQuantity - //from dm_machine_record mr - // INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` where mr.machine_id='{machine_id}' - // and IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) >0 - // and DATE_FORMAT(operation_time,'%Y-%m')= '{strDate}' and type in('2,4') - //GROUP BY mr.drug_id,mr.manu_no - //) as t"; - //AccountTotalQuantity OutQuantityList = SqlSugarHelper.Db.SqlQueryable(strOutSql) - // .Select(it => new AccountTotalQuantity()).First(); - - //string strStockSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(stock_quantity) AS StrTotalQuantity FROM - // (SELECT a.Manu_No,a.stock_quantity from dm_machine_record a inner join - // (select drug_id,manu_no,max(operation_time) as latest_date,stock_quantity from dm_machine_record - // WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and machine_id='{machine_id}' GROUP BY drug_id,manu_no ) b on a.drug_id=b.drug_id and a.manu_no=b.manu_no - // and a.operation_time=b.latest_date and machine_id='{machine_id}' WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}') as t "; - //AccountTotalQuantity StockQuantityList = SqlSugarHelper.Db.SqlQueryable(strStockSql) - // .Select(it => new AccountTotalQuantity()).First(); - //string str1 = "本月领药数量" + ":" + InQuantityList.StrTotalQuantity + " 批号:" + InQuantityList.StrTotalManuNo; - //string str2 = "本月发药数量" + ":" + OutQuantityList.StrTotalQuantity + " 批号:" + OutQuantityList.StrTotalManuNo; - //string str3 = "本月结存数量" + ":" + StockQuantityList.StrTotalQuantity + " 批号:" + StockQuantityList.StrTotalManuNo; - //Report.ControlByName("StaticBox24").AsStaticBox.Text = str1; - //Report.ControlByName("StaticBox26").AsStaticBox.Text = str2; - //Report.ControlByName("StaticBox28").AsStaticBox.Text = str3; - #endregion - - - //Report.DetailGrid.Recordset.ConnectionString = gridConnectionString; SQL = $@"SELECT mr.drug_id as drugId,'test' InTotal,YEAR(mr.`operation_time`) as DMYear,MONTH(mr.`operation_time`) as DMMonth, DAY(mr.`operation_time`) as DMDay,manu_no as manuNo,operation_time as operationTime,return_quantity1 as inQuantity,return_quantity2 as outQuantity, manunoQuantity as stockQuantity,u1.user_name as operatorName,u2.user_name as reviewerName,di.`drug_name` AS `drugName`, @@ -410,8 +376,6 @@ namespace DM_Weight.Report FROM dm_machine_record mr INNER JOIN DRUG_INFO di ON mr.drug_id=di.drug_id LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{machine_id}' and type=5 and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' ORDER BY mr.drug_id,operation_time"; - //Report.DetailGrid.Recordset.QuerySQL = SQL; - List> tableList = SqlSugarHelper.Db.SqlQueryable(SQL).ToDictionaryList(); for (int i = 0; i < tableList.Count; i++) { diff --git a/DM_Weight/Services/MachineRecordService.cs b/DM_Weight/Services/MachineRecordService.cs index 2809a39..c54d152 100644 --- a/DM_Weight/Services/MachineRecordService.cs +++ b/DM_Weight/Services/MachineRecordService.cs @@ -30,13 +30,18 @@ namespace DM_Weight.Services string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); string SQL = $@"SELECT TYPE, stockQuantity,inQuantity,outQuantity,operationTime,invoiceId,drugName,drugId,drugSpec,packUnit,dosage,manufactory,manuNo,effDate, operatorName,reviewerName,supplierDept,receiveDept FROM - (SELECT mr.type,mr.`stock_quantity` AS `stockQuantity`, IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) - AS `inQuantity`, IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`, + (SELECT mr.type,mr.`stock_quantity` AS `stockQuantity`, + -- IF(mr.`type` IN (1, 31), mr.`quantity`,IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) AS `inQuantity`, + -- IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`, + if(mr.drawer_no>8 and mr.`type` IN (1, 31),quantity,IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`,0)) AS `inQuantity`, + if(OI.ORDER_NO is not null,mr.quantity,IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`, DATE_FORMAT(mr.`operation_time`,'%m/%d') AS `operationTime`,IF(mr.`type`=1,mr.`invoice_id`,NULL) AS `invoiceId`, di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`, di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`, mr.`manu_no` AS `manuNo`, DATE_FORMAT(mr.`eff_date`,'%y/%m/%d') AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName`,mr.supplierDept,mr.receiveDept FROM dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id` - LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}' + LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` + LEFT JOIN ORDER_INFO OI ON OI.ORDER_NO=mr.invoice_id + WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}' AND mr.`operation_time` < '{p_endDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 "; if (!string.IsNullOrEmpty(drug_id)) { diff --git a/DM_Weight/ViewModels/AddDrugControlViewModel.cs b/DM_Weight/ViewModels/AddDrugControlViewModel.cs index 738ebd0..0ecb968 100644 --- a/DM_Weight/ViewModels/AddDrugControlViewModel.cs +++ b/DM_Weight/ViewModels/AddDrugControlViewModel.cs @@ -148,7 +148,18 @@ namespace DM_Weight.ViewModels private int _status; public int Status { get => _status; set => SetProperty(ref _status, value); } + /// + /// 操作状态 + /// + private int _OptionStatus = -1; + public int OptionStatus { get => _OptionStatus; set => SetProperty(ref _OptionStatus, value); } + /// + /// 完成按钮绑定文本(完成;保存中) + /// + private string _FinishContent = "完成"; + public string FinishContent + { get => _FinishContent; set => SetProperty(ref _FinishContent, value); } private int _drawerNo = 1; public int DrawerNo @@ -185,53 +196,6 @@ namespace DM_Weight.ViewModels { get => new DelegateCommand(() => { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelLsts.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelLsts.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); - bool bEqualEight = ChannelLsts.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - - } Status = 1; _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉"); @@ -262,7 +226,17 @@ namespace DM_Weight.ViewModels // 完成按钮 public DelegateCommand TakeFinish { - get => new DelegateCommand(() => + get => new DelegateCommand(TakeFinishAction); + } + private void TakeFinishAction() + { + OptionStatus = 4; + FinishContent = "保存中"; + Task.Factory.StartNew(() => TakeFinishMethod()); + } + private async void TakeFinishMethod() + { + try { if (!_isFinishClick) { @@ -295,9 +269,13 @@ namespace DM_Weight.ViewModels Quantity = it.Quantity + it.AddQuantity, ManuNo = it.ManuNo, EffDate = it.EffDate, - DrugId=it.DrugId, + DrugId = it.DrugId, Id = it.Id, - }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.DrugId }).ExecuteCommand(); + DrawerNo = it.DrawerNo, + ColNo = it.ColNo, + DrawerType = it.DrawerType, + BoardType = it.BoardType + }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId }).ExecuteCommand(); } else { @@ -343,7 +321,7 @@ namespace DM_Weight.ViewModels ManuNo = it.ManuNo, EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null, Operator = HomeWindowViewModel.Operator?.Id, - Reviewer= HomeWindowViewModel.Reviewer?.Id, + Reviewer = HomeWindowViewModel.Reviewer?.Id, OperationTime = DateTime.Now, Quantity = it.AddQuantity, Type = 1, @@ -359,10 +337,14 @@ namespace DM_Weight.ViewModels { AlertMsg alertMsg = new AlertMsg { - Message = $"该抽屉已存在此药品批次{string.Join(',', stockRepeats.Select(r=>r.ManuNo).ToArray())},请选择其他批次", + Message = $"该抽屉已存在此药品批次{string.Join(',', stockRepeats.Select(r => r.ManuNo).ToArray())},请选择其他批次", Type = MsgType.ERROR }; - _eventAggregator.GetEvent().Publish(alertMsg); + + System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() => + { + _eventAggregator.GetEvent().Publish(alertMsg); + })); } else { @@ -374,7 +356,7 @@ namespace DM_Weight.ViewModels if (stockRepeats.Count > 0) { msg = $"该抽屉下批次{string.Join(',', stockRepeats.Select(r => r.ManuNo).ToArray())}已存在,不可重复添加,其他批次加药完成,库存已更新"; - foreach(var stockRpt in stockRepeats) + foreach (var stockRpt in stockRepeats) { //移除重复的信息,以免更新屏显库存时更新了重复数据 record.Remove(stockRpt); @@ -396,20 +378,20 @@ namespace DM_Weight.ViewModels ret.Quantity = it.Sum(itx => itx.Quantity); ret.AddQuantity = it.Sum(itx => itx.AddQuantity); ret.EffDate = it.Min(it => it.EffDate); - ret.ManuNo = it.OrderBy(it=>it.ManuNo).Select(it=>it.ManuNo).First().ToString(); + ret.ManuNo = it.OrderBy(it => it.ManuNo).Select(it => it.ManuNo).First().ToString(); return ret; }) - .OrderBy(it=>it.EffDate) + .OrderBy(it => it.EffDate) .ToList(); singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList(); if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5) { //将库位多批次的总库存数更新标签 //_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) + singleChannels.Sum(it => it.AddQuantity)); - + singleChannels.ForEach(it => { - + _portUtil.WriteChannelInfo(6, it.EffDate == null ? "" : it.EffDate, it.DrawerNo, it.ColNo); Thread.Sleep(200); _portUtil.WriteChannelInfo(5, it.ManuNo, it.DrawerNo, it.ColNo); @@ -429,7 +411,11 @@ namespace DM_Weight.ViewModels Message = msg, Type = type, }; - _eventAggregator.GetEvent().Publish(alertMsg); + + System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() => + { + _eventAggregator.GetEvent().Publish(alertMsg); + })); } else { @@ -438,7 +424,11 @@ namespace DM_Weight.ViewModels Message = "更新库存失败", Type = MsgType.SUCCESS, }; - _eventAggregator.GetEvent().Publish(alertMsg); + + System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() => + { + _eventAggregator.GetEvent().Publish(alertMsg); + })); } } Status = 0; @@ -456,14 +446,31 @@ namespace DM_Weight.ViewModels Message = "没有填写加药数量", Type = MsgType.ERROR }; - _eventAggregator.GetEvent().Publish(alertMsg); + + System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() => + { + _eventAggregator.GetEvent().Publish(alertMsg); + })); } } - - }); + OptionStatus = -1; + } + catch (Exception ex) + { + logger.Info($"AddDrugControlViewModel异常:{ex.Message}"); + _isFinishClick = false; + AlertMsg alertMsg = new AlertMsg + { + Message = $"异常:{ex.Message}", + Type = MsgType.ERROR + }; + System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() => + { + _eventAggregator.GetEvent().Publish(alertMsg); + })); + } } - // 取消按钮 public DelegateCommand CancleTake { @@ -531,11 +538,11 @@ namespace DM_Weight.ViewModels public void FindDrawerCount() { - int count = SqlSugarHelper.Db.Queryable().Where(cs => cs.DrawerType != 3) - .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count(); - Is8Drawer = count < 9; - Is16Drawer = count >= 16; - Is17Drawer = count > 16; + //int count = SqlSugarHelper.Db.Queryable().Where(cs => cs.DrawerType != 3) + // .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count(); + Is8Drawer = App.SingleModel; //count < 9; + Is16Drawer = !App.SingleModel; //count >= 16; + Is17Drawer = false;//count > 16; } //这个方法用于拦截请求,continuationCallback(true)就是不拦截,continuationCallback(false)拦截本次操作 diff --git a/DM_Weight/ViewModels/BeforeLoginViewModel.cs b/DM_Weight/ViewModels/BeforeLoginViewModel.cs new file mode 100644 index 0000000..7113d5f --- /dev/null +++ b/DM_Weight/ViewModels/BeforeLoginViewModel.cs @@ -0,0 +1,87 @@ +using DM_Weight.Finger; +using DM_Weight.Port; +using Prism.Commands; +using Prism.Events; +using Prism.Mvvm; +using Prism.Regions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace DM_Weight.ViewModels +{ + public class BeforeLoginViewModel : BindableBase, IRegionMemberLifetime, IConfirmNavigationRequest + { + public bool KeepAlive => false; + IRegionManager _regionManager; + IEventAggregator _eventAggregator; + public BeforeLoginViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil) + { + _regionManager = regionManager; + _eventAggregator = eventAggregator; + } + private NavigationParameters keys = new NavigationParameters(); + /// + /// 值班柜柜登录 + /// + public DelegateCommand DutyCommand + { + get => new DelegateCommand(() => + { + + //_loginWindowViewModel.SingleLogin = true; + //_loginWindowViewModel.MultiLogin = false; + + keys.Add("SingleLogin", true); + App.SingleModel = true; + _regionManager.RequestNavigate("MainRegion", "LoginWindow",keys); + }); + } + /// + /// 周转柜登录 + /// + public DelegateCommand OtherCommand + { + get => new DelegateCommand(() => + { + //_loginWindowViewModel.SingleLogin = false; + //_loginWindowViewModel.MultiLogin = true; + + keys.Add("SingleLogin", false); + App.SingleModel = false; + _regionManager.RequestNavigate("MainRegion", "LoginWindow", keys); + }); + } + + public void ConfirmNavigationRequest(NavigationContext navigationContext, Action continuationCallback) + { + continuationCallback(true); + } + + public bool IsNavigationTarget(NavigationContext navigationContext) + { + return true; + } + + public void OnNavigatedFrom(NavigationContext navigationContext) + { + } + + public void OnNavigatedTo(NavigationContext navigationContext) + { + } + //手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题 + 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(); + } + } +} diff --git a/DM_Weight/ViewModels/BindingChannelNewDialogViewModel .cs b/DM_Weight/ViewModels/BindingChannelNewDialogViewModel .cs index 33fff54..ce8e2da 100644 --- a/DM_Weight/ViewModels/BindingChannelNewDialogViewModel .cs +++ b/DM_Weight/ViewModels/BindingChannelNewDialogViewModel .cs @@ -142,7 +142,7 @@ namespace DM_Weight.ViewModels public void UpdateComboBoxItems(string text) { string str = @"SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit, - d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name_spec FROM `drug_info` d"; + d.manufactory,d.max_stock,CONCAT(drug_name,';',drug_spec,';',manufactory)as drug_name_spec FROM `drug_info` d"; if (string.IsNullOrEmpty(text)) { DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); @@ -247,7 +247,7 @@ namespace DM_Weight.ViewModels //var list = SqlSugarHelper.Db.Queryable().Includes(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList(); //DrugInfos = list; //DrugInfos_PY = list; - string str = "SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name_spec FROM `drug_info` d"; + string str = "SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,d.manufactory,d.max_stock,CONCAT(drug_name,';',drug_spec,';',manufactory) as drug_name_spec FROM `drug_info` d"; DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); } @@ -258,6 +258,8 @@ namespace DM_Weight.ViewModels int totalCount = 0; var list = SqlSugarHelper.Db.Queryable() .Includes(cl => cl.Drug) + .WhereIF(App.SingleModel, cl => cl.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cl => cl.DrawerNo > 8) .Includes(cs => cs.channelStocks) .WhereIF(DrawerNo > 0, cl => cl.DrawerNo == DrawerNo) .Where(cl => cl.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")) diff --git a/DM_Weight/ViewModels/CheckStockNew2WindowViewModel.cs b/DM_Weight/ViewModels/CheckStockNew2WindowViewModel.cs index 8fc1864..7894adc 100644 --- a/DM_Weight/ViewModels/CheckStockNew2WindowViewModel.cs +++ b/DM_Weight/ViewModels/CheckStockNew2WindowViewModel.cs @@ -574,7 +574,8 @@ namespace DM_Weight.ViewModels .Where(cs => cs.DrawerType == 1) .Where(cs => cs.DrugId != null) .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")) - + .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8) .WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue) .OrderBy(cs => cs.DrawerNo) .OrderBy(cs => cs.ColNo) diff --git a/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs b/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs index 742b603..40c4bb4 100644 --- a/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs +++ b/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs @@ -706,7 +706,8 @@ namespace DM_Weight.ViewModels .Where(cs => cs.DrawerType == 1) .Where(cs => cs.DrugId != null) .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")) - + .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8) .WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue) .OrderBy(cs => cs.DrawerNo) //.OrderByDescending(cs => cs.DrawerNo) diff --git a/DM_Weight/ViewModels/CheckStockWindowViewModel.cs b/DM_Weight/ViewModels/CheckStockWindowViewModel.cs index 7293f74..e4857fe 100644 --- a/DM_Weight/ViewModels/CheckStockWindowViewModel.cs +++ b/DM_Weight/ViewModels/CheckStockWindowViewModel.cs @@ -121,53 +121,53 @@ namespace DM_Weight.ViewModels { get => new DelegateCommand(() => { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8&&n<17).Any(); - bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } + //if (App.CurrentFaUserList.Role != null) + //{ + // //查看当前用户是否有所在药品抽屉的权限 + // bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); + // bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8&&n<17).Any(); + // bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); + // if (bLessEight) + // { + // if (App.CurrentFaUserList.Role.FirstEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bMoreEight) + // { + // if (App.CurrentFaUserList.Role.LastEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bEqualEight) + // { + // if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } - } + //} Status = 1; diff --git a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs index 77a5405..bd535dd 100644 --- a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs @@ -138,53 +138,53 @@ namespace DM_Weight.ViewModels { get => new DelegateCommand(() => { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8&&n<17).Any(); - bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } + //if (App.CurrentFaUserList.Role != null) + //{ + // //查看当前用户是否有所在药品抽屉的权限 + // bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); + // bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8&&n<17).Any(); + // bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); + // if (bLessEight) + // { + // if (App.CurrentFaUserList.Role.FirstEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bMoreEight) + // { + // if (App.CurrentFaUserList.Role.LastEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bEqualEight) + // { + // if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } - } + //} Status = 1; _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉"); diff --git a/DM_Weight/ViewModels/HomeWindowViewModel.cs b/DM_Weight/ViewModels/HomeWindowViewModel.cs index 7786bed..a03efa8 100644 --- a/DM_Weight/ViewModels/HomeWindowViewModel.cs +++ b/DM_Weight/ViewModels/HomeWindowViewModel.cs @@ -38,7 +38,7 @@ namespace DM_Weight.ViewModels private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1"); public bool MultiLogin { - get => loginMode == 2; + get => !App.SingleModel;// loginMode == 2; } private PremissionDm? _selectedMenu; @@ -206,7 +206,7 @@ namespace DM_Weight.ViewModels logger.Info($"用户【{Operator?.Nickname}】退出登录"); Operator = null; Reviewer = null; - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + _regionManager.RequestNavigate("MainRegion", "BeforeLogin"); } else { @@ -358,7 +358,7 @@ namespace DM_Weight.ViewModels Reviewer = null; Application.Current.Dispatcher.Invoke(() => { - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + _regionManager.RequestNavigate("MainRegion", "BeforeLogin"); }); AlertMsg alertMsg = new AlertMsg { @@ -394,7 +394,7 @@ namespace DM_Weight.ViewModels Reviewer = null; Application.Current.Dispatcher.Invoke(() => { - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + _regionManager.RequestNavigate("MainRegion", "BeforeLogin"); timer.Stop(); }); } @@ -433,7 +433,7 @@ namespace DM_Weight.ViewModels logger.Info($"用户【{Operator?.Nickname}】退出登录"); Operator = null; Reviewer = null; - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + _regionManager.RequestNavigate("MainRegion", "BeforeLogin"); } else { @@ -453,7 +453,7 @@ namespace DM_Weight.ViewModels logger.Info($"用户【{Operator?.Nickname}】退出登录"); Operator = null; Reviewer = null; - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + _regionManager.RequestNavigate("MainRegion", "BeforeLogin"); } else { @@ -474,7 +474,7 @@ namespace DM_Weight.ViewModels logger.Info($"用户【{Operator?.Nickname}】退出登录"); Operator = null; Reviewer = null; - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + _regionManager.RequestNavigate("MainRegion", "BeforeLogin"); } else { @@ -493,7 +493,7 @@ namespace DM_Weight.ViewModels logger.Info($"用户【{Operator?.Nickname}】退出登录"); Operator = null; Reviewer = null; - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + _regionManager.RequestNavigate("MainRegion", "BeforeLogin"); } else { @@ -512,7 +512,7 @@ namespace DM_Weight.ViewModels logger.Info($"用户【{Operator?.Nickname}】退出登录"); Operator = null; Reviewer = null; - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + _regionManager.RequestNavigate("MainRegion", "BeforeLogin"); } else { diff --git a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs index 2e1dabe..7dc4f59 100644 --- a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs @@ -177,53 +177,53 @@ namespace DM_Weight.ViewModels { if (Status == 0) { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); - bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } + //if (App.CurrentFaUserList.Role != null) + //{ + // //查看当前用户是否有所在药品抽屉的权限 + // bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); + // bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); + // bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); + // if (bLessEight) + // { + // if (App.CurrentFaUserList.Role.FirstEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bMoreEight) + // { + // if (App.CurrentFaUserList.Role.LastEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bEqualEight) + // { + // if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } - } + //} enumerator.MoveNext(); Status = 1; diff --git a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs index b5566dc..eed90fd 100644 --- a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs @@ -253,53 +253,53 @@ namespace DM_Weight.ViewModels if (Status == 0) { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); - bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } + //if (App.CurrentFaUserList.Role != null) + //{ + // //查看当前用户是否有所在药品抽屉的权限 + // bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); + // bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); + // bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); + // if (bLessEight) + // { + // if (App.CurrentFaUserList.Role.FirstEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bMoreEight) + // { + // if (App.CurrentFaUserList.Role.LastEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bEqualEight) + // { + // if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") + // { + // 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/LoginWindowViewModel.cs b/DM_Weight/ViewModels/LoginWindowViewModel.cs index 048a019..1b95b96 100644 --- a/DM_Weight/ViewModels/LoginWindowViewModel.cs +++ b/DM_Weight/ViewModels/LoginWindowViewModel.cs @@ -46,13 +46,15 @@ namespace DM_Weight.ViewModels public bool SingleLogin { - get => ReadAppSetting("loginMode") == "1"; + //get => ReadAppSetting("loginMode") == "1"; //get => loginMode == 1; + get;set; } public bool MultiLogin { //get => loginMode == 2; - get => ReadAppSetting("loginMode") == "2"; + //get => ReadAppSetting("loginMode") == "2"; + get;set; } private FingerprintUtil _fingerprintUtil; @@ -393,6 +395,9 @@ _exitCommand ??= new DelegateCommand(Exit); //接收导航传过来的参数 现在是在此处初始化了表格数据 public void OnNavigatedTo(NavigationContext navigationContext) { + SingleLogin = navigationContext.Parameters.GetValue("SingleLogin"); + MultiLogin = !SingleLogin; + FingerMsg = !_fingerprintUtil.bIsConnected;//false; _eventAggregator.GetEvent().Subscribe(LoginEvent); } diff --git a/DM_Weight/ViewModels/MainWindowViewModel.cs b/DM_Weight/ViewModels/MainWindowViewModel.cs index 6c13274..04f0346 100644 --- a/DM_Weight/ViewModels/MainWindowViewModel.cs +++ b/DM_Weight/ViewModels/MainWindowViewModel.cs @@ -80,8 +80,11 @@ namespace DM_Weight.ViewModels System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() => { - _container.RegisterType("LoginWindow"); - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + //_container.RegisterType("LoginWindow"); + //_regionManager.RequestNavigate("MainRegion", "LoginWindow"); + + _container.RegisterType("BeforeLogin"); + _regionManager.RequestNavigate("MainRegion", "BeforeLogin"); })); diff --git a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs index ad704c5..d8d43a9 100644 --- a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs @@ -247,53 +247,53 @@ namespace DM_Weight.ViewModels { if (Status == 0) { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); - bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } + //if (App.CurrentFaUserList.Role != null) + //{ + // //查看当前用户是否有所在药品抽屉的权限 + // bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); + // bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); + // bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); + // if (bLessEight) + // { + // if (App.CurrentFaUserList.Role.FirstEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bMoreEight) + // { + // if (App.CurrentFaUserList.Role.LastEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bEqualEight) + // { + // if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") + // { + // 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 bc7e130..a302105 100644 --- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs @@ -192,6 +192,12 @@ namespace DM_Weight.ViewModels { OrderDetail orderDetail = orderDetails[i]; + //bool bAdmin=false; + ////有开后8个抽屉的权限 + //if(App.CurrentFaUserList.Role.LastEightChecked=="1") + //{ + // bAdmin = true; + //} List HasQChannels = SqlSugarHelper.Db.Queryable() .Includes(cs => cs.DrugInfo) .InnerJoin((cs, cl) => cs.Chnguid == cl.Id && cs.DrugId == cl.DrugId) @@ -201,6 +207,8 @@ namespace DM_Weight.ViewModels .WhereIF(!string.IsNullOrEmpty(orderDetail.SetEffDate), cs => cs.EffDate.Equals(orderDetail.SetEffDate)) .WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo)) .Where(cs => cs.DrugId == orderDetail.DrugId) + .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8) .OrderBy(cs => cs.EffDate) .OrderBy(cs => cs.DrawerNo) .OrderBy(cs => cs.ManuNo) @@ -262,53 +270,6 @@ namespace DM_Weight.ViewModels { if (Status == 0) { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); - bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - 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/ReturnDrugDialogViewModel.cs b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs index 6d6b271..e393973 100644 --- a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs @@ -193,53 +193,53 @@ namespace DM_Weight.ViewModels { get => new DelegateCommand(() => { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); - bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } + //if (App.CurrentFaUserList.Role != null) + //{ + // //查看当前用户是否有所在药品抽屉的权限 + // bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); + // bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); + // bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); + // if (bLessEight) + // { + // if (App.CurrentFaUserList.Role.FirstEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bMoreEight) + // { + // if (App.CurrentFaUserList.Role.LastEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bEqualEight) + // { + // if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } - } + //} if (ChannelStock != null) { Status = 1; diff --git a/DM_Weight/ViewModels/ReturnDrugWindow2ViewModel.cs b/DM_Weight/ViewModels/ReturnDrugWindow2ViewModel.cs index 280ec39..41fe93b 100644 --- a/DM_Weight/ViewModels/ReturnDrugWindow2ViewModel.cs +++ b/DM_Weight/ViewModels/ReturnDrugWindow2ViewModel.cs @@ -218,7 +218,10 @@ namespace DM_Weight.ViewModels int totalCount = 0; List queryData = SqlSugarHelper.Db.Queryable() .InnerJoin((oi, od) => oi.OrderNo == od.OrderNo) - .InnerJoin(SqlSugarHelper.Db.Queryable().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId) + .InnerJoin(SqlSugarHelper.Db.Queryable().Where(cs => cs.DrawerType == 1) + .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8) + .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId) .WhereIF(OrderDate != null, oi => oi.OrderDate.ToString("yyyy-MM-dd") == OrderDate) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue) diff --git a/DM_Weight/ViewModels/ReturnDrugWindowViewModel.cs b/DM_Weight/ViewModels/ReturnDrugWindowViewModel.cs index b319fa9..50d24e1 100644 --- a/DM_Weight/ViewModels/ReturnDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/ReturnDrugWindowViewModel.cs @@ -184,6 +184,8 @@ namespace DM_Weight.ViewModels .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (mr) => mr.DrugInfo.DrugName.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (mr) => mr.DrugInfo.PyCode.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (mr) => mr.DrugInfo.DrugBarcode.Contains(SearchValue)) + .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8) .OrderBy(mr => mr.OperationTime) .ToList(); MachineRecords = queryData; diff --git a/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs b/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs index bc6b089..9ac9304 100644 --- a/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs @@ -235,53 +235,53 @@ namespace DM_Weight.ViewModels else { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStock.DrawerNo <= 8; - bool bMoreEight = ChannelStock.DrawerNo > 8; - bool bEqualEight = ChannelStock.DrawerNo == 17; - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } + //if (App.CurrentFaUserList.Role != null) + //{ + // //查看当前用户是否有所在药品抽屉的权限 + // bool bLessEight = ChannelStock.DrawerNo <= 8; + // bool bMoreEight = ChannelStock.DrawerNo > 8; + // bool bEqualEight = ChannelStock.DrawerNo == 17; + // if (bLessEight) + // { + // if (App.CurrentFaUserList.Role.FirstEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bMoreEight) + // { + // if (App.CurrentFaUserList.Role.LastEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bEqualEight) + // { + // if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } - } + //} Status = 1; _portUtil.SpeakAsync("正在打开" + ChannelStock.DrawerNo + "号抽屉"); _portUtil.WindowName = WindowName; diff --git a/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs b/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs index 97b09c4..312f534 100644 --- a/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs +++ b/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using DM_Weight.Models; using DM_Weight.util; using DM_Weight.Report; +using System.Configuration; namespace DM_Weight.ViewModels { @@ -104,6 +105,9 @@ namespace DM_Weight.ViewModels Channels = SqlSugarHelper.Db.Queryable() .LeftJoin((cs,di) => cs.DrugId == di.DrugId.ToString()) .Where((cs) => cs.DrawerType != 1) + .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8) + .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")) .Select((cs, di) => new ChannelStock{ CanReturnQuantity = SqlFunc.Subqueryable().Where(mr => mr.DrugId == cs.DrugId).Where(mr => mr.Type == 2).Where(mr => mr.Status != 2).Select(mr => SqlFunc.IsNull(SqlFunc.AggregateSumNoNull(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2), 0)) , DrugInfo = new DrugInfo diff --git a/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs b/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs index ef9378b..eb8be5d 100644 --- a/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs +++ b/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs @@ -343,15 +343,15 @@ namespace DM_Weight.ViewModels PremissionName = "交接班记录", PremissionPath = "ChangeShiftsListWindow", }; + //PremissionDm kuguan6 = new PremissionDm + //{ + // Id = 46, + // PremissionName = "账册", + // PremissionPath = "AccountWindow", + //}; PremissionDm kuguan6 = new PremissionDm { Id = 46, - PremissionName = "账册", - PremissionPath = "AccountWindow", - }; - PremissionDm kuguan66 = new PremissionDm - { - Id = 466, PremissionName = "专用账册", PremissionPath = "SpecialAccountWindow", }; @@ -367,7 +367,7 @@ namespace DM_Weight.ViewModels kuguanChild.Add(kuguan4); kuguanChild.Add(kuguan5); kuguanChild.Add(kuguan6); - kuguanChild.Add(kuguan66); + //kuguanChild.Add(kuguan66); //kuguanChild.Add(kuguan7); kuguan.Children = kuguanChild; defaultAll.Add(kuguan); diff --git a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs index 46f984d..4e50021 100644 --- a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs @@ -176,53 +176,53 @@ namespace DM_Weight.ViewModels { if (Status == 0) { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); - bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } + //if (App.CurrentFaUserList.Role != null) + //{ + // //查看当前用户是否有所在药品抽屉的权限 + // bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); + // bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); + // bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); + // if (bLessEight) + // { + // if (App.CurrentFaUserList.Role.FirstEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bMoreEight) + // { + // if (App.CurrentFaUserList.Role.LastEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bEqualEight) + // { + // if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } - } + //} enumerator.MoveNext(); Status = 1; OpenOneByOne(); diff --git a/DM_Weight/ViewModels/SelfAddWindowViewModel.cs b/DM_Weight/ViewModels/SelfAddWindowViewModel.cs index 0fdf91c..1ee97fe 100644 --- a/DM_Weight/ViewModels/SelfAddWindowViewModel.cs +++ b/DM_Weight/ViewModels/SelfAddWindowViewModel.cs @@ -211,7 +211,10 @@ namespace DM_Weight.ViewModels // .ToList(); //ChannelStocks = queryData; List q = SqlSugarHelper.Db.Queryable() - .Includes(di => di.channelStocks.Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList()) + .Includes(di => di.channelStocks.Where(cs => cs.DrawerType == 1) + .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8) + .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList()) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue)) diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs index 5ec9e2c..ee525ff 100644 --- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs @@ -168,53 +168,53 @@ namespace DM_Weight.ViewModels { if (Status == 0) { - if (App.CurrentFaUserList.Role != null) - { - //查看当前用户是否有所在药品抽屉的权限 - bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); - bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); - bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); - if (bLessEight) - { - if (App.CurrentFaUserList.Role.FirstEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bMoreEight) - { - if (App.CurrentFaUserList.Role.LastEightChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } - if (bEqualEight) - { - if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") - { - AlertMsg alertMsg = new AlertMsg - { - Message = "当前用户没有打开抽屉的权限!", - Type = MsgType.ERROR, - }; - _eventAggregator.GetEvent().Publish(alertMsg); - return; - } - } + //if (App.CurrentFaUserList.Role != null) + //{ + // //查看当前用户是否有所在药品抽屉的权限 + // bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any(); + // bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any(); + // bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any(); + // if (bLessEight) + // { + // if (App.CurrentFaUserList.Role.FirstEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bMoreEight) + // { + // if (App.CurrentFaUserList.Role.LastEightChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } + // if (bEqualEight) + // { + // if (App.CurrentFaUserList.Role.StorageBoxChecked == "0") + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "当前用户没有打开抽屉的权限!", + // Type = MsgType.ERROR, + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // return; + // } + // } - } + //} enumerator.MoveNext(); Status = 1; OpenOneByOne(); diff --git a/DM_Weight/ViewModels/SelfTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/SelfTakeDrugWindowViewModel.cs index 80769f9..4da590d 100644 --- a/DM_Weight/ViewModels/SelfTakeDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/SelfTakeDrugWindowViewModel.cs @@ -197,6 +197,8 @@ namespace DM_Weight.ViewModels //ChannelStocks = queryData; List q = SqlSugarHelper.Db.Queryable() .Includes(di => di.channelStocks.Where(cs => cs.DrawerType == 1) + .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8 ) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8 ) .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.Quantity>0).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList()) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue)) diff --git a/DM_Weight/ViewModels/StockListWindowViewModel.cs b/DM_Weight/ViewModels/StockListWindowViewModel.cs index 480340d..425593e 100644 --- a/DM_Weight/ViewModels/StockListWindowViewModel.cs +++ b/DM_Weight/ViewModels/StockListWindowViewModel.cs @@ -243,12 +243,15 @@ namespace DM_Weight.ViewModels List q = SqlSugarHelper.Db.Queryable() .Includes(di => di.channelStocks.Where(cs => cs.DrawerType == 1) - .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList()) - .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue)) + .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 + .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8) + .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList()) + .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue)) - .Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null)) + .WhereIF(App.SingleModel, di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.DrawerNo <= 8&& cs.DrawerType == 1)) + .WhereIF(!(App.SingleModel), di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.DrawerNo > 8&& cs.DrawerType == 1)) .OrderBy(cs => cs.DrugId) .ToList(); Drugs = q; diff --git a/DM_Weight/Views/AddDrugControl.xaml b/DM_Weight/Views/AddDrugControl.xaml index 50a0e68..d318830 100644 --- a/DM_Weight/Views/AddDrugControl.xaml +++ b/DM_Weight/Views/AddDrugControl.xaml @@ -141,23 +141,22 @@ - + + + + + + diff --git a/DM_Weight/Views/BeforeLogin.xaml.cs b/DM_Weight/Views/BeforeLogin.xaml.cs new file mode 100644 index 0000000..86e7686 --- /dev/null +++ b/DM_Weight/Views/BeforeLogin.xaml.cs @@ -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 +{ + /// + /// BeforeLogin.xaml 的交互逻辑 + /// + public partial class BeforeLogin : UserControl + { + public BeforeLogin() + { + InitializeComponent(); + } + } +} diff --git a/DM_Weight/Views/Dialog/OrderTakeDialog.xaml b/DM_Weight/Views/Dialog/OrderTakeDialog.xaml index 2cdc78c..1155119 100644 --- a/DM_Weight/Views/Dialog/OrderTakeDialog.xaml +++ b/DM_Weight/Views/Dialog/OrderTakeDialog.xaml @@ -21,7 +21,7 @@ - + @@ -107,6 +107,7 @@ Text="{Binding OrderInfo.Age}" /> + + diff --git a/DM_Weight/Views/LoginWindow.xaml b/DM_Weight/Views/LoginWindow.xaml index 55287cb..47567b0 100644 --- a/DM_Weight/Views/LoginWindow.xaml +++ b/DM_Weight/Views/LoginWindow.xaml @@ -56,7 +56,7 @@ FontSize="28" Foreground="#31ccec" FontWeight="Bold" - Text="欢迎登录麻醉药品管理系统"> + Text="欢迎登录麻精药品管理系统">