|
@ -71,7 +71,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
|
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
|
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
|
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
|
|
public static DataTable Machines = new DataTable(); //设备表缓存
|
|
|
public static DataTable Machines = new DataTable(); //设备表缓存
|
|
|
public static DataTable InfData = new DataTable(); |
|
|
|
|
|
// public static DataRow MachinesROW;
|
|
|
// public static DataRow MachinesROW;
|
|
|
public static DataTable USER_data = new DataTable(); |
|
|
public static DataTable USER_data = new DataTable(); |
|
|
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
|
|
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
|
@ -103,13 +102,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
CountDown(); |
|
|
CountDown(); |
|
|
TcpClientNEW(); |
|
|
TcpClientNEW(); |
|
|
SQL_LINK(); |
|
|
SQL_LINK(); |
|
|
|
|
|
|
|
|
/**添加提示信息栏**/ |
|
|
|
|
|
InfData.Columns.Add("Machine", Type.GetType("System.String")); |
|
|
|
|
|
InfData.Columns.Add("Information", Type.GetType("System.String")); |
|
|
|
|
|
InfData.Columns.Add("Code", Type.GetType("System.String")); |
|
|
|
|
|
InfData.Columns.Add("ID", Type.GetType("System.Int32")); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
public static void USERCapacity(string user) //权限
|
|
|
public static void USERCapacity(string user) //权限
|
|
|
{ |
|
|
{ |
|
@ -162,18 +154,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
|
|
|
|
|
|
public void CountDown() |
|
|
public void CountDown() |
|
|
{ |
|
|
{ |
|
|
DispatcherTimer timer1s = new DispatcherTimer(DispatcherPriority.Normal);//初始化循环,每1秒调用一次Tick
|
|
|
|
|
|
timer1s.Interval = TimeSpan.FromMilliseconds(950);//秒
|
|
|
|
|
|
timer1s.Tick += Tick_Main_1S; |
|
|
|
|
|
timer1s.Start(); |
|
|
|
|
|
|
|
|
|
|
|
DispatcherTimer dis50ms = new DispatcherTimer |
|
|
DispatcherTimer dis50ms = new DispatcherTimer |
|
|
{ |
|
|
{ |
|
|
Interval = TimeSpan.FromMilliseconds(10) //毫秒
|
|
|
Interval = TimeSpan.FromMilliseconds(50) //毫秒
|
|
|
}; |
|
|
}; |
|
|
dis50ms.Tick += new EventHandler(DisTimer_50MS);//每执行的方法
|
|
|
dis50ms.Tick += new EventHandler(DisTimer_50MS);//每执行的方法
|
|
|
dis50ms.Start();//计时开始
|
|
|
dis50ms.Start();//计时开始
|
|
|
}//时间周期初始化
|
|
|
}//时间周期初始化
|
|
|
|
|
|
int Time1 = 0, Time5 = 0, Time60 = 0; |
|
|
void DisTimer_50MS(object sender, EventArgs e)//Tick_Event周期执行事件50MS
|
|
|
void DisTimer_50MS(object sender, EventArgs e)//Tick_Event周期执行事件50MS
|
|
|
{ |
|
|
{ |
|
|
if (stringQueue.Count > 0) //信息发送队列
|
|
|
if (stringQueue.Count > 0) //信息发送队列
|
|
@ -181,9 +169,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
QueueString t = stringQueue.Dequeue(); |
|
|
QueueString t = stringQueue.Dequeue(); |
|
|
MachiensTcpClient[t.ID].SendAsync(t.DAT); |
|
|
MachiensTcpClient[t.ID].SendAsync(t.DAT); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
|
|
if (Time1 >= 20) |
|
|
|
|
|
{ |
|
|
|
|
|
Tick_Main_1S(); |
|
|
|
|
|
Time1 = 0; |
|
|
|
|
|
} |
|
|
|
|
|
else { Time1++; } |
|
|
|
|
|
} |
|
|
|
|
|
void Tick_Main_1S()//Tick_Event周期执行事件1S
|
|
|
{ |
|
|
{ |
|
|
//下传工单信息
|
|
|
//下传工单信息
|
|
|
SQLiteHelper WorkOrderSQL = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
SQLiteHelper WorkOrderSQL = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
@ -310,7 +304,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
} |
|
|
} |
|
|
else { Time60++; } |
|
|
else { Time60++; } |
|
|
} |
|
|
} |
|
|
int Time5=0,Time60; |
|
|
|
|
|
void Tick_Event_5S()//Tick_Event周期执行事件5S
|
|
|
void Tick_Event_5S()//Tick_Event周期执行事件5S
|
|
|
{ |
|
|
{ |
|
|
for (int i = 0; i < Machinesdata_Count; i++) |
|
|
for (int i = 0; i < Machinesdata_Count; i++) |
|
@ -364,6 +357,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* public static void Inf_Data() |
|
|
|
|
|
{ |
|
|
|
|
|
UserInformation userInformation = new UserInformation(); |
|
|
|
|
|
userInformation.Topmost = true; |
|
|
|
|
|
userInformation.Show(); |
|
|
|
|
|
userInformation.Activate(); |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
public static string SYS_WorkNumder; //工单号
|
|
|
public static string SYS_WorkNumder; //工单号
|
|
|
public static int SYS_AT1; //附缸1-3
|
|
|
public static int SYS_AT1; //附缸1-3
|
|
|
public static int SYS_AT2; |
|
|
public static int SYS_AT2; |
|
|