From a21d4897ddc1b5279aaf0dce63c882aa2c4a76af Mon Sep 17 00:00:00 2001 From: Simone Palacino Date: Tue, 17 Sep 2019 16:12:08 +0200 Subject: [PATCH] Patch level : 12.0 874 Files correlati : f9.exe, f90100.sql Commento : - Pulizia codice - Eliminazione record movimento nella lista di controllo errori (eliminazione da db) - Cambiato sistema di fetch numero ultima estrazione del giorno - Cambiato ordinamento visualizzazione pacchetti in ordine decr. di data - Sistemata query controllo sovrapposizione periodi per definitivo - Aggiunti messaggi di errore in caso di fallimento creazione/aggiornam. tabelle --- src/f9/f90100.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/f9/f90100.cpp b/src/f9/f90100.cpp index abf54da0c..33e8292c4 100644 --- a/src/f9/f90100.cpp +++ b/src/f9/f90100.cpp @@ -980,10 +980,22 @@ TString TF9_app::next_estr_today(const char tipo) const "FROM " F9_DRD "\n" "WHERE " DRD_ID_EST " LIKE '" << today.date2ansi() << tipo << "%'\n" << "ORDER BY " DRD_ID_EST " DESC"; - if(!db().sq_set_exec(query)) - fatal_box(db().sq_get_text_error()); + db().sq_set_exec(query); + + const int last_estr = db().sq_items() > 0 ? real(db().sq_get("IDESTR").ltrim(10)).integer() : -1; + + if (last_estr < -1 || last_estr == 99999999) + { + ofstream fout; fout.open("f9err_nextestr.txt"); + if (fout.is_open()) + { + fout << "Errore progressivo nuova estrazione!\n" << today << "\nn:" << last_estr << "\n" << query << "\n"; + fout.close(); + } + TString msg; + fatal_box(msg << "database error: progressivo nuova estrazione. Ultima estrazione: " << last_estr); + } - const int last_estr = real(db().sq_get("IDESTR").ltrim(10)).integer(); sprintf_s(estr, 9, "%08d", last_estr + 1); return estr; } @@ -996,8 +1008,7 @@ bool TF9_app::check_periodo_def(const drd& head) query << "SELECT *\nFROM F9DRD00K\n" << "WHERE " << DRD_DATAA << " >= '" << head.dal.date2ansi() << "' AND " DRD_DATADA " <= '" << head.al.date2ansi() << "' AND " DRD_FLAG_PD " = 'D' AND\n " DRD_STATO " <> '" D_GEST_ERR "' AND " DRD_STATO " <> '" D_WA_ERR "' AND " DRD_STATO " <> '" D_ERR_SOS "' AND " DRD_TIPODOC " = '" << head.tipo_doc << "';"; - if (!db().sq_set_exec(query)) - fatal_box(db().sq_get_text_error()); + db().sq_set_exec(query); return db().sq_items() == 0; }