DataBeam :

- modifiche per gestione warnings per caduta pezzi
- modifiche per gestire ricalcolo per PF1250.
This commit is contained in:
Dario Sassi
2021-02-25 14:51:59 +00:00
parent c1032afc73
commit 26f428646a
3 changed files with 59 additions and 14 deletions
+28 -9
View File
@@ -1,4 +1,4 @@
-- BatchProcess.lua by Egaltech s.r.l. 2021/02/22
-- BatchProcess.lua by Egaltech s.r.l. 2021/02/25
-- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita.
@@ -19,6 +19,7 @@
-- 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/22 Aggiunto anche controllo su file macchina mlde per aggiornare calcoli.
-- 2021/02/25 Aggiunta gestione tipo scarico (standard, lav. incomplete, a caduta).
-- Intestazioni
require( 'EgtBase')
@@ -67,6 +68,14 @@ local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId)
hFile:write( 'TASKID=' .. tostring( nTaskId or 0) .. '\n')
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')
@@ -380,14 +389,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