From 8d4212c92694d03be1f2dd0cd8ede267863d08f5 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 28 Apr 2025 16:49:11 +0200 Subject: [PATCH] - in BatchProcessNew piccola correzione alla scrittura log txt - Process modificata per essere coerente con la nuova restituzione risultati --- BatchProcessNew.lua | 2 +- Process.lua | 43 +++++++++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 8b91f5a..2ee203c 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -553,7 +553,7 @@ if bToProcess then nWarnCnt = nWarnCnt + 1 sOutput = sOutput .. string.format( '[%d,%d] %s\n', RESULT[i].idCut, RESULT[i].idTask, sMsg) BEAM.ERR = -19 - BEAM.MSG = 'Completion : ' .. Proc.nCompletionIndex .. '/5\n' .. sMsg + BEAM.MSG = 'Incomplete : Completion index ' .. RESULT[i].ChosenStrategy.nCompletionIndex .. '/5\n' .. sMsg BEAM.ROT = -( RESULT[i].nRotation or 1) + 1 BEAM.CUTID = RESULT[i].idCut BEAM.TASKID = RESULT[i].idTask diff --git a/Process.lua b/Process.lua index 0451a01..cd14639 100644 --- a/Process.lua +++ b/Process.lua @@ -301,21 +301,44 @@ end ------------------------------------------------------------------------------------------------------------- local function MyProcessFeatures() BeamExec.GetProcessings( PARTS) - local bOk, Stats = BeamExec.ProcessMachinings( PARTS) + BeamExec.ProcessMachinings( PARTS) local nErrCnt = 0 local nWarnCnt = 0 local sOutput = '' - for i = 1, #Stats do - if Stats[i].nErr > 0 then + for i = 1, #RESULT do + local sMsg = '' + if RESULT[i].sType == 'Feature' then + sMsg = RESULT[i].ChosenStrategy.sInfo + elseif RESULT[i].sType == 'Part' then + sMsg = RESULT[i].sMsg + end + sMsg = string.gsub( sMsg or '', '\n', ' ', 10) + sMsg = string.gsub( sMsg or '', '\r', ' ', 10) + -- trovata almeno una strategia e feature lavorata completamente + if RESULT[i].sType == 'Feature' and RESULT[i].ChosenStrategy.sStatus == 'Completed' then + -- nulla da segnalare + + -- trovata almeno una strategia ma nessuna applicabile oppure non trovata alcuna strategia + elseif RESULT[i].sType == 'Feature' + and ( ( RESULT[i].ChosenStrategy.sStatus == 'Not-Applicable') + or ( not RESULT[i].ChosenStrategy.sStrategyName)) then + nErrCnt = nErrCnt + 1 - sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].idCut, Stats[i].idTask, Stats[i].sMsg) - elseif Stats[i].nErr < 0 then - -- se segnalazione scarico pezzo standard, incompleto o a caduta - if Stats[i].nErr == -100 or Stats[i].nErr == -101 or Stats[i].nErr == -102 then - -- non faccio niente - else + if #sMsg == 0 then + sMsg = 'No applicable strategy found' + end + sOutput = sOutput .. string.format( '[%d,%d] %s\n', RESULT[i].idCut, RESULT[i].idTask, sMsg) + else + -- segnalazione scarico pezzo standard, incompleto o a caduta + if RESULT[i].sType == 'Part' and ( RESULT[i].nErr == -100 or RESULT[i].nErr == -101 or RESULT[i].nErr == -102) then + -- nulla da segnalare + + -- feature incompleta e altro + elseif RESULT[i].sType == 'Feature' and RESULT[i].ChosenStrategy.sStatus == 'Not-Completed' then nWarnCnt = nWarnCnt + 1 - sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].idCut, Stats[i].idTask, Stats[i].sMsg) + sMsg = 'Incomplete : Completion index ' .. RESULT[i].ChosenStrategy.nCompletionIndex .. '/5\n' .. sMsg + sOutput = sOutput .. string.format( '[%d,%d] %s\n', RESULT[i].idCut, RESULT[i].idTask, sMsg) + end end end