Patch level : 12.0
Files correlati : Commento : Modifiche a Campo/Compass: (da testare) Aggiunta esportazione codici cicli in C09P. Aggiunta importazione codici cicli da C09A Sistemato Long in real in mr2201.cpp git-svn-id: svn://10.65.10.50/branches/R_10_00@23891 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b1c71fc3a0
commit
248ea8b39b
@ -5,6 +5,7 @@
|
||||
#include <relation.h>
|
||||
#include <utility.h>
|
||||
#include <doc.h>
|
||||
#include <recarray.h> // cache()
|
||||
|
||||
#include "mr0600a.h"
|
||||
|
||||
@ -69,6 +70,9 @@ protected:
|
||||
bool p01a(const TString id) const;
|
||||
bool p01b(const TString id) const;
|
||||
bool p02a(const TString id) const;
|
||||
|
||||
bool c09p(const TString id) const; // Esportazione cicli articoli
|
||||
bool c09a() const; // Importazione cicli articoli
|
||||
/**< Funzione di test */
|
||||
bool test() const;
|
||||
//bool o01b(const TString& DSN) const; Messa in pausa
|
||||
@ -314,7 +318,33 @@ TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TStr
|
||||
endExport(a01);
|
||||
|
||||
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";
|
||||
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();
|
||||
|
||||
return errors;
|
||||
@ -1025,6 +1055,7 @@ bool TCampass_app::p01b(const TString id) const
|
||||
|
||||
return sqlset.commit() == -1 ? false : true;
|
||||
}
|
||||
|
||||
bool TCampass_app::p02a(const TString id) const
|
||||
{
|
||||
TODBC_recordset sqlset("", true);
|
||||
@ -1066,6 +1097,84 @@ bool TCampass_app::p02a(const TString id) const
|
||||
return sqlset.commit() == -1 ? false : true;
|
||||
}
|
||||
|
||||
bool TCampass_app::c09p(const TString id) const
|
||||
{
|
||||
TODBC_recordset sqlset("", true);
|
||||
// Controllo la connessione
|
||||
if (!sqlset.connect(DSN, usr, psw))
|
||||
return false;
|
||||
|
||||
int items;
|
||||
TString msg("Esportazione tabella "); msg << "P02A";
|
||||
TRelation anamag(LF_ANAMAG);
|
||||
TCursor curAna(&anamag);
|
||||
items = curAna.items();
|
||||
TProgress_monitor p(items, msg);
|
||||
for(curAna = 0; curAna.pos() < items; ++curAna)
|
||||
{
|
||||
if (!p.add_status())
|
||||
break;
|
||||
|
||||
// Prendo la riga di Anamag
|
||||
TRectype rowAna = curAna.curr();
|
||||
|
||||
TString codTab; codTab << rowAna.get("CODTAB");
|
||||
// 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") << "','";
|
||||
|
||||
TString keyTab; keyTab << "PS|920|CCC|" << rowAna.get("USER18");
|
||||
|
||||
sqlQuery << cache().get(LF_TABMOD, keyTab, "I0") << "');";
|
||||
|
||||
if(sqlset.exec(sqlQuery) != 1)
|
||||
{
|
||||
message_box(sqlQuery);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return sqlset.commit() == -1 ? false : true;
|
||||
}
|
||||
|
||||
bool TCampass_app::c09a() const
|
||||
{
|
||||
TODBC_recordset sqlset("", true);
|
||||
if (!sqlset.connect(DSN, usr, psw))
|
||||
return false;
|
||||
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)
|
||||
{
|
||||
message_box(sqlQuery);
|
||||
return false;
|
||||
}
|
||||
// Importo tutto quello che ho trovato
|
||||
TLocalisamfile tabMod(LF_TABMOD);
|
||||
for(bool ok = sqlset.move_first(); ok; sqlset.move_next())
|
||||
{
|
||||
TString ccic = sqlset.get("C09A.CCIC").as_string();
|
||||
TString rcic = sqlset.get("C09A.RCIC").as_string();
|
||||
int nrev = sqlset.get("C09A.NREV").as_int();
|
||||
TRectype rec(LF_TABMOD);
|
||||
rec.put("MOD", "PS");
|
||||
rec.put("CUST", "920");
|
||||
rec.put("COD", "CCC");
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TCampass_app::main_loop()
|
||||
{
|
||||
TCampass_msk m;
|
||||
|
@ -697,7 +697,7 @@ void TCRP_line::fill_load_row(TToken_string& row, char load_type, bool percent)
|
||||
NFCHECK("Tipo di carico non riconosciuto");
|
||||
}
|
||||
if (percent)
|
||||
l = c.is_zero() ? ZERO : (100L * l / c);
|
||||
l = c.is_zero() ? ZERO : (CENTO * l / c);
|
||||
row.add(l.string(), bu + F_LBUCKET0 -FIRST_FIELD); // buckets
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user