diff --git a/IntegrationEgaltech/Generator.cs b/IntegrationEgaltech/Generator.cs index b2de5ac..4bf6370 100644 --- a/IntegrationEgaltech/Generator.cs +++ b/IntegrationEgaltech/Generator.cs @@ -129,16 +129,36 @@ namespace ib.essetre.integration.egaltech BtlName = "Bar_" + pattInfo.ProductionId.ToString() + "_" + pattInfo.PatternId.ToString() + ".btl" ; // Path completa del nome del file da salvare string BtlPath = Path.Combine( BtlDir, BtlName) ; - btlObject.WriteIntoFile( BtlPath, pattInfo.IsFromProject) ; + bool BtlOk = btlObject.WriteIntoFile( BtlPath, pattInfo.IsFromProject) ; - // Esecuzione di EgtCAM5 con parametri path BTL, nome macchina e modo - string path = "\"" + BtlPath + "\" " + parameters.MachineName + " " + (int)parameters.UIMode ; - Process process = Process.Start( ExePath, path) ; + // Se scrittura Btl riuscita, lancio EgtCAM5 + if ( BtlOk) { + // Esecuzione di EgtCAM5 con parametri path BTL, nome macchina e modo + string path = "\"" + BtlPath + "\" " + parameters.MachineName + " " + (int)parameters.UIMode ; + Process process = Process.Start( ExePath, path) ; + // Attendo il termine del processo + while ( ! process.HasExited) { + process.Refresh() ; + System.Threading.Thread.Sleep( 50) ; + } + } - // Attendo il termine del processo - while ( ! process.HasExited) { - process.Refresh() ; - System.Threading.Thread.Sleep( 50) ; + // altrimenti scrivo direttamente il file di errore + else { + // scrivo il file + int ErrCutId = ( pattInfo.IsFromProject ? pattInfo.ElementId : pattInfo.PatternId) ; + using ( var tw = new StreamWriter( Path.ChangeExtension( BtlPath, ".txt"), false)) { + tw.WriteLine( "ERR=10") ; + tw.WriteLine( "CUTID=" + ErrCutId.ToString()) ; + tw.WriteLine( "TASKID=0") ; + tw.WriteLine( "BTL vuoto") ; + } + // elimino eventuale file Cn già presente + if ( parameters.UIMode == InOutParameters.UIModes.HIDDEN) { + string CncPath = Path.ChangeExtension( BtlPath, ".cnc") ; + if ( File.Exists( CncPath)) + File.Delete( CncPath) ; + } } // Recupero il risultato @@ -325,8 +345,10 @@ namespace ib.essetre.integration.egaltech { DataTable dTab = ds.Tables[0] ; int listaProcessesCount = dTab.Rows.Count ; - if ( listaProcessesCount == 0) + if ( listaProcessesCount == 0) { + btlObject.parts = null ; return ; + } DataRow dRow0 = dTab.Rows[0] ; btlObject.projectNumber = dRow0["projectId"].ToString() ; diff --git a/IntegrationEgaltech/Properties/AssemblyInfo.cs b/IntegrationEgaltech/Properties/AssemblyInfo.cs index 891bd36..d56d1b1 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.2.6")] -[assembly: AssemblyFileVersion("2.1.2.6")] +[assembly: AssemblyVersion("2.1.3.1")] +[assembly: AssemblyFileVersion("2.1.3.1")]