Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified MicroDAQ.smm
Binary file not shown.
34 changes: 17 additions & 17 deletions MicroDAQ/DataDisplayForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
42 changes: 27 additions & 15 deletions MicroDAQ/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}


Expand All @@ -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()
Expand Down Expand Up @@ -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;
Expand Down
20 changes: 8 additions & 12 deletions MicroDAQ/MicroDAQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,19 @@
<StartupObject>MicroDAQ.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="Automatic, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Release\Automatic.dll</HintPath>
<Reference Include="Automatic">
<HintPath>..\..\..\Project\JonLibrary\Automatic\bin\Release\Automatic.dll</HintPath>
</Reference>
<Reference Include="JonLibrary, Version=1.0.4546.17827, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Release\JonLibrary.dll</HintPath>
<Reference Include="JonLibrary">
<HintPath>..\..\..\Project\JonLibrary\JonLibrary\bin\Release\JonLibrary.dll</HintPath>
</Reference>
<Reference Include="OpcRcw.Comn, Version=1.10.1.21, Culture=neutral, PublicKeyToken=9a40e993cbface53">
<SpecificVersion>False</SpecificVersion>
<Reference Include="OpcRcw.Comn">
<HintPath>..\..\..\Project\JonLibrary\JonLibrary\bin\Release\OpcRcw.Comn.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>bin\Release\OpcRcw.Comn.dll</HintPath>
</Reference>
<Reference Include="OpcRcw.Da, Version=3.0.2.22, Culture=neutral, PublicKeyToken=9a40e993cbface53">
<SpecificVersion>False</SpecificVersion>
<Reference Include="OpcRcw.Da">
<HintPath>..\..\..\Project\JonLibrary\JonLibrary\bin\Release\OpcRcw.Da.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>bin\Release\OpcRcw.Da.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand Down
6 changes: 3 additions & 3 deletions MicroDAQ/MicroDAQ.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[General]
Title=���ݲɼ�ϵͳ-�Ϻ�����
ProjetCode=SHXY
VersionCode=1.17
Title=���ݲɼ�ϵͳ-άԶ̩��
ProjetCode=Vwin
VersionCode=1.26
Duty=M
;Duty=E

Expand Down
22 changes: 22 additions & 0 deletions MicroDAQ/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions MicroDAQ/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// 控制。更改这些属性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("MicroDAQ")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("数据刷新时间300ms")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("K")]
[assembly: AssemblyProduct("MicroDAQ")]
Expand All @@ -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")]
2 changes: 1 addition & 1 deletion MicroDAQ/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion MicroDAQ/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.