SAT9/.resources/52c94ff315f93f8e443d975953dfe4ce1d62f8529ec9fe361980e756b18e7334
2025-04-18 19:44:27 +04:00

45 lines
1.5 KiB
Plaintext

def generate_tag_config(self,event):
"""This function generates the tag config in the search window.
Args:
self: A reference to the object that is invoking this function.
event: A reference to the event object that is being called by this function..
Returns:
This is a description of what is returned.
Raises:
None.
"""
tag = event.value.get("Tags")
fc = system.tag.read("Configuration/FC").value
path ="[%s_SCADA_TAG_PROVIDER]%s/OPC/" % (fc, tag)
results = system.tag.browse( path = path)
tag_list = results.getResults()
data = [i["fullPath"] for i in tag_list]
table_data = []
for i in data:
config = system.tag.getConfiguration(i)
alarms = [x.get("alarms") for x in config]
try:
for alarm in alarms:
for x in alarm:
# replace = "[%s_SCADA_TAG_PROVIDER]" % (fc)
system.perspective.print(x)
full_path = str(i)
name = x.get("name")
additional_info = x.get("AdditionalInfo")
priority = x.get("priority")
bit_position = x.get("bitPosition")
row = row_builder.build_row(FullPath = full_path, AdditionalInfo = additional_info,
Priority = priority, Name = name, StyleClass = {"classes":"Alarms-Styles/NoAlarms"})
table_data.append(row)
except:
system.perspective.print("object not iterable")
# self.getSibling("Table_0").props.data = table_data
payload = {}
payload["table_data"] = table_data
system.perspective.sendMessage("build-tag-config", payload = payload, scope = "view")