From 400c4580fd15283d7989e8da42fe214a054e54a9 Mon Sep 17 00:00:00 2001 From: mtollari Date: Thu, 24 May 2018 08:37:00 +0000 Subject: [PATCH] Patch level : 12.0 576 Files correlati : bs Commento : - Aggiunti progress monitor - Come da richiesta saltato controllo stato documento, verranno sempre importati git-svn-id: svn://10.65.10.50/branches/R_10_00@24501 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- src/bs/bs0300.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/bs/bs0300.cpp b/src/bs/bs0300.cpp index e4855a984..89239dd19 100644 --- a/src/bs/bs0300.cpp +++ b/src/bs/bs0300.cpp @@ -500,8 +500,11 @@ void TSknet_sync::sync_anamag() query.cut(0) << "SELECT * from tieArticoli where Origine=" << their_origin(); TODBC_recordset odbcunit(query); odbcunit.connect(_dsn, _usr, _psw); + TProgress_monitor p(odbcunit.items(), "Aggiornamento unità di misura"); for (bool go = odbcunit.move_first(); go; go = odbcunit.move_next()) { + if (!p.add_status()) + break; // Umart TLocalisamfile umart(LF_UMART); TRectype rumart(LF_UMART); @@ -531,8 +534,11 @@ void TSknet_sync::sync_anamag() TLocalisamfile ccor(LF_CODCORR); TRectype rccor(LF_CODCORR); // Il primo giro svuoto CODCORR dagli articoli inseriti (sono stati importati tantissimi articoli con CODART == CODARTALT, così facendo pulisco) + TProgress_monitor p(odbc.items(), "Pulizia Codici clienti"); for (bool go = odbc.move_first(); go; go = odbc.move_next()) { + if (!p.add_status()) + break; ccor.first(); // Useless?? rccor.zero(); const TString& codpadre = odbc.get("CodPadre").as_string(); @@ -591,8 +597,11 @@ void TSknet_sync::sync_anamag() query.cut(0) << "SELECT * FROM tieArtCONAI where origine=" << their_origin(); TODBC_recordset odbc(query); odbc.connect(_dsn, _usr, _psw); + TProgress_monitor p(odbc.items(), "Aggiornamento CONAI"); for (bool go = odbc.move_first(); go; go = odbc.move_next()) { + if (!p.add_status()) + break; art.first(); // Useless?? rart.zero(); rart.put(ANAMAG_CODART, odbc.get("Cod_PK").as_string()); @@ -1310,6 +1319,7 @@ void TSknet_sync::sync_doc() const TDate datadoc = docs.get("DataMov").as_date(); TString8 numdoc; TString8 tipodoc; + char stato_doc = '\0'; // Controllo se ho ricevuto un codice Campo per il TipoDoc o devo prenderlo dalle impostazioni if (docs.get("TipoDocCE").is_empty()) @@ -1359,17 +1369,13 @@ void TSknet_sync::sync_doc() static TDocumento existDoc; if (existDoc.read('D', datadoc.year(), numdoc, nd) == NOERR) // Ha uno stato che considero bloccato { - if (existDoc.stato() < '3')// && docs.get("DOCANNULLATO").as_int() == 1) + stato_doc = existDoc.stato(); + if (existDoc.stato() >= '3')// && docs.get("DOCANNULLATO").as_int() == 1) { - existDoc.remove(); - } - else - { - TString err; err << "Il documento " << datadoc.year() << " " << numdoc << " " << nd << " con chiave " << docs.get("Cod_PK").as_string() << " non è stato sostituito in quanto definitivo o già importato."; + TString err; err << "Il documento " << datadoc.year() << " " << numdoc << " " << nd << " con chiave " << docs.get("Cod_PK").as_string() << " verrà sostituito ma è già stato fatturato."; _log->log(2, err); - num_doc = -1; - continue; } + existDoc.remove(); } /* @@ -1389,6 +1395,9 @@ void TSknet_sync::sync_doc() doc->put(DOC_CODCF, codcf); doc->cli2doc(); + if (stato_doc != '\0') + doc->put(DOC_STATO, stato_doc); + const TString8 codval = docs.get("CodValuta").as_string(); const real cambio = docs.get("CambioValuta").as_real(); const TString asp = docs.get("AspettoBeni").as_string();