gestione GFLOW
This commit is contained in:
@@ -30,7 +30,7 @@ sub getUnitName { # parm => file received ($trfile)
|
|||||||
my ( $fileDate, $fileTime );
|
my ( $fileDate, $fileTime );
|
||||||
my ( $unittype, $unit );
|
my ( $unittype, $unit );
|
||||||
my ( $filenamecsv, $path, $suffix ) = fileparse( $filename, qr/\.[^.]*/ );
|
my ( $filenamecsv, $path, $suffix ) = fileparse( $filename, qr/\.[^.]*/ );
|
||||||
if ( $filenamecsv =~ m/^G201_ID\d\d\d\d_DT\d\d\d\d_\d*$/i ) { # G201
|
if ( $filenamecsv =~ m/^G201_ID\d\d\d\d_DT\d\d\d\d_\d*$/i ) {
|
||||||
my @strings = $filenamecsv =~
|
my @strings = $filenamecsv =~
|
||||||
/(.{1,4})_(.{1,6})_(.{1,6})_(.{1,4})(.{1,2})(.{1,2})(.{1,2})(.{1,2})(.{1,2}).*/;
|
/(.{1,4})_(.{1,6})_(.{1,6})_(.{1,4})(.{1,2})(.{1,2})(.{1,2})(.{1,2})(.{1,2}).*/;
|
||||||
$unittype = $strings[0];
|
$unittype = $strings[0];
|
||||||
@@ -38,6 +38,14 @@ sub getUnitName { # parm => file received ($trfile)
|
|||||||
$fileDate = $strings[3] . "/" . $strings[4] . "/" . $strings[5];
|
$fileDate = $strings[3] . "/" . $strings[4] . "/" . $strings[5];
|
||||||
$fileTime = $strings[6] . ":" . $strings[7] . ":" . $strings[8];
|
$fileTime = $strings[6] . ":" . $strings[7] . ":" . $strings[8];
|
||||||
}
|
}
|
||||||
|
elsif ( $filenamecsv =~ m/^GFLOW_ID\d\d\d\d_DT\d\d\d\d_\d*$/i ) {
|
||||||
|
my @strings = $filenamecsv =~
|
||||||
|
/(.{1,5})_(.{1,6})_(.{1,6})_(.{1,4})(.{1,2})(.{1,2})(.{1,2})(.{1,2})(.{1,2}).*/;
|
||||||
|
$unittype = $strings[0];
|
||||||
|
$unit = $strings[1];
|
||||||
|
$fileDate = $strings[3] . "/" . $strings[4] . "/" . $strings[5];
|
||||||
|
$fileTime = $strings[6] . ":" . $strings[7] . ":" . $strings[8];
|
||||||
|
}
|
||||||
elsif ( $filenamecsv =~ m/^D2W_ID\d\d\d\d_DT\d\d\d\d$/i ) {
|
elsif ( $filenamecsv =~ m/^D2W_ID\d\d\d\d_DT\d\d\d\d$/i ) {
|
||||||
my @strings = $filenamecsv =~ /(.{1,3})_(.{1,6})_(.{1,6}).*/;
|
my @strings = $filenamecsv =~ /(.{1,3})_(.{1,6})_(.{1,6}).*/;
|
||||||
$unittype = $strings[0];
|
$unittype = $strings[0];
|
||||||
@@ -62,7 +70,7 @@ sub getUnitName { # parm => file received ($trfile)
|
|||||||
|
|
||||||
my $readingFile;
|
my $readingFile;
|
||||||
my $recvOKstr = "OK UPLOAD";
|
my $recvOKstr = "OK UPLOAD";
|
||||||
my $ext = ".csv";
|
my @ext = ( ".csv", ".txt" );
|
||||||
|
|
||||||
GetOptions( "file=s" => \$readingFile )
|
GetOptions( "file=s" => \$readingFile )
|
||||||
or die("Error in command line arguments\n");
|
or die("Error in command line arguments\n");
|
||||||
@@ -86,11 +94,13 @@ while ( my $line = $tail->GetLine() ) {
|
|||||||
$trfile = "/home/" . $truser . $trfile;
|
$trfile = "/home/" . $truser . $trfile;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
( ( uc $suffix ) eq ( uc $ext ) )
|
( grep( /^$suffix$/, @ext ) )
|
||||||
and ( $filename =~ m/^(\d\d_\d\d\d\d_|)(DT\d\d\d\d|LOC\d*|GD\d*)$/i
|
and ( $filename =~
|
||||||
|
m/^(\d\d_\d\d\d\d_|)(DT\d\d\d\d|LOC\d\d\d\d|GD\d\d\d\d)$/i
|
||||||
or $filename =~ m/^G201_ID\d\d\d\d_DT\d\d\d\d_\d*$/i
|
or $filename =~ m/^G201_ID\d\d\d\d_DT\d\d\d\d_\d*$/i
|
||||||
or $filename =~ m/^D2W_ID\d\d\d\d_DT\d\d\d\d$/i
|
or $filename =~ m/^D2W_ID\d\d\d\d_DT\d\d\d\d$/i
|
||||||
or $filename =~ m/^G301_ID\d\d\d\d_DT\d\d\d\d$/i )
|
or $filename =~ m/^G301_ID\d\d\d\d_DT\d\d\d\d$/i
|
||||||
|
or $filename =~ m/^GFLOW_ID\d\d\d\d_DT\d\d\d\d_\d*$/i )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
my $unit = getUnitName($trfile);
|
my $unit = getUnitName($trfile);
|
||||||
@@ -129,6 +139,7 @@ while ( my $line = $tail->GetLine() ) {
|
|||||||
or $filename =~ m/^G201_ID\d\d\d\d_DT\d\d\d\d_\d*$/i
|
or $filename =~ m/^G201_ID\d\d\d\d_DT\d\d\d\d_\d*$/i
|
||||||
or $filename =~ m/^D2W_ID\d\d\d\d_DT\d\d\d\d$/i
|
or $filename =~ m/^D2W_ID\d\d\d\d_DT\d\d\d\d$/i
|
||||||
or $filename =~ m/^G301_ID\d\d\d\d_DT\d\d\d\d$/i
|
or $filename =~ m/^G301_ID\d\d\d\d_DT\d\d\d\d$/i
|
||||||
|
or $filename =~ m/^GFLOW_ID\d\d\d\d_DT\d\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