From 08a10571ae885c881e764151605fbf3182becbbf Mon Sep 17 00:00:00 2001 From: mtollari Date: Fri, 30 Jun 2017 09:45:10 +0000 Subject: [PATCH] Patch level : 12.0 Files correlati : Commento : Aggiunti flag import e export git-svn-id: svn://10.65.10.50/branches/R_10_00@23896 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- src/mr/mr0600.cpp | 266 +++++++++++++++++++++++---------------------- src/mr/mr0600a.h | 10 +- src/mr/mr0600a.uml | 12 +- 3 files changed, 154 insertions(+), 134 deletions(-) diff --git a/src/mr/mr0600.cpp b/src/mr/mr0600.cpp index f99a2991b..65c09aa8b 100644 --- a/src/mr/mr0600.cpp +++ b/src/mr/mr0600.cpp @@ -38,6 +38,8 @@ TCampass_msk::TCampass_msk() : TAutomask("mr0600a") set(F_DSN, ini_get_string(CONFIG_DITTA, "Campo_Compass", "DSN")); set(F_USR, ini_get_string(CONFIG_DITTA, "Campo_Compass", "User")); set(F_PWD, ini_get_string(CONFIG_DITTA, "Campo_Compass", "Password")); + set(B_IMPORT, ini_get_bool(CONFIG_DITTA, "Campo_Compass", "Importa")); + set(B_EXPORT, ini_get_bool(CONFIG_DITTA, "Campo_Compass", "Esporta")); } class TCampass_app : public TSkeleton_application @@ -45,6 +47,7 @@ class TCampass_app : public TSkeleton_application protected: TToken_string tables; TString DSN, usr, psw; + TCampass_msk* m; 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] @@ -80,8 +83,15 @@ protected: public: virtual void main_loop(); void setTable(TToken_string s) { tables = s; } + ~TCampass_app(); }; +TCampass_app::~TCampass_app() +{ + if(m != NULL) + delete m; +} + const TString TCampass_app::getTime() const { TString app; @@ -130,6 +140,8 @@ bool TCampass_app::setParameters(TString dsn, TString utente, TString password) ini_set_string(CONFIG_DITTA, "Campo_Compass", "DSN", dsn); ini_set_string(CONFIG_DITTA, "Campo_Compass", "User", utente); ini_set_string(CONFIG_DITTA, "Campo_Compass", "Password", password); + ini_set_bool(CONFIG_DITTA, "Campo_Compass", "Importa", m->get_bool(B_IMPORT)); + ini_set_bool(CONFIG_DITTA, "Campo_Compass", "Esporta", m->get_bool(B_EXPORT)); DSN = dsn; usr = utente; psw = password; @@ -189,13 +201,6 @@ bool TCampass_app::emptyTables(const TString& DSN, const TString& usr, const TSt TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TString& psw) const { TString errors; - // Funzione disabilitata di debug - // Innanzitutto svuoto le tabelle - //if(!emptyTables(DSN)) return false; - //test(); - //return ""; - - // Adesso inizio a popolarle // File di Log ofstream logFile; @@ -210,131 +215,134 @@ TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TStr return "Connessione fallita!"; logFile << getTime() << " - Connessione effettuata!\n"; - - // INIZIO O03 - logFile << getTime() << " - Inizio esportazione O03:\n"; - TString o03; o03 << startExport("O03"); - - if(!o03a(o03)) errors << "ERRORE TABELLA: O03A\n"; // O03A - else - logFile << getTime() << " - Esportata tabella O03A\n"; - - endExport(o03); - logFile << getTime() << " - Fine esportazione O03!\n"; - - - // INIZIO P02 - logFile << getTime() << " - Inizio esportazione P02:\n"; - - TString p02; p02 << startExport("P02"); - - if(!p02a(p02)) errors << "ERRORE TABELLA: P02A\n"; // P02A - else - logFile << getTime() << " - Esportata tabella P02A\n"; - - 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 - else - logFile << getTime() << " - Esportata tabella P01A\n"; - - if(!p01b(p01)) errors << "ERRORE TABELLA: P01B\n"; // P01B - else - logFile << getTime() << " - Esportata tabella P01B\n"; - - if(!p01c(p01)) errors << "ERRORE TABELLA: P01C\n"; // O01A - else - logFile << getTime() << " - Esportata tabella P01C\n"; - - endExport(p01); - - logFile << getTime() << " - Fine esportazione P01!\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 - else - logFile << getTime() << " - Esportata tabella O02A - ORC\n"; - - if(!o02a("PRC", o02)) errors << "ERRORE TABELLA: O02A - PRC\n"; // O02A PRC - else - logFile << getTime() << " - Esportata tabella O02A - PRC\n"; - - if(!o02c("ORC", o02)) errors << "ERRORE TABELLA: O02C - ORC\n"; // O02C ORC - else - logFile << getTime() << " - Esportata tabella O02C - ORC\n"; - - if(!o02c("PRC", o02)) errors << "ERRORE TABELLA: O02C - PRC\n"; // O02C PRC - else - logFile << getTime() << " - Esportata tabella O02C - PRC\n"; - - endExport(o02); - - logFile << getTime() << " - Fine esportazione O02!\n"; - - // INIZIO O01 - - logFile << getTime() << " - Inizio esportazione O01:\n"; - - TString o01; o01 << startExport("O01"); - - if(!o01a(o01)) errors << "ERRORE TABELLA: O01A\n"; // O01A - else - logFile << getTime() << " - Esportata tabella O01A\n"; - - if(!o01c(o01)) errors << "ERRORE TABELLA: O01C\n"; // O01C - else - logFile << getTime() << " - Esportata tabella O01C\n"; - - if(!o01e(o01)) errors << "ERRORE TABELLA: O01E\n"; // O01E - else - logFile << getTime() << " - Esportata tabella O01E\n"; - - endExport(o01); - - logFile << getTime() << " - Fine esportazione O01!\n"; - - - // INIZIO A01 - - logFile << getTime() << " - Inizio esportazione A01:\n"; - - TString a01; a01 << startExport("A01"); - - if(!a01a(a01)) errors << "ERRORE TABELLA: A01A\n"; // O01A - else - logFile << getTime() << " - Esportata tabella A01A\n"; - - endExport(a01); - - logFile << getTime() << " - Fine esportazione A01!\n"; - - if(yesno_box("Importare tabella C09A?")) + if(m->get_bool(B_EXPORT)) { + + // INIZIO O03 + logFile << getTime() << " - Inizio esportazione O03:\n"; + + TString o03; o03 << startExport("O03"); + + if(!o03a(o03)) errors << "ERRORE TABELLA: O03A\n"; // O03A + else + logFile << getTime() << " - Esportata tabella O03A\n"; + + endExport(o03); + logFile << getTime() << " - Fine esportazione O03!\n"; + + + // INIZIO P02 + logFile << getTime() << " - Inizio esportazione P02:\n"; + + TString p02; p02 << startExport("P02"); + + if(!p02a(p02)) errors << "ERRORE TABELLA: P02A\n"; // P02A + else + logFile << getTime() << " - Esportata tabella P02A\n"; + + 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 + else + logFile << getTime() << " - Esportata tabella P01A\n"; + + if(!p01b(p01)) errors << "ERRORE TABELLA: P01B\n"; // P01B + else + logFile << getTime() << " - Esportata tabella P01B\n"; + + if(!p01c(p01)) errors << "ERRORE TABELLA: P01C\n"; // O01A + else + logFile << getTime() << " - Esportata tabella P01C\n"; + + endExport(p01); + + logFile << getTime() << " - Fine esportazione P01!\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 + else + logFile << getTime() << " - Esportata tabella O02A - ORC\n"; + + if(!o02a("PRC", o02)) errors << "ERRORE TABELLA: O02A - PRC\n"; // O02A PRC + else + logFile << getTime() << " - Esportata tabella O02A - PRC\n"; + + if(!o02c("ORC", o02)) errors << "ERRORE TABELLA: O02C - ORC\n"; // O02C ORC + else + logFile << getTime() << " - Esportata tabella O02C - ORC\n"; + + if(!o02c("PRC", o02)) errors << "ERRORE TABELLA: O02C - PRC\n"; // O02C PRC + else + logFile << getTime() << " - Esportata tabella O02C - PRC\n"; + + endExport(o02); + + logFile << getTime() << " - Fine esportazione O02!\n"; + + // INIZIO O01 + + logFile << getTime() << " - Inizio esportazione O01:\n"; + + TString o01; o01 << startExport("O01"); + + if(!o01a(o01)) errors << "ERRORE TABELLA: O01A\n"; // O01A + else + logFile << getTime() << " - Esportata tabella O01A\n"; + + if(!o01c(o01)) errors << "ERRORE TABELLA: O01C\n"; // O01C + else + logFile << getTime() << " - Esportata tabella O01C\n"; + + if(!o01e(o01)) errors << "ERRORE TABELLA: O01E\n"; // O01E + else + logFile << getTime() << " - Esportata tabella O01E\n"; + + endExport(o01); + + logFile << getTime() << " - Fine esportazione O01!\n"; + + + // INIZIO A01 + + logFile << getTime() << " - Inizio esportazione A01:\n"; + + TString a01; a01 << startExport("A01"); + + if(!a01a(a01)) errors << "ERRORE TABELLA: A01A\n"; // O01A + else + logFile << getTime() << " - Esportata tabella A01A\n"; + + endExport(a01); + + logFile << getTime() << " - Fine esportazione A01!\n"; + + } + + if(m->get_bool(B_IMPORT)) + { + logFile << getTime() << " - Inizio importazione C09A:\n"; if(!c09a()) errors << "ERRORE TABELLA: C09A\n"; // O01A else logFile << getTime() << " - Importata tabella C09A\n"; logFile << getTime() << " - Fine importazione C09A!\n"; } - else - { - logFile << getTime() << " - Saltata importazione C09A!\n"; - } + logFile.close(); @@ -1187,12 +1195,12 @@ bool TCampass_app::c09a() const void TCampass_app::main_loop() { - TCampass_msk m; - while (m.run() == K_ENTER) + m = new TCampass_msk(); + while (m->run() == K_ENTER) { - const TString& DSN = m.get(F_DSN); - const TString& usr = m.get(F_USR); - const TString& psw = m.get(F_PWD); + const TString& DSN = m->get(F_DSN); + const TString& usr = m->get(F_USR); + const TString& psw = m->get(F_PWD); if(checkParameters(DSN, usr, psw)) { // Chiamo la funzione globale esporta diff --git a/src/mr/mr0600a.h b/src/mr/mr0600a.h index 6404d7893..febe5780c 100644 --- a/src/mr/mr0600a.h +++ b/src/mr/mr0600a.h @@ -1,4 +1,6 @@ -#define F_DSN 250 -#define F_USR 251 -#define F_PWD 252 -#define F_LOG 253 +#define F_DSN 101 +#define F_USR 102 +#define F_PWD 103 +#define F_LOG 104 +#define B_EXPORT 105 +#define B_IMPORT 106 diff --git a/src/mr/mr0600a.uml b/src/mr/mr0600a.uml index 626b60bd0..1d1c73fd6 100644 --- a/src/mr/mr0600a.uml +++ b/src/mr/mr0600a.uml @@ -10,7 +10,7 @@ PAGE "Invio a Compass" 0 2 0 0 STRING F_DSN 260 50 BEGIN - PROMPT 1 0 "ODBC DSN " + PROMPT 1 1 "ODBC DSN " CHECKTYPE REQUIRED END @@ -27,6 +27,16 @@ BEGIN FLAGS "*" END +BOOLEAN B_EXPORT +BEGIN + PROMPT 1 4 "Esporta tutte le tabelle" +END + +BOOLEAN B_IMPORT +BEGIN + PROMPT 1 5 "Importa C09A" +END + ENDPAGE ENDMASK