EgtMachKernel 2.2k4 :
- aggiunta gestione stringa di errore o avvertimento da PostApply delle lavorazioni e da SpecialApply delle disposizioni.
This commit is contained in:
+17
-11
@@ -1315,15 +1315,16 @@ Disposition::SpecialApply( bool bRecalc)
|
||||
|
||||
// costanti
|
||||
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
|
||||
static const string EVAR_TABNAME = ".TABNAME" ; // IN (string) nome della tavola macchina
|
||||
static const string EVAR_DISPID = ".DISPID" ; // IN (int) identificativo della disposizione
|
||||
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore, < 0 warning)
|
||||
static const string EVAR_TABNAME = ".TABNAME" ; // IN (string) nome della tavola macchina
|
||||
static const string EVAR_DISPID = ".DISPID" ; // IN (int) identificativo della disposizione
|
||||
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore, < 0 warning)
|
||||
static const string EVAR_MSG = ".MSG" ; // OUT (string) stringa di errore o warning ( opzionale)
|
||||
static const string EVAR_HEAD = ".HEAD" ; // OUT (string) nome della testa
|
||||
static const string EVAR_EXIT = ".EXIT" ; // OUT (int) indice dell'uscita
|
||||
static const string EVAR_EXIT = ".EXIT" ; // OUT (int) indice dell'uscita
|
||||
static const string EVAR_TCPOS = ".TCPOS" ; // OUT (string) nome della posizione nel TC
|
||||
static const string EVAR_SHIFTS = ".SHIFTS" ; // OUT (int) numero di movimenti eseguiti
|
||||
static const string EVAR_SBH = ".SBH" ; // OUT (bool) flag presenza operazioni manuali
|
||||
static const string EVAR_SHIFTS = ".SHIFTS" ; // OUT (int) numero di movimenti eseguiti
|
||||
static const string EVAR_SBH = ".SBH" ; // OUT (bool) flag presenza operazioni manuali
|
||||
|
||||
// eseguo l'azione
|
||||
bool bOk = true ;
|
||||
@@ -1344,20 +1345,25 @@ Disposition::SpecialApply( bool bRecalc)
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SHIFTS, m_nShifts) ;
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SBH, m_bSomeByHand) ;
|
||||
// recupero valori parametri opzionali
|
||||
if ( bOk)
|
||||
pMch->LuaGetGlobVar( EMC_VAR + EVAR_TCPOS, m_sTcPos) ;
|
||||
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_TCPOS, m_sTcPos) ;
|
||||
string sMsg ;
|
||||
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ;
|
||||
// reset
|
||||
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
|
||||
// segnalo errori ed esco
|
||||
if ( ! bOk || nErr > 0) {
|
||||
m_nShifts = - 1 ;
|
||||
string sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
|
||||
string sOut = sMsg ;
|
||||
if ( IsEmptyOrSpaces( sOut))
|
||||
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
|
||||
m_pMchMgr->SetLastError( 2006, sOut) ;
|
||||
return false ;
|
||||
}
|
||||
// recupero eventuale warning
|
||||
else if ( nErr < 0) {
|
||||
string sOut = " Warning in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
|
||||
string sOut = sMsg ;
|
||||
if ( IsEmptyOrSpaces( sOut))
|
||||
sOut = " Warning in " + ON_SPECIAL_APPLY + " (" + ToString( abs( nErr)) + ")" ;
|
||||
m_pMchMgr->SetWarning( 2053, sOut) ;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user