Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@22378 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
53ee9f53f2
commit
e82013110e
@ -28,7 +28,7 @@ protected:
|
||||
virtual TObject* key2obj(const char* key);
|
||||
|
||||
public:
|
||||
TDocumento& doc(const int anno, const long ndoc);
|
||||
TDocumento& doc(const int anno, const TString4 codnum, const long ndoc);
|
||||
TBEM_cache();
|
||||
};
|
||||
|
||||
@ -59,16 +59,15 @@ TObject* TBEM_cache::key2obj(const char* key)
|
||||
}
|
||||
|
||||
//DOC: metodo che restituisce un puntatore ad un documento identificato dalla chiave doc
|
||||
TDocumento& TBEM_cache::doc(const int anno, const long ndoc)
|
||||
TDocumento& TBEM_cache::doc(const int anno, const TString4 codnum, const long ndoc)
|
||||
{
|
||||
TDoc_key kdoc(anno, _codnum, ndoc);
|
||||
TDoc_key kdoc(anno, codnum, ndoc);
|
||||
return *(TDocumento*)objptr(kdoc);
|
||||
}
|
||||
|
||||
//metodo costruttore di una cache di 20 elementi
|
||||
TBEM_cache::TBEM_cache() : TCache(20)
|
||||
{
|
||||
_codnum = "BEM";
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
@ -211,20 +210,33 @@ bool TImporta_produzione_msk::chiudi_bem()
|
||||
for(bool ok = testate.move_first(); ok; ok = testate.move_next())
|
||||
{
|
||||
TRectype& trec = testate.cursor()->curr();
|
||||
const char provv = trec.get(RILPROD_PROVV)[0];
|
||||
const int anno = trec.get_int(RILPROD_ANNO);
|
||||
const TString4 codnum = trec.get(RILPROD_CODNUM);
|
||||
const int ndoc = trec.get_long(RILPROD_NDOC);
|
||||
const int idriga = trec.get_int(RILPROD_NRIGA);
|
||||
const real qta = trec.get_real(RILPROD_QTA);
|
||||
const char provv = trec.get(RILPROD_PROVV)[0];
|
||||
const int anno = trec.get_int(RILPROD_ANNO);
|
||||
const TString4 codnum = trec.get(RILPROD_CODNUM);
|
||||
const int ndoc = trec.get_long(RILPROD_NDOC);
|
||||
const int idriga = trec.get_int(RILPROD_NRIGA);
|
||||
const real qta = trec.get_real(RILPROD_QTA);
|
||||
const TString16 codlav = trec.get(RILPROD_OPERATORE);
|
||||
const TDate data = trec.get_date(RILPROD_DATA);
|
||||
|
||||
TDocumento& doc = ca.doc(anno, ndoc);
|
||||
TDocumento& doc = ca.doc(anno, codnum, ndoc);
|
||||
if(!doc.empty())
|
||||
{
|
||||
const int nriga = doc.id2rownum(idriga);
|
||||
TRiga_documento& row = doc[nriga];
|
||||
|
||||
row.put(RDOC_QTA, qta);
|
||||
|
||||
if(row.get(RDOC_FASCMS) == codlav)
|
||||
{
|
||||
row.put(RDOC_CODAGG2, data.string());
|
||||
row.put(RDOC_QTAGG2, qta);
|
||||
}
|
||||
else if(row.get(RDOC_CODCMS) == codlav)
|
||||
{
|
||||
row.put(RDOC_DATACONS, data.string());
|
||||
row.put(RDOC_QTAGG1, qta);
|
||||
}
|
||||
else
|
||||
warning_box(TR("Riga BEM non trovata"));
|
||||
|
||||
trec.put(RILPROD_PROVVP, provv);
|
||||
trec.put(RILPROD_ANNOP, anno);
|
||||
@ -283,22 +295,39 @@ bool TImporta_produzione_msk::genera_produzione(const TFilename& file)
|
||||
key.add(codlav);
|
||||
|
||||
int prog;
|
||||
//se non l'ho già fatto creo il record della testata, altrimenti aggiorno le quantità
|
||||
if(!tprod_ar.is_key(key))
|
||||
|
||||
TString query;
|
||||
query << "USE RILPROD KEY 4\n"
|
||||
<< "SELECT OPERATORE==\"" << codlav << "\"\n"
|
||||
<< "FROM PROVV=D ANNO=" << anno << " CODNUM=" << codnum << "NRIGA=" << idriga << "\n"
|
||||
<< "TO PROVV=D ANNO=" << anno << " CODNUM=" << codnum << "NRIGA=" << idriga;
|
||||
TISAM_recordset testate(query);
|
||||
|
||||
if(!testate.empty())
|
||||
{
|
||||
TRectype& testata = testate.cursor()->curr();
|
||||
real& qta = testata.get_real(RILPROD_QTA);
|
||||
qta += qtaprod;
|
||||
|
||||
tprod_ar.add(key, testata);
|
||||
}
|
||||
else if(!tprod_ar.is_key(key))
|
||||
{
|
||||
//se non l'ho già fatto creo il record della testata, altrimenti aggiorno le quantità
|
||||
prog = calcola_prog(codart, datafine);
|
||||
TRectype& testata = tprod.curr();
|
||||
testata.zero();
|
||||
testata.put(RILPROD_CODART, codart);
|
||||
testata.put(RILPROD_DATA, datafine);
|
||||
testata.put(RILPROD_PROG, prog);
|
||||
testata.put(RILPROD_CODNUM, codnum);
|
||||
testata.put(RILPROD_ANNO, anno);
|
||||
testata.put(RILPROD_PROVV, provv);
|
||||
testata.put(RILPROD_NDOC, ndoc);
|
||||
testata.put(RILPROD_NRIGA, idriga);
|
||||
testata.put(RILPROD_QTA, qtaprod);
|
||||
testata.put(RILPROD_CHIUSO, flgsaldo);
|
||||
testata.put(RILPROD_CODART, codart);
|
||||
testata.put(RILPROD_DATA, datafine);
|
||||
testata.put(RILPROD_PROG, prog);
|
||||
testata.put(RILPROD_CODNUM, codnum);
|
||||
testata.put(RILPROD_ANNO, anno);
|
||||
testata.put(RILPROD_PROVV, provv);
|
||||
testata.put(RILPROD_NDOC, ndoc);
|
||||
testata.put(RILPROD_NRIGA, idriga);
|
||||
testata.put(RILPROD_OPERATORE, codlav);
|
||||
testata.put(RILPROD_QTA, qtaprod);
|
||||
testata.put(RILPROD_CHIUSO, flgsaldo);
|
||||
|
||||
tprod_ar.add(key, testata);
|
||||
}
|
||||
@ -313,16 +342,16 @@ bool TImporta_produzione_msk::genera_produzione(const TFilename& file)
|
||||
//creo la riga corrispondente a quella letta da file
|
||||
TRectype& riga = rprod.curr();
|
||||
riga.zero();
|
||||
riga.put(RRILPROD_CODART, codart);
|
||||
riga.put(RRILPROD_DATA, datafine);
|
||||
riga.put(RRILPROD_PROG, prog);
|
||||
riga.put(RRILPROD_NRIGA, calcola_nriga(codart, datafine, prog));
|
||||
riga.put(RILPROD_OPERATORE, codlav);
|
||||
riga.put(RRILPROD_DATAINI, datafine);
|
||||
riga.put(RRILPROD_ORAINI, orafine);
|
||||
riga.put(RRILPROD_DATAFINE, datafine);
|
||||
riga.put(RRILPROD_ORAFINE, orafine);
|
||||
riga.put(RRILPROD_QTA, qtaprod);
|
||||
riga.put(RRILPROD_CODART, codart);
|
||||
riga.put(RRILPROD_DATA, datafine);
|
||||
riga.put(RRILPROD_PROG, prog);
|
||||
riga.put(RRILPROD_NRIGA, calcola_nriga(codart, datafine, prog));
|
||||
riga.put(RRILPROD_DATAINI, datafine);
|
||||
riga.put(RRILPROD_ORAINI, orafine);
|
||||
riga.put(RRILPROD_DATAFINE, datafine);
|
||||
riga.put(RRILPROD_ORAFINE, orafine);
|
||||
riga.put(RRILPROD_OPERATORE, codlav);
|
||||
riga.put(RRILPROD_QTA, qtaprod);
|
||||
|
||||
err = riga.rewrite_write(rprod);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user