Fixato il progressivo per archiviazione contigue

finalizzato l'abbinamento manuale ed introdotto il campo MOV_KEYPAF negli archivi di campo (probabilmente nei movimenti)
This commit is contained in:
smen 2023-03-17 09:26:34 +01:00
parent 09c6369bbb
commit 97f59efa7e
4 changed files with 39 additions and 13 deletions

View File

@ -218,6 +218,8 @@ bool TFppro::associa_mov(const long numreg)
return ok;
}
const TString & TFppro::get_tipoprot()
{
TString query;

View File

@ -438,7 +438,7 @@ class TEstrazione : public TObject
*/
static state_fppro check_fppro(int numreg);
state_estr_int checkPafw3_int(int numreg);
bool guess_the_int(const TLocalisamfile& mov);
bool guess_the_int(TLocalisamfile& mov);
bool check_periodo_def() const;
void copy_file_to_webapp_fld(TMovimento_estr& movimento) const;
void fill_id(const TRectype& clifo, TString& statopaiv, TString& idfisc, TString& paiv, TString& codfis);
@ -463,7 +463,7 @@ private:
/** Controlla ultimo id estrazione della giornata e in base al tipo di estrazione,
* genera il progressivo seguente. Chiamata da \a estrai() e \a estrai_single().
* \return Nuovo id estrazione. */
TString next_estr_today(char tipo) const;
TString next_estr_today(char tipo, const bool estr_int = false) const;
static bool pura_iva(const TRectype& mov);
void write_errorsql_log(const TString& query);

View File

@ -464,7 +464,7 @@ state_estr_int TEstrazione::checkPafw3_int(int numreg)
return int_with_err;
}
bool TEstrazione::guess_the_int(const TLocalisamfile& mov)
bool TEstrazione::guess_the_int(TLocalisamfile& mov)
{
// Prendo il fornitore del mov per controllare la p.iva
long codcf = mov.get_long(MOV_CODCF);
@ -502,9 +502,13 @@ bool TEstrazione::guess_the_int(const TLocalisamfile& mov)
if (ok && (fp_db().sq_items() == 1))
{
//CAPIRE COSA FARE QUI DENTRO
//_keys = _db->sq_get("KEYPRGINVIO");
//_keys.add(_db->sq_get("KEYHEADERFATT"));
//_keys.add(_db->sq_get("KEYBODYFATT"));
TToken_string keys = (fp_db().sq_get("KEYPRGINVIO"), ";");
keys.add(fp_db().sq_get("KEYHEADERFATT"));
keys.add(fp_db().sq_get("KEYBODYFATT"));
mov.put(MOV_KEYPAF, keys);
mov.rewrite();
return true;
}
return false;
@ -852,15 +856,19 @@ bool TEstrazione::export_error_list()
return ok;
}
TString TEstrazione::next_estr_today(char tipo) const
TString TEstrazione::next_estr_today(char tipo, const bool estr_int) const
{
char estr[] = { 0,0,0,0,0,0,0,0,0 };
TString query;
query << "SELECT TOP 1 SUBSTRING(" DRD_ID_EST ", 11, 8) AS IDESTR\n"
"FROM " F9_DRD "\n"
"WHERE " DRD_CODSOC " = '" << _head.cod_soc << "' AND\n"
DRD_ID_EST " LIKE '" << today.date2ansi() << "%'\n"
"ORDER BY IDESTR DESC";
"WHERE " DRD_CODSOC " = '" << _head.cod_soc << "' AND\n";
if (estr_int)
query << DRD_ID_EST " LIKE 'R" << today.date2ansi() << "%'\n";
else
query << DRD_ID_EST " LIKE '" << today.date2ansi() << "%'\n";
query << "ORDER BY IDESTR DESC";
fp_db().sq_set_exec(query);
const int last_estr = fp_db().sq_items() > 0 ? real(fp_db().sq_get("IDESTR")).integer() : -1;
@ -1160,6 +1168,21 @@ const char* TEstrazione::diagnostica_mov_integrazione()
if (!mov_i.estratto() && mov_i.descr_estr() == mov_escluso)
continue;
const long numreg = mov_i.numreg();
const TRectype & mov = cache().get(LF_MOV, numreg);
TToken_string keys = (mov.get(MOV_KEYPAF));
keys.separator(';');
int i = keys.items();
if (keys.full() && (keys.items() == 3))
{
ok &= true;
mov_i.set_estratto(true);
mov_i.set_state_int(guessed_int);
++_stats.int_match;
continue;
}
if (mov_i.no_err() && mov_i.estratto())
{
@ -1601,7 +1624,7 @@ result_estr TEstrazione::estrai_integrazioni()
}
// Non so come usare questi 18 caratteri...
// Uso dati anche se gia' noti in altri campi (I know..) + un numero incrementale.
_head.id_estr.cut(0) << 'R' << today.date2ansi() << (_head.flag_prov ? "P" : "D") << next_estr_today(_head.tipo_doc);
_head.id_estr.cut(0) << 'R' << today.date2ansi() << (_head.flag_prov ? "P" : "D") << next_estr_today(_head.tipo_doc, true);
_head.user = user();
// Eseguo controllo sui movimenti e segno in testata lo stato
_head.stato_estr = IN_DIAGN; // "01" che verra' quasi subito rimpiazzato dal risultato della diagnostica.

View File

@ -65,6 +65,7 @@
#define MOV_DATADOCSDI "DATADOCSDI"
#define MOV_COLL_GOLEM "COLL_GOLEM"
#define MOV_CARTACEI "CARTACEI"
#define MOV_KEYPAF "KEYPAF"
#define NUMREG_PROVVISORIO 999999L