Patch level : 12.00 1262

Files correlati     :
Commento            :
nvio postino con ODBC
This commit is contained in:
Alessandro Bonazzi 2023-05-30 23:09:18 +02:00
parent 6664b94657
commit 883e9e0edd
5 changed files with 171 additions and 52 deletions

View File

@ -2,6 +2,7 @@
#include <config.h> #include <config.h>
#include <automask.h> #include <automask.h>
#include <progind.h> #include <progind.h>
#include <transaction.h>
#include "lvlib.h" #include "lvlib.h"
@ -140,19 +141,62 @@ bool TGenera_planning_app::elimina_planning_cliente(const TDate& dadata, const T
return true; return true;
} }
HIDDEN void rec2ini(const TRectype& rec, TConfig& ini)
{
for (int i = 0; i < rec.items(); i++)
{
const char* fname = rec.fieldname(i);
const TString& val = rec.get(fname);
if (val.full())
{
if (val.find(' ') >= 0 && rec.type(fname) == _alfafld)
{
TString quoted; quoted << '"' << val << '"';
ini.set(fname, quoted);
}
else
ini.set(fname, val);
}
}
}
HIDDEN void build_ini(TConfig & ini, const TRectype & rec,const char * action)
{
ini.set_paragraph("Transaction");
ini.set("Firm", prefix().get_codditta(), "Transaction");
ini.set("User", user());
ini.set("HostName", get_hostname());
ini.set("Action", action);
ini.set("Mode", "Auto");
int year, release, tag, patch;
if (TApplication::get_version_info(year, release, tag, patch))
{
TString80 ver;
ver.format("%d %d.%d-%d", year, release, tag, patch);
ini.set("Version", ver);
}
TString16 para; para << rec.num();
ini.set_paragraph(para);
rec2ini(rec, ini);
}
//KILL_PLANNING: metodo che elimina un recordset generato precedentemente //KILL_PLANNING: metodo che elimina un recordset generato precedentemente
bool TGenera_planning_app::kill_planning (TISAM_recordset& selrighe) const bool TGenera_planning_app::kill_planning (TISAM_recordset& selrighe) const
{ {
const TRecnotype righe = selrighe.items(); const TRecnotype righe = selrighe.items();
if (righe > 0) if (righe > 0)
{ {
TProgress_monitor pi(righe, TR("Eliminazione planning precedenti in corso...")); TProgress_monitor pi(righe, TR("Eliminazione planning precedenti in corso..."));
TLocalisamfile& rplan = selrighe.cursor()->file(); TLocalisamfile& rplan = selrighe.cursor()->file();
for (bool ok = selrighe.move_last(); ok; ok = selrighe.move_prev()) TRectype & rplanrec = rplan.curr();
for (bool ok = selrighe.move_last(); pi.addstatus() && ok; ok = selrighe.move_prev())
{ {
send_transaction(rplanrec, TRANSACTION_DELETE);
rplan.remove(); rplan.remove();
if (!pi.add_status())
break;
} }
} }
return true; return true;
@ -417,8 +461,8 @@ void TGenera_planning_app::elabora_passaggio(const TDate& dadata, const TDate& a
rplan.put(LVRCONSPLAN_CONSSTD,true); //setta il flag di "consegna standard" rplan.put(LVRCONSPLAN_CONSSTD,true); //setta il flag di "consegna standard"
rplan.put(LVRCONSPLAN_PERSOSP,codpersosp); //setta il periodo di sospensione rplan.put(LVRCONSPLAN_PERSOSP,codpersosp); //setta il periodo di sospensione
lv_set_update_info(rplan); //setta utente, data e ora dell'ultimo aggiornamento lv_set_update_info(rplan); //setta utente, data e ora dell'ultimo aggiornamento
file_rplan.write(); file_rplan.write();
send_transaction(rplan, TRANSACTION_INSERT);
} }
} }

View File

