麻醉医生当天使用过的柜子与未使用过的柜子用颜色区分
This commit is contained in:
		
							parent
							
								
									f3c8aa5873
								
							
						
					
					
						commit
						9707453c98
					
				| 
						 | 
					@ -58,12 +58,13 @@ namespace DM_Weight.Models
 | 
				
			||||||
        /////</summary>
 | 
					        /////</summary>
 | 
				
			||||||
        //[SugarColumn(ColumnName = "manu_no")]
 | 
					        //[SugarColumn(ColumnName = "manu_no")]
 | 
				
			||||||
        //public string ManuNo { get; set; }
 | 
					        //public string ManuNo { get; set; }
 | 
				
			||||||
        ///// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /////  
 | 
					        ///  
 | 
				
			||||||
        ///// 默认值: NULL
 | 
					        ///这个值 用于控制柜子使用与未使用的状态
 | 
				
			||||||
        /////</summary>
 | 
					        ///自始至终未使用是空值,打开了则记录当前打开时间,根据时间修改按钮颜色
 | 
				
			||||||
        //[SugarColumn(ColumnName = "eff_date")]
 | 
					        ///</summary>
 | 
				
			||||||
        //public string EffDate { get; set; }
 | 
					        [SugarColumn(ColumnName = "eff_date")]
 | 
				
			||||||
 | 
					        public string EffDate { get; set; }
 | 
				
			||||||
        ///// <summary>
 | 
					        ///// <summary>
 | 
				
			||||||
        /////  
 | 
					        /////  
 | 
				
			||||||
        ///// 默认值: NULL
 | 
					        ///// 默认值: NULL
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,7 @@ using System.Linq.Expressions;
 | 
				
			||||||
