Patch level : 12.0
Files correlati : Commento : Sistemata query e tabella errata git-svn-id: svn://10.65.10.50/branches/R_10_00@23895 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
042a5d4809
commit
da3df8a6ff
@ -71,7 +71,7 @@ protected:
|
||||
bool p01b(const TString id) const;
|
||||
bool p02a(const TString id) const;
|
||||
|
||||
bool c09p(const TString id) const; // Esportazione cicli articoli
|
||||
bool p01c(const TString id) const; // Esportazione cicli articoli
|
||||
bool c09a() const; // Importazione cicli articoli
|
||||
/**< Funzione di test */
|
||||
bool test() const;
|
||||
@ -252,6 +252,10 @@ TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TStr
|
||||
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";
|
||||
@ -319,19 +323,6 @@ TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TStr
|
||||
|
||||
logFile << getTime() << " - Fine esportazione A01!\n";
|
||||
|
||||
// INIZIO C09
|
||||
logFile << getTime() << " - Inizio esportazione C09:\n";
|
||||
|
||||
TString c09; c09 << startExport("C09");
|
||||
|
||||
if(!c09p(c09)) errors << "ERRORE TABELLA: C09P\n"; // O01A
|
||||
else
|
||||
logFile << getTime() << " - Esportata tabella C09P\n";
|
||||
|
||||
endExport(c09);
|
||||
|
||||
logFile << getTime() << " - Fine esportazione C09!\n";
|
||||
|
||||
if(yesno_box("Importare tabella C09A?"))
|
||||
{
|
||||
logFile << getTime() << " - Inizio importazione C09A:\n";
|
||||
@ -1097,7 +1088,7 @@ bool TCampass_app::p02a(const TString id) const
|
||||
return sqlset.commit() == -1 ? false : true;
|
||||
}
|
||||
|
||||
bool TCampass_app::c09p(const TString id) const
|
||||
bool TCampass_app::p01c(const TString id) const
|
||||
{
|
||||
TODBC_recordset sqlset("", true);
|
||||
// Controllo la connessione
|
||||
@ -1118,16 +1109,29 @@ bool TCampass_app::c09p(const TString id) const
|
||||
// Prendo la riga di Anamag
|
||||
TRectype rowAna = curAna.curr();
|
||||
|
||||
TString codTab; codTab << rowAna.get("CODTAB");
|
||||
TString codTab; codTab << rowAna.get("CODART");
|
||||
// Dichiaro la stringa
|
||||
TString sqlQuery;
|
||||
|
||||
// Inserisco Tutto
|
||||
sqlQuery << "INSERT INTO C09P (IKRUNEXP, CSTR, CCIC, CART, CCICVER) VALUES('" << id << "','DBS','" << rowAna.get("USER18") << "','" << rowAna.get("CODART") << "','";
|
||||
sqlQuery << "INSERT INTO P01C (IKRUNIMP, CSTR, CCIC, CART, CCICVER) VALUES('" << id << "','DBS',";
|
||||
|
||||
TString user18 = rowAna.get("USER18");
|
||||
|
||||
if(user18.full())
|
||||
sqlQuery << "'" << toEscape(user18) << "'";
|
||||
else
|
||||
sqlQuery << "NULL";
|
||||
|
||||
sqlQuery << ",'" << toEscape(rowAna.get("CODART")) << "',";
|
||||
|
||||
TString keyTab; keyTab << "PS|920|CCC|" << rowAna.get("USER18");
|
||||
|
||||
sqlQuery << cache().get(LF_TABMOD, keyTab, "I0") << "');";
|
||||
TString ccicver; ccicver << cache().get(LF_TABMOD, keyTab, "I0");
|
||||
if(ccicver.full())
|
||||
sqlQuery << "'" << toEscape(ccicver) << "');";
|
||||
else
|
||||
sqlQuery << "NULL);";
|
||||
|
||||
if(sqlset.exec(sqlQuery) != 1)
|
||||
{
|
||||
@ -1147,15 +1151,20 @@ bool TCampass_app::c09a() const
|
||||
TString sqlQuery = "SELECT * \
|
||||
FROM C09A JOIN RUNEXP ON C09A.IKRUNEXP = RUNEXP.IDRUNEXP \
|
||||
WHERE RUNEXP.DWEND IS NOT NULL AND RUNEXP.DRINI IS NULL;";
|
||||
if(sqlset.exec(sqlQuery) != 1)
|
||||
if(sqlset.exec(sqlQuery) <= 0)
|
||||
{
|
||||
message_box(sqlQuery);
|
||||
return false;
|
||||
}
|
||||
// Importo tutto quello che ho trovato
|
||||
TLocalisamfile tabMod(LF_TABMOD);
|
||||
TString msg("Importazione tabella "); msg << "C09A";
|
||||
TProgress_monitor p(sqlset.items(), msg);
|
||||
for(bool ok = sqlset.move_first(); ok; sqlset.move_next())
|
||||
{
|
||||
if (!p.add_status())
|
||||
break;
|
||||
|
||||
TString ccic = sqlset.get("C09A.CCIC").as_string();
|
||||
TString rcic = sqlset.get("C09A.RCIC").as_string();
|
||||
int nrev = sqlset.get("C09A.NREV").as_int();
|
||||
@ -1166,6 +1175,7 @@ bool TCampass_app::c09a() const
|
||||
rec.put("CODTAB", ccic);
|
||||
rec.put("S0", rcic);
|
||||
rec.put("I0", nrev);
|
||||
|
||||
if(rec.rewrite_write(tabMod) != NOERR)
|
||||
{
|
||||
message_box(TR("Errore caricamento record CCIC: %s RCIC: %s NREV: %d"), ccic, rcic, nrev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user