Patch level : 4.0
Files correlati : ve2 Ricompilazione Demo : [ ] Commento : Gestione copia articoli con codice avanzato git-svn-id: svn://10.65.10.50/trunk@15489 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									c66817d1c4
								
							
						
					
					
						commit
						91063d6b20
					
				@ -1899,11 +1899,12 @@ bool TAnagrafica_magazzino::handle_copia(TMask_field &fld, KEY k)
 | 
				
			|||||||
  if (k == K_SPACE)
 | 
					  if (k == K_SPACE)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    TMask_anamag & m = (TMask_anamag &) fld.mask();
 | 
					    TMask_anamag & m = (TMask_anamag &) fld.mask();
 | 
				
			||||||
 | 
					    const TString oldart = m.get(F_CODART);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
    TString codart, descart;
 | 
					    TString codart, descart;
 | 
				
			||||||
    if (advanced_codart_enabled())
 | 
					    if (advanced_codart_enabled())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      codart = m.get(F_CODART);
 | 
					      codart = oldart;
 | 
				
			||||||
      if (!advanced_codart_ask(codart, descart))
 | 
					      if (!advanced_codart_ask(codart, descart))
 | 
				
			||||||
        codart.cut(0);
 | 
					        codart.cut(0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -1927,7 +1928,7 @@ bool TAnagrafica_magazzino::handle_copia(TMask_field &fld, KEY k)
 | 
				
			|||||||
        codart = ask.get(F_CODART);
 | 
					        codart = ask.get(F_CODART);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (codart.full())
 | 
					    if (codart.full() && codart != oldart)
 | 
				
			||||||
    {     
 | 
					    {     
 | 
				
			||||||
      if (descart.full())
 | 
					      if (descart.full())
 | 
				
			||||||
        m.set(F_DESCR, descart);
 | 
					        m.set(F_DESCR, descart);
 | 
				
			||||||
@ -1940,7 +1941,7 @@ bool TAnagrafica_magazzino::handle_copia(TMask_field &fld, KEY k)
 | 
				
			|||||||
      m.load_profile(0, FALSE);
 | 
					      m.load_profile(0, FALSE);
 | 
				
			||||||
          
 | 
					          
 | 
				
			||||||
      m.set_mode(MODE_INS);
 | 
					      m.set_mode(MODE_INS);
 | 
				
			||||||
      xvtil_statbar_set("Inserimento", TRUE);
 | 
					      xvtil_statbar_set(TR("Inserimento"), TRUE);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return TRUE;
 | 
					  return TRUE;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,9 +1,9 @@
 | 
				
			|||||||
#include "ve2400.h"
 | 
					#include "ve2400.h"
 | 
				
			||||||
#include "ve2401.h"
 | 
					#include "ve2401.h"
 | 
				
			||||||
 | 
					#include "../db/dblib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <automask.h>
 | 
					#include <automask.h>
 | 
				
			||||||
#include <diction.h>
 | 
					#include <diction.h>
 | 
				
			||||||
#include <recarray.h>
 | 
					 | 
				
			||||||
#include <recset.h>
 | 
					#include <recset.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////
 | 
				
			||||||
@ -12,7 +12,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const TString& root_code()
 | 
					const TString& root_code()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  static TString8 _root_code; // Solitamente lungo 3
 | 
					  static TString8 _root_code; // Solitamente lungo 3, ma stiamo larghi
 | 
				
			||||||
  if (_root_code.empty())
 | 
					  if (_root_code.empty())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    const TString query = "USE FSA SELECT B0=\"X\"";
 | 
					    const TString query = "USE FSA SELECT B0=\"X\"";
 | 
				
			||||||
@ -21,7 +21,6 @@ const TString& root_code()
 | 
				
			|||||||
      _root_code = set.get("CODTAB").as_string();
 | 
					      _root_code = set.get("CODTAB").as_string();
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      _root_code = "   "; // Evito riletture inutili
 | 
					      _root_code = "   "; // Evito riletture inutili
 | 
				
			||||||
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return _root_code;
 | 
					  return _root_code;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -37,12 +36,13 @@ static const TRectype& get_sublevel_info(const TString& code)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class TCodart_mask : public TAutomask
 | 
					class TCodart_mask : public TAutomask
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  static TString8 _restart; // Solitamente lungo 3
 | 
					  static TCodice_articolo _restart;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
					  virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
				
			||||||
 | 
					  void start_run();
 | 
				
			||||||
  void create_level(int level, const TString& subcode);
 | 
					  void create_level(int level, const TString& subcode);
 | 
				
			||||||
  void build_children();
 | 
					  bool build_children();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  bool restart() const { return _restart.full(); }
 | 
					  bool restart() const { return _restart.full(); }
 | 
				
			||||||
@ -51,31 +51,18 @@ public:
 | 
				
			|||||||
  TCodart_mask();
 | 
					  TCodart_mask();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TString8 TCodart_mask::_restart;
 | 
					TCodice_articolo TCodart_mask::_restart;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TCodart_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
					bool TCodart_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  switch (o.dlg())
 | 
					  switch (o.dlg())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
  case 101:
 | 
					  case 101:
 | 
				
			||||||
    if (e == fe_init && restart())
 | 
					    if (e == fe_modify && !o.empty())   // Se cambio il contenuto del primo livello ...
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      _restart.cut(o.size()); // Taglia alla lunghezza vera del campo
 | 
					 | 
				
			||||||
      o.set(_restart);
 | 
					 | 
				
			||||||
      _restart.cut(0);
 | 
					 | 
				
			||||||
      o.check(STARTING_CHECK);
 | 
					 | 
				
			||||||
      e = fe_modify;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (e == fe_modify)   // Se cambio il contenuto del primo livello ...
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      if (id2pos(102) < 0)
 | 
					 | 
				
			||||||
        build_children(); // Ricostruisco la maschera
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      _restart = o.get();
 | 
					      _restart = o.get();
 | 
				
			||||||
      stop_run(K_FORCE_CLOSE);
 | 
					      stop_run(K_FORCE_CLOSE);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
  default: 
 | 
					  default: 
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
@ -83,6 +70,39 @@ bool TCodart_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
 | 
				
			|||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TCodart_mask::start_run()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  first_focus(101);
 | 
				
			||||||
 | 
					  if (_restart.full())
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    const TString r(_restart);
 | 
				
			||||||
 | 
					    bool spegni101 = false;
 | 
				
			||||||
 | 
					    int from = 0;
 | 
				
			||||||
 | 
					    for (short id = 101; id2pos(id) >= 0; id++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      const int len = efield(id).size();
 | 
				
			||||||
 | 
					      const TString16 part = r.mid(from, len);
 | 
				
			||||||
 | 
					      if (part.not_empty())
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        set(id, part);
 | 
				
			||||||
 | 
					        from += len;
 | 
				
			||||||
 | 
					        if (id == 101)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          if (build_children())
 | 
				
			||||||
 | 
					            first_focus(102);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					          spegni101 = true;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    _restart.cut(0);
 | 
				
			||||||
 | 
					    enable(101, !spegni101);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  TAutomask::start_run();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TCodart_mask::create_level(int level, const TString& subcode)
 | 
					void TCodart_mask::create_level(int level, const TString& subcode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const TRectype& fsa = get_sublevel_info(subcode);
 | 
					  const TRectype& fsa = get_sublevel_info(subcode);
 | 
				
			||||||
@ -93,7 +113,7 @@ void TCodart_mask::create_level(int level, const TString& subcode)
 | 
				
			|||||||
    const TString& picture = fsa.get("S1");
 | 
					    const TString& picture = fsa.get("S1");
 | 
				
			||||||
    const int length = picture.len();
 | 
					    const int length = picture.len();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TEdit_field& kfld = add_string(100+level, 0, prompt, 1, level, length, "B");
 | 
					    TEdit_field& kfld = add_string(100+level, 0, prompt, 1, level, length, "BU");
 | 
				
			||||||
    TEdit_field& dfld = add_string(200+level, 0, "", 40, level, 36, "D");
 | 
					    TEdit_field& dfld = add_string(200+level, 0, "", 40, level, 36, "D");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TFilename tmp; tmp.temp();
 | 
					    TFilename tmp; tmp.temp();
 | 
				
			||||||
@ -124,7 +144,7 @@ void TCodart_mask::create_level(int level, const TString& subcode)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TCodart_mask::build_children()
 | 
					bool TCodart_mask::build_children()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TString8 code = root_code();
 | 
					  TString8 code = root_code();
 | 
				
			||||||
  code << get(101);
 | 
					  code << get(101);
 | 
				
			||||||
@ -141,6 +161,8 @@ void TCodart_mask::build_children()
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  force_update();
 | 
					  force_update();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return id2pos(102) > 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TCodart_mask::TCodart_mask() : TAutomask(TR("Articolo guidato"), 1, 78, 13)
 | 
					TCodart_mask::TCodart_mask() : TAutomask(TR("Articolo guidato"), 1, 78, 13)
 | 
				
			||||||
@ -156,11 +178,9 @@ bool advanced_codart_ask(TString& code, TString& desc)
 | 
				
			|||||||
  bool running = true;
 | 
					  bool running = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (code.full())
 | 
					  if (code.full())
 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    code.cut(4); // Taglio grossolano, poi la TCodart_mask tagliera' meglio
 | 
					 | 
				
			||||||
    TCodart_mask::restart_with(code);
 | 
					    TCodart_mask::restart_with(code);
 | 
				
			||||||
  code.cut(0);
 | 
					  code.cut(0);
 | 
				
			||||||
  }
 | 
					  desc.cut(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  while (running)
 | 
					  while (running)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -168,8 +188,6 @@ bool advanced_codart_ask(TString& code, TString& desc)
 | 
				
			|||||||
    ok = m.run() == K_ENTER;
 | 
					    ok = m.run() == K_ENTER;
 | 
				
			||||||
    if (ok)
 | 
					    if (ok)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      code.cut(0);
 | 
					 | 
				
			||||||
      desc.cut(0);
 | 
					 | 
				
			||||||
      for (short id = 101; m.id2pos(id) >= 0; id++)
 | 
					      for (short id = 101; m.id2pos(id) >= 0; id++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        code << m.get(id);
 | 
					        code << m.get(id);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user