Browse Source

SCADA MessageBoxes in Database

master
Evgeny Gagua 2 months ago
parent
commit
00be87cca7
  1. 2
      lib/controller/getMonitoringPlatformView.php
  2. 1093
      lib/controller/getScadaEditor.php
  3. 1
      lib/controller/getScadaStatus.php
  4. 26
      lib/controller/getStatus.php
  5. 22
      lib/javascript/jsapi_dynamic/argus_monitoring.js
  6. 2
      lib/javascript/jsapi_dynamic/argus_settings.js
  7. 5
      lib/php/argus/templates.php
  8. 20
      lib/upgrade_database.php
  9. 3
      style/style.css

2
lib/controller/getMonitoringPlatformView.php

@ -171,7 +171,7 @@
$vcount++;
};
$SCADA = "<td class=\"mon_scada_passive_panel\"><b>".$Labels->GetLabel('_SCADA_STATUS_')."</b><hr/><table width=\"100%\"><tr><td>".$Labels->GetLabel('_MOD_STATUS_').":</td><td colspan=4><div id=\"scada_status\" class=\"mon_scada_status_tag_na\">".$Labels->GetLabel('_NOT_ASSIGNED_')."</div></td></tr><tr><td>&nbsp</td><td id=\"scada_a\" class=\"mon_scada_head\">{$SCA_UT_TTL}</td><td id=\"scada_b\" class=\"mon_scada_head\">{$SCA_BT_TTL}</td><td id=\"scada_c\" class=\"mon_scada_head\">".$Labels->GetLabel('_HEALTH_')."</td><td id=\"scada_d\" class=\"mon_scada_head\">AUX</td></tr><tr><td>&nbsp;</td><td></td><td></td><td></td><td></td></tr></table></td>";
$ITEM_X="<table border=0 width=\"100%\" id=\"plat_table_{$CID}\"><tr>{$TOP}</tr><tr><td width=\"100%\">".createPlatformBackground( $CR['layout'], $CID, array()/*$MDD*/ )."</td></tr><tr>{$BOTTOM}</tr><tr>{$SCADA}</tr></table>";
$ITEM_X="<table border=0 width=\"100%\" id=\"plat_table_{$CID}\"><tr>{$TOP}</tr><tr><td width=\"100%\">".createPlatformBackground( $CR['layout'], $CID, array()/*$MDD*/ )."</td></tr><tr>{$BOTTOM}</tr><tr>{$SCADA}</tr></table><div id=\"scada_postbox_{$CID}\"></div>";
$PLAT_PARTS[] = str_ireplace( '%%%PLATFORM%MAP%%%', $ITEM_X, $ITEM );

1093
lib/controller/getScadaEditor.php
File diff suppressed because it is too large
View File

1
lib/controller/getScadaStatus.php

@ -26,6 +26,7 @@
$Data['outputs'][] = ($VO & 2)?true:false;
$Data['outputs'][] = ($VO & 4)?true:false;
$Data['outputs'][] = ($VO & 8)?true:false;
$Data['ov'] = $VO;
$VI = ($VV >> 8 ) & 0xFF;
$Data['inputs']=array();
$Data['inputs'][] = ($VI & 1)?true:false;

26
lib/controller/getStatus.php

@ -254,7 +254,7 @@
$Modules[] = $LD;
};
$Data['modules'] = $Modules;
$QS = "SELECT * FROM `modbus_modules` WHERE `platform_id`={$PID}";
$QS = "SELECT * FROM `modbus_modules` WHERE `platform_id`={$PID} AND `func`=3";
$RR = $DATABASE->Query( $QS );
$Data['scada'] = array();
if( count($RR) == 0 ) {
@ -262,21 +262,35 @@
} else {
$SM = $RR[0];
if( $SM['wm'] == 'D' ){
$Data['scada']['status']=1;
$Data['scada']['status']=0;
} else {
$SM['status'] = intval($SM['status']);
$Data['scada']['status']=$SM['status']+2;
if( $SM['status'] > 0 ){
$CV = intval($SM['values']);
$Data['scada']['A']= $CV & 0x01;
$Data['scada']['B']= $CV & 0x02;
$Data['scada']['C']= $CV & 0x04;
$Data['scada']['D']= $CV & 0x08;
$Data['scada']['A']= (($CV & 0x01) == 1);
$Data['scada']['B']= (($CV & 0x02) == 2);
$Data['scada']['C']= (($CV & 0x04) == 4);
$Data['scada']['D']= (($CV & 0x08) == 8);
};
};
};
$Data['train']=array( 'status'=>$TrainPos );
};
$QS = "SELECT * FROM `metro_platforms_mboxes` WHERE `platform_id`={$PID}";
$RR = $DATABASE->Query( $QS, false );
$Data['poster'] = array();
if( count( $RR ) ){
foreach( $RR as $M ){
$CR = array();
$CR['id'] = intval( $M['id'] );
$CR['status'] = intval( $M['status'] );
$CR['msg'] = $Labels->GetLabel( $M['msg'] );
$Data['poster'][] = $CR;
};
} else {
};
};
break;
};

