EgtMachKernel 2.7c3 :
- modifiche per poter costruire DB utensili e lavorazioni partendo da zero.
This commit is contained in:
Binary file not shown.
+2
-2
@@ -210,8 +210,8 @@ MachMgr::GetCurrMachiningsMgr( void) const
|
||||
// se DB lavorazioni non esiste, provo a crearlo e caricarlo
|
||||
if ( m_vMachines[m_nCurrMch].pMsMgr == nullptr) {
|
||||
PtrOwner<MachiningsMgr> pMsMgr( new( nothrow) MachiningsMgr) ;
|
||||
string sMachsFile = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR + "\\" + MACHININGS_FILE ;
|
||||
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsFile, GetCurrToolsMgr()))
|
||||
string sMachsDir = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR ;
|
||||
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsDir, MACHININGS_FILE, GetCurrToolsMgr()))
|
||||
return nullptr ;
|
||||
// salvo nel vettore
|
||||
const_cast<MachineData&>( m_vMachines[m_nCurrMch]).pMsMgr = Release( pMsMgr) ;
|
||||
|
||||
+15
-8
@@ -125,11 +125,12 @@ MachiningsMgr::Clear( bool bReset)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::Load( const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
MachiningsMgr::Load( const string& sMachsDir, const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
{
|
||||
// Salvo la path del file con i dati
|
||||
m_sMachsFile = sMachsFile ;
|
||||
string sOut = "MachiningsMgr Init : " + m_sMachsFile ;
|
||||
m_sMachsDir = sMachsDir ;
|
||||
m_sMachsPath = m_sMachsDir + "\\" + sMachsFile ;
|
||||
string sOut = "MachiningsMgr Init : " + m_sMachsPath ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
|
||||
// Verifico il gestore degli utensili
|
||||
@@ -158,9 +159,15 @@ MachiningsMgr::Reload( void)
|
||||
|
||||
// Inizializzo lo scanner
|
||||
Scanner TheScanner ;
|
||||
if ( ! TheScanner.Init( m_sMachsFile, ";")) {
|
||||
if ( ! TheScanner.Init( m_sMachsPath, ";")) {
|
||||
LOG_ERROR( GetEMkLogger(), "ReloadMachinings : Error on Init")
|
||||
return false ;
|
||||
if ( ExistsDirectory( m_sMachsDir) && ! ExistsFile( m_sMachsPath)) {
|
||||
m_nDbVer = MF_CURR_VER ;
|
||||
m_bModified = true ;
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
// variabili di stato della lettura
|
||||
@@ -399,17 +406,17 @@ MachiningsMgr::Save( bool bCompressed) const
|
||||
return true ;
|
||||
|
||||
// Faccio copia di backup del file originale
|
||||
CopyFileEgt( m_sMachsFile, m_sMachsFile + ".bak") ;
|
||||
CopyFileEgt( m_sMachsPath, m_sMachsPath + ".bak") ;
|
||||
|
||||
// Inizializzo il writer
|
||||
Writer TheWriter ;
|
||||
if ( ! TheWriter.Init( m_sMachsFile, bCompressed)) {
|
||||
if ( ! TheWriter.Init( m_sMachsPath, bCompressed)) {
|
||||
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Init")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Scrivo linea di inizio file
|
||||
string sOut = "; --- " + m_sMachsFile + " " + CurrDateTime() + " ---" ;
|
||||
string sOut = "; --- " + m_sMachsPath + " " + CurrDateTime() + " ---" ;
|
||||
if ( ! TheWriter.OutText( sOut)) {
|
||||
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Start")
|
||||
return false ;
|
||||
|
||||
+4
-3
@@ -27,7 +27,7 @@ class MachiningsMgr
|
||||
public :
|
||||
MachiningsMgr( void) ;
|
||||
~MachiningsMgr( void) ;
|
||||
bool Load( const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
|
||||
bool Load( const std::string& sMachsDir, const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
|
||||
bool Reload( void) ;
|
||||
bool Save( bool bCompressed = true) const ;
|
||||
bool GetMachiningNewName( std::string& sName) const ;
|
||||
@@ -108,8 +108,9 @@ class MachiningsMgr
|
||||
typedef STRUUID_MAP::const_iterator STRUUID_CITER ;
|
||||
|
||||
private :
|
||||
// path file lavorazioni
|
||||
std::string m_sMachsFile ;
|
||||
// dir e path file lavorazioni
|
||||
std::string m_sMachsDir ;
|
||||
std::string m_sMachsPath ;
|
||||
// flag di dati modificati
|
||||
mutable bool m_bModified ;
|
||||
// versione DB caricato
|
||||
|
||||
+6
-1
@@ -85,7 +85,12 @@ ToolsMgr::Reload( void)
|
||||
Scanner TheScanner ;
|
||||
if ( ! TheScanner.Init( m_sToolsPath, ";")) {
|
||||
LOG_ERROR( GetEMkLogger(), "ReloadTools : Error on Init")
|
||||
return false ;
|
||||
if ( ExistsDirectory( m_sToolsDir) && ! ExistsFile( m_sToolsPath)) {
|
||||
m_bModified = true ;
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
// variabili di stato della lettura
|
||||
|
||||
Reference in New Issue
Block a user