SAT9-236, SAT9-239, SAT9-237
This commit is contained in:
parent
848644c03a
commit
9cc78c5b27
@ -54,6 +54,10 @@
|
|||||||
"/Oil": {
|
"/Oil": {
|
||||||
"viewPath": "Main-Views/OilMonitoring"
|
"viewPath": "Main-Views/OilMonitoring"
|
||||||
},
|
},
|
||||||
|
"/Real-Time": {
|
||||||
|
"title": "",
|
||||||
|
"viewPath": "Alarm-Views/RealTime"
|
||||||
|
},
|
||||||
"/Temperature": {
|
"/Temperature": {
|
||||||
"title": "",
|
"title": "",
|
||||||
"viewPath": "Main-Views/TempMonitoring"
|
"viewPath": "Main-Views/TempMonitoring"
|
||||||
|
|||||||
@ -1,6 +1,18 @@
|
|||||||
{
|
{
|
||||||
"custom": {},
|
"custom": {},
|
||||||
"params": {},
|
"params": {
|
||||||
|
"highlightTagPath": ""
|
||||||
|
},
|
||||||
|
"propConfig": {
|
||||||
|
"params.highlightTagPath": {
|
||||||
|
"onChange": {
|
||||||
|
"enabled": null,
|
||||||
|
"script": "\tutils.handleTagHighlight(self.view, currentValue)\n"
|
||||||
|
},
|
||||||
|
"paramDirection": "input",
|
||||||
|
"persistent": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"props": {
|
"props": {
|
||||||
"defaultSize": {
|
"defaultSize": {
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
@ -487,6 +499,24 @@
|
|||||||
"y": 692.163
|
"y": 692.163
|
||||||
},
|
},
|
||||||
"props": {
|
"props": {
|
||||||
|
"params": {
|
||||||
|
"angle": 0,
|
||||||
|
"directionLeft": false,
|
||||||
|
"forceFaultStatus": null,
|
||||||
|
"forceRunningStatus": null,
|
||||||
|
"tagProps": [
|
||||||
|
"System/MCM01/Conveyor/APF/ULC1_3",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value"
|
||||||
|
]
|
||||||
|
},
|
||||||
"path": "Symbol-Views/Equipment-Views/Status"
|
"path": "Symbol-Views/Equipment-Views/Status"
|
||||||
},
|
},
|
||||||
"type": "ia.display.view"
|
"type": "ia.display.view"
|
||||||
|
|||||||
@ -1,6 +1,18 @@
|
|||||||
{
|
{
|
||||||
"custom": {},
|
"custom": {},
|
||||||
"params": {},
|
"params": {
|
||||||
|
"highlightTagPath": ""
|
||||||
|
},
|
||||||
|
"propConfig": {
|
||||||
|
"params.highlightTagPath": {
|
||||||
|
"onChange": {
|
||||||
|
"enabled": null,
|
||||||
|
"script": "\tutils.handleTagHighlight(self.view, currentValue)"
|
||||||
|
},
|
||||||
|
"paramDirection": "input",
|
||||||
|
"persistent": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"props": {
|
"props": {
|
||||||
"defaultSize": {
|
"defaultSize": {
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
|
|||||||
@ -1,6 +1,18 @@
|
|||||||
{
|
{
|
||||||
"custom": {},
|
"custom": {},
|
||||||
"params": {},
|
"params": {
|
||||||
|
"highlightTagPath": ""
|
||||||
|
},
|
||||||
|
"propConfig": {
|
||||||
|
"params.highlightTagPath": {
|
||||||
|
"onChange": {
|
||||||
|
"enabled": null,
|
||||||
|
"script": "\tutils.handleTagHighlight(self.view, currentValue)"
|
||||||
|
},
|
||||||
|
"paramDirection": "input",
|
||||||
|
"persistent": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"props": {
|
"props": {
|
||||||
"defaultSize": {
|
"defaultSize": {
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
|
|||||||
@ -1,6 +1,18 @@
|
|||||||
{
|
{
|
||||||
"custom": {},
|
"custom": {},
|
||||||
"params": {},
|
"params": {
|
||||||
|
"highlightTagPath": ""
|
||||||
|
},
|
||||||
|
"propConfig": {
|
||||||
|
"params.highlightTagPath": {
|
||||||
|
"onChange": {
|
||||||
|
"enabled": null,
|
||||||
|
"script": "\tutils.handleTagHighlight(self.view, currentValue)"
|
||||||
|
},
|
||||||
|
"paramDirection": "input",
|
||||||
|
"persistent": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"props": {
|
"props": {
|
||||||
"defaultSize": {
|
"defaultSize": {
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
|
|||||||
@ -1,6 +1,18 @@
|
|||||||
{
|
{
|
||||||
"custom": {},
|
"custom": {},
|
||||||
"params": {},
|
"params": {
|
||||||
|
"highlightTagPath": ""
|
||||||
|
},
|
||||||
|
"propConfig": {
|
||||||
|
"params.highlightTagPath": {
|
||||||
|
"onChange": {
|
||||||
|
"enabled": null,
|
||||||
|
"script": "\tutils.handleTagHighlight(self.view, currentValue)"
|
||||||
|
},
|
||||||
|
"paramDirection": "input",
|
||||||
|
"persistent": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"props": {
|
"props": {
|
||||||
"defaultSize": {
|
"defaultSize": {
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,23 @@
|
|||||||
|
SELECT *
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
Active.id As NumberID,
|
||||||
|
Active.eventtime As 'Start Timestamp',
|
||||||
|
IFNULL(Clear.eventtime,'') as 'End Timestamp',
|
||||||
|
IFNULL(CONVERT(SEC_TO_TIME(Clear.eventtime - Active.eventtime),VARCHAR(20)),(SEC_TO_TIME(NOW()-Active.eventtime))) as Duration,
|
||||||
|
Class.strvalue As Class,
|
||||||
|
Location.strvalue As Area,
|
||||||
|
Description.strvalue As Description,
|
||||||
|
Tag.strvalue As Tag,
|
||||||
|
alarm_events.eventtype as eventtype
|
||||||
|
FROM alarm_events
|
||||||
|
LEFT OUTER JOIN alarm_events as Active ON alarm_events.eventid = Active.eventid AND (Active.eventtype = 0)
|
||||||
|
LEFT OUTER JOIN alarm_events as Clear ON alarm_events.eventid = Clear.eventid AND (Clear.eventtype = 1)
|
||||||
|
LEFT OUTER JOIN alarm_event_data as Class ON alarm_events.id = Class.id AND (Class.propname = "Class")
|
||||||
|
LEFT OUTER JOIN alarm_event_data as Location ON alarm_events.id = Location.id AND (Location.propname = "Area")
|
||||||
|
LEFT OUTER JOIN alarm_event_data as Description ON alarm_events.id = Description.id AND (Description.propname = "Description")
|
||||||
|
LEFT OUTER JOIN alarm_event_data as Tag ON alarm_events.id = Tag.id AND (Tag.propname = "Tag")
|
||||||
|
WHERE (alarm_events.eventtime BETWEEN :starttime AND :endtime)
|
||||||
|
) t1
|
||||||
|
WHERE t1.eventtype = 0 and t1.Class = 'Error' or t1.Class = :warning or t1.Class = :message
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "SEC",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 1,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "549e4dafbe6ba3fbeeb00d2ddcecdc76439159e008dbce1050b096e21e805799",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "external",
|
||||||
|
"timestamp": "2025-05-14T11:11:04Z"
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "endtime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "starttime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "message",
|
||||||
|
"sqlType": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "warning",
|
||||||
|
"sqlType": 7
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
SELECT concat(date(dumper_cycles.t_stamp), ' ', hour(dumper_cycles.t_stamp), ':00') as StartTimestamp,
|
||||||
|
concat('H',TIMESTAMPDIFF(HOUR,DATE_FORMAT(dumper_cycles.t_stamp,"%Y-%m-%d %H:00:00"),DATE_FORMAT(now(),"%Y-%m-%d %H:00:00"))) as Hour,
|
||||||
|
SUM (dumper_cycles.ulgl1 = 1) as ULGL1,
|
||||||
|
SUM (dumper_cycles.ulgl2 = 1) as ULGL2,
|
||||||
|
SUM (dumper_cycles.ulgl3 = 1) as ULGL3
|
||||||
|
|
||||||
|
FROM dumper_cycles
|
||||||
|
Where (dumper_cycles.t_stamp BETWEEN :starttime AND :endtime)
|
||||||
|
GROUP BY hour(dumper_cycles.t_stamp)
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "SEC",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 1,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "MariaDB",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "a39ede3571def049880fe12bb6cc6c436f397aed3add9a55bc972be502b0566b",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "admin",
|
||||||
|
"timestamp": "2025-05-14T11:27:59Z"
|
||||||
|
},
|
||||||
|
"syntaxProvider": "class com.adbs.syntax.MySQLSyntaxProvider",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "starttime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "endtime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "dumper",
|
||||||
|
"sqlType": 7
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
SELECT concat(date(dumper_cycles.t_stamp), ' ', hour(dumper_cycles.t_stamp), ':00') as StartTimestamp,
|
||||||
|
concat('H',TIMESTAMPDIFF(HOUR,DATE_FORMAT(dumper_cycles.t_stamp,"%Y-%m-%d %H:00:00"),DATE_FORMAT(now(),"%Y-%m-%d %H:00:00"))) as Hour,
|
||||||
|
|
||||||
|
concat(round(SUM(dumper_cycles.ulgl1 = 1)/COUNT(*) * 100*2,2),'%') AS ULGL1,
|
||||||
|
concat(round(SUM(dumper_cycles.ulgl2 = 1)/COUNT(*) * 100*2,2),'%') AS ULGL2,
|
||||||
|
concat(round(SUM(dumper_cycles.ulgl3 = 1)/COUNT(*) * 100*2,2),'%') AS ULGL3
|
||||||
|
|
||||||
|
FROM dumper_cycles
|
||||||
|
Where (dumper_cycles.t_stamp BETWEEN :starttime AND :endtime)
|
||||||
|
GROUP BY hour(dumper_cycles.t_stamp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "SEC",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 1,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "MariaDB",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "149b8d4f7c1f1a6c31050b6a3238db02492a85dde584c0f62e94e2756dc0ce2e",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "admin",
|
||||||
|
"timestamp": "2025-05-14T11:27:59Z"
|
||||||
|
},
|
||||||
|
"syntaxProvider": "class com.adbs.syntax.MySQLSyntaxProvider",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "starttime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "endtime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "dumper",
|
||||||
|
"sqlType": 7
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
SELECT concat(date(dumper_cycles.t_stamp), ' ', hour(dumper_cycles.t_stamp), ':00') as StartTimestamp,
|
||||||
|
concat('H',TIMESTAMPDIFF(HOUR,DATE_FORMAT(dumper_cycles.t_stamp,"%Y-%m-%d %H:00:00"),DATE_FORMAT(now(),"%Y-%m-%d %H:00:00"))) as Hour,
|
||||||
|
|
||||||
|
concat(cast(SUM(dumper_cycles.ulgl1 = 1) as char),' cph') AS ULGL1,
|
||||||
|
concat(cast(SUM(dumper_cycles.ulgl2 = 1) as char),' cph') AS ULGL2,
|
||||||
|
concat(cast(SUM(dumper_cycles.ulgl3 = 1) as char),' cph') AS ULGL3
|
||||||
|
|
||||||
|
FROM dumper_cycles
|
||||||
|
Where (dumper_cycles.t_stamp BETWEEN :starttime AND :endtime)
|
||||||
|
GROUP BY hour(dumper_cycles.t_stamp)
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "SEC",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 1,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "MariaDB",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "5ce43909cae731d141b3f6b3b440afb112fd3f37d331686a7c6124f1bb9b8133",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "admin",
|
||||||
|
"timestamp": "2025-05-14T11:27:59Z"
|
||||||
|
},
|
||||||
|
"syntaxProvider": "class com.adbs.syntax.MySQLSyntaxProvider",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "starttime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "endtime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "dumper",
|
||||||
|
"sqlType": 7
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
26
SAT9_SCADA/ignition/named-query/Jam_Area/Jam/query.sql
Normal file
26
SAT9_SCADA/ignition/named-query/Jam_Area/Jam/query.sql
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Select
|
||||||
|
Total_Jam,Dumpers_jam,Inbound_jam,Runout_jam,Sorter_Recirc_jam,Startstamp,Endtstamp,Sorter_jam,
|
||||||
|
|
||||||
|
1 as Total_perc,
|
||||||
|
Dumpers_jam/Total_Jam as Dumpers_perc,
|
||||||
|
Inbound_jam/Total_Jam as Inbound_perc,
|
||||||
|
Runout_jam/Total_Jam as Runout_perc,
|
||||||
|
Sorter_Recirc_jam/Total_Jam as Sorter_Recirc_perc,
|
||||||
|
Sorter_jam/Total_Jam as Sorter_perc
|
||||||
|
|
||||||
|
|
||||||
|
FROM
|
||||||
|
|
||||||
|
(SELECT
|
||||||
|
|
||||||
|
MIN(jam_area.t_stamp) AS Startstamp,
|
||||||
|
Max(jam_area.t_stamp) AS Endtstamp,
|
||||||
|
SUM (IFNULL(`jam_ulgl`,0) + IFNULL(`Inbound_jam`, 0)+ IFNULL(`Runout_jam`, 0) + IFNULL(`Sorter_recirc`,0)+ IFNULL(`Sorter_jam`,0)) AS Total_Jam,
|
||||||
|
SUM(jam_area.jam_ulgl = 1) AS Dumpers_jam,
|
||||||
|
SUM(jam_area.Inbound_jam = 1) AS Inbound_jam,
|
||||||
|
SUM(jam_area.Runout_jam = 1) AS Runout_jam,
|
||||||
|
SUM(jam_area.Sorter_recirc = 1) AS Sorter_Recirc_jam,
|
||||||
|
SUM(jam_area.Sorter_jam = 1) AS Sorter_jam
|
||||||
|
|
||||||
|
FROM jam_area
|
||||||
|
Where (jam_area.t_stamp BETWEEN :starttime AND :endtime)) basajam
|
||||||
46
SAT9_SCADA/ignition/named-query/Jam_Area/Jam/resource.json
Normal file
46
SAT9_SCADA/ignition/named-query/Jam_Area/Jam/resource.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "SEC",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 1,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "MariaDB",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "829211c4a9a16b08c7f80a503ea4affa82da93b907acd696bb592deac749d719",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "admin",
|
||||||
|
"timestamp": "2025-05-14T11:28:28Z"
|
||||||
|
},
|
||||||
|
"syntaxProvider": "class com.adbs.syntax.MySQLSyntaxProvider",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "endtime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "starttime",
|
||||||
|
"sqlType": 8
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
20
SAT9_SCADA/ignition/named-query/Jam_Area/Jam_graph/query.sql
Normal file
20
SAT9_SCADA/ignition/named-query/Jam_Area/Jam_graph/query.sql
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Select
|
||||||
|
roundtime,Dumpers_jam,Inbound_jam,Runout_jam,Sorter_Recirc_jam,Sorter_jam
|
||||||
|
|
||||||
|
FROM
|
||||||
|
|
||||||
|
(Select
|
||||||
|
|
||||||
|
SUM(jam_area.jam_ulgl = 1) AS Dumpers_jam,
|
||||||
|
SUM(jam_area.Inbound_jam = 1) AS Inbound_jam,
|
||||||
|
SUM(jam_area.Runout_jam = 1) AS Runout_jam,
|
||||||
|
SUM(jam_area.Sorter_recirc = 1) AS Sorter_Recirc_jam,
|
||||||
|
SUM(jam_area.Sorter_jam = 1) AS Sorter_jam,
|
||||||
|
FROM_UNIXTIME(CEIL(UNIX_TIMESTAMP(jam_area.t_stamp) / 600) * 600) roundtime
|
||||||
|
|
||||||
|
FROM jam_area
|
||||||
|
Where (jam_area.t_stamp BETWEEN :starttime AND :endtime)
|
||||||
|
|
||||||
|
Group BY FROM_UNIXTIME(CEIL(UNIX_TIMESTAMP(jam_area.t_stamp) / 600) * 600)
|
||||||
|
Order By jam_area.t_stamp ASC
|
||||||
|
) okeyjam
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "SEC",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 1,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "MariaDB",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "b0338f44fa7fe41646c12e4fbd540a9630b9e877f98b5017a4d9650ed85e2a63",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "admin",
|
||||||
|
"timestamp": "2025-05-14T11:28:28Z"
|
||||||
|
},
|
||||||
|
"syntaxProvider": "class com.adbs.syntax.MySQLSyntaxProvider",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "starttime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "endtime",
|
||||||
|
"sqlType": 8
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
SELECT IFNULL(max(total_count*12),0) as max_pph FROM (
|
||||||
|
SELECT
|
||||||
|
Round(SUM(alltable.ACTUAL_DEST <> 'S0199' and alltable.ACTUAL_DEST <> 'S0168')) AS total_count
|
||||||
|
FROM alltable
|
||||||
|
Where (alltable.t_stamp BETWEEN :starttime AND :endtime)
|
||||||
|
GROUP BY UNIX_TIMESTAMP(alltable.t_stamp) DIV 300) basa
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "SEC",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 1,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "MariaDB",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "c55660c0037cfe8b8cd8a33f43b3cde75afb33dfcc65da2bdc570cf81c99983b",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "admin",
|
||||||
|
"timestamp": "2025-05-14T11:20:19Z"
|
||||||
|
},
|
||||||
|
"syntaxProvider": "class com.adbs.syntax.MySQLSyntaxProvider",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "starttime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "endtime",
|
||||||
|
"sqlType": 8
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
12
SAT9_SCADA/ignition/named-query/Status/Ethernet/query.sql
Normal file
12
SAT9_SCADA/ignition/named-query/Status/Ethernet/query.sql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
SELECT Status_Ethernet.status_ethernet_ndx,
|
||||||
|
Status_Ethernet.DeviceType,
|
||||||
|
Status_Ethernet.Device,
|
||||||
|
Status_Ethernet.IPAddress,
|
||||||
|
Status_Ethernet.Status1,
|
||||||
|
Status_Ethernet.CurrentAmps,
|
||||||
|
Status_Ethernet.SpeedFPM,
|
||||||
|
Status_Ethernet.StatusCode,
|
||||||
|
Status_Ethernet.row_id,
|
||||||
|
Status_Ethernet.LastStatusCode,
|
||||||
|
IF (Status_Ethernet.Status1 = "false","OK", "Fault") as Status
|
||||||
|
FROM Status_Ethernet
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "MIN",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 50000,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "MariaDB80",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "02deb199176c9615762b6c844d47a42609bba154cd0498f90d5aa4faf6ee055b",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "external",
|
||||||
|
"timestamp": "2025-05-14T11:11:04Z"
|
||||||
|
},
|
||||||
|
"syntaxProvider": "class com.adbs.syntax.MySQLSyntaxProvider"
|
||||||
|
}
|
||||||
|
}
|
||||||
137
SAT9_SCADA/ignition/named-query/Status/Lane Status/query.sql
Normal file
137
SAT9_SCADA/ignition/named-query/Status/Lane Status/query.sql
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
WITH DesiredLanes AS (
|
||||||
|
SELECT lane_number
|
||||||
|
FROM (
|
||||||
|
SELECT 101 + n AS lane_number FROM (
|
||||||
|
SELECT a.N + b.N * 10 AS n
|
||||||
|
FROM (SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) a,
|
||||||
|
(SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3) b
|
||||||
|
) numbers WHERE n <= 29 -- 101 to 130
|
||||||
|
UNION
|
||||||
|
SELECT 201 + n FROM (
|
||||||
|
SELECT a.N + b.N * 10 AS n
|
||||||
|
FROM (SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) a,
|
||||||
|
(SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3) b
|
||||||
|
) numbers WHERE n <= 29 -- 201 to 230
|
||||||
|
) lanes
|
||||||
|
),
|
||||||
|
AlarmData AS (
|
||||||
|
SELECT DISTINCT
|
||||||
|
ae.id AS record_id,
|
||||||
|
ae.eventid AS event_uuid,
|
||||||
|
ae.source,
|
||||||
|
ae.eventtime AS active_time,
|
||||||
|
(SELECT MIN(eventtime)
|
||||||
|
FROM alarm_events ae2
|
||||||
|
WHERE ae2.eventid = ae.eventid
|
||||||
|
AND ae2.eventtype = 1
|
||||||
|
AND ae2.eventtime >= ae.eventtime
|
||||||
|
) AS clear_time
|
||||||
|
FROM alarm_events ae
|
||||||
|
WHERE
|
||||||
|
ae.eventtime BETWEEN :startDate AND :endDate
|
||||||
|
AND ae.eventtype = 0
|
||||||
|
AND (ae.source LIKE '%Chute%' OR ae.source LIKE '%ChuteStatus%')
|
||||||
|
),
|
||||||
|
LaneMapping AS (
|
||||||
|
SELECT
|
||||||
|
id AS record_id,
|
||||||
|
strvalue AS tag_value,
|
||||||
|
CASE
|
||||||
|
WHEN strvalue LIKE '%Chute[%' THEN
|
||||||
|
CAST(SUBSTRING(strvalue, LOCATE('Chute[', strvalue) + 6,
|
||||||
|
LOCATE(']', strvalue, LOCATE('Chute[', strvalue)) - LOCATE('Chute[', strvalue) - 6) AS UNSIGNED)
|
||||||
|
WHEN strvalue LIKE '%Chute[_%' THEN
|
||||||
|
CAST(SUBSTRING(strvalue, LOCATE('Chute_', strvalue) + 6) AS UNSIGNED)
|
||||||
|
WHEN strvalue LIKE '%Chute%' THEN
|
||||||
|
CAST(REGEXP_SUBSTR(strvalue, '[0-9]+') AS UNSIGNED)
|
||||||
|
ELSE NULL
|
||||||
|
END AS plc_index,
|
||||||
|
CASE
|
||||||
|
WHEN strvalue LIKE '%Chute[%' THEN
|
||||||
|
CASE
|
||||||
|
WHEN CAST(SUBSTRING(strvalue, LOCATE('Chute[', strvalue) + 6,
|
||||||
|
LOCATE(']', strvalue, LOCATE('Chute[', strvalue)) - LOCATE('Chute[', strvalue) - 6) AS UNSIGNED) BETWEEN 1 AND 30
|
||||||
|
THEN 101 + (CAST(SUBSTRING(strvalue, LOCATE('Chute[', strvalue) + 6,
|
||||||
|
LOCATE(']', strvalue, LOCATE('Chute[', strvalue)) - LOCATE('Chute[', strvalue) - 6) AS UNSIGNED) - 1)
|
||||||
|
WHEN CAST(SUBSTRING(strvalue, LOCATE('Chute[', strvalue) + 6,
|
||||||
|
LOCATE(']', strvalue, LOCATE('Chute[', strvalue)) - LOCATE('Chute[', strvalue) - 6) AS UNSIGNED) BETWEEN 31 AND 60
|
||||||
|
THEN 201 + (CAST(SUBSTRING(strvalue, LOCATE('Chute[', strvalue) + 6,
|
||||||
|
LOCATE(']', strvalue, LOCATE('Chute[', strvalue)) - LOCATE('Chute[', strvalue) - 6) AS UNSIGNED) - 31)
|
||||||
|
ELSE NULL
|
||||||
|
END
|
||||||
|
WHEN strvalue LIKE '%Chute[_%' THEN
|
||||||
|
CASE
|
||||||
|
WHEN CAST(SUBSTRING(strvalue, LOCATE('Chute_', strvalue) + 6) AS UNSIGNED) BETWEEN 1 AND 30
|
||||||
|
THEN 101 + (CAST(SUBSTRING(strvalue, LOCATE('Chute_', strvalue) + 6) AS UNSIGNED) - 1)
|
||||||
|
WHEN CAST(SUBSTRING(strvalue, LOCATE('Chute_', strvalue) + 6) AS UNSIGNED) BETWEEN 31 AND 60
|
||||||
|
THEN 201 + (CAST(SUBSTRING(strvalue, LOCATE('Chute_', strvalue) + 6) AS UNSIGNED) - 31)
|
||||||
|
ELSE NULL
|
||||||
|
END
|
||||||
|
WHEN strvalue LIKE '%Chute%' THEN
|
||||||
|
CASE
|
||||||
|
WHEN CAST(REGEXP_SUBSTR(strvalue, '[0-9]+') AS UNSIGNED) BETWEEN 1 AND 30
|
||||||
|
THEN 101 + (CAST(REGEXP_SUBSTR(strvalue, '[0-9]+') AS UNSIGNED) - 1)
|
||||||
|
WHEN CAST(REGEXP_SUBSTR(strvalue, '[0-9]+') AS UNSIGNED) BETWEEN 31 AND 60
|
||||||
|
THEN 201 + (CAST(REGEXP_SUBSTR(strvalue, '[0-9]+') AS UNSIGNED) - 31)
|
||||||
|
ELSE NULL
|
||||||
|
END
|
||||||
|
ELSE NULL
|
||||||
|
END AS lane_number
|
||||||
|
FROM alarm_event_data
|
||||||
|
WHERE propname = 'Tag' AND strvalue LIKE '%Chute%'
|
||||||
|
),
|
||||||
|
JamEvents AS (
|
||||||
|
SELECT DISTINCT
|
||||||
|
lm.lane_number,
|
||||||
|
ad.event_uuid,
|
||||||
|
ad.active_time,
|
||||||
|
ad.clear_time
|
||||||
|
FROM LaneMapping lm
|
||||||
|
INNER JOIN AlarmData ad ON lm.record_id = ad.record_id
|
||||||
|
INNER JOIN alarm_event_data aed ON ad.record_id = aed.id
|
||||||
|
WHERE aed.propname = 'Jam' AND aed.strvalue = '1'
|
||||||
|
),
|
||||||
|
FullEvents AS (
|
||||||
|
SELECT DISTINCT
|
||||||
|
lm.lane_number,
|
||||||
|
ad.event_uuid,
|
||||||
|
ad.active_time,
|
||||||
|
ad.clear_time
|
||||||
|
FROM LaneMapping lm
|
||||||
|
INNER JOIN AlarmData ad ON lm.record_id = ad.record_id
|
||||||
|
INNER JOIN alarm_event_data aed ON ad.record_id = aed.id
|
||||||
|
WHERE aed.propname = 'Full' AND aed.strvalue = '1'
|
||||||
|
),
|
||||||
|
Aggregated AS (
|
||||||
|
SELECT
|
||||||
|
CONCAT('S02_', dl.lane_number, 'CH') AS lane,
|
||||||
|
COALESCE(j.jam_count, 0) AS jam_count,
|
||||||
|
COALESCE(f.full_count, 0) AS full_count,
|
||||||
|
COALESCE(j.jam_duration_seconds, 0) AS jam_duration_seconds,
|
||||||
|
COALESCE(f.full_duration_seconds, 0) AS full_duration_seconds
|
||||||
|
FROM DesiredLanes dl
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
lane_number,
|
||||||
|
COUNT(DISTINCT event_uuid) AS jam_count,
|
||||||
|
SUM(TIMESTAMPDIFF(SECOND, active_time, COALESCE(clear_time, NOW()))) AS jam_duration_seconds
|
||||||
|
FROM JamEvents
|
||||||
|
GROUP BY lane_number
|
||||||
|
) j ON dl.lane_number = j.lane_number
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
lane_number,
|
||||||
|
COUNT(DISTINCT event_uuid) AS full_count,
|
||||||
|
SUM(TIMESTAMPDIFF(SECOND, active_time, COALESCE(clear_time, NOW()))) AS full_duration_seconds
|
||||||
|
FROM FullEvents
|
||||||
|
GROUP BY lane_number
|
||||||
|
) f ON dl.lane_number = f.lane_number
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
lane AS Lane,
|
||||||
|
jam_count AS JamCount,
|
||||||
|
full_count AS FullCount,
|
||||||
|
COALESCE(SEC_TO_TIME(jam_duration_seconds), '00:00:00') AS JamDuration,
|
||||||
|
COALESCE(SEC_TO_TIME(full_duration_seconds), '00:00:00') AS FullDuration
|
||||||
|
FROM Aggregated
|
||||||
|
ORDER BY lane;
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "SEC",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 1,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "MariaDB",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "c61c20203cac71c18a7c69216672ce9b1cc24d28ebf72a8921f4adcf5c066c7b",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "external",
|
||||||
|
"timestamp": "2025-08-04T14:29:26Z"
|
||||||
|
},
|
||||||
|
"syntaxProvider": "class com.adbs.syntax.MySQLSyntaxProvider",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "startDate",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "endDate",
|
||||||
|
"sqlType": 8
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
SELECT alltable.t_stamp,
|
||||||
|
'S03' AS SorterName,
|
||||||
|
alltable.ParcelID,
|
||||||
|
'S03aa' AS ScannerName,
|
||||||
|
'0' AS IMGID,
|
||||||
|
alltable.ScanLabel,
|
||||||
|
alltable.ScanStatus,
|
||||||
|
alltable.Length,
|
||||||
|
alltable.AssignmentScanHist,
|
||||||
|
alltable.DivertStatus,
|
||||||
|
alltable.DEST_REQ,
|
||||||
|
alltable.ACTUAL_DEST,
|
||||||
|
alltable.SortCode
|
||||||
|
FROM alltable
|
||||||
|
WHERE alltable.t_stamp BETWEEN :starttime AND :endtime
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"scope": "DG",
|
||||||
|
"version": 2,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"query.sql"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"useMaxReturnSize": false,
|
||||||
|
"autoBatchEnabled": false,
|
||||||
|
"fallbackValue": "",
|
||||||
|
"maxReturnSize": 100,
|
||||||
|
"cacheUnit": "SEC",
|
||||||
|
"type": "Query",
|
||||||
|
"enabled": true,
|
||||||
|
"cacheAmount": 1,
|
||||||
|
"cacheEnabled": false,
|
||||||
|
"database": "MariaDB",
|
||||||
|
"fallbackEnabled": false,
|
||||||
|
"lastModificationSignature": "5306f5c00a239a7312c276bbbf14b8473d26ef35c449ee29394069e2621301b0",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"zone": "",
|
||||||
|
"role": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "external",
|
||||||
|
"timestamp": "2025-08-04T14:29:26Z"
|
||||||
|
},
|
||||||
|
"syntaxProvider": "class com.adbs.syntax.MySQLSyntaxProvider",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "endtime",
|
||||||
|
"sqlType": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": "starttime",
|
||||||
|
"sqlType": 8
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
51
SAT9_SCADA/ignition/script-python/utils/code.py
Normal file
51
SAT9_SCADA/ignition/script-python/utils/code.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
def handleTagHighlight(view, currentValue):
|
||||||
|
tag_priority = currentValue.value
|
||||||
|
|
||||||
|
if tag_priority == None:
|
||||||
|
return
|
||||||
|
|
||||||
|
parts = str(tag_priority).split("||")
|
||||||
|
tag = parts[0]
|
||||||
|
|
||||||
|
splitedTag = tag.split("/")
|
||||||
|
|
||||||
|
deviceName = splitedTag[-1]
|
||||||
|
|
||||||
|
Docked_East_Map = {
|
||||||
|
"VFD" : "Docked-East-VFD",
|
||||||
|
"MCM" : "Docked-East-MCM"
|
||||||
|
}
|
||||||
|
|
||||||
|
Docked_East_View = Docked_East_Map["VFD"]
|
||||||
|
|
||||||
|
if "PE" in deviceName:
|
||||||
|
tag = "/".join(splitedTag[:2]) + "/Conveyor/" + deviceName[:-3] + "VFD1"
|
||||||
|
|
||||||
|
if "MCM" in deviceName:
|
||||||
|
Docked_East_View = Docked_East_Map["MCM"]
|
||||||
|
|
||||||
|
components = view.rootContainer.getChildren()
|
||||||
|
|
||||||
|
priority = parts[1]
|
||||||
|
|
||||||
|
foundMatch = False
|
||||||
|
|
||||||
|
# clear all highlights and apply new one when found
|
||||||
|
for child in components:
|
||||||
|
params = child.props.get("params", {})
|
||||||
|
tagProps = params.get("tagProps", {})
|
||||||
|
tagsList = list(tagProps)
|
||||||
|
|
||||||
|
if len(tagsList) == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
|
child.props.style.classes = ""
|
||||||
|
|
||||||
|
tagPath = tagsList[0]
|
||||||
|
|
||||||
|
if tag == tagPath:
|
||||||
|
child.props.style["classes"] = "Highlight/Pulse-" + priority
|
||||||
|
system.perspective.openDock(Docked_East_View, params={'tagProps': tagProps})
|
||||||
|
foundMatch = True
|
||||||
|
|
||||||
|
return foundMatch
|
||||||
17
SAT9_SCADA/ignition/script-python/utils/resource.json
Normal file
17
SAT9_SCADA/ignition/script-python/utils/resource.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"scope": "A",
|
||||||
|
"version": 1,
|
||||||
|
"restricted": false,
|
||||||
|
"overridable": true,
|
||||||
|
"files": [
|
||||||
|
"code.py"
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"lastModification": {
|
||||||
|
"actor": "admin",
|
||||||
|
"timestamp": "2025-08-04T14:49:37Z"
|
||||||
|
},
|
||||||
|
"hintScope": 2,
|
||||||
|
"lastModificationSignature": "93a8270c967cab2d3f0a4b9fb6f635ef1cd2bf9137a6d191679be9e98842eb99"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1585,75 +1585,6 @@
|
|||||||
"results": {
|
"results": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"selection": {
|
|
||||||
"data": [
|
|
||||||
{
|
|
||||||
"Description": {
|
|
||||||
"style": {
|
|
||||||
"classes": "Alarms-Styles/Diagnostic"
|
|
||||||
},
|
|
||||||
"value": "FL2078_2_VFD1 - Voltage"
|
|
||||||
},
|
|
||||||
"Device": {
|
|
||||||
"style": {
|
|
||||||
"classes": "Alarms-Styles/Diagnostic"
|
|
||||||
},
|
|
||||||
"value": "FL2078_2_VFD1"
|
|
||||||
},
|
|
||||||
"Duration": {
|
|
||||||
"style": {
|
|
||||||
"classes": "Alarms-Styles/Diagnostic"
|
|
||||||
},
|
|
||||||
"value": "07:05:16"
|
|
||||||
},
|
|
||||||
"FullTag": {
|
|
||||||
"style": {
|
|
||||||
"classes": "Alarms-Styles/Diagnostic"
|
|
||||||
},
|
|
||||||
"value": "System/MCM01/Conveyor/FL2078_2_VFD1/Voltage"
|
|
||||||
},
|
|
||||||
"ID": {
|
|
||||||
"style": {
|
|
||||||
"classes": "Alarms-Styles/Diagnostic"
|
|
||||||
},
|
|
||||||
"value": 8
|
|
||||||
},
|
|
||||||
"Location": {
|
|
||||||
"style": {
|
|
||||||
"classes": "Alarms-Styles/Diagnostic"
|
|
||||||
},
|
|
||||||
"value": "MCM01"
|
|
||||||
},
|
|
||||||
"Priority": {
|
|
||||||
"style": {
|
|
||||||
"classes": "Alarms-Styles/Diagnostic"
|
|
||||||
},
|
|
||||||
"value": "Diagnostic"
|
|
||||||
},
|
|
||||||
"StartTimestamp": {
|
|
||||||
"style": {
|
|
||||||
"classes": "Alarms-Styles/Diagnostic"
|
|
||||||
},
|
|
||||||
"value": {
|
|
||||||
"$": [
|
|
||||||
"ts",
|
|
||||||
0,
|
|
||||||
1750962272012
|
|
||||||
],
|
|
||||||
"$ts": 1750936755000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Tag": {
|
|
||||||
"style": {
|
|
||||||
"classes": "Alarms-Styles/Diagnostic"
|
|
||||||
},
|
|
||||||
"value": "FL2078_2_VFD1.HMI.Voltage"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"selectedColumn": "Duration",
|
|
||||||
"selectedRow": 2
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": "ia.display.table"
|
"type": "ia.display.table"
|
||||||
@ -3350,7 +3281,7 @@
|
|||||||
"$": [
|
"$": [
|
||||||
"ts",
|
"ts",
|
||||||
192,
|
192,
|
||||||
1750938073345
|
1754319546080
|
||||||
],
|
],
|
||||||
"$ts": 1750435156149
|
"$ts": 1750435156149
|
||||||
},
|
},
|
||||||
@ -3358,7 +3289,7 @@
|
|||||||
"$": [
|
"$": [
|
||||||
"ts",
|
"ts",
|
||||||
192,
|
192,
|
||||||
1750938073345
|
1754319546081
|
||||||
],
|
],
|
||||||
"$ts": 1750436956149
|
"$ts": 1750436956149
|
||||||
}
|
}
|
||||||
@ -4377,24 +4308,6 @@
|
|||||||
"pager": {
|
"pager": {
|
||||||
"bottom": false
|
"bottom": false
|
||||||
},
|
},
|
||||||
"selection": {
|
|
||||||
"data": [
|
|
||||||
{
|
|
||||||
"Description": "MCM01 - Hello world",
|
|
||||||
"Device": "MCM01",
|
|
||||||
"Duration": "06:30:56",
|
|
||||||
"EndTimestamp": null,
|
|
||||||
"FullTag": "System/MCM01/MCM01/Beacon_Light",
|
|
||||||
"ID": 12,
|
|
||||||
"Location": "MCM01",
|
|
||||||
"Priority": "High",
|
|
||||||
"StartTimestamp": "Thu Jun 26 2025 15:57:50 GMT+0400 (Georgia Standard Time)",
|
|
||||||
"Tag": "MCM01.HMI.Beacon_Light"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"selectedColumn": "EndTimestamp",
|
|
||||||
"selectedRow": 0
|
|
||||||
},
|
|
||||||
"style": {
|
"style": {
|
||||||
"margin": 20
|
"margin": 20
|
||||||
}
|
}
|
||||||
@ -4518,7 +4431,7 @@
|
|||||||
"$": [
|
"$": [
|
||||||
"ts",
|
"ts",
|
||||||
192,
|
192,
|
||||||
1750938073345
|
1754319546080
|
||||||
],
|
],
|
||||||
"$ts": 1750435156149
|
"$ts": 1750435156149
|
||||||
},
|
},
|
||||||
@ -4526,7 +4439,7 @@
|
|||||||
"$": [
|
"$": [
|
||||||
"ts",
|
"ts",
|
||||||
192,
|
192,
|
||||||
1750938073345
|
1754319546080
|
||||||
],
|
],
|
||||||
"$ts": 1750436956149
|
"$ts": 1750436956149
|
||||||
},
|
},
|
||||||
@ -4785,7 +4698,6 @@
|
|||||||
"contentStyle": {
|
"contentStyle": {
|
||||||
"classes": "Background-Styles/Grey-Background"
|
"classes": "Background-Styles/Grey-Background"
|
||||||
},
|
},
|
||||||
"currentTabIndex": 1,
|
|
||||||
"menuType": "modern",
|
"menuType": "modern",
|
||||||
"style": {
|
"style": {
|
||||||
"classes": "Background-Styles/Grey-Background"
|
"classes": "Background-Styles/Grey-Background"
|
||||||
|
|||||||
@ -6,9 +6,9 @@
|
|||||||
"$": [
|
"$": [
|
||||||
"ts",
|
"ts",
|
||||||
192,
|
192,
|
||||||
1710802671820
|
1754319546004
|
||||||
],
|
],
|
||||||
"$ts": 1710802671820
|
"$ts": 1754319545822
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -78,6 +78,143 @@
|
|||||||
"grow": 0,
|
"grow": 0,
|
||||||
"shrink": 0
|
"shrink": 0
|
||||||
},
|
},
|
||||||
|
"instances": [
|
||||||
|
{
|
||||||
|
"Counts": {
|
||||||
|
"Diag": 0,
|
||||||
|
"High": 0,
|
||||||
|
"Low": 0,
|
||||||
|
"Medium": 0
|
||||||
|
},
|
||||||
|
"area": "Bulk Inbound",
|
||||||
|
"instancePosition": {},
|
||||||
|
"instanceStyle": {
|
||||||
|
"classes": "",
|
||||||
|
"margin": "5px"
|
||||||
|
},
|
||||||
|
"subarea": "",
|
||||||
|
"tagProps": [
|
||||||
|
"MCM05",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Counts": {
|
||||||
|
"Diag": 0,
|
||||||
|
"High": 0,
|
||||||
|
"Low": 0,
|
||||||
|
"Medium": 0
|
||||||
|
},
|
||||||
|
"area": "Fluid Inbound",
|
||||||
|
"instancePosition": {},
|
||||||
|
"instanceStyle": {
|
||||||
|
"classes": "",
|
||||||
|
"margin": "5px"
|
||||||
|
},
|
||||||
|
"subarea": "",
|
||||||
|
"tagProps": [
|
||||||
|
"MCM04",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Counts": {
|
||||||
|
"Diag": 0,
|
||||||
|
"High": 0,
|
||||||
|
"Low": 0,
|
||||||
|
"Medium": 0
|
||||||
|
},
|
||||||
|
"area": "Fluid Inbound",
|
||||||
|
"instancePosition": {},
|
||||||
|
"instanceStyle": {
|
||||||
|
"classes": "",
|
||||||
|
"margin": "5px"
|
||||||
|
},
|
||||||
|
"subarea": "",
|
||||||
|
"tagProps": [
|
||||||
|
"MCM03",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Counts": {
|
||||||
|
"Diag": 0,
|
||||||
|
"High": 0,
|
||||||
|
"Low": 0,
|
||||||
|
"Medium": 0
|
||||||
|
},
|
||||||
|
"area": "Sorter Destination and Chutes",
|
||||||
|
"instancePosition": {},
|
||||||
|
"instanceStyle": {
|
||||||
|
"classes": "",
|
||||||
|
"margin": "5px"
|
||||||
|
},
|
||||||
|
"subarea": "",
|
||||||
|
"tagProps": [
|
||||||
|
"MCM02",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Counts": {
|
||||||
|
"Diag": 0,
|
||||||
|
"High": 0,
|
||||||
|
"Low": 0,
|
||||||
|
"Medium": 0
|
||||||
|
},
|
||||||
|
"area": "Sorter Destination, Chutes and Bypass",
|
||||||
|
"instancePosition": {},
|
||||||
|
"instanceStyle": {
|
||||||
|
"classes": "",
|
||||||
|
"margin": "5px"
|
||||||
|
},
|
||||||
|
"subarea": "",
|
||||||
|
"tagProps": [
|
||||||
|
"MCM01",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value",
|
||||||
|
"value"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"path": "Symbol-Views/Controller-Views/ControllerStatus",
|
"path": "Symbol-Views/Controller-Views/ControllerStatus",
|
||||||
"style": {
|
"style": {
|
||||||
"overflow": "visible"
|
"overflow": "visible"
|
||||||
@ -89,65 +226,26 @@
|
|||||||
],
|
],
|
||||||
"custom": {
|
"custom": {
|
||||||
"Devices": [
|
"Devices": [
|
||||||
"ARSAW1301",
|
[
|
||||||
"PLC03",
|
"MCM01",
|
||||||
"ARSAW1302",
|
"Bulk Inbound"
|
||||||
"PLC01",
|
],
|
||||||
"PLC02",
|
[
|
||||||
"PLC98",
|
"MCM02",
|
||||||
"ARSAW1305",
|
"Fluid Inbound"
|
||||||
"ARSAW1503",
|
],
|
||||||
"PLC08",
|
[
|
||||||
"PLC99",
|
"MCM03",
|
||||||
"ARSAW1306",
|
"Fluid Inbound"
|
||||||
"ARSAW1504",
|
],
|
||||||
"ARSAW1501",
|
[
|
||||||
"ARSAW1303",
|
"MCM05",
|
||||||
"PLC06",
|
"Sorter Destination and Chutes"
|
||||||
"PLC07",
|
],
|
||||||
"ARSAW1304",
|
[
|
||||||
"ARSAW1502",
|
"MCM04",
|
||||||
"ARSAW1309",
|
"Sorter Destination, Chutes and Bypass"
|
||||||
"ARSAW1507",
|
]
|
||||||
"ARSAW1508",
|
|
||||||
"PLC09",
|
|
||||||
"ARSAW1307",
|
|
||||||
"ARSAW1505",
|
|
||||||
"ARSAW1308",
|
|
||||||
"ARSAW1506",
|
|
||||||
"PLC20",
|
|
||||||
"ARSAW1509",
|
|
||||||
"PLC14",
|
|
||||||
"PLC80",
|
|
||||||
"PLC81",
|
|
||||||
"PLC82",
|
|
||||||
"PLC16",
|
|
||||||
"FSC10",
|
|
||||||
"PLC21",
|
|
||||||
"PLC22",
|
|
||||||
"PLC69",
|
|
||||||
"PLC25",
|
|
||||||
"PLC26",
|
|
||||||
"PLC23",
|
|
||||||
"PLC24",
|
|
||||||
"PLC97",
|
|
||||||
"PLC27",
|
|
||||||
"PLC61",
|
|
||||||
"PLC60",
|
|
||||||
"PLC1000",
|
|
||||||
"PLC13",
|
|
||||||
"ARSAW1312",
|
|
||||||
"ARSAW1510",
|
|
||||||
"ARSAW1511",
|
|
||||||
"ARSAW1310",
|
|
||||||
"ARSAW1311",
|
|
||||||
"ARSAW1512",
|
|
||||||
"PLC70",
|
|
||||||
"PLC71",
|
|
||||||
"PLC32",
|
|
||||||
"PLC30",
|
|
||||||
"PLC31",
|
|
||||||
"PLC15"
|
|
||||||
],
|
],
|
||||||
"count": "value",
|
"count": "value",
|
||||||
"delay": 2000,
|
"delay": 2000,
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
"plc": "value",
|
"plc": "value",
|
||||||
"priority": 0,
|
"priority": 0,
|
||||||
"priority_string": "No active alarms",
|
"priority_string": "No active alarms",
|
||||||
"searchId": "value",
|
"searchId": "PLC01",
|
||||||
"state": 5
|
"state": 5
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
@ -481,7 +481,7 @@
|
|||||||
"meta.visible": {
|
"meta.visible": {
|
||||||
"binding": {
|
"binding": {
|
||||||
"config": {
|
"config": {
|
||||||
"path": "session.custom.alarm_filter.show_safety"
|
"path": "session.custom.alarm_filter.show_buttons"
|
||||||
},
|
},
|
||||||
"type": "property"
|
"type": "property"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,62 +1,62 @@
|
|||||||
WITH Active AS (
|
SELECT
|
||||||
SELECT
|
Active.id AS ID,
|
||||||
ae.id,
|
Active.eventtime AS StartTimestamp,
|
||||||
ae.eventtime,
|
NULL AS EndTimestamp, -- still active
|
||||||
ae.eventid,
|
CONCAT(
|
||||||
ae.source,
|
LPAD(FLOOR(Active.duration_seconds / 3600), 2, '0'), ':',
|
||||||
ae.priority,
|
LPAD(FLOOR((Active.duration_seconds % 3600) / 60), 2, '0'), ':',
|
||||||
ae.displaypath,
|
LPAD(Active.duration_seconds % 60, 2, '0')
|
||||||
TIMESTAMPDIFF(SECOND, ae.eventtime, NOW()) AS duration_seconds
|
) AS Duration,
|
||||||
FROM alarm_events ae
|
CONCAT(Active.displaypath, ' - ', SUBSTRING_INDEX(Active.source, ':/alm:', -1)) AS Description,
|
||||||
WHERE ae.eventtype = 0
|
CASE Active.priority
|
||||||
AND NOT EXISTS (
|
WHEN 0 THEN 'Diagnostic'
|
||||||
SELECT 1 FROM alarm_events ae_clear
|
WHEN 1 THEN 'Low'
|
||||||
WHERE ae_clear.eventid = ae.eventid
|
WHEN 2 THEN 'Medium'
|
||||||
AND ae_clear.eventtype = 1
|
WHEN 3 THEN 'High'
|
||||||
)
|
WHEN 4 THEN 'Critical'
|
||||||
AND ae.displaypath NOT LIKE '%System Startup%'
|
ELSE 'Unknown'
|
||||||
AND ae.source NOT LIKE '%System Startup%'
|
END AS Priority,
|
||||||
-- Priority filter using FIND_IN_SET for comma-separated values
|
CONCAT(
|
||||||
AND (
|
Active.displaypath,
|
||||||
:priorityList IS NULL
|
'.HMI.',
|
||||||
OR :priorityList = ''
|
SUBSTRING_INDEX(aed.strValue, '/', -1)
|
||||||
OR FIND_IN_SET(ae.priority, :priorityList) > 0
|
) AS Tag,
|
||||||
)
|
SUBSTRING_INDEX(SUBSTRING_INDEX(aed.strValue, '/', 2), '/', -1) AS Location,
|
||||||
GROUP BY ae.id
|
|
||||||
),
|
|
||||||
SingleMyTag AS (
|
|
||||||
SELECT aed.id, aed.strValue
|
|
||||||
FROM alarm_event_data aed
|
|
||||||
WHERE aed.propname = 'myTag'
|
|
||||||
GROUP BY aed.id
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
Active.id AS ID,
|
|
||||||
Active.eventtime AS StartTimestamp,
|
|
||||||
NULL AS EndTimestamp, -- no end time since it's still active
|
|
||||||
CONCAT(
|
|
||||||
LPAD(FLOOR(Active.duration_seconds / 3600), 2, '0'), ':',
|
|
||||||
LPAD(FLOOR((Active.duration_seconds % 3600) / 60), 2, '0'), ':',
|
|
||||||
LPAD(Active.duration_seconds % 60, 2, '0')
|
|
||||||
) AS Duration,
|
|
||||||
CONCAT(Active.displaypath, ' - ', SUBSTRING_INDEX(Active.source, ':/alm:', -1)) AS Description,
|
|
||||||
CASE Active.priority
|
|
||||||
WHEN 0 THEN 'Diagnostic'
|
|
||||||
WHEN 1 THEN 'Low'
|
|
||||||
WHEN 2 THEN 'Medium'
|
|
||||||
WHEN 3 THEN 'High'
|
|
||||||
WHEN 4 THEN 'Critical'
|
|
||||||
ELSE 'Unknown'
|
|
||||||
END AS Priority,
|
|
||||||
CONCAT(
|
|
||||||
Active.displaypath,
|
|
||||||
'.HMI.',
|
|
||||||
SUBSTRING_INDEX(aed.strValue, '/', -1)
|
|
||||||
) AS Tag,
|
|
||||||
SUBSTRING_INDEX(SUBSTRING_INDEX(aed.strValue, '/', 2), '/', -1) AS Location
,
|
|
||||||
aed.strValue AS FullTag,
|
aed.strValue AS FullTag,
|
||||||
Active.displaypath as Device
|
Active.displaypath as Device
|
||||||
FROM Active
|
FROM
|
||||||
LEFT JOIN SingleMyTag aed
|
(
|
||||||
ON aed.id = Active.id
|
SELECT
|
||||||
ORDER BY Active.eventtime DESC;
|
ae.id,
|
||||||
|
ae.eventtime,
|
||||||
|
ae.eventid,
|
||||||
|
ae.source,
|
||||||
|
ae.priority,
|
||||||
|
ae.displaypath,
|
||||||
|
TIMESTAMPDIFF(SECOND, ae.eventtime, NOW()) AS duration_seconds
|
||||||
|
FROM alarm_events ae
|
||||||
|
WHERE ae.eventtype = 0
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM alarm_events ae_clear
|
||||||
|
WHERE ae_clear.eventid = ae.eventid
|
||||||
|
AND ae_clear.eventtype = 1
|
||||||
|
)
|
||||||
|
AND ae.displaypath NOT LIKE '%System Startup%'
|
||||||
|
AND ae.source NOT LIKE '%System Startup%'
|
||||||
|
AND (
|
||||||
|
:priorityList IS NULL
|
||||||
|
OR :priorityList = ''
|
||||||
|
OR FIND_IN_SET(ae.priority, :priorityList) > 0
|
||||||
|
)
|
||||||
|
GROUP BY ae.id
|
||||||
|
) AS Active
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT aed.id, aed.strValue
|
||||||
|
FROM alarm_event_data aed
|
||||||
|
WHERE aed.propname = 'myTag'
|
||||||
|
GROUP BY aed.id
|
||||||
|
) AS aed
|
||||||
|
ON aed.id = Active.id
|
||||||
|
ORDER BY Active.eventtime DESC;
|
||||||
|
|||||||
@ -1,20 +1,3 @@
|
|||||||
WITH Active AS (
|
|
||||||
SELECT
|
|
||||||
ae.id,
|
|
||||||
ae.eventid,
|
|
||||||
ae.priority,
|
|
||||||
aed.strValue
|
|
||||||
FROM alarm_events ae
|
|
||||||
LEFT JOIN alarm_event_data aed ON ae.id = aed.id AND aed.propname = 'myTag'
|
|
||||||
WHERE ae.eventtype = 0
|
|
||||||
AND NOT EXISTS (
|
|
||||||
SELECT 1 FROM alarm_events ae_clear
|
|
||||||
WHERE ae_clear.eventid = ae.eventid
|
|
||||||
AND ae_clear.eventtype = 1
|
|
||||||
)
|
|
||||||
AND ae.displaypath NOT LIKE '%System Startup%'
|
|
||||||
AND ae.source NOT LIKE '%System Startup%'
|
|
||||||
)
|
|
||||||
SELECT
|
SELECT
|
||||||
SUBSTRING_INDEX(SUBSTRING_INDEX(strValue, '/', 2), '/', -1) AS Location,
|
SUBSTRING_INDEX(SUBSTRING_INDEX(strValue, '/', 2), '/', -1) AS Location,
|
||||||
CASE priority
|
CASE priority
|
||||||
@ -26,6 +9,25 @@ SELECT
|
|||||||
ELSE 'Unknown'
|
ELSE 'Unknown'
|
||||||
END AS Priority,
|
END AS Priority,
|
||||||
COUNT(*) AS Count
|
COUNT(*) AS Count
|
||||||
FROM Active
|
FROM (
|
||||||
|
SELECT
|
||||||
|
ae.id,
|
||||||
|
ae.eventid,
|
||||||
|
ae.priority,
|
||||||
|
aed.strValue
|
||||||
|
FROM alarm_events ae
|
||||||
|
LEFT JOIN alarm_event_data aed
|
||||||
|
ON ae.id = aed.id
|
||||||
|
AND aed.propname = 'myTag'
|
||||||
|
WHERE ae.eventtype = 0
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM alarm_events ae_clear
|
||||||
|
WHERE ae_clear.eventid = ae.eventid
|
||||||
|
AND ae_clear.eventtype = 1
|
||||||
|
)
|
||||||
|
AND ae.displaypath NOT LIKE '%System Startup%'
|
||||||
|
AND ae.source NOT LIKE '%System Startup%'
|
||||||
|
) AS Active
|
||||||
GROUP BY Location, Priority
|
GROUP BY Location, Priority
|
||||||
ORDER BY Location, Priority;
|
ORDER BY Location, Priority;
|
||||||
|
|||||||
@ -1,71 +1,67 @@
|
|||||||
WITH Active AS (
|
SELECT
|
||||||
SELECT
|
Active.id AS ID,
|
||||||
ae.id,
|
Active.eventtime AS StartTimestamp,
|
||||||
ae.eventtime,
|
Clear.eventtime AS EndTimestamp,
|
||||||
ae.eventid,
|
|
||||||
ae.source,
|
CONCAT(
|
||||||
ae.priority,
|
LPAD(FLOOR(Active.duration_seconds / 3600), 2, '0'), ':',
|
||||||
ae.displaypath,
|
LPAD(FLOOR((Active.duration_seconds % 3600) / 60), 2, '0'), ':',
|
||||||
TIMESTAMPDIFF(SECOND, ae.eventtime, COALESCE(ae_clear.eventtime, NOW())) AS duration_seconds
|
LPAD(Active.duration_seconds % 60, 2, '0')
|
||||||
FROM alarm_events ae
|
) AS Duration,
|
||||||
LEFT JOIN alarm_events ae_clear
|
|
||||||
ON ae.eventid = ae_clear.eventid AND ae_clear.eventtype = 1
|
CONCAT(Active.displaypath, ' - ', SUBSTRING_INDEX(Active.source, ':/alm:', -1)) AS Description,
|
||||||
WHERE ae.eventtype = 0
|
|
||||||
AND ae.displaypath NOT LIKE '%System Startup%'
|
CASE Active.priority
|
||||||
AND ae.source NOT LIKE '%System Startup%'
|
WHEN 0 THEN 'Diagnostic'
|
||||||
GROUP BY ae.id -- Ensure one row per alarm
|
WHEN 1 THEN 'Low'
|
||||||
),
|
WHEN 2 THEN 'Medium'
|
||||||
SingleMyTag AS (
|
WHEN 3 THEN 'High'
|
||||||
SELECT aed.id, aed.strValue
|
WHEN 4 THEN 'Critical'
|
||||||
FROM alarm_event_data aed
|
ELSE 'Unknown'
|
||||||
WHERE aed.propname = 'myTag'
|
END AS Priority,
|
||||||
GROUP BY aed.id -- Collapse duplicates by id
|
|
||||||
),
|
CONCAT(
|
||||||
SingleClear AS (
|
Active.displaypath,
|
||||||
SELECT eventid, MIN(eventtime) AS eventtime
|
'.HMI.',
|
||||||
FROM alarm_events
|
SUBSTRING_INDEX(aed.strValue, '/', -1)
|
||||||
WHERE eventtype = 1
|
) AS Tag,
|
||||||
GROUP BY eventid
|
|
||||||
)
|
SUBSTRING_INDEX(SUBSTRING_INDEX(aed.strValue, '/', 2), '/', -1) AS Location, aed.strValue AS FullTag,
|
||||||
|
Active.displaypath AS Device
|
||||||
SELECT
|
|
||||||
Active.id AS ID,
|
FROM (
|
||||||
Active.eventtime AS StartTimestamp,
|
SELECT
|
||||||
Clear.eventtime AS EndTimestamp,
|
ae.id,
|
||||||
|
ae.eventtime,
|
||||||
CONCAT(
|
ae.eventid,
|
||||||
LPAD(FLOOR(Active.duration_seconds / 3600), 2, '0'), ':',
|
ae.source,
|
||||||
LPAD(FLOOR((Active.duration_seconds % 3600) / 60), 2, '0'), ':',
|
ae.priority,
|
||||||
LPAD(Active.duration_seconds % 60, 2, '0')
|
ae.displaypath,
|
||||||
) AS Duration,
|
TIMESTAMPDIFF(SECOND, ae.eventtime, COALESCE(ae_clear.eventtime, NOW())) AS duration_seconds
|
||||||
|
FROM alarm_events ae
|
||||||
CONCAT(Active.displaypath, ' - ', SUBSTRING_INDEX(Active.source, ':/alm:', -1)) AS Description,
|
LEFT JOIN alarm_events ae_clear
|
||||||
|
ON ae.eventid = ae_clear.eventid
|
||||||
CASE Active.priority
|
AND ae_clear.eventtype = 1
|
||||||
WHEN 0 THEN 'Diagnostic'
|
WHERE ae.eventtype = 0
|
||||||
WHEN 1 THEN 'Low'
|
AND ae.displaypath NOT LIKE '%System Startup%'
|
||||||
WHEN 2 THEN 'Medium'
|
AND ae.source NOT LIKE '%System Startup%'
|
||||||
WHEN 3 THEN 'High'
|
GROUP BY ae.id
|
||||||
WHEN 4 THEN 'Critical'
|
) AS Active
|
||||||
ELSE 'Unknown'
|
|
||||||
END AS Priority,
|
LEFT JOIN (
|
||||||
|
SELECT eventid, MIN(eventtime) AS eventtime
|
||||||
CONCAT(
|
FROM alarm_events
|
||||||
Active.displaypath,
|
WHERE eventtype = 1
|
||||||
'.HMI.',
|
GROUP BY eventid
|
||||||
SUBSTRING_INDEX(aed.strValue, '/', -1)
|
) AS Clear
|
||||||
) AS Tag,
|
ON Active.eventid = Clear.eventid
|
||||||
|
|
||||||
SUBSTRING_INDEX(SUBSTRING_INDEX(aed.strValue, '/', 2), '/', -1) AS Location
,
|
LEFT JOIN (
|
||||||
aed.strValue AS FullTag,
|
SELECT aed.id, aed.strValue
|
||||||
Active.displaypath as Device
|
FROM alarm_event_data aed
|
||||||
|
WHERE aed.propname = 'myTag'
|
||||||
FROM Active
|
GROUP BY aed.id
|
||||||
|
) AS aed
|
||||||
LEFT JOIN SingleClear Clear
|
ON aed.id = Active.id
|
||||||
ON Active.eventid = Clear.eventid
|
|
||||||
|
ORDER BY Active.eventtime DESC;
|
||||||
LEFT JOIN SingleMyTag aed
|
|
||||||
ON aed.id = Active.id
|
|
||||||
|
|
||||||
ORDER BY Active.eventtime DESC;
|
|
||||||
@ -7,13 +7,11 @@ def handleClick(data):
|
|||||||
MCM = row.get("Location", "")
|
MCM = row.get("Location", "")
|
||||||
|
|
||||||
MCM_Pages_Map = {
|
MCM_Pages_Map = {
|
||||||
"MCM01": "Detailed-Views/MCM01 Fluid Inbound Merges 1-4",
|
"MCM01": "Detailed-Views/MCM01 Bulk Inbound",
|
||||||
"MCM02": "Detailed-Views/MCM02 Fluid Inbound Merges 5-7",
|
"MCM02": "Detailed-Views/MCM02 Fluid Inbound",
|
||||||
"MCM03": "Detailed-Views/MCM03 Non Con",
|
"MCM03": "Detailed-Views/MCM03 Fluid Inbound",
|
||||||
"MCM04": "Detailed-Views/MCM04 North Bulk Inbound, Fluid Outbound and Problem Solve",
|
"MCM04": "Detailed-Views/MCM04 Sorter Destination, Chutes and Bypass",
|
||||||
"MCM05": "Detailed-Views/MCM05 South Bulk Inbound, Fluid Outbound and Problem Solve",
|
"MCM05": "Detailed-Views/MCM05 Sorter Destination and Chutes",
|
||||||
"MCM06": "Detailed-Views/MCM06 Non Con",
|
|
||||||
"MCM07": "Detailed-Views/MCM07 Bypass",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user