using System.Text;
 | 
					using System.Text;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using System.Windows;
 | 
					using System.Windows;
 | 
				
			||||||
 | 
					using System.Windows.Media;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace DM_Weight.ViewModels
 | 
					namespace DM_Weight.ViewModels
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -120,6 +121,114 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
        public OrderInfo selectOrderInfo { get => _selectOrderInfo; set => SetProperty(ref _selectOrderInfo, value); }
 | 
					        public OrderInfo selectOrderInfo { get => _selectOrderInfo; set => SetProperty(ref _selectOrderInfo, value); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private Brush _button1Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button1Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button1Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button1Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button2Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button2Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button2Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button2Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button3Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button3Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button3Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button3Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button4Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button4Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button4Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button4Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button5Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button5Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button5Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button5Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button6Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button6Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button6Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button6Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button7Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button7Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button7Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button7Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button8Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button8Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button8Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button8Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button9Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button9Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button9Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button9Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button10Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button10Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button10Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button10Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button11Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button11Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button11Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button11Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button12Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button12Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button12Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button12Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button13Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button13Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button13Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button13Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button14Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button14Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button14Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button14Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button15Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button15Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button15Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button15Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button16Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button16Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button16Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button16Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button17Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button17Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button17Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button17Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Brush _button18Color = Brushes.White;
 | 
				
			||||||
 | 
					        public Brush Button18Color
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _button18Color; 
 | 
				
			||||||
 | 
					            set =>SetProperty(ref _button18Color, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        IEventAggregator _eventAggregator;
 | 
					        IEventAggregator _eventAggregator;
 | 
				
			||||||
        private PortUtil _portUtil;
 | 
					        private PortUtil _portUtil;
 | 
				
			||||||
| 
						 | 
					@ -149,8 +258,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            if (DrawerNo >= 0)
 | 
					            if (DrawerNo >= 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                //查询当前药箱归属的药师
 | 
					                //查询当前药箱归属的药师
 | 
				
			||||||
                string currentDrawerUser = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.DrawerNo == DrawerNo + 1 && cl.MachineId == "DM5").Select(cl => cl.BelongUser).First();
 | 
					                ChannelList currentList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.DrawerNo == DrawerNo + 1 && cl.MachineId == "DM5").First();//.Select(cl => cl.BelongUser).First();
 | 
				
			||||||
 | 
					                string currentDrawerUser = currentList.BelongUser;
 | 
				
			||||||
                OrderInfoList = SqlSugarHelper.Db.Queryable<OrderInfo>()
 | 
					                OrderInfoList = SqlSugarHelper.Db.Queryable<OrderInfo>()
 | 
				
			||||||
                                .Includes(oi => oi.OrderDetailList, od => od.DrugInfo)
 | 
					                                .Includes(oi => oi.OrderDetailList, od => od.DrugInfo)
 | 
				
			||||||
                               //.Includes(cl => cl.channelStocks, cs => cs.DrugInfo,di=>di.drugBase)
 | 
					                               //.Includes(cl => cl.channelStocks, cs => cs.DrugInfo,di=>di.drugBase)
 | 
				
			||||||
| 
						 | 
					@ -179,6 +288,138 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                TotalCount = totalCount;
 | 
					                TotalCount = totalCount;
 | 
				
			||||||
                PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
 | 
					                PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
 | 
				
			||||||
 | 
					                if(currentList.EffDate== DateTime.Now.ToString("yyyy-MM-dd"))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    switch (DrawerNo)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        case 1:
 | 
				
			||||||
 | 
					                            _button1Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 2:
 | 
				
			||||||
 | 
					                            _button2Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 3:
 | 
				
			||||||
 | 
					                            _button3Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 4:
 | 
				
			||||||
 | 
					                            _button4Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 5:
 | 
				
			||||||
 | 
					                            _button5Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 6:
 | 
				
			||||||
 | 
					                            _button6Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 7:
 | 
				
			||||||
 | 
					                            _button7Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 8:
 | 
				
			||||||
 | 
					                            _button8Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 9:
 | 
				
			||||||
 | 
					                            _button9Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 10:
 | 
				
			||||||
 | 
					                            _button10Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 11:
 | 
				
			||||||
 | 
					                            _button11Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 12:
 | 
				
			||||||
 | 
					                            _button12Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 13:
 | 
				
			||||||
 | 
					                            _button13Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 14:
 | 
				
			||||||
 | 
					                            _button14Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 15:
 | 
				
			||||||
 | 
					                            _button15Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 16:
 | 
				
			||||||
 | 
					                            _button16Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 17:
 | 
				
			||||||
 | 
					                            _button17Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 18:
 | 
				
			||||||
 | 
					                            _button18Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        default:
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            List<ChannelList> chlList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5").ToList();//.Select(cl => cl.BelongUser).First();
 | 
				
			||||||
 | 
					            if (chlList != null && chlList.Count > 0)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                for (int i = 0; i < chlList.Count; i++)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ChannelList chl = chlList[i];
 | 
				
			||||||
 | 
					                    if (chl.EffDate == DateTime.Now.ToString("yyyy-MM-dd"))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        switch (chl.DrawerNo)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            case 1:
 | 
				
			||||||
 | 
					                                Button1Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 2:
 | 
				
			||||||
 | 
					                                Button2Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 3:
 | 
				
			||||||
 | 
					                                Button3Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 4:
 | 
				
			||||||
 | 
					                                Button4Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 5:
 | 
				
			||||||
 | 
					                                Button5Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 6:
 | 
				
			||||||
 | 
					                                Button6Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 7:
 | 
				
			||||||
 | 
					                                Button7Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 8:
 | 
				
			||||||
 | 
					                                Button8Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 9:
 | 
				
			||||||
 | 
					                                Button9Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 10:
 | 
				
			||||||
 | 
					                                Button9Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 11:
 | 
				
			||||||
 | 
					                                Button9Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 12:
 | 
				
			||||||
 | 
					                                Button12Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 13:
 | 
				
			||||||
 | 
					                                Button13Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 14:
 | 
				
			||||||
 | 
					                                Button14Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 15:
 | 
				
			||||||
 | 
					                                Button15Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 16:
 | 
				
			||||||
 | 
					                                Button16Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 17:
 | 
				
			||||||
 | 
					                                Button17Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            case 18:
 | 
				
			||||||
 | 
					                                Button18Color = Brushes.Yellow;
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                            default:
 | 
				
			||||||
 | 
					                                break;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public DelegateCommand RowSelected
 | 
					        public DelegateCommand RowSelected
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //抽屉号列表
 | 
					        //抽屉号列表
 | 
				
			||||||
        public static List<int> iList = new List<int>();
 | 
					        public static List<ChannelList> iList = new List<ChannelList>();
 | 
				
			||||||
        //第几个抽屉号
 | 
					        //第几个抽屉号
 | 
				
			||||||
        //public static int iNumber = 1;
 | 
					        //public static int iNumber = 1;
 | 
				
			||||||
        private PortUtil _portUtil;
 | 
					        private PortUtil _portUtil;
 | 
				
			||||||
| 
						 | 
					@ -83,8 +83,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
        private void SearchBox()
 | 
					        private void SearchBox()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            iList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerType == this.DrawerType)
 | 
					            iList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerType == this.DrawerType)
 | 
				
			||||||
                .WhereIF(this.DrawerType == 0, cl => cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode)
 | 
					                .WhereIF(this.DrawerType == 0, cl => cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode).ToList();
 | 
				
			||||||
                .Select(cl => cl.DrawerNo).ToList();
 | 
					            // .Select(cl => cl.DrawerNo).ToList();
 | 
				
			||||||
            if (iList.Count > 0)
 | 
					            if (iList.Count > 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                //_portUtil.SpeakAsync("正在打开药箱");
 | 
					                //_portUtil.SpeakAsync("正在打开药箱");
 | 
				
			||||||
| 
						 | 
					@ -94,19 +94,24 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                for (int i = 0; i < iList.Count; i++)
 | 
					                for (int i = 0; i < iList.Count; i++)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    ChannelList channelList= iList[i];
 | 
				
			||||||
                    //记录开药箱日志
 | 
					                    //记录开药箱日志
 | 
				
			||||||
                    SqlSugarHelper.Db.Insertable(new MachineRecord()
 | 
					                    SqlSugarHelper.Db.Insertable(new MachineRecord()
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        MachineId = "DM5",
 | 
					                        MachineId = "DM5",
 | 
				
			||||||
                        DrawerNo = iList[i],
 | 
					                        DrawerNo = channelList.DrawerNo,
 | 
				
			||||||
                        Operator = HomeWindowViewModel.Operator?.Id,
 | 
					                        Operator = HomeWindowViewModel.Operator?.Id,
 | 
				
			||||||
                        OperationTime = DateTime.Now,
 | 
					                        OperationTime = DateTime.Now,
 | 
				
			||||||
                        Type = 55,
 | 
					                        Type = 55,
 | 
				
			||||||
                        InvoiceId = $"打开{iList[i]}号药箱",
 | 
					                        InvoiceId = $"打开{iList[i]}号药箱",
 | 
				
			||||||
                    }).ExecuteCommand();
 | 
					                    }).ExecuteCommand();
 | 
				
			||||||
                    _portUtil.SpeakAsync($"正在打开{iList[i]}号药箱");
 | 
					                    //记录药箱打开时间
 | 
				
			||||||
                    logger.Info($"正在打开{iList[i]}号药箱");
 | 
					                    channelList.EffDate = DateTime.Now.ToString("yyyy-MM-dd");
 | 
				
			||||||
                    ModbusHelper.GetInstance().OpenBoxDoor(iList[i] - 1);
 | 
					                    SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it=>new { it.EffDate }).ExecuteCommand();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    _portUtil.SpeakAsync($"正在打开{channelList.DrawerNo}号药箱");
 | 
				
			||||||
 | 
					                    logger.Info($"正在打开{channelList.DrawerNo}号药箱");
 | 
				
			||||||
 | 
					                    ModbusHelper.GetInstance().OpenBoxDoor(channelList.DrawerNo - 1);
 | 
				
			||||||
                    Thread.Sleep(1000);
 | 
					                    Thread.Sleep(1000);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
