diff --git a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml index c032a4eb..503c0b8b 100644 --- a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml @@ -163,8 +163,8 @@ Margin="0,0,17,0" Background="#ff0C255F"> - - + + @@ -244,10 +244,10 @@ - + - - + + @@ -291,10 +291,10 @@ - + - - + + diff --git a/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml index 58ac02a5..d03dfa62 100644 --- a/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml @@ -240,7 +240,7 @@ - + diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs index b8ac842a..81234dd5 100644 --- a/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs +++ b/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs @@ -9,6 +9,7 @@ using System.Collections.ObjectModel; using BPASmartClient.CustomResource.Pages.Model; using System.Windows; using BPASmartClient.Helper; +using System.Diagnostics; namespace BPASmartClient.CustomResource.Pages.ViewModel { @@ -67,15 +68,23 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel var data = Sqlite.GetInstance.GetData(); if (data != null) { - HistoryRunLog.Clear(); - foreach (var item in data) + var res = data.Where(p => p.Date == DateTime.Now.ToString("yyyy-MM-dd")).ToList(); + if (res != null) { - int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; - if (day == 0) + HistoryRunLog.Clear(); + res.ForEach(item => { HistoryRunLog.Add(item); - } + }); } + //foreach (var item in data) + //{ + // int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; + // if (day == 0) + // { + // HistoryRunLog.Add(item); + // } + //} } } @@ -106,7 +115,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel /// public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } } private string _mControlButText = "报警复位"; - + /// /// 开始时间 /// diff --git a/BPASmartClient.Helper/Sqlite.cs b/BPASmartClient.Helper/Sqlite.cs index 03b78159..e5597fb5 100644 --- a/BPASmartClient.Helper/Sqlite.cs +++ b/BPASmartClient.Helper/Sqlite.cs @@ -27,8 +27,10 @@ namespace BPASmartClient.Helper { get { - Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DB")); - return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DB\\{typeof(T).Name}.db"; + int Year = DateTime.Now.Year; + int Month = DateTime.Now.Month; + Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DB\\{Year}-{Month}")); + return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DB\\{Year}-{Month}\\{typeof(T).Name}.db"; } } public bool DataBaseExist() @@ -48,5 +50,7 @@ namespace BPASmartClient.Helper return Base.ToList(); } + + } } diff --git a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs index 7646c814..0c571639 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs @@ -957,12 +957,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model { if (Attribute.IsDefined(item, typeof(VarCommAttribute))) { + string type = item.PropertyType.ToString(); CommData.Add(new PlcInfos() { Count = CommData.Count + 1, Name = item.Name, Address = item.GetCustomAttribute().Address, - Type = item.PropertyType.ToString(), + Type = type.Substring(type.IndexOf(".") + 1), Describe = item.GetCustomAttribute().Describe, Value = item.GetValue(GVL_SmallStation.GetInstance.plcReadDataDB3).ToString(), }); @@ -973,11 +974,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model { if (Attribute.IsDefined(item, typeof(VarCommAttribute))) { + string type = item.PropertyType.ToString(); ProcessVar.Add(new PlcInfos() { Count = ProcessVar.Count + 1, Name = item.Name, - Type = item.PropertyType.ToString(), + Type = type.Substring(type.IndexOf(".") + 1), Address = item.GetCustomAttribute().Address, Describe = item.GetCustomAttribute().Describe, Value = item.GetValue(GVL_SmallStation.GetInstance).ToString() diff --git a/BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.xaml b/BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.xaml index 082d2106..3c18f7fd 100644 --- a/BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.xaml +++ b/BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.xaml @@ -105,7 +105,7 @@ - + diff --git a/BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs b/BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs index 6fa8cbc4..aed63cb4 100644 --- a/BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs +++ b/BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs @@ -29,8 +29,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel Test1Command = new RelayCommand(() => { ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX8.0", PlcVarType = PlcVarType.Bool, Value = true }); - Thread.Sleep(200); - ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX8.0", PlcVarType = PlcVarType.Bool, Value = false }); + //Thread.Sleep(200); + //ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX8.0", PlcVarType = PlcVarType.Bool, Value = false }); //GVL_SmallStation.GetInstance.AGV_PutTray1Finish = true; MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV送托盘完成"); @@ -55,8 +55,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel Test3Command = new RelayCommand(() => { ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX10.0", PlcVarType = PlcVarType.Bool, Value = true }); - Thread.Sleep(200); - ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX10.0", PlcVarType = PlcVarType.Bool, Value = false }); + //Thread.Sleep(200); + //ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX10.0", PlcVarType = PlcVarType.Bool, Value = false }); //GVL_SmallStation.GetInstance.AGV_GetTray1Finish = true; MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV取托盘完成");