Patch level : 12.0 902
Files correlati : bacnv.exe ve0.exe vearea.men vetbcsc.msk Commento : Conversione e tabella di conversione categorie CONAI
This commit is contained in:
parent
ffdaa31e0e
commit
f29d215492
109
src/ba/bacnv.cpp
109
src/ba/bacnv.cpp
@ -22,6 +22,8 @@
|
|||||||
#include "..\cg\cglib02.h"
|
#include "..\cg\cglib02.h"
|
||||||
#include "..\ve\velib.h"
|
#include "..\ve\velib.h"
|
||||||
#include "..\ci\rilore.h"
|
#include "..\ci\rilore.h"
|
||||||
|
#include "..\mg\mglib.h"
|
||||||
|
#include <conart.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -202,8 +204,9 @@ public:
|
|||||||
void convert_conai_rdoc();
|
void convert_conai_rdoc();
|
||||||
void convert_conai_righe();
|
void convert_conai_righe();
|
||||||
//roba per il file della rilevazione ore
|
//roba per il file della rilevazione ore
|
||||||
void convert_rilore();
|
void convert_rilore();
|
||||||
|
void convert_CONAI();
|
||||||
|
|
||||||
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
|
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -372,10 +375,13 @@ bool TConversione_archivi::menu(MENU_TAG)
|
|||||||
case 24:
|
case 24:
|
||||||
convert_conai_righe();
|
convert_conai_righe();
|
||||||
break;
|
break;
|
||||||
case 25:
|
case 25:
|
||||||
convert_rilore();
|
convert_rilore();
|
||||||
break;
|
break;
|
||||||
default:
|
case 26:
|
||||||
|
convert_CONAI();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -2232,12 +2238,12 @@ void TConversione_archivi::convert_conai_anamag()
|
|||||||
//prende i pesi conai su ciascuna riga
|
//prende i pesi conai su ciascuna riga
|
||||||
FOR_EACH_CONAI_CLASS(cc)
|
FOR_EACH_CONAI_CLASS(cc)
|
||||||
{
|
{
|
||||||
const char* peso_name = conai_peso_name(cc, LF_ANAMAG);
|
const char* peso_name = conai_peso_name(cc);
|
||||||
const real peso = anamag.get(peso_name).as_real();
|
const real peso = anamag.get(peso_name).as_real();
|
||||||
//se peso conai > 0, deve scrivere il codice conai nel campo CONAISC
|
//se peso conai > 0, deve scrivere il codice conai nel campo CONAISC
|
||||||
if (peso > ZERO)
|
if (peso > ZERO)
|
||||||
{
|
{
|
||||||
const char* sottocat = conai_sottocat_name(cc, LF_ANAMAG);
|
const char* sottocat = conai_sottocat_name(cc);
|
||||||
TFieldref fr(sottocat, LF_ANAMAG);
|
TFieldref fr(sottocat, LF_ANAMAG);
|
||||||
fr.write(conai_default_vals.row(cc), anamag.cursor()->curr());
|
fr.write(conai_default_vals.row(cc), anamag.cursor()->curr());
|
||||||
}
|
}
|
||||||
@ -2380,6 +2386,93 @@ void TConversione_archivi::convert_rilore()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TConversione_archivi::convert_CONAI()
|
||||||
|
{
|
||||||
|
TConfig ditta(CONFIG_DITTA, "ve");
|
||||||
|
TString_array conai_default_vals;
|
||||||
|
const char* conai_default_names[CONAI_CLASSES] = { "CONAI_DEFAULT_ACC", "CONAI_DEFAULT_ALL", "CONAI_DEFAULT_CAR",
|
||||||
|
"CONAI_DEFAULT_LEG", "CONAI_DEFAULT_PLA", "CONAI_DEFAULT_VET" };
|
||||||
|
const char* conai_default_values[CONAI_CLASSES] = { "AC99", "AL99", "CA40", "LE99", "PL12", "VE99" };
|
||||||
|
|
||||||
|
FOR_EACH_CONAI_CLASS(cc)
|
||||||
|
{
|
||||||
|
const TString& conai_cat = ditta.get(conai_default_names[cc], NULL, -1, conai_default_values[cc]);
|
||||||
|
conai_default_vals.add(conai_cat);
|
||||||
|
}
|
||||||
|
|
||||||
|
//prende solo le righe che hanno un peso conai di carta e/o plastica
|
||||||
|
TISAM_recordset anamag("USE ANAMAG\n");
|
||||||
|
const long anamag_items = anamag.items();
|
||||||
|
|
||||||
|
{
|
||||||
|
TProgind pic(anamag_items, "Controllo conversione anagrafica articoli...", false);
|
||||||
|
TLog_report log(TR("Errori conversione CONAI"));
|
||||||
|
int err = false;
|
||||||
|
|
||||||
|
log.log(0, "\n");
|
||||||
|
for (bool ok = anamag.move_first(); ok; ok = anamag.move_next())
|
||||||
|
{
|
||||||
|
if (!pic.addstatus(1))
|
||||||
|
break;
|
||||||
|
|
||||||
|
const TString art(anamag.get(ANAMAG_CODART).as_string());
|
||||||
|
TArticolo_conai artc(art);
|
||||||
|
|
||||||
|
for (int i = 0; i < FR_CMAX; i++)
|
||||||
|
{
|
||||||
|
TString sottocat = artc.get_scat(i);
|
||||||
|
|
||||||
|
if (sottocat.full())
|
||||||
|
if (cache().get("&VECSC", sottocat).empty())
|
||||||
|
{
|
||||||
|
err = true;
|
||||||
|
log.log(2, format("Articolo : %s - sottocategoria %s assente", (const char *)art, (const char *)sottocat));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
log.print_or_preview();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TProgind pi(anamag_items, "Conversione anagrafica articoli...", false);
|
||||||
|
TLog_report log(TR("Conversione CONAI"));
|
||||||
|
|
||||||
|
for (bool ok = anamag.move_first(); ok; ok = anamag.move_next())
|
||||||
|
{
|
||||||
|
if (!pi.addstatus(1))
|
||||||
|
break;
|
||||||
|
|
||||||
|
TString art(anamag.get(ANAMAG_CODART).as_string());
|
||||||
|
TArticolo_conai artc(art);
|
||||||
|
TRecord_array conart(art, LF_CONART);
|
||||||
|
TRectype conrec(LF_CONART);
|
||||||
|
int r = 1;
|
||||||
|
|
||||||
|
conart.destroy_rows();
|
||||||
|
for (int i = 0; i < FR_CMAX; i++)
|
||||||
|
{
|
||||||
|
const TString sottocat = artc.get_scat(i);
|
||||||
|
const TString new_sottocat = cache().get("&VECSC", sottocat, "S1");
|
||||||
|
|
||||||
|
if (new_sottocat.full())
|
||||||
|
{
|
||||||
|
conrec.zero();
|
||||||
|
conrec.put(CONART_CODART, art);
|
||||||
|
conrec.put(CONART_NRIGA, r++);
|
||||||
|
conrec.put(CONART_CATEGORIA, new_sottocat.left(2));
|
||||||
|
conrec.put(CONART_SOTTOCAT, new_sottocat.mid(2));
|
||||||
|
conrec.put(CONART_PESO, artc.get_peso(i));
|
||||||
|
conart.add_row(conrec);
|
||||||
|
log.log(0, format("Articolo : %s - da sottocategoria %s a %s peso %s", (const char *)art, (const char *)sottocat, (const char *)new_sottocat, (const char *)artc.get_peso(i).stringa()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conart.write(true);
|
||||||
|
}
|
||||||
|
log.print_or_preview();
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Programma di conversione archivi speciale
|
// Programma di conversione archivi speciale
|
||||||
|
Loading…
x
Reference in New Issue
Block a user