using DM_Weight.msg;
 | 
					using DM_Weight.msg;
 | 
				
			||||||
using DM_Weight.Port;
 | 
					using DM_Weight.Port;
 | 
				
			||||||
using DM_Weight.util;
 | 
					using DM_Weight.util;
 | 
				
			||||||
 | 
					using MaterialDesignThemes.Wpf;
 | 
				
			||||||
using Prism.Commands;
 | 
					using Prism.Commands;
 | 
				
			||||||
using Prism.Events;
 | 
					using Prism.Events;
 | 
				
			||||||
using Prism.Mvvm;
 | 
					using Prism.Mvvm;
 | 
				
			||||||
| 
						 | 
					@ -14,11 +15,25 @@ using System.Linq;
 | 
				
			||||||
using System.Text;
 | 
					using System.Text;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using System.Windows;
 | 
					using System.Windows;
 | 
				
			||||||
 | 
					using System.Windows.Media;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace DM_Weight.ViewModels
 | 
					namespace DM_Weight.ViewModels
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public class SettingBoxWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
 | 
					    public class SettingBoxWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        private SolidColorBrush _colorBrush;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public SolidColorBrush SnackbarBackground
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _colorBrush;
 | 
				
			||||||
 | 
					            set => SetProperty(ref _colorBrush, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private ISnackbarMessageQueue _snackbarMessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(3));
 | 
				
			||||||
 | 
					        public ISnackbarMessageQueue SnackbarMessageQueue
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _snackbarMessageQueue;
 | 
				
			||||||
 | 
					            set => SetProperty(ref _snackbarMessageQueue, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        private int _drawerNo = 0;
 | 
					        private int _drawerNo = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public int DrawerNo
 | 
					        public int DrawerNo
 | 
				
			||||||
| 
						 | 
					@ -218,8 +233,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        Message = $"未选择药箱,请先选择药箱",
 | 
					                        Message = $"未选择药箱,请先选择药箱",
 | 
				
			||||||
                        Type = MsgType.ERROR
 | 
					                        Type = MsgType.ERROR
 | 
				
			||||||
                    };
 | 
					                        };
 | 
				
			||||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
					                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -295,6 +310,13 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public DelegateCommand Query
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => new DelegateCommand(() =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                BindUserList();
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /// <summary>
 | 
					    /// <summary>
 | 
				
			||||||
    /// 药箱类型
 | 
					    /// 药箱类型
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,27 +74,26 @@
 | 
				
			||||||
                <ColumnDefinition />
 | 
					                <ColumnDefinition />
 | 
				
			||||||
                <ColumnDefinition />
 | 
					                <ColumnDefinition />
 | 
				
			||||||
            </Grid.ColumnDefinitions>
 | 
					            </Grid.ColumnDefinitions>
 | 
				
			||||||
 | 
					            <Button Margin="0 0  3 0" Grid.Row="0" Grid.Column="0" Width="120" Content="1号药箱" Background="{Binding Button1Color}" Command="{Binding UpdateDrawerNo,ConverterParameter=1}" CommandParameter="1" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=0}"/>
 | 
				
			||||||
 | 
					            <Button Margin="0 0  3 0" Grid.Row="1" Grid.Column="0" Width="120" Content="2号药箱" Background="{Binding Button2Color}"  Command="{Binding UpdateDrawerNo}" CommandParameter="2" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=1}"/>
 | 
				
			||||||
 | 
					            <Button Margin="0 0  3 0" Grid.Row="2" Grid.Column="0" Width="120" Content="3号药箱"  Background="{Binding Button3Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="3" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=2}"/>
 | 
				
			||||||
 | 
					            <Button Margin="0 0  3 0" Grid.Row="3" Grid.Column="0" Width="120" Content="4号药箱"  Background="{Binding Button4Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="4" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=3}"/>
 | 
				
			||||||
 | 
					            <Button Margin="0 0  3 0" Grid.Row="4" Grid.Column="0" Width="120" Content="5号药箱"  Background="{Binding Button5Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="5" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=4}"/>
 | 
				
			||||||
 | 
					            <Button Margin="0 0  3 0" Grid.Row="5" Grid.Column="0" Width="120" Content="6号药箱"  Background="{Binding Button6Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="6" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=5}"/>
 | 
				
			||||||
 | 
					            <Button Margin="0 0  3 0" Grid.Row="6" Grid.Column="0" Width="120" Content="7号药箱"  Background="{Binding Button7Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="7" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=6}"/>
 | 
				
			||||||
 | 
					            <Button Margin="0 0  3 0" Grid.Row="7" Grid.Column="0" Width="120" Content="8号药箱"  Background="{Binding Button8Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="8" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=7}"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="0" Grid.Column="0" Width="120" Content="1号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="1" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=0}"/>
 | 
					            <Button Margin="0 0  3 0" Grid.Row="8" Grid.Column="0" Width="120" Content="9号药箱"  Background="{Binding Button9Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="9"   IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=8}"/>
 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="1" Grid.Column="0" Width="120" Content="2号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="2" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=1}"/>
 | 
					            <Button Margin="0 0  3 0" Grid.Row="0" Grid.Column="1" Width="120" Content="10号药箱" Background="{Binding Button10Color}"  Command="{Binding UpdateDrawerNo}" CommandParameter="10" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=9}"/>
 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="2" Grid.Column="0" Width="120" Content="3号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="3" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=2}"/>
 | 
					 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="3" Grid.Column="0" Width="120" Content="4号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="4" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=3}"/>
 | 
					 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="4" Grid.Column="0" Width="120" Content="5号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="5" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=4}"/>
 | 
					 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="5" Grid.Column="0" Width="120" Content="6号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="6" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=5}"/>
 | 
					 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="6" Grid.Column="0" Width="120" Content="7号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="7" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=6}"/>
 | 
					 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="7" Grid.Column="0" Width="120" Content="8号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="8" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=7}"/>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="8" Grid.Column="0" Width="120" Content="9号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="9"   IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=8}"/>
 | 
					            <Button Grid.Row="1" Grid.Column="1" Width="120" Content="11号药箱"  Background="{Binding Button11Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="11" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=10}"/>
 | 
				
			||||||
            <Button Margin="0 0  3 0" Grid.Row="0" Grid.Column="1" Width="120" Content="10号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="10" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=9}"/>
 | 
					            <Button Grid.Row="2" Grid.Column="1" Width="120" Content="12号药箱"  Background="{Binding Button12Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="12" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=11}"/>
 | 
				
			||||||
            
 | 
					            <Button Grid.Row="3" Grid.Column="1" Width="120" Content="13号药箱"  Background="{Binding Button13Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="13" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=12}"/>
 | 
				
			||||||
            <Button Grid.Row="1" Grid.Column="1" Width="120" Content="11号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="11" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=10}"/>
 | 
					            <Button Grid.Row="4" Grid.Column="1" Width="120" Content="14号药箱"  Background="{Binding Button14Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="14" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=13}"/>
 | 
				
			||||||
            <Button Grid.Row="2" Grid.Column="1" Width="120" Content="12号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="12" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=11}"/>
 | 
					            <Button Grid.Row="5" Grid.Column="1" Width="120" Content="15号药箱"  Background="{Binding Button15Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="15" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=14}"/>
 | 
				
			||||||
            <Button Grid.Row="3" Grid.Column="1" Width="120" Content="13号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="13" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=12}"/>
 | 
					            <Button Grid.Row="6" Grid.Column="1" Width="120" Content="16号药箱"  Background="{Binding Button16Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="16" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=15}"/>
 | 
				
			||||||
            <Button Grid.Row="4" Grid.Column="1" Width="120" Content="14号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="14" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=13}"/>
 | 
					            <Button Grid.Row="7" Grid.Column="1" Width="120" Content="17号药箱"  Background="{Binding Button17Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="17" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=16}"/>
 | 
				
			||||||
            <Button Grid.Row="5" Grid.Column="1" Width="120" Content="15号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="15" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=14}"/>
 | 
					            <Button Grid.Row="8" Grid.Column="1" Width="120" Content="18号药箱"  Background="{Binding Button18Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="18" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=17}"/>
 | 
				
			||||||
            <Button Grid.Row="6" Grid.Column="1" Width="120" Content="16号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="16" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=15}"/>
 | 
					 | 
				
			||||||
            <Button Grid.Row="7" Grid.Column="1" Width="120" Content="17号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="17" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=16}"/>
 | 
					 | 
				
			||||||
            <Button Grid.Row="8" Grid.Column="1" Width="120" Content="18号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="18" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=17}"/>
 | 
					 | 
				
			||||||
            <!--<Button Grid.Row="8" Grid.Column="1" Width="120" Content="19号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="19" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=19}"/>
 | 
					            <!--<Button Grid.Row="8" Grid.Column="1" Width="120" Content="19号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="19" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=19}"/>
 | 
				
			||||||
            <Button Grid.Row="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=20}"/>-->
 | 
					            <Button Grid.Row="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=20}"/>-->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue