Patch level : 10.0 67

Files correlati     :
Ricompilazione Demo : [ ]
Commento           :

RIportata la verione 3.2 1167


git-svn-id: svn://10.65.10.50/trunk@16722 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2008-06-11 10:58:17 +00:00
parent 9a3f75125c
commit 2030c1272c
11 changed files with 196 additions and 44 deletions

View File

@ -422,7 +422,7 @@ bool TMask_movmag::handle_codarticolo(TMask_field &f, KEY k)
mov_mask.curr_art().read(codart);
ok = handle_checksosp(f, k);
if (ok)
handle_righeprezzo2(f, k);
handle_righeprezzo1(f, k);
}
else
error_box(TR("Articolo assente"));

View File

@ -415,11 +415,13 @@ int TMov_mag::line_deleted(TToken_string &k, TLine_movmag &r)
void TMov_mag::mark_current_lines(const bool as_deleted)
{
const int nrows = rows(); // lasciare la riga qui perchè comporta il caricamento del body
_annoes =get(MOVMAG_ANNOES);
_datacomp=get_date(MOVMAG_DATACOMP);
_annoes = get(MOVMAG_ANNOES);
_datacomp = get_date(MOVMAG_DATACOMP);
lines_to_add.destroy();
lines_to_subtract.destroy();
/* Vecchio modo che si pianta se manca qualche riga
const int nrows = rows(); // lasciare la riga qui perchè comporta il caricamento del body
for (int i = 1; i<= nrows; i++)
{
if (as_deleted)
@ -427,6 +429,18 @@ void TMov_mag::mark_current_lines(const bool as_deleted)
else
line_inserted(line2key(i), line2data(i));
}
*/
const TRecord_array& b = body();
for (int i = b.last_row(); i > 0; i = b.pred_row(i))
{
TLine_movmag& data = line2data(i);
TToken_string& key = line2key(i);
if (as_deleted)
line_deleted(key, data);
else
line_inserted(key, data);
}
}
@ -451,7 +465,7 @@ bool TMov_mag::lock_anamag(const char *codart)
TString mess;
mess << TR("Il record di anagrafica dell'articolo '")<< codart << TR("' risulta essere già in uso.");
TTimed_breakbox bbox((const char *)mess,10);
TTimed_breakbox bbox(mess,10);
key = bbox.run();
}

View File

@ -129,10 +129,25 @@ TMRP_record::TMRP_record(const TMRP_time& t) : _time(t)
///////////////////////////////////////////////////////////
TArticolo_giacenza *TMRP_line::_articolo_giac = NULL;
// Stringa temporanea di lavoro
static TString16 _sub;
const TString& TMRP_line::codmag() const
{ return _sub = _codmag.left(3); }
const TString& TMRP_line::codmagaz_coll() const
{ return _sub = _codmag_coll.left(3); }
const TString& TMRP_line::coddep() const
{ return _sub = _codmag.mid(3); }
const TString& TMRP_line::coddep_coll() const
{ return _sub = _codmag_coll.mid(3); }
const TString& TMRP_line::livgiac(int l) const
{
const TCodgiac_livelli& lg = livelli_giacenza();
return _livgiac.mid(lg.code_start(l)-1, lg.code_length(l));
return _sub = _livgiac.mid(lg.code_start(l)-1, lg.code_length(l));
}
void TMRP_line::lotti_riordino(real& minimo, real& increm) const
@ -948,6 +963,7 @@ private:
bool gross2net_logic(TMRP_line &curr_article, int bucket, bool & sc_used);
bool load_gross_requirements();
bool load_planned_orders();
bool ciclica(TDistinta_tree& distinta);
bool explode_articles();
bool test_codnum(const TCodice_numerazione& num, const TString_array& a) const;
@ -1572,7 +1588,18 @@ void TMatResMask::select_orders(char type, const char * dacatmer,const char * ac
xvtil_statbar_set(msg);
}
static bool handle_interval(TMask_field &fld, KEY k)
{
if (fld.to_check(k, true))
{
TMatResMask & m = ((TMatResMask &)fld.mask());
const TDate & from = m.get_date(F_DADATA);
const TDate & to = m.get_date(F_ADATA);
m.calendar().set_highlight_interval(from, to);
}
return true;
}
TMatResMask::TMatResMask() : TCalendar_mask("mr2100a"), _sel_color(sfield(F_ORDINI))
{
@ -1598,6 +1625,12 @@ TMatResMask::TMatResMask() : TCalendar_mask("mr2100a"), _sel_color(sfield(F_ORDI
set(F_NOIMP, "X");
}
_nodist_pos =_sel_color.add_color_def("NODIST", TR("Art.pianificati senza distinta"), COLOR_YELLOW, COLOR_BLACK);
set_handler(F_DADATA, handle_interval);
set_handler(F_ADATA, handle_interval);
TCalendar_field & cf = (TCalendar_field &) field(F_CALENDAR);
cf.set_immediate_write();
}
///////////////////////////////////////////////////////////
@ -2117,6 +2150,14 @@ bool TMatResPlanning::load_gross_requirements()
/////////// finished: 100%
/////////// tested : 100%
static bool cyclic(TTree& tree, void* jolly, word flags)
{
TDistinta_tree & distinta = (TDistinta_tree &) tree;
return distinta.is_cyclic();
}
bool TMatResPlanning::explode_articles()
{
const TMatResMask& m = *_mask;
@ -2171,7 +2212,15 @@ bool TMatResPlanning::explode_articles()
if (distinta.set_root(line.articolo(), "", 1.0 , line.livgiac()))
{
line.set_final_product(FALSE);
distinta.explode(boom, FALSE, RAGGR_EXP_UMBASE, 1, "AV");
distinta.goto_root();
if (distinta.scan_depth_first(cyclic, NULL))
{
TToken_string & rdoc = (TToken_string &)line.da_rdoc_key();
error_box ("Ordine %s %d/%ld riga n. %d - Distinta %s ciclica", (const char *) rdoc.left(4), atoi(rdoc.mid(4, 4)), atoi(rdoc.mid(9, 7)), atoi(rdoc.mid(16)), (const char *) line.articolo());
continue;
}
distinta.explode(boom, FALSE, RAGGR_EXP_UMBASE, 1, "AV");
for (int i = 0; i < boom.items(); i++)
{
const TRiga_esplosione& riga = (const TRiga_esplosione&)boom[i];
@ -3643,3 +3692,4 @@ int mr2100(int argc, char* argv[])
a.run(argc, argv, TR("Material Requirements Planning"));
return 0;
}

View File

@ -131,10 +131,10 @@ public:
const TString& description() const { return _descr; }
const TString& da_rdoc_key() const { return _da_rdoc_key; }
const TString& codmag() const { return _codmag.left(3);}
const TString& codmagaz_coll() const { return _codmag_coll.left(3); }
const TString& coddep() const { return _codmag.mid(3); }
const TString& coddep_coll() const { return _codmag_coll.mid(3); }
const TString& codmag() const;
const TString& codmagaz_coll() const;
const TString& coddep() const;
const TString& coddep_coll() const;
const TString& livgiac(int l) const;
int explosion_depth() const { return _explosion_depth; }

View File

@ -531,16 +531,7 @@ bool TPlanning_mask::carica_documenti()
TDate datalim(date_fr);
const int days = days_per_bucket();
if (days < 7 )
datalim -= 7;
else
if (days < 31)
datalim.addmonth(-1);
else
if (days < 180)
datalim.addmonth(-3);
else
datalim -= days * 2;
datalim -= get_int(F_LIM);
TTable num("%NUM");
TCodice_numerazione cod;
@ -683,19 +674,20 @@ bool TPlanning_mask::carica_documenti()
{
if (skip)
{
const TRectype * doc = riga.find_original_doc();
if (doc != NULL)
const p = riga.get_long(RDOC_PRIORITY);
line = _constraints.find(cli, art, liv, imp, ignore_lin ? "" : lin, mag, magc, da_rdoc_key, false);
if ( line != NULL)
{
const int stato = doc->get_int(DOC_STATO);
if (test_status(*doc, tn) < 0)
if (p > line->priority())
line->priority(p);
else
continue;
}
else
continue;
}
line = _articles.find(cli, art, liv, imp, lin, mag, magc, da_rdoc_key, true);
line = _articles.find(cli, art, liv, imp, lin, mag, magc, da_rdoc_key, true);
}
if (line->description().blank())
@ -3827,6 +3819,24 @@ static bool handle_codice(TMask_field &fld, KEY k)
return true;
}
static bool handle_interval(TMask_field &fld, KEY k)
{
if (fld.to_check(k, true))
{
TPlanning_mask & m = ((TPlanning_mask &)fld.mask());
const TDate & from = m.get_date(F_DADATA);
TDate to(m.get_date(F_DADATA));
int days = m.days_per_bucket();
if (days < 7)
days = 7;
to += days;
m.calendar().set_highlight_interval(from, to);
}
return true;
}
void TPlanning_mask::create_browse1(TEdit_field& kfld, int level, short key_id, short des_id, const TCodart_livelli &cal)
{
TFilename tmp; tmp.temp();
@ -3932,6 +3942,9 @@ void TPlanning_mask::init()
create_codart_fields(10, 4, F_LIVART1, F_DESART1);
set_handler(F_CODART, handle_codice);
set_handler(F_DADATA, handle_interval);
set_handler(F_BUCKETS, handle_interval);
TConfig ini(CONFIG_DITTA, "mg");
if (!ini.get_bool("GESDEPOSITI"))
@ -3958,6 +3971,11 @@ void TPlanning_mask::init()
load_profile();
_npr_pos =_sel_color.add_color_def("PROP", TR("Nuove proposte"), COLOR_YELLOW, COLOR_BLACK);
TCalendar_field & cf = (TCalendar_field &) field(F_CALENDAR);
cf.set_immediate_write();
}

View File

@ -100,6 +100,7 @@
#define F_IGNORE_PREC 268
#define F_SINGLE_DOC 269
#define F_MSP_SORT_PRILIN 290
@ -136,6 +137,7 @@
#define F_NUMBERBYWEEK 271
#define F_DIVIDEBYART 273
#define F_DIVIDEBYDATE 272
#define F_LIM 274
#define F_YEAR 301
#define F_IMPIANTO 302

View File

@ -92,7 +92,7 @@ END
LIST F_BUCKETS 1 15
BEGIN
PROMPT 2 6 "Intervallo "
PROMPT 2 5 "Intervallo "
ITEM "1|1 Settimana"
MESSAGE SHOW,G_BUCKET_WEEK@|HIDE,G_BUCKET_DEF@|COPY,F_BUCKET|"7",F_DAYXBUCK
ITEM "2|2 Settimane"
@ -120,13 +120,13 @@ END
NUMBER H_BUCKET 2
BEGIN
PROMPT 41 6 "= "
PROMPT 41 5 "= "
FLAGS "D"
GROUP G_BUCKET_WEEK
END
NUMBER F_BUCKET 2
BEGIN
PROMPT 41 6 "= "
PROMPT 41 5 "= "
FLAGS "GU"
CHECKTYPE REQUIRED
MESSAGE COPY,H_BUCKET
@ -134,12 +134,16 @@ BEGIN
END
LIST F_DAYXBUCK 1 9
BEGIN
PROMPT 48 6 ""
PROMPT 48 5 ""
ITEM "1|giorni"
ITEM "7|settimane"
FLAGS "D"
GROUP G_BUCKET_WEEK
END
NUMBER F_LIM 2
BEGIN
PROMPT 2 6 "Gg.limite residui"
END
BOOL F_RESCHEDULING
BEGIN
PROMPT 2 9 "Permetti rescheduling"

View File

@ -879,8 +879,24 @@ void TMSP_constraint::fill_sheet_row(TToken_string& row, const TMask & m, const
}
}
if (userdesc.full())
{
const int p0 = val.find(__sep);
int p1 = val.find(',');
if (p1 >= 0 && val[p1 + 1] != ' ')
p1 = -1;
userdesc << ", ";
val.insert(userdesc);
if ((p0 >= 0) && (p1 > p0))
{
val = userdesc;
val << cache().get(LF_ANAMAG, articolo(), ANAMAG_DESCR);
if (da_rdoc_key.full())
val << '¦' << da_rdoc_key;
}
else
val.insert(userdesc);
}
}
row.add(val, F_DESCART-FIRST_FIELD);
row.add(codimp(),F_CODIMP-FIRST_FIELD);

