From eeedb336034f24c17941c4b4c61fbc4018029ea3 Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 19 Apr 2021 15:06:38 +0200 Subject: [PATCH] EgtMachKernel 2.3d4 : - in MachMgr aggiunta funzione AdjustOperationPhase. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes MachMgr.h | 1 + MachMgrOperations.cpp | 29 +++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index d9154e24f2bc96be1953aa61c484d2b8c4d68069..b3bf09238fa9dd3fad97d0d408157736a03207c7 100644 GIT binary patch delta 97 zcmewt{V#gMFE&P#&A-`fnHfzcKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUI`BbWdH delta 97 zcmewt{V#gMFE&Qw&A-`fnHh~IKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUD-Bai?9 diff --git a/MachMgr.h b/MachMgr.h index 0bfddae..1bfd72e 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -255,6 +255,7 @@ class MachMgr : public IMachMgr bool SetOperationStatus( int nId, bool bShow) override ; bool GetOperationStatus( int nId, bool& bShow) const override ; bool SetAllOperationsStatus(bool bExceptFirstDisp, bool bShow) override ; + bool AdjustOperationPhase( int nMchId) override ; bool ChangeOperationPhase( int nMchId, int nNewPhase) override ; int GetPhaseLastOperation( int nPhase) const override ; bool RemoveOperationHome( int nId) override ; diff --git a/MachMgrOperations.cpp b/MachMgrOperations.cpp index a665ea9..e193f1e 100644 --- a/MachMgrOperations.cpp +++ b/MachMgrOperations.cpp @@ -477,6 +477,35 @@ MachMgr::SetAllOperationsStatus( bool bExceptFirstDisp, bool bShow) return true ; } +//---------------------------------------------------------------------------- +bool +MachMgr::AdjustOperationPhase( int nMchId) +{ + // l'operazione deve esistere e non essere una disposizione + int nType = GetOperationType( nMchId) ; + if ( nType == OPER_NULL || nType == OPER_DISP) + return false ; + // cerco l'ultima disposizione che la precede + int nCurrId = GetPrevOperation( nMchId) ; + while ( nCurrId != GDB_ID_NULL) { + if ( GetOperationType( nCurrId) == OPER_DISP) + break ; + nCurrId = GetPrevOperation( nCurrId) ; + } + if ( nCurrId == GDB_ID_NULL) + return false ; + // recupero la fase di questa disposizione e la assegno alla lavorazione + int nDispPhase = GetOperationPhase( nCurrId) ; + if ( nDispPhase == 0) + return false ; + // recupero la lavorazione + Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nMchId)) ; + if ( pMch == nullptr) + return false ; + // assegno nuova fase + return pMch->SetPhase( nDispPhase) ; +} + //---------------------------------------------------------------------------- bool MachMgr::ChangeOperationPhase( int nMchId, int nNewPhase)