Patch level :10.0 188
Files correlati :ba1.exe Ricompilazione Demo : [ ] Commento :log di conversione! git-svn-id: svn://10.65.10.50/trunk@17845 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7ea3472e6f
commit
a8984dd075
105
ba/ba1100.cpp
105
ba/ba1100.cpp
@ -6,6 +6,8 @@
|
|||||||
#include <dongle.h>
|
#include <dongle.h>
|
||||||
#include <printer.h>
|
#include <printer.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
|
#include <reprint.h>
|
||||||
|
#include <reputils.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
|
|
||||||
@ -38,7 +40,8 @@ class TManutenzione_app : public TSkeleton_application
|
|||||||
long _level;
|
long _level;
|
||||||
long _history_firm;
|
long _history_firm;
|
||||||
TRec_sheet* _rec;
|
TRec_sheet* _rec;
|
||||||
FILE * _log;
|
TLog_report* _log;
|
||||||
|
bool _print_log;
|
||||||
|
|
||||||
bool _superprassi;
|
bool _superprassi;
|
||||||
|
|
||||||
@ -65,11 +68,13 @@ protected:
|
|||||||
void close_history();
|
void close_history();
|
||||||
void dump_trc(const char * dir, const bool des_too, const long modules);
|
void dump_trc(const char * dir, const bool des_too, const long modules);
|
||||||
void repair_file(int i);
|
void repair_file(int i);
|
||||||
void open_log();
|
|
||||||
void write_log(const char * line);
|
|
||||||
void close_log();
|
|
||||||
void save_file(const char * file);
|
void save_file(const char * file);
|
||||||
|
|
||||||
|
void open_log();
|
||||||
|
void write_log(const char* line, const int severity = 0);
|
||||||
|
void close_log();
|
||||||
|
|
||||||
|
|
||||||
bool moveable_file(int file) const;
|
bool moveable_file(int file) const;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -99,7 +104,7 @@ HIDDEN bool browse_file_handler(TMask_field& f, KEY k)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TManutenzione_app::TManutenzione_app() : _browse(NULL), _mask(NULL), _firm(0), _level(0), _rec(NULL)
|
TManutenzione_app::TManutenzione_app() : _browse(NULL), _mask(NULL), _firm(0), _level(0), _rec(NULL), _log(NULL)
|
||||||
{
|
{
|
||||||
if (!fexist(Dir_file)) // controlla l'esistenza dei direttori standard (dir.gen e trc.gen)
|
if (!fexist(Dir_file)) // controlla l'esistenza dei direttori standard (dir.gen e trc.gen)
|
||||||
{ // vengono creati se non esistono
|
{ // vengono creati se non esistono
|
||||||
@ -381,13 +386,35 @@ bool TManutenzione_app::destroy() // releasev e arrmask
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TManutenzione_app::open_log()
|
void TManutenzione_app::open_log()
|
||||||
{
|
{
|
||||||
TFilename log;
|
_print_log = false;
|
||||||
|
|
||||||
log << firm2dir(0L) << '/' << "conv.log";
|
|
||||||
_log = fopen(log,"a");
|
|
||||||
if (_log == NULL)
|
if (_log == NULL)
|
||||||
fatal_box("Non posso aprire il file di log della conversione(%s)", (const char *) log);
|
_log = new TLog_report("Conversione");
|
||||||
|
}
|
||||||
|
|
||||||
|
void TManutenzione_app::write_log(const char* line, const int severity)
|
||||||
|
{
|
||||||
|
if (_log != NULL)
|
||||||
|
{
|
||||||
|
_log->log(severity, line);
|
||||||
|
if (severity > 0)
|
||||||
|
_print_log = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TManutenzione_app::close_log()
|
||||||
|
{
|
||||||
|
if (_log != NULL)
|
||||||
|
{
|
||||||
|
if (_print_log)
|
||||||
|
{
|
||||||
|
TReport_book book;
|
||||||
|
book.add(*_log);
|
||||||
|
book.preview();
|
||||||
|
}
|
||||||
|
delete _log;
|
||||||
|
_log = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TManutenzione_app::save_file(const char * file)
|
void TManutenzione_app::save_file(const char * file)
|
||||||
@ -411,17 +438,6 @@ void TManutenzione_app::save_file(const char * file)
|
|||||||
TFilename dest_file(dest_path); dest_file << '/' << (const char *) source_file.name();
|
TFilename dest_file(dest_path); dest_file << '/' << (const char *) source_file.name();
|
||||||
fcopy((const char *) source_file, dest_file);
|
fcopy((const char *) source_file, dest_file);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TManutenzione_app::write_log(const char * line)
|
|
||||||
{
|
|
||||||
fprintf(_log,"%s\n", line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TManutenzione_app::close_log()
|
|
||||||
{
|
|
||||||
fclose(_log);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -776,10 +792,9 @@ void TManutenzione_app::delete_riga (long riga_sel)
|
|||||||
|
|
||||||
bool TManutenzione_app::recover(TSystemisamfile& f, int err)
|
bool TManutenzione_app::recover(TSystemisamfile& f, int err)
|
||||||
{
|
{
|
||||||
if (err == -60 || err == -64 || err == _ispatherr ||
|
if (err == -60 || err == -64 || err == _ispatherr || (err > -600 && err <= -300))
|
||||||
(err > -600 && err <= -300))
|
|
||||||
{
|
{
|
||||||
err = f.packindex();
|
err = f.packindex(false, false);
|
||||||
}
|
}
|
||||||
return err == NOERR;
|
return err == NOERR;
|
||||||
}
|
}
|
||||||
@ -800,7 +815,7 @@ void TManutenzione_app::repair_file(int i)
|
|||||||
n.ext("cdx"); remove(n);
|
n.ext("cdx"); remove(n);
|
||||||
n.ext("fpt"); remove(n);
|
n.ext("fpt"); remove(n);
|
||||||
s.format(FR("File n. %d - %s : eliminato file errato"), i, (const char *)d.filename());
|
s.format(FR("File n. %d - %s : eliminato file errato"), i, (const char *)d.filename());
|
||||||
write_log(s);
|
write_log(s, 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -820,7 +835,7 @@ void TManutenzione_app::repair_file(int i)
|
|||||||
d.set_len(reclen);
|
d.set_len(reclen);
|
||||||
d.put(i, _nordir, _sysdirop);
|
d.put(i, _nordir, _sysdirop);
|
||||||
s.format(FR("File n. %d - %s : corretto tracciato da %d a %d bytes"), i, (const char *)d.filename(), oldreclen, reclen);
|
s.format(FR("File n. %d - %s : corretto tracciato da %d a %d bytes"), i, (const char *)d.filename(), oldreclen, reclen);
|
||||||
write_log(s);
|
write_log(s, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,7 +930,7 @@ void TManutenzione_app::update_dir()
|
|||||||
|
|
||||||
TString msg(_MAX_PATH);
|
TString msg(_MAX_PATH);
|
||||||
msg.format(FR("File n. %d - %s : eliminato file non utilizzato"), i, (const char *)d.filename());
|
msg.format(FR("File n. %d - %s : eliminato file non utilizzato"), i, (const char *)d.filename());
|
||||||
write_log(msg);
|
write_log(msg, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i > 2 && is_firm == old_is_firm)
|
if (i > 2 && is_firm == old_is_firm)
|
||||||
@ -934,6 +949,7 @@ void TManutenzione_app::update_dir()
|
|||||||
if ((err == _istrcerr) && (d.eod() == 0) && (fsize(d.filename()) < 4096))
|
if ((err == _istrcerr) && (d.eod() == 0) && (fsize(d.filename()) < 4096))
|
||||||
{
|
{
|
||||||
bool kill = true;
|
bool kill = true;
|
||||||
|
//controllo solo all'aga
|
||||||
if (is_power_station())
|
if (is_power_station())
|
||||||
kill = yesno_box(FR("Il tracciato record del file %d e' incoerente:\nSi desidera eliminare il file vuoto %s?"), i, d.filename());
|
kill = yesno_box(FR("Il tracciato record del file %d e' incoerente:\nSi desidera eliminare il file vuoto %s?"), i, d.filename());
|
||||||
if (kill)
|
if (kill)
|
||||||
@ -944,6 +960,11 @@ void TManutenzione_app::update_dir()
|
|||||||
n.ext("cdx"); remove(n);
|
n.ext("cdx"); remove(n);
|
||||||
n.ext("fpt"); remove(n);
|
n.ext("fpt"); remove(n);
|
||||||
err = NOERR;
|
err = NOERR;
|
||||||
|
// se si decide di eliminare il file con tracciato del cazzo deve tenerne traccia nel log (nel caso di utonti..
|
||||||
|
//..è sempre così, perchè kill è sempre true)
|
||||||
|
TString msg;
|
||||||
|
msg.format(TR("Eliminato il file %d avente tracciato record incoerente"), n);
|
||||||
|
write_log(msg, 2);
|
||||||
}
|
}
|
||||||
} //if((err==_istrcerr...
|
} //if((err==_istrcerr...
|
||||||
|
|
||||||
@ -959,11 +980,11 @@ void TManutenzione_app::update_dir()
|
|||||||
if (!recover(b, err))
|
if (!recover(b, err))
|
||||||
{
|
{
|
||||||
TString msg(_MAX_PATH);
|
TString msg(_MAX_PATH);
|
||||||
msg.format(TR("File n. %d - %s : errore n.ro %d"), i, (const char *)d.filename(), err);
|
msg.format(TR("Impossibile compattare il file %d - %s : errore n.ro %d"), i, (const char *)d.filename(), err);
|
||||||
write_log(msg);
|
write_log(msg, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} //if(err!=NOERR && flags<10000L..
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1226,10 +1247,21 @@ void TManutenzione_app::convert_dir()
|
|||||||
|
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
{
|
{
|
||||||
if (!yesno_box(FR("Il file %d non puo' essere aperto:\nErrore %d. Continuare ugualmente?"),i,err))
|
bool go_on = true;
|
||||||
|
//controllo solo all'aga
|
||||||
|
if (is_power_station())
|
||||||
|
go_on = yesno_box(FR("Il file %d non puo' essere aperto:\nErrore %d. Continuare ugualmente?"), i, err);
|
||||||
|
if (!go_on)
|
||||||
stop_run();
|
stop_run();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
//si decide di proseguire anche se il file non può essere aperto ne tiene traccia nel log (nel caso di utonti..
|
||||||
|
//..è sempre così, perchè go_on è sempre true)
|
||||||
|
TString msg;
|
||||||
|
msg.format(TR("Il file %d non può essere aperto. Errore %d"), i, err);
|
||||||
|
write_log(msg, 2);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} //if (i > 2 && err != NOERR &&...
|
} //if (i > 2 && err != NOERR &&...
|
||||||
|
|
||||||
@ -1502,8 +1534,7 @@ void TManutenzione_app::update()
|
|||||||
s.format(FR("Conversione del %s"), (const char*)TDate(TODAY).string());
|
s.format(FR("Conversione del %s"), (const char*)TDate(TODAY).string());
|
||||||
write_log(s);
|
write_log(s);
|
||||||
write_log("");
|
write_log("");
|
||||||
s.format(TR("Dati comuni"));
|
write_log(TR("Dati comuni"));
|
||||||
write_log(s);
|
|
||||||
write_log("");
|
write_log("");
|
||||||
|
|
||||||
update_dir();
|
update_dir();
|
||||||
@ -1541,9 +1572,7 @@ void TManutenzione_app::update()
|
|||||||
ditte.readat(rec);
|
ditte.readat(rec);
|
||||||
}
|
}
|
||||||
ditte.close();
|
ditte.close();
|
||||||
|
//chiude il log di conversione
|
||||||
write_log("--------------------");
|
|
||||||
write_log("");
|
|
||||||
close_log();
|
close_log();
|
||||||
|
|
||||||
if (firm > 0) set_firm(firm);
|
if (firm > 0) set_firm(firm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user