Corretta implosione disitinte (GF)
git-svn-id: svn://10.65.10.50/branches/R_10_00@23087 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6fa29e77d4
commit
46c3bbba19
@ -94,7 +94,7 @@ void TXmas_tree::add_branch(TDistinta_tree& dt)
|
||||
for (c = 1; ; c++)
|
||||
{
|
||||
child = find_child(art, c);
|
||||
if (child == NULL)
|
||||
if (child == NULL || child->empty())
|
||||
break;
|
||||
if (child->get("CODCOMP") != father)
|
||||
continue;
|
||||
|
@ -55,12 +55,12 @@ END
|
||||
|
||||
BOOLEAN F_ONLYONE
|
||||
BEGIN
|
||||
PROMPT 50 16 "Solo primo livello"
|
||||
PROMPT 52 16 "Solo primo livello"
|
||||
END
|
||||
|
||||
BOOLEAN F_DISPLAY_ZERO
|
||||
BEGIN
|
||||
PROMPT 2 17 "Visualizza le quantitá a zero"
|
||||
PROMPT 2 17 "Visualizza le quantitŕ a zero"
|
||||
END
|
||||
|
||||
BOOLEAN F_USECATMER
|
||||
|
38
db/dblib.cpp
38
db/dblib.cpp
@ -995,7 +995,7 @@ const TRectype* TDistinta_tree::find_child(const TCodice_articolo& father, int c
|
||||
bool TDistinta_tree::has_child_num(const TCodice_articolo& father, int child) const
|
||||
{
|
||||
const TRectype* rec = find_child(father, child);
|
||||
return rec != NULL && !rec->empty();
|
||||
return rec && !rec->empty();
|
||||
}
|
||||
|
||||
int TDistinta_tree::build_children_list(const TCodice_articolo& father, TArray& children) const
|
||||
@ -1024,6 +1024,16 @@ int TDistinta_tree::build_children_list(const TCodice_articolo& father, TArray&
|
||||
return total;
|
||||
}
|
||||
|
||||
bool TDistinta_tree::set_curr(const TCodice_articolo& key, int child) const
|
||||
{
|
||||
const TRectype* c = child > 0 ? find_child(key, child) : NULL;
|
||||
if (c != NULL)
|
||||
(TRectype&)_curr = *c;
|
||||
else
|
||||
((TRectype&)_curr).zero();
|
||||
return c != NULL;
|
||||
}
|
||||
|
||||
bool TDistinta_tree::has_son() const
|
||||
{
|
||||
if (_max_depth > 0)
|
||||
@ -1038,14 +1048,14 @@ bool TDistinta_tree::has_son() const
|
||||
|
||||
TCodice_articolo key; curr_code(key);
|
||||
// TString16 livgiac; curr_giaclev(livgiac);
|
||||
(TRectype&)_curr = *find_child(key, 1);
|
||||
set_curr(key, 1);
|
||||
// Se ci sono almeno due figli ed e' necessario ordinare
|
||||
if (_sort != 0 && has_child_num(key, 2))
|
||||
{
|
||||
TArray children;
|
||||
build_children_list(key, children);
|
||||
const int first = ((TToken_string*)children.objptr(0))->get_int(2);
|
||||
(TRectype&)_curr = *find_child(key, first);
|
||||
set_curr(key, first);
|
||||
}
|
||||
return !_curr.empty();
|
||||
}
|
||||
@ -1147,17 +1157,17 @@ bool TDistinta_tree::has_rbrother() const
|
||||
if (c >= 0 && c < last)
|
||||
{
|
||||
const int brother = ((TToken_string*)children.objptr(c+1))->get_int(2);
|
||||
(TRectype&)_curr = *find_child(father, brother);
|
||||
set_curr(father, brother);
|
||||
}
|
||||
else
|
||||
((TRectype&)_curr).zero();
|
||||
set_curr(father, -1);
|
||||
}
|
||||
else
|
||||
((TRectype&)_curr).zero();
|
||||
set_curr(father, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
(TRectype&)_curr = *find_child(father, curr_nrig+1);
|
||||
set_curr(father, curr_nrig+1);
|
||||
}
|
||||
|
||||
return !_curr.empty();
|
||||
@ -1191,8 +1201,7 @@ bool TDistinta_tree::has_lbrother() const
|
||||
const int last = build_children_list(father, children)-1;
|
||||
if (last > 0) // Ci sono almeno due fratelli
|
||||
{
|
||||
int c;
|
||||
|
||||
int c = 0;
|
||||
for (c = last; c > 0; c--)
|
||||
{
|
||||
const int nrig = ((TToken_string*)children.objptr(c))->get_int(2);
|
||||
@ -1202,21 +1211,18 @@ bool TDistinta_tree::has_lbrother() const
|
||||
if (c > 0)
|
||||
{
|
||||
const int brother = ((TToken_string*)children.objptr(c-1))->get_int(2);
|
||||
(TRectype&)_curr = *find_child(father, brother);
|
||||
set_curr(father, brother);
|
||||
}
|
||||
else
|
||||
((TRectype&)_curr).zero();
|
||||
set_curr(father, -1); // reset
|
||||
}
|
||||
else
|
||||
((TRectype&)_curr).zero();
|
||||
set_curr(father, -1); // reset
|
||||
}
|
||||
else
|
||||
{
|
||||
const int brother = curr_nrig - 1;
|
||||
if (brother > 0)
|
||||
(TRectype&)_curr = *find_child(father, brother);
|
||||
else
|
||||
((TRectype&)_curr).zero();
|
||||
set_curr(father, brother);
|
||||
}
|
||||
|
||||
return !_curr.empty();
|
||||
|
@ -212,6 +212,7 @@ enum TExplosion_grouping
|
||||
// _IMPIANTO : CODICE IMPIANTO
|
||||
|
||||
class TRiga_esplosione;
|
||||
|
||||
class TDistinta_tree : public TBidirectional_tree
|
||||
{
|
||||
TString _root;
|
||||
@ -239,6 +240,7 @@ private:
|
||||
|
||||
protected:
|
||||
bool isola_codice(TString& code) const;
|
||||
bool set_curr(const TCodice_articolo& key, int child) const;
|
||||
|
||||
bool add_child();
|
||||
void kill_child();
|
||||
|
Loading…
x
Reference in New Issue
Block a user