diff --git a/IntegrationEgaltech/Generator.cs b/IntegrationEgaltech/Generator.cs index 7f03471..38b2361 100644 --- a/IntegrationEgaltech/Generator.cs +++ b/IntegrationEgaltech/Generator.cs @@ -46,7 +46,7 @@ namespace ib.essetre.integration.egaltech _SqlConnectionStr = parameters.ConnectionString ; String ExePath = GetExePath( parameters) ; - String BtlDir = GetBtlDir( parameters) ; + String DataDir = GetDataDir( parameters) ; int numBars = parameters.Patterns.Length ; @@ -135,14 +135,8 @@ namespace ib.essetre.integration.egaltech } // Scrittura del file BTL - // Il nome del file cambia a seconda che si tratti del caso Produzione o caso Ordine - string BtlName ; - if ( pattInfo.IsFromProject) - BtlName = "Part_" + pattInfo.ProjectId.ToString() + "_" + pattInfo.ElementId.ToString() + ".btl" ; - else - BtlName = "Bar_" + pattInfo.ProductionId.ToString() + "_" + pattInfo.PatternId.ToString() + ".btl" ; // Path completa del nome del file da salvare - string BtlPath = Path.Combine( BtlDir, BtlName) ; + string BtlPath = GetBtlPath( DataDir, pattInfo) ; bool BtlOk = btlObject.WriteIntoFile( BtlPath, pattInfo.IsFromProject) ; // Se scrittura Btl riuscita, lancio EgtCAM5 @@ -663,18 +657,6 @@ namespace ib.essetre.integration.egaltech return parameters.Read( "EGALTECH", "PATH_EXE", "") ; } - //------------------------------------------------------------------------------------------------------------- - // Restituisce il direttorio per i file BTL - private static String GetBtlDir( InOutParameters parameters) - { - String BtlDir = parameters.Read( "EGALTECH", "DIR_BTL", "") ; - // Se la directory non esiste viene creata - DirectoryInfo di = new DirectoryInfo( BtlDir) ; - if ( ! di.Exists) - di.Create() ; - return BtlDir ; - } - //------------------------------------------------------------------------------------------------------------- // Restituisce il direttorio per i file con i dati macchina private static String GetDataDir( InOutParameters parameters) @@ -687,14 +669,37 @@ namespace ib.essetre.integration.egaltech return DataDir ; } + //------------------------------------------------------------------------------------------------------------- + // Restituisce la path completa per il file BTL + private static String GetBtlPath( String DataDir, PatternInfo pattInfo) + { + String BtlDir, BtlName ; + // Se progetto + if ( pattInfo.IsFromProject) { + BtlDir = Path.Combine( DataDir, "Projs", pattInfo.ProjectId.ToString( "D4")) ; + BtlName = "Part_" + pattInfo.ProjectId.ToString() + "_" + pattInfo.ElementId.ToString() + ".btl" ; + } + // altrimenti produzione + else { + BtlDir = Path.Combine( DataDir, "Prods", pattInfo.ProductionId.ToString( "D4")) ; + BtlName = "Bar_" + pattInfo.ProductionId.ToString() + "_" + pattInfo.PatternId.ToString() + ".btl" ; + } + // Se la directory non esiste viene creata + DirectoryInfo di = new DirectoryInfo( BtlDir) ; + if ( ! di.Exists) + di.Create() ; + // restituisco la path completa + return Path.Combine( BtlDir, BtlName) ; + } + //------------------------------------------------------------------------------------------------------------- // Visualizzazione finestra gestione DB utensili public bool ShowTools( InOutParameters parameters) { // Recupero dati string ExePath = GetExePath( parameters) ; - string BtlDir = GetBtlDir( parameters) ; - string BtlPath = Path.Combine( BtlDir, "QQQ.btl") ; + string DataDir = GetDataDir( parameters) ; + string BtlPath = Path.Combine( DataDir, "QQQ.btl") ; // Esecuzione di EgtCAM5 con parametri path BTL, nome macchina e modo Process process = new Process() ; process.StartInfo.FileName = ExePath ; @@ -715,8 +720,8 @@ namespace ib.essetre.integration.egaltech { // Recupero dati string ExePath = GetExePath( parameters) ; - string BtlDir = GetBtlDir( parameters) ; - string BtlPath = Path.Combine( BtlDir, "QQQ.btl") ; + string DataDir = GetDataDir( parameters) ; + string BtlPath = Path.Combine( DataDir, "QQQ.btl") ; // Esecuzione di EgtCAM5 con parametri path BTL, nome macchina e modo Process process = new Process() ; process.StartInfo.FileName = ExePath ; diff --git a/IntegrationEgaltech/Properties/AssemblyInfo.cs b/IntegrationEgaltech/Properties/AssemblyInfo.cs index b5b2505..c3ad92f 100644 --- a/IntegrationEgaltech/Properties/AssemblyInfo.cs +++ b/IntegrationEgaltech/Properties/AssemblyInfo.cs @@ -36,5 +36,5 @@ using System.Runtime.InteropServices; // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build // usando l'asterisco '*' come illustrato di seguito: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.10.7")] -[assembly: AssemblyFileVersion("2.1.10.7")] +[assembly: AssemblyVersion("2.1.11.2")] +[assembly: AssemblyFileVersion("2.1.11.2")]