Patch level : 10.0 patch 417

Files correlati     : lv2
Ricompilazione Demo : [ ]
Commento            :
Corretta la domanda "Vuoi sovrascivere, sommare o ignorare", adesso viene proposta per ogni cliente che incontro (mail Paolo 12/08)


git-svn-id: svn://10.65.10.50/trunk@19210 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca83 2009-08-20 09:14:10 +00:00
parent eb5814e098
commit bd69651da6

View File

@ -156,7 +156,7 @@ TAcquisizione_cache::TAcquisizione_cache() : TCache(17)
{ {
_codnum = ini_get_string(CONFIG_DITTA, "lv", "NUM_RIT(0)"); _codnum = ini_get_string(CONFIG_DITTA, "lv", "NUM_RIT(0)");
_tipodoc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_RIT(0)"); _tipodoc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_RIT(0)");
_stato = ini_get_string(CONFIG_DITTA, "lv", "STATO_RIT(0)"); _stato = cache().get("%TIP", _tipodoc, "S2").left(1);
_ndoc = 0; _ndoc = 0;
} }
@ -176,7 +176,7 @@ protected:
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
void elabora_file(const TString& file, bool new_file, TLog_report &rep); void elabora_file(const TString& file, TLog_report &rep);
public: public:
@ -204,12 +204,14 @@ bool TAcquisizione_lavanderie_app::destroy()
} }
//ELABORA_FILE: metodo che effettivamente fa l'elaborazione del file, creando i documenti //ELABORA_FILE: metodo che effettivamente fa l'elaborazione del file, creando i documenti
void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_file, TLog_report &rep) void TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report &rep)
{ {
TAcquisizione_cache ca; TAcquisizione_cache ca;
bool sovrascrivi = true; bool sovrascrivi = true;
bool nuovo_cliente = true;
TAssoc_array deleted_docs; TAssoc_array deleted_docs;
TAssoc_array clienti;
//scandisco il file //scandisco il file
TScanner s(file); TScanner s(file);
while (s.ok()) while (s.ok())
@ -219,7 +221,7 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi
continue; continue;
TDate datadoc; TDate datadoc;
long codcf = 0; long codcf = 0; TString8 codcf_str;
TString80 codart; TString80 codart;
long qta; long qta;
long rotti; long rotti;
@ -236,11 +238,18 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi
const int y = atoi(riga.mid(4,4)); const int y = atoi(riga.mid(4,4));
if (d > 0 && d <= 31 && m > 0 && m <= 12 && y > 2000) if (d > 0 && d <= 31 && m > 0 && m <= 12 && y > 2000)
{ {
codcf_str = riga.mid(8,6);
datadoc = TDate(d, m, y); datadoc = TDate(d, m, y);
codcf = atol(riga.mid(8,6)); codcf = atol(codcf_str);
codart = riga.mid(14,8); codart = riga.mid(14,8);
qta = atol(riga.mid(22,6)); qta = atol(riga.mid(22,6));
rotti = atol(riga.mid(28,6)); rotti = atol(riga.mid(28,6));
if(!clienti.is_key(codcf_str))
{
clienti.add(codcf_str,codcf_str);
nuovo_cliente = true;
}
} }
else else
continue; continue;
@ -253,9 +262,10 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi
const int d = atoi(riga.mid(6,2)); const int d = atoi(riga.mid(6,2));
if (d > 0 && d <= 31 && m > 0 && m <= 12 && y > 2000) if (d > 0 && d <= 31 && m > 0 && m <= 12 && y > 2000)
{ {
codcf_str = riga.mid(28,20);
datadoc = TDate(d, m, y); datadoc = TDate(d, m, y);
codart = riga.mid(8,20); codart = riga.mid(8,20);
codcf = atol(riga.mid(28,20)); codcf = atol(codcf_str);
qta = atoi(riga.mid(48,11)); qta = atoi(riga.mid(48,11));
ndoc = atoi(riga.mid(59,11)); ndoc = atoi(riga.mid(59,11));
@ -265,8 +275,15 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi
case 2: tipo_conteggio = "Manuale"; break; case 2: tipo_conteggio = "Manuale"; break;
case 3: tipo_conteggio = "Scarto"; break; case 3: tipo_conteggio = "Scarto"; break;
default: break; default: break;
}
operatore = riga.mid(81,40);
if(!clienti.is_key(codcf_str))
{
clienti.add(codcf_str,codcf_str);
nuovo_cliente = true;
}
} }
operatore = riga.mid(81,40); }
else else
continue; continue;
} }
@ -276,18 +293,19 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi
TDocumento& doc = ca.doc(datadoc,codcf); TDocumento& doc = ca.doc(datadoc,codcf);
//se sto elaborando un nuovo file, ma i documenti che sto importando esistono già, chiedi cosa devo fare //se sto elaborando un nuovo file, ma i documenti che sto importando esistono già, chiedi cosa devo fare
if (doc.rows() > 0 && new_file) if (doc.rows() > 0 && nuovo_cliente)
{ {
KEY k = yesnocancel_box(TR("ATTENZIONE: il documento che si sta importando esiste già! Si desidera continuare?\n" KEY k = yesnocancel_box(TR("ATTENZIONE: il documento che si sta importando esiste già! Si desidera continuare?\n"
"Premendo SI il documento verrà sovracsritto;\n" "Premendo SI il documento verrà sovrascritto;\n"
"Premendo NO le quantità verranno sommate a quelle esistenti\n" "Premendo NO le quantità verranno sommate a quelle esistenti\n"
"Premendo ANNULLA il file verrà ignorato")); "Premendo ANNULLA il documento non verrà modificato"));
switch (k) switch (k)
{ {
case K_YES: sovrascrivi = true; break; case K_YES: sovrascrivi = true; break;
case K_NO: sovrascrivi = false; break; case K_NO: sovrascrivi = false; break;
default: return; default: return;
} }
nuovo_cliente = false;
} }
else else
{ {
@ -331,8 +349,6 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi
{ {
const TRectype& anamag = cache().get(LF_ANAMAG, codart); const TRectype& anamag = cache().get(LF_ANAMAG, codart);
//
TRiga_documento& rdoc = doc.new_row("22"); TRiga_documento& rdoc = doc.new_row("22");
rdoc.put(RDOC_CODART, codart); rdoc.put(RDOC_CODART, codart);
rdoc.put(RDOC_DESCR, anamag.get(ANAMAG_DESCR)); rdoc.put(RDOC_DESCR, anamag.get(ANAMAG_DESCR));
@ -342,7 +358,6 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi
rdoc.put(RDOC_QTAGG1, qta); rdoc.put(RDOC_QTAGG1, qta);
rdoc.put(RDOC_QTA, rotti); rdoc.put(RDOC_QTA, rotti);
} }
new_file = false;
} }
//rinomino il file in uso //rinomino il file in uso
@ -354,7 +369,6 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi
s.close(); s.close();
fcopy(fnameini, fnamefin); fcopy(fnameini, fnamefin);
fnameini.fremove(); fnameini.fremove();
if (ca.empty()) if (ca.empty())
{ {
@ -401,10 +415,10 @@ bool TAcquisizione_lavanderie_app::transfer()
list_files(file, lista_file); list_files(file, lista_file);
FOR_EACH_ARRAY_ROW(lista_file, r2, row2) FOR_EACH_ARRAY_ROW(lista_file, r2, row2)
elabora_file(*row2, true, logrep); elabora_file(*row2, logrep);
} }
else else
elabora_file(file, true, logrep); elabora_file(file, logrep);
} }
} }