gestione g201 2

This commit is contained in:
2018-05-13 11:50:10 +02:00
parent 32b7853754
commit 8b7d08a347
2 changed files with 26 additions and 11 deletions

View File

@@ -365,6 +365,8 @@ if ( $filename = m/^(\d\d_\d\d\d\d_|)(DT\d\d\d\d|LOC\d.*|GD\d*)$/i ) { # GD801
$fileTime = $strings[3] . ":" . $strings[4] . ":" . $strings[5];
$unittype = $strings[6];
$unit = $strings[7];
$tool = $strings[8];
$tooltype = 'MUX';
}
while ( my $line = <FILE> ) {
@@ -455,10 +457,15 @@ while ( my $line = <FILE> ) {
}
else {
my ( $y, $m, $d, $t ) = split( /[\s\/]/, $first );
if (length($y) != 4) { # G201 con la data invertita
my $w = $y;
$y = $d;
$m = sprintf('%02d',$m);
$d = sprintf('%02d',$w);
}
foreach (@data) {
if ( $sql[ ( $outcount % $maxsqllines ) ] eq "" ) {
$sql[ ( $outcount % $maxsqllines ) ] =
"('$unit','$tool','$nodenum','$y-$m-$d','$t','$toolbatt','$tooltemp'";
$sql[ ( $outcount % $maxsqllines ) ] = "('$unit','$tool','$nodenum','$y-$m-$d','$t','$toolbatt','$tooltemp'";
}
$sql[ ( $outcount % $maxsqllines ) ] .= ",'" . $_ . "'";
}

View File

@@ -26,6 +26,13 @@ sub getTimeStamp
}
sub getUnitName { # parm => file received ($trfile)
if ( $filename = m/^(\d\d\d\d\d\d\d\d\d\d\d\d\d\d_)(G201_ID\d\d\d\d_DT\d\d\d\d)$/i ) { # GD201
my @strings = $filename =~ /(.{1,4})(.{1,2})(.{1,2})(.{1,2})(.{1,2})(.{1,2})_(.{1,4})_(.{1,6})_(.{1,6}).*/;
$fileDate = $strings[0] . "/" . $strings[1] . "/" . $strings[2];;
$fileTime = $strings[3] . ":" . $strings[4] . ":" . $strings[5];
$unittype = $strings[6];
$unit = $strings[7];
} else {
my ($filename) = @_;
open FILE, $filename
or warn getTimeStamp("log") . " >> Error: opening input file $filename\n";
@@ -33,6 +40,7 @@ sub getUnitName { # parm => file received ($trfile)
my ( $unittype, $unit ) = split( /\s/, uc <FILE> );
$unit =~ s/;+$//;
close FILE;
}
return $unit;
}
@@ -96,8 +104,8 @@ while ( my $line = $tail->GetLine() ) {
chmod 0664, $dest;
my @fname = ($dest);
chown $uid, $gid, @fname;
if ( $filename =~
m/^(\d\d_\d\d\d\d_|)(DT\d\d\d\d|LOC\d.*|GD\d*)$/i
if ( ($filename =~ m/^(\d\d_\d\d\d\d_|)(DT\d\d\d\d|LOC\d.*|GD\d*)$/i
or $filename =~ m/^(\d\d\d\d\d\d\d\d\d\d\d\d\d\d_)(G201_ID\d\d\d\d_DT\d\d\d\d)$/i)
and ( $unit ne 'ID9999' )
and ( $truser ne 'corra' ) )
{