diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index e240285..3943243 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -1,4 +1,4 @@ --- BatchProcess.lua by Egaltech s.r.l. 2021/08/04 +-- BatchProcessNew.lua by Egaltech s.r.l. 2022/01/07 -- 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). @@ -7,6 +7,7 @@ -- 2021/02/25 Aggiunta gestione tipo scarico (standard, lav. incomplete, a caduta). -- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN. -- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste. +-- 2022/01/07 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo. -- Intestazioni require( 'EgtBase') @@ -195,7 +196,7 @@ if bToProcess then EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt) -- Aggiorno eventuali dati ausiliari - UpdateAuxData( sBtmFile) + --UpdateAuxData( sBtmFile) -- Se già presente un gruppo di lavoro if EgtGetFirstMachGroup() then @@ -520,27 +521,33 @@ else -- Dichiaro nessun errore local nPartId = EgtGetFirstPart() while nPartId do - local nCutId = EgtGetInfo( nPartId, 'CUTID', 'i') - if nCutId then - local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nPartId, 'Processings') or GDB_ID.NULL) - while nProcId do - local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC') - local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i') - if bIsFea and nTaskId then - BEAM.ERR = 0 - BEAM.MSG = '---' - BEAM.ROT = 0 - BEAM.CUTID = nCutId - BEAM.TASKID = nTaskId - WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) + local vDup = EgtDuploList( nPartId) + if not vDup or #vDup == 0 then + vDup = { nPartId} + end + for i = 1, #vDup do + local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i') + if nCutId then + local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL) + while nProcId do + local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC') + local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i') + if bIsFea and nTaskId then + BEAM.ERR = 0 + BEAM.MSG = '---' + BEAM.ROT = 0 + BEAM.CUTID = nCutId + BEAM.TASKID = nTaskId + WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) + end + nProcId = EgtGetNext( nProcId) end - nProcId = EgtGetNext( nProcId) end end nPartId = EgtGetNextPart( nPartId) end -- Aggiorno eventuali dati ausiliari - UpdateAuxData( sBtmFile) + --UpdateAuxData( sBtmFile) -- Passo in modalità lavora EgtSetCurrMachGroup( EgtGetLastMachGroup()) -- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni @@ -552,9 +559,6 @@ else EgtSaveFile( sNgeFile) -- copio come originale (per dichiarare progetto ricalcolato) EgtCopyFile( sNgeFile, sOriFile) - else - -- Salvo il progetto - EgtSaveFile( sNgeFile) end end