Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hemei
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
潘栩锋
hemei
Commits
013060ee
Commit
013060ee
authored
Dec 31, 2019
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 中央收卷 X117 地址出错,8进制!!!!!
parent
a9f0cc28
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
43 deletions
+116
-43
WinderSystem.cs
...ect.FLY.Winder_20190413/FLY.Winder/Server/WinderSystem.cs
+97
-33
WS.xml
Resource/收卷/中央收卷_设备连接变量表_20191206/Generated/WS.xml
+7
-6
DataInfos.cs
...Project.FLY.Autogen_WS/Autogen_WS/Autogen_WS/DataInfos.cs
+12
-4
No files found.
Project.FLY.Winder_20190413/FLY.Winder/Server/WinderSystem.cs
View file @
013060ee
...
...
@@ -73,56 +73,117 @@ namespace FLY.Winder.Server
#
region
报警
class
ErrorAction
{
public
List
<
string
>
error_property
;
public
List
<
ErrorInfo
>
error_property
;
public
object
state
;
public
delegate
void
ErrorHandler
(
ref
string
msg
,
object
state
);
public
ErrorHandler
action
;
}
class
ErrorInfo
{
public
string
property
;
public
byte
code
;
public
string
msg
;
public
bool
offIsError
;
}
Dictionary
<
INotifyPropertyChanged
,
ErrorAction
>
obj_error
=
new
Dictionary
<
INotifyPropertyChanged
,
ErrorAction
>();
void
InitError
()
{
byte
code
=
0
;
//反射找出全部是报警的property
List
<
string
>
error_accessory_property
=
new
List
<
string
>();
{
List
<
ErrorInfo
>
error_accessory_property
=
new
List
<
ErrorInfo
>();
foreach
(
var
propertyInfo
in
typeof
(
WinderAccessory
).
GetProperties
())
{
if
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
IsErrorAttribute
),
false
).
Count
()
>
0
)
{
error_accessory_property
.
Add
(
propertyInfo
.
Name
);
string
desp
=
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
DescriptionAttribute
),
false
).
First
()
as
DescriptionAttribute
).
Description
;
bool
offIsError
=
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
IsErrorAttribute
),
false
).
First
()
as
IsErrorAttribute
).
OffIsError
;
ErrorInfo
errorInfo
=
new
ErrorInfo
()
{
property
=
propertyInfo
.
Name
,
msg
=
desp
,
offIsError
=
offIsError
,
code
=
code
};
error_accessory_property
.
Add
(
errorInfo
);
code
++;
}
}
obj_error
.
Add
(
Accessory
,
new
ErrorAction
()
{
error_property
=
error_accessory_property
});
}
List
<
string
>
error_winder_property
=
new
List
<
string
>();
{
List
<
ErrorInfo
>
error_winder_property
=
new
List
<
ErrorInfo
>();
foreach
(
var
propertyInfo
in
typeof
(
WinderInsideOutside
).
GetProperties
())
{
if
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
IsErrorAttribute
),
false
).
Count
()
>
0
)
{
error_winder_property
.
Add
(
propertyInfo
.
Name
);
}
}
string
desp
=
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
DescriptionAttribute
),
false
).
First
()
as
DescriptionAttribute
).
Description
;
bool
offIsError
=
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
IsErrorAttribute
),
false
).
First
()
as
IsErrorAttribute
).
OffIsError
;
obj_error
.
Add
(
Accessory
,
new
ErrorAction
()
ErrorInfo
errorInfo
=
new
ErrorInfo
()
{
error_property
=
error_accessory_property
});
property
=
propertyInfo
.
Name
,
msg
=
desp
,
offIsError
=
offIsError
,
code
=
code
};
code
++;
error_winder_property
.
Add
(
errorInfo
);
}
}
obj_error
.
Add
(
Items
[
0
],
new
ErrorAction
()
{
error_property
=
error_winder_property
,
action
=
(
ref
string
description
,
object
state
)
=>
{
action
=
(
ref
string
description
,
object
state
)
=>
{
description
=
"内"
+
description
;
}
});
}
{
List
<
ErrorInfo
>
error_winder_property
=
new
List
<
ErrorInfo
>();
foreach
(
var
propertyInfo
in
typeof
(
WinderInsideOutside
).
GetProperties
())
{
if
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
IsErrorAttribute
),
false
).
Count
()
>
0
)
{
string
desp
=
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
DescriptionAttribute
),
false
).
First
()
as
DescriptionAttribute
).
Description
;
bool
offIsError
=
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
IsErrorAttribute
),
false
).
First
()
as
IsErrorAttribute
).
OffIsError
;
ErrorInfo
errorInfo
=
new
ErrorInfo
()
{
property
=
propertyInfo
.
Name
,
msg
=
desp
,
offIsError
=
offIsError
,
code
=
code
};
code
++;
error_winder_property
.
Add
(
errorInfo
);
}
}
obj_error
.
Add
(
Items
[
1
],
new
ErrorAction
()
{
error_property
=
error_winder_property
,
action
=
(
ref
string
description
,
object
state
)
=>
{
action
=
(
ref
string
description
,
object
state
)
=>
{
description
=
"外"
+
description
;
}
});
}
foreach
(
var
obj
in
obj_error
.
Keys
)
{
...
...
@@ -134,7 +195,7 @@ namespace FLY.Winder.Server
foreach
(
var
kv
in
obj_error
)
{
string
objname
=
PLCos
.
ObjNames
.
First
(
_kv
=>
_kv
.
Value
==
kv
.
Key
).
Key
;
PLCos
.
SetPlan
(
objname
,
kv
.
Value
.
error_property
.
ToArray
(),
0
);
PLCos
.
SetPlan
(
objname
,
kv
.
Value
.
error_property
.
Select
(
ei
=>
ei
.
property
).
ToArray
(),
0
);
}
//--------------------------------------------------------------------------------
...
...
@@ -160,7 +221,7 @@ namespace FLY.Winder.Server
foreach
(
var
kv
in
obj_error
)
{
object
sender
=
kv
.
Key
;
foreach
(
string
propertyname
in
kv
.
Value
.
error_property
)
foreach
(
string
propertyname
in
kv
.
Value
.
error_property
.
Select
(
ei
=>
ei
.
property
)
)
{
Obj_PropertyChanged_ForError
(
sender
,
new
PropertyChangedEventArgs
(
propertyname
));
}
...
...
@@ -175,15 +236,18 @@ namespace FLY.Winder.Server
{
ErrorAction
errorAction
=
obj_error
[
sender
as
INotifyPropertyChanged
];
if
(
errorAction
.
error_property
.
Contains
(
e
.
PropertyName
))
var
eis
=
from
ei
in
errorAction
.
error_property
where
ei
.
property
==
e
.
PropertyName
select
ei
;
if
(
eis
.
Count
()>
0
)
{
var
ei
=
eis
.
First
();
//获取描述
var
type
=
sender
.
GetType
();
var
property
=
type
.
GetProperty
(
e
.
PropertyName
);
var
property
=
type
.
GetProperty
(
e
i
.
property
);
// e
.PropertyName);
bool
b
=
(
bool
)
property
.
GetValue
(
sender
,
null
);
//肯定有,没有就让它出错!!!
string
desp
=
(
property
.
GetCustomAttributes
(
typeof
(
DescriptionAttribute
),
false
).
First
()
as
DescriptionAttribute
).
Description
;
bool
offIsError
=
(
property
.
GetCustomAttributes
(
typeof
(
IsErrorAttribute
),
false
).
First
()
as
IsErrorAttribute
).
OffIsError
;
string
desp
=
ei
.
msg
;
//
(property.GetCustomAttributes(typeof(DescriptionAttribute), false).First() as DescriptionAttribute).Description;
bool
offIsError
=
ei
.
offIsError
;
//
(property.GetCustomAttributes(typeof(IsErrorAttribute), false).First() as IsErrorAttribute).OffIsError;
ERR_STATE
state
;
if
(
offIsError
)
...
...
@@ -191,7 +255,7 @@ namespace FLY.Winder.Server
else
state
=
b
?
ERR_STATE
.
ON
:
ERR_STATE
.
OFF
;
byte
errcode
=
ERRNOs
.
ERRNO_PLC_REG
.
Code
;
byte
errcode
=
ei
.
code
;
//
ERRNOs.ERRNO_PLC_REG.Code;
string
description
=
desp
;
errorAction
.
action
?.
Invoke
(
ref
description
,
errorAction
.
state
);
...
...
Resource/收卷/中央收卷_设备连接变量表_20191206/Generated/WS.xml
View file @
013060ee
...
...
@@ -65,13 +65,13 @@
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"63535"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_CustomerScram"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"63514"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_RotaryForwLimit"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"63515"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_RotaryBackwLimit"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
75
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_AirRoller1Power"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
76
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_AirRoller2Power"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
59
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_AirRoller1Power"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
60
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_AirRoller2Power"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"0"
Addr=
"142"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_T1CommErr"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"0"
Addr=
"143"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_T2CommErr"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"0"
Addr=
"146"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_RotaryCommErr"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
84
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_Splint1CommErr"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
85
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_Splint2CommErr"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
68
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_Splint1CommErr"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
69
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_Splint2CommErr"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"0"
Addr=
"1202"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_RotaryFlLock"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"0"
Addr=
"1203"
Type=
"bool"
Scale=
"1"
OwnerName=
"Accessory"
PropertyName=
"IsError_RotaryBlLock"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"4"
Addr=
"924"
Type=
"uint32"
Scale=
"1"
OwnerName=
"Items[0]"
PropertyName=
"MeasureLen"
/>
...
...
@@ -288,7 +288,7 @@
<PLCVariable
DeviceIndex=
"0"
Mode=
"0"
Addr=
"703"
Type=
"bool"
Scale=
"1"
OwnerName=
"Items[1]"
PropertyName=
"IsError_MoveOut"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"0"
Addr=
"704"
Type=
"bool"
Scale=
"1"
OwnerName=
"Items[0]"
PropertyName=
"IsError_UnloadUp"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"0"
Addr=
"705"
Type=
"bool"
Scale=
"1"
OwnerName=
"Items[1]"
PropertyName=
"IsError_UnloadUp"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
83
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Items[0]"
PropertyName=
"IsError_PumpPower"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
70
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Items[1]"
PropertyName=
"IsError_PumpPower"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
67
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Items[0]"
PropertyName=
"IsError_PumpPower"
/>
<PLCVariable
DeviceIndex=
"0"
Mode=
"1"
Addr=
"635
54
"
Type=
"bool"
Scale=
"1"
OwnerName=
"Items[1]"
PropertyName=
"IsError_PumpPower"
/>
</Variables>
</PLCGroup>
\ No newline at end of file
Resource/收卷/收卷_辅助代码生成/Project.FLY.Autogen_WS/Autogen_WS/Autogen_WS/DataInfos.cs
View file @
013060ee
...
...
@@ -100,7 +100,7 @@ namespace Autogen_WS
if
(!
m
.
Success
)
return
false
;
string
plc_vt
=
m
.
Groups
[
1
].
Value
;
int
plc_a
=
int
.
Parse
(
m
.
Groups
[
2
].
Value
);
//
int plc_a = int.Parse(m.Groups[2].Value);
//查表
var
cells
=
from
_cell
in
mDevMapperRuleTable
.
Tables
where
_cell
.
PLCVarType
==
plc_vt
select
_cell
;
...
...
@@ -109,12 +109,20 @@ namespace Autogen_WS
type
=
cells
.
First
().
VarType
;
//特别的, M0~... D0~.... 是连续的
//但 X0~X7 ,X10~X17, Y0~Y7 ,Y10~Y17, 不是连续的
//特别的, M0~... D0~.... 是10进制
//但 X0~X7 ,X10~X17,X70~X77,X100~X107, Y0~Y7 ,Y10~Y17, 是8进制
int
plc_a
;
if
(
plc_vt
==
"X"
||
plc_vt
==
"Y"
)
{
plc_a
=
((
int
)(
plc_a
/
10
))
*
8
+
plc_a
%
10
;
plc_a
=
Convert
.
ToInt32
(
m
.
Groups
[
2
].
Value
,
8
);
// ((int)(plc_a / 10)) * 8 + plc_a % 10;
}
else
{
plc_a
=
Convert
.
ToInt32
(
m
.
Groups
[
2
].
Value
,
10
);
}
addr
=
(
plc_a
-
cells
.
First
().
PLCAddr1st
)
+
cells
.
First
().
Addr1st
;
return
true
;
...
...
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