修改连线逻辑

This commit is contained in:
sc committed 2025-04-10 22:58:20 +08:00
commit 26c41a0c10
3 files changed
+14 -11

No files matched your search

+2 -2
View File
@@ -90,7 +90,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.BeginEdit(); drEmployee.BeginEdit();
drEmployee["State"] = "899"; drEmployee["State"] = "800";
drEmployee["WorkOrder"] = "------"; drEmployee["WorkOrder"] = "------";
drEmployee["Dyelot"] = ""; drEmployee["Dyelot"] = "";
drEmployee["Temperature"] = "---.-"; drEmployee["Temperature"] = "---.-";
@@ -123,7 +123,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.BeginEdit(); drEmployee.BeginEdit();
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString(); drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString(); // drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString(); drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString();
drEmployee["State"] = "802"; drEmployee["State"] = "802";
drEmployee.EndEdit(); drEmployee.EndEdit();
+1 -1
View File
@@ -40,7 +40,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
public MonitorView() public MonitorView()
{ {
DataContext = new MainWindowViewModel(); //DataContext = new MainWindowViewModel();
InitializeComponent(); InitializeComponent();
CountDown(); CountDown();
} }
+11 -8
View File
@@ -15,7 +15,9 @@ using System.Data.SqlClient;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Timers;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Media; using System.Windows.Media;
@@ -149,14 +151,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
LogGing.LogGingDATA("[Database='" + ex + "']=SQLSERVER"); LogGing.LogGingDATA("[Database='" + ex + "']=SQLSERVER");
ERR_c++; ERR_c++;
} }
} }
public void CountDown() public void CountDown()
{ {
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick DispatcherTimer timer1s = new DispatcherTimer(DispatcherPriority.Normal);//初始化循环,每1秒调用一次Tick
{ timer1s.Interval = TimeSpan.FromMilliseconds(950);//秒
Interval = TimeSpan.FromSeconds(1)//秒 timer1s.Tick += Tick_Main_1S;
};
timer1s.Tick += Tick_Event_1S;
timer1s.Start(); timer1s.Start();
DispatcherTimer dis50ms = new DispatcherTimer DispatcherTimer dis50ms = new DispatcherTimer
@@ -164,7 +165,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
Interval = TimeSpan.FromMilliseconds(10) //毫秒 Interval = TimeSpan.FromMilliseconds(10) //毫秒
}; };
dis50ms.Tick += new EventHandler(DisTimer_50MS);//每一秒执行的方法 dis50ms.Tick += new EventHandler(DisTimer_50MS);//每一秒执行的方法
dis50ms.Start();//计时开始 dis50ms.Start();//计时开始
}//时间周期初始化 }//时间周期初始化
void DisTimer_50MS(object sender, EventArgs e)//Tick_Event周期执行事件50MS void DisTimer_50MS(object sender, EventArgs e)//Tick_Event周期执行事件50MS
{ {
@@ -174,7 +175,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
MachiensTcpClient[t.ID].SendAsync(t.DAT); MachiensTcpClient[t.ID].SendAsync(t.DAT);
} }
} }
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{ {
DATA_view(); DATA_view();
//下传工单信息 //下传工单信息