diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index d9154e2..b3bf092 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ 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)