Patch level : 12.0 no-patch
Files correlati : mr0.exe Commento : Aggiornamento query Campo/Compass: - SAggiunta query O01C git-svn-id: svn://10.65.10.50/branches/R_10_00@23568 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4541938e26
commit
2ce78f75c6
@ -61,6 +61,7 @@ protected:
|
|||||||
// Funzioni di esportazione
|
// Funzioni di esportazione
|
||||||
bool a01a(const TString id) const;
|
bool a01a(const TString id) const;
|
||||||
bool o01a(const TString id) const;
|
bool o01a(const TString id) const;
|
||||||
|
bool o01c(const TString id) const;
|
||||||
bool o01e(const TString id) const;
|
bool o01e(const TString id) const;
|
||||||
bool o02a(const TString CodNum, const TString id) const;
|
bool o02a(const TString CodNum, const TString id) const;
|
||||||
bool o02c(const TString CodNum, const TString id) const;
|
bool o02c(const TString CodNum, const TString id) const;
|
||||||
@ -199,7 +200,7 @@ TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TStr
|
|||||||
TODBC_recordset sqlset("");
|
TODBC_recordset sqlset("");
|
||||||
if (!sqlset.connect(DSN, usr, psw))
|
if (!sqlset.connect(DSN, usr, psw))
|
||||||
return "Connessione fallita!";
|
return "Connessione fallita!";
|
||||||
|
/*
|
||||||
logFile << getTime() << " - Connessione effettuata!\n";
|
logFile << getTime() << " - Connessione effettuata!\n";
|
||||||
|
|
||||||
// INIZIO O03
|
// INIZIO O03
|
||||||
@ -272,7 +273,7 @@ TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TStr
|
|||||||
endExport(o02);
|
endExport(o02);
|
||||||
|
|
||||||
logFile << getTime() << " - Fine esportazione O02!\n";
|
logFile << getTime() << " - Fine esportazione O02!\n";
|
||||||
|
*/
|
||||||
// INIZIO O01
|
// INIZIO O01
|
||||||
|
|
||||||
logFile << getTime() << " - Inizio esportazione O01:\n";
|
logFile << getTime() << " - Inizio esportazione O01:\n";
|
||||||
@ -283,6 +284,10 @@ TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TStr
|
|||||||
else
|
else
|
||||||
logFile << getTime() << " - Esportata tabella O01A\n";
|
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
|
if(!o01e(o01)) errors << "ERRORE TABELLA: O01E\n"; // O01E
|
||||||
else
|
else
|
||||||
logFile << getTime() << " - Esportata tabella O01E\n";
|
logFile << getTime() << " - Esportata tabella O01E\n";
|
||||||
@ -386,7 +391,7 @@ bool TCampass_app::o01a(const TString id) const
|
|||||||
TRelation doc(LF_DOC),rdoc(LF_RIGHEDOC), filtro(LF_RIGHEDOC);
|
TRelation doc(LF_DOC),rdoc(LF_RIGHEDOC), filtro(LF_RIGHEDOC);
|
||||||
int items;
|
int items;
|
||||||
TString msg("Esportazione tabella "); msg << "O01A";
|
TString msg("Esportazione tabella "); msg << "O01A";
|
||||||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono più veloci di un filtro (come è possibile?)
|
// Creo il filtro per la chiave del cursore
|
||||||
TRectype filtroRDoc(rdoc.curr()); filtroRDoc.put("CODNUM", "ORP1");
|
TRectype filtroRDoc(rdoc.curr()); filtroRDoc.put("CODNUM", "ORP1");
|
||||||
TCursor curRDoc(&rdoc, "", 1, &filtroRDoc, &filtroRDoc);
|
TCursor curRDoc(&rdoc, "", 1, &filtroRDoc, &filtroRDoc);
|
||||||
items = curRDoc.items();
|
items = curRDoc.items();
|
||||||
@ -465,6 +470,77 @@ bool TCampass_app::o01a(const TString id) const
|
|||||||
return sqlset.commit() == -1 ? false : true;
|
return sqlset.commit() == -1 ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TCampass_app::o01c(const TString id) const
|
||||||
|
{
|
||||||
|
TODBC_recordset sqlset("", true);
|
||||||
|
// Controllo la connessione
|
||||||
|
if (!sqlset.connect(DSN, usr, psw))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
TRelation rdist(LF_RDIST),rdoc(LF_RIGHEDOC), filtro(LF_RIGHEDOC);
|
||||||
|
int items;
|
||||||
|
TString msg("Esportazione tabella "); msg << "O01C";
|
||||||
|
|
||||||
|
// Cursore RDOC
|
||||||
|
TRectype filtroRDoc(rdoc.curr()); filtroRDoc.put("CODNUM", "ORP1");
|
||||||
|
TSorted_cursor curRDoc(&rdoc, "CODART", "", 1, &filtroRDoc, &filtroRDoc);
|
||||||
|
|
||||||
|
// Cursore RDIST
|
||||||
|
TSorted_cursor curRDist(&rdist, "CODDIST", "TIPO==\"A\"");
|
||||||
|
|
||||||
|
items = curRDoc.items();
|
||||||
|
curRDist.items();
|
||||||
|
TProgress_monitor p(items, msg);
|
||||||
|
|
||||||
|
curRDoc = 0, curRDist = 0;
|
||||||
|
TRectype rowRDoc = curRDoc.curr(), rowRDist = curRDist.curr();
|
||||||
|
for (; curRDoc.pos() < items && curRDist.pos() < curRDist.items() && !p.is_cancelled(); ++curRDoc)
|
||||||
|
{
|
||||||
|
// Aggiorno il Progress Monitor
|
||||||
|
if (!p.add_status())
|
||||||
|
break;
|
||||||
|
|
||||||
|
rowRDoc = curRDoc.curr();
|
||||||
|
while(rowRDoc.get("CODART") < rowRDist.get("CODDIST"))
|
||||||
|
{
|
||||||
|
++curRDoc;
|
||||||
|
rowRDoc = curRDoc.curr();
|
||||||
|
}
|
||||||
|
while(rowRDoc.get("CODART") > rowRDist.get("CODDIST"))
|
||||||
|
{
|
||||||
|
++curRDist;
|
||||||
|
rowRDist = curRDist.curr();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rowRDoc.get("CODART") != rowRDist.get("CODDIST")) continue;
|
||||||
|
|
||||||
|
// Vado a prendere la riga di riferimento
|
||||||
|
TRectype filtroFiltro(filtro.curr());
|
||||||
|
if(rowRDoc.get("DACODNUM") == "ORC")
|
||||||
|
{
|
||||||
|
filtroFiltro.put("CODNUM", rowRDoc.get("DACODNUM"));
|
||||||
|
filtroFiltro.put("ANNO", rowRDoc.get("DAANNO"));
|
||||||
|
filtroFiltro.put("PROVV", rowRDoc.get("DAPROVV"));
|
||||||
|
filtroFiltro.put("NDOC", rowRDoc.get("DANDOC"));
|
||||||
|
filtroFiltro.put("IDRIGA", rowRDoc.get("DAIDRIGA"));
|
||||||
|
TCursor curFiltro(&rdoc, "RIGAEVASA != \"X\"", 1, &filtroFiltro, &filtroFiltro);
|
||||||
|
for (curFiltro = 0; curFiltro.pos() < curFiltro.items() && !p.is_cancelled(); ++curFiltro)
|
||||||
|
{
|
||||||
|
TString sqlQuery;
|
||||||
|
sqlQuery << "INSERT INTO O01C ( IKRUNIMP, CStr, CPRD, CARTFIL, CUDM, QIMP, QBASE, XTCALC, NSEQ ) \
|
||||||
|
VALUES('" << id << "','DBS','" << rowRDoc.get("NDOC") << "','" << rowRDist.get("CODCOMP") << "','"
|
||||||
|
<< rowRDist.get("UM") << "','" << rowRDist.get("EXPR") << "','1','0','" << rowRDist.get("NRIG") << "');";
|
||||||
|
if(sqlset.exec(sqlQuery) != 1)
|
||||||
|
{
|
||||||
|
message_box(sqlQuery);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sqlset.commit() == -1 ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
bool TCampass_app::o01e(const TString id) const
|
bool TCampass_app::o01e(const TString id) const
|
||||||
{
|
{
|
||||||
TODBC_recordset sqlset("", true);
|
TODBC_recordset sqlset("", true);
|
||||||
@ -482,6 +558,10 @@ bool TCampass_app::o01e(const TString id) const
|
|||||||
// Adesso inserisco tutta la bella roba
|
// Adesso inserisco tutta la bella roba
|
||||||
for (curRDoc = 0; curRDoc.pos() < items && !p.is_cancelled(); ++curRDoc)
|
for (curRDoc = 0; curRDoc.pos() < items && !p.is_cancelled(); ++curRDoc)
|
||||||
{
|
{
|
||||||
|
// Aggiorno il Progress Monitor
|
||||||
|
if (!p.add_status())
|
||||||
|
break;
|
||||||
|
|
||||||
TRectype rowRDoc = curRDoc.curr();
|
TRectype rowRDoc = curRDoc.curr();
|
||||||
|
|
||||||
// Vado a prendere la riga di riferimento
|
// Vado a prendere la riga di riferimento
|
||||||
|
Loading…
x
Reference in New Issue
Block a user