Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@22370 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
27e6e0897e
commit
f4d91b41a5
105
ps/ps1002200.cpp
105
ps/ps1002200.cpp
@ -9,10 +9,68 @@
|
||||
#include "rdoc.h"
|
||||
#include "../mr/rilprod.h"
|
||||
#include "../mr/rrilprod.h"
|
||||
#include "../ve/velib.h"
|
||||
|
||||
#include "ps1002.h"
|
||||
#include "ps1002200a.h"
|
||||
|
||||
///////////////////////////////////
|
||||
//// TACQUISIZIONE_CACHE ////
|
||||
///////////////////////////////////
|
||||
|
||||
//classe TAcquisizione_cache
|
||||
class TBEM_cache : public TCache
|
||||
{
|
||||
TString4 _codnum;
|
||||
|
||||
protected:
|
||||
virtual void discarding(const THash_object* obj);
|
||||
virtual TObject* key2obj(const char* key);
|
||||
|
||||
public:
|
||||
TDocumento& doc(const int anno, const long ndoc);
|
||||
TBEM_cache();
|
||||
};
|
||||
|
||||
//DISCARDING: metodo che salva un documento sul disco prima di eliminarlo dalla cache
|
||||
void TBEM_cache::discarding(const THash_object* obj)
|
||||
{
|
||||
TDocumento& doc = (TDocumento&)obj->obj();
|
||||
int err = doc.rewrite();
|
||||
}
|
||||
|
||||
//KEY2OBJ: metodo che sceglie il documento giusto da disco in modo da poterlo continuare
|
||||
TObject* TBEM_cache::key2obj(const char* key)
|
||||
{
|
||||
TToken_string chiave(key);
|
||||
TDoc_key kdoc(key);
|
||||
//chiave di doc
|
||||
TString query;
|
||||
query << "USE DOC\n"
|
||||
<< "FROM PROVV=D ANNO=" << kdoc.anno() << " CODNUM=" << kdoc.codnum() << " NDOC=" << kdoc.ndoc() << "\n"
|
||||
<< "TO PROVV=D ANNO=" << kdoc.anno() << " CODNUM=" << kdoc.codnum() << " NDOC=" << kdoc.ndoc();
|
||||
TISAM_recordset rset(query);
|
||||
|
||||
TDocumento* doc = NULL;
|
||||
|
||||
if (rset.move_first())
|
||||
doc = new TDocumento(rset.cursor()->curr());
|
||||
return doc;
|
||||
}
|
||||
|
||||
//DOC: metodo che restituisce un puntatore ad un documento identificato dalla chiave doc
|
||||
TDocumento& TBEM_cache::doc(const int anno, const long 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";
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
//// TIMPORTA_PRODUZIONE_REC ////
|
||||
///////////////////////////////////////
|
||||
@ -60,6 +118,7 @@ bool TImporta_produzione_msk::on_field_event(TOperable_field& o, TField_event e,
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case DLG_OK:
|
||||
case DLG_ELABORA:
|
||||
if(e == fe_button)
|
||||
{
|
||||
@ -132,9 +191,9 @@ void TImporta_produzione_msk::sposta_file(const TString& file)
|
||||
bool TImporta_produzione_msk::chiudi_bem()
|
||||
{
|
||||
const TDate data = get_date(F_DATA);
|
||||
|
||||
TLocalisamfile rdoc(LF_RIGHEDOC);
|
||||
|
||||
TLocalisamfile rilprod(LF_RILPROD);
|
||||
TBEM_cache ca;
|
||||
|
||||
int err = NOERR;
|
||||
|
||||
@ -159,21 +218,13 @@ bool TImporta_produzione_msk::chiudi_bem()
|
||||
const int idriga = trec.get_int(RILPROD_NRIGA);
|
||||
const real qta = trec.get_real(RILPROD_QTA);
|
||||
|
||||
TRectype& rec = rdoc.curr();
|
||||
rec.put(RDOC_CODNUM, codnum);
|
||||
rec.put(RDOC_ANNO, anno);
|
||||
rec.put(RDOC_PROVV, provv);
|
||||
rec.put(RDOC_IDRIGA, idriga);
|
||||
|
||||
if(rec.read(rdoc) == NOERR)
|
||||
TDocumento& doc = ca.doc(anno, ndoc);
|
||||
if(!doc.empty())
|
||||
{
|
||||
rec.put(RDOC_CODNUM, codnum);
|
||||
rec.put(RDOC_ANNO, anno);
|
||||
rec.put(RDOC_PROVV, provv);
|
||||
rec.put(RDOC_IDRIGA, idriga);
|
||||
rec.put(RDOC_QTA, qta);
|
||||
|
||||
rec.rewrite(rdoc);
|
||||
const int nriga = doc.id2rownum(idriga);
|
||||
TRiga_documento& row = doc[nriga];
|
||||
|
||||
row.put(RDOC_QTA, qta);
|
||||
|
||||
trec.put(RILPROD_PROVVP, provv);
|
||||
trec.put(RILPROD_ANNOP, anno);
|
||||
@ -185,6 +236,7 @@ bool TImporta_produzione_msk::chiudi_bem()
|
||||
else
|
||||
return false;
|
||||
}
|
||||
ca.destroy();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -237,16 +289,16 @@ bool TImporta_produzione_msk::genera_produzione(const TFilename& file)
|
||||
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_OPERATORE, codlav);
|
||||
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_QTA, qtaprod);
|
||||
testata.put(RILPROD_CHIUSO, flgsaldo);
|
||||
|
||||
tprod_ar.add(key, testata);
|
||||
}
|
||||
@ -265,6 +317,7 @@ bool TImporta_produzione_msk::genera_produzione(const TFilename& file)
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user