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
343e10fe
Commit
343e10fe
authored
Apr 27, 2023
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 PLCProxySystem 可以没有 设置obj 也能读数据
parent
6b9fde5f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
3 deletions
+44
-3
PLCProxySystem.cs
....FLY.OBJComponents/OBJComponents/Server/PLCProxySystem.cs
+44
-3
No files found.
Project.FLY.OBJComponents/OBJComponents/Server/PLCProxySystem.cs
View file @
343e10fe
...
@@ -88,12 +88,19 @@ namespace FLY.OBJComponents.Server
...
@@ -88,12 +88,19 @@ namespace FLY.OBJComponents.Server
}
}
try
try
{
{
object
obj
=
null
;
if
(
this
.
ObjNames
.
Count
()!=
0
)
{
if
(!
this
.
ObjNames
.
ContainsKey
(
var
.
OwnerName
))
throw
new
Exception
(
$"配置文件出错,不能找到 对象
{
var
.
OwnerName
}
"
);
obj
=
this
.
ObjNames
[
var
.
OwnerName
];
}
DataToRegs
dr
=
plc
.
MapDataToRegs
(
DataToRegs
dr
=
plc
.
MapDataToRegs
(
ModbusMapper
.
TranslateToPLCAddressArea
(
var
.
Mode
),
ModbusMapper
.
TranslateToPLCAddressArea
(
var
.
Mode
),
var
.
Addr
,
var
.
Addr
,
reg_type
,
reg_type
,
var
.
Scale
,
var
.
Scale
,
this
.
ObjNames
[
var
.
OwnerName
]
,
obj
,
var
.
PropertyName
,
var
.
PropertyName
,
var
.
RegAddr
,
var
.
RegAddr
,
var
.
OwnerName
);
var
.
OwnerName
);
...
@@ -138,7 +145,6 @@ namespace FLY.OBJComponents.Server
...
@@ -138,7 +145,6 @@ namespace FLY.OBJComponents.Server
obj
.
PropertyChanged
+=
Obj_PropertyChanged
;
obj
.
PropertyChanged
+=
Obj_PropertyChanged
;
}
}
FObjBase
.
PollModule
.
Current
.
Poll_Config
(
FObjBase
.
PollModule
.
POLL_CONFIG
.
ADD
,
FObjBase
.
PollModule
.
Current
.
Poll_Config
(
FObjBase
.
PollModule
.
POLL_CONFIG
.
ADD
,
OnPoll_plans
,
TimeSpan
.
FromSeconds
(
1
));
OnPoll_plans
,
TimeSpan
.
FromSeconds
(
1
));
...
@@ -226,7 +232,10 @@ namespace FLY.OBJComponents.Server
...
@@ -226,7 +232,10 @@ namespace FLY.OBJComponents.Server
FObjBase
.
PollModule
.
Current
.
Dispatcher
.
Invoke
(()
=>
FObjBase
.
PollModule
.
Current
.
Dispatcher
.
Invoke
(()
=>
{
{
isShield
=
true
;
isShield
=
true
;
if
(
dr
.
owner
!=
null
)
{
Misc
.
PropertiesManager
.
SetValue
(
dr
.
owner
,
dr
.
propertyName
,
dr
.
value
);
Misc
.
PropertiesManager
.
SetValue
(
dr
.
owner
,
dr
.
propertyName
,
dr
.
value
);
}
isShield
=
false
;
isShield
=
false
;
});
});
}
}
...
@@ -274,6 +283,38 @@ namespace FLY.OBJComponents.Server
...
@@ -274,6 +283,38 @@ namespace FLY.OBJComponents.Server
}
}
/// <summary>
/// 全更新
/// </summary>
/// <param name="planID"></param>
public
void
SetPlanAll
(
long
planID
)
{
Plan
plan
=
planIDs
.
Find
(
p
=>
p
.
ID
==
planID
);
if
(
plan
==
null
)
{
plan
=
new
Plan
()
{
ID
=
planID
,
FeedTime
=
DateTime
.
Now
};
planIDs
.
Add
(
plan
);
}
else
{
plan
.
FeedTime
=
DateTime
.
Now
;
}
List
<
DataToRegs
>
drs
=
DRMap
;
foreach
(
DataToRegs
dr
in
drs
)
{
dr
.
mapper
.
PlanAdd
(
planID
,
dr
);
if
(!
plan
.
mappers
.
Contains
(
dr
.
mapper
))
plan
.
mappers
.
Add
(
dr
.
mapper
);
}
foreach
(
var
mapper
in
plan
.
mappers
)
{
mapper
.
PlanMake
();
}
}
long
freeplanid
=
1
;
long
freeplanid
=
1
;
long
GetFreePlanID
()
long
GetFreePlanID
()
{
{
...
...
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