From fe3f5357b0d220da6733ba104e50ec2ed445947b Mon Sep 17 00:00:00 2001 From: battilo Date: Fri, 23 Nov 2018 21:25:34 +0100 Subject: [PATCH 1/4] modifica export per includere unit --- LoadCSVData.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LoadCSVData.pl b/LoadCSVData.pl index 399091f..b307c5e 100644 --- a/LoadCSVData.pl +++ b/LoadCSVData.pl @@ -178,7 +178,7 @@ sub trxelab { XShift, YShift, ZShift , X, Y, Z, HShift, HShiftDir, HShift_local, speed, speed_local, acceleration, acceleration_local, T_node, water_level, pressure, load_value, AlfaX, AlfaY, calcerr from ElabDataView - where UnitName = '$unit', ToolNameID = '$tool' and updated_at > '$matlab_timestamp' + where UnitName = '$unit' and ToolNameID = '$tool' and updated_at > '$matlab_timestamp' order by ToolNameID DESC, EventDate, EventTime, convert(`NodeNum`, decimal) DESC ) resulting_set into outfile '$fileelab' From dd28cfe47f737a216af3709cc4da16a2614792b5 Mon Sep 17 00:00:00 2001 From: battilo Date: Fri, 23 Nov 2018 22:57:19 +0100 Subject: [PATCH 2/4] chiusura se nno channels din ain etc --- LoadCSVData.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LoadCSVData.pl b/LoadCSVData.pl index b307c5e..c8e6000 100644 --- a/LoadCSVData.pl +++ b/LoadCSVData.pl @@ -140,7 +140,7 @@ sub trxelab { ) or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr"; $sth->execute(); - if ( $sth->rows < 0 ) { + if ( $sth->rows eq 0 ) { die getTimeStamp("log") . " - pid $$ >> No unit ftp params selected.\n"; }else { while ( my $results = $sth->fetchrow_hashref ) { @@ -245,7 +245,7 @@ sub getNodesType { $sth->execute(); print getTimeStamp("log"). " - pid $$ >> $unit - $tool: " . $sth->rows . " rows selected to get node type/Ain/Din/channels.\n"; - if ( $sth->rows < 0 ) { + if ( $sth->rows eq 0 ) { die getTimeStamp("log") . " - pid $$ >> No node channels selected.\n"; }else { my $row = 0; @@ -272,7 +272,7 @@ sub getUdbPwd { or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr"; $sth->execute(); - if ( $sth->rows < 0 ) { + if ( $sth->rows eq 0 ) { die getTimeStamp("log") . " - pid $$ >> No password selected.\n"; }else { my $results = $sth->fetchrow_hashref; @@ -301,7 +301,7 @@ sub getMatlabCmd { ) or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr"; $sth->execute(); - if ( $sth->rows < 0 ) { + if ( $sth->rows eq 0 ) { die getTimeStamp("log"). " - pid $$ >> No tool's matlab function selected.\n"; }else { while ( my $results = $sth->fetchrow_hashref ) { From b08b43b04ec0df863bb35bcb64f6ea1cf89f01cf Mon Sep 17 00:00:00 2001 From: battilo Date: Sat, 24 Nov 2018 00:18:10 +0100 Subject: [PATCH 3/4] unsigned integer al posto di decimal nella query per estraz ftp --- LoadCSVData.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LoadCSVData.pl b/LoadCSVData.pl index c8e6000..f0c384e 100644 --- a/LoadCSVData.pl +++ b/LoadCSVData.pl @@ -179,7 +179,7 @@ sub trxelab { speed, speed_local, acceleration, acceleration_local, T_node, water_level, pressure, load_value, AlfaX, AlfaY, calcerr from ElabDataView where UnitName = '$unit' and ToolNameID = '$tool' and updated_at > '$matlab_timestamp' - order by ToolNameID DESC, EventDate, EventTime, convert(`NodeNum`, decimal) DESC + order by ToolNameID DESC, EventDate, EventTime, convert(`NodeNum`, UNSIGNED INTEGER) DESC ) resulting_set into outfile '$fileelab' fields terminated by ',' optionally enclosed by '"' lines terminated by '\n'} From 6c1c19e52f71c7ea06fbedc99044eb49b9b3dfa4 Mon Sep 17 00:00:00 2001 From: battilo Date: Sat, 24 Nov 2018 00:22:30 +0100 Subject: [PATCH 4/4] exit fi no Ain Din Node defined --- LoadCSVData.pl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/LoadCSVData.pl b/LoadCSVData.pl index f0c384e..dbe0900 100644 --- a/LoadCSVData.pl +++ b/LoadCSVData.pl @@ -246,7 +246,9 @@ sub getNodesType { $sth->execute(); print getTimeStamp("log"). " - pid $$ >> $unit - $tool: " . $sth->rows . " rows selected to get node type/Ain/Din/channels.\n"; if ( $sth->rows eq 0 ) { - die getTimeStamp("log") . " - pid $$ >> No node channels selected.\n"; + print getTimeStamp("log"). " - pid $$ >> Node/Channels/Ain/Din not defined.\n"; + print getTimeStamp("log"). " - pid $$ >> Execution ended.\n"; + exit; }else { my $row = 0; while ( my $results = $sth->fetchrow_hashref ) { @@ -470,12 +472,6 @@ while ( my $line = ) { my ( $Vbat, $Tmod, $Ain1, $Ain2, $Din1, $Din2 ) = split( /;/, $NodeData ); - if ( scalar @din ) { - print getTimeStamp("log"). " - pid $$ >> Ain/Din not defined.\n"; - print getTimeStamp("log"). " - pid $$ >> Execution ended.\n"; - exit; - } - my $idx = 0; $CSVData[$idx++] = $Vbat . ";" . $Tmod;