角色中添加打开抽屉权限
This commit is contained in:
		
							parent
							
								
									d4c42203d2
								
							
						
					
					
						commit
						0aec8f0dc5
					
				| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
  <connectionStrings>
 | 
			
		||||
	<!-- 数据库连接字符串 -->
 | 
			
		||||
	<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
 | 
			
		||||
	<add name="database" connectionString="server=127.0.0.1;port=3306;database=hunanxianchang_db;userid=root;password=root" />
 | 
			
		||||
	<add name="database" connectionString="server=127.0.0.1;port=3306;database=sanya_xianchang;userid=root;password=root" />
 | 
			
		||||
  </connectionStrings>
 | 
			
		||||
	<!--<runtime>
 | 
			
		||||
		--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Converter
 | 
			
		||||
{
 | 
			
		||||
    internal class DrawerAuthorityConverter : IValueConverter
 | 
			
		||||
    {
 | 
			
		||||
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
        {
 | 
			
		||||
            if (value != null && value.ToString().Equals("1"))
 | 
			
		||||
            {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
                return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
        {
 | 
			
		||||
            bool isTrue;
 | 
			
		||||
            if (bool.TryParse(value.ToString(), out isTrue))
 | 
			
		||||
            {
 | 
			
		||||
                if(isTrue)
 | 
			
		||||
                {
 | 
			
		||||
                    return 1;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +87,7 @@ namespace DM_Weight.Models
 | 
			
		|||
        ///  
 | 
			
		||||
        /// 默认值: 1
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "state")]
 | 
			
		||||
        [SugarColumn(ColumnName = "dm_state")]
 | 
			
		||||
        public int? State { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(IsIgnore = true)]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,5 +36,22 @@ namespace DM_Weight.Models
 | 
			
		|||
        ///</summary>
 | 
			
		||||
         [SugarColumn(ColumnName="machine_id"    )]
 | 
			
		||||
         public string MachineId { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  1-8号抽屉
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "FirstEightChecked")]
 | 
			
		||||
        public string FirstEightChecked { get; set; } = "0";
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  9-16号抽屉
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        [SugarColumn(ColumnName= "LastEightChecked")]
 | 
			
		||||
         public string LastEightChecked { get; set; } = "0";
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  17号抽屉
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        [SugarColumn(ColumnName= "StorageBoxChecked")]
 | 
			
		||||
         public string StorageBoxChecked { get; set; } = "0";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -185,6 +185,53 @@ 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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (bMoreEight)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (bEqualEight)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                Status = 1;
 | 
			
		||||
                _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
    public class CheckStockNewWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        //public static CheckStockNewWindowViewModel vm;
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(CheckStockWindowViewModel));
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(CheckStockNewWindowViewModel));
 | 
			
		||||
        public string drugId;
 | 
			
		||||
        //public string Stock;
 | 
			
		||||
        private static readonly DateTime Jan1st1970 = new DateTime
 | 
			
		||||
| 
						 | 
				
			
			@ -317,6 +317,28 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            IGrouping<int, ChannelStock> grouping = enumerator.Current;
 | 
			
		||||
            //int DrawerNo =Convert.ToInt32(grouping.Key.Substring(0,grouping.Key.IndexOf('-')));
 | 
			
		||||
            int DrawerNo = grouping.Key;
 | 
			
		||||
 | 
			
		||||
            if (DrawerNo <= 8)
 | 
			
		||||
            {
 | 
			
		||||
                if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
 | 
			
		||||
                {
 | 
			
		||||
                    NoAuthority();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (DrawerNo > 8 && DrawerNo != 17)
 | 
			
		||||
            {
 | 
			
		||||
                if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                {
 | 
			
		||||
                    NoAuthority();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (DrawerNo == 17)
 | 
			
		||||
            {
 | 
			
		||||
                if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                {
 | 
			
		||||
                    NoAuthority();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            List<ChannelStock> Stocks = grouping.ToList();
 | 
			
		||||
            Stocks.ForEach(it => it.process = 1);
 | 
			
		||||
            _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
 | 
			
		||||
| 
						 | 
				
			
			@ -718,5 +740,42 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            // 取消消息订阅
 | 
			
		||||
            _eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //无权限,进入下一个抽屉
 | 
			
		||||
        private void NoAuthority()
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
 | 
			
		||||
            int DrawerNoBefore = groupingBefore.Key; //Convert.ToInt32(groupingBefore.Key.Substring(0, groupingBefore.Key.IndexOf('-')));
 | 
			
		||||
            if (enumerator.MoveNext())
 | 
			
		||||
            {
 | 
			
		||||
                IGrouping<int, ChannelStock> groupingAfter = enumerator.Current;
 | 
			
		||||
                int DrawerNoAfter = groupingAfter.Key;//Convert.ToInt32(groupingAfter.Key.Substring(0, groupingAfter.Key.IndexOf('-')));
 | 
			
		||||
                                                      //if (DrawerNoBefore < 9 && DrawerNoAfter > 8)
 | 
			
		||||
                                                      //{
 | 
			
		||||
                                                      //    Thread.Sleep(50);
 | 
			
		||||
                                                      //}
 | 
			
		||||
 | 
			
		||||
                logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
 | 
			
		||||
                if (DrawerNoAfter == 17 || DrawerNoBefore == 17)
 | 
			
		||||
                {
 | 
			
		||||
                    //if (DrawerNoBefore == 17)
 | 
			
		||||
                    {
 | 
			
		||||
                        int sleepMilliseconds = Convert.ToInt32(ConfigurationManager.AppSettings["CheckSleepMilliseconds"] ?? "500");
 | 
			
		||||
                        Thread.Sleep(sleepMilliseconds);
 | 
			
		||||
                    }
 | 
			
		||||
                    //else
 | 
			
		||||
                    //{
 | 
			
		||||
                    //    Thread.Sleep(500);
 | 
			
		||||
                    //}
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    //Thread.Sleep(80);
 | 
			
		||||
                    Thread.Sleep(500);
 | 
			
		||||
                }
 | 
			
		||||
                OpenOneByOne();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -121,6 +121,55 @@ 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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (bMoreEight)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (bEqualEight)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                Status = 1;
 | 
			
		||||
                _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -138,6 +138,54 @@ 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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (bMoreEight)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (bEqualEight)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                Status = 1;
 | 
			
		||||
                _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,11 +35,11 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            get => _channelStocks;
 | 
			
		||||
            set => SetProperty(ref _channelStocks, value);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        private static readonly DateTime Jan1st1970 = new DateTime
 | 
			
		||||
    (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
 | 
			
		||||
 | 
			
		||||
       
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private PortUtil _portUtil;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +93,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _status;
 | 
			
		||||
| 
						 | 
				
			
			@ -129,7 +129,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            }, (DrawerNo) => Status == 0
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand OpenDrawer
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -137,6 +137,48 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            {
 | 
			
		||||
                if (Status == 0)
 | 
			
		||||
                {
 | 
			
		||||
                    if (App.CurrentFaUserList.Role != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (DrawerNo <= 8)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (DrawerNo > 8)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (DrawerNo == 17)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    Status = 1;
 | 
			
		||||
                    _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -144,7 +186,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    //                  group t by new { t.ColNo, t.BoardType }
 | 
			
		||||
                    //                 into grp
 | 
			
		||||
                    //                  select new { grp.Key.ColNo, grp.Key.BoardType, quantity = grp.Sum(t => t.Quantity) }).ToList();
 | 
			
		||||
                    
 | 
			
		||||
 | 
			
		||||
                    List<ChannelStock> singleChannels = ChannelStocks.FindAll(it => it.BoardType != 1);
 | 
			
		||||
 | 
			
		||||
                    _portUtil.WindowName = "DrawerTakeDrugWindow";
 | 
			
		||||
| 
						 | 
				
			
			@ -206,7 +248,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    ColNo = it.ColNo,
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    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,
 | 
			
		||||
                                    Reviewer = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    OperationTime = DateTime.Now,
 | 
			
		||||
| 
						 | 
				
			
			@ -224,7 +266,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            }
 | 
			
		||||
                            return true;
 | 
			
		||||
                        });
 | 
			
		||||
                         if (f.Data)
 | 
			
		||||
                        if (f.Data)
 | 
			
		||||
                        {
 | 
			
		||||
                            logger.Info("更新屏显库存singleChannels");
 | 
			
		||||
                            // 更新屏显库存
 | 
			
		||||
| 
						 | 
				
			
			@ -282,7 +324,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -177,6 +177,54 @@ 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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bMoreEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bEqualEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    enumerator.MoveNext();
 | 
			
		||||
                    Status = 1;
 | 
			
		||||
                    OpenOneByOne();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -743,8 +743,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            sb.Append(" (SELECT drug_id,in_pharmacy_id,out_pharmacy_id, invoice_no as InvoiceNo, DATE_FORMAT(Invoice_Date,'%Y-%m-%d')  as InvoiceDate, SUM(quantity) as quantity ");
 | 
			
		||||
            sb.Append(" FROM in_out_invoice where status=@Status  and type!=@type  and cancel_flag=@CancelFlag GROUP BY invoice_no,drug_id) i ");
 | 
			
		||||
            sb.Append(" inner join ( select c.drug_id as drug_id from channel_list c where c.machine_id = '" + (ConfigurationManager.AppSettings["machineId"] ?? "DM1") + "' group by c.drug_id ) di on di.drug_id = i.drug_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p1 on p1.pharmacy_id = i.in_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p2 on p2.pharmacy_id = i.out_pharmacy_id where 1=1");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p1 on p1.pharmacy = i.in_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id where 1=1");
 | 
			
		||||
            //sb.Append(" where i.status=@Status ");
 | 
			
		||||
            //sb.Append(" and i.type!=@type ");
 | 
			
		||||
            //sb.Append(" and i.cancel_flag=@CancelFlag ");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -214,8 +214,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            var sb = new StringBuilder();
 | 
			
		||||
            sb.Append("select i.invoice_no as InvoiceNo, i.invoice_date as InvoiceDate, COUNT(i.id) as `Count`, SUM(i.quantity) as quantity, p1.pharmacy_name as PharmacyName1, p2.pharmacy_name as PharmacyName2 from in_out_invoice i");
 | 
			
		||||
            sb.Append(" inner join ( select c.drug_id as drug_id from channel_stock c where c.machine_id = '" + (ConfigurationManager.AppSettings["machineId"] ?? "DM1") + "' group by c.drug_id ) di on di.drug_id = i.drug_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p1 on p1.pharmacy_id = i.in_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p2 on p2.pharmacy_id = i.out_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p1 on p1.pharmacy = i.in_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id");
 | 
			
		||||
            sb.Append(" where i.status=@Status ");
 | 
			
		||||
            sb.Append(" and i.type!=@type ");
 | 
			
		||||
            sb.Append(" and i.cancel_flag=@CancelFlag ");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -252,6 +252,54 @@ 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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bMoreEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bEqualEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                    enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
 | 
			
		||||
                    enumerator = enumerable.GetEnumerator();
 | 
			
		||||
                    enumerator.MoveNext();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -247,6 +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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bMoreEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bEqualEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                    enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
 | 
			
		||||
                    enumerator = enumerable.GetEnumerator();
 | 
			
		||||
                    enumerator.MoveNext();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
        private PortUtil _portUtil;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        IDialogService _dialogService; 
 | 
			
		||||
        IDialogService _dialogService;
 | 
			
		||||
        //private SqlSugarScope SqlSugarHelper.Db;
 | 
			
		||||
        public OrderTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService, SqlSugarScope sqlSugarScope)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -171,11 +171,11 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
        public void RequestData()
 | 
			
		||||
        {
 | 
			
		||||
          orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
 | 
			
		||||
                .Includes<DrugInfo>(od => od.DrugInfo)
 | 
			
		||||
                .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
 | 
			
		||||
                .Where(od => od.OrderNo == OrderInfo.OrderNo)
 | 
			
		||||
                .ToList();
 | 
			
		||||
            orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
 | 
			
		||||
                  .Includes<DrugInfo>(od => od.DrugInfo)
 | 
			
		||||
                  .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
 | 
			
		||||
                  .Where(od => od.OrderNo == OrderInfo.OrderNo)
 | 
			
		||||
                  .ToList();
 | 
			
		||||
 | 
			
		||||
            List<ChannelStock> channelStocks = new List<ChannelStock>();
 | 
			
		||||
            List<string> msg = new List<string>();
 | 
			
		||||
| 
						 | 
				
			
			@ -194,7 +194,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    .Where(cs => cs.DrugId == orderDetail.DrugId)
 | 
			
		||||
                    .OrderBy(cs => cs.EffDate)
 | 
			
		||||
                    .OrderBy(cs => cs.DrawerNo)
 | 
			
		||||
                    .OrderBy(cs=> cs.ManuNo)
 | 
			
		||||
                    .OrderBy(cs => cs.ManuNo)
 | 
			
		||||
                    .ToList();
 | 
			
		||||
                int total = HasQChannels.Sum(it => it.Quantity);
 | 
			
		||||
                int TakeQ = orderDetail.Quantity;
 | 
			
		||||
| 
						 | 
				
			
			@ -230,7 +230,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                dialogParameters.Add("msgInfo", msg);
 | 
			
		||||
                DialogServiceExtensions.ShowDialogHost(_dialogService, "ShowMessageDialog", dialogParameters, "RootDialog");
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -253,6 +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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bMoreEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bEqualEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                    enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
 | 
			
		||||
                    enumerator = enumerable.GetEnumerator();
 | 
			
		||||
                    enumerator.MoveNext();
 | 
			
		||||
| 
						 | 
				
			
			@ -278,7 +325,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
 | 
			
		||||
                singleChannels.Add(copy);
 | 
			
		||||
            }
 | 
			
		||||
            singleChannels=singleChannels
 | 
			
		||||
            singleChannels = singleChannels
 | 
			
		||||
               .GroupBy(it => new { it.DrawerNo, it.ColNo })
 | 
			
		||||
               .Select(it =>
 | 
			
		||||
               {
 | 
			
		||||
| 
						 | 
				
			
			@ -402,12 +449,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                                                         }).ToList();
 | 
			
		||||
                            //if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                            //{
 | 
			
		||||
                                //singleChannels.ForEach(it =>
 | 
			
		||||
                                //{
 | 
			
		||||
                                //    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                //});
 | 
			
		||||
                            //singleChannels.ForEach(it =>
 | 
			
		||||
                            //{
 | 
			
		||||
                            //    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                            //});
 | 
			
		||||
                            //}
 | 
			
		||||
                            if(singleChannels.Count > 0)
 | 
			
		||||
                            if (singleChannels.Count > 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                                {
 | 
			
		||||
| 
						 | 
				
			
			@ -430,7 +477,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        }
 | 
			
		||||
                        if(!f.IsSuccess)
 | 
			
		||||
                        if (!f.IsSuccess)
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -193,6 +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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (bMoreEight)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (bEqualEight)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                if (ChannelStock != null)
 | 
			
		||||
                {
 | 
			
		||||
                    Status = 1;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -199,6 +199,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                if (ChannelStock != null)
 | 
			
		||||
                {
 | 
			
		||||
                    if (Status == 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -209,6 +210,54 @@ 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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                        return;
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                if (bMoreEight)
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                                    {
 | 
			
		||||
                                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                        {
 | 
			
		||||
                                            Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                            Type = MsgType.ERROR,
 | 
			
		||||
                                        };
 | 
			
		||||
                                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                        return;
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                if (bEqualEight)
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                                    {
 | 
			
		||||
                                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                        {
 | 
			
		||||
                                            Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                            Type = MsgType.ERROR,
 | 
			
		||||
                                        };
 | 
			
		||||
                                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                        return;
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                            }
 | 
			
		||||
                            Status = 1;
 | 
			
		||||
                            _portUtil.SpeakAsync("正在打开" + ChannelStock.DrawerNo + "号抽屉");
 | 
			
		||||
                            _portUtil.WindowName = WindowName;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            get { return _roleList; }
 | 
			
		||||
            set { SetProperty(ref _roleList, value); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //private SqlSugarScope SqlSugarHelper.Db;
 | 
			
		||||
        public RoleManagerWindowViewModel(SqlSugarScope sqlSugarScope)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -247,7 +249,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            PremissionDm jiayao5 = new PremissionDm
 | 
			
		||||
            {
 | 
			
		||||
                Id = 24,
 | 
			
		||||
                PremissionName = "多批次抽屉加药",
 | 
			
		||||
                PremissionName = "批次抽屉加药",
 | 
			
		||||
                PremissionPath = "AddDrugControl",
 | 
			
		||||
            };
 | 
			
		||||
            jiayaoChild.Add(jiayao1);
 | 
			
		||||
| 
						 | 
				
			
			@ -697,6 +699,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                Role.Id = 0;
 | 
			
		||||
                Role.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
 | 
			
		||||
                Role.Permissions = RightPremissions.ToList();
 | 
			
		||||
               
 | 
			
		||||
                List<RoleDm> roleList = SqlSugarHelper.Db.Queryable<RoleDm>().Where(r => r.RoleName == Role.RoleName).ToList();
 | 
			
		||||
                if(roleList.Count>0)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -743,8 +746,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                .Where(di => di.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue), (di) => di.RoleName.Contains(SearchValue??""))
 | 
			
		||||
                .Select(r => r)
 | 
			
		||||
                .ToList()
 | 
			
		||||
                ;
 | 
			
		||||
                .ToList();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -176,6 +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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bMoreEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bEqualEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                    enumerator.MoveNext();
 | 
			
		||||
                    Status = 1;
 | 
			
		||||
                    OpenOneByOne();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -168,6 +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<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bMoreEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.LastEightChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (bEqualEight)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "当前用户没有打开抽屉的权限!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                    enumerator.MoveNext();
 | 
			
		||||
                    Status = 1;
 | 
			
		||||
                    OpenOneByOne();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@
 | 
			
		|||
            xmlns:prism="http://prismlibrary.com/"
 | 
			
		||||
            mc:Ignorable="d">
 | 
			
		||||
    <UserControl.Resources>
 | 
			
		||||
        <convert:DrawerAuthorityConverter x:Key="DrawerAuthorityConverter" />
 | 
			
		||||
        <Style x:Key="st" TargetType="GridViewColumnHeader">
 | 
			
		||||
            <Style.Setters>
 | 
			
		||||
                <Setter Property="Height">
 | 
			
		||||
| 
						 | 
				
			
			@ -95,6 +96,7 @@
 | 
			
		|||
                <Grid.RowDefinitions>
 | 
			
		||||
                    <RowDefinition Height="Auto" />
 | 
			
		||||
                    <RowDefinition />
 | 
			
		||||
                    <RowDefinition Height="0.2*" />
 | 
			
		||||
                </Grid.RowDefinitions>
 | 
			
		||||
                <Grid Grid.Row="0">
 | 
			
		||||
                    <Grid.ColumnDefinitions>
 | 
			
		||||
| 
						 | 
				
			
			@ -190,6 +192,18 @@
 | 
			
		|||
                MessageQueue="{Binding SnackbarMessageQueue}"/>
 | 
			
		||||
                </Grid>
 | 
			
		||||
 | 
			
		||||
                <Grid Grid.Row="2">
 | 
			
		||||
                    <Grid.ColumnDefinitions>
 | 
			
		||||
                        <ColumnDefinition />
 | 
			
		||||
                        <ColumnDefinition />
 | 
			
		||||
                        <ColumnDefinition />
 | 
			
		||||
                        <ColumnDefinition />
 | 
			
		||||
                    </Grid.ColumnDefinitions>
 | 
			
		||||
                    <TextBlock Text="抽屉权限" FontWeight="Bold" FontSize="14"  Grid.Column="0" Margin="10"></TextBlock>
 | 
			
		||||
                    <CheckBox Content="1-8号抽屉" IsChecked="{Binding Role.FirstEightChecked, Converter={StaticResource DrawerAuthorityConverter}}" VerticalAlignment="Center"  HorizontalAlignment="Left" Grid.Column="1"/>
 | 
			
		||||
                    <CheckBox Content="9-16号抽屉" IsChecked="{Binding Role.LastEightChecked, Converter={StaticResource DrawerAuthorityConverter}}" VerticalAlignment="Center"  HorizontalAlignment="Left"  Grid.Column="2"/>
 | 
			
		||||
                    <CheckBox Content="17号抽屉"  IsChecked="{Binding Role.StorageBoxChecked, Converter={StaticResource DrawerAuthorityConverter}}" VerticalAlignment="Center"  HorizontalAlignment="Left" Grid.Column="3"/>
 | 
			
		||||
                </Grid>
 | 
			
		||||
            </Grid>
 | 
			
		||||
        </GroupBox>
 | 
			
		||||
    </Grid>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue