Patch level : 12.0 982
Files correlati : bs0.exe Commento : Modifica per importazione sknet nuovabienne vecchi codici pack
This commit is contained in:
parent
93f66cf6a6
commit
fb9f970441
@ -8,8 +8,7 @@
|
||||
#include <utility.h>
|
||||
|
||||
#include "../mg/mglib.h"
|
||||
#include "../cg/cglib01.h"
|
||||
#include "../cg/cg2101.h"
|
||||
#include "../cg/cglib.h"
|
||||
#include "../ve/velib.h"
|
||||
#include <doc.h>
|
||||
#include <rdoc.h>
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <validate.h>
|
||||
|
||||
#include "../mg/mglib.h"
|
||||
#include "../cg/cglib01.h"
|
||||
#include "../cg/cglib.h"
|
||||
|
||||
#include "../ve/velib.h"
|
||||
#include <doc.h>
|
||||
@ -1412,6 +1412,8 @@ void TSknet_sync::sync_doc()
|
||||
{
|
||||
//TToken_string test(docs.get("CodTestata").as_string(), '\\');
|
||||
const TString keyDoc = docs.get("CodTestata").as_string();
|
||||
//if (keyDoc.starts_with("1-2020-01-09-16"))
|
||||
// bool simo = true;
|
||||
nd = docs.get("NumRif").as_int();
|
||||
TString wrk = docs.get("CodCliente").as_string();
|
||||
|
||||
@ -1423,7 +1425,7 @@ void TSknet_sync::sync_doc()
|
||||
|
||||
if ((tipocf != "C" && tipocf != "F") || codcf == 0)
|
||||
{
|
||||
TString msg; msg.format("Attenzione! Per il doc n.%d è presente il tipo C/F = '%s' con cod = %d \nIl documento verrà saltato.", nd, tipocf, codcf);
|
||||
TString msg; msg.format("Attenzione! Per il doc n.%d e' presente il tipo C/F = '%s' con cod = %d \nIl documento verra' saltato.", nd, (const char*)tipocf, codcf);
|
||||
_log->log(1, msg);
|
||||
continue;
|
||||
}
|
||||
@ -1464,7 +1466,7 @@ void TSknet_sync::sync_doc()
|
||||
tipodoc = ini_get_string(CONFIG_DITTA, "BS", "SKTIPODOCORC");
|
||||
break;
|
||||
default:
|
||||
warning_box("Attenzione! Per il doc con codice: %s è presente un tipo documento non supportato.\nIl documento saltato", keyDoc);
|
||||
warning_box("Attenzione! Per il doc con codice: %s e' presente un tipo documento non supportato.\nIl documento saltato", (const char*)keyDoc);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1578,16 +1580,65 @@ void TSknet_sync::sync_doc()
|
||||
}
|
||||
}
|
||||
|
||||
const TString80 codart = docs.get("CodArticolo").as_string();
|
||||
const TString descr = docs.get("DSRiga").as_string();
|
||||
const TString80 codart = docs.get("CodArticolo").as_string();
|
||||
TString80 codartmag = codart;
|
||||
const TString descr = docs.get("DSRiga").as_string();
|
||||
|
||||
bool checked = false;
|
||||
if (tiporiga == "01" && ini_get_bool(CONFIG_DITTA, "BS", "SKUseCustomRiga", false))
|
||||
{
|
||||
TLocalisamfile codcor(LF_CODCORR); codcor.setkey(2);
|
||||
TRectype rcodcor(LF_CODCORR);
|
||||
rcodcor.put(CODCORR_CODARTALT, codart);
|
||||
if (codcor.read(rcodcor, _isequal) == NOERR)
|
||||
{
|
||||
// Testo quanti sono. Non ho altro modo?
|
||||
const bool items = rcodcor.next(codcor) == NOERR && rcodcor.get(CODCORR_CODARTALT) == codart;
|
||||
if(items)
|
||||
{
|
||||
rcodcor.prev(codcor);
|
||||
// Prima cerco subito se ho un codice per questo cliente.
|
||||
// Altrimenti prendo quello che non e' un codice di pack, se c'e' altrimenti riprendo sempre il primo.
|
||||
TSQL_recordset codici(TString() << "SELECT * FROM CODCORR WHERE CODARTALT = '" << codart << "' AND TIPOCF = '" << tipocf << "' AND CODCF = '" << codcf << "'");
|
||||
if (codici.items() == 1)
|
||||
{
|
||||
codartmag = codici.get(codici.find_column(CODCORR_CODART)).as_string();
|
||||
checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TString last_cod = rcodcor.get(CODCORR_CODART);
|
||||
|
||||
// Codice di PACK di cinque cifre.
|
||||
static auto is_pack_code = [&]()
|
||||
{
|
||||
bool flag = last_cod.len() == 5;
|
||||
for (int i = 0; i < 5 && flag; ++i) flag &= xvt_chr_is_digit(last_cod[i]);
|
||||
return flag;
|
||||
};
|
||||
|
||||
checked = true; // Se va tutto bene ho il nuovo codartmag.
|
||||
while (is_pack_code())
|
||||
{
|
||||
if (rcodcor.next(codcor) == NOERR && rcodcor.get(CODCORR_CODARTALT) == codart)
|
||||
{
|
||||
last_cod = rcodcor.get(CODCORR_CODART);
|
||||
continue;
|
||||
}
|
||||
checked = false;
|
||||
break;
|
||||
}
|
||||
if(checked)
|
||||
{
|
||||
if (rcodcor.next(codcor) != NOERR || rcodcor.get(CODCORR_CODARTALT) != codart) // Controllo che sia effettivamente l'unico altrimenenti ciaone.
|
||||
codartmag = last_cod;
|
||||
else
|
||||
checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
tiporiga = ini_get_string(CONFIG_DITTA, "BS", "SKNumCustomRiga", "14");
|
||||
}
|
||||
}
|
||||
|
||||
TRectype& rdoc = doc->new_row(tiporiga);
|
||||
@ -1608,8 +1659,9 @@ void TSknet_sync::sync_doc()
|
||||
rdoc.put(RDOC_CODARTMAG, codart);
|
||||
}
|
||||
|
||||
rdoc.put(RDOC_CODARTMAG, codart);
|
||||
// rdoc.check_row();
|
||||
//rdoc.put(RDOC_CODARTMAG, codart);
|
||||
rdoc.put(RDOC_CODARTMAG, codartmag);
|
||||
rdoc.put(RDOC_CHECKED, checked);
|
||||
|
||||
rdoc.put(RDOC_DESCR, descr.sleft(50));
|
||||
if (descr.len() > 50)
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <ODBCrset.h>
|
||||
#include <reputils.h>
|
||||
#include "../mg/mglib.h"
|
||||
#include "../cg/cg2101.h"
|
||||
#include "../ve/velib.h"
|
||||
#include "../fe/felib.h"
|
||||
#include <clifo.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user