Patch level : 12.0 no-patch
Files correlati : Commento : Aggiornamento Campo/Compass. - Aggiunto file di Log in temp - Sistemazione ordine esportazione - Pulizia maschera git-svn-id: svn://10.65.10.50/branches/R_10_00@23434 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3a2a02e5d8
commit
107471405b
@ -29,20 +29,6 @@ long TCampass_msk::handler(WINDOW task, EVENT* ep)
|
||||
|
||||
bool TCampass_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_DATA_INI:
|
||||
case F_DATA_FIN:
|
||||
if (e == fe_modify)
|
||||
break;
|
||||
/*
|
||||
case F_FILES:
|
||||
if (e == se_query_add || e == se_query_del)
|
||||
return false;
|
||||
*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -58,10 +44,11 @@ class TCampass_app : public TSkeleton_application
|
||||
protected:
|
||||
TToken_string tables;
|
||||
TString DSN, usr, psw;
|
||||
const TString getTime() const;
|
||||
const TString getFam(TString codArt) const {TString app; app << codArt[3] << codArt[4] << codArt[5]; return app; } // Restituisce la famiglia di un prodotto CODART[3,5]
|
||||
const TString getGroup(TString codTab) const {TString app; app << codTab[1] << codTab[2] << codTab[3]; return app; } // Restituisce la famiglia di un prodotto CODART[3,5]
|
||||
const TString toEscape(TString val) const; // Prende una stringa e sistema i caratteri di escape
|
||||
const TString zeroFill(TString val) const; // Riempe di 0 se non ci sono 6 caratteri
|
||||
const TString zeroFill(TString val, int n = 6) const; // Riempe di 0 se non ci sono 6 caratteri
|
||||
bool setParameters(TString dsn, TString utente, TString password);
|
||||
bool checkParameters(const TString& DSN, const TString& usr, const TString& psw) { TODBC_recordset connTest(""); return connTest.connect(DSN, usr, psw) ? setParameters(DSN, usr, psw) : false; }
|
||||
//*****************************************************************
|
||||
@ -88,6 +75,21 @@ public:
|
||||
void setTable(TToken_string s) { tables = s; }
|
||||
};
|
||||
|
||||
const TString TCampass_app::getTime() const
|
||||
{
|
||||
TString app;
|
||||
time_t timer = time(0); // Tempo per il file di log
|
||||
tm *ltm = localtime(&timer);
|
||||
TString hour; hour << 1 + ltm->tm_hour;
|
||||
TString min; min << 1 + ltm->tm_min;
|
||||
TString sec; sec << 1 + ltm->tm_sec;
|
||||
TString day; day << ltm->tm_mday;
|
||||
TString month; month << 1 + ltm->tm_mon;
|
||||
TString year; year << 1900 + ltm->tm_year;
|
||||
app << zeroFill(day, 2) << "/" << zeroFill(month, 2) << "/" << year << " - " << zeroFill(hour, 2) << ":" << zeroFill(min, 2) << ":" << zeroFill(sec, 2);
|
||||
return app;
|
||||
}
|
||||
|
||||
const TString TCampass_app::toEscape(TString val) const
|
||||
{
|
||||
TString app;
|
||||
@ -106,11 +108,11 @@ const TString TCampass_app::toEscape(TString val) const
|
||||
return app;
|
||||
}
|
||||
|
||||
const TString TCampass_app::zeroFill(TString val) const
|
||||
const TString TCampass_app::zeroFill(TString val, int n) const
|
||||
{
|
||||
TString app;
|
||||
if (6 - val.len() > 0)
|
||||
app.fill('0', 6 - val.len());
|
||||
if (n - val.len() > 0)
|
||||
app.fill('0', n - val.len());
|
||||
app << val;
|
||||
return app;
|
||||
}
|
||||
@ -186,69 +188,126 @@ TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TStr
|
||||
|
||||
// Adesso inizio a popolarle
|
||||
|
||||
// O01B, quasi finito di implementarla, è stata messa in pausa
|
||||
//if(!o01b(DSN)) return false;
|
||||
|
||||
// File di Log
|
||||
ofstream logFile;
|
||||
logFile.open("temp/Campass_log.txt");
|
||||
if(!logFile.is_open())
|
||||
return "Errore generazione file di Log";
|
||||
|
||||
logFile << getTime() << " - Test connessione\n";
|
||||
|
||||
TODBC_recordset sqlset("");
|
||||
if (!sqlset.connect(DSN, usr, psw))
|
||||
return "Connessione fallita!";
|
||||
|
||||
// INIZIO A01
|
||||
TString a01; a01 << startExport("A01");
|
||||
|
||||
if(!a01a(a01)) errors << "ERRORE TABELLA: A01A\n"; // O01A
|
||||
|
||||
endExport(a01);
|
||||
logFile << getTime() << " - Connessione effettuata!\n";
|
||||
|
||||
|
||||
|
||||
// INIZIO O01
|
||||
TString o01; o01 << startExport("O01");
|
||||
|
||||
if(!o01a(o01)) errors << "ERRORE TABELLA: O01A\n"; // O01A
|
||||
if(!o01e(o01)) errors << "ERRORE TABELLA: O01E\n"; // O01E
|
||||
|
||||
endExport(o01);
|
||||
|
||||
|
||||
// INIZIO O02
|
||||
TString o02; o02 << startExport("O02");
|
||||
|
||||
if(!o02a("ORC", o02)) errors << "ERRORE TABELLA: O02A\n"; // O02A ORC
|
||||
if(!o02a("PRC", o02)) errors << "ERRORE TABELLA: O02A\n"; // O02A PRC
|
||||
if(!o02c("ORC", o02)) errors << "ERRORE TABELLA: O02C\n"; // O02C ORC
|
||||
if(!o02c("PRC", o02)) errors << "ERRORE TABELLA: O02C\n"; // O02C PRC
|
||||
|
||||
endExport(o02);
|
||||
|
||||
// INIZIO O03
|
||||
logFile << getTime() << " - Inizio esportazione O03:\n";
|
||||
|
||||
TString o03; o03 << startExport("O03");
|
||||
|
||||
if(!o03a(o03)) errors << "ERRORE TABELLA: O03A\n"; // O03A
|
||||
|
||||
endExport(o03);
|
||||
|
||||
logFile << getTime() << " - Esportata tabella O03A\n";
|
||||
|
||||
endExport(o03);
|
||||
logFile << getTime() << " - Fine esportazione O03!\n";
|
||||
|
||||
|
||||
// INIZIO p01
|
||||
TString p01; p01 << startExport("P01");
|
||||
// INIZIO P02
|
||||
logFile << getTime() << " - Inizio esportazione P02:\n";
|
||||
|
||||
if(!p01a(p01)) errors << "ERRORE TABELLA: P01A\n"; // P01A
|
||||
if(!p01b(p01)) errors << "ERRORE TABELLA: P01B\n"; // P01B
|
||||
|
||||
endExport(p01);
|
||||
|
||||
|
||||
|
||||
// INIZIO p02
|
||||
TString p02; p02 << startExport("P02");
|
||||
|
||||
if(!p02a(p02)) errors << "ERRORE TABELLA: P02A\n"; // P02A
|
||||
|
||||
logFile << getTime() << " - Esportata tabella P02A\n";
|
||||
|
||||
endExport(p02);
|
||||
endExport(p02);
|
||||
|
||||
logFile << getTime() << " - Fine esportazione P02!\n";
|
||||
|
||||
|
||||
// INIZIO P01
|
||||
|
||||
logFile << getTime() << " - Inizio esportazione P01:\n";
|
||||
|
||||
TString p01; p01 << startExport("P01");
|
||||
|
||||
if(!p01a(p01)) errors << "ERRORE TABELLA: P01A\n"; // P01A
|
||||
|
||||
logFile << getTime() << " - Esportata tabella P01A\n";
|
||||
|
||||
if(!p01b(p01)) errors << "ERRORE TABELLA: P01B\n"; // P01B
|
||||
|
||||
logFile << getTime() << " - Esportata tabella P01B\n";
|
||||
|
||||
endExport(p01);
|
||||
|
||||
logFile << getTime() << " - Fine esportazione P01!\n";
|
||||
|
||||
// INIZIO O01
|
||||
|
||||
logFile << getTime() << " - Inizio esportazione O01:\n";
|
||||
|
||||
TString o01; o01 << startExport("O01");
|
||||
|
||||
if(!o01a(o01)) errors << "ERRORE TABELLA: O01A\n"; // O01A
|
||||
|
||||
logFile << getTime() << " - Esportata tabella O01A\n";
|
||||
|
||||
if(!o01e(o01)) errors << "ERRORE TABELLA: O01E\n"; // O01E
|
||||
|
||||
logFile << getTime() << " - Esportata tabella O01E\n";
|
||||
|
||||
endExport(o01);
|
||||
|
||||
logFile << getTime() << " - Fine esportazione O01!\n";
|
||||
|
||||
|
||||
// INIZIO O02
|
||||
|
||||
logFile << getTime() << " - Inizio esportazione O02:\n";
|
||||
|
||||
TString o02; o02 << startExport("O02");
|
||||
|
||||
if(!o02a("ORC", o02)) errors << "ERRORE TABELLA: O02A - ORC\n"; // O02A ORC
|
||||
|
||||
logFile << getTime() << " - Esportata tabella O02A - ORC\n";
|
||||
|
||||
if(!o02a("PRC", o02)) errors << "ERRORE TABELLA: O02A - PRC\n"; // O02A PRC
|
||||
|
||||
logFile << getTime() << " - Esportata tabella O02A - PRC\n";
|
||||
|
||||
if(!o02c("ORC", o02)) errors << "ERRORE TABELLA: O02C - ORC\n"; // O02C ORC
|
||||
|
||||
logFile << getTime() << " - Esportata tabella O02C - ORC\n";
|
||||
|
||||
if(!o02c("PRC", o02)) errors << "ERRORE TABELLA: O02C - PRC\n"; // O02C PRC
|
||||
|
||||
logFile << getTime() << " - Esportata tabella O02C - PRC\n";
|
||||
|
||||
endExport(o02);
|
||||
|
||||
logFile << getTime() << " - Fine esportazione O02!\n";
|
||||
|
||||
|
||||
// INIZIO A01
|
||||
|
||||
logFile << getTime() << " - Inizio esportazione A01:\n";
|
||||
|
||||
TString a01; a01 << startExport("A01");
|
||||
|
||||
if(!a01a(a01)) errors << "ERRORE TABELLA: A01A\n"; // O01A
|
||||
|
||||
logFile << getTime() << " - Esportata tabella A01A\n";
|
||||
|
||||
endExport(a01);
|
||||
|
||||
logFile << getTime() << " - Fine esportazione A01!\n";
|
||||
|
||||
logFile.close();
|
||||
|
||||
return errors;
|
||||
}
|
||||
@ -454,7 +513,7 @@ bool TCampass_app::o02a(const TString CodNum, const TString id) const
|
||||
return false;
|
||||
TRelation doc(LF_DOC),rdoc(LF_RIGHEDOC);
|
||||
int items;
|
||||
TString msg("Esportazione tabella "); msg << "O02A";
|
||||
TString msg("Esportazione tabella "); msg << "O02A - " << CodNum;
|
||||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono più veloci di un filtro (come è possibile?)
|
||||
TRectype filtroRDoc(rdoc.curr()); filtroRDoc.put("CODNUM", CodNum);
|
||||
TCursor curRDoc(&rdoc, "", 1, &filtroRDoc, &filtroRDoc);
|
||||
@ -507,7 +566,7 @@ bool TCampass_app::o02c(const TString CodNum, const TString id) const
|
||||
return false;
|
||||
TRelation doc(LF_DOC),rdoc(LF_RIGHEDOC);
|
||||
int items;
|
||||
TString msg("Esportazione tabella "); msg << "O02C";
|
||||
TString msg("Esportazione tabella "); msg << "O02C - " << CodNum;
|
||||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono più veloci di un filtro (come è possibile?)
|
||||
TRectype filtroRDoc(rdoc.curr()); filtroRDoc.put("CODNUM", "ORP1");
|
||||
TCursor curRDoc(&rdoc, "", 1, &filtroRDoc, &filtroRDoc);
|
||||
|
@ -1,6 +1,4 @@
|
||||
#define F_DSN 250
|
||||
#define F_USR 251
|
||||
#define F_PWD 252
|
||||
#define F_DATA_INI 253
|
||||
#define F_DATA_FIN 254
|
||||
|
||||
#define F_DSN 250
|
||||
#define F_USR 251
|
||||
#define F_PWD 252
|
||||
#define F_LOG 253
|
||||
|
@ -27,52 +27,8 @@ BEGIN
|
||||
FLAGS "*"
|
||||
END
|
||||
|
||||
DATE F_DATA_INI
|
||||
BEGIN
|
||||
PROMPT 1 2 "Data iniziale "
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
DATE F_DATA_FIN
|
||||
BEGIN
|
||||
PROMPT 1 3 "Data finale "
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Riga" -1 -1 60 5
|
||||
|
||||
BOOLEAN 101
|
||||
BEGIN
|
||||
PROMPT 1 1 "Selezionato per invio"
|
||||
END
|
||||
|
||||
NUMBER 102 2
|
||||
BEGIN
|
||||
PROMPT 1 3 "File "
|
||||
FLAGS "L"
|
||||
END
|
||||
|
||||
STRING 103 32
|
||||
BEGIN
|
||||
PROMPT 10 2 ""
|
||||
FLAGS "L"
|
||||
END
|
||||
|
||||
NUMBER 104 8
|
||||
BEGIN
|
||||
PROMPT 30 1 ""
|
||||
FLAGS "L"
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 8 2
|
||||
BEGIN
|
||||
PROMPT -11 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
Loading…
x
Reference in New Issue
Block a user