From 84e3bd28ee598e2b0d4fa4edfc1f919c38f5be69 Mon Sep 17 00:00:00 2001 From: battilo Date: Thu, 29 Mar 2018 21:35:54 +0200 Subject: [PATCH] eliminazione utilizzo del db mums --- AlertNotReceived.pl | 11 ++++++++--- LoadCSVData.pl | 12 ++---------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/AlertNotReceived.pl b/AlertNotReceived.pl index 02076c9..7448752 100644 --- a/AlertNotReceived.pl +++ b/AlertNotReceived.pl @@ -8,11 +8,13 @@ use Mail::Sender; # Variables my $username = 'aseuser'; my $password = 'Mums0001!'; -my $database = 'ase_mums'; +#my $database = 'ase_mums'; +my $database = 'ase_lar'; my $db_lar = 'ase_lar'; my $server = 'localhost'; my ($email_msg, $email_obj, $tools_info, $ref_date); my $act_tool = 0; +my $gd_tool = 0; #my $email_addr = 'alessandro.battilani@gmail.com'; my $email_addr = 'aseparma@gmail.com,alessandro.battilani@gmail.com,corrado@geielettronica.it,luca.chiapponi@unipr.it'; @@ -129,6 +131,9 @@ if ($sth->rows < 0) { $ToolName{$results->{'ToolNameID'}}{'ErroriTotaliLetture'} = "--"; if ($results->{'ToolState'} eq "Active" ){ $act_tool++; + } + if (substr($results->{'ToolNameID'},0,2) eq "GD" ){ + $act_tool++; } } } @@ -140,7 +145,7 @@ $dbh->disconnect; $dbh = DBI->connect("DBI:mysql:$database;host=$server", $username, $password) or die getLoggingTime() . " - Could not connect to database: $DBI::errstr"; -my $stw = $dbh->prepare("select ToolNameID, EventDate, count(EventTime) 'LettureNodi', truncate(Count(EventTime)/max(NodeNum),1) 'LettureCatene', max(NodeNum) 'NumeroNodi' from RAWDATA where ToolNameId not like 'DT009%' and EventDate = subdate(curdate(),1) group by ToolNameID") +my $stw = $dbh->prepare("select ToolNameID, EventDate, count(EventTime) 'LettureNodi', truncate(Count(EventTime)/max(NodeNum),1) 'LettureCatene', max(NodeNum) 'NumeroNodi' from RAWDATACOR where EventDate = subdate(curdate(),1) group by ToolNameID") or die getLoggingTime() . " - $DBI::errstr"; $stw->execute(); @@ -154,7 +159,7 @@ if ($stw->rows == 0) { $ToolName{$results->{'ToolNameID'}}{'NumeroNodi'} = $results->{'NumeroNodi'}; $ref_date = $results->{'EventDate'}; } - if ($act_tool == $stw->rows) { + if (($act_tool + $gd_tool) == $stw->rows) { $email_obj = "Tutte le letture pervenute."; } else { $email_obj = "ATTENZIONE: alcune letture non pervenute!!!"; diff --git a/LoadCSVData.pl b/LoadCSVData.pl index 749de20..c6b9a1d 100644 --- a/LoadCSVData.pl +++ b/LoadCSVData.pl @@ -16,8 +16,8 @@ my $password = 'laravel'; my $db_lar = 'ase_lar'; my $db_sp = 'ase_lar'; my $server = 'localhost'; -my $db_name = "ase_mums"; -my $table = "RAWDATA"; +my $db_name = "ase_lar"; +my $table = "RAWDATACOR"; my ( @CSVData, @sql ); my $outcount = 0; my $outfilenum = 0; @@ -81,14 +81,6 @@ sub writeOutSql { @sql = (); print SQLOUT "/* unlock table */\nUNLOCK TABLES;\n"; - if ( $table eq 'RAWDATA' ) { - print SQLOUT "/* call stored procedure to copy in " - . $db_sp - . "*/\ncall " - . $db_sp - . ".CopyAndFill('$tn');\n"; - } - close SQLOUT or die( getTimeStamp("log") . " - pid $$ >> Error in closing file "