Patch level : 12.0 1090
Files correlati : bs0.exe Commento : aggiunto un meccanismo di trace nell'importazione bee store Interno:
This commit is contained in:
parent
c91aa2efc3
commit
c81d72de4d
@ -238,12 +238,12 @@ class TImporta_Beestore : public TSkeleton_application
|
||||
protected:
|
||||
bool save_and_delete_doc(TDocumento * doc) const;
|
||||
|
||||
void import_table(int logicnum, const char* table, TAssoc_array& pairs);
|
||||
void import_table(const char * tab, const char* table, TAssoc_array& pairs);
|
||||
void import_table(int logicnum, const char* table, TAssoc_array& pairs, const char * msg = nullptr);
|
||||
void import_table(const char * tab, const char* table, TAssoc_array& pairs, const char * msg = nullptr);
|
||||
void direct_table(int logicnum, TODBC_recordset & odbc, TAssoc_array& pairs);
|
||||
void direct_table(const char * table, TODBC_recordset & odbc, TAssoc_array& pairs);
|
||||
void transaction_table(int logicnum, TODBC_recordset & odbc, TAssoc_array& pairs);
|
||||
void transaction_table(const char * table, TODBC_recordset & odbc, TAssoc_array& pairs);
|
||||
void transaction_table(int logicnum, TODBC_recordset & odbc, TAssoc_array& pairs, const char * msg = nullptr);
|
||||
void transaction_table(const char * table, TODBC_recordset & odbc, TAssoc_array& pairs, const char * msg = nullptr);
|
||||
|
||||
void import_iva();
|
||||
void import_ums();
|
||||
@ -254,7 +254,7 @@ protected:
|
||||
void import_barcode();
|
||||
|
||||
void direct_doc(TODBC_recordset & odbc, const char * table, const int tipotestata, const char* unitadefault, bool importadoc);
|
||||
void transaction_doc(TODBC_recordset & odbc, const char * table, const int tipotestata, const char* unitadefault, bool importadoc);
|
||||
void transaction_doc(TODBC_recordset & odbc, const char * hmsg, const char * table, const int tipotestata, const char* unitadefault, bool importadoc);
|
||||
void import_doc(const TDate& dal, const TDate& al, int tipotestata,const char* unitadefault, bool importadoc);
|
||||
void import_clifo(int cfmask, const TDate& dal, const TDate& al);
|
||||
|
||||
@ -392,35 +392,40 @@ const char * TImporta_Beestore::build_query(const char* table, TAssoc_array& pai
|
||||
return query;
|
||||
}
|
||||
|
||||
void TImporta_Beestore::import_table(int logicnum, const char* table, TAssoc_array& pairs)
|
||||
void TImporta_Beestore::import_table(int logicnum, const char* table, TAssoc_array& pairs, const char * msg)
|
||||
{
|
||||
TString str;
|
||||
TString str(msg);
|
||||
TODBC_recordset odbc(build_query(table, pairs));
|
||||
|
||||
odbc.connect(_dsn, _usr, _psw);
|
||||
|
||||
const TRecnotype n = odbc.items();
|
||||
TRACE("Importazione file %s", logicnum);
|
||||
|
||||
if (str.blank())
|
||||
str << "file " << logicnum;
|
||||
TRACE("Importazione %s", str);
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
if (_direct_write)
|
||||
direct_table(logicnum, odbc, pairs);
|
||||
else
|
||||
transaction_table(logicnum, odbc, pairs);
|
||||
transaction_table(logicnum, odbc, pairs, str);
|
||||
}
|
||||
}
|
||||
|
||||
void TImporta_Beestore::import_table(const char * tab, const char* table, TAssoc_array& pairs)
|
||||
void TImporta_Beestore::import_table(const char * tab, const char* table, TAssoc_array& pairs, const char * msg)
|
||||
{
|
||||
TString str;
|
||||
TString str(msg);
|
||||
TODBC_recordset odbc(build_query(table, pairs));
|
||||
|
||||
odbc.connect(_dsn, _usr, _psw);
|
||||
|
||||
const TRecnotype n = odbc.items();
|
||||
|
||||
TRACE("Importazione tabella %s", tab);
|
||||
if (str.blank())
|
||||
str << "tabella " << tab;
|
||||
TRACE("Importazione %s", str);
|
||||
if (n > 0)
|
||||
{
|
||||
if (_direct_write)
|
||||
@ -582,7 +587,7 @@ void TImporta_Beestore::direct_table(const char * tab, TODBC_recordset & odbc, T
|
||||
}
|
||||
|
||||
// Carica da BeeStore i record con Origine=1, cioè generati da lui ed eventualmente aggiorna i corrispondenti in Campo
|
||||
void TImporta_Beestore::transaction_table(int logicnum, TODBC_recordset & odbc, TAssoc_array& pairs)
|
||||
void TImporta_Beestore::transaction_table(int logicnum, TODBC_recordset & odbc, TAssoc_array& pairs, const char * msg)
|
||||
{
|
||||
TString str;
|
||||
TLocalisamfile file(logicnum);
|
||||
@ -647,12 +652,14 @@ void TImporta_Beestore::transaction_table(int logicnum, TODBC_recordset & odbc,
|
||||
transactions.add(t);
|
||||
}
|
||||
}
|
||||
str = msg;
|
||||
str << " #KEY";
|
||||
execute_transactions(transactions, *_log, _interactive, str);
|
||||
}
|
||||
}
|
||||
|
||||
// Carica da BeeStore i record con Origine=1, cioè generati da lui ed eventualmente aggiorna i corrispondenti in Campo
|
||||
void TImporta_Beestore::transaction_table(const char * table, TODBC_recordset & odbc, TAssoc_array& pairs)
|
||||
void TImporta_Beestore::transaction_table(const char * table, TODBC_recordset & odbc, TAssoc_array& pairs, const char * msg)
|
||||
{
|
||||
TString str;
|
||||
TTable file(table);
|
||||
@ -706,6 +713,8 @@ void TImporta_Beestore::transaction_table(const char * table, TODBC_recordset &
|
||||
transactions.add(t);
|
||||
}
|
||||
}
|
||||
str = msg;
|
||||
str << " #KEY";
|
||||
execute_transactions(transactions, *_log, _interactive, str);
|
||||
}
|
||||
}
|
||||
@ -716,8 +725,7 @@ void TImporta_Beestore::import_ums()
|
||||
|
||||
fields.add("CodUntMis", "CODTAB");
|
||||
fields.add("DSUntMis", "S0");
|
||||
TRACE("Unità di misura");
|
||||
import_table("%UMS", "tieUntMisura", fields);
|
||||
import_table("%UMS", "tieUntMisura", fields, "Unità di misura ");
|
||||
}
|
||||
|
||||
void TImporta_Beestore::import_iva()
|
||||
@ -728,8 +736,7 @@ void TImporta_Beestore::import_iva()
|
||||
fields.add("CodIvaSt", "CODTAB");
|
||||
fields.add("DSIva", "S0");
|
||||
fields.add("Aliquota", "R0");
|
||||
TRACE("IVA");
|
||||
import_table("%IVA", "tieIva", fields);
|
||||
import_table("%IVA", "tieIva", fields, "IVA ");
|
||||
}
|
||||
|
||||
void TImporta_Beestore::import_lines()
|
||||
@ -738,8 +745,7 @@ void TImporta_Beestore::import_lines()
|
||||
|
||||
fields.add("CodLinea", "CODTAB");
|
||||
fields.add("DSLinea", "S0");
|
||||
TRACE("Linee");
|
||||
import_table("GMC", "tieLineeArt", fields);
|
||||
import_table("GMC", "tieLineeArt", fields, "Linea ");
|
||||
}
|
||||
|
||||
void TImporta_Beestore::import_catmer()
|
||||
@ -749,8 +755,7 @@ void TImporta_Beestore::import_catmer()
|
||||
fields.add("CodCategoriaMerceologica", "CODTAB");
|
||||
fields.add("DSCategoriaMerceologica", "S0");
|
||||
// fields.add("CodTipoEtichetta", ""); a che serviva ?
|
||||
TRACE("Categorie merceologiche");
|
||||
import_table("GMC", "tieCategorieMerceologiche", fields);
|
||||
import_table("GMC", "tieCategorieMerceologiche", fields, "Categoria merceologica ");
|
||||
}
|
||||
|
||||
void TImporta_Beestore::import_anamag()
|
||||
@ -764,7 +769,6 @@ void TImporta_Beestore::import_anamag()
|
||||
fields.add("CodCategMerceologica", ANAMAG_GRMERC);
|
||||
fields.add("Bloccato", ANAMAG_SOSPESO);
|
||||
fields.add("codDogana", ANAMAG_CLASSDOG);
|
||||
TRACE("Anagrafica di magazzino");
|
||||
if (_direct_write)
|
||||
{
|
||||
import_table(LF_ANAMAG, "tieArticoli", fields);
|
||||
@ -779,7 +783,7 @@ void TImporta_Beestore::import_anamag()
|
||||
fields.add("CodPadre", FIELD_NAME(LF_UMART, UMART_CODART));
|
||||
fields.add("@1", FIELD_NAME(LF_UMART, UMART_NRIGA));
|
||||
fields.add("CodUntMagazzino", FIELD_NAME(LF_UMART, UMART_UM));
|
||||
import_table(LF_ANAMAG, "tieArticoli", fields);
|
||||
import_table(LF_ANAMAG, "tieArticoli", fields, "Anagrafica di magazzino ");
|
||||
}
|
||||
import_barcode();
|
||||
}
|
||||
@ -1152,7 +1156,7 @@ void TImporta_Beestore::transaction_clifo(char tipocf) // fare
|
||||
|
||||
const TRecnotype n = odbc.items();
|
||||
|
||||
str.cut(0) << TR("Importazione ") << (tipocf == 'F' ? TR("Fornitori") : TR(" CLIenti"));
|
||||
str.cut(0) << TR("Importazione ") << (tipocf == 'F' ? TR("Fornitori") : TR(" Clienti"));
|
||||
|
||||
TProgress_monitor pi(n, str);
|
||||
|
||||
@ -1232,7 +1236,10 @@ void TImporta_Beestore::transaction_clifo(char tipocf) // fare
|
||||
t.set(CLI_DATAAGG, dataagg, -1, LF_CLIFO);
|
||||
transactions.add(t);
|
||||
}
|
||||
execute_transactions(transactions, *_log, _interactive, str);
|
||||
TString hstr((tipocf == 'F' ? TR("Fornitore ") : TR(" Cliente ")));
|
||||
|
||||
hstr << "#" << CLI_CODCF;
|
||||
execute_transactions(transactions, *_log, _interactive, hstr, str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1259,8 +1266,7 @@ void TImporta_Beestore::import_val()
|
||||
fields.add("CodValuta", "CODTAB");
|
||||
fields.add("DSValuta2", "S0");
|
||||
fields.add("Simbolo", "CODTAB");
|
||||
TRACE("Valute");
|
||||
import_table("%VAL", "tieValute", fields);
|
||||
import_table("%VAL", "tieValute", fields, "Valuta");
|
||||
}
|
||||
|
||||
int TImporta_Beestore::tipotestata2idx(int tipotestata)
|
||||
@ -1569,7 +1575,7 @@ void TImporta_Beestore::direct_doc(TODBC_recordset & docs, const char * table, c
|
||||
}
|
||||
}
|
||||
|
||||
void TImporta_Beestore::transaction_doc(TODBC_recordset & docs, const char * table, const int tipotestata, const char* unitadefault, bool importadoc)
|
||||
void TImporta_Beestore::transaction_doc(TODBC_recordset & docs, const char * hmsg, const char * table, const int tipotestata, const char* unitadefault, bool importadoc)
|
||||
{
|
||||
TString msg(TR("Importazione ")); msg << table;
|
||||
TProgress_monitor pi(docs.items(), msg);
|
||||
@ -1785,14 +1791,20 @@ void TImporta_Beestore::transaction_doc(TODBC_recordset & docs, const char * tab
|
||||
if (elab && last > 0 && row > 0)
|
||||
transactions.add(t);
|
||||
TRACE("Salvataggio articoli");
|
||||
execute_transactions(art_transactions, *_log, _interactive, "Importazione articoli");
|
||||
execute_transactions(art_transactions, *_log, _interactive, "Articolo #KEY", "Importazione articoli");
|
||||
TRACE("Salvataggio %s", table);
|
||||
execute_transactions(transactions, *_log, _interactive, msg);
|
||||
|
||||
TString header_msg(hmsg);
|
||||
|
||||
header_msg << " #" << DOC_CODNUM " #" << DOC_NDOC;
|
||||
execute_transactions(transactions, *_log, _interactive, header_msg, msg);
|
||||
}
|
||||
|
||||
void TImporta_Beestore::import_doc(const TDate& dal, const TDate& al, int tipotestata, const char* unitadefault, bool importadoc)
|
||||
{
|
||||
TString str(255);
|
||||
TString hstr;
|
||||
|
||||
if (tipotestata < 10)
|
||||
{
|
||||
str << "SELECT tieDMovMag.*,tieTBolFat.* FROM tieDMovMag,tieTBolFat WHERE tieDMovMag.Origine=1 AND tieDMovMag.TipoTestata=2 AND TieTBolFat.TipoDoc=" << tipotestata << " AND tieDMovMag.CodTestata=tieTBolFat.Cod_PK";
|
||||
@ -1841,34 +1853,42 @@ void TImporta_Beestore::import_doc(const TDate& dal, const TDate& al, int tipote
|
||||
{
|
||||
case 1:
|
||||
str = TR("Bolle");
|
||||
break;
|
||||
hstr = TR("Bolla");
|
||||
break;
|
||||
case 2:
|
||||
str = TR("Fatture");
|
||||
break;
|
||||
hstr = TR("Fattura");
|
||||
break;
|
||||
case 6:
|
||||
str = TR("Note di credito");
|
||||
str = TR("Note di credito");
|
||||
hstr = TR("Nota di credito");
|
||||
break;
|
||||
case 9:
|
||||
str = TR("Ordini");
|
||||
break;
|
||||
str = TR("Ordini");
|
||||
hstr = TR("Ordine");
|
||||
break;
|
||||
case 11:
|
||||
str = TR("Carichi e scarichi");
|
||||
hstr = TR("Movimento");
|
||||
break;
|
||||
case 13:
|
||||
str = TR("Scontrini");
|
||||
hstr = TR("Documento");
|
||||
break;
|
||||
case 14:
|
||||
str = TR("Generici");
|
||||
hstr = TR("Movimento");
|
||||
break;
|
||||
default:
|
||||
str = TR("Documenti");
|
||||
break;
|
||||
hstr = TR("Documento");
|
||||
break;
|
||||
};
|
||||
TRACE(str);
|
||||
if (_direct_write)
|
||||
direct_doc(docs, str, tipotestata, unitadefault, importadoc);
|
||||
else
|
||||
transaction_doc(docs, str, tipotestata, unitadefault, importadoc);
|
||||
transaction_doc(docs, hstr, str, tipotestata, unitadefault, importadoc);
|
||||
}
|
||||
|
||||
TToken_string & TImporta_Beestore::decode_presentazione(const char*IBAN)
|
||||
|
Loading…
x
Reference in New Issue
Block a user