diff --git a/MicroDAQ.smm b/MicroDAQ.smm index a616dd2..d015746 100644 Binary files a/MicroDAQ.smm and b/MicroDAQ.smm differ diff --git a/MicroDAQ/DataDisplayForm.cs b/MicroDAQ/DataDisplayForm.cs index 8441d66..8e8e9ec 100644 --- a/MicroDAQ/DataDisplayForm.cs +++ b/MicroDAQ/DataDisplayForm.cs @@ -77,29 +77,29 @@ meter.State .ToString (), lsvItems.Items[i - 1].BackColor = Color.Gold; //Console.WriteLine((item as Meter).ID); } - - if (Program.M_flowAlert.Items != null) - foreach (var item in Program.M_flowAlert.Items) - { - DataItem meter = item as DataItem; - i++; - if (lsvItems.Items.Count < i) - lsvItems.Items.Add(new ListViewItem(new string[]{ + if (Program.M_flowAlert != null) + if (Program.M_flowAlert.Items != null) + foreach (var item in Program.M_flowAlert.Items) + { + DataItem meter = item as DataItem; + i++; + if (lsvItems.Items.Count < i) + lsvItems.Items.Add(new ListViewItem(new string[]{ meter.ID.ToString() , meter.Value .ToString () , string.Empty, - "流量", + "粒子计数器流量", meter.State .ToString (), meter.Quality.ToString ()})); - else - { - lsvItems.Items[i - 1].SubItems[0].Text = meter.ID.ToString(); - lsvItems.Items[i - 1].SubItems[1].Text = meter.Value.ToString(); - lsvItems.Items[i - 1].SubItems[3].Text = "流量"; - lsvItems.Items[i - 1].SubItems[4].Text = meter.State.ToString(); - lsvItems.Items[i - 1].SubItems[5].Text = meter.Quality.ToString(); + else + { + lsvItems.Items[i - 1].SubItems[0].Text = meter.ID.ToString(); + lsvItems.Items[i - 1].SubItems[1].Text = meter.Value.ToString(); + lsvItems.Items[i - 1].SubItems[3].Text = "粒子计数器流量"; + lsvItems.Items[i - 1].SubItems[4].Text = meter.State.ToString(); + lsvItems.Items[i - 1].SubItems[5].Text = meter.Quality.ToString(); + } } - } switch (Program.M.ConnectionState) diff --git a/MicroDAQ/MainForm.cs b/MicroDAQ/MainForm.cs index f83b9b6..44bf2a3 100644 --- a/MicroDAQ/MainForm.cs +++ b/MicroDAQ/MainForm.cs @@ -204,8 +204,11 @@ private void CreateMeters() Program.M = new DataItemManager("MachineData", h.ToArray(), d.ToArray()); Program.M.Connect("127.0.0.1"); - Program.M_flowAlert = new FlowAlertManager("FlowAlert", h_flow.ToArray(), d_flow.ToArray()); - Program.M_flowAlert.Connect("127.0.0.1"); + if (h_flow.Count > 0) + { + Program.M_flowAlert = new FlowAlertManager("FlowAlert", h_flow.ToArray(), d_flow.ToArray()); + Program.M_flowAlert.Connect("127.0.0.1"); + } } @@ -215,21 +218,30 @@ private void CreateMeters() private void update2() { - foreach (var item in Program.M.Items) + try { - Program.DatabaseManager.UpdateMeterValue(item.ID, (int)item.Type, (int)item.State, (float)item.Value, 0.0f, 0.0f, item.Quality); + foreach (var item in Program.M.Items) + { + Program.DatabaseManager.UpdateMeterValue(item.ID, (int)item.Type, (int)item.State, (float)item.Value, 0.0f, 0.0f, item.Quality); + } + if (Program.M_flowAlert != null) + foreach (var item in Program.M_flowAlert.Items) + { + float t = 0.0f; + if ((item.Value == 0) && ((item.State == DataState.正常) || (item.State == DataState.已启动))) + t = 28.3f; + if (item.Value == 2) + t = 0.0f; + Program.DatabaseManager.UpdateMeterValue(item.ID + 10000, (int)16, (int)item.State, t, 0.0f, 0.0f, item.Quality); + Console.WriteLine(item.ToString()); + } } - foreach (var item in Program.M_flowAlert.Items) + catch + { } + finally { - float t = 0.0f; - if ((item.Value == 0) && ((item.State == DataState.正常) || (item.State == DataState.已启动))) - t = 28.3f; - if (item.Value == 2) - t = 0.0f; - Program.DatabaseManager.UpdateMeterValue(item.ID + 10000, (int)16, (int)item.State, t, 0.0f, 0.0f, item.Quality); - Console.WriteLine(item.ToString()); + //Thread.Sleep(30000); } - } int running; public void remoteCtrl() @@ -282,8 +294,8 @@ public void start() UpdateCycle = new CycleTask(); RemoteCtrl = new CycleTask(); Program.RemoteCycle = RemoteCtrl; - UpdateCycle.WorkStateChanged += new CycleTask.dgtWorkStateChange(UpdateCycle_WorkStateChanged); - RemoteCtrl.WorkStateChanged += new CycleTask.dgtWorkStateChange(RemoteCtrl_WorkStateChanged); + UpdateCycle.WorkStateChanged += new CycleTask.WorkStateChangeEventHandle(UpdateCycle_WorkStateChanged); + RemoteCtrl.WorkStateChanged += new CycleTask.WorkStateChangeEventHandle(RemoteCtrl_WorkStateChanged); UpdateCycle.Run(update2, System.Threading.ThreadPriority.BelowNormal); RemoteCtrl.Run(remoteCtrl, System.Threading.ThreadPriority.BelowNormal); Start.SetExit = true; diff --git a/MicroDAQ/MicroDAQ.csproj b/MicroDAQ/MicroDAQ.csproj index d33bb0a..a8e882d 100644 --- a/MicroDAQ/MicroDAQ.csproj +++ b/MicroDAQ/MicroDAQ.csproj @@ -62,23 +62,19 @@ MicroDAQ.Program - - False - bin\Release\Automatic.dll + + ..\..\..\Project\JonLibrary\Automatic\bin\Release\Automatic.dll - - False - bin\Release\JonLibrary.dll + + ..\..\..\Project\JonLibrary\JonLibrary\bin\Release\JonLibrary.dll - - False + + ..\..\..\Project\JonLibrary\JonLibrary\bin\Release\OpcRcw.Comn.dll True - bin\Release\OpcRcw.Comn.dll - - False + + ..\..\..\Project\JonLibrary\JonLibrary\bin\Release\OpcRcw.Da.dll True - bin\Release\OpcRcw.Da.dll diff --git a/MicroDAQ/MicroDAQ.ini b/MicroDAQ/MicroDAQ.ini index accc130..cd46052 100644 --- a/MicroDAQ/MicroDAQ.ini +++ b/MicroDAQ/MicroDAQ.ini @@ -1,7 +1,7 @@ [General] -Title=ݲɼϵͳ-Ϻ -ProjetCode=SHXY -VersionCode=1.17 +Title=ݲɼϵͳ-άԶ̩ +ProjetCode=Vwin +VersionCode=1.26 Duty=M ;Duty=E diff --git a/MicroDAQ/Program.cs b/MicroDAQ/Program.cs index bafec96..4f614d9 100644 --- a/MicroDAQ/Program.cs +++ b/MicroDAQ/Program.cs @@ -25,6 +25,28 @@ static void Main(string[] args) break; } + } + #endregion + + #region 处理来自参数的调整模式请求,不使用错误捕获和重新启动 + foreach (string arg in args) + { + if (arg.Contains("debug")) + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + Form MainForm = null; + while (!BeQuit) + { + MainForm = new MainForm(); + Application.Run(MainForm); + if (MainForm != null) MainForm.Dispose(); + } + Environment.Exit(Environment.ExitCode); + break; + } + } #endregion bool createNew; diff --git a/MicroDAQ/Properties/AssemblyInfo.cs b/MicroDAQ/Properties/AssemblyInfo.cs index 354814e..35159e1 100644 --- a/MicroDAQ/Properties/AssemblyInfo.cs +++ b/MicroDAQ/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ // 控制。更改这些属性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("MicroDAQ")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("数据刷新时间300ms")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("K")] [assembly: AssemblyProduct("MicroDAQ")] @@ -31,6 +31,6 @@ // // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: -[assembly: AssemblyVersion("1.26.4")] +[assembly: AssemblyVersion("1.26.6.4")] //[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.26.4")] +[assembly: AssemblyFileVersion("1.26.6.4")] diff --git a/MicroDAQ/Properties/Resources.Designer.cs b/MicroDAQ/Properties/Resources.Designer.cs index 97c9a86..41da1ce 100644 --- a/MicroDAQ/Properties/Resources.Designer.cs +++ b/MicroDAQ/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // 此代码由工具生成。 -// 运行时版本:4.0.30319.296 +// 运行时版本:4.0.30319.1008 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 diff --git a/MicroDAQ/Properties/Settings.Designer.cs b/MicroDAQ/Properties/Settings.Designer.cs index 879f292..d9fe3f7 100644 --- a/MicroDAQ/Properties/Settings.Designer.cs +++ b/MicroDAQ/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // 此代码由工具生成。 -// 运行时版本:4.0.30319.296 +// 运行时版本:4.0.30319.1008 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。