|
|
@ -1,4 +1,6 @@ |
|
|
|
using SunlightCentralizedControlManagement_SCCM_.Properties; |
|
|
|
using OpenTK.Graphics.ES11; |
|
|
|
using SunlightCentralizedControlManagement_SCCM_.Properties; |
|
|
|
using SunlightCentralizedControlManagement_SCCM_.UserClass; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.ComponentModel; |
|
|
@ -8,6 +10,8 @@ using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System.Windows.Controls; |
|
|
|
using System.Windows.Threading; |
|
|
|
using TouchSocket.Core; |
|
|
|
using TouchSocket.Sockets; |
|
|
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; |
|
|
|
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
@ -69,9 +73,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
|
|
|
{ |
|
|
|
Sys_Time = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件5S
|
|
|
|
{ |
|
|
|
for (int i = 0; i < Machinesdata_Count; i++) |
|
|
|
{ |
|
|
|
MachiensTcpClient[i].SendAsync("SC800"); |
|
|
|
} |
|
|
|
} |
|
|
|
void DisTimer_500MS(object sender, EventArgs e)//Tick_Event周期执行事件500MS
|
|
|
|
{ |
|
|
@ -89,7 +100,30 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
|
SQLiteHelpers.Close(); |
|
|
|
|
|
|
|
CountDown(); |
|
|
|
TcpClientNEW(); |
|
|
|
} |
|
|
|
|
|
|
|
private readonly TcpClient[] MachiensTcpClient = new TcpClient[999]; |
|
|
|
public int Machinesdata_Count; |
|
|
|
public void TcpClientNEW() |
|
|
|
{ |
|
|
|
DataRow[] machinesdata = Machines.Select("PORT>0 AND IP<>''");//获取连接有效的组
|
|
|
|
Machinesdata_Count = machinesdata.Count(); |
|
|
|
|
|
|
|
for (int i = 0; i < Machinesdata_Count; i++) |
|
|
|
{ |
|
|
|
MachiensTcpClient[i] = new TcpClient(); |
|
|
|
DataRow dt= machinesdata[i]; |
|
|
|
|
|
|
|
_= AsyncTcpClient.TcpClient(MachiensTcpClient[i] //建立tcp连接
|
|
|
|
, Selet_Machines(MainWindowViewModel.Machines, "IP", Convert.ToInt16( dt["ID"])).ToString() |
|
|
|
, Selet_Machines(MainWindowViewModel.Machines, "PORT", Convert.ToInt16(dt["ID"])).ToString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static string SYS_WorkNumder; //工单号
|
|
|
|
public static int SYS_AT1; //附缸1-3
|
|
|
@ -100,7 +134,23 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static object Selet_Machines(DataTable DB, string name, int key)//查询
|
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
lock (DB) |
|
|
|
{ |
|
|
|
DataRow drEmployee = DB.Select("ID='" + key + "'").First(); |
|
|
|
object index = drEmployee.Field<object>(name); |
|
|
|
return index; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
// LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
|
|
|
return "ERR"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|