diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 0eb5351..be8bd23 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -1,9 +1,10 @@ --- BatchProcess.lua by Egaltech s.r.l. 2021/02/14 +-- BatchProcess.lua by Egaltech s.r.l. 2021/02/25 -- Gestione calcolo batch disposizione e lavorazioni per Travi -- 2021/01/07 Per nuova interfaccia Egt. -- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5). -- 2021/02/04 Se necessario ricalcolo allora si aggiorna anche l'attrezzaggio. -- 2021/02/14 Modifica per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2. +-- 2021/02/25 Aggiunta gestione tipo scarico (standard, lav. incomplete, a caduta). -- Intestazioni require( 'EgtBase') @@ -51,6 +52,15 @@ local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId) hFile:close() end +local function WriteFallToLogFile( nErr, sMsg, nCutId, nFall) + local hFile = io.open( sLogFile, 'a') + hFile:write( 'ERR=' .. tostring( nErr) .. '\n') + hFile:write( sMsg .. '\n') + hFile:write( 'CUTID=' .. tostring( nCutId or 0) .. '\n') + hFile:write( 'FALL=' .. tostring( nFall or 0) .. '\n') + hFile:close() +end + local function WriteTimeToLogFile( dTime) local hFile = io.open( sLogFile, 'a') hFile:write( 'TIME=' .. EgtNumToString( dTime) .. '\n') @@ -424,14 +434,24 @@ if bToProcess then BEAM.TASKID = Stats[i].TaskId WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) elseif Stats[i].Err < 0 then - nWarnCnt = nWarnCnt + 1 - sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg) - BEAM.ERR = -19 - BEAM.MSG = sMsg - BEAM.ROT = Stats[i].Rot or 0 - BEAM.CUTID = Stats[i].CutId - BEAM.TASKID = Stats[i].TaskId - WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) + -- se segnalazione scarico pezzo standard, incompleto o a caduta + if Stats[i].Err == -100 or Stats[i].Err == -101 or Stats[i].Err == -102 then + BEAM.ERR = 0 + BEAM.MSG = sMsg + BEAM.CUTID = Stats[i].CutId + BEAM.FALL = abs( Stats[i].Err + 100) + WriteFallToLogFile( BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL) + -- altri avvertimenti + else + nWarnCnt = nWarnCnt + 1 + sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg) + BEAM.ERR = -19 + BEAM.MSG = sMsg + BEAM.ROT = Stats[i].Rot or 0 + BEAM.CUTID = Stats[i].CutId + BEAM.TASKID = Stats[i].TaskId + WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) + end end end