修改实时曲线缓存逻辑
This commit is contained in:
commit
6e690b78b7
2 files changed
+19
-19
No files matched your search
+5
-5
@@ -128,11 +128,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
t30S = 0;
|
||||
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);
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
dis50ms.Tick += new EventHandler(DisTimer_50MS);//每执行的方法
|
||||
dis50ms.Start();//计时开始
|
||||
}//时间周期初始化
|
||||
int Time5 = 0, Time60 = 0;
|
||||
int Time5 = 0, Time30 = 0;
|
||||
void DisTimer_50MS(object sender, EventArgs e)//Tick_Event周期执行事件50MS
|
||||
{
|
||||
if (stringQueue.Count > 0) //信息发送队列
|
||||
@@ -319,12 +319,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
Time5 = 0;
|
||||
}
|
||||
else { Time5++; }
|
||||
if (Time60 > 60)
|
||||
if (Time30 > 30)
|
||||
{
|
||||
// Tick_Event_60S();
|
||||
Time60 = 0;
|
||||
Tick_Event_30S();
|
||||
Time30 = 0;
|
||||
}
|
||||
else { Time60++; }
|
||||
else { Time30++; }
|
||||
}
|
||||
async void Tick_Event_5S()//Tick_Event周期执行事件5S
|
||||
{
|
||||
@@ -613,19 +613,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
|
||||
}
|
||||
}
|
||||
async void Tick_Event_60S()
|
||||
void Tick_Event_30S()
|
||||
{
|
||||
for (int i = 0; i < Machinesdata_Count; i++)
|
||||
for (int i = 0; i < Machines.Rows.Count; i++)
|
||||
{
|
||||
if (Selet_Machines(Machines, "State", "ID='" + i + "'").ToString() == "800")
|
||||
if (Selet_Machines(Machines, "State", "ID='" + i + "'").ToString() !="800")
|
||||
{
|
||||
MachiensTcpClient[i] = new TcpClient();
|
||||
DataRow dt = machinesdata[i];
|
||||
await AsyncTcpClient.TcpClient(MachiensTcpClient[i] //建立tcp连接
|
||||
, Selet_Machines(Machines, "IP", "ID='" + Convert.ToInt16(dt["ID"]) + "'" ).ToString()
|
||||
, Selet_Machines(Machines, "PORT", "ID='" + Convert.ToInt16(dt["ID"]) + "'").ToString());
|
||||
DataRow whole_Dat = Whole_dat.NewRow();
|
||||
whole_Dat["Machine"] = Selet_Machines(Machines, "NAME", "ID='" + i + "'").ToString();
|
||||
whole_Dat["DateTime"] = DateTime.Now;
|
||||
whole_Dat["DAT"] = (double)Selet_Machines(Machines, "Temperature", "ID='" + i + "'");
|
||||
Whole_dat.Rows.Add(whole_Dat);
|
||||
}
|
||||
}//重连
|
||||
}
|
||||
}
|
||||
|
||||
public static TcpClient[] MachiensTcpClient = new TcpClient[999];
|
||||
|
||||
Reference in new issue
Block a user