un po' di roba
This commit is contained in:
@@ -121,17 +121,18 @@ if ($sth->rows < 0) {
|
||||
print getLoggingTime() . " - No rows from TOOLS & UNITS.\n";
|
||||
} else {
|
||||
while (my $results = $sth->fetchrow_hashref) {
|
||||
$ToolName{$results->{'ToolNameID'}}{'idCompany'} = $results->{'idCompany'};
|
||||
$ToolName{$results->{'ToolNameID'}}{'CompanyNameShort'} = $results->{'CompanyNameShort'};
|
||||
$ToolName{$results->{'ToolNameID'}}{'SiteName'} = $results->{'SiteName'};
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'idCompany'} = $results->{'idCompany'};
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'CompanyNameShort'} = $results->{'CompanyNameShort'};
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'SiteName'} = $results->{'SiteName'};
|
||||
$ToolName{$results->{'idCompany'}}{'CompanyEmail'} = $results->{'CompanyEmail'};
|
||||
$ToolName{$results->{'idCompany'}}{'SendAlarm'} = $results->{'SendAlarm'};
|
||||
$ToolName{$results->{'ToolNameID'}}{'UnitNameId'} = $results->{'UnitNameId'};
|
||||
$ToolName{$results->{'ToolNameID'}}{'ToolState'} = $results->{'ToolState'};
|
||||
$ToolName{$results->{'ToolNameID'}}{'LettureNodi'} = "--";
|
||||
$ToolName{$results->{'ToolNameID'}}{'LettureCatene'} = "--";
|
||||
$ToolName{$results->{'ToolNameID'}}{'NumeroNodi'} = "--";
|
||||
$ToolName{$results->{'ToolNameID'}}{'ErroriTotaliLetture'} = "--";
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'UnitNameId'} = $results->{'UnitNameId'};
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'ToolNameID'} = $results->{'ToolNameID'};
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'ToolState'} = $results->{'ToolState'};
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'LettureNodi'} = "--";
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'LettureCatene'} = "--";
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'NumeroNodi'} = "--";
|
||||
$ToolName{$results->{UnitNameId} . $results->{'ToolNameID'}}{'ErroriTotaliLetture'} = "--";
|
||||
if ($results->{'ToolState'} eq "Active" ){
|
||||
$act_tool++;
|
||||
}
|
||||
@@ -145,7 +146,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 RAWDATACOR where EventDate = subdate(curdate(),1) group by ToolNameID")
|
||||
my $stw = $dbh->prepare("select UnitName, ToolNameID, EventDate, count(EventTime) 'LettureNodi', truncate(Count(EventTime)/max(NodeNum),1) 'LettureCatene', max(NodeNum) 'NumeroNodi' from RAWDATACOR where EventDate = subdate(curdate(),1) group by UnitName, ToolNameID")
|
||||
or die getLoggingTime() . " - $DBI::errstr";
|
||||
$stw->execute();
|
||||
|
||||
@@ -154,9 +155,9 @@ if ($stw->rows == 0) {
|
||||
$email_obj = "ATTENZIONE: nessuna lettura pervenuta!!!"
|
||||
} else {
|
||||
while (my $results = $stw->fetchrow_hashref) {
|
||||
$ToolName{$results->{'ToolNameID'}}{'LettureNodi'} = $results->{'LettureNodi'};
|
||||
$ToolName{$results->{'ToolNameID'}}{'LettureCatene'} = $results->{'LettureCatene'};
|
||||
$ToolName{$results->{'ToolNameID'}}{'NumeroNodi'} = $results->{'NumeroNodi'};
|
||||
$ToolName{$results->{'UnitName'} . $results->{'ToolNameID'}}{'LettureNodi'} = $results->{'LettureNodi'};
|
||||
$ToolName{$results->{'UnitName'} . $results->{'ToolNameID'}}{'LettureCatene'} = $results->{'LettureCatene'};
|
||||
$ToolName{$results->{'UnitName'} . $results->{'ToolNameID'}}{'NumeroNodi'} = $results->{'NumeroNodi'};
|
||||
$ref_date = $results->{'EventDate'};
|
||||
if (substr($results->{'ToolNameID'},0,2) eq "GD" ){
|
||||
$gd_tool++;
|
||||
@@ -172,12 +173,12 @@ if ($stw->rows == 0) {
|
||||
|
||||
$stw->finish;
|
||||
|
||||
my $ste = $dbh->prepare("select ToolNameID, count(val0) 'ErroriTotaliLetture' from RAWDATACOR where EventDate = ? and val0 = 'Err1' group by ToolNameID")
|
||||
my $ste = $dbh->prepare("select UnitName, ToolNameID, count(val0) 'ErroriTotaliLetture' from RAWDATACOR where EventDate = ? and val0 = 'Err1' group by ToolNameID")
|
||||
or die getLoggingTime() . " - $DBI::errstr";
|
||||
$ste->bind_param(1, $ref_date);
|
||||
$ste->execute();
|
||||
while (my $results = $ste->fetchrow_hashref) {
|
||||
$ToolName{$results->{'ToolNameID'}}{'ErroriTotaliLetture'} = $results->{'ErroriTotaliLetture'};
|
||||
$ToolName{$results->{'UnitName'} . $results->{'ToolNameID'}}{'ErroriTotaliLetture'} = $results->{'ErroriTotaliLetture'};
|
||||
}
|
||||
|
||||
$ste->finish;
|
||||
@@ -193,7 +194,7 @@ foreach my $tool (sort grep { /DT|PT/ } keys %ToolName){
|
||||
}
|
||||
|
||||
my $tool_part = "<td>" . $ToolName{$tool}{'CompanyNameShort'} . "</td><td>". $ToolName{$tool}{'SiteName'} . "</td>";
|
||||
$tool_part .= "<td align=\"center\">" . $ToolName{$tool}{'UnitNameId'} . "</td><td align=\"center\">" . $tool . "</td>";
|
||||
$tool_part .= "<td align=\"center\">" . $ToolName{$tool}{'UnitNameId'} . "</td><td align=\"center\">" . $ToolName{$tool}{ToolNameID} . "</td>";
|
||||
$tool_part .= "<td align=\"right\">" . $ToolName{$tool}{'LettureNodi'} . "</td><td align=\"right\">" . $ToolName{$tool}{'NumeroNodi'} . "</td>";
|
||||
$tool_part .= "<td align=\"right\">" . $ToolName{$tool}{'LettureCatene'} . "</td>";
|
||||
$tool_part .= "<td align=\"center\">" . $ToolName{$tool}{'ErroriTotaliLetture'} . "</td><td align=\"center\">" . $ToolName{$tool}{'ToolState'} . "</td></tr>\n";
|
||||
|
||||
Reference in New Issue
Block a user