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
b4191e67
Commit
b4191e67
authored
Jun 04, 2018
by
wangjunqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加一些判断条件,严格化约束
parent
daaefa58
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
42 deletions
+46
-42
MDIBase.cs
GcDevicePc/MDIBase.cs
+11
-10
GcDataTh.cs
GcDevicePc/ProThread/GcDataTh.cs
+35
-32
No files found.
GcDevicePc/MDIBase.cs
View file @
b4191e67
...
@@ -130,7 +130,7 @@ namespace GcDevicePc
...
@@ -130,7 +130,7 @@ namespace GcDevicePc
startTime
=
DateTime
.
Now
;
startTime
=
DateTime
.
Now
;
// toolStripStatusLabeSystme.Text = string.Format("状态:{0}", Formstr);
// toolStripStatusLabeSystme.Text = string.Format("状态:{0}", Formstr);
timespan
=
System
.
DateTime
.
Now
-
startTime
;
timespan
=
DateTime
.
Now
-
startTime
;
toolStripStatusLabelusertime
.
Text
=
String
.
Format
(
"运行时间:{0}"
,
timespan
.
Days
.
ToString
()
+
"天"
+
timespan
.
Hours
.
ToString
()
+
"时"
+
timespan
.
Minutes
.
ToString
()
+
"分"
+
timespan
.
Seconds
.
ToString
()
+
"秒"
);
toolStripStatusLabelusertime
.
Text
=
String
.
Format
(
"运行时间:{0}"
,
timespan
.
Days
.
ToString
()
+
"天"
+
timespan
.
Hours
.
ToString
()
+
"时"
+
timespan
.
Minutes
.
ToString
()
+
"分"
+
timespan
.
Seconds
.
ToString
()
+
"秒"
);
//显示方法名称
//显示方法名称
...
@@ -281,9 +281,6 @@ namespace GcDevicePc
...
@@ -281,9 +281,6 @@ namespace GcDevicePc
return
(
Environment
.
TickCount
-
(
long
)
vLastInputInfo
.
dwTime
)/
1000
;
return
(
Environment
.
TickCount
-
(
long
)
vLastInputInfo
.
dwTime
)/
1000
;
}
}
public
void
SendPCCMD
(
bool
flag
)
public
void
SendPCCMD
(
bool
flag
)
{
{
if
(
flag
)
//打开运行
if
(
flag
)
//打开运行
...
@@ -348,13 +345,12 @@ namespace GcDevicePc
...
@@ -348,13 +345,12 @@ namespace GcDevicePc
{
{
globaldata
.
OS_STOP
=
false
;
globaldata
.
OS_STOP
=
false
;
}
}
worker
.
ReportProgress
(
100
);
worker
.
ReportProgress
(
100
);
break
;
break
;
}
}
else
else
{
{
if
(
i
%
2
0
==
0
)
if
(
i
%
1
0
==
0
)
{
{
if
(
globaldata
.
OS_STOP
)
if
(
globaldata
.
OS_STOP
)
{
{
...
@@ -365,11 +361,15 @@ namespace GcDevicePc
...
@@ -365,11 +361,15 @@ namespace GcDevicePc
hmiopt
.
WriteStopVal
();
hmiopt
.
WriteStopVal
();
}
}
}
}
Thread
.
Sleep
(
100
);
if
(
i
!=
99
)
if
(
i
!=
99
)
{
worker
.
ReportProgress
(
i
);
worker
.
ReportProgress
(
i
);
break
;
}
}
}
if
(
worker
.
CancellationPending
)
// 如果用户取消则跳出处理数据代码
if
(
worker
.
CancellationPending
)
// 如果用户取消则跳出处理数据代码
...
@@ -377,6 +377,8 @@ namespace GcDevicePc
...
@@ -377,6 +377,8 @@ namespace GcDevicePc
e
.
Cancel
=
true
;
e
.
Cancel
=
true
;
break
;
break
;
}
}
Thread
.
Sleep
(
100
);
}
}
}
}
...
@@ -415,9 +417,8 @@ namespace GcDevicePc
...
@@ -415,9 +417,8 @@ namespace GcDevicePc
{
{
worker
.
ReportProgress
(
100
);
worker
.
ReportProgress
(
100
);
break
;
break
;
}
else
}
else
{
{
if
(
i
%
20
==
0
&&
i
!=
0
)
if
(
i
%
20
==
0
&&
i
!=
0
)
{
{
if
(
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcworkinfo
.
RunType
==
0
)
if
(
globaldata
.
m_pcbuffer
.
gcpcinfo
.
pcworkinfo
.
RunType
==
0
)
...
...
GcDevicePc/ProThread/GcDataTh.cs
View file @
b4191e67
...
@@ -320,9 +320,9 @@ namespace GcDevicePc.ProThread
...
@@ -320,9 +320,9 @@ namespace GcDevicePc.ProThread
/// 获取HMI运行状态
/// 获取HMI运行状态
/// </summary>
/// </summary>
/// <param name="state"></param>
/// <param name="state"></param>
private
void
GetHMIState
(
ref
ushort
[]
state
)
private
int
GetHMIState
(
ref
ushort
[]
state
)
{
{
int
ret
=
0
;
int
ret
=
-
1
;
try
try
{
{
ret
=
GetState
(
globaldata
.
hmistatus
,
9
,
ref
state
);
ret
=
GetState
(
globaldata
.
hmistatus
,
9
,
ref
state
);
...
@@ -346,6 +346,7 @@ namespace GcDevicePc.ProThread
...
@@ -346,6 +346,7 @@ namespace GcDevicePc.ProThread
Log
.
Error
(
e
.
Message
);
Log
.
Error
(
e
.
Message
);
}
}
return
ret
;
}
}
/// <summary>
/// <summary>
...
@@ -715,8 +716,11 @@ namespace GcDevicePc.ProThread
...
@@ -715,8 +716,11 @@ namespace GcDevicePc.ProThread
private
void
update_hmidata
()
private
void
update_hmidata
()
{
{
UInt16
[]
hmistate
=
new
UInt16
[
9
];
UInt16
[]
hmistate
=
new
UInt16
[
9
];
GetHMIState
(
ref
hmistate
);
int
ret
=
-
1
;
ret
=
GetHMIState
(
ref
hmistate
);
if
(
ret
==
0
)
{
globaldata
.
m_hmibuffer
.
gcinfo
.
batno
=
hmistate
[
0
];
globaldata
.
m_hmibuffer
.
gcinfo
.
batno
=
hmistate
[
0
];
globaldata
.
m_hmibuffer
.
gcinfo
.
batruncount
=
hmistate
[
1
];
globaldata
.
m_hmibuffer
.
gcinfo
.
batruncount
=
hmistate
[
1
];
globaldata
.
m_hmibuffer
.
gcinfo
.
oneruntime
=
hmistate
[
2
];
globaldata
.
m_hmibuffer
.
gcinfo
.
oneruntime
=
hmistate
[
2
];
...
@@ -736,9 +740,6 @@ namespace GcDevicePc.ProThread
...
@@ -736,9 +740,6 @@ namespace GcDevicePc.ProThread
if
(
globaldata
.
m_hmibuffer
.
gcinfo
.
methodstatus
==
4
||
globaldata
.
m_hmibuffer
.
gcinfo
.
methodstatus
==
5
)
if
(
globaldata
.
m_hmibuffer
.
gcinfo
.
methodstatus
==
4
||
globaldata
.
m_hmibuffer
.
gcinfo
.
methodstatus
==
5
)
{
{
globaldata
.
m_hmibuffer
.
gcinfo
.
NowStartTime
=
Get_Method_StartTime
();
globaldata
.
m_hmibuffer
.
gcinfo
.
NowStartTime
=
Get_Method_StartTime
();
//Get_Method_StartEndTime(ref globaldata.m_hmibuffer.gcinfo.NowStartTime, ref globaldata.m_hmibuffer.gcinfo.NowEndTime);
}
}
//获取结束时间
//获取结束时间
...
@@ -748,6 +749,8 @@ namespace GcDevicePc.ProThread
...
@@ -748,6 +749,8 @@ namespace GcDevicePc.ProThread
}
}
}
}
}
/// <summary>
/// <summary>
/// 更新通道采集数据
/// 更新通道采集数据
/// </summary>
/// </summary>
...
...
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