@ -296,7 +296,10 @@ void TGestione_planning_mask::aggiorna_plan()
{ {
//se esiste una riga sul file, la rimuovo //se esiste una riga sul file, la rimuovo
if (codrigaor > 0 && rplan.status() == NOERR) if (codrigaor > 0 && rplan.status() == NOERR)
{
rplan.remove(); rplan.remove();
send_transaction(rplan.curr(), TRANSACTION_DELETE);
}
//creo la nuova riga //creo la nuova riga
rplan.zero(); rplan.zero();
@ -310,6 +313,8 @@ void TGestione_planning_mask::aggiorna_plan()
//scrivo la nuova riga //scrivo la nuova riga
if (err != NOERR) if (err != NOERR)
warning_box (FR("Errore di scrittura. Errore %d"), err); warning_box (FR("Errore di scrittura. Errore %d"), err);
else
send_transaction(rplan.curr(), TRANSACTION_INSERT);
//modifico anche la TToken_string così da evitare errori al momento della rewrite //modifico anche la TToken_string così da evitare errori al momento della rewrite
@ -350,6 +355,9 @@ void TGestione_planning_mask::aggiorna_plan()
lv_set_update_info(rplan.curr()); lv_set_update_info(rplan.curr());
if (rplan.rewrite() != NOERR) if (rplan.rewrite() != NOERR)
warning_box (TR("Errore di scrittura.")); warning_box (TR("Errore di scrittura."));
else
send_transaction(rplan.curr(), TRANSACTION_MODIFY);
if (updatecar && _rigaoriginale.not_empty()) if (updatecar && _rigaoriginale.not_empty())
rewrite_all(rigamodificata, data, codplan); rewrite_all(rigamodificata, data, codplan);
@ -396,6 +404,7 @@ void TGestione_planning_mask::rewrite_all(TToken_string& rigamodificata, TDate&
lv_set_update_info(rec); lv_set_update_info(rec);
//faccio l'effettiva rewrite //faccio l'effettiva rewrite
rec.rewrite(rplan); rec.rewrite(rplan);
send_transaction(rplan.curr(), TRANSACTION_MODIFY);
} }
} }
fill_sheet(); fill_sheet();
@ -428,6 +437,7 @@ bool TGestione_planning_mask::cancella_riga()
rplan.put(LVRCONSPLAN_CODPLAN,codplan); rplan.put(LVRCONSPLAN_CODPLAN,codplan);
rplan.put(LVRCONSPLAN_CODRIGA,codriga); rplan.put(LVRCONSPLAN_CODRIGA,codriga);
err = rplan.remove(); err = rplan.remove();
send_transaction(rplan.curr(), TRANSACTION_DELETE);
} }
return err == NOERR; return err == NOERR;
} }

View File

@ -9,6 +9,7 @@
#include <clifo.h> #include <clifo.h>
#include "lvcondv.h" #include "lvcondv.h"
#include "lvpasplan.h" #include "lvpasplan.h"
#include "lvlib.h"
#include "lv2a00a.h" #include "lv2a00a.h"
@ -83,11 +84,13 @@ void TAutogiro_app::main_loop()
query << "USE LVCONDV SELECT LVPASPLAN->NRIGA!=1" query << "USE LVCONDV SELECT LVPASPLAN->NRIGA!=1"
<< "\nJOIN LVPASPLAN INTO CODCF==CODCF CODCONT==CODCONT NRIGA==1"; << "\nJOIN LVPASPLAN INTO CODCF==CODCF CODCONT==CODCONT NRIGA==1";
TISAM_recordset contratti(query); TISAM_recordset contratti(query);
TProgress_monitor pi(contratti.items(), title());
TLog_report log; TLog_report log;
for (bool ok = contratti.move_first(); ok; ok = contratti.move_next()) {
TProgress_monitor pi(contratti.items(), title());
for (bool ok = contratti.move_first(); pi.addstatus() && ok; ok = contratti.move_next())
{ {
const long codcf = contratti.get(LVCONDV_CODCF).as_int(); const long codcf = contratti.get(LVCONDV_CODCF).as_int();
if (codcf <= 0) if (codcf <= 0)
@ -98,7 +101,7 @@ void TAutogiro_app::main_loop()
continue; continue;
int nriga = 1; int nriga = 1;
for (int day = 0; day < 7; day++) if (msk.get_bool(F_LUNEDI+day)) for (int day = 0; day < 7; day++) if (msk.get_bool(F_LUNEDI + day))
{ {
if (nriga == 1) if (nriga == 1)
{ {
@ -116,9 +119,10 @@ void TAutogiro_app::main_loop()
pasplan.put(LVPASPLAN_CODITI, msk.get(F_ITINERARIO)); pasplan.put(LVPASPLAN_CODITI, msk.get(F_ITINERARIO));
pasplan.put(LVPASPLAN_FREQ, msk.get(F_FREQUENZA)); pasplan.put(LVPASPLAN_FREQ, msk.get(F_FREQUENZA));
pasplan.put(LVPASPLAN_MODPASS, msk.get(F_CONSEGNA)); pasplan.put(LVPASPLAN_MODPASS, msk.get(F_CONSEGNA));
pasplan.put(LVPASPLAN_GGCONS, day+1); pasplan.put(LVPASPLAN_GGCONS, day + 1);
const int err = pasplan.write(); const int err = pasplan.write();
if (err != NOERR) if (err != NOERR)
{ {
cantwrite_box(pasplan.description()); cantwrite_box(pasplan.description());
@ -126,12 +130,11 @@ void TAutogiro_app::main_loop()
contratti.move_last(); contratti.move_last();
break; break;
} }
else
send_transaction(pasplan.curr(), TRANSACTION_INSERT);
}
} }
if (!pi.add_status())
break;
} }
log.preview(); log.preview();
} }
} }

