Patch level : 12.0 1028

Files correlati     : bacnv.exe

Commento :

Migliorate le segnalazioni e codificate le categorie mancanti nella conversione dell'anagrafica articoli per il CONAI
This commit is contained in:
francescofucarino 2021-01-20 17:10:55 +01:00
parent 77d77ba3ed
commit af7c084565
4 changed files with 41 additions and 11 deletions

View File

@ -197,17 +197,17 @@ long fsize(const char* name)
return (name && *name) ? xvt_fsys_file_attr(name, XVT_FILE_ATTR_SIZE) : 0L; return (name && *name) ? xvt_fsys_file_attr(name, XVT_FILE_ATTR_SIZE) : 0L;
} }
time_t atime(const char* file) const time_t atime(const char* file)
{ {
return xvt_fsys_file_attr(file, XVT_FILE_ATTR_ATIME); return xvt_fsys_file_attr(file, XVT_FILE_ATTR_ATIME);
} }
time_t ctime(const char* file) const time_t ctime(const char* file)
{ {
return xvt_fsys_file_attr(file, XVT_FILE_ATTR_CTIME); return xvt_fsys_file_attr(file, XVT_FILE_ATTR_CTIME);
} }
time_t mtime(const char* file) const time_t mtime(const char* file)
{ {
return xvt_fsys_file_attr(file, XVT_FILE_ATTR_MTIME); return xvt_fsys_file_attr(file, XVT_FILE_ATTR_MTIME);
} }

View File

@ -61,9 +61,9 @@ long fsize(const char* file);
bool dexist(const char* file); bool dexist(const char* file);
void log_message(const char* fmt, ...); void log_message(const char* fmt, ...);
time_t atime(const char* file); // access time const time_t atime(const char* file); // access time
time_t ctime(const char* file); // creation time const time_t ctime(const char* file); // creation time
time_t mtime(const char* file); // modification time const time_t mtime(const char* file); // modification time
struct tm * altime(const char* file); // access local time struct tm * altime(const char* file); // access local time
struct tm * cltime(const char* file); // creation local time struct tm * cltime(const char* file); // creation local time
struct tm * mltime(const char* file); // creation local time struct tm * mltime(const char* file); // creation local time

View File

@ -48,7 +48,9 @@
#include "../mg/rmovmag.h" #include "../mg/rmovmag.h"
#endif #endif
#include <map> #ifndef __REPUTILS_H
#include <reputils.h>
#endif
// campi comuni alla maschere di magazzino // campi comuni alla maschere di magazzino
typedef enum typedef enum
@ -346,7 +348,7 @@ public:
const TString & get_scat(int i) {return _sc.objptr(i) != NULL ? (const TString &)_sc[i] : EMPTY_STRING;} const TString & get_scat(int i) {return _sc.objptr(i) != NULL ? (const TString &)_sc[i] : EMPTY_STRING;}
const real get_peso(int i) {return _peso.objptr(i) != NULL ? (const real &)_peso[i] : ZERO;} const real get_peso(int i) {return _peso.objptr(i) != NULL ? (const real &)_peso[i] : ZERO;}
TArticolo_conai(const TString& codart); TArticolo_conai(const TString& codart, TLog_report * log = nullptr);
}; };
// ******************************* // *******************************

View File

@ -11,6 +11,7 @@
#include "mglib.h" #include "mglib.h"
#include "../cg/cglib.h" #include "../cg/cglib.h"
#include "../ve/veconf.h" #include "../ve/veconf.h"
#include "../ve/velib.h"
#include "anamag.h" #include "anamag.h"
#include "mag.h" #include "mag.h"
@ -1868,8 +1869,9 @@ const char* conai2anamagfld(const TString& conai_cat)
return "ERROR"; return "ERROR";
} }
static const char* __conai_default_values[CONAI_CLASSES] = { "AC99", "AL99", "CA40", "LE99", "PL12", "VE99" };
// Conai nell'articolo // Conai nell'articolo
TArticolo_conai::TArticolo_conai(const TString& codart) TArticolo_conai::TArticolo_conai(const TString& codart, TLog_report * log)
: _codart(codart) : _codart(codart)
{ {
/* Devo caricarmi tutti i codici conai presenti nell'articolo /* Devo caricarmi tutti i codici conai presenti nell'articolo
@ -1880,6 +1882,7 @@ TArticolo_conai::TArticolo_conai(const TString& codart)
TLocalisamfile conart(LF_CONART); TLocalisamfile conart(LF_CONART);
conart.put(CONART_CODART, _codart); conart.put(CONART_CODART, _codart);
int err = conart.read(_isgteq); int err = conart.read(_isgteq);
while (err == NOERR && _codart == conart.get(CONART_CODART)) while (err == NOERR && _codart == conart.get(CONART_CODART))
{ {
const int i = conart.get_int(CONART_NRIGA) - 1; const int i = conart.get_int(CONART_NRIGA) - 1;
@ -1896,6 +1899,7 @@ TArticolo_conai::TArticolo_conai(const TString& codart)
* La risposta è semplice, tutti i programmi che non verranno aggiornati da queste modifiche (es. Importazione Pack/SKNT) * La risposta è semplice, tutti i programmi che non verranno aggiornati da queste modifiche (es. Importazione Pack/SKNT)
* scrivono li e quindi va tenuta la compatibilità * scrivono li e quindi va tenuta la compatibilità
*/ */
if (_sc.empty()) if (_sc.empty())
{ {
TLocalisamfile anamag(LF_ANAMAG); TLocalisamfile anamag(LF_ANAMAG);
@ -1919,7 +1923,12 @@ TArticolo_conai::TArticolo_conai(const TString& codart)
if (fldname != "ERROR") if (fldname != "ERROR")
{ {
_sc.add(con); _sc.add(con);
_peso.add(ranamag.get_real(fldname));
const real peso = ranamag.get_real(fldname);
_peso.add(peso);
if ((log != nullptr) && (peso==ZERO))
log->log(0, format("articolo :%s - peso unitario a zero", (const char *)_codart));
} }
#ifdef DBG #ifdef DBG
else else
@ -1930,6 +1939,25 @@ TArticolo_conai::TArticolo_conai(const TString& codart)
} }
#endif #endif
} }
else
{
TString categoria = __conai_default_values[i];
const TString& sottocat = categoria.right(2);
categoria = categoria.left(2);
const TString fldname = conai2anamagfld(categoria);
const real peso = ranamag.get_real(fldname);
if (peso != ZERO)
{
_sc.add((TString)__conai_default_values[i]);
const real peso = ranamag.get_real(fldname);
_peso.add(peso);
if (log != nullptr)
log->log(0, format("articolo :%s - peso unitario: kg %s senza categoria, impostato a: %s%s", (const char *)_codart,
(const char *)peso.stringa(), (const char *)categoria, (const char *)sottocat));
}
}
} }
} }
} }