Patch level : 12.0 no-patch
Files correlati : mg Commento : Aggiunta nuova macro per lettura conai, aggiunta funzione conai() a TArticolo per restituire l'oggetto TArticolo_conai
This commit is contained in:
parent
cd175c490c
commit
5024861411
@ -87,6 +87,8 @@ const char* const zero_fields[] =
|
||||
NULL
|
||||
};
|
||||
|
||||
class TArticolo_conai;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TCodice_articolo
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -171,6 +173,8 @@ public:
|
||||
TRecord_array& deslin() const { return body(LF_DESLIN); }
|
||||
TRecord_array& codcorr() const { return body(LF_CODCORR); }
|
||||
|
||||
TArticolo_conai& conai() const;
|
||||
|
||||
TArticolo(const char* codice = NULL);
|
||||
TArticolo(const TRectype& rec);
|
||||
virtual ~TArticolo() {}
|
||||
@ -339,16 +343,18 @@ private:
|
||||
// Categoria -> Sottocategoria + peso
|
||||
std::map<TString, std::map<TString, real>> _catsotpes;
|
||||
public:
|
||||
const std::map<TString, std::map<TString, real>> get_map() { return _catsotpes; }
|
||||
const std::map<TString, std::map<TString, real>>& get_map() { return _catsotpes; }
|
||||
const std::map<TString, real>* get_scat(const TString& cat);
|
||||
real get_peso(const TString& cat, const TString& scat);
|
||||
real get_peso(const TString& fcat) { return get_peso(fcat.left(2), fcat.right(2)); }
|
||||
|
||||
|
||||
|
||||
TArticolo_conai(const TString& codart);
|
||||
};
|
||||
|
||||
#define FOR_EACH_CONAI_CAT(_art_con, _cat) const auto& _map_conai = ac.get_map(); \
|
||||
for(const auto& _cat : _map_conai)
|
||||
#define FOR_EACH_CONAI_SOTTOCAT(_art_con, _cat, _sottocat) FOR_EACH_CONAI_CAT(_art_con, _cat) for(const auto& _sottocat : (_cat).second)
|
||||
|
||||
// *******************************
|
||||
// LIBRERIA DI utility del magazzino
|
||||
// *******************************
|
||||
|
@ -466,6 +466,15 @@ real TArticolo::convert_to_um(const real& v, const TString& to_um, const TString
|
||||
return r;
|
||||
}
|
||||
|
||||
TArticolo_conai& TArticolo::conai() const
|
||||
{
|
||||
static TArticolo_conai* articolo_conai = nullptr;
|
||||
if (articolo_conai == nullptr)
|
||||
articolo_conai = new TArticolo_conai(_codice);
|
||||
|
||||
return *articolo_conai;
|
||||
}
|
||||
|
||||
TArticolo::TArticolo(const char* codice) : TMultiple_rectype(LF_ANAMAG)
|
||||
{
|
||||
add_file(LF_UMART,"NRIGA");
|
||||
@ -1870,16 +1879,14 @@ TArticolo_conai::TArticolo_conai(const TString& codart)
|
||||
{
|
||||
TLocalisamfile conart(LF_CONART);
|
||||
conart.put(CONART_CODART, _codart);
|
||||
if (conart.read(_isgteq) == NOERR)
|
||||
int err = conart.read(_isgteq);
|
||||
while (err == NOERR && _codart == conart.get(CONART_CODART))
|
||||
{
|
||||
while (_codart == conart.get(CONART_CODART))
|
||||
{
|
||||
const TString& categoria = conart.get(CONART_CATEGORIA);
|
||||
const TString& sottocat = conart.get(CONART_SOTTOCAT);
|
||||
const real& peso = conart.get_real(CONART_PESO);
|
||||
_catsotpes[categoria][sottocat] = peso;
|
||||
++conart;
|
||||
}
|
||||
const TString& categoria = conart.get(CONART_CATEGORIA);
|
||||
const TString& sottocat = conart.get(CONART_SOTTOCAT);
|
||||
const real& peso = conart.get_real(CONART_PESO);
|
||||
_catsotpes[categoria][sottocat] = peso;
|
||||
err = conart.next();
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user