From 2498dd4959d15a08b2dd6c6baaf08c838921ed1f Mon Sep 17 00:00:00 2001 From: xxe Date: Fri, 18 Nov 2022 14:30:02 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardOUT/Bootstrapper.cs | 1 - HKCardOUT/Views/RootView.xaml.cs | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/HKCardOUT/Bootstrapper.cs b/HKCardOUT/Bootstrapper.cs index ae09f3b..9953b94 100644 --- a/HKCardOUT/Bootstrapper.cs +++ b/HKCardOUT/Bootstrapper.cs @@ -48,7 +48,6 @@ namespace HKCardOUT } Thread.Sleep(3000); }), "循环状态监测线程", false); - HKLogImport.Init("HKCardOUT"); } protected override void ConfigureIoC(IStyletIoCBuilder builder) diff --git a/HKCardOUT/Views/RootView.xaml.cs b/HKCardOUT/Views/RootView.xaml.cs index 9524e6c..15a0fb0 100644 --- a/HKCardOUT/Views/RootView.xaml.cs +++ b/HKCardOUT/Views/RootView.xaml.cs @@ -1,6 +1,7 @@ using BPA.Helper; using Helper; using HKCardOUT.ViewModels; +using HKLog; using System; using System.IO; using System.Linq; @@ -16,6 +17,7 @@ namespace HKCardOUT.Views { public RootView() { + HKLogImport.Init("HKCardOUT"); InitializeComponent(); MessageLog.GetInstance.NotifyShow = new Action((s) => { From 22c404857761ef5d033b601841412863c13133cf Mon Sep 17 00:00:00 2001 From: xxe Date: Fri, 18 Nov 2022 16:40:07 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B8=85=E7=90=86=E5=B1=8F=E5=B9=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardOUT/ViewModels/AdWindowViewModel.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/HKCardOUT/ViewModels/AdWindowViewModel.cs b/HKCardOUT/ViewModels/AdWindowViewModel.cs index 0828f9e..80a2850 100644 --- a/HKCardOUT/ViewModels/AdWindowViewModel.cs +++ b/HKCardOUT/ViewModels/AdWindowViewModel.cs @@ -23,6 +23,7 @@ namespace HKCardOUT.ViewModels { Foods.Add(""); } + } #region 属性 @@ -34,9 +35,9 @@ namespace HKCardOUT.ViewModels private AdInfoModel _mRAdinfo = new AdInfoModel(); public ObservableCollection Foods { get; set; } = new ObservableCollection(); + #endregion - #endregion void FoodsInit(int[] ScreenLoc) { @@ -60,6 +61,15 @@ namespace HKCardOUT.ViewModels { FoodsInit(BindScreen); + ThreadManage.GetInstance().StartLong(() => { + if (DateTime.Now.Hour == 16) + { + LAdInfo.AInfo = new ObservableCollection(); + RAdinfo.AInfo = new ObservableCollection(); + } + Thread.Sleep(5000); + }, "清理屏幕数据", true); + ThreadManage.GetInstance().StartLong(() => { var model = (new HKCore()).PullDaySaleLog(BindScreen); From a75bf6add1c381ce1fb8f6cc783094b4fdcf6f39 Mon Sep 17 00:00:00 2001 From: xxe Date: Sat, 19 Nov 2022 09:56:52 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKLog/HKLogImport.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HKLog/HKLogImport.cs b/HKLog/HKLogImport.cs index c55c931..76e6d9a 100644 --- a/HKLog/HKLogImport.cs +++ b/HKLog/HKLogImport.cs @@ -10,7 +10,7 @@ namespace HKLog //日志 Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() - .WriteTo.File($"Logs/{input}.log", rollingInterval: RollingInterval.Day) + .WriteTo.File($"D:\\HK刷卡端正式环境\\Logs\\{input}.log", rollingInterval: RollingInterval.Day) .CreateLogger(); } public static void WriteInfo(string msg) From 51a592ea409fc4bc3cedf7c4e0432622bfeba9f2 Mon Sep 17 00:00:00 2001 From: xxe Date: Sat, 19 Nov 2022 10:17:51 +0800 Subject: [PATCH 4/6] 1 --- HKCardOUT/Views/RootView.xaml.cs | 1 + HKLog/HKLogImport.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/HKCardOUT/Views/RootView.xaml.cs b/HKCardOUT/Views/RootView.xaml.cs index 15a0fb0..72d623d 100644 --- a/HKCardOUT/Views/RootView.xaml.cs +++ b/HKCardOUT/Views/RootView.xaml.cs @@ -18,6 +18,7 @@ namespace HKCardOUT.Views public RootView() { HKLogImport.Init("HKCardOUT"); + HKLogImport.WriteInfo("程序初始化"); InitializeComponent(); MessageLog.GetInstance.NotifyShow = new Action((s) => { diff --git a/HKLog/HKLogImport.cs b/HKLog/HKLogImport.cs index 76e6d9a..7791ace 100644 --- a/HKLog/HKLogImport.cs +++ b/HKLog/HKLogImport.cs @@ -7,10 +7,11 @@ namespace HKLog { public static void Init(string input) { + var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs",$"{input}.log"); //日志 Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() - .WriteTo.File($"D:\\HK刷卡端正式环境\\Logs\\{input}.log", rollingInterval: RollingInterval.Day) + .WriteTo.File(path, rollingInterval: RollingInterval.Day) .CreateLogger(); } public static void WriteInfo(string msg) From 63d8cf9bc5a0f2927af73ef1df824424e19ecb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Sat, 19 Nov 2022 14:29:25 +0800 Subject: [PATCH 5/6] 11 --- HKCardOUT/ViewModels/AdWindowViewModel.cs | 11 ++++++++--- HKCardOUT/Views/AdWindow.xaml.cs | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/HKCardOUT/ViewModels/AdWindowViewModel.cs b/HKCardOUT/ViewModels/AdWindowViewModel.cs index 80a2850..1061be5 100644 --- a/HKCardOUT/ViewModels/AdWindowViewModel.cs +++ b/HKCardOUT/ViewModels/AdWindowViewModel.cs @@ -23,7 +23,7 @@ namespace HKCardOUT.ViewModels { Foods.Add(""); } - + } #region 属性 @@ -61,7 +61,8 @@ namespace HKCardOUT.ViewModels { FoodsInit(BindScreen); - ThreadManage.GetInstance().StartLong(() => { + ThreadManage.GetInstance().StartLong(() => + { if (DateTime.Now.Hour == 16) { LAdInfo.AInfo = new ObservableCollection(); @@ -115,7 +116,7 @@ namespace HKCardOUT.ViewModels data.UserName = DataBus.UserListDto .Where(t => t.Cards.Select(x => x.CardNum).Contains(data.CardNo)) .Select(x => x.Name).FirstOrDefault(); - + HKLog.HKLogImport.WriteInfo("取出刷卡信息" + data.ToJsonString()); App.Current.Dispatcher.Invoke(() => { if (LAdInfo.Info != null && !string.IsNullOrEmpty(LAdInfo.Info.UserName)) @@ -128,6 +129,10 @@ namespace HKCardOUT.ViewModels } } } + else + { + HKLog.HKLogImport.WriteInfo("未包含屏幕" + BindScreen[i]); + } } Thread.Sleep(10); }, $"屏幕刷卡信息{BindScreen[0]}-{BindScreen[1]}", true); diff --git a/HKCardOUT/Views/AdWindow.xaml.cs b/HKCardOUT/Views/AdWindow.xaml.cs index e7e9c87..3e0f5bf 100644 --- a/HKCardOUT/Views/AdWindow.xaml.cs +++ b/HKCardOUT/Views/AdWindow.xaml.cs @@ -52,8 +52,10 @@ namespace HKCardOUT.Views { if (DataBus.saleLogDtos.Count > 0) { + HKLog.HKLogImport.WriteInfo("添加刷卡信息"); if (DataBus.saleLogDtos.TryDequeue(out SaleLogDto info)) { + HKLog.HKLogImport.WriteInfo("取出信息加入队列"); if (!DataBus.SaleLogDtoList.ContainsKey(info.Location)) DataBus.SaleLogDtoList.TryAdd(info.Location, new ConcurrentQueue()); DataBus.SaleLogDtoList[info.Location].Enqueue(info); From ad577d3e21b69f898130b957284cf7ccfedd2f0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Sat, 19 Nov 2022 16:24:49 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardOUT/Helper/BigScreen/DataCenter.cs | 3 +- HKCardOUT/ViewModels/RootViewModel.cs | 4 +- HKControl/DataModel.cs | 92 +++++++++++++++++++----- HKControl/Main.cs | 79 ++++++++++++-------- 4 files changed, 130 insertions(+), 48 deletions(-) diff --git a/HKCardOUT/Helper/BigScreen/DataCenter.cs b/HKCardOUT/Helper/BigScreen/DataCenter.cs index cb3a7c7..f8cbec7 100644 --- a/HKCardOUT/Helper/BigScreen/DataCenter.cs +++ b/HKCardOUT/Helper/BigScreen/DataCenter.cs @@ -40,9 +40,10 @@ namespace Helper.BigScreen AlarmMs = param, AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); + HKLog.HKLogImport.WriteInfo(param); }); - + ThreadManage.GetInstance().StartLong(() => { var model = new HKCore().GetDayData(); diff --git a/HKCardOUT/ViewModels/RootViewModel.cs b/HKCardOUT/ViewModels/RootViewModel.cs index 4c4a407..3d05965 100644 --- a/HKCardOUT/ViewModels/RootViewModel.cs +++ b/HKCardOUT/ViewModels/RootViewModel.cs @@ -136,7 +136,7 @@ namespace HKCardOUT.ViewModels Device = t.Name, Stalls = x.Name }).ToList(); -/* if (Init != null) + if (Init != null) { Ad = new ObservableCollection(Init); var route = SyncStatic.CreateFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AD.txt")); @@ -148,7 +148,7 @@ namespace HKCardOUT.ViewModels var jsons = SyncStatic.Decompress(SyncStatic.ReadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AD.txt")), SecurityType.Base64); Ad = new ObservableCollection(jsons.ToModel>()); AdOpen(); - }*/ + } })); } diff --git a/HKControl/DataModel.cs b/HKControl/DataModel.cs index 2b637d7..aaa1a27 100644 --- a/HKControl/DataModel.cs +++ b/HKControl/DataModel.cs @@ -11,6 +11,29 @@ namespace HKControl { public WindowDataModel LeftWindowData { get; set; } = new WindowDataModel(); public WindowDataModel RightWindowData { get; set; } = new WindowDataModel(); + + [Alarm("1号通道缺碗")] + public bool LackBowl1 { get; set; } + + [Alarm("2号通道缺碗")] + public bool LackBowl2 { get; set; } + + [Alarm("3号通道缺碗")] + public bool LackBowl3 { get; set; } + + [Alarm("4号通道缺碗")] + public bool LackBowl4 { get; set; } + + [Alarm("水温过低")] + public bool WaterTemperatureLow { get; set; } + + [Alarm("变频器故障")] + public bool FrequencyConverterFault { get; set; } + + [Alarm("机器人通讯异常")] + public bool RobotCommFault { get; set; } + + public RobotStatus RBStatus { get; set; } } public class WindowDataModel @@ -37,42 +60,79 @@ namespace HKControl [Alarm("警告左侧机构餐盘无盘")] public bool L1 { get; set; } - [Alarm("警告左侧升降气缸下降不到位")] + + [Alarm("左侧机构餐盘掉落无餐盘报警")] public bool L2 { get; set; } - [Alarm("警告左侧升降气缸中间不到位")] + + [Alarm("左侧升降气缸下降不到位报警")] public bool L3 { get; set; } - [Alarm("警告左侧升降气缸上升不到位")] + + [Alarm("左侧升降气缸中间位置不到位报警")] public bool L4 { get; set; } - [Alarm("警告左侧升降气缸上升不到位")] + + [Alarm("左侧升降气缸上升不到位报警")] public bool L5 { get; set; } - [Alarm("警告左侧机构推空餐盘不到位")] + + [Alarm("左侧机构推空餐盘不到位报警")] public bool L6 { get; set; } - [Alarm("警告左侧出餐推不到位")] + + [Alarm("左侧机构推空餐盘回退不到位报警")] public bool L7 { get; set; } - [Alarm("警告左侧出餐回退不到位")] + + [Alarm("左侧出餐推不到位报警")] public bool L8 { get; set; } - [Alarm("警告左餐盘掉落位置有餐盘")] + + [Alarm("左侧出餐回退不到位报警")] public bool L9 { get; set; } + [Alarm("左餐盘掉落位置有餐盘报警")] + public bool L10 { get; set; } + + [Alarm("左侧套餐完成")] + public bool L11 { get; set; } + [Alarm("警告右侧机构餐盘无盘")] public bool R1 { get; set; } - [Alarm("警告右侧升降气缸下降不到位")] + + [Alarm("右侧机构餐盘掉落无餐盘报警")] public bool R2 { get; set; } - [Alarm("警告右侧升降气缸中间不到位")] + + [Alarm("右侧升降气缸下降不到位报警")] public bool R3 { get; set; } - [Alarm("警告右侧升降气缸上升不到位")] + + [Alarm("右侧升降气缸中间位置不到位报警")] public bool R4 { get; set; } - [Alarm("警告右侧升降气缸上升不到位")] + + [Alarm("右侧升降气缸上升不到位报警")] public bool R5 { get; set; } - [Alarm("警告右侧机构推空餐盘不到位")] + + [Alarm("右侧机构推空餐盘不到位报警")] public bool R6 { get; set; } - [Alarm("警告右侧出餐推不到位")] + + [Alarm("右侧机构推空餐盘回退不到位报警")] public bool R7 { get; set; } - [Alarm("警告右侧出餐回退不到位")] + + [Alarm("右侧出餐推不到位报警")] public bool R8 { get; set; } - [Alarm("警告右餐盘掉落位置有餐盘")] + + [Alarm("右侧出餐回退不到位报警")] public bool R9 { get; set; } + [Alarm("右餐盘掉落位置有餐盘报警")] + public bool R10 { get; set; } + + [Alarm("右侧套餐完成")] + public bool R11 { get; set; } + + } + + public enum RobotStatus + { + 运行, + 停止, + 暂停, + 准备, + 故障, } } diff --git a/HKControl/Main.cs b/HKControl/Main.cs index 6ffcb90..452cbe4 100644 --- a/HKControl/Main.cs +++ b/HKControl/Main.cs @@ -132,45 +132,66 @@ namespace HKControl { SiemensDicitonary[item.DeviceNum].ConnectOk = new Action(() => { - AlarmHelper.GetInstance($"{item.DeviceNum}号档口"); AlarmHelper.Init(); + //AlarmHelper.GetInstance($"{item.DeviceNum}号档口"); HKLog.HKLogImport.WriteInfo($"{item.DeviceNum}:连接成功"); ThreadManage.GetInstance().StartLong(new Action(() => { try { - var md = AlarmHelper.GetInstance($"{item.DeviceNum}号档口"); - var res = SiemensDicitonary[item.DeviceNum].Read("MB7"); - var res1 = SiemensDicitonary[item.DeviceNum].Read("MB10"); - var res2 = SiemensDicitonary[item.DeviceNum].Read("MB11"); - md.LeftWindowData.L1 = Get8bitValue(res1, 2); - md.LeftWindowData.L2 = Get8bitValue(res1, 3); - md.LeftWindowData.L3 = Get8bitValue(res1, 4); - md.LeftWindowData.L4 = Get8bitValue(res1, 5); - md.LeftWindowData.L5 = Get8bitValue(res1, 6); - md.LeftWindowData.L6 = Get8bitValue(res1, 7); - md.LeftWindowData.L7 = Get8bitValue(res1, 8); - md.LeftWindowData.L8 = Get8bitValue(res2, 1); - md.LeftWindowData.L9 = Get8bitValue(res2, 2); + var md = AlarmHelper.GetInstance($"{item.DeviceNum}"); + var MB7 = SiemensDicitonary[item.DeviceNum].Read("MB7"); + DataModels[item.DeviceNum].LeftWindowData.IsSwipe = Get8bitValue(MB7, 1); + DataModels[item.DeviceNum].LeftWindowData.Complete = Get8bitValue(MB7, 2); + DataModels[item.DeviceNum].RightWindowData.IsSwipe = Get8bitValue(MB7, 3); + DataModels[item.DeviceNum].RightWindowData.Complete = Get8bitValue(MB7, 4); - var res3 = SiemensDicitonary[item.DeviceNum].Read("MB12"); - var res4 = SiemensDicitonary[item.DeviceNum].Read("MB13"); - md.RightWindowData.R1 = Get8bitValue(res3, 2); - md.RightWindowData.R2 = Get8bitValue(res3, 3); - md.RightWindowData.R3 = Get8bitValue(res3, 4); - md.RightWindowData.R4 = Get8bitValue(res3, 5); - md.RightWindowData.R5 = Get8bitValue(res3, 6); - md.RightWindowData.R6 = Get8bitValue(res3, 7); - md.RightWindowData.R7 = Get8bitValue(res3, 8); - md.RightWindowData.R8 = Get8bitValue(res4, 1); - md.RightWindowData.R9 = Get8bitValue(res4, 2); + var MB10 = SiemensDicitonary[item.DeviceNum].Read("MB10"); + var MB11 = SiemensDicitonary[item.DeviceNum].Read("MB11"); + md.LeftWindowData.L2 = Get8bitValue(MB10, 2); + md.LeftWindowData.L3 = Get8bitValue(MB10, 3); + md.LeftWindowData.L4 = Get8bitValue(MB10, 4); + md.LeftWindowData.L5 = Get8bitValue(MB10, 5); + md.LeftWindowData.L6 = Get8bitValue(MB10, 6); + md.LeftWindowData.L7 = Get8bitValue(MB10, 7); + md.LeftWindowData.L8 = Get8bitValue(MB10, 8); + md.LeftWindowData.L9 = Get8bitValue(MB11, 1); - DataModels[item.DeviceNum].LeftWindowData.IsSwipe = Get8bitValue(res, 1); - DataModels[item.DeviceNum].LeftWindowData.Complete = Get8bitValue(res, 2); + var MB12 = SiemensDicitonary[item.DeviceNum].Read("MB12"); + var MB13 = SiemensDicitonary[item.DeviceNum].Read("MB13"); + md.RightWindowData.R2 = Get8bitValue(MB12, 2); + md.RightWindowData.R3 = Get8bitValue(MB12, 3); + md.RightWindowData.R4 = Get8bitValue(MB12, 4); + md.RightWindowData.R5 = Get8bitValue(MB12, 5); + md.RightWindowData.R6 = Get8bitValue(MB12, 6); + md.RightWindowData.R7 = Get8bitValue(MB12, 7); + md.RightWindowData.R8 = Get8bitValue(MB12, 8); + md.RightWindowData.R9 = Get8bitValue(MB13, 1); + + var MB14 = SiemensDicitonary[item.DeviceNum].Read("MB14"); + md.WaterTemperatureLow = Get8bitValue(MB14, 5); + md.FrequencyConverterFault = Get8bitValue(MB14, 6); + + var MB15 = SiemensDicitonary[item.DeviceNum].Read("MB15"); + md.RobotCommFault = Get8bitValue(MB15, 6); + bool TempFault = Get8bitValue(MB15, 5); + if (TempFault) + { + md.RBStatus = RobotStatus.故障; + } + else + { + if (Get8bitValue(MB15, 1)) + md.RBStatus = RobotStatus.运行; + else if (Get8bitValue(MB15, 2)) + md.RBStatus = RobotStatus.停止; + else if (Get8bitValue(MB15, 3)) + md.RBStatus = RobotStatus.暂停; + else if (Get8bitValue(MB15, 4)) + md.RBStatus = RobotStatus.准备; + } - DataModels[item.DeviceNum].RightWindowData.IsSwipe = Get8bitValue(res, 3); - DataModels[item.DeviceNum].RightWindowData.Complete = Get8bitValue(res, 4); } catch (Exception ex) {