Patch level : 12.0 932
Files correlati : bs0.exe Commento : Corretta importazione da SKYNET per nuovab. dopo modifica CONAI
This commit is contained in:
parent
a86eddf0e5
commit
d319980d15
@ -15,6 +15,7 @@
|
|||||||
#include "../ve/velib.h"
|
#include "../ve/velib.h"
|
||||||
#include <doc.h>
|
#include <doc.h>
|
||||||
#include <rdoc.h>
|
#include <rdoc.h>
|
||||||
|
#include "conart.h"
|
||||||
|
|
||||||
#include "bs0.h"
|
#include "bs0.h"
|
||||||
|
|
||||||
@ -28,6 +29,7 @@
|
|||||||
|
|
||||||
#include "bsutility.h"
|
#include "bsutility.h"
|
||||||
#include "urldefid.h"
|
#include "urldefid.h"
|
||||||
|
#include "sqlset.h"
|
||||||
|
|
||||||
#define BS_DTULTAGG "DtUltAgg"
|
#define BS_DTULTAGG "DtUltAgg"
|
||||||
|
|
||||||
@ -571,8 +573,8 @@ void TSknet_sync::sync_anamag()
|
|||||||
if (_hasConai)
|
if (_hasConai)
|
||||||
{
|
{
|
||||||
// Apro anamag per aggiungere le informazioni sugli articoli
|
// Apro anamag per aggiungere le informazioni sugli articoli
|
||||||
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() << " AND " << where_time_import() << ";";
|
query.cut(0) << "SELECT * FROM tieArtCONAI where origine=" << their_origin() << " AND " << where_time_import() << ";";
|
||||||
//_log->log(0, query);
|
//_log->log(0, query);
|
||||||
TODBC_recordset odbc(query);
|
TODBC_recordset odbc(query);
|
||||||
@ -582,6 +584,67 @@ void TSknet_sync::sync_anamag()
|
|||||||
{
|
{
|
||||||
if (!p.add_status())
|
if (!p.add_status())
|
||||||
break;
|
break;
|
||||||
|
TString codart = odbc.get("Cod_PK").as_string();
|
||||||
|
TString4 cats[] = { odbc.get("CatAC").as_string(), odbc.get("CatAL").as_string(), odbc.get("CatCA").as_string(), odbc.get("CatLE").as_string(), odbc.get("CatPL").as_string(), odbc.get("CatVE").as_string() };
|
||||||
|
TString pesi[] = { odbc.get("PesoAC").as_string(), odbc.get("PesoAL").as_string(), odbc.get("PesoCA").as_string(), odbc.get("PesoLE").as_string(), odbc.get("PesoPL").as_string(), odbc.get("PesoVE").as_string() };
|
||||||
|
// ac, al, ca, le, pl, ve
|
||||||
|
TString4 categoria, sottocat;
|
||||||
|
TString peso;
|
||||||
|
for(int i = 0; i < 6; ++i)
|
||||||
|
{
|
||||||
|
if (!cats[i].empty())
|
||||||
|
{
|
||||||
|
categoria = cats[i].left(2);
|
||||||
|
sottocat = cats[i].right(2);
|
||||||
|
peso = pesi[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int nriga = 1;
|
||||||
|
TString s_query; s_query << "SELECT * FROM CONART WHERE CODART = '" << codart << "' AND Categoria = '" << categoria << "' AND Sottocat = '" << sottocat << "'";
|
||||||
|
TSQL_recordset sql(s_query);
|
||||||
|
static bool flag = false;
|
||||||
|
if (!categoria.empty() && !sottocat.empty() && !peso.empty())
|
||||||
|
{
|
||||||
|
TLocalisamfile conart(LF_CONART);
|
||||||
|
if (sql.items() > 0 && sql.move_first())
|
||||||
|
{
|
||||||
|
nriga = sql.get(sql.find_column("NRIGA")).as_int();
|
||||||
|
conart.put(CONART_CODART, codart);
|
||||||
|
conart.put(CONART_CATEGORIA, categoria);
|
||||||
|
conart.put(CONART_NRIGA, nriga);
|
||||||
|
if (conart.read() == NOERR)
|
||||||
|
{
|
||||||
|
conart.put(CONART_PESO, peso);
|
||||||
|
conart.write();
|
||||||
|
conart.rewrite();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sql.items() == 0) // Non esiste quell'art. con quella cat. e sottocat.
|
||||||
|
{
|
||||||
|
TString codart_query;
|
||||||
|
// Aggiungo nuovo record per quell'articolo.
|
||||||
|
// Se c'e' gia' qualche altra sottocategoria aggiungo una riga in piu', altrimenti e' la prima
|
||||||
|
codart_query << "SELECT * FROM CONART WHERE CODART = '" << codart << "'";
|
||||||
|
TSQL_recordset sql_codart(codart_query);
|
||||||
|
nriga = sql.items() + 1;
|
||||||
|
conart.zero();
|
||||||
|
conart.put(CONART_CODART, codart);
|
||||||
|
conart.put(CONART_NRIGA, nriga);
|
||||||
|
conart.put(CONART_CATEGORIA, categoria);
|
||||||
|
conart.put(CONART_SOTTOCAT, sottocat);
|
||||||
|
conart.put(CONART_PESO, peso);
|
||||||
|
conart.write();
|
||||||
|
conart.rewrite();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!flag)
|
||||||
|
flag = yesno_box("Attenzione trovato articolo con categoria CONAI vuota: %s\nSopprimere eventuali prossimi messaggi?", (const char*)codart);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
|
||||||
art.first(); // Useless??
|
art.first(); // Useless??
|
||||||
rart.zero();
|
rart.zero();
|
||||||
rart.put(ANAMAG_CODART, odbc.get("Cod_PK").as_string());
|
rart.put(ANAMAG_CODART, odbc.get("Cod_PK").as_string());
|
||||||
@ -609,6 +672,7 @@ void TSknet_sync::sync_anamag()
|
|||||||
odbc.get("CatVE").as_string().left(4) // Categoria Vetro
|
odbc.get("CatVE").as_string().left(4) // Categoria Vetro
|
||||||
);
|
);
|
||||||
* /
|
* /
|
||||||
|
|
||||||
rart.put(ANAMAG_CONAISC, catCON);
|
rart.put(ANAMAG_CONAISC, catCON);
|
||||||
rart.put(ANAMAG_CONACC, odbc.get("PesoAC").as_real()); // Peso Acciaio
|
rart.put(ANAMAG_CONACC, odbc.get("PesoAC").as_real()); // Peso Acciaio
|
||||||
rart.put(ANAMAG_CONALL, odbc.get("PesoAL").as_real()); // Peso Alluminio
|
rart.put(ANAMAG_CONALL, odbc.get("PesoAL").as_real()); // Peso Alluminio
|
||||||
@ -623,6 +687,8 @@ void TSknet_sync::sync_anamag()
|
|||||||
{
|
{
|
||||||
bool tolla = true;
|
bool tolla = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1603,33 +1669,33 @@ void TSknet_sync::sync_doc()
|
|||||||
// In base al conai che ha abilitato controllo
|
// In base al conai che ha abilitato controllo
|
||||||
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFACC")) // Acciaio
|
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFACC")) // Acciaio
|
||||||
{
|
{
|
||||||
rdoc.put("CONSCACC", docs.get("CatAC").as_string());
|
rdoc.put("CCON(1)", docs.get("CatAC").as_string());
|
||||||
rdoc.put("CONPUACC", docs.get("PesoAC").as_string());
|
rdoc.put("PCON(1)", docs.get("PesoAC").as_string());
|
||||||
}
|
}
|
||||||
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFALL")) // Alluminio
|
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFALL")) // Alluminio
|
||||||
{
|
{
|
||||||
rdoc.put("CONSCALL", docs.get("CatAL").as_string());
|
rdoc.put("CCON(1)", docs.get("CatAL").as_string());
|
||||||
rdoc.put("CONPUALL", docs.get("PesoAL").as_string());
|
rdoc.put("PCON(1)", docs.get("PesoAL").as_string());
|
||||||
}
|
}
|
||||||
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFCAR")) // Carta
|
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFCAR")) // Carta
|
||||||
{
|
{
|
||||||
rdoc.put("CONSCCAR", docs.get("CatCA").as_string());
|
rdoc.put("CCON(1)", docs.get("CatCA").as_string());
|
||||||
rdoc.put("CONPUCAR", docs.get("PesoCA").as_string());
|
rdoc.put("PCON(1)", docs.get("PesoCA").as_string());
|
||||||
}
|
}
|
||||||
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFLEG")) // Legno
|
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFLEG")) // Legno
|
||||||
{
|
{
|
||||||
rdoc.put("CONSCLEG", docs.get("CatLE").as_string());
|
rdoc.put("CCON(1)", docs.get("CatLE").as_string());
|
||||||
rdoc.put("CONPULEG", docs.get("PesoLE").as_string());
|
rdoc.put("PCON(1)", docs.get("PesoLE").as_string());
|
||||||
}
|
}
|
||||||
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFPLA")) // Plastica
|
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFPLA")) // Plastica
|
||||||
{
|
{
|
||||||
rdoc.put("CONSCPLA", docs.get("CatPL").as_string());
|
rdoc.put("CCON(1)", docs.get("CatPL").as_string());
|
||||||
rdoc.put("CONPUPLA", docs.get("PesoPL").as_string());
|
rdoc.put("PCON(1)", docs.get("PesoPL").as_string());
|
||||||
}
|
}
|
||||||
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFVET")) // Vetro
|
if (ini_get_bool(CONFIG_DITTA, "ve", "CONFVET")) // Vetro
|
||||||
{
|
{
|
||||||
rdoc.put("CONSCVET", docs.get("CatVE").as_string());
|
rdoc.put("CCON(1)", docs.get("CatVE").as_string());
|
||||||
rdoc.put("CONPUVET", docs.get("PesoVE").as_string());
|
rdoc.put("PCON(1)", docs.get("PesoVE").as_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user