View File

@ -8,6 +8,7 @@
#include <config.h> #include <config.h>
#include <dongle.h> #include <dongle.h>
#include <postman.h>
#include <recset.h> #include <recset.h>
#include <utility.h> #include <utility.h>
@ -2146,3 +2147,58 @@ void TDoc_inventario_row::set_magazzinoc(const char* magc)
{ {
_rinv.put(RDOC_CODMAGC, magc); _rinv.put(RDOC_CODMAGC, magc);
} }
void rec2ini(const TRectype& rec, TConfig& ini)
{
for (int i = 0; i < rec.items(); i++)
{
const char* fname = rec.fieldname(i);
const TString& val = rec.get(fname);
if (val.full())
{
if (val.find(' ') >= 0 && rec.type(fname) == _alfafld)
{
TString quoted; quoted << '"' << val << '"';
ini.set(fname, quoted);
}
else
ini.set(fname, val);
}
}
}
void build_ini(TConfig & ini, const TRectype & rec, const char * action)
{
ini.set_paragraph("Transaction");
ini.set("Firm", prefix().get_codditta(), "Transaction");
ini.set("User", user());
ini.set("HostName", get_hostname());
ini.set("Action", action);
ini.set("Mode", "Auto");
int year, release, tag, patch;
if (TApplication::get_version_info(year, release, tag, patch))
{
TString80 ver;
ver.format("%d %d.%d-%d", year, release, tag, patch);
ini.set("Version", ver);
}
TString16 para; para << rec.num();
ini.set_paragraph(para);
rec2ini(rec, ini);
}
void send_transaction(const TRectype & rec, const char * action)
{
if (can_dispatch_transaction(rec))
{
TFilename temp; temp.temp();
{
TConfig ini(temp);
build_ini(ini, rec, action);
}
dispatch_transaction(rec, temp);
}
}

View File

@ -5,6 +5,8 @@
#include "../ve/velib07.h" #include "../ve/velib07.h"
#endif #endif
#include <transaction.h>
#define RDOC_QTAREALE "CIN01" #define RDOC_QTAREALE "CIN01"
#define RDOC_TOTREALE "CIN02" #define RDOC_TOTREALE "CIN02"
#define RDOC_PROVV1REALE "CIN03" #define RDOC_PROVV1REALE "CIN03"
@ -405,4 +407,8 @@ public:
// Finestra di notifica per messaggi non troppo critici, tipice nelle elaborazioni batch // Finestra di notifica per messaggi non troppo critici, tipice nelle elaborazioni batch
bool lv_popup_msg(const char* fmt, ...); bool lv_popup_msg(const char* fmt, ...);
void rec2ini(const TRectype& rec, TConfig& ini);
void build_ini(TConfig & ini, const TRectype & rec, const char * action);
void send_transaction(const TRectype & rec, const char * action);
#endif #endif