diff --git a/HKCardOUT/Logic/Service/HKCore.cs b/HKCardOUT/Logic/Service/HKCore.cs index 5c5395a..4615bdb 100644 --- a/HKCardOUT/Logic/Service/HKCore.cs +++ b/HKCardOUT/Logic/Service/HKCore.cs @@ -294,10 +294,11 @@ namespace HKCardOUT.Logic.Service // .WhereIF(screen == 1, t => t.Location == "1" || t.Location == "2") // .WhereIF(screen ==2, t => t.Location == "5" || t.Location == "6").Select(t => t.Location).ToList(); //return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count()); - + string a = screen[0].ToString(); + string b = screen[1].ToString(); var today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); var count = DbContext.Context.Queryable().Where(t => t.CreateTime >= today) - .WhereIF(screen.Length == 2, t => t.Location == $"{screen[0]}" || t.Location == $"{screen[1]}").Select(t => t.Location).ToList(); + .WhereIF(screen.Length == 2, t => t.Location == a || t.Location == b).Select(t => t.Location).ToList(); return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count()); } } diff --git a/HKCardOUT/ViewModels/AdWindowViewModel.cs b/HKCardOUT/ViewModels/AdWindowViewModel.cs index 35b775e..5b6987f 100644 --- a/HKCardOUT/ViewModels/AdWindowViewModel.cs +++ b/HKCardOUT/ViewModels/AdWindowViewModel.cs @@ -117,25 +117,6 @@ namespace HKCardOUT.ViewModels if (Foods == null) { string GateId = string.Empty; - //int[] loc = new int[2]; - //if (ScreenLoc == 0) - //{ - // loc[0] = 0; - // loc[1] = 1; - // GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == "02" || t.Address == "01").Select(t => t.GateId).FirstOrDefault(); - //} - //else if (ScreenLoc == 1) - //{ - // loc[0] = 4; - // loc[1] = 5; - // GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == "05" || t.Address == "06").Select(t => t.GateId).FirstOrDefault(); - //} - //else if (ScreenLoc == 2) - //{ - // loc[0] = 2; - // loc[1] = 3; - // GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == "03" || t.Address == "04").Select(t => t.GateId).FirstOrDefault(); - //} GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == $"0{ScreenLoc[0]}" || t.Address == $"0{ScreenLoc[1]}").Select(t => t.GateId).FirstOrDefault(); var res = DataBus.Menu.GateFood.Where(t => t.GateId == GateId)?.Select(t => t.Foods)?.FirstOrDefault(); if (res != null) Foods = new ObservableCollection(res); @@ -160,41 +141,11 @@ namespace HKCardOUT.ViewModels public void InitData(int[] BindScreen) { - //int BindScreen FoodsInit(BindScreen); - ThreadManage.GetInstance().StartLong(() => { var model = (new HKCore()).PullDaySaleLog(BindScreen); - //if (BindScreen == 1) - //{ - // LGate = "6号档口"; - // RGate = "5号档口"; - // LCount = model.Where(t => t.Key == "6").FirstOrDefault().Value; - // RCount = model.Where(t => t.Key == "5").FirstOrDefault().Value; - // LMsg = HKControl.Main.GetInstance.GetIsSwipe(6) ? "正常" : "异常"; - // RMsg = HKControl.Main.GetInstance.GetIsSwipe(5) ? "正常" : "异常"; - //} - //if (BindScreen == 0) - //{ - // LGate = "2号档口"; - // RGate = "1号档口"; - // LCount = model.Where(t => t.Key == "2").FirstOrDefault().Value; - // RCount = model.Where(t => t.Key == "1").FirstOrDefault().Value; - // LMsg = HKControl.Main.GetInstance.GetIsSwipe(6) ? "正常" : "异常"; - // RMsg = HKControl.Main.GetInstance.GetIsSwipe(5) ? "正常" : "异常"; - //} - //if (BindScreen == 2) - //{ - // LGate = "4号档口"; - // RGate = "3号档口"; - // LCount = model.Where(t => t.Key == "4").FirstOrDefault().Value; - // RCount = model.Where(t => t.Key == "3").FirstOrDefault().Value; - // LMsg = HKControl.Main.GetInstance.GetIsSwipe(4) ? "正常" : "异常"; - // RMsg = HKControl.Main.GetInstance.GetIsSwipe(3) ? "正常" : "异常"; - //} - LGate = $"{BindScreen[1]}号档口"; RGate = $"{BindScreen[0]}号档口"; LCount = model.Where(t => t.Key == $"{BindScreen[1]}").FirstOrDefault().Value; @@ -202,7 +153,6 @@ namespace HKCardOUT.ViewModels LMsg = HKControl.Main.GetInstance.GetIsSwipe(BindScreen[1]) ? "正常" : "异常"; RMsg = HKControl.Main.GetInstance.GetIsSwipe(BindScreen[0]) ? "正常" : "异常"; - for (int i = 0; i < BindScreen.Length; i++) { if (DataBus.SaleLogDtoList.ContainsKey(BindScreen[i].ToString())) @@ -235,71 +185,8 @@ namespace HKCardOUT.ViewModels } } - - - - //if (DataBus.saleLogDtos.TryDequeue(out SaleLogDto info)) - //{ - // ScreenInfoDto data = new ScreenInfoDto - // { - // CardNo = info.CardNo, - // UserName = "", - // Location = info.Location, - // }; - // data.UserName = DataBus.UserListDto - // .Where(t => t.Cards.Select(x => x.CardNum).Contains(data.CardNo)) - // .Select(x => x.Name).FirstOrDefault(); - - // App.Current.Dispatcher.Invoke(() => - // { - // if (LInfo != null && !string.IsNullOrEmpty(LInfo.UserName)) - // ALInfo.Insert(0, LInfo); LInfo.Time = DateTime.Now.ToString("HH:mm:ss"); - // if (RInfo != null && !string.IsNullOrEmpty(RInfo.UserName)) - // ARInfo.Insert(0, RInfo); RInfo.Time = DateTime.Now.ToString("HH:mm:ss"); - // }); - // LInfo = data.Location == $"{BindScreen[1]}" ? data : new ScreenInfoDto(); - // RInfo = data.Location == $"{BindScreen[0]}" ? data : new ScreenInfoDto(); - - - //if (BindScreen == 1) - //{ - // App.Current.Dispatcher.Invoke(() => - // { - // if (LInfo != null && !string.IsNullOrEmpty(LInfo.UserName)) - // ALInfo.Insert(0, LInfo); LInfo.Time = DateTime.Now.ToString("HH:mm:ss"); - // if (RInfo != null && !string.IsNullOrEmpty(RInfo.UserName)) - // ARInfo.Insert(0, RInfo); RInfo.Time = DateTime.Now.ToString("HH:mm:ss"); - // }); - // LInfo = data.Location == "6" ? data : new ScreenInfoDto(); - // RInfo = data.Location == "5" ? data : new ScreenInfoDto(); - //} - //if (BindScreen == 0) - //{ - // App.Current.Dispatcher.Invoke(() => - // { - // if (LInfo != null && !string.IsNullOrEmpty(LInfo.UserName)) - // ALInfo.Insert(0, LInfo); LInfo.Time = DateTime.Now.ToString("HH:mm:ss"); - // if (RInfo != null && !string.IsNullOrEmpty(RInfo.UserName)) - // ARInfo.Insert(0, RInfo); RInfo.Time = DateTime.Now.ToString("HH:mm:ss"); - // }); - // LInfo = data.Location == "2" ? data : new ScreenInfoDto(); - // RInfo = data.Location == "1" ? data : new ScreenInfoDto(); - //} - //if (BindScreen == 2) - //{ - // App.Current.Dispatcher.Invoke(() => - // { - // if (LInfo != null && !string.IsNullOrEmpty(LInfo.UserName)) - // ALInfo.Insert(0, LInfo); LInfo.Time = DateTime.Now.ToString("HH:mm:ss"); - // if (RInfo != null && !string.IsNullOrEmpty(RInfo.UserName)) - // ARInfo.Insert(0, RInfo); RInfo.Time = DateTime.Now.ToString("HH:mm:ss"); - // }); - // LInfo = data.Location == "4" ? data : new ScreenInfoDto(); - // RInfo = data.Location == "3" ? data : new ScreenInfoDto(); - //} - //} Thread.Sleep(100); - }, $"屏幕刷卡信息{BindScreen}", true); + }, $"屏幕刷卡信息{BindScreen[0]}-{BindScreen[1]}", true); } } } diff --git a/HKCardOUT/Views/AdWindow.xaml.cs b/HKCardOUT/Views/AdWindow.xaml.cs index b88d3b5..d735828 100644 --- a/HKCardOUT/Views/AdWindow.xaml.cs +++ b/HKCardOUT/Views/AdWindow.xaml.cs @@ -43,9 +43,9 @@ namespace HKCardOUT.Views if (BindScreen != -1) { int[] NotchNum = new int[2]; - if (bindScreen == 0) NotchNum[0] = 1; NotchNum[1] = 2; - if (bindScreen == 1) NotchNum[0] = 5; NotchNum[1] = 6; - if (bindScreen == 2) NotchNum[0] = 3; NotchNum[1] = 4; + if (bindScreen == 1) { NotchNum[0] = 1; NotchNum[1] = 2; } + if (bindScreen == 2) { NotchNum[0] = 5; NotchNum[1] = 6; } + if (bindScreen == 0) { NotchNum[0] = 3; NotchNum[1] = 4; } (this.DataContext as AdWindowViewModel).InitData(NotchNum);