check ascii line

This commit is contained in:
2021-05-08 01:18:28 +02:00
parent d1695a111a
commit 03500d2a92

View File

@@ -448,6 +448,7 @@ elsif ( $filecsvname =~ m/^G301_ID\d\d\d\d_DT\d\d\d\d_\d*$/i ) {
}
while ( my $line = <FILE> ) {
if ( $line =~ m/\A [[:ascii:]]* \Z/xms ) {
my ( $first, $NodeData ) = split( /;/, $line, 2 );
if ( defined $first and ( $first ne '' ) ) {
$first =~ s/;+$//;
@@ -498,14 +499,18 @@ while ( my $line = <FILE> ) {
$G301_fcheck = 1;
}
if ( $tooltype eq "MUX" or $tooltype eq "D2W" or $tooltype eq "G301" ) {
if ( $tooltype eq "MUX"
or $tooltype eq "D2W"
or $tooltype eq "G301" )
{
#$NodeData =~ s/Dis\./N\/A/g;
@NewData = grep /\S/, split( /\||;/, $NodeData );
if ( scalar(@NewData) != 0 ) {
my $idx = 0;
$CSVData[ $idx++ ] = join( ';', splice( @NewData, 0, 2 ) );
$CSVData[ $idx++ ] =
join( ';', splice( @NewData, 0, 2 ) );
foreach my $ch (@channels) {
$CSVData[ $idx++ ] =
join( ';', splice( @NewData, 0, $ch ) );
@@ -600,7 +605,8 @@ while ( my $line = <FILE> ) {
}
else {
my ( $y, $m, $d, $t ) = split( /[\s\/]/, $first );
if ( length($y) != 4 ) { # G201/G301 con la data invertita
if ( length($y) != 4 )
{ # G201/G301 con la data invertita
my $w = $y;
$y = $d;
$m = sprintf( '%02d', $m );
@@ -611,7 +617,8 @@ while ( my $line = <FILE> ) {
$sql[ ( $outcount % $maxsqllines ) ] =
"('$unit','$tool','$nodenum','$y-$m-$d','$t','$toolbatt','$tooltemp'";
}
$sql[ ( $outcount % $maxsqllines ) ] .= ",'" . $_ . "'";
$sql[ ( $outcount % $maxsqllines ) ] .=
",'" . $_ . "'";
}
my $InsCompl = ",NULL" x ( 15 - $#data );
$sql[ ( $outcount % $maxsqllines ) ] .= $InsCompl . ")";
@@ -628,6 +635,7 @@ while ( my $line = <FILE> ) {
}
}
}
}
close FILE;
$sql[ ( $outcount % $maxsqllines ) - 1 ] =~ s/,$/;/g;
writeOutSql($tool);