Patch level : 12.0 574
Files correlati : bs Commento : - Sistemati errori in importazione UM - Sistemato errore con codartalt == codart git-svn-id: svn://10.65.10.50/branches/R_10_00@24495 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
73cb530d74
commit
a678a66b50
@ -495,6 +495,33 @@ void TSknet_sync::sync_anamag()
|
|||||||
TISAM_recordset art(query);
|
TISAM_recordset art(query);
|
||||||
sync_table(art, "tieArticoli", fields);
|
sync_table(art, "tieArticoli", fields);
|
||||||
|
|
||||||
|
// Sincronizzo le unità di misura
|
||||||
|
{
|
||||||
|
query.cut(0) << "SELECT * from tieArticoli where Origine=" << their_origin();
|
||||||
|
TODBC_recordset odbcunit(query);
|
||||||
|
odbcunit.connect(_dsn, _usr, _psw);
|
||||||
|
for (bool go = odbcunit.move_first(); go; go = odbcunit.move_next())
|
||||||
|
{
|
||||||
|
// Umart
|
||||||
|
TLocalisamfile umart(LF_UMART);
|
||||||
|
TRectype rumart(LF_UMART);
|
||||||
|
const TString& codpadre = odbcunit.get("CodPadre").as_string();
|
||||||
|
rumart.put("CODART", codpadre);
|
||||||
|
rumart.put("NRIGA", 1);
|
||||||
|
rumart.put("UM", "PZ");
|
||||||
|
rumart.put("FC", UNO);
|
||||||
|
if (rumart.rewrite_write(umart) != NOERR)
|
||||||
|
{
|
||||||
|
// Eror!
|
||||||
|
bool tolla = true;
|
||||||
|
TString msg = "Errata importazione UM per l'articolo ";
|
||||||
|
msg << codpadre;
|
||||||
|
_log->log(1, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
// Controllo se esistono varianti e le aggiungo
|
// Controllo se esistono varianti e le aggiungo
|
||||||
query.cut(0) << "SELECT * FROM tieArtVarianti where origine=" << their_origin();
|
query.cut(0) << "SELECT * FROM tieArtVarianti where origine=" << their_origin();
|
||||||
TODBC_recordset odbc(query);
|
TODBC_recordset odbc(query);
|
||||||
@ -503,47 +530,56 @@ void TSknet_sync::sync_anamag()
|
|||||||
// Apro codcorr per aggiungere i codici dei clienti
|
// Apro codcorr per aggiungere i codici dei clienti
|
||||||
TLocalisamfile ccor(LF_CODCORR);
|
TLocalisamfile ccor(LF_CODCORR);
|
||||||
TRectype rccor(LF_CODCORR);
|
TRectype rccor(LF_CODCORR);
|
||||||
|
// Il primo giro svuoto CODCORR dagli articoli inseriti (sono stati importati tantissimi articoli con CODART == CODARTALT, così facendo pulisco)
|
||||||
|
for (bool go = odbc.move_first(); go; go = odbc.move_next())
|
||||||
|
{
|
||||||
|
ccor.first(); // Useless??
|
||||||
|
rccor.zero();
|
||||||
|
const TString& codpadre = odbc.get("CodPadre").as_string();
|
||||||
|
rccor.put(CODCORR_CODART, codpadre);
|
||||||
|
rccor.put(CODCORR_NRIGA, 1);
|
||||||
|
if (ccor.read(rccor, _isequal) == NOERR)
|
||||||
|
{
|
||||||
|
while (rccor.get(CODCORR_CODART) == codpadre)
|
||||||
|
{
|
||||||
|
rccor.remove(ccor);
|
||||||
|
rccor.next(ccor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (bool go = odbc.move_first(); go; go = odbc.move_next())
|
for (bool go = odbc.move_first(); go; go = odbc.move_next())
|
||||||
{
|
{
|
||||||
// Lavoro sul file ISAM, più veloce
|
// Lavoro sul file ISAM, più veloce
|
||||||
// Azzero
|
// Azzero
|
||||||
ccor.first(); // Useless??
|
ccor.first(); // Useless??
|
||||||
rccor.zero();
|
rccor.zero();
|
||||||
bool add = true;
|
bool add = false;
|
||||||
int riga = 1;
|
int riga = 1;
|
||||||
rccor.put(CODCORR_CODART, odbc.get("CodPadre").as_string());
|
const TString& codpadre = odbc.get("CodPadre").as_string();
|
||||||
|
const TString& codarticolo = odbc.get("CodArticolo").as_string();
|
||||||
|
rccor.put(CODCORR_CODART, codpadre);
|
||||||
rccor.put(CODCORR_NRIGA, riga);
|
rccor.put(CODCORR_NRIGA, riga);
|
||||||
if (ccor.read(rccor, _isequal) == NOERR)
|
if (codpadre != codarticolo && ccor.read(rccor, _isequal) == NOERR)
|
||||||
{
|
{
|
||||||
while (add && rccor.get(CODCORR_CODART) == odbc.get("CodPadre").as_string())
|
add = true;
|
||||||
|
while (add && rccor.get(CODCORR_CODART) == codpadre)
|
||||||
{
|
{
|
||||||
riga = rccor.get_int(CODCORR_NRIGA);
|
riga = rccor.get_int(CODCORR_NRIGA);
|
||||||
add = rccor.get(CODCORR_CODARTALT) != odbc.get("CodArticolo").as_string();
|
add = rccor.get(CODCORR_CODARTALT) != codarticolo;
|
||||||
rccor.next(ccor);
|
rccor.next(ccor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (add)
|
if (add)
|
||||||
{
|
{
|
||||||
rccor.zero();
|
rccor.zero();
|
||||||
rccor.put(CODCORR_CODART, odbc.get("CodPadre").as_string());
|
rccor.put(CODCORR_CODART, codpadre);
|
||||||
rccor.put(CODCORR_NRIGA, riga++);
|
rccor.put(CODCORR_NRIGA, riga++);
|
||||||
rccor.put(CODCORR_CODARTALT, odbc.get("CodArticolo").as_string());
|
rccor.put(CODCORR_CODARTALT, codarticolo);
|
||||||
rccor.put(CODCORR_UM, ini_get_string(CONFIG_DITTA, "BS", "SKCodUmsDef"));
|
rccor.put(CODCORR_UM, ini_get_string(CONFIG_DITTA, "BS", "SKCodUmsDef"));
|
||||||
ccor.write(rccor);
|
ccor.write(rccor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Umart
|
|
||||||
TLocalisamfile umart(LF_UMART);
|
|
||||||
TRectype rumart(LF_UMART);
|
|
||||||
rumart.put("CODART", odbc.get("CodPadre").as_string());
|
|
||||||
rumart.put("NRIGA", 1);
|
|
||||||
rumart.put("UM", "PZ");
|
|
||||||
rumart.put("FC", UNO);
|
|
||||||
if (rumart.rewrite_write(umart) != NOERR)
|
|
||||||
{
|
|
||||||
// Eror!
|
|
||||||
bool tolla = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conai
|
// Conai
|
||||||
@ -553,7 +589,8 @@ void TSknet_sync::sync_anamag()
|
|||||||
TLocalisamfile art(LF_ANAMAG);
|
TLocalisamfile art(LF_ANAMAG);
|
||||||
TRectype rart(LF_ANAMAG);
|
TRectype rart(LF_ANAMAG);
|
||||||
query.cut(0) << "SELECT * FROM tieArtCONAI where origine=" << their_origin();
|
query.cut(0) << "SELECT * FROM tieArtCONAI where origine=" << their_origin();
|
||||||
odbc.exec(query);
|
TODBC_recordset odbc(query);
|
||||||
|
odbc.connect(_dsn, _usr, _psw);
|
||||||
for (bool go = odbc.move_first(); go; go = odbc.move_next())
|
for (bool go = odbc.move_first(); go; go = odbc.move_next())
|
||||||
{
|
{
|
||||||
art.first(); // Useless??
|
art.first(); // Useless??
|
||||||
@ -995,7 +1032,7 @@ void TSknet_sync::load_clifo(const char tipocf)
|
|||||||
cfv.put(CFV_ADDBOLLI, tipocf == 'C');
|
cfv.put(CFV_ADDBOLLI, tipocf == 'C');
|
||||||
|
|
||||||
// Non ho capito se alla fine mi passa qua i dati o nel campo NOTE
|
// Non ho capito se alla fine mi passa qua i dati o nel campo NOTE
|
||||||
cfv.put(CFV_ASSFIS, tipocf == 'C' ? odbc.get("Cli_CodIva").as_string() : odbc.get("For_CodIva").as_string());
|
cfv.put(CFV_ASSFIS, cache().get("%SKI", tipocf == 'C' ? odbc.get("Cli_CodIva").as_string() : odbc.get("For_CodIva").as_string(), "S6"));
|
||||||
|
|
||||||
// Parso il campo Note
|
// Parso il campo Note
|
||||||
TToken_string note(odbc.get("Note").as_string());
|
TToken_string note(odbc.get("Note").as_string());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user