View File

@ -724,12 +724,14 @@ class TCalendar_win : public TField_window
{
int _anno;
TMRP_calendar* _calendario;
bool _immediate_write;
protected:
virtual void handler(WINDOW win, EVENT* ep);
virtual void update();
public:
void set_immediate_write(bool on = true) { _immediate_write = on; }
void set_calendar(TMRP_calendar* cal, int year = 0);
TMRP_calendar* get_calendar() { return _calendario; }
@ -818,6 +820,8 @@ void TCalendar_win::handler(WINDOW win, EVENT* ep)
else
_calendario->suppress_holiday(d.day(), d.month());
}
if (_immediate_write)
_calendario->write();
owner().set_dirty();
force_update();
}
@ -855,6 +859,41 @@ void TCalendar_win::update()
_pixmap = true;
TMRP_calendar* defcal = NULL;
TMRP_calendar* cal = _calendario;
if (cal == NULL)
{
defcal = new TMRP_calendar();
cal = defcal;
}
if (cal->from().ok() || cal->to().ok())
{
TDate from = cal->from();
TDate to = cal->to();
if (from.year() < _anno)
from = TDate(1,1, _anno);
if (to.year() > _anno)
to = TDate(31, 12, _anno);
set_brush(FOCUS_BACK_COLOR);
hide_pen();
for (TDate d = from ; d <= to; ++d)
{
RCT rect;
rect.left = rct.right * (d.day() + 1) / 33;
rect.right = rct.right * (d.day() + 2) / 33;
rect.top = rct.bottom * d.month() / 13;
rect.bottom = rct.bottom * (d.month() + 1) / 13;
xvt_dwin_draw_rect(win(), &rect);
}
set_brush(NORMAL_BACK_COLOR);
}
TString16 str;
str << _anno;
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
@ -893,14 +932,6 @@ void TCalendar_win::update()
set_font();
}
TMRP_calendar* defcal = NULL;
TMRP_calendar* cal = _calendario;
if (cal == NULL)
{
defcal = new TMRP_calendar();
cal = defcal;
}
for (j = 1; j <= 12; j++)
{
const int y = rct.bottom * j / 13;
@ -964,6 +995,7 @@ TCalendar_win::TCalendar_win(int x, int y, int dx, int dy,
WINDOW parent, TWindowed_field* owner)
: TField_window(x, y, dx, dy, parent, owner)
{
_immediate_write = false;
xvt_sbar_set_range(win(), HSCROLL, 0, 0);
xvt_sbar_set_range(win(), VSCROLL, 0, 0);
set_calendar(NULL);
@ -973,6 +1005,14 @@ TCalendar_win::TCalendar_win(int x, int y, int dx, int dy,
// TCalendar_field
///////////////////////////////////////////////////////////
void TCalendar_field::set_immediate_write(bool on)
{
TCalendar_win& cw = (TCalendar_win&)win();
cw.set_immediate_write(on);
}
TField_window* TCalendar_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{
return new TCalendar_win(x, y, dx, dy, parent, this);

View File

@ -66,6 +66,9 @@ class TMRP_calendar : public TObject
TAssoc_array _exc_imp, _exc_lin;
TString8 _codimp, _codlin;
TDate _from;
TDate _to;
protected:
void init_default();
TString& turni_del_mese(char tipo, int year, int month) const;
@ -107,6 +110,9 @@ public:
const TString& linea() const { return _codlin; }
const TString& impianto() const { return _codimp; }
char tipo() const;
void set_highlight_interval(const TDate & from = botime, const TDate & to = botime) { _from = from; _to = to;}
const TDate & from() const { return _from; }
const TDate & to() const { return _to; }
TMRP_calendar(const char* linea = NULL, const char* impianto = NULL);
virtual ~TMRP_calendar() { }
@ -119,6 +125,8 @@ protected: // TWindowed_field
WINDOW parent);
public:
void set_calendar(TMRP_calendar* cal, int year = 0);
void set_immediate_write(bool on = true);
void reset_immediate_write() { set_immediate_write(false); }
TCalendar_field(TMask* m) : TWindowed_field(m) { }
virtual ~TCalendar_field() { }
@ -137,7 +145,7 @@ public:
// void save_profile();
// void load_profile();
const TMRP_calendar& calendar() const { return _calendar; }
const TMRP_calendar& calendar() const { return _calendar; }
void update_calendar(short calendar, short year, short plant = 0, short line = 0);
TCalendar_mask(const char* name, int num = 0);

View File

@ -200,7 +200,7 @@ void TGenera_ordini_mask::update_sheet()
row.add(recset.get(ANAMAG_GIORNIRIOR).as_string(), sf.cid2index(F_LEADTIME));
row.add(recset.get(ANAMAG_LOTTORIOR).as_string(), sf.cid2index(F_LOTTOMIN));
row.add(recset.get(ANAMAG_DESCRAGG).as_string(), sf.cid2index(F_DESCRAGG));
row.add(giac.stringa(), sf.cid2index(F_GIACENZA));
row.add(giac.string(), sf.cid2index(F_GIACENZA));
row.add(recset.get(ANAMAG_PPCONF).as_string(), sf.cid2index(F_PPCONF));
row.add(recset.get(ANAMAG_USER1).as_string(), sf.cid2index(F_USER1));
@ -405,7 +405,7 @@ void TCreazione_ordini::generate_orders(TGenera_ordini_mask & mask)
FOR_EACH_SHEET_ROW(sf, n, row)
{
const real qta(row->get(sf.cid2index(F_QTA)));
if (qta > ZERO)
if (qta != ZERO)
{
const TString16 codforn(row->get(sf.cid2index(F_FORNITORE)));
const long cod = atoi(codforn);