- in BatchProcessNew gestito ritorno risultati in caso di errore e ritorno tempi

- in BeamExec resa non locale la funzione AddApplyResultToGlobalList
This commit is contained in:
Emmanuele Sassi
2025-11-26 16:47:09 +01:00
parent e3cd0d3033
commit 1c8049d9a9
2 changed files with 59 additions and 6 deletions
+56 -3
View File
@@ -300,6 +300,9 @@ if bToProcess then
BEAM.MSG = 'Error opening BWE file : ' .. BEAM.FILE
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
-- Faccio copia del file originale
@@ -320,6 +323,9 @@ if bToProcess then
BEAM.MSG = 'Error no Raw Parts in the file : ' .. BEAM.FILE
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
local b3Raw = EgtGetRawPartBBox( nRawId)
@@ -344,6 +350,9 @@ if bToProcess then
BEAM.MSG = 'Error no beams in the file : ' .. BEAM.FILE
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
else
local sOut = ''
@@ -362,6 +371,9 @@ if bToProcess then
BEAM.MSG = 'Box undefined for beam ' .. PARTS[i].sName
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
else
PARTS[i].b3PartOriginal = b3Solid
@@ -398,6 +410,9 @@ if bToProcess then
BEAM.ERR = 14
BEAM.MSG = 'Error : no beams in the project'
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
else
local sOut = ''
@@ -415,6 +430,9 @@ if bToProcess then
BEAM.ERR = 15
BEAM.MSG = 'Box undefined for beam ' .. PARTS[i].sName
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
else
PARTS[i].b3PartOriginal = b3Solid
@@ -471,6 +489,9 @@ if bToProcess then
BEAM.MSG = sOut
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
else
@@ -484,6 +505,9 @@ if bToProcess then
BEAM.MSG = sOut
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
end
@@ -497,6 +521,9 @@ if bToProcess then
BEAM.MSG = sOut
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
@@ -515,6 +542,9 @@ if bToProcess then
BEAM.MSG = sPbErr
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
else
-- Scrivo altezza e larghezza barra nel gruppo di lavoro corrente
@@ -623,6 +653,9 @@ if bToProcess then
BEAM.ERR = 0
BEAM.MSG = '---'
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
end
EgtOutLog( ' +++ BatchProcess completed')
return
@@ -639,6 +672,7 @@ if bToProcess then
EgtImportSetup()
-- Lavoro le features
-- TODO gestire errori e messaggi di ritorno in questo caso
if not GetDataConfig() then return end
-- creo un gruppo temporaneo dove finiranno tutte le entità che non bisogna salvare, alla fine lo si cancella
@@ -654,8 +688,6 @@ if bToProcess then
local sOutput = ''
-- Scrittura json risultati
WriteResultToJson( RESULT)
-- scrittura txt risultati
for i = 1, #RESULT do
local sMsg = ''
@@ -766,7 +798,12 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
sToolsList = sToolsList .. ", "
end
end
WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0)
BEAM.ERR = 19
BEAM.MSG = 'Error in setup: tool/s ' .. sToolsList .. ' not found'
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, 0, 0, 0)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
-- lancio simulazione
@@ -801,6 +838,10 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
end
end
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
-- TODO gestire collisione su feature specifica!!!!!!!!!!!!!!!!!!!!!!!!!!!!
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, BEAM.CUTID, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
end
@@ -820,6 +861,9 @@ if bIsGenerationEnabled and ( BEAM.FLAG == 0 or BEAM.FLAG == 4) then
BEAM.MSG = 'Error generating NC part program : ' .. sName
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
end
@@ -832,6 +876,9 @@ if not EgtEstimate( '', 'EgtCAM5 - ' .. sNgeFile) then
BEAM.MSG = 'Error estimating production time : ' .. sName
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
BeamExec.AddApplyResultToGlobalList( BEAM.ERR, 0, BEAM.MSG)
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot', 'd')
@@ -854,5 +901,11 @@ end
-- Scrittura tempo totale stimato di lavorazione
WriteTimeToLogFile( Ttot)
RESULT[#RESULT+1] = { dTime = Ttot, sType = 'Time'}
-- Riporto risultati in tabella globale BEAM
BEAM.RESULT = BeamLib.TableCopyDeep( RESULT)
-- Scrittura json risultati
WriteResultToJson( RESULT)
EgtOutLog( ' +++ BatchProcess completed')