22
lib/javascript/jsapi_dynamic/argus_monitoring.js

@ -222,7 +222,8 @@ function correctPlatformView( id ){
};
tt = Ext.getCmp('plat_schematics_'+id );
if( tt != null ){
tt.setHeight( 18 * pawi + 2 * 56 );
//tt.setHeight( 18 * pawi + 2 * 56 );
tt.setHeight( PanelH-130 );
};
tt = document.getElementById('plat_video_'+id+'_'+pp.getComponent(0).custom);
if( tt != null ){
@ -244,6 +245,25 @@ function correctPlatformView( id ){
tt.style.width = 16 * pawi +'px';
tt.style.height = 9 * pawi +'px';
};
var O = new Ext.Panel({
renderTo: 'scada_postbox_'+id,
width: '100%',
height: 150,
layout: 'hbox',
layoutConfig: {
align: 'stretch', // Options: 'top', 'middle', 'stretch', 'stretchmax'
pack: 'start' // Options: 'start', 'center', 'end'
},
defaults: {
flex: 1, // Automatically distributes equal width among items
bodyStyle: 'padding:10px'
},
items: [{
title: 'Column 1',
html: 'Content for the first column'
}]
});
};
function correctModuleView( id ){

2
lib/javascript/jsapi_dynamic/argus_settings.js

@ -1256,6 +1256,8 @@ function fetchScadaEditorStatus(){
tT.toggle( data.outputs[3] );
tT.resumeEvents();
};
var cv = Ext.getCmp('c_sca_e_panel');
if( cv != undefined ) cv.c_do_val = data.ov;
} else {
var lt = document.getElementById('scae_onl_sts');
if( lt != undefined ) lt.src = "/style/assets/bul_gray.png";

5
lib/php/argus/templates.php

@ -314,8 +314,9 @@ $PLATFORM_PLATFORM_CTX=<<<DATA_BOUNDARY
frame: false,
layout: 'table',
width: '100%',
cls: 'x-table-layout-cell-top-align',
defaults: {
//bodyStyle:'padding:3px'
bodyStyle: 'vertical-align: top !important;'
},
layoutConfig: {
columns: 4
@ -333,7 +334,7 @@ $PLATFORM_PLATFORM_CTX=<<<DATA_BOUNDARY
height: 10
}],
colspan: 2,
rowspan: 2
rowspan: 4
},%%%VIDEOUN%%%,%%%VIDEOBN%%%,%%%VIDEOBF%%%]
}
DATA_BOUNDARY;

20
lib/upgrade_database.php

@ -100,6 +100,26 @@ DATA_BOUNDARY;
$UPGRADE = true;
};
$QS = "SHOW TABLES LIKE 'metro_platforms_mboxes'";
$R = $DATABASE->Query( $QS );
if( count( $R ) == 0 ){
$QS =<<<DATA_BOUNDARY
CREATE TABLE `metro_platforms_mboxes` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`platform_id` int(10) UNSIGNED NOT NULL,
`type` tinyint(3) NOT NULL,
`ts` int(10) UNSIGNED NOT NULL,
`status` tinyint(3) UNSIGNED NULL DEFAULT 0,
`value` char(32) CHARACTER SET ascii COLLATE ascii_bin NULL DEFAULT '0',
`msg` char(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uniq`(`platform_id`, `type`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Fixed;
DATA_BOUNDARY;
$UPGRADE = true;
$DATABASE->Query( $QS );
};
if( $UPGRADE ){
echo "Upgrade Done!\n\n";
} else {

3
style/style.css

@ -2365,4 +2365,7 @@ input[type="range"]:focus::-moz-range-thumb {
font-weight: bold;
border-radius: 10px;
margin-bottom: 10px;
}
.x-table-layout-cell-top-align td.x-table-layout-cell {
vertical-align: top !important;
}
Loading…
Cancel
Save