Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
GC_Branch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周磊
GC_Branch
Commits
7b0a1056
Commit
7b0a1056
authored
Aug 26, 2019
by
liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增林工通讯的通讯协议,添加zb2040后处理软件的通讯,修改外部用户界面和对外部自动校准的逻辑问题
parent
245b0043
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1590 additions
and
946 deletions
+1590
-946
AboutForm.cs
GcDevicePc/AboutForm.cs
+1
-1
AppInit.cs
GcDevicePc/AppInit.cs
+42
-11
InfoBarUser.cs
GcDevicePc/CK_UI/InfoBarUser.cs
+31
-26
UserCtl.Designer.cs
GcDevicePc/CK_UI/UserCtl.Designer.cs
+8
-8
UserCtl.cs
GcDevicePc/CK_UI/UserCtl.cs
+25
-25
NModbusSlave.cs
GcDevicePc/Common/NModbusSlave.cs
+253
-153
MethodMain.cs
GcDevicePc/ConfigMethod/MethodMain.cs
+2
-2
DataState.Designer.cs
GcDevicePc/DataState.Designer.cs
+1
-0
DataState.cs
GcDevicePc/DataState.cs
+36
-0
FormUser.Designer.cs
GcDevicePc/FormUser.Designer.cs
+1
-1
FormUser.cs
GcDevicePc/FormUser.cs
+13
-2
DPBuffer.cs
GcDevicePc/GCBuffer/DPBuffer.cs
+28
-6
PCBuffer.cs
GcDevicePc/GCBuffer/PCBuffer.cs
+21
-3
MDIBase.Designer.cs
GcDevicePc/MDIBase.Designer.cs
+43
-31
MDIBase.cs
GcDevicePc/MDIBase.cs
+156
-99
GcDataTh.cs
GcDevicePc/ProThread/GcDataTh.cs
+77
-0
HMIControl.cs
GcDevicePc/ProThread/HMIControl.cs
+13
-3
SendDataToZB.cs
GcDevicePc/ProThread/SendDataToZB.cs
+384
-304
SignalDataToHw.cs
GcDevicePc/ProThread/SignalDataToHw.cs
+269
-254
RunTables.cs
GcDevicePc/RunTables.cs
+2
-2
StartForm.cs
GcDevicePc/StartForm.cs
+4
-1
TestForm.Designer.cs
GcDevicePc/TestForm.Designer.cs
+116
-12
TestForm.cs
GcDevicePc/TestForm.cs
+63
-1
globaldata.cs
GcDevicePc/globaldata.cs
+1
-1
No files found.
GcDevicePc/AboutForm.cs
View file @
7b0a1056
...
...
@@ -42,7 +42,7 @@ namespace GcDevicePc
this
.
fid1ver
.
Text
=
this
.
FID1version
;
this
.
fid2ver
.
Text
=
this
.
FID2version
;
this
.
tcdver
.
Text
=
this
.
TCD1version
;
this
.
PCver
.
Text
=
this
.
Hmiversion
+
"/1.5.
6
"
;
this
.
PCver
.
Text
=
this
.
Hmiversion
+
"/1.5.
7
"
;
}
}
}
GcDevicePc/AppInit.cs
View file @
7b0a1056
...
...
@@ -594,7 +594,6 @@ namespace GcDevicePc
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcfolderinfo
.
FwFolder
=
tmpMainFolder
;
}
//Logs
tmpMainFolder
=
Path
.
Combine
(
tmpFolder
,
"Logs"
);
CheckFolderandFile
(
0
,
tmpMainFolder
);
...
...
@@ -615,6 +614,16 @@ namespace GcDevicePc
CheckFolderandFile
(
0
,
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcfolderinfo
.
SubStatusFolder
);
tmpFolder
=
null
;
//string file = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.StartupPath), "GC_Config\\GC_Set\\启动参数\\startup.ini");
//IniFile ini = new IniFile(file);
//string Version = ini.ReadString("Version", "VersionType");
//if (string.IsNullOrEmpty(Version))
//{
// Version = "1";
//}
globaldata
.
CurrentVersion
=
"1"
;
}
/// <summary>
...
...
@@ -683,6 +692,35 @@ namespace GcDevicePc
return
true
;
}
public
GCMethodConfig
InitGetConfig
(
string
filename
)
{
GCMethodConfig
gCMethodConfig
=
new
GCMethodConfig
();
IniFile
iniFile
=
new
IniFile
(
filename
);
if
(
File
.
Exists
(
filename
))
{
string
section
=
"信号"
;
gCMethodConfig
.
signal
.
u16ChannelA
=
(
ushort
)
iniFile
.
ReadInteger
(
section
,
"通道A"
);
gCMethodConfig
.
signal
.
u16ChannelB
=
(
ushort
)
iniFile
.
ReadInteger
(
section
,
"通道B"
);
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
gCMethodConfig
.
signal
.
uDetA
[
i
]
=
(
ushort
)
iniFile
.
ReadInteger
(
section
,
"通道A检测器"
+
(
i
+
1
).
ToString
());
gCMethodConfig
.
signal
.
uDetB
[
i
]
=
(
ushort
)
iniFile
.
ReadInteger
(
section
,
"通道B检测器"
+
(
i
+
1
).
ToString
());
}
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
gCMethodConfig
.
signal
.
u16DetTimeLengthA
[
i
]
=
(
ushort
)
iniFile
.
ReadInteger
(
section
,
"通道A检测时间"
+
(
i
+
1
).
ToString
());
gCMethodConfig
.
signal
.
u16DetTimeLengthB
[
i
]
=
(
ushort
)
iniFile
.
ReadInteger
(
section
,
"通道B检测时间"
+
(
i
+
1
).
ToString
());
}
}
return
gCMethodConfig
;
}
/// <summary>
/// 配置文件初始化
/// </summary>
...
...
@@ -722,6 +760,9 @@ namespace GcDevicePc
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcfileinfo
.
cur_MethodName
=
tmpfile
;
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcfileinfo
.
show_MethodName
=
"SingleAnal.ini"
;
}
//SignalDataToHw.methodconfig = InitGetConfig(tmpfile);
SendDataToZB
.
methodconfig
=
InitGetConfig
(
tmpfile
);
}
else
{
...
...
@@ -774,17 +815,7 @@ namespace GcDevicePc
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcfileinfo
.
cur_StatusName
=
tmpfile
;
tmpfile
=
null
;
string
file
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
System
.
Windows
.
Forms
.
Application
.
StartupPath
),
"GC_Config\\GC_Set\\启动参数\\startup.ini"
);
IniFile
ini
=
new
IniFile
(
file
);
string
Version
=
ini
.
ReadString
(
"Version"
,
"VersionType"
);
if
(
string
.
IsNullOrEmpty
(
Version
))
{
Version
=
"0"
;
}
globaldata
.
CurrentVersion
=
Version
;
}
public
void
LocalNetworkCheck
()
...
...
GcDevicePc/CK_UI/InfoBarUser.cs
View file @
7b0a1056
...
...
@@ -28,7 +28,7 @@ namespace GcDevicePc.CK_UI
{
//温度显示
Color
zcolor
=
Color
.
White
;
Color
waringcolor
=
Color
.
LightGreen
;
Color
waringcolor
=
Color
.
White
;
//前进样口
...
...
@@ -73,8 +73,8 @@ namespace GcDevicePc.CK_UI
}
else
{
textBoxport
.
Text
=
""
;
textBoxport
.
BackColor
=
Color
.
LightGray
;
textBoxport
.
Text
=
"
0.0/0
"
;
textBoxport
.
BackColor
=
waringcolor
;
;
}
...
...
@@ -108,7 +108,7 @@ namespace GcDevicePc.CK_UI
}
if
(
Math
.
Abs
(
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
ColSetTemp
-
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
ColActualTemp
)<=
0.1
)
if
(
Math
.
Abs
(
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
ColSetTemp
-
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
ColActualTemp
)
<=
0.1
)
{
textBoven
.
BackColor
=
zcolor
;
}
...
...
@@ -192,7 +192,7 @@ namespace GcDevicePc.CK_UI
textBFid
.
BackColor
=
waringcolor
;
//epc
if
(
globaldata
.
m_hwconfig
.
hwconfiginfo
.
u16StartType
!=
0
)
if
(
globaldata
.
m_hwconfig
.
hwconfiginfo
.
u16StartType
!=
2
)
{
hflow
.
Text
=
(
globaldata
.
m_dpbuffer
.
ShowList
.
showepc
.
EPC1_2_Cur
/
10.0f
).
ToString
(
"#0.0"
)
+
"/"
+
(
globaldata
.
m_dpbuffer
.
ShowList
.
showepc
.
EPC1_2_Set
/
10.0f
).
ToString
(
"#0"
);
hflow
.
BackColor
=
waringcolor
;
...
...
@@ -205,10 +205,14 @@ namespace GcDevicePc.CK_UI
}
else
{
hflow
.
BackColor
=
Color
.
LightGray
;
airflow
.
BackColor
=
Color
.
LightGray
;
foneflow
.
BackColor
=
Color
.
LightGray
;
ftwoflow
.
BackColor
=
Color
.
LightGray
;
hflow
.
Enabled
=
false
;
airflow
.
Enabled
=
false
;
foneflow
.
Enabled
=
false
;
ftwoflow
.
Enabled
=
false
;
//hflow.BackColor = waringcolor;
//airflow.BackColor = waringcolor;
//foneflow.BackColor = waringcolor;
//ftwoflow.BackColor = waringcolor;
}
...
...
@@ -289,7 +293,8 @@ namespace GcDevicePc.CK_UI
//txtstats.Text = strtext;
//txtstats.BackColor = bkcolor;
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
Trace
.
Write
(
ex
);
}
...
...
GcDevicePc/CK_UI/UserCtl.Designer.cs
View file @
7b0a1056
...
...
@@ -42,8 +42,8 @@
this
.
label5
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
textBox4
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
textBox2
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
groupBox1
.
SuspendLayout
();
this
.
SuspendLayout
();
//
...
...
@@ -132,7 +132,7 @@
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
413
);
this
.
groupBox1
.
TabIndex
=
8
;
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
Text
=
"结果
(ppm)
"
;
this
.
groupBox1
.
Text
=
"结果
浓度
"
;
//
// textBox6
//
...
...
@@ -188,12 +188,6 @@
this
.
label1
.
TabIndex
=
9
;
this
.
label1
.
Text
=
"苯"
;
//
// timer1
//
this
.
timer1
.
Enabled
=
true
;
this
.
timer1
.
Interval
=
60000
;
this
.
timer1
.
Tick
+=
new
System
.
EventHandler
(
this
.
timer1_Tick
);
//
// textBox2
//
this
.
textBox2
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
14.25F
,
System
.
Drawing
.
FontStyle
.
Bold
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
...
...
@@ -202,6 +196,12 @@
this
.
textBox2
.
Size
=
new
System
.
Drawing
.
Size
(
116
,
29
);
this
.
textBox2
.
TabIndex
=
6
;
//
// timer1
//
this
.
timer1
.
Enabled
=
true
;
this
.
timer1
.
Interval
=
60000
;
this
.
timer1
.
Tick
+=
new
System
.
EventHandler
(
this
.
timer1_Tick
);
//
// UserCtl
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
...
...
GcDevicePc/CK_UI/UserCtl.cs
View file @
7b0a1056
...
...
@@ -59,7 +59,7 @@ namespace GcDevicePc.CK_UI
Systemtype
=
CKVocAnalyzer
.
GlobalCKV
.
Systemtype
;
isppm
=
false
;
groupBox1
.
Text
=
"结果
(mg/m³)
"
;
groupBox1
.
Text
=
"结果
浓度
"
;
switch
(
Systemtype
)
{
default
:
//非甲烷总烃
...
...
@@ -272,11 +272,11 @@ namespace GcDevicePc.CK_UI
{
if
(
isppm
)
{
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
();
}
else
{
//此处计算成mg/m3 nmhc
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"mg/m³"
;
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
();
//textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
...
...
@@ -293,11 +293,11 @@ namespace GcDevicePc.CK_UI
{
if
(
isppm
)
{
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
();
}
else
{
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"mg/m³"
;
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
();
//textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
...
...
@@ -316,11 +316,11 @@ namespace GcDevicePc.CK_UI
{
if
(
isppm
)
{
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
();
}
else
{
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"mg/m³"
;
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
();
//textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
...
...
@@ -391,12 +391,12 @@ namespace GcDevicePc.CK_UI
{
return
;
}
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox4
.
Text
=
Math
.
Round
(
listben
[
listben
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox5
.
Text
=
Math
.
Round
(
listjiaben
[
listjiaben
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox6
.
Text
=
Math
.
Round
(
listerjiaben
[
listerjiaben
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
();
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
();
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
();
textBox4
.
Text
=
Math
.
Round
(
listben
[
listben
.
Count
-
1
].
Y
,
2
).
ToString
();
textBox5
.
Text
=
Math
.
Round
(
listjiaben
[
listjiaben
.
Count
-
1
].
Y
,
2
).
ToString
();
textBox6
.
Text
=
Math
.
Round
(
listerjiaben
[
listerjiaben
.
Count
-
1
].
Y
,
2
).
ToString
();
...
...
@@ -407,11 +407,11 @@ namespace GcDevicePc.CK_UI
{
if
(
isppm
)
{
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
();
}
else
{
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"mg/m³"
;
textBox1
.
Text
=
Math
.
Round
(
listNmoc
[
listNmoc
.
Count
-
1
].
Y
,
2
).
ToString
();
//textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
...
...
@@ -428,11 +428,11 @@ namespace GcDevicePc.CK_UI
{
if
(
isppm
)
{
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
();
}
else
{
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"mg/m³"
;
textBox2
.
Text
=
Math
.
Round
(
listTHC
[
listTHC
.
Count
-
1
].
Y
,
2
).
ToString
();
//textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
...
...
@@ -449,11 +449,11 @@ namespace GcDevicePc.CK_UI
{
if
(
isppm
)
{
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
();
}
else
{
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"mg/m³"
;
textBox3
.
Text
=
Math
.
Round
(
listCH4
[
listCH4
.
Count
-
1
].
Y
,
2
).
ToString
();
//textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
...
...
@@ -471,11 +471,11 @@ namespace GcDevicePc.CK_UI
{
if
(
isppm
)
{
textBox4
.
Text
=
Math
.
Round
(
listben
[
listben
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox4
.
Text
=
Math
.
Round
(
listben
[
listben
.
Count
-
1
].
Y
,
2
).
ToString
();
}
else
{
textBox4
.
Text
=
Math
.
Round
(
listben
[
listben
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"mg/m³"
;
textBox4
.
Text
=
Math
.
Round
(
listben
[
listben
.
Count
-
1
].
Y
,
2
).
ToString
();
//textBox4.Text = Math.Round(listben[listben.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
...
...
@@ -492,11 +492,11 @@ namespace GcDevicePc.CK_UI
{
if
(
isppm
)
{
textBox5
.
Text
=
Math
.
Round
(
listjiaben
[
listjiaben
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox5
.
Text
=
Math
.
Round
(
listjiaben
[
listjiaben
.
Count
-
1
].
Y
,
2
).
ToString
();
}
else
{
textBox5
.
Text
=
Math
.
Round
(
listjiaben
[
listjiaben
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"mg/m³"
;
textBox5
.
Text
=
Math
.
Round
(
listjiaben
[
listjiaben
.
Count
-
1
].
Y
,
2
).
ToString
();
//textBox5.Text = Math.Round(listjiaben[listjiaben.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
...
...
@@ -513,11 +513,11 @@ namespace GcDevicePc.CK_UI
{
if
(
isppm
)
{
textBox6
.
Text
=
Math
.
Round
(
listerjiaben
[
listerjiaben
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"ppm"
;
textBox6
.
Text
=
Math
.
Round
(
listerjiaben
[
listerjiaben
.
Count
-
1
].
Y
,
2
).
ToString
();
}
else
{
textBox6
.
Text
=
Math
.
Round
(
listerjiaben
[
listerjiaben
.
Count
-
1
].
Y
,
2
).
ToString
()
+
"mg/m³"
;
textBox6
.
Text
=
Math
.
Round
(
listerjiaben
[
listerjiaben
.
Count
-
1
].
Y
,
2
).
ToString
();
//textBox6.Text = Math.Round(listerjiaben[listerjiaben.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
...
...
GcDevicePc/Common/NModbusSlave.cs
View file @
7b0a1056
...
...
@@ -97,7 +97,7 @@ namespace GcDevicePc.Common
switch
(
e
.
ModbusDataType
)
{
case
ModbusDataType
.
HoldingRegister
:
slavewirtehreg
(
e
.
StartAddress
,
e
.
Data
.
B
.
ToArray
());
//
slavewirtehreg(e.StartAddress, e.Data.B.ToArray());
break
;
case
ModbusDataType
.
Coil
:
...
...
@@ -117,6 +117,11 @@ namespace GcDevicePc.Common
}
/// <summary>
/// 辰科污染源VOC
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
static
ushort
slavereadhreg
(
ushort
address
)
{
try
...
...
@@ -415,6 +420,24 @@ namespace GcDevicePc.Common
case
1002
:
value
=
globaldata
.
m_dpbuffer
.
ShowList
.
showepc
.
EPC1_3_Cur
;
break
;
case
1003
:
//value = CKVocAnalyzer.GlobalCKV.adjustTwo.;
value
=
0
;
break
;
case
1004
:
value
=
0
;
//value = globaldata.m_dpbuffer.ShowList.showepc.EPC1_3_Cur;
break
;
case
1300
:
value
=
(
ushort
)
globaldata
.
m_pcbuffer
.
gcpcinfo
.
adjust
.
AdjustType
;
break
;
case
1301
:
value
=
(
ushort
)
globaldata
.
m_pcbuffer
.
gcpcinfo
.
adjust
.
AdjustOS
;
break
;
case
1302
:
value
=
(
ushort
)(
globaldata
.
m_pcbuffer
.
gcpcinfo
.
adjust
.
AdjustTime
*
60
);
break
;
}
}
if
(
address
>=
1500
)
...
...
@@ -470,55 +493,64 @@ namespace GcDevicePc.Common
static
void
slavewirtehreg
(
ushort
address
,
ushort
[]
value
)
{
if
(
address
>=
50
&&
address
<
99
)
{
switch
(
address
)
{
case
50
:
globaldata
.
m_hmibuffer
.
gcadjust
.
setpotency
=
ushortofloat
(
value
);
//int index = CKVocAnalyzer.GlobalCKV.autoVlue.FindIndex(s => s.name == "NMHC");
CKVocAnalyzer
.
GlobalCKV
.
nmhcsavevale
.
biaozhun
=
Math
.
Round
(
globaldata
.
m_hmibuffer
.
gcadjust
.
setpotency
,
2
);
CKVocAnalyzer
.
ExteConfig
.
Instance
.
Save
();
CKVocAnalyzer
.
AutoAdjust
.
IsSaveConfig
=
true
;
break
;
case
52
:
globaldata
.
m_hmibuffer
.
gcadjust
.
trackpotency
=
ushortofloat
(
value
);
int
tindex
=
CKVocAnalyzer
.
GlobalCKV
.
autoVlue
.
FindIndex
(
s
=>
s
.
name
==
"CH4"
);
CKVocAnalyzer
.
GlobalCKV
.
autoVlue
[
tindex
].
biaozhun
=
Math
.
Round
(
globaldata
.
m_hmibuffer
.
gcadjust
.
trackpotency
,
2
);
CKVocAnalyzer
.
ExteConfig
.
Instance
.
Save
();
CKVocAnalyzer
.
AutoAdjust
.
IsSaveConfig
=
true
;
break
;
case
54
:
globaldata
.
m_hmibuffer
.
gcadjust
.
settime
=
ushortolong
(
value
);
CKVocAnalyzer
.
GlobalCKV
.
AutoTimes
=
(
int
)
globaldata
.
m_hmibuffer
.
gcadjust
.
settime
/
60
;
CKVocAnalyzer
.
ExteConfig
.
Instance
.
Save
();
CKVocAnalyzer
.
AutoAdjust
.
IsSaveConfig
=
true
;
break
;
case
56
:
globaldata
.
m_hmibuffer
.
gcadjust
.
executefun
=
ushortolong
(
value
);
break
;
case
58
:
globaldata
.
m_hmibuffer
.
gcadjust
.
funrun
=
ushortolong
(
value
);
executefuncation
();
globaldata
.
m_hmibuffer
.
gcadjust
.
funrun
=
0
;
break
;
case
60
:
//globaldata.m_hmibuffer.gcadjust.runtime = ushortolong(value);
//SharedSpace.MControl.zhouqi* SharedSpace.MControl.runcount <= SharedSpace.MControl.dateend
break
;
case
62
:
//globaldata.m_hmibuffer.gcadjust.executestat = ushortolong(value);
break
;
default
:
break
;
}
}
//if (address
>= 50 && address < 99
)
//if (address
== 200
)
//{
//
switch (address
)
//
if (value[0] == 0
)
// {
// case 50:
// globaldata.m_hmibuffer.gcadjust.setpotency = ushortofloat(value);
// CKVocAnalyzer.GlobalCKV.nongdu = (int)globaldata.m_hmibuffer.gcadjust.setpotency;
// CKVocAnalyzer.ExteConfig.Instance.Save();
// break;
// case 52:
// //globaldata.m_hmibuffer.gcadjust.trackpotency = ushortofloat(value);
// break;
// case 54:
// globaldata.m_hmibuffer.gcadjust.settime = ushortolong(value);
// CKVocAnalyzer.GlobalCKV.AutoTimes = (int)globaldata.m_hmibuffer.gcadjust.settime / 60;
// CKVocAnalyzer.ExteConfig.Instance.Save();
// break;
// case 56:
// globaldata.m_hmibuffer.gcadjust.executefun = ushortolong(value);
// break;
// case 58:
// globaldata.m_hmibuffer.gcadjust.funrun = ushortolong(value);
// executefuncation();
// break;
// case 60:
// //globaldata.m_hmibuffer.gcadjust.runtime = ushortolong(value);
// //SharedSpace.MControl.zhouqi* SharedSpace.MControl.runcount <= SharedSpace.MControl.dateend
// break;
// case 62:
// //globaldata.m_hmibuffer.gcadjust.executestat = ushortolong(value);
// break;
// default:
// break;
// globaldata.usable = false;
// }
// if (value[0] == 1)
// {
// globaldata.usable = true;
// }
//}
if
(
address
==
200
)
{
if
(
value
[
0
]
==
0
)
{
globaldata
.
usable
=
false
;
}
if
(
value
[
0
]
==
1
)
{
globaldata
.
usable
=
true
;
}
}
//if (address == 100 || address == 99)
//{
...
...
@@ -550,41 +582,80 @@ namespace GcDevicePc.Common
public
static
void
executefuncation
()
{
if
(
globaldata
.
m_hmibuffer
.
gcadjust
.
funrun
==
1
)
//if (globaldata.m_hmibuffer.gcadjust.funrun==1)
//{
// switch (globaldata.m_hmibuffer.gcadjust.executefun)
// {
// case 0x02:
// case 0x03:
// case 0x00:
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Ling;
// break;
// case 0x0A:
// case 0x0E:
// case 0x0B:
// case 0x0F:
// case 0x08:
// case 0x0C:
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Xiao;
// break;
// case 0x06:
// case 0x07:
// case 0x04:
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Biao;
// break;
// default:
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Default;
// break;
// }
//}
//else
//{
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_fang;
//}
switch
(
globaldata
.
m_hmibuffer
.
gcadjust
.
funrun
)
{
case
1
:
switch
(
globaldata
.
m_hmibuffer
.
gcadjust
.
executefun
)
{
//校零
case
0x02
:
case
0x03
:
case
0x00
:
CKVocAnalyzer
.
AutoAdjust
.
Af_Option
=
CKVocAnalyzer
.
AutoAdjust
.
AdjustFromSet
.
AF_Ling
;
break
;
case
0x0A
:
case
0x06
:
case
0x0E
:
CurveDisPlay
.
curdisp
.
SetAutoAdjust
(
0
);
break
;
//校标
case
0x03
:
case
0x0B
:
case
0x07
:
case
0x0F
:
CurveDisPlay
.
curdisp
.
SetAutoAdjust
(
1
);
break
;
//样
case
0x00
:
case
0x08
:
case
0x04
:
case
0x0C
:
CurveDisPlay
.
curdisp
.
SetAutoAdjust
(
2
);
CKVocAnalyzer
.
AutoAdjust
.
Af_Option
=
CKVocAnalyzer
.
AutoAdjust
.
AdjustFromSet
.
AF_Xiao
;
break
;
case
0x06
:
case
0x07
:
case
0x04
:
CKVocAnalyzer
.
AutoAdjust
.
Af_Option
=
CKVocAnalyzer
.
AutoAdjust
.
AdjustFromSet
.
AF_Biao
;
break
;
default
:
CKVocAnalyzer
.
AutoAdjust
.
Af_Option
=
CKVocAnalyzer
.
AutoAdjust
.
AdjustFromSet
.
AF_Default
;
break
;
}
break
;
case
2
:
CKVocAnalyzer
.
AutoAdjust
.
Af_Option
=
CKVocAnalyzer
.
AutoAdjust
.
AdjustFromSet
.
AF_fang
;
break
;
case
3
:
CKVocAnalyzer
.
AutoAdjust
.
Af_Option
=
CKVocAnalyzer
.
AutoAdjust
.
AdjustFromSet
.
AF_fang
;
break
;
default
:
//CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Default;
break
;
}
else
{
CurveDisPlay
.
curdisp
.
StopAutoAdjust
();
}
}
public
static
ushort
slavereadcreg
(
ushort
address
)
...
...
@@ -686,7 +757,7 @@ namespace GcDevicePc.Common
{
if
(
CProfileDevice
.
m_DevParam
.
syspara
.
u16InjPortFront
==
1
)
{
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
FPActualTemp
*
10
;
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
FPActualTemp
;
}
else
{
...
...
@@ -697,7 +768,7 @@ namespace GcDevicePc.Common
{
if
(
CProfileDevice
.
m_DevParam
.
syspara
.
u16InjPortBehind
==
1
)
{
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
BPActualTemp
*
10
;
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
BPActualTemp
;
}
else
{
...
...
@@ -708,7 +779,7 @@ namespace GcDevicePc.Common
{
if
(
CProfileDevice
.
m_DevParam
.
syspara
.
u16Col
==
1
)
{
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
ColActualTemp
*
10
;
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
ColActualTemp
;
}
else
{
...
...
@@ -721,11 +792,11 @@ namespace GcDevicePc.Common
{
if
(
CProfileDevice
.
m_DevParam
.
syspara
.
u16DetFrontType
==
0
)
{
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
fDetActualTemp
*
10
;
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
fDetActualTemp
;
}
else
if
(
CProfileDevice
.
m_DevParam
.
syspara
.
u16DetFrontType
==
1
)
{
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
fDetActualTemp
*
10
;
f
[
0
]
=
globaldata
.
m_dpbuffer
.
ShowList
.
showtemp
.
fDetActualTemp
;
}
else
{
...
...
@@ -748,49 +819,90 @@ namespace GcDevicePc.Common
}
}
if
(
address
>=
40
&&
address
<
50
)
if
(
address
>=
36
&&
address
<
50
)
{
if
(
address
>=
36
&&
address
<
48
)
{
if
(
address
==
36
||
address
==
37
)
{
}
if
(
address
==
38
||
address
==
39
)
{
}
//jiawan
if
(
address
==
40
||
address
==
41
)
value
=
0
;
if
(
address
==
48
||
address
==
49
)
{
switch
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
)
int
index
=
CKVocAnalyzer
.
GlobalCKV
.
adjustTwo
.
FindIndex
(
p
=>
p
.
name
==
"CH4"
);
if
(
index
!=-
1
)
{
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Zero
:
l
[
0
]
=
0x02
;
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Biao
:
l
[
0
]
=
0x03
;
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
:
l
[
0
]
=
0x00
;
break
;
default
:
l
[
0
]
=
0x00
;
break
;
f
[
0
]
=
float
.
Parse
(
CKVocAnalyzer
.
GlobalCKV
.
adjustTwo
[
index
].
BValue
.
ToString
(
"0.00"
));
}
else
{
f
[
0
]
=
0
;
}
}
if
(
address
==
42
||
address
==
43
)
{
int
index
=
CKVocAnalyzer
.
GlobalCKV
.
adjustTwo
.
FindIndex
(
p
=>
p
.
name
==
"CH4"
);
if
(
index
!=
-
1
)
{
f
[
0
]
=
float
.
Parse
(
CKVocAnalyzer
.
GlobalCKV
.
adjustTwo
[
index
].
CValue
.
ToString
(
"0.00"
));
}
else
{
f
[
0
]
=
0
;
}
}
//zongting
if
(
address
==
44
||
address
==
45
)
{
int
index
=
CKVocAnalyzer
.
GlobalCKV
.
adjustTwo
.
FindIndex
(
p
=>
p
.
name
==
"THC"
);
if
(
index
!=
-
1
)
{
f
[
0
]
=
float
.
Parse
(
CKVocAnalyzer
.
GlobalCKV
.
adjustTwo
[
index
].
BValue
.
ToString
(
"0.00"
));
}
else
{
f
[
0
]
=
0
;
}
}
if
(
address
==
46
||
address
==
47
)
{
int
index
=
CKVocAnalyzer
.
GlobalCKV
.
adjustTwo
.
FindIndex
(
p
=>
p
.
name
==
"THC"
);
if
(
index
!=
-
1
)
{
f
[
0
]
=
float
.
Parse
(
CKVocAnalyzer
.
GlobalCKV
.
adjustTwo
[
index
].
CValue
.
ToString
(
"0.00"
));
}
else
{
f
[
0
]
=
0
;
}
}
Buffer
.
BlockCopy
(
l
,
0
,
s
,
0
,
4
);
Buffer
.
BlockCopy
(
f
,
2
,
s
,
0
,
2
);
Buffer
.
BlockCopy
(
f
,
0
,
s
,
2
,
2
);
value
=
s
[(
address
-
42
)
%
2
];
}
if
(
address
>=
48
&&
address
<
50
)
{
if
(
address
==
48
||
address
==
49
)
l
[
0
]
=
globaldata
.
m_hmibuffer
.
gcadjust
.
executefun
;
value
=
s
[(
address
-
40
)
%
2
];
Buffer
.
BlockCopy
(
l
,
2
,
s
,
0
,
2
);
Buffer
.
BlockCopy
(
l
,
0
,
s
,
2
,
2
);
value
=
s
[(
address
-
46
)
%
2
];
}
}
if
(
address
>=
50
&&
address
<
54
)
{
if
(
address
==
50
||
address
==
51
)
f
[
0
]
=
float
.
Parse
(
CKVocAnalyzer
.
GlobalCKV
.
n
ongdu
.
ToString
(
"0.000"
));
f
[
0
]
=
float
.
Parse
(
CKVocAnalyzer
.
GlobalCKV
.
n
mhcsavevale
.
biaozhun
.
ToString
(
"0.000"
));
if
(
address
==
52
||
address
==
53
)
{
//foreach (var item in CKVocAnalyzer.GlobalCKV.autoVlue)
//{
// if (item.name == "THC")
// {
// f[0] = float.Parse(item.biaozhun.ToString("0.000"));
// }
//}
f
[
0
]
=
0
;
int
tindex
=
CKVocAnalyzer
.
GlobalCKV
.
autoVlue
.
FindIndex
(
p
=>
p
.
name
==
"CH4"
);
f
[
0
]
=
float
.
Parse
(
CKVocAnalyzer
.
GlobalCKV
.
autoVlue
[
tindex
].
biaozhun
.
ToString
(
"0.000"
));
}
Buffer
.
BlockCopy
(
f
,
2
,
s
,
0
,
2
);
Buffer
.
BlockCopy
(
f
,
0
,
s
,
2
,
2
);
...
...
@@ -815,21 +927,23 @@ namespace GcDevicePc.Common
break
;
case
60
:
case
61
:
if
((
ushort
)
SharedSpace
.
Data
.
typesint
==
1
||
(
ushort
)
SharedSpace
.
Data
.
typesint
==
2
)
{
if
(
SharedSpace
.
MControl
.
dateend
!=
0
&&
SharedSpace
.
MControl
.
zhouqi
!=
0
)
{
l
[
0
]=
globaldata
.
m_hmibuffer
.
gcadjust
.
runtime
;
}
else
{
l
[
0
]
=
0
;
}
}
else
{
l
[
0
]
=
0
;
}
//if ((ushort)SharedSpace.Data.typesint == 1 || (ushort)SharedSpace.Data.typesint == 2)
//{
// if (SharedSpace.MControl.dateend != 0 && SharedSpace.MControl.zhouqi != 0)
// {
// l[0]= globaldata.m_hmibuffer.gcadjust.runtime;
// }
// else
// {
// l[0] = 0;
// }
//}
//else
//{
// l[0] = 0;
//}
l
[
0
]
=
CKVocAnalyzer
.
GlobalCKV
.
TimeCount
;
break
;
case
62
:
case
63
:
...
...
@@ -868,7 +982,8 @@ namespace GcDevicePc.Common
break
;
}
Buffer
.
BlockCopy
(
l
,
0
,
s
,
0
,
4
);
Buffer
.
BlockCopy
(
l
,
2
,
s
,
0
,
2
);
Buffer
.
BlockCopy
(
l
,
0
,
s
,
2
,
2
);
value
=
s
[(
address
-
54
)
%
2
];
...
...
@@ -932,32 +1047,17 @@ namespace GcDevicePc.Common
}
}
public
struct
state
{
public
ushort
blvalve
;
//标零阀开关
public
ushort
yblvalve
;
//样气阀标零阀切换
public
ushort
biaoling
;
//零/标
public
ushort
Sample_Adjust
;
//走气/校气
public
ushort
jzgz
;
//校准/跟踪
public
ushort
jzcl_stat
;
//校准状态/测量状态
public
ushort
normal_error
;
//正常/报警
public
ushort
Long_Short_range
;
//本地/遥控指示位
}
/// <summary>
/// 设置字节指定位置的值
/// </summary>
/// <param name="data">字节</param>
/// <param name="index">位置</param>
/// <param name="flag">值</param>
void
set_bit
(
ref
byte
data
,
int
index
,
bool
flag
)
{
if
(
index
>
8
||
index
<
1
)
throw
new
ArgumentOutOfRangeException
();
int
v
=
index
<
2
?
index
:
(
2
<<
(
index
-
2
));
data
=
flag
?
(
byte
)(
data
|
v
)
:
(
byte
)(
data
&
~
v
);
}
//public struct state
//{
// public ushort blvalve; //标零阀开关
// public ushort yblvalve; //样气阀标零阀切换
// public ushort biaoling; //零/标
// public ushort Sample_Adjust; //走气/校气
// public ushort jzgz; //校准/跟踪
// public ushort jzcl_stat; //校准状态/测量状态
// public ushort normal_error; //正常/报警
// public ushort Long_Short_range; //本地/遥控指示位
//}
private
static
float
ushortofloat
(
ushort
[]
us
)
{
...
...
GcDevicePc/ConfigMethod/MethodMain.cs
View file @
7b0a1056
...
...
@@ -434,8 +434,8 @@ namespace GcDevicePc.ConfigMethod
globaldata
.
m_configDlg
.
m_SignalDlg
.
reflashContent
();
}
SignalDataToHw
.
methodconfig
=
this
.
gcmethodconfig
;
//
SendDataToZB.methodconfig = this.gcmethodconfig;
//
SignalDataToHw.methodconfig = this.gcmethodconfig;
SendDataToZB
.
methodconfig
=
this
.
gcmethodconfig
;
//string message = "提交成功!";
//MessageBox.Show(message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
...
...
GcDevicePc/DataState.Designer.cs
View file @
7b0a1056
...
...
@@ -39,6 +39,7 @@
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
datalist
.
FullRowSelect
=
true
;
this
.
datalist
.
GridLines
=
true
;
this
.
datalist
.
HideSelection
=
false
;
this
.
datalist
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
datalist
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
datalist
.
Name
=
"datalist"
;
...
...
GcDevicePc/DataState.cs
View file @
7b0a1056
...
...
@@ -1072,6 +1072,7 @@ namespace GcDevicePc
this
.
datalist
.
Items
.
Add
(
tempshow
);
#
region
//tempshow = new ListViewItem();
//this.datalist.Items.Add(tempshow);
...
...
@@ -2163,6 +2164,41 @@ namespace GcDevicePc
GetSetValue
(
globaldata
.
m_dpbuffer
.
ShowList
.
showepc
.
EPC2_2_Set
));
this
.
datalist
.
Items
.
Add
(
tempshow
);
}
tempshow
.
SubItems
.
Add
(
""
);
this
.
datalist
.
Items
.
Add
(
tempshow
);
tempshow
=
new
ListViewItem
();
tempshow
.
Text
=
GettempName
(
"6路功率"
);
tempshow
.
Font
=
new
Font
(
tempshow
.
Font
,
tempshow
.
Font
.
Style
|
FontStyle
.
Bold
);
tempshow
.
SubItems
.
Add
(
""
);
this
.
datalist
.
Items
.
Add
(
tempshow
);
;
tempshow
=
new
ListViewItem
();
tempshow
.
Text
=
GettempName
(
"前检测器功率"
);
tempshow
.
SubItems
.
Add
(
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
fDPower
.
ToString
());
this
.
datalist
.
Items
.
Add
(
tempshow
);
tempshow
=
new
ListViewItem
();
tempshow
.
Text
=
GettempName
(
"中检测器功率"
);
tempshow
.
SubItems
.
Add
(
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
iDPower
.
ToString
());
this
.
datalist
.
Items
.
Add
(
tempshow
);
tempshow
=
new
ListViewItem
();
tempshow
.
Text
=
GettempName
(
"后检测器功率"
);
tempshow
.
SubItems
.
Add
(
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
bDPower
.
ToString
());
this
.
datalist
.
Items
.
Add
(
tempshow
);
tempshow
=
new
ListViewItem
();
tempshow
.
Text
=
GettempName
(
"前进样器功率"
);
tempshow
.
SubItems
.
Add
(
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
fSPower
.
ToString
());
this
.
datalist
.
Items
.
Add
(
tempshow
);
tempshow
=
new
ListViewItem
();
tempshow
.
Text
=
GettempName
(
"后进样器功率"
);
tempshow
.
SubItems
.
Add
(
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
bSPower
.
ToString
());
this
.
datalist
.
Items
.
Add
(
tempshow
);
tempshow
=
new
ListViewItem
();
tempshow
.
Text
=
GettempName
(
"柱箱功率"
);
tempshow
.
SubItems
.
Add
(
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
CbPower
.
ToString
());
this
.
datalist
.
Items
.
Add
(
tempshow
);
#
region
//if (CProfileDevice.m_DevParam.syspara.u16InjPortCtlMode_Behind == 3 &&
// CProfileDevice.m_DevParam.syspara.u16InjPortCtlMode_Front == 3)
...
...
GcDevicePc/FormUser.Designer.cs
View file @
7b0a1056
...
...
@@ -54,7 +54,7 @@
this
.
buttonauto
.
Name
=
"buttonauto"
;
this
.
buttonauto
.
Size
=
new
System
.
Drawing
.
Size
(
89
,
34
);
this
.
buttonauto
.
TabIndex
=
3
;
this
.
buttonauto
.
Text
=
"
自动
校准"
;
this
.
buttonauto
.
Text
=
"校准"
;
this
.
buttonauto
.
UseVisualStyleBackColor
=
true
;
this
.
buttonauto
.
Click
+=
new
System
.
EventHandler
(
this
.
buttonauto_Click
);
//
...
...
GcDevicePc/FormUser.cs
View file @
7b0a1056
...
...
@@ -60,7 +60,7 @@ namespace GcDevicePc
// MessageBox.Show("点火操作禁止,FID已经点火成功");
}
CKVocAnalyzer
.
AutoAdjust
auto
;
public
CKVocAnalyzer
.
AutoAdjust
auto
;
//自动校准
private
void
buttonauto_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -75,17 +75,28 @@ namespace GcDevicePc
if
(
auto
==
null
)
{
auto
=
new
CKVocAnalyzer
.
AutoAdjust
();
auto
.
Isadmin
=
false
;
auto
.
Show
();
}
else
if
(
auto
.
IsDisposed
)
{
auto
=
null
;
auto
=
new
CKVocAnalyzer
.
AutoAdjust
();
auto
.
Isadmin
=
false
;
auto
.
Show
();
}
else
{
auto
.
Activate
();
//auto.Activate();
if
(!
auto
.
Visible
)
{
auto
.
Isadmin
=
false
;
auto
.
Show
();
auto
.
IsinitShow
();
//auto.ShowKB();
}
}
//if (!globaldata.usable)//表示上位机处于运行状态下不可进行自动校准
...
...
GcDevicePc/GCBuffer/DPBuffer.cs
View file @
7b0a1056
...
...
@@ -165,6 +165,20 @@ namespace GcDevicePc.GCBuffer
public
ushort
bDetPol
;
}
public
struct
PwmInfo
{
public
int
fDPower
;
public
int
iDPower
;
public
int
bDPower
;
public
int
fSPower
;
public
int
bSPower
;
public
int
CbPower
;
}
public
struct
ShowInfo
{
public
TiemInfo
showtime
;
...
...
@@ -173,6 +187,7 @@ namespace GcDevicePc.GCBuffer
public
ISportInfo
showISport
;
public
DetInfo
showDet
;
public
EPCInfo
showepc
;
public
PwmInfo
pwmInfo
;
}
public
ShowInfo
ShowList
=
new
ShowInfo
();
...
...
@@ -289,6 +304,13 @@ namespace GcDevicePc.GCBuffer
this
.
ShowList
.
showDet
.
bDetSwitch
=
false
;
// this.ShowList.errorifo.ErrorStatus = new byte[9];
this
.
ShowList
.
pwmInfo
.
bDPower
=
0
;
this
.
ShowList
.
pwmInfo
.
fDPower
=
0
;
this
.
ShowList
.
pwmInfo
.
iDPower
=
0
;
this
.
ShowList
.
pwmInfo
.
bSPower
=
0
;
this
.
ShowList
.
pwmInfo
.
fDPower
=
0
;
this
.
ShowList
.
pwmInfo
.
CbPower
=
0
;
}
public
DPBuffer
()
...
...
GcDevicePc/GCBuffer/PCBuffer.cs
View file @
7b0a1056
...
...
@@ -44,6 +44,7 @@ namespace GcDevicePc.GCBuffer
public
ushort
work_Statue
;
//系统工作状态
public
ushort
RunType
;
//运行类型 0 打开运行 1 智能运行 2 批处理
public
bool
sendtohw
;
public
bool
sendtoZb
;
public
bool
info_log
;
public
bool
error_log
;
public
string
hmimac
;
...
...
@@ -78,11 +79,19 @@ namespace GcDevicePc.GCBuffer
public
ThreadInfo
pcthreadinfo
;
public
OutPutInfo
outputinfo
;
public
Adjust
adjust
;
}
public
PCInfo
gcpcinfo
=
new
PCInfo
();
public
struct
Adjust
{
public
int
AdjustType
;
public
int
AdjustOS
;
public
int
AdjustTime
;
}
public
PCBuffer
()
{
...
...
@@ -117,7 +126,9 @@ namespace GcDevicePc.GCBuffer
gcpcinfo
.
moduleinfo
.
ip
=
""
;
gcpcinfo
.
outputinfo
.
port
=
0
;
gcpcinfo
.
adjust
.
AdjustOS
=
0
;
gcpcinfo
.
adjust
.
AdjustType
=
0
;
gcpcinfo
.
adjust
.
AdjustTime
=
0
;
try
{
...
...
@@ -131,7 +142,8 @@ namespace GcDevicePc.GCBuffer
int
opensys
=
ini
.
ReadInteger
(
"StartUp"
,
"打开系统"
);
int
runtype
=
ini
.
ReadInteger
(
"StartUp"
,
"运行类型"
);
int
senddata
=
ini
.
ReadInteger
(
"StartUp"
,
"SendData"
);
int
senddatatohw
=
ini
.
ReadInteger
(
"StartUp"
,
"SendDataToHw"
);
int
senddatatozb
=
ini
.
ReadInteger
(
"StartUp"
,
"SendDataToZB"
);
gcpcinfo
.
pcfolderinfo
.
DataFolder
=
ini
.
ReadString
(
"DataFolder"
,
"历史数据"
);
gcpcinfo
.
pcworkinfo
.
hmimac
=
ini
.
ReadString
(
"NetWorkConfig"
,
"MAC地址"
);
...
...
@@ -145,13 +157,18 @@ namespace GcDevicePc.GCBuffer
gcpcinfo
.
pcworkinfo
.
RunType
=
0
;
}
if
(
senddata
==
1
)
if
(
senddata
tohw
==
1
)
{
gcpcinfo
.
pcworkinfo
.
sendtohw
=
true
;
}
else
if
(
senddatatozb
==
1
)
{
gcpcinfo
.
pcworkinfo
.
sendtoZb
=
true
;
}
else
{
gcpcinfo
.
pcworkinfo
.
sendtohw
=
false
;
gcpcinfo
.
pcworkinfo
.
sendtoZb
=
false
;
}
//INIOperation test = new INIOperation(file);
...
...
@@ -223,6 +240,7 @@ namespace GcDevicePc.GCBuffer
{
gcpcinfo
.
pcworkinfo
.
RunType
=
0
;
gcpcinfo
.
pcworkinfo
.
sendtohw
=
false
;
gcpcinfo
.
pcworkinfo
.
sendtoZb
=
false
;
gcpcinfo
.
pcfolderinfo
.
DataFolder
=
null
;
}
}
...
...
GcDevicePc/MDIBase.Designer.cs
View file @
7b0a1056
...
...
@@ -39,6 +39,7 @@
this
.
SystemStopMenu
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
AuxToolMenu
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
ParameterSettingMenu
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
自动校准
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
SettingMainMenu
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
NetWorkMenu
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
MethodBatMenu
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
...
...
@@ -56,9 +57,11 @@
this
.
SingleStart
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
SingleStop
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
SingleCancel
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
testToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
HelpMainMenu
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
AboutMenu
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
changeVsi
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
单位换算
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
toolTip
=
new
System
.
Windows
.
Forms
.
ToolTip
(
this
.
components
);
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
backgroundWorker1
=
new
System
.
ComponentModel
.
BackgroundWorker
();
...
...
@@ -71,8 +74,6 @@
this
.
AdjustStat
=
new
System
.
Windows
.
Forms
.
ToolStripStatusLabel
();
this
.
workProgress
=
new
System
.
Windows
.
Forms
.
ToolStripProgressBar
();
this
.
timer2
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
单位换算
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
自动校准
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
menuStrip
.
SuspendLayout
();
this
.
statusStrip
.
SuspendLayout
();
this
.
SuspendLayout
();
...
...
@@ -133,31 +134,38 @@
// SystemStartMenu
//
this
.
SystemStartMenu
.
Name
=
"SystemStartMenu"
;
this
.
SystemStartMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
SystemStartMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
SystemStartMenu
.
Text
=
"系统开启"
;
this
.
SystemStartMenu
.
Click
+=
new
System
.
EventHandler
(
this
.
SystemStartMenu_Click
);
//
// SystemStopMenu
//
this
.
SystemStopMenu
.
Name
=
"SystemStopMenu"
;
this
.
SystemStopMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
SystemStopMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
SystemStopMenu
.
Text
=
"系统关闭"
;
this
.
SystemStopMenu
.
Click
+=
new
System
.
EventHandler
(
this
.
SystemStopMenu_Click
);
//
// AuxToolMenu
//
this
.
AuxToolMenu
.
Name
=
"AuxToolMenu"
;
this
.
AuxToolMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
AuxToolMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
AuxToolMenu
.
Text
=
"辅助工具"
;
this
.
AuxToolMenu
.
Click
+=
new
System
.
EventHandler
(
this
.
AuxToolMenu_Click
);
//
// ParameterSettingMenu
//
this
.
ParameterSettingMenu
.
Name
=
"ParameterSettingMenu"
;
this
.
ParameterSettingMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
ParameterSettingMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
ParameterSettingMenu
.
Text
=
"参数设置"
;
this
.
ParameterSettingMenu
.
Click
+=
new
System
.
EventHandler
(
this
.
ParameterSettingMenu_Click
);
//
// 自动校准ToolStripMenuItem
//
this
.
自动校准
ToolStripMenuItem
.
Name
=
"自动校准ToolStripMenuItem"
;
this
.
自动校准
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
144
,
26
);
this
.
自动校准
ToolStripMenuItem
.
Text
=
"系统校准"
;
this
.
自动校准
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
自动校准
ToolStripMenuItem_Click
);
//
// SettingMainMenu
//
this
.
SettingMainMenu
.
DropDownItems
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[]
{
...
...
@@ -176,47 +184,47 @@
// NetWorkMenu
//
this
.
NetWorkMenu
.
Name
=
"NetWorkMenu"
;
this
.
NetWorkMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
NetWorkMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
76
,
26
);
this
.
NetWorkMenu
.
Text
=
"通讯设置"
;
this
.
NetWorkMenu
.
Click
+=
new
System
.
EventHandler
(
this
.
NetWorkMenu_Click
);
//
// MethodBatMenu
//
this
.
MethodBatMenu
.
Name
=
"MethodBatMenu"
;
this
.
MethodBatMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
MethodBatMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
76
,
26
);
this
.
MethodBatMenu
.
Text
=
"方法批处理"
;
this
.
MethodBatMenu
.
Click
+=
new
System
.
EventHandler
(
this
.
MethodBatMenu_Click
);
//
// NewMethodMenu
//
this
.
NewMethodMenu
.
Name
=
"NewMethodMenu"
;
this
.
NewMethodMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
NewMethodMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
76
,
26
);
this
.
NewMethodMenu
.
Text
=
"新建方法"
;
this
.
NewMethodMenu
.
Click
+=
new
System
.
EventHandler
(
this
.
NewMethodMenu_Click
);
//
// OpenMethodMenu
//
this
.
OpenMethodMenu
.
Name
=
"OpenMethodMenu"
;
this
.
OpenMethodMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
OpenMethodMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
76
,
26
);
this
.
OpenMethodMenu
.
Text
=
"打开方法文件"
;
this
.
OpenMethodMenu
.
Click
+=
new
System
.
EventHandler
(
this
.
OpenMethodMenu_Click
);
//
// MethodBrowseMenuItem
//
this
.
MethodBrowseMenuItem
.
Name
=
"MethodBrowseMenuItem"
;
this
.
MethodBrowseMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
MethodBrowseMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
76
,
26
);
this
.
MethodBrowseMenuItem
.
Text
=
"方法查阅"
;
this
.
MethodBrowseMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
MethodBrowseMenuItem_Click
);
//
// SettingSeparator
//
this
.
SettingSeparator
.
Name
=
"SettingSeparator"
;
this
.
SettingSeparator
.
Size
=
new
System
.
Drawing
.
Size
(
17
7
,
6
);
this
.
SettingSeparator
.
Size
=
new
System
.
Drawing
.
Size
(
17
3
,
6
);
//
// GCConfigMenuItem
//
this
.
GCConfigMenuItem
.
Name
=
"GCConfigMenuItem"
;
this
.
GCConfigMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
GCConfigMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
76
,
26
);
this
.
GCConfigMenuItem
.
Text
=
"仪器配置"
;
this
.
GCConfigMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
ConfigCreateSubMenuItem_Click
);
//
...
...
@@ -255,7 +263,8 @@
// DebugMainMenu
//
this
.
DebugMainMenu
.
DropDownItems
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[]
{
this
.
SingleControlMenu
});
this
.
SingleControlMenu
,
this
.
testToolStripMenuItem
});
this
.
DebugMainMenu
.
Font
=
new
System
.
Drawing
.
Font
(
"Microsoft YaHei UI"
,
12F
);
this
.
DebugMainMenu
.
Name
=
"DebugMainMenu"
;
this
.
DebugMainMenu
.
Size
=
new
System
.
Drawing
.
Size
(
54
,
25
);
...
...
@@ -268,7 +277,7 @@
this
.
SingleStop
,
this
.
SingleCancel
});
this
.
SingleControlMenu
.
Name
=
"SingleControlMenu"
;
this
.
SingleControlMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
SingleControlMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
76
,
26
);
this
.
SingleControlMenu
.
Text
=
"单次流程控制"
;
//
// SingleStart
...
...
@@ -292,6 +301,14 @@
this
.
SingleCancel
.
Text
=
"取消"
;
this
.
SingleCancel
.
Click
+=
new
System
.
EventHandler
(
this
.
SingleCancel_Click
);
//
// testToolStripMenuItem
//
this
.
testToolStripMenuItem
.
Name
=
"testToolStripMenuItem"
;
this
.
testToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
176
,
26
);
this
.
testToolStripMenuItem
.
Text
=
"test"
;
this
.
testToolStripMenuItem
.
Visible
=
false
;
this
.
testToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
TestToolStripMenuItem_Click
);
//
// HelpMainMenu
//
this
.
HelpMainMenu
.
DropDownItems
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[]
{
...
...
@@ -306,17 +323,25 @@
// AboutMenu
//
this
.
AboutMenu
.
Name
=
"AboutMenu"
;
this
.
AboutMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
AboutMenu
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
AboutMenu
.
Text
=
"关于"
;
this
.
AboutMenu
.
Click
+=
new
System
.
EventHandler
(
this
.
AboutMenu_Click
);
//
// changeVsi
//
this
.
changeVsi
.
Name
=
"changeVsi"
;
this
.
changeVsi
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
changeVsi
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
changeVsi
.
Text
=
"切换版本"
;
this
.
changeVsi
.
Visible
=
false
;
this
.
changeVsi
.
Click
+=
new
System
.
EventHandler
(
this
.
changeVsi_Click
);
//
// 单位换算ToolStripMenuItem
//
this
.
单位换算
ToolStripMenuItem
.
Name
=
"单位换算ToolStripMenuItem"
;
this
.
单位换算
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
144
,
26
);
this
.
单位换算
ToolStripMenuItem
.
Text
=
"单位换算"
;
this
.
单位换算
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
单位换算
ToolStripMenuItem_Click
);
//
// timer1
//
this
.
timer1
.
Enabled
=
true
;
...
...
@@ -412,20 +437,6 @@
this
.
timer2
.
Interval
=
1000
;
this
.
timer2
.
Tick
+=
new
System
.
EventHandler
(
this
.
timer2_Tick
);
//
// 单位换算ToolStripMenuItem
//
this
.
单位换算
ToolStripMenuItem
.
Name
=
"单位换算ToolStripMenuItem"
;
this
.
单位换算
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
180
,
26
);
this
.
单位换算
ToolStripMenuItem
.
Text
=
"单位换算"
;
this
.
单位换算
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
单位换算
ToolStripMenuItem_Click
);
//
// 自动校准ToolStripMenuItem
//
this
.
自动校准
ToolStripMenuItem
.
Name
=
"自动校准ToolStripMenuItem"
;
this
.
自动校准
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
180
,
26
);
this
.
自动校准
ToolStripMenuItem
.
Text
=
"自动校准"
;
this
.
自动校准
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
自动校准
ToolStripMenuItem_Click
);
//
// MDIBase
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
...
...
@@ -495,6 +506,7 @@
private
System
.
Windows
.
Forms
.
ToolStripStatusLabel
AdjustStat
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
单位换算
ToolStripMenuItem
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
自动校准
ToolStripMenuItem
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
testToolStripMenuItem
;
}
}
...
...
GcDevicePc/MDIBase.cs
View file @
7b0a1056
...
...
@@ -85,7 +85,7 @@ namespace GcDevicePc
private
DataOutput
wtd624xOutput
=
new
DataOutput
();
private
SignalDataToHw
signalDataTohw
=
new
SignalDataToHw
();
//
private SendDataToZB signalDataTozb = new SendDataToZB();
private
SendDataToZB
signalDataTozb
=
new
SendDataToZB
();
#
endregion
#
region
Author
by
zjx
...
...
@@ -326,6 +326,10 @@ namespace GcDevicePc
if
(
globaldata
.
CurrentVersion
==
"1"
)
{
_userForm
.
Show
();
_userForm
.
auto
=
new
CKVocAnalyzer
.
AutoAdjust
();
_userForm
.
auto
.
Show
();
_userForm
.
auto
.
Hide
();
}
_EPCTipsForm
=
new
EPCTips
();
...
...
@@ -773,7 +777,7 @@ namespace GcDevicePc
/// 1.0.2.3 添加了周期完成后,重新绘图功能
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
this
.
Text
=
String
.
Format
(
"
Tetchrom色谱工作站-1.5.6
{0}"
,
Formstr
);
this
.
Text
=
String
.
Format
(
"
Vocs色谱工作站-1.5.7
{0}"
,
Formstr
);
//if (LandIn.Island)
//{
// HmiStatus.Text = String.Format("状态:{0}", statestr);
...
...
@@ -801,36 +805,18 @@ namespace GcDevicePc
//Console.WriteLine(t2.ToString());
//下方状态显示
if
(
CKVocAnalyzer
.
GlobalCKV
.
FarNear
==
0
)
{
switch
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
)
{
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Zero
:
AdjustStat
.
Text
=
"近端校零"
;
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Biao
:
AdjustStat
.
Text
=
"近端校标"
;
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
:
AdjustStat
.
Text
=
"走样"
;
break
;
}
}
else
{
switch
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
)
{
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Zero
:
AdjustStat
.
Text
=
"远端校零
"
;
AdjustStat
.
Text
=
"校零中
"
;
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Biao
:
AdjustStat
.
Text
=
"远端校标
"
;
AdjustStat
.
Text
=
"校标中
"
;
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
:
AdjustStat
.
Text
=
"走样
"
;
AdjustStat
.
Text
=
"走样中
"
;
break
;
}
}
//监视界面活动
if
(
getIdleTick
()>
60
*
30
&&
LandIn
.
Island
)
...
...
@@ -1264,10 +1250,16 @@ namespace GcDevicePc
if
(
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcworkinfo
.
sendtohw
)
{
signalDataTohw
.
DataToHwStart
();
//signalDataTozb.DataToZBStart();
//signalDataTohw.DataToHwStart();
signalDataTozb
.
DataToZBStart
();
}
if
(
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcworkinfo
.
sendtoZb
)
{
//signalDataTohw.DataToHwStart();
signalDataTozb
.
DataToZBStart
();
}
try
{
if
(
globaldata
.
CurrentVersion
==
"1"
)
...
...
@@ -2233,9 +2225,11 @@ namespace GcDevicePc
{
hmiopt
.
AdjustSwitch
(
val
);
}
public
bool
Isadmin
=
false
;
private
void
UserLoginMenu_Click
(
object
sender
,
EventArgs
e
)
{
string
lgpwd
=
DateTime
.
Now
.
ToString
(
"HHmm"
)
;
string
lgpwd
=
"666666"
;
while
(
true
)
{
DialogResult
dr
=
new
LandIn
(
"admin"
,
lgpwd
).
ShowDialog
();
...
...
@@ -2250,12 +2244,14 @@ namespace GcDevicePc
_debugForm
.
Activate
();
title
.
Activate
();
}
Isadmin
=
true
;
SetMenu
(
LandIn
.
Island
);
Trace
.
WriteLine
(
string
.
Format
(
"用户{0},进入调试模式"
,
"admin"
),
"sys"
);
return
;
}
else
{
Isadmin
=
false
;
MessageBox
.
Show
(
"密码错误!"
);
}
}
...
...
@@ -2280,6 +2276,7 @@ namespace GcDevicePc
//userForm.Show();
Trace
.
WriteLine
(
"注销登录,进入用户模式"
,
"sys"
);
}
Isadmin
=
false
;
LandIn
.
Island
=
false
;
SetMenu
(
LandIn
.
Island
);
...
...
@@ -2829,13 +2826,28 @@ namespace GcDevicePc
Log
.
Error
(
ex
.
Message
);
}
}
CKVocAnalyzer
.
SetInfoForm
sf
;
private
void
ParameterSettingMenu_Click
(
object
sender
,
EventArgs
e
)
{
try
{
CKVocAnalyzer
.
SetInfoForm
sf
=
new
CKVocAnalyzer
.
SetInfoForm
();
if
(
showConfig
==
null
)
{
sf
=
new
CKVocAnalyzer
.
SetInfoForm
();
sf
.
Show
();
}
else
if
(
showConfig
.
IsDisposed
)
{
sf
=
null
;
sf
=
new
CKVocAnalyzer
.
SetInfoForm
();
sf
.
Show
();
}
else
{
sf
.
Activate
();
}
}
catch
(
Exception
ex
)
...
...
@@ -3048,6 +3060,7 @@ namespace GcDevicePc
/// </summary>
DateTime
AutoAdjust
;
bool
cancv
=
false
;
private
void
timerWorker_Tick
(
object
sender
,
EventArgs
e
)
{
try
...
...
@@ -3067,21 +3080,21 @@ namespace GcDevicePc
SharedSpace
.
MControl
.
SetRun
=
true
;
//仪器进入校准环境
CurveDisPlay
.
forcePurge
=
true
;
//强制清除数据
AutoAdjust
=
DateTime
.
Now
.
AddSeconds
(
SharedSpace
.
MControl
.
dateend
);
switch
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
)
{
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Zero
:
hmiopt
.
Adjust_ling_biao
(
0
,
(
ushort
)
65280
);
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Biao
:
hmiopt
.
Adjust_ling_biao
(
1
,
(
ushort
)
65280
);
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
:
hmiopt
.
Adjust_ling_biao
(
0
,
0
);
break
;
default
:
break
;
}
cancv
=
true
;
//
switch (CKVocAnalyzer.GlobalCKV.adjustType)
//
{
//
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
//
hmiopt.Adjust_ling_biao(0, (ushort)65280);
//
break;
//
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
//
hmiopt.Adjust_ling_biao(1, (ushort)65280);
//
break;
//
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
//
hmiopt.Adjust_ling_biao(0, 0);
//
break;
//
default:
//
break;
//
}
}
if
(
SharedSpace
.
MControl
.
MethodType
==
2
)
{
...
...
@@ -3089,21 +3102,8 @@ namespace GcDevicePc
SharedSpace
.
MControl
.
SetRun
=
true
;
//仪器进入校准环境
CurveDisPlay
.
forcePurge
=
true
;
AutoAdjust
=
DateTime
.
Now
.
AddSeconds
(
SharedSpace
.
MControl
.
dateend
);
cancv
=
true
;
switch
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
)
{
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Zero
:
hmiopt
.
Adjust_ling_biao
(
0
,
(
ushort
)
65280
);
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Biao
:
hmiopt
.
Adjust_ling_biao
(
1
,
(
ushort
)
65280
);
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
:
hmiopt
.
Adjust_ling_biao
(
0
,
0
);
break
;
default
:
break
;
}
}
...
...
@@ -3135,11 +3135,11 @@ namespace GcDevicePc
{
CurveDisPlay
.
curdisp
.
ConfingAdjust
();
}
if
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
==
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
)
{
hmiopt
.
Adjust_ling_biao
(
0
,
0
);
}
cancv
=
true
;
//
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
//
{
//
hmiopt.Adjust_ling_biao(0, 0);
//
}
Trace
.
WriteLine
(
"校准结束"
,
"sys"
);
}
if
(
SharedSpace
.
MControl
.
MethodType
==
2
)
...
...
@@ -3150,11 +3150,11 @@ namespace GcDevicePc
{
CurveDisPlay
.
curdisp
.
ConfingAdjust
();
}
if
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
==
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
)
{
hmiopt
.
Adjust_ling_biao
(
0
,
0
);
}
cancv
=
true
;
//
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
//
{
//
hmiopt.Adjust_ling_biao(0, 0);
//
}
Trace
.
WriteLine
(
"校准结束"
,
"sys"
);
}
...
...
@@ -3169,28 +3169,47 @@ namespace GcDevicePc
SharedSpace
.
MControl
.
SetOut
=
false
;
SharedSpace
.
MControl
.
SetRun
=
false
;
SharedSpace
.
Data
.
typesint
=
0
;
Trace
.
WriteLine
(
"强制校准结束"
,
"sys"
)
;
cancv
=
true
;
if
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
==
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
)
{
hmiopt
.
Adjust_ling_biao
(
0
,
0
);
}
Trace
.
WriteLine
(
"强制校准结束"
,
"sys"
);
//if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
//{
// hmiopt.Adjust_ling_biao(0, 0);
//}
}
if
(
SharedSpace
.
MControl
.
MethodType
==
2
)
{
SharedSpace
.
MControl
.
SetOut
=
false
;
SharedSpace
.
MControl
.
SetRun
=
false
;
SharedSpace
.
Data
.
typesint
=
0
;
Trace
.
WriteLine
(
"强制校准结束"
,
"sys"
)
;
cancv
=
true
;
if
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
==
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
)
{
hmiopt
.
Adjust_ling_biao
(
0
,
0
);
Trace
.
WriteLine
(
"强制校准结束"
,
"sys"
);
//if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
//{
// hmiopt.Adjust_ling_biao(0, 0);
//}
}
}
if
(
cancv
)
{
switch
(
CKVocAnalyzer
.
GlobalCKV
.
adjustType
)
{
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Zero
:
cancv
=
!
hmiopt
.
Adjust_ling_biao
(
0
,
(
ushort
)
65280
);
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Biao
:
cancv
=
!
hmiopt
.
Adjust_ling_biao
(
1
,
(
ushort
)
65280
);
break
;
case
CKVocAnalyzer
.
GlobalCKV
.
AdjustType
.
AT_Yang
:
cancv
=
!
hmiopt
.
Adjust_ling_biao
(
0
,
0
);
break
;
default
:
break
;
}
}
globaldata
.
m_hmibuffer
.
gcadjust
.
runtime
=
(
long
)(
AutoAdjust
-
DateTime
.
Now
).
TotalSeconds
<
0
?
0
:
(
long
)(
AutoAdjust
-
DateTime
.
Now
).
TotalSeconds
;
}
catch
(
Exception
ex
)
...
...
@@ -3202,6 +3221,8 @@ namespace GcDevicePc
}
private
int
epct
;
private
bool
epcs
;
private
Process
[]
MyProcesses
;
private
bool
Zbexe
=
false
;
private
void
timer2_Tick
(
object
sender
,
EventArgs
e
)
{
epct
++;
...
...
@@ -3221,9 +3242,28 @@ namespace GcDevicePc
tips_Show
(
globaldata
.
m_hmibuffer
.
gcinfo
.
EPCStatus
);
}
}
if
(!
Zbexe
)
{
MyProcesses
=
Process
.
GetProcessesByName
(
"通用5.2"
);
//需要监控的程序名,该方法带出该程序所有用到的进程
foreach
(
Process
myprocess
in
MyProcesses
)
{
//textBox1.Text += myprocess.ProcessName + "\r\n";
if
(
myprocess
.
ProcessName
.
ToLower
()
==
"通用5.2"
)
{
Zbexe
=
true
;
//MessageBox.Show("通用5.2");
myprocess
.
EnableRaisingEvents
=
true
;
//设置进程终止时触发的时间
myprocess
.
Exited
+=
new
EventHandler
(
myprocess_Exited
);
//发现外部程序关闭即触发方法myprocess_Exited
}
}
}
}
private
void
myprocess_Exited
(
object
sender
,
EventArgs
e
)
//被触发的程序
{
Zbexe
=
false
;
MessageBox
.
Show
(
"后处理软件已退出,请重启本软件和后处理软件"
);
}
private
void
changeVsi_Click
(
object
sender
,
EventArgs
e
)
{
DialogResult
dl
=
MessageBox
.
Show
(
"是否切换"
,
"版本切换"
,
MessageBoxButtons
.
OKCancel
);
...
...
@@ -3267,26 +3307,43 @@ namespace GcDevicePc
ft
.
Activate
();
}
}
CKVocAnalyzer
.
AutoAdjust
auto
;
//
CKVocAnalyzer.AutoAdjust auto;
private
void
自动校准
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
if
(
auto
==
null
)
if
(
_userForm
.
auto
==
null
)
{
auto
=
new
CKVocAnalyzer
.
AutoAdjust
();
auto
.
Show
();
_userForm
.
auto
=
new
CKVocAnalyzer
.
AutoAdjust
();
//_userForm.auto
_userForm
.
auto
.
Isadmin
=
Isadmin
;
_userForm
.
auto
.
Show
();
}
else
if
(
auto
.
IsDisposed
)
else
if
(
_userForm
.
auto
.
IsDisposed
)
{
auto
=
null
;
auto
=
new
CKVocAnalyzer
.
AutoAdjust
();
auto
.
Show
();
_userForm
.
auto
=
null
;
_userForm
.
auto
=
new
CKVocAnalyzer
.
AutoAdjust
();
_userForm
.
auto
.
Isadmin
=
Isadmin
;
_userForm
.
auto
.
Show
();
}
else
{
auto
.
Activate
();
if
(!
_userForm
.
auto
.
Visible
)
{
_userForm
.
auto
.
Isadmin
=
Isadmin
;
_userForm
.
auto
.
Show
();
_userForm
.
auto
.
IsinitShow
();
//_userForm.auto.ShowKB();
}
}
}
private
void
TestToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
CKVocAnalyzer
.
testsjshow
testsjshow
=
new
CKVocAnalyzer
.
testsjshow
();
testsjshow
.
Show
();
}
//private void debugSubMenu_Click(object sender, EventArgs e)
//{
// try
...
...
GcDevicePc/ProThread/GcDataTh.cs
View file @
7b0a1056
...
...
@@ -247,6 +247,17 @@ namespace GcDevicePc.ProThread
globaldata
.
channelB_A
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
}
}
else
if
(
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcworkinfo
.
sendtoZb
)
{
lock
(
globaldata
.
channelA_A
)
{
globaldata
.
channelA_A
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
}
lock
(
globaldata
.
channelB_A
)
{
globaldata
.
channelB_A
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
}
}
}
}
}
...
...
@@ -306,6 +317,18 @@ namespace GcDevicePc.ProThread
globaldata
.
channelA_B
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
}
lock
(
globaldata
.
channelB_B
)
{
globaldata
.
channelB_B
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
}
}
else
if
(
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcworkinfo
.
sendtoZb
)
{
lock
(
globaldata
.
channelA_B
)
{
globaldata
.
channelA_B
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
}
lock
(
globaldata
.
channelB_B
)
{
globaldata
.
channelB_B
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
...
...
@@ -374,6 +397,17 @@ namespace GcDevicePc.ProThread
globaldata
.
channelB_C
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
}
}
else
if
(
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcworkinfo
.
sendtoZb
)
{
lock
(
globaldata
.
channelA_C
)
{
globaldata
.
channelA_C
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
}
lock
(
globaldata
.
channelB_C
)
{
globaldata
.
channelB_C
.
Add
((
long
)(
fidv
[
i
]
*
1000000
));
}
}
}
}
}
...
...
@@ -729,6 +763,7 @@ namespace GcDevicePc.ProThread
ushort
[]
firestatus
=
new
ushort
[
4
]
{
0
,
0
,
0
,
0
};
ushort
[]
dacstatus
=
new
ushort
[
6
]
{
0
,
0
,
0
,
0
,
0
,
0
};
ushort
[]
hmiabnormal
=
new
ushort
[
3
];
ushort
[]
hmipower
=
new
ushort
[
6
]
{
0
,
0
,
0
,
0
,
0
,
0
};
//ushort[] epcdata = new ushort[36];
ushort
[]
epc1
=
new
ushort
[
6
];
...
...
@@ -974,6 +1009,48 @@ namespace GcDevicePc.ProThread
{
globaldata
.
m_hmibuffer
.
gcinfo
.
HmiAbnormal
=
hmiabnormal
;
}
if
(
GetHmiPower
(
ref
hmipower
)
==
0
)
{
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
fDPower
=
hmipower
[
0
];
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
iDPower
=
hmipower
[
1
];
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
bDPower
=
hmipower
[
2
];
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
fSPower
=
hmipower
[
3
];
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
fSPower
=
hmipower
[
4
];
globaldata
.
m_dpbuffer
.
ShowList
.
pwmInfo
.
CbPower
=
hmipower
[
5
];
}
}
private
int
GetHmiPower
(
ref
ushort
[]
hmipower
)
{
int
ret
=
-
1
;
try
{
ret
=
GetHmiPowerHoldingReg
(
1151
,
6
,
ref
hmipower
);
}
catch
(
Exception
e
)
{
Log
.
Error
(
e
.
Message
);
}
return
ret
;
}
private
int
GetHmiPowerHoldingReg
(
ushort
address
,
ushort
num
,
ref
ushort
[]
state
)
{
int
ret
=
-
1
;
int
count
=
0
;
if
(
setflag
)
{
ret
=
globaldata
.
global_moudbus
.
ReadHoldingReg
(
address
,
num
,
this
.
strIP
,
netPost
,
ref
state
);
while
(
ret
!=
0
)
{
count
++;
if
(
count
>
3
)
break
;
ret
=
globaldata
.
global_moudbus
.
ReadHoldingReg
(
address
,
num
,
this
.
strIP
,
netPost
,
ref
state
);
}
}
return
ret
;
}
...
...
GcDevicePc/ProThread/HMIControl.cs
View file @
7b0a1056
...
...
@@ -331,10 +331,10 @@ namespace GcDevicePc.ProThread
}
public
void
Adjust_ling_biao
(
int
type
,
ushort
oc
)
public
bool
Adjust_ling_biao
(
int
type
,
ushort
oc
)
{
int
lret
;
int
bret
;
int
lret
=
0
;
int
bret
=
0
;
int
count
=
0
;
if
(
type
==
0
)
{
...
...
@@ -380,6 +380,16 @@ namespace GcDevicePc.ProThread
break
;
}
}
if
(
lret
==
0
&&
bret
==
0
)
{
return
true
;
}
else
{
return
false
;
}
}
...
...
GcDevicePc/ProThread/SendDataToZB.cs
View file @
7b0a1056
...
...
@@ -27,7 +27,8 @@ namespace GcDevicePc.ProThread
{
GcSendDataToZb
(
1
,
0
,
1
);
GcSendDataToZb
(
0
,
1
,
1
);
//GcSendDataToZb(0, 1, 3);
//GcSendDataToZb(1, 0, 3);
//GcSendDataToZb(1, 1, 1);
}
...
...
@@ -36,29 +37,89 @@ namespace GcDevicePc.ProThread
{
GcSendDataToZb
(
1
,
0
,
2
);
GcSendDataToZb
(
0
,
1
,
2
);
//GcSendDataToZb(0, 1, 4);
//GcSendDataToZb(1, 0, 4);
//GcSendDataToZb(1, 1, 2);
}
private
void
SendDataToZB_A
(
Int32
data
)
{
GcSendDataToZb
(
data
,
0
,
3
);
GcSendDataToZb
(
0
,
0
,
4
);
//GcSendDataToZb(data, 0, 3);
//GcSendDataToZb(0, 0, 4);
GcSendDataToZb
(
1
,
0
,
1
);
GcSendDataToZb
(
0
,
1
,
2
);
}
private
void
SendDataToZB_B
(
Int32
data
)
{
GcSendDataToZb
(
0
,
data
,
4
);
GcSendDataToZb
(
0
,
0
,
3
);
GcSendDataToZb
(
0
,
1
,
1
);
GcSendDataToZb
(
1
,
0
,
2
);
}
private
void
SendDataToZB_AB
(
Int32
dataA
,
Int32
dataB
)
{
//GcSendDataToZb(1, 1, 1);
//double bz = 8388608 / 1120400;
//int da = dataA * 0.298;//8388608 = 2^23
//int db = dataB * 0.298;
int
da
=
Convert
.
ToInt32
(
dataA
);
int
db
=
Convert
.
ToInt32
(
dataB
);
GcSendDataToZb
(
da
,
db
,
0
);
//GcSendDataToZb(10, 20, 0);
}
public
void
testzb
(
Int32
dataA
,
Int32
dataB
)
{
//GcSendDataToZb(1, 1, 1);
GcSendDataToZb
(
dataA
,
dataB
,
0
);
//GcSendDataToZb(dataA, dataB, 0);
GcSendDataToZb
(
10
,
20
,
0
);
//GcSendDataToZb(10, 20, 0);
}
public
void
testzba
()
{
//GcSendDataToZb(1, 1, 1);
GcSendDataToZb
(
1
,
0
,
1
);
GcSendDataToZb
(
1
,
0
,
3
);
GcSendDataToZb
(
0
,
1
,
2
);
GcSendDataToZb
(
0
,
1
,
4
);
//GcSendDataToZb(10, 20, 0);
}
public
void
testzbb
()
{
//GcSendDataToZb(1, 1, 1);
GcSendDataToZb
(
0
,
1
,
1
);
GcSendDataToZb
(
1
,
0
,
2
);
//GcSendDataToZb(0, 1, 3);
//GcSendDataToZb(1, 0, 4);
//GcSendDataToZb(10, 20, 0);
}
public
void
testzbb
(
int
a
,
int
b
,
int
c
)
{
//GcSendDataToZb(1, 1, 1);
GcSendDataToZb
(
a
,
b
,
c
);
//GcSendDataToZb(0, 1, 3);
//GcSendDataToZb(1, 0, 4);
//GcSendDataToZb(10, 20, 0);
}
#
endregion
...
...
@@ -123,7 +184,8 @@ namespace GcDevicePc.ProThread
int
i
=
0
;
for
(
i
=
0
;
i
<
5
;
i
++)
{
try
{
switch
(
methodconfig
.
signal
.
uDetA
[
0
])
{
case
1
:
...
...
@@ -173,24 +235,29 @@ namespace GcDevicePc.ProThread
}
break
;
}
if
(
methodconfig
.
signal
.
u16ChannelA
==
1
&&
methodconfig
.
signal
.
u16ChannelB
==
1
)
{
SendDataToZB_AB
(
mydataA
,
mydataB
);
Thread
.
Sleep
(
50
);
}
//写入A
if
(
methodconfig
.
signal
.
u16ChannelA
==
1
&&
methodconfig
.
signal
.
u16ChannelB
!=
1
)
catch
{
SendDataToZB_A
(
mydataA
);
Thread
.
Sleep
(
50
);
}
//写入B
if
(
methodconfig
.
signal
.
u16ChannelA
!=
1
&&
methodconfig
.
signal
.
u16ChannelB
==
1
)
////写入A
//if (methodconfig.signal.u16ChannelA == 1 && methodconfig.signal.u16ChannelB != 1)
//{
// SendDataToZB_A(mydataA);
// Thread.Sleep(50);
//}
////写入B
//if (methodconfig.signal.u16ChannelA != 1 && methodconfig.signal.u16ChannelB == 1)
//{
// SendDataToZB_B(mydataB);
// Thread.Sleep(50);
//}
if
(
methodconfig
.
signal
.
u16ChannelA
==
1
||
methodconfig
.
signal
.
u16ChannelB
==
1
)
{
SendDataToZB_
B
(
mydataB
);
SendDataToZB_
AB
(
mydataA
,
mydataB
);
Thread
.
Sleep
(
50
);
}
}
...
...
@@ -255,23 +322,25 @@ namespace GcDevicePc.ProThread
break
;
}
if
(
methodconfig
.
signal
.
u16ChannelA
==
1
&&
methodconfig
.
signal
.
u16ChannelB
==
1
)
{
SendDataToZB_AB
(
mydataA
,
mydataB
);
Thread
.
Sleep
(
50
);
}
//写入A
if
(
methodconfig
.
signal
.
u16ChannelA
==
1
&&
methodconfig
.
signal
.
u16ChannelB
!=
1
)
{
SendDataToZB_A
(
mydataA
);
Thread
.
Sleep
(
50
);
}
//写入B
if
(
methodconfig
.
signal
.
u16ChannelA
!=
1
&&
methodconfig
.
signal
.
u16ChannelB
==
1
)
////写入A
//if (methodconfig.signal.u16ChannelA == 1 && methodconfig.signal.u16ChannelB != 1)
//{
// SendDataToZB_A(mydataA);
// Thread.Sleep(50);
//}
////写入B
//if (methodconfig.signal.u16ChannelA != 1 && methodconfig.signal.u16ChannelB == 1)
//{
// SendDataToZB_B(mydataB);
// Thread.Sleep(50);
//}
if
(
methodconfig
.
signal
.
u16ChannelA
==
1
||
methodconfig
.
signal
.
u16ChannelB
==
1
)
{
SendDataToZB_
B
(
mydataB
);
SendDataToZB_
AB
(
mydataA
,
mydataB
);
Thread
.
Sleep
(
50
);
}
}
...
...
@@ -352,6 +421,9 @@ namespace GcDevicePc.ProThread
tsB
=
StartTimeB
.
Subtract
(
EndTimeB
).
Duration
();
secB
=
(
int
)
tsB
.
TotalSeconds
;
try
{
if
(
StepA
<
SendNumA
)
{
if
(
secA
<=
methodconfig
.
signal
.
u16DetTimeLengthA
[
StepA
])
...
...
@@ -604,30 +676,38 @@ namespace GcDevicePc.ProThread
StartTimeB
=
DateTime
.
Now
;
}
}
//写入AB
if
(
StepA
<
SendNumA
&&
StepB
<
SendNumB
)
}
catch
{
//Console.WriteLine("SendDataToHW A B", secA.ToString() + " "+ secB.ToString());
SendDataToZB_AB
(
mydataA
,
mydataB
);
Thread
.
Sleep
(
50
);
}
//写入A
if
(
StepA
<
SendNumA
&&
StepB
>=
SendNumB
)
{
// LogHelper.I("SendDataToHW_A", secA.ToString());
SendDataToZB_A
(
mydataA
);
//
if (StepA < SendNumA && StepB >= SendNumB)
//
{
//
// LogHelper.I("SendDataToHW_A", secA.ToString());
//
SendDataToZB_A(mydataA);
Thread
.
Sleep
(
50
);
}
// Thread.Sleep(50);
//}
////写入B
//if (StepB < SendNumB && StepA >= SendNumA)
//{
// // LogHelper.I("SendDataToHW_B", secB.ToString());
// SendDataToZB_B(mydataB);
// Thread.Sleep(50);
//}
//写入B
if
(
Step
B
<
SendNumB
&&
StepA
>=
SendNumA
)
//写入
A
B
if
(
Step
A
<
SendNumA
||
StepB
<
SendNumB
)
{
//
LogHelper.I("SendDataToHW_B",
secB.ToString());
SendDataToZB_
B
(
mydataB
);
//
Console.WriteLine("SendDataToHW A B", secA.ToString() + " "+
secB.ToString());
SendDataToZB_
AB
(
mydataA
,
mydataB
);
Thread
.
Sleep
(
50
);
}
...
...
GcDevicePc/ProThread/SignalDataToHw.cs
View file @
7b0a1056
...
...
@@ -112,7 +112,8 @@ namespace GcDevicePc.ProThread
int
i
=
0
;
for
(
i
=
0
;
i
<
5
;
i
++)
{
try
{
switch
(
methodconfig
.
signal
.
uDetA
[
0
])
{
case
1
:
...
...
@@ -162,6 +163,12 @@ namespace GcDevicePc.ProThread
}
break
;
}
}
catch
{
}
if
(
methodconfig
.
signal
.
u16ChannelA
==
1
&&
methodconfig
.
signal
.
u16ChannelB
==
1
)
{
...
...
@@ -340,6 +347,8 @@ namespace GcDevicePc.ProThread
tsB
=
StartTimeB
.
Subtract
(
EndTimeB
).
Duration
();
secB
=
(
int
)
tsB
.
TotalSeconds
;
try
{
if
(
StepA
<
SendNumA
)
{
if
(
secA
<=
methodconfig
.
signal
.
u16DetTimeLengthA
[
StepA
])
...
...
@@ -592,6 +601,12 @@ namespace GcDevicePc.ProThread
StartTimeB
=
DateTime
.
Now
;
}
}
}
catch
{
}
//写入AB
if
(
StepA
<
SendNumA
&&
StepB
<
SendNumB
)
...
...
GcDevicePc/RunTables.cs
View file @
7b0a1056
...
...
@@ -132,7 +132,7 @@ namespace GcDevicePc
RunTableView
.
Rows
[
index
].
Cells
[
1
].
Value
=
runtable
.
INIGetStringValue
(
"运行表"
,
key
[
i
],
"无"
);
RunTableView
.
Rows
[
index
].
Cells
[
2
].
Value
=
runtable
.
INIGetStringValue
(
"运行时间"
,
key
[
i
],
"无"
);
RunTableView
.
Rows
[
index
].
Cells
[
3
].
Value
=
runtable
.
INIGetStringValue
(
"循环"
,
key
[
i
],
"无"
);
RunTableView
.
Rows
[
index
].
Cells
[
4
].
Value
=
"1"
;
RunTableView
.
Rows
[
index
].
Cells
[
4
].
Value
=
runtable
.
INIGetStringValue
(
"间隔时间"
,
key
[
i
],
"无"
);
;
}
this
.
updategv
.
Enabled
=
false
;
...
...
@@ -406,7 +406,7 @@ namespace GcDevicePc
tmp
.
filename
=
(
string
)
LocalMethodView
.
Rows
[
i
].
Cells
[
1
].
Value
;
tmp
.
runtime
=
"0"
;
tmp
.
runcount
=
"1"
;
tmp
.
rundelay
=
"
1
"
;
tmp
.
rundelay
=
"
0
"
;
RunTabList
.
Add
(
tmp
);
}
}
...
...
GcDevicePc/StartForm.cs
View file @
7b0a1056
...
...
@@ -3,6 +3,8 @@ using System.ComponentModel;
using
System.Drawing
;
using
System.Windows.Forms
;
using
System.Threading
;
using
System.IO
;
using
Ini.Net
;
namespace
GcDevicePc
{
...
...
@@ -147,7 +149,8 @@ namespace GcDevicePc
private
void
PreLoadingProc
()
{
bool
ret
=
false
;
// globaldata.m_appinit.InitAppFolderGC();
//globaldata.m_appinit.InitAppFolderGC();
_appInitInfo
=
"系统初始化开始"
;
_appInitInfo
=
"检测本地网络"
;
globaldata
.
m_appinit
.
LocalNetworkCheck
();
...
...
GcDevicePc/TestForm.Designer.cs
View file @
7b0a1056
...
...
@@ -31,7 +31,6 @@
this
.
components
=
new
System
.
ComponentModel
.
Container
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button2
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
gcTitle1
=
new
GcDevicePc
.
Controls
.
GCTitle
();
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
button3
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button4
=
new
System
.
Windows
.
Forms
.
Button
();
...
...
@@ -39,6 +38,15 @@
this
.
button6
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button7
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button8
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
gcTitle1
=
new
GcDevicePc
.
Controls
.
GCTitle
();
this
.
button9
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button10
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button11
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button12
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button13
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button14
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button15
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button16
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
SuspendLayout
();
//
// button1
...
...
@@ -53,7 +61,7 @@
//
// button2
//
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
1
28
,
314
);
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
1
10
,
231
);
this
.
button2
.
Name
=
"button2"
;
this
.
button2
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button2
.
TabIndex
=
1
;
...
...
@@ -61,14 +69,6 @@
this
.
button2
.
UseVisualStyleBackColor
=
true
;
this
.
button2
.
Click
+=
new
System
.
EventHandler
(
this
.
button2_Click
);
//
// gcTitle1
//
this
.
gcTitle1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Top
;
this
.
gcTitle1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
gcTitle1
.
Name
=
"gcTitle1"
;
this
.
gcTitle1
.
Size
=
new
System
.
Drawing
.
Size
(
800
,
20
);
this
.
gcTitle1
.
TabIndex
=
2
;
//
// timer1
//
this
.
timer1
.
Interval
=
5000
;
...
...
@@ -112,7 +112,7 @@
//
// button7
//
this
.
button7
.
Location
=
new
System
.
Drawing
.
Point
(
244
,
314
);
this
.
button7
.
Location
=
new
System
.
Drawing
.
Point
(
191
,
231
);
this
.
button7
.
Name
=
"button7"
;
this
.
button7
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button7
.
TabIndex
=
4
;
...
...
@@ -122,7 +122,7 @@
//
// button8
//
this
.
button8
.
Location
=
new
System
.
Drawing
.
Point
(
389
,
314
);
this
.
button8
.
Location
=
new
System
.
Drawing
.
Point
(
272
,
231
);
this
.
button8
.
Name
=
"button8"
;
this
.
button8
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button8
.
TabIndex
=
5
;
...
...
@@ -130,11 +130,107 @@
this
.
button8
.
UseVisualStyleBackColor
=
true
;
this
.
button8
.
Click
+=
new
System
.
EventHandler
(
this
.
Button8_Click
);
//
// gcTitle1
//
this
.
gcTitle1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Top
;
this
.
gcTitle1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
gcTitle1
.
Name
=
"gcTitle1"
;
this
.
gcTitle1
.
Size
=
new
System
.
Drawing
.
Size
(
800
,
20
);
this
.
gcTitle1
.
TabIndex
=
2
;
//
// button9
//
this
.
button9
.
Location
=
new
System
.
Drawing
.
Point
(
110
,
352
);
this
.
button9
.
Name
=
"button9"
;
this
.
button9
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button9
.
TabIndex
=
6
;
this
.
button9
.
Text
=
"button9"
;
this
.
button9
.
UseVisualStyleBackColor
=
true
;
this
.
button9
.
Click
+=
new
System
.
EventHandler
(
this
.
Button9_Click
);
//
// button10
//
this
.
button10
.
Location
=
new
System
.
Drawing
.
Point
(
110
,
381
);
this
.
button10
.
Name
=
"button10"
;
this
.
button10
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button10
.
TabIndex
=
6
;
this
.
button10
.
Text
=
"button9"
;
this
.
button10
.
UseVisualStyleBackColor
=
true
;
this
.
button10
.
Click
+=
new
System
.
EventHandler
(
this
.
Button10_Click
);
//
// button11
//
this
.
button11
.
Location
=
new
System
.
Drawing
.
Point
(
272
,
352
);
this
.
button11
.
Name
=
"button11"
;
this
.
button11
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button11
.
TabIndex
=
6
;
this
.
button11
.
Text
=
"button9"
;
this
.
button11
.
UseVisualStyleBackColor
=
true
;
this
.
button11
.
Click
+=
new
System
.
EventHandler
(
this
.
Button11_Click
);
//
// button12
//
this
.
button12
.
Location
=
new
System
.
Drawing
.
Point
(
272
,
381
);
this
.
button12
.
Name
=
"button12"
;
this
.
button12
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button12
.
TabIndex
=
6
;
this
.
button12
.
Text
=
"button9"
;
this
.
button12
.
UseVisualStyleBackColor
=
true
;
this
.
button12
.
Click
+=
new
System
.
EventHandler
(
this
.
Button12_Click
);
//
// button13
//
this
.
button13
.
Location
=
new
System
.
Drawing
.
Point
(
395
,
352
);
this
.
button13
.
Name
=
"button13"
;
this
.
button13
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button13
.
TabIndex
=
6
;
this
.
button13
.
Text
=
"button9"
;
this
.
button13
.
UseVisualStyleBackColor
=
true
;
this
.
button13
.
Click
+=
new
System
.
EventHandler
(
this
.
Button13_Click
);
//
// button14
//
this
.
button14
.
Location
=
new
System
.
Drawing
.
Point
(
395
,
381
);
this
.
button14
.
Name
=
"button14"
;
this
.
button14
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button14
.
TabIndex
=
6
;
this
.
button14
.
Text
=
"button9"
;
this
.
button14
.
UseVisualStyleBackColor
=
true
;
this
.
button14
.
Click
+=
new
System
.
EventHandler
(
this
.
Button14_Click
);
//
// button15
//
this
.
button15
.
Location
=
new
System
.
Drawing
.
Point
(
557
,
352
);
this
.
button15
.
Name
=
"button15"
;
this
.
button15
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button15
.
TabIndex
=
6
;
this
.
button15
.
Text
=
"button9"
;
this
.
button15
.
UseVisualStyleBackColor
=
true
;
this
.
button15
.
Click
+=
new
System
.
EventHandler
(
this
.
Button15_Click
);
//
// button16
//
this
.
button16
.
Location
=
new
System
.
Drawing
.
Point
(
557
,
381
);
this
.
button16
.
Name
=
"button16"
;
this
.
button16
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button16
.
TabIndex
=
6
;
this
.
button16
.
Text
=
"button9"
;
this
.
button16
.
UseVisualStyleBackColor
=
true
;
this
.
button16
.
Click
+=
new
System
.
EventHandler
(
this
.
Button16_Click
);
//
// TestForm
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
800
,
583
);
this
.
Controls
.
Add
(
this
.
button16
);
this
.
Controls
.
Add
(
this
.
button14
);
this
.
Controls
.
Add
(
this
.
button12
);
this
.
Controls
.
Add
(
this
.
button15
);
this
.
Controls
.
Add
(
this
.
button13
);
this
.
Controls
.
Add
(
this
.
button11
);
this
.
Controls
.
Add
(
this
.
button10
);
this
.
Controls
.
Add
(
this
.
button9
);
this
.
Controls
.
Add
(
this
.
button8
);
this
.
Controls
.
Add
(
this
.
button7
);
this
.
Controls
.
Add
(
this
.
button6
);
...
...
@@ -162,5 +258,13 @@
private
System
.
Windows
.
Forms
.
Button
button6
;
private
System
.
Windows
.
Forms
.
Button
button7
;
private
System
.
Windows
.
Forms
.
Button
button8
;
private
System
.
Windows
.
Forms
.
Button
button9
;
private
System
.
Windows
.
Forms
.
Button
button10
;
private
System
.
Windows
.
Forms
.
Button
button11
;
private
System
.
Windows
.
Forms
.
Button
button12
;
private
System
.
Windows
.
Forms
.
Button
button13
;
private
System
.
Windows
.
Forms
.
Button
button14
;
private
System
.
Windows
.
Forms
.
Button
button15
;
private
System
.
Windows
.
Forms
.
Button
button16
;
}
}
\ No newline at end of file
GcDevicePc/TestForm.cs
View file @
7b0a1056
using
GcDevicePc.Common
;
using
GcDevicePc.ConfigMethod
;
using
GcDevicePc.Controls
;
using
GcDevicePc.GCBuffer
;
using
GcDevicePc.ProThread
;
using
Ini.Net
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
...
...
@@ -10,6 +12,7 @@ using System.Drawing;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
...
...
@@ -121,6 +124,7 @@ namespace GcDevicePc
private
void
button2_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzba
();
}
int
i
=
0
;
...
...
@@ -132,7 +136,7 @@ namespace GcDevicePc
private
void
Button7_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzbb
();
}
SendDataToZB
dataToZB
=
new
SendDataToZB
();
...
...
@@ -140,6 +144,64 @@ namespace GcDevicePc
{
//dataToZB.InitsendData();
dataToZB
.
StartSendDataToZB
();
starttr
();
}
Thread
tr
;
private
void
starttr
()
{
tr
=
new
Thread
(
ths
);
tr
.
Start
();
}
private
void
ths
()
{
while
(
true
)
{
dataToZB
.
testzb
(
2
,
10
);
Thread
.
Sleep
(
50
);
}
}
private
void
Button9_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzbb
(
1
,
0
,
1
);
}
private
void
Button10_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzbb
(
1
,
0
,
2
);
}
private
void
Button11_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzbb
(
0
,
1
,
1
);
}
private
void
Button12_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzbb
(
0
,
1
,
2
);
}
private
void
Button13_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzbb
(
1
,
0
,
3
);
}
private
void
Button14_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzbb
(
1
,
0
,
4
);
}
private
void
Button15_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzbb
(
0
,
1
,
3
);
}
private
void
Button16_Click
(
object
sender
,
EventArgs
e
)
{
dataToZB
.
testzbb
(
0
,
1
,
4
);
}
}
}
GcDevicePc/globaldata.cs
View file @
7b0a1056
...
...
@@ -95,7 +95,7 @@ namespace GcDevicePc
public
static
PCBuffer
m_pcbuffer
=
new
PCBuffer
();
public
static
SignalBuffer
m_signalbuffer
=
new
SignalBuffer
();
public
static
bool
IsShowPower
=
false
;
//暂时判断是否显示功率
//
public
static
HWConfig
m_hwconfig
=
new
HWConfig
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment