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
@ -9,10 +9,68 @@
|
|||||||
#include "rdoc.h"
|
#include "rdoc.h"
|
||||||
#include "../mr/rilprod.h"
|
#include "../mr/rilprod.h"
|
||||||
#include "../mr/rrilprod.h"
|
#include "../mr/rrilprod.h"
|
||||||
|
#include "../ve/velib.h"
|
||||||
|
|
||||||
#include "ps1002.h"
|
#include "ps1002.h"
|
||||||
#include "ps1002200a.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 ////
|
//// TIMPORTA_PRODUZIONE_REC ////
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
@ -60,6 +118,7 @@ bool TImporta_produzione_msk::on_field_event(TOperable_field& o, TField_event e,
|
|||||||
{
|
{
|
||||||
switch (o.dlg())
|
switch (o.dlg())
|
||||||
{
|
{
|
||||||
|
case DLG_OK:
|
||||||
case DLG_ELABORA:
|
case DLG_ELABORA:
|
||||||
if(e == fe_button)
|
if(e == fe_button)
|
||||||
{
|
{
|
||||||
@ -133,8 +192,8 @@ bool TImporta_produzione_msk::chiudi_bem()
|
|||||||
{
|
{
|
||||||
const TDate data = get_date(F_DATA);
|
const TDate data = get_date(F_DATA);
|
||||||
|
|
||||||
TLocalisamfile rdoc(LF_RIGHEDOC);
|
|
||||||
TLocalisamfile rilprod(LF_RILPROD);
|
TLocalisamfile rilprod(LF_RILPROD);
|
||||||
|
TBEM_cache ca;
|
||||||
|
|
||||||
int err = NOERR;
|
int err = NOERR;
|
||||||
|
|
||||||
@ -159,21 +218,13 @@ bool TImporta_produzione_msk::chiudi_bem()
|
|||||||
const int idriga = trec.get_int(RILPROD_NRIGA);
|
const int idriga = trec.get_int(RILPROD_NRIGA);
|
||||||
const real qta = trec.get_real(RILPROD_QTA);
|
const real qta = trec.get_real(RILPROD_QTA);
|
||||||
|
|
||||||
TRectype& rec = rdoc.curr();
|
TDocumento& doc = ca.doc(anno, ndoc);
|
||||||
rec.put(RDOC_CODNUM, codnum);
|
if(!doc.empty())
|
||||||
rec.put(RDOC_ANNO, anno);
|
|
||||||
rec.put(RDOC_PROVV, provv);
|
|
||||||
rec.put(RDOC_IDRIGA, idriga);
|
|
||||||
|
|
||||||
if(rec.read(rdoc) == NOERR)
|
|
||||||
{
|
{
|
||||||
rec.put(RDOC_CODNUM, codnum);
|
const int nriga = doc.id2rownum(idriga);
|
||||||
rec.put(RDOC_ANNO, anno);
|
TRiga_documento& row = doc[nriga];
|
||||||
rec.put(RDOC_PROVV, provv);
|
|
||||||
rec.put(RDOC_IDRIGA, idriga);
|
|
||||||
rec.put(RDOC_QTA, qta);
|
|
||||||
|
|
||||||
rec.rewrite(rdoc);
|
row.put(RDOC_QTA, qta);
|
||||||
|
|
||||||
trec.put(RILPROD_PROVVP, provv);
|
trec.put(RILPROD_PROVVP, provv);
|
||||||
trec.put(RILPROD_ANNOP, anno);
|
trec.put(RILPROD_ANNOP, anno);
|
||||||
@ -185,6 +236,7 @@ bool TImporta_produzione_msk::chiudi_bem()
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
ca.destroy();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +296,7 @@ bool TImporta_produzione_msk::genera_produzione(const TFilename& file)
|
|||||||
testata.put(RILPROD_ANNO, anno);
|
testata.put(RILPROD_ANNO, anno);
|
||||||
testata.put(RILPROD_PROVV, provv);
|
testata.put(RILPROD_PROVV, provv);
|
||||||
testata.put(RILPROD_NDOC, ndoc);
|
testata.put(RILPROD_NDOC, ndoc);
|
||||||
testata.put(RILPROD_OPERATORE, codlav);
|
testata.put(RILPROD_NRIGA, idriga);
|
||||||
testata.put(RILPROD_QTA, qtaprod);
|
testata.put(RILPROD_QTA, qtaprod);
|
||||||
testata.put(RILPROD_CHIUSO, flgsaldo);
|
testata.put(RILPROD_CHIUSO, flgsaldo);
|
||||||
|
|
||||||
@ -265,6 +317,7 @@ bool TImporta_produzione_msk::genera_produzione(const TFilename& file)
|
|||||||
riga.put(RRILPROD_DATA, datafine);
|
riga.put(RRILPROD_DATA, datafine);
|
||||||
riga.put(RRILPROD_PROG, prog);
|
riga.put(RRILPROD_PROG, prog);
|
||||||
riga.put(RRILPROD_NRIGA, calcola_nriga(codart, datafine, prog));
|
riga.put(RRILPROD_NRIGA, calcola_nriga(codart, datafine, prog));
|
||||||
|
riga.put(RILPROD_OPERATORE, codlav);
|
||||||
riga.put(RRILPROD_DATAINI, datafine);
|
riga.put(RRILPROD_DATAINI, datafine);
|
||||||
riga.put(RRILPROD_ORAINI, orafine);
|
riga.put(RRILPROD_ORAINI, orafine);
|
||||||
riga.put(RRILPROD_DATAFINE, datafine);
|
riga.put(RRILPROD_DATAFINE, datafine);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user