Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
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
潘栩锋
Thick-Common
Commits
21c5a6f2
Commit
21c5a6f2
authored
Jan 08, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 ErrorConf 报警时显示的 PLC名称 可以自定义。
parent
9fa1a097
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
8 deletions
+28
-8
ErrorConf.cs
Project.FLY.OBJComponents/OBJComponents/Server/ErrorConf.cs
+28
-8
No files found.
Project.FLY.OBJComponents/OBJComponents/Server/ErrorConf.cs
View file @
21c5a6f2
...
@@ -16,7 +16,8 @@ namespace FLY.OBJComponents.Server
...
@@ -16,7 +16,8 @@ namespace FLY.OBJComponents.Server
#
region
延时推送
MARKNO
#
region
延时推送
MARKNO
const
int
MARKNO_DELAY_ISCONNECTED
=
4
;
const
int
MARKNO_DELAY_ISCONNECTED
=
4
;
#
endregion
#
endregion
string
plcName
;
List
<
string
>
plcNames
;
/// <summary>
/// <summary>
/// 需要设置
/// 需要设置
/// </summary>
/// </summary>
...
@@ -30,9 +31,17 @@ namespace FLY.OBJComponents.Server
...
@@ -30,9 +31,17 @@ namespace FLY.OBJComponents.Server
{
{
this
.
PLCos
=
PLCos
;
this
.
PLCos
=
PLCos
;
this
.
mWarning
=
mWarning
;
this
.
mWarning
=
mWarning
;
this
.
plcName
=
plcName
;
plcNames
=
new
List
<
string
>();
plcNames
.
Add
(
plcName
);
}
public
ErrorConf
(
PLCProxySystem
PLCos
,
WarningSystem2
mWarning
,
string
[]
plcNames
)
{
this
.
PLCos
=
PLCos
;
this
.
mWarning
=
mWarning
;
this
.
plcNames
=
new
List
<
string
>();
if
(
plcNames
.
All
(
s
=>
!
string
.
IsNullOrEmpty
(
s
)))
this
.
plcNames
.
AddRange
(
plcNames
);
}
}
#
region
报警
#
region
报警
public
class
ErrorAction
public
class
ErrorAction
{
{
...
@@ -109,11 +118,7 @@ namespace FLY.OBJComponents.Server
...
@@ -109,11 +118,7 @@ namespace FLY.OBJComponents.Server
ERRNO
errno
=
PlcErrNos
.
Instance
.
ERRNO_PLC_DISCONNECTED
;
ERRNO
errno
=
PlcErrNos
.
Instance
.
ERRNO_PLC_DISCONNECTED
;
UInt16
errcode
=
(
UInt16
)(
errno
.
Code
-
i
);
UInt16
errcode
=
(
UInt16
)(
errno
.
Code
-
i
);
string
description
;
string
description
=
$"
{
GetPlcName
(
i
)}
"
+
errno
.
Descrption
;
if
(
PLCos
.
PLCs
.
Count
()
>
1
)
description
=
$"
{
plcName
}
No.
{
i
+
1
}
"
+
errno
.
Descrption
;
else
description
=
$"
{
plcName
}
"
+
errno
.
Descrption
;
mWarning
.
Add
(
errcode
,
description
,
state
);
mWarning
.
Add
(
errcode
,
description
,
state
);
}
}
...
@@ -150,7 +155,22 @@ namespace FLY.OBJComponents.Server
...
@@ -150,7 +155,22 @@ namespace FLY.OBJComponents.Server
// }
// }
// }, TimeSpan.FromSeconds(1));
// }, TimeSpan.FromSeconds(1));
}
}
string
GetPlcName
(
int
index
)
{
if
(
PLCos
.
PLCs
.
Count
()
==
1
)
{
return
plcNames
[
0
];
}
//多个PLC
if
(
PLCos
.
PLCs
.
Count
()
!=
plcNames
.
Count
())
{
//没有定义全部名字
return
$"
{
plcNames
[
0
]}
No.
{
index
+
1
}
"
;
}
return
plcNames
[
index
];
}
public
void
ResetError
(
INotifyPropertyChanged
sender
)
public
void
ResetError
(
INotifyPropertyChanged
sender
)
{
{
var
type
=
sender
.
GetType
();
var
type
=
sender
.
GetType
();
...
...
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