Patch level : 10.0 no patch
Files correlati : Ricompilazione Demo : [ ] Commento : Habilita git-svn-id: svn://10.65.10.50/branches/R_10_00@21155 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4202720a55
commit
5a2a236544
@ -2763,6 +2763,18 @@ bool ca_can_merge_rows(const TRectype& compact_rec, const TRectype& rec)
|
|||||||
compact_rec.get(RMOVANA_CODCONTORI) == rec.get(RMOVANA_CODCONTORI);
|
compact_rec.get(RMOVANA_CODCONTORI) == rec.get(RMOVANA_CODCONTORI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ca_can_pack_rows(const TRectype& compact_rec, const TRectype& rec)
|
||||||
|
{
|
||||||
|
return compact_rec.get(RMOVANA_CODCCOSTO) == rec.get(RMOVANA_CODCCOSTO) &&
|
||||||
|
compact_rec.get(RMOVANA_CODCMS) == rec.get(RMOVANA_CODCMS) &&
|
||||||
|
compact_rec.get(RMOVANA_CODFASE) == rec.get(RMOVANA_CODFASE) &&
|
||||||
|
compact_rec.get(RMOVANA_CODCONTO) == rec.get(RMOVANA_CODCONTO)&&
|
||||||
|
compact_rec.get(RMOVANA_CODCCORI) == rec.get(RMOVANA_CODCCORI) &&
|
||||||
|
compact_rec.get(RMOVANA_CODCMSORI) == rec.get(RMOVANA_CODCMSORI) &&
|
||||||
|
compact_rec.get(RMOVANA_CODFASEORI) == rec.get(RMOVANA_CODFASEORI) &&
|
||||||
|
compact_rec.get(RMOVANA_CODCONTORI) == rec.get(RMOVANA_CODCONTORI);
|
||||||
|
}
|
||||||
|
|
||||||
bool ca_ori_present(const TRectype& rec)
|
bool ca_ori_present(const TRectype& rec)
|
||||||
{
|
{
|
||||||
return (rec.get(RMOVANA_CODCCORI).not_empty() || rec.get(RMOVANA_CODCMSORI).not_empty() ||
|
return (rec.get(RMOVANA_CODCCORI).not_empty() || rec.get(RMOVANA_CODCMSORI).not_empty() ||
|
||||||
|
@ -255,6 +255,7 @@ bool ca_implode_rows(const TRecord_array& input_rows, TRecord_array& compact_row
|
|||||||
bool ca_ori_present(const TRectype& rec);
|
bool ca_ori_present(const TRectype& rec);
|
||||||
bool ca_ori_present(const TRecordset & rec);
|
bool ca_ori_present(const TRecordset & rec);
|
||||||
bool ca_can_merge_rows(const TRectype& compact_rec, const TRectype& rec);
|
bool ca_can_merge_rows(const TRectype& compact_rec, const TRectype& rec);
|
||||||
|
bool ca_can_pack_rows(const TRectype& compact_rec, const TRectype& rec);
|
||||||
void ca_taglia_campo(TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
void ca_taglia_campo(TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
||||||
void ca_copia_campo(const TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
void ca_copia_campo(const TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ protected:
|
|||||||
virtual const char * extra_modules() const {return "ca";}
|
virtual const char * extra_modules() const {return "ca";}
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
|
|
||||||
bool elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_rows, TRecord_array& output_rows);
|
bool elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_rows);
|
||||||
bool ripartizione(const TAnal_ripartizioni_batch& rrip, const TRectype& rec, const TToken_string& path_item, TRecord_array& output_rows, TArray & output_paths);
|
bool ripartizione(const TAnal_ripartizioni_batch& rrip, const TRectype& rec, const TToken_string& path_item, TRecord_array& output_rows, TArray & output_paths);
|
||||||
bool pareggio(TAnal_mov& anal_mov, const TAnal_ripartizioni_batch& rrip, const TRectype& rec, const TToken_string& path, TRecord_array& output_rows, TArray & output_paths);
|
bool pareggio(TAnal_mov& anal_mov, const TAnal_ripartizioni_batch& rrip, const TRectype& rec, const TToken_string& path, TRecord_array& output_rows, TArray & output_paths);
|
||||||
|
|
||||||
@ -231,8 +231,7 @@ bool TRib_movanal_app::ripartizione(const TAnal_ripartizioni_batch& rrip, const
|
|||||||
if (imp != ZERO)
|
if (imp != ZERO)
|
||||||
{
|
{
|
||||||
TRectype* newrec = new TRectype(rec);
|
TRectype* newrec = new TRectype(rec);
|
||||||
newrec->put(RMOVANA_NUMRIG, output_rows.rows() + 1);
|
|
||||||
newrec->put(RMOVANA_IMPORTO, imp); //e la mette nella nuova riga
|
|
||||||
//poi copia i valori dei campi cdc,cms,fsc,in quelli di tipo ori (nello stesso record)
|
//poi copia i valori dei campi cdc,cms,fsc,in quelli di tipo ori (nello stesso record)
|
||||||
if (rec.get(RMOVANA_CODCCORI).blank() && rec.get(RMOVANA_CODCMSORI).blank() &&
|
if (rec.get(RMOVANA_CODCCORI).blank() && rec.get(RMOVANA_CODCMSORI).blank() &&
|
||||||
rec.get(RMOVANA_CODFASEORI).blank()) // RMOVANA_CODCONTORI è vuoto nel caso di pareggio
|
rec.get(RMOVANA_CODFASEORI).blank()) // RMOVANA_CODCONTORI è vuoto nel caso di pareggio
|
||||||
@ -262,12 +261,26 @@ bool TRib_movanal_app::ripartizione(const TAnal_ripartizioni_batch& rrip, const
|
|||||||
ripkey.add(newrec->get(RMOVANA_CODFASE));
|
ripkey.add(newrec->get(RMOVANA_CODFASE));
|
||||||
// ripkey.add(newrec->get(RMOVANA_CODCONTO));
|
// ripkey.add(newrec->get(RMOVANA_CODCONTO));
|
||||||
|
|
||||||
int r = output_rows.add_row(newrec);
|
const int rows = output_rows.rows();
|
||||||
TToken_string * rowpath = (TToken_string *) output_paths.objptr(r);
|
int r = -1;
|
||||||
|
for (int j = 1; r < 0 && j <= rows; j++)
|
||||||
|
if (ca_can_pack_rows(*newrec, output_rows[j]))
|
||||||
|
r = j;
|
||||||
|
if (r < 0)
|
||||||
|
{
|
||||||
|
newrec->put(RMOVANA_NUMRIG, rows + 1);
|
||||||
|
newrec->put(RMOVANA_IMPORTO, imp); //e la mette nella nuova riga
|
||||||
|
output_rows.add_row(newrec);
|
||||||
|
TToken_string * rowpath = (TToken_string *) output_paths.objptr(r);
|
||||||
|
|
||||||
if (rowpath == NULL)
|
if (rowpath == NULL)
|
||||||
output_paths.add(rowpath = new TToken_string, r);
|
output_paths.add(rowpath = new TToken_string, r);
|
||||||
rowpath->add(path_item);
|
rowpath->add(path_item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output_rows[r].add(RMOVANA_IMPORTO, imp);
|
||||||
|
}
|
||||||
|
|
||||||
real * value = (real *) row->objptr(ripkey);
|
real * value = (real *) row->objptr(ripkey);
|
||||||
|
|
||||||
@ -283,17 +296,18 @@ bool TRib_movanal_app::ripartizione(const TAnal_ripartizioni_batch& rrip, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TRib_movanal_app::elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_rows, TRecord_array& output_rows)
|
bool TRib_movanal_app::elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_rows)
|
||||||
{
|
{
|
||||||
bool ho_cambiato_qualchecosa = false;
|
bool ho_cambiato_qualchecosa = false;
|
||||||
|
|
||||||
const int annoes = anal_mov.get_int(MOVANA_ANNOES);
|
const int annoes = anal_mov.get_int(MOVANA_ANNOES);
|
||||||
const char tipomov = anal_mov.get_char(MOVANA_TIPOMOV);
|
const char tipomov = anal_mov.get_char(MOVANA_TIPOMOV);
|
||||||
|
TRecord_array output_rows = input_rows; output_rows.destroy_rows();
|
||||||
TArray input_paths;
|
TArray input_paths;
|
||||||
TArray output_paths;
|
TArray output_paths;
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
|
|
||||||
while (loop++ < 50)
|
while (loop++ < 20)
|
||||||
{
|
{
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
const int nrows = input_rows.rows();
|
const int nrows = input_rows.rows();
|
||||||
@ -324,14 +338,13 @@ bool TRib_movanal_app::elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_r
|
|||||||
path_item.add(rec.get(RMOVANA_CODFASE));
|
path_item.add(rec.get(RMOVANA_CODFASE));
|
||||||
path_item.add(rec.get(RMOVANA_CODCONTO));
|
path_item.add(rec.get(RMOVANA_CODCONTO));
|
||||||
|
|
||||||
if (rec.get(RMOVANA_CODCMS) == "0001")
|
|
||||||
int i = 1;
|
|
||||||
|
|
||||||
if (ripartisci)
|
if (ripartisci)
|
||||||
ripartisci = input_path.find(path_item) < 0;
|
ripartisci = input_path.find(path_item) < 0;
|
||||||
input_path.add(path_item);
|
input_path.add(path_item);
|
||||||
if (ripartisci)
|
if (ripartisci)
|
||||||
{
|
{
|
||||||
|
if (input_rows.rows() + righe_ripartizione > 999)
|
||||||
|
break;
|
||||||
switch (tiporip)
|
switch (tiporip)
|
||||||
{
|
{
|
||||||
//procedura di ripartizione batch 'B' originale; se tiporip=='P' invece ci vuole il pareggio del movana
|
//procedura di ripartizione batch 'B' originale; se tiporip=='P' invece ci vuole il pareggio del movana
|
||||||
@ -352,11 +365,13 @@ bool TRib_movanal_app::elabora_righe(TAnal_mov& anal_mov, TRecord_array& input_r
|
|||||||
output_rows.add_row(newrec);
|
output_rows.add_row(newrec);
|
||||||
}
|
}
|
||||||
} //for(int r=1; r<=nrows...
|
} //for(int r=1; r<=nrows...
|
||||||
if (modified)
|
if (modified && input_rows.rows() != output_rows.rows())
|
||||||
{
|
{
|
||||||
ho_cambiato_qualchecosa = true;
|
ho_cambiato_qualchecosa = true;
|
||||||
input_rows = output_rows;
|
input_rows = output_rows;
|
||||||
|
input_paths = output_paths;
|
||||||
output_rows.destroy_rows();
|
output_rows.destroy_rows();
|
||||||
|
output_paths.destroy();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@ -371,25 +386,16 @@ bool TRib_movanal_app::elabora_movimento(TAnal_mov& anal_mov, const bool esplodi
|
|||||||
bool do_rewrite = false;
|
bool do_rewrite = false;
|
||||||
|
|
||||||
//Per prima cosa prende le righe del movimento su RMOVANA e le ricompatta..
|
//Per prima cosa prende le righe del movimento su RMOVANA e le ricompatta..
|
||||||
TRecord_array compact_rows = input_rows; //record array con le righe compattate da creare con la..
|
if(anal_mov.get_long(MOVANA_NUMREG) == 358L)
|
||||||
compact_rows.destroy_rows(); //..implode_rows(); intanto le azzera per sicurezza
|
int i = 1;
|
||||||
|
|
||||||
if (esplodi)
|
if (esplodi)
|
||||||
{
|
{
|
||||||
//Imploditore
|
//Imploditore
|
||||||
ca_implode_rows(input_rows, compact_rows);
|
|
||||||
//..poi lo riesplode in tutte le righe che possono nascere secondo le regole delle ripartizioni!
|
//..poi lo riesplode in tutte le righe che possono nascere secondo le regole delle ripartizioni!
|
||||||
TRecord_array output_rows = input_rows; //crea il record_array di output come copia dell'INPUT..
|
|
||||||
output_rows.destroy_rows(); //..e poi lo pulisce
|
|
||||||
|
|
||||||
//Esploditore
|
//Esploditore
|
||||||
if (elabora_righe(anal_mov, compact_rows, output_rows))
|
do_rewrite = elabora_righe(anal_mov, input_rows);
|
||||||
{
|
|
||||||
input_rows = output_rows; //rimette i record elaborati negli originali
|
if (_definitivo) //se l'elaborazione e' definitiva...
|
||||||
do_rewrite = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_definitivo) //se l'elaborazione e' definitiva...
|
|
||||||
{
|
{
|
||||||
anal_mov.put(MOVANA_BLOCCATO, 'X'); //..mette bloccato = X nella testata del movimento
|
anal_mov.put(MOVANA_BLOCCATO, 'X'); //..mette bloccato = X nella testata del movimento
|
||||||
do_rewrite = true;
|
do_rewrite = true;
|
||||||
@ -398,6 +404,9 @@ bool TRib_movanal_app::elabora_movimento(TAnal_mov& anal_mov, const bool esplodi
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Imploditore
|
//Imploditore
|
||||||
|
TRecord_array compact_rows = input_rows; //record array con le righe compattate da creare con la..
|
||||||
|
compact_rows.destroy_rows(); //..implode_rows(); intanto le azzera per sicurezza
|
||||||
|
|
||||||
do_rewrite = ca_implode_rows(input_rows, compact_rows);
|
do_rewrite = ca_implode_rows(input_rows, compact_rows);
|
||||||
for (int r = 1; r <= compact_rows.rows(); r++)
|
for (int r = 1; r <= compact_rows.rows(); r++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user