diff --git a/IntegrationEgaltech/Generator.cs b/IntegrationEgaltech/Generator.cs index bc401b7..11d631b 100644 --- a/IntegrationEgaltech/Generator.cs +++ b/IntegrationEgaltech/Generator.cs @@ -177,6 +177,31 @@ namespace ib.essetre.integration.egaltech //esegue EgtCAM5 in base ad alcuni parametri passati nella string path string percorsoDirBTL = parameters.Read("EGALTECH", "DIR_BTL", ""); string filePath = btlObject.writeIntoFile(parameters.Patterns[i].IsFromProject, percorsoDirBTL); + + //Lettura Iso e generazione file CN + string[] lines = System.IO.File.ReadAllLines("C:\\TechnoEssetre7\\Catalog\\Iso\\000003\\1.xpi"); // parameters.Patterns[i].OutputFilename); //"C:\\TechnoEssetre7\\Catalog\\Iso\\000003\\1.xpi" + string txtToXpi = filePath.Replace(".btl", ".txt"); + using (var txtWrite = new StreamWriter(txtToXpi, false)) + { + foreach (string line in lines) + { + txtWrite.WriteLine(line); + } + } + if (File.Exists(txtToXpi.Replace(".txt", ".xpi"))) + File.Delete(txtToXpi.Replace(".txt", ".xpi")); + File.Move(txtToXpi, Path.ChangeExtension(txtToXpi, ".xpi")); + //string fileCN = String.Format("{0}.xpi", txtToXpi); + + DateTime d1 = File.GetLastWriteTime(txtToXpi.Replace(".txt", ".xpi")); + DateTime d2 = File.GetLastWriteTime(filePath); + if (DateTime.Compare(d1, d2) >= 0){ + //Se la data modifica del file .xpi è più recente del BTL: OK, restuirlo alla stringa Iso, altrimenti niente, non restituirlo a Iso + parameters.Patterns[i].Iso = txtToXpi.Replace(".txt", ".xpi"); + } + + + string path = "\"" + filePath + "\" " + parameters.MachineName + " " + (int)parameters.UIMode + " " + parameters.Patterns[i].OutputFilename; Process process = Process.Start(percorsoExe, path); @@ -189,10 +214,18 @@ namespace ib.essetre.integration.egaltech System.Threading.Thread.Sleep(1000); } - //string text = System.IO.File.ReadAllText(filePath.Replace(".btl", ".txt")); - //parameters.Patterns[i].SetTaskState(btlObject.cutId, parameters.Patterns[i]. btlObject.features., PatternInfo.Results.ERROR, text); - //parameters.Patterns[i].GetTaskState(cutId, taskId, PatternInfo.Results, text); - //System.Windows.Forms.MessageBox.Show(text, "Error"); + int cutId = 1; + int taskId = 2; + string text = System.IO.File.ReadAllText(filePath.Replace(".btl", ".txt")); + if(text.Contains("ERR=0")) + parameters.Patterns[i].SetTaskState(cutId, taskId, PatternInfo.Results.OK, text); + else + parameters.Patterns[i].SetTaskState(cutId, taskId, PatternInfo.Results.ERROR, text); + + PatternInfo.Results res; + string msg; + parameters.Patterns[i].GetTaskState(cutId, taskId, out res, out msg); + System.Windows.Forms.MessageBox.Show(msg, res.ToString()); ////imposta le modifiche ////solo se parameters.Patterns[i].Transformable diff --git a/IntegrationEgaltech/Properties/AssemblyInfo.cs b/IntegrationEgaltech/Properties/AssemblyInfo.cs index 6329ef9..3e21774 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.1.2")] -[assembly: AssemblyFileVersion("2.1.1.2")] +[assembly: AssemblyVersion("2.1.1.3")] +[assembly: AssemblyFileVersion("2.1.1.3")]