gestione g201 2
This commit is contained in:
@@ -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];
|
$fileTime = $strings[3] . ":" . $strings[4] . ":" . $strings[5];
|
||||||
$unittype = $strings[6];
|
$unittype = $strings[6];
|
||||||
$unit = $strings[7];
|
$unit = $strings[7];
|
||||||
|
$tool = $strings[8];
|
||||||
|
$tooltype = 'MUX';
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( my $line = <FILE> ) {
|
while ( my $line = <FILE> ) {
|
||||||
@@ -455,10 +457,15 @@ while ( my $line = <FILE> ) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my ( $y, $m, $d, $t ) = split( /[\s\/]/, $first );
|
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) {
|
foreach (@data) {
|
||||||
if ( $sql[ ( $outcount % $maxsqllines ) ] eq "" ) {
|
if ( $sql[ ( $outcount % $maxsqllines ) ] eq "" ) {
|
||||||
$sql[ ( $outcount % $maxsqllines ) ] =
|
$sql[ ( $outcount % $maxsqllines ) ] = "('$unit','$tool','$nodenum','$y-$m-$d','$t','$toolbatt','$tooltemp'";
|
||||||
"('$unit','$tool','$nodenum','$y-$m-$d','$t','$toolbatt','$tooltemp'";
|
|
||||||
}
|
}
|
||||||
$sql[ ( $outcount % $maxsqllines ) ] .= ",'" . $_ . "'";
|
$sql[ ( $outcount % $maxsqllines ) ] .= ",'" . $_ . "'";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,13 @@ sub getTimeStamp
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub getUnitName { # parm => file received ($trfile)
|
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) = @_;
|
my ($filename) = @_;
|
||||||
open FILE, $filename
|
open FILE, $filename
|
||||||
or warn getTimeStamp("log") . " >> Error: opening input file $filename\n";
|
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> );
|
my ( $unittype, $unit ) = split( /\s/, uc <FILE> );
|
||||||
$unit =~ s/;+$//;
|
$unit =~ s/;+$//;
|
||||||
close FILE;
|
close FILE;
|
||||||
|
}
|
||||||
return $unit;
|
return $unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +104,8 @@ while ( my $line = $tail->GetLine() ) {
|
|||||||
chmod 0664, $dest;
|
chmod 0664, $dest;
|
||||||
my @fname = ($dest);
|
my @fname = ($dest);
|
||||||
chown $uid, $gid, @fname;
|
chown $uid, $gid, @fname;
|
||||||
if ( $filename =~
|
if ( ($filename =~ m/^(\d\d_\d\d\d\d_|)(DT\d\d\d\d|LOC\d.*|GD\d*)$/i
|
||||||
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 ( $unit ne 'ID9999' )
|
||||||
and ( $truser ne 'corra' ) )
|
and ( $truser ne 'corra' ) )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user