EgtMachKernel 2.2k4 :
- aggiunta gestione stringa di errore o avvertimento da PostApply delle lavorazioni e da SpecialApply delle disposizioni.
This commit is contained in:
+18
-8
@@ -305,7 +305,7 @@ Machining::ToolPreview( int nEntId, int nFlag) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::PostApply( void)
|
||||
Machining::PostApply( string& sErr)
|
||||
{
|
||||
// recupero la macchina corrente
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
@@ -313,9 +313,10 @@ Machining::PostApply( void)
|
||||
return false ;
|
||||
// costanti
|
||||
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
|
||||
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
|
||||
static const string EVAR_MCHID = ".MCHID" ; // IN (int) identificativo della lavorazione
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
|
||||
static const string EVAR_MCHID = ".MCHID" ; // IN (int) identificativo della lavorazione
|
||||
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 ( opzionale)
|
||||
static const string ON_POST_APPLY = "OnPostApplyMachining" ;
|
||||
|
||||
// eseguo l'azione
|
||||
@@ -331,14 +332,23 @@ Machining::PostApply( void)
|
||||
// recupero valori parametri obbligatori
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
|
||||
// recupero valori parametri opzionali
|
||||
// ...
|
||||
string sMsg ;
|
||||
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ;
|
||||
// reset
|
||||
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
|
||||
// segnalo errori
|
||||
if ( nErr != 0) {
|
||||
if ( ! bOk || nErr > 0) {
|
||||
bOk = false ;
|
||||
string sOut = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
sErr = sMsg ;
|
||||
if ( IsEmptyOrSpaces( sErr))
|
||||
sErr = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
|
||||
}
|
||||
// recupero eventuale warning
|
||||
else if ( nErr < 0) {
|
||||
string sOut = sMsg ;
|
||||
if ( IsEmptyOrSpaces( sOut))
|
||||
sOut = " Warning in " + ON_POST_APPLY + " (" + ToString( abs( nErr)) + ")" ;
|
||||
m_pMchMgr->SetWarning( abs( nErr), sOut) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user