@@ -163,8 +163,8 @@ | |||
Margin="0,0,17,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
@@ -244,10 +244,10 @@ | |||
<ItemsControl ItemsSource="{Binding Log}" Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid x:Name="gr" MinHeight="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
@@ -291,10 +291,10 @@ | |||
<ItemsControl ItemsSource="{Binding HistoryRunLog}" Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid x:Name="gr" MinHeight="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
@@ -240,7 +240,7 @@ | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Grid.Row="1" Background="#ff0C255F"> | |||
<Grid Grid.Row="1" Margin="0 0 17 0" Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.3*" /> | |||
@@ -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<RunLog>.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 | |||
/// </summary> | |||
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } } | |||
private string _mControlButText = "报警复位"; | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
@@ -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(); | |||
} | |||
} | |||
} |
@@ -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<VarCommAttribute>().Address, | |||
Type = item.PropertyType.ToString(), | |||
Type = type.Substring(type.IndexOf(".") + 1), | |||
Describe = item.GetCustomAttribute<VarCommAttribute>().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<VarCommAttribute>().Address, | |||
Describe = item.GetCustomAttribute<VarCommAttribute>().Describe, | |||
Value = item.GetValue(GVL_SmallStation.GetInstance).ToString() | |||
@@ -105,7 +105,7 @@ | |||
<ItemsControl Foreground="Aqua" ItemsSource="{Binding plcInfos}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Name="gr"> | |||
<Grid Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="3*" /> | |||
<ColumnDefinition Width="8*" /> | |||
@@ -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取托盘完成"); | |||