总览卡曲线
This commit is contained in:
commit
acdfc68def
3 files changed
+40
-6
No files matched your search
@@ -13,6 +13,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
@@ -105,10 +106,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
|
|||||||
DataContext = this;
|
DataContext = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DataAdd(double dat)
|
public void DataAdd(DateTime dateTime, double dat)
|
||||||
{
|
{
|
||||||
DateTime dateTime = DateTime.Now;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
// 添加新数据点
|
// 添加新数据点
|
||||||
@@ -125,6 +124,23 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DataROW(DataRow[] dataRows)
|
||||||
|
{
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
foreach (DataRow row in dataRows)
|
||||||
|
{
|
||||||
|
// 添加新数据点
|
||||||
|
MTH_values.Add(new DateTimePoint((DateTime)row["DateTime"], (double)row["DAT"]));
|
||||||
|
}
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
// 更新X轴范围,始终保持最近6小时
|
||||||
|
XAxes[0].MinLimit = dateTime.AddHours(-6).Ticks;
|
||||||
|
XAxes[0].MaxLimit = dateTime.AddMinutes(1).Ticks;
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// 初始化系列
|
// 初始化系列
|
||||||
|
|||||||
+16
-3
@@ -64,6 +64,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
WholeView.Children.Add(inf[i]);
|
WholeView.Children.Add(inf[i]);
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < MainWindowViewModel.Machines.Rows.Count; i++)
|
||||||
|
{
|
||||||
|
DataRow[] rows= MainWindowViewModel.Whole_dat.Select("Machine='" + inf[i].name.Text+"'");
|
||||||
|
inf[i].DataROW(rows);
|
||||||
|
}
|
||||||
|
|
||||||
CountDown();
|
CountDown();
|
||||||
}
|
}
|
||||||
@@ -99,6 +104,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
void Tick_Event_S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
void Tick_Event_S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||||
{
|
{
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
for (int i = 0; i < MainWindowViewModel.Machines.Rows.Count; i++)
|
for (int i = 0; i < MainWindowViewModel.Machines.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
string State_ = Selet_Machines(MainWindowViewModel.Machines, "State", i).ToString();
|
string State_ = Selet_Machines(MainWindowViewModel.Machines, "State", i).ToString();
|
||||||
@@ -117,13 +123,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
inf[i].Orders.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "WorkOrder", i);
|
inf[i].Orders.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "WorkOrder", i);
|
||||||
inf[i].time.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "time", i);
|
inf[i].time.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "time", i);
|
||||||
|
|
||||||
if ((t30S > 30)&&(State_!="800"))
|
if ((t30S > 10)&&(State_!="800"))
|
||||||
{
|
{
|
||||||
t30S = 0;
|
t30S = 0;
|
||||||
inf[i].DataAdd((double)Selet_Machines(MainWindowViewModel.Machines, "Temperature", i));
|
inf[i].DataAdd(dateTime,(double)Selet_Machines(MainWindowViewModel.Machines, "Temperature", i));
|
||||||
|
|
||||||
|
DataRow whole_Dat = MainWindowViewModel.Whole_dat.NewRow();
|
||||||
|
whole_Dat["Machine"] = Selet_Machines(MainWindowViewModel.Machines, "NAME", i).ToString();
|
||||||
|
whole_Dat["DateTime"] = dateTime;
|
||||||
|
whole_Dat["DAT"] = (double)Selet_Machines(MainWindowViewModel.Machines, "Temperature", i);
|
||||||
|
MainWindowViewModel.Whole_dat.Rows.Add(whole_Dat);
|
||||||
}
|
}
|
||||||
else { t30S++; }
|
|
||||||
}
|
}
|
||||||
|
t30S++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,6 +81,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
// public static DataRow MachinesROW;
|
// public static DataRow MachinesROW;
|
||||||
public static DataTable USER_data = new DataTable();
|
public static DataTable USER_data = new DataTable();
|
||||||
public static DataTable Dyelot_CALL = new DataTable();
|
public static DataTable Dyelot_CALL = new DataTable();
|
||||||
|
public static DataTable Whole_dat = new DataTable();
|
||||||
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
||||||
public static int ERR_c = 0;//错误计数器
|
public static int ERR_c = 0;//错误计数器
|
||||||
public static bool[] USER_Capacity { set; get; } = new bool[99];
|
public static bool[] USER_Capacity { set; get; } = new bool[99];
|
||||||
@@ -107,6 +108,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
Dyelot_CALL = SQLiteHelpers.ExecuteDataSet("select * from Dyelot", null).Tables[0].Clone();
|
Dyelot_CALL = SQLiteHelpers.ExecuteDataSet("select * from Dyelot", null).Tables[0].Clone();
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Close();
|
||||||
|
|
||||||
|
Whole_dat.Columns.Add("Machine", Type.GetType("System.String"));
|
||||||
|
Whole_dat.Columns.Add("DateTime", Type.GetType("System.DateTime"));
|
||||||
|
Whole_dat.Columns.Add("DAT", Type.GetType("System.Double"));
|
||||||
|
|
||||||
USERCapacity(App.USER_Purview);//App.USER_Purview);
|
USERCapacity(App.USER_Purview);//App.USER_Purview);
|
||||||
CountDown();
|
CountDown();
|
||||||
TcpClientNEW();
|
TcpClientNEW();
|
||||||
|
|||||||
Reference in new issue
Block a user