diff --git a/IntegrationEgaltech/BTL.cs b/IntegrationEgaltech/BTL.cs index 7f6c39b..e8b7ab5 100644 --- a/IntegrationEgaltech/BTL.cs +++ b/IntegrationEgaltech/BTL.cs @@ -83,16 +83,18 @@ namespace ib.essetre.integration.egaltech tw.WriteLine( Constants.USERATTRIBUTE + "\"CUTID\":" + "\"" + CutId + "\"") ; foreach ( Feature singleFeature in singlePart.features) { - // Assegno identificativo del processo + // Assegno identificativo del processo string TaskId = ( IsFromProject ? singleFeature.processId : singleFeature.taskId).ToString() ; - // Se Contorno Libero (processo "250") elaborazione speciale + // Se Contorno Libero (processo "250") elaborazione speciale if ( singleFeature.processKey.Contains( "250")) { - FreeContourAnalyzer( singleFeature, TaskId, tw) ; + WriteFreeContour( singleFeature, TaskId, tw) ; } else { - // Tipo di Process + // Tipo di Process tw.WriteLine( Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation) ; - // Parametri standard del Process ( 1 .. 26) + // Eventuale sistema di riferimto + WriteReference( singleFeature, tw) ; + // Parametri standard del Process ( 1 .. 26) tw.Write( Constants.PROCESS_PARAMETERS) ; for ( int i = 1 ; i <= 26 ; ++ i) { string singleParameter = singleFeature.processParameters[i-1] ; @@ -102,7 +104,7 @@ namespace ib.essetre.integration.egaltech tw.Write( "P" + i.ToString( "D2") + ":" + "\"" + singleFeature.text + "\" ") ; } tw.WriteLine( "") ; - // Parametri speciali Q diversi da 0, preceduti da "USERATTRIBUTE:" + // Parametri speciali Q diversi da 0, preceduti da "USERATTRIBUTE:" for ( int i = 1 ; i <= 20 ; ++ i) { string singleParameter = singleFeature.processParameters[i+25] ; if ( ! singleParameter.Equals( "0")) { @@ -118,7 +120,7 @@ namespace ib.essetre.integration.egaltech } } - // Scrittura file ausiliario con dati che non fanno ricalcolare le lavorazioni + // Scrittura file ausiliario con dati che non fanno ricalcolare le lavorazioni using ( var tw = new StreamWriter( Path.ChangeExtension( BtlPath, ".btm"), false)) { tw.WriteLine( "[AuxData]") ; tw.WriteLine( "LOAD90=" + barLoad90) ; @@ -129,7 +131,7 @@ namespace ib.essetre.integration.egaltech // Il seguente metodo analizza il campo sag1 della singleFeature passata: se non è vuoto allora la stringa // viene splittata nei parametri P di POLY ed analizzata - public void FreeContourAnalyzer( Feature singleFeature, String TaskId, StreamWriter tw) + public void WriteFreeContour( Feature singleFeature, String TaskId, StreamWriter tw) { // Se non ci sono dati, esco if ( singleFeature.sag1 == "") @@ -162,6 +164,8 @@ namespace ib.essetre.integration.egaltech if ( i == 0) { ++ _FcEnt ; tw.WriteLine(Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation); + // Eventuale sistema di riferimto + WriteReference( singleFeature, tw) ; tw.Write(Constants.PROCESS_PARAMETERS); tw.Write("P01:" + MultAndConvertTo8(parts[1]) + " "); // x tw.Write("P02:" + MultAndConvertTo8(parts[2]) + " "); // y @@ -256,6 +260,44 @@ namespace ib.essetre.integration.egaltech } } + // Se definito, scrittura del riferimento + public void WriteReference( Feature singleFeature, StreamWriter tw) + { + // Verifico se definito e quindi da emettere + bool bToEmit = false ; + for ( int i = 1 ; i <= 9 ; ++ i) { + string singleParameter = singleFeature.processReference[i-1].Trim() ; + if ( ! singleParameter.Equals( "0")) { + bToEmit = true ; + break ; + } + } + // Se non definito esco + if ( ! bToEmit) + return ; + // Eseguo emissione + tw.Write( Constants.REFERENCE_PLANE) ; + string OX = singleFeature.processReference[0].Trim() ; + tw.Write( "OX:" + MultAndConvertTo8( OX) + " ") ; + string OY = singleFeature.processReference[1].Trim() ; + tw.Write( "OY:" + MultAndConvertTo8( OY) + " ") ; + string OZ = singleFeature.processReference[2].Trim() ; + tw.Write( "OZ:" + MultAndConvertTo8( OZ) + " ") ; + string XX = singleFeature.processReference[3].Trim() ; + tw.Write( "XX:" + MultAndConvertTo8( XX) + " ") ; + string XY = singleFeature.processReference[4].Trim() ; + tw.Write( "XY:" + MultAndConvertTo8( XY) + " ") ; + string XZ = singleFeature.processReference[5].Trim() ; + tw.Write( "XZ:" + MultAndConvertTo8( XZ) + " ") ; + string YX = singleFeature.processReference[6].Trim() ; + tw.Write( "YX:" + MultAndConvertTo8( YX) + " ") ; + string YY = singleFeature.processReference[7].Trim() ; + tw.Write( "YY:" + MultAndConvertTo8( YY) + " ") ; + string YZ = singleFeature.processReference[8].Trim() ; + tw.Write( "YZ:" + MultAndConvertTo8( YZ)) ; + tw.WriteLine( "") ; + } + // Il seguente metodo prende il valore di un Process Parameter, lo moltiplica per 10^scaleUnit // e lo converte in una stringa di 8 caratteri (i caratteri mancanti sono degli 0) public string MultAndConvertTo8( string processParameter) @@ -289,6 +331,7 @@ namespace ib.essetre.integration.egaltech public string processKey ; public string designation ; public List processParameters ; + public List processReference ; public string processIdent ; public string process ; public string sag1 ; diff --git a/IntegrationEgaltech/Constants.cs b/IntegrationEgaltech/Constants.cs index 9daabd3..bec1502 100644 --- a/IntegrationEgaltech/Constants.cs +++ b/IntegrationEgaltech/Constants.cs @@ -23,6 +23,7 @@ namespace ib.essetre.integration.egaltech public const string WIDTH = "WIDTH: " ; public const string PROCESS_KEY = "PROCESSKEY: " ; public const string PROCESS_PARAMETERS = "PROCESSPARAMETERS: " ; + public const string REFERENCE_PLANE = "REFERENCEPLANE: " ; public const string PROCESS_IDENT = "PROCESSIDENT: " ; public const string PROCESS = "PROCESS: " ; public const string COMMENT = "COMMENT: " ; diff --git a/IntegrationEgaltech/Generator.cs b/IntegrationEgaltech/Generator.cs index 8c7688f..dd66862 100644 --- a/IntegrationEgaltech/Generator.cs +++ b/IntegrationEgaltech/Generator.cs @@ -92,12 +92,13 @@ namespace ib.essetre.integration.egaltech "P.flagDeleted, P.[group], [key], face, edge, des, " + "p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, " + "q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, " + - "priority, processIdent, processingQuality, sag1, text, P.projectId, P.elementId, P.processId, 0 cutStart, 0 cutEnd, " + + "ox, oy, oz, xx, xy, xz, yx, yy, yz, " + + "priority, processIdent, processingQuality, sag1, text, E.projectId, E.elementId, P.processId, 0 cutStart, 0 cutEnd, " + "E.inverted, E.rotated, 0 doneTime, 0 startAngle, 0 endAngle, -1 referenceCutId, E.length, E.width, E.height " + "FROM dbo.vw_Process AS P " + "INNER JOIN dbo.vw_Element AS E " + "ON P.projectId=E.projectId AND P.elementId=E.elementId " + - "WHERE P.projectId = @firstId AND E.elementId = @secondId" ; + "WHERE E.projectId = @firstId AND E.elementId = @secondId" ; } else { sql = "SELECT vw_Task.productionId, " + @@ -106,12 +107,13 @@ namespace ib.essetre.integration.egaltech "vw_Task.flagDeleted, [group], [key], face, edge, des, " + "p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, " + "q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, " + - "priority, processIdent, processingQuality, sag1, text, projectId, elementId, cutStart, cutEnd, " + + "ox, oy, oz, xx, xy, xz, yx, yy, yz, " + + "priority, processIdent, processingQuality, sag1, text, vw_Cut.projectId, vw_Cut.elementId, cutStart, cutEnd, " + "inverted, rotated, doneTime, startAngle, endAngle, referenceCutId, length, width, height " + "FROM dbo.vw_Task " + "INNER JOIN vw_Cut " + "ON (vw_Task.cutId = vw_Cut.cutId AND vw_Task.patternId = vw_Cut.patternId AND vw_Task.productionId = vw_Cut.productionId) " + - "WHERE vw_Task.productionId = @firstId AND vw_Task.patternId = @secondId" ; + "WHERE vw_Cut.productionId = @firstId AND vw_Task.patternId = @secondId" ; } // Connessione al DB ed esecuzione query @@ -580,6 +582,17 @@ namespace ib.essetre.integration.egaltech dRowF["q19"].ToString(), dRowF["q20"].ToString() }, + processReference = new List( 9) { + dRowF["ox"].ToString(), + dRowF["oy"].ToString(), + dRowF["oz"].ToString(), + dRowF["xx"].ToString(), + dRowF["xy"].ToString(), + dRowF["xz"].ToString(), + dRowF["yx"].ToString(), + dRowF["yy"].ToString(), + dRowF["yz"].ToString() + }, } ; readPart.features.Add( readFeature) ; } @@ -706,6 +719,17 @@ namespace ib.essetre.integration.egaltech dRowF["q19"].ToString(), dRowF["q20"].ToString() }, + processReference = new List( 9) { + dRowF["ox"].ToString(), + dRowF["oy"].ToString(), + dRowF["oz"].ToString(), + dRowF["xx"].ToString(), + dRowF["xy"].ToString(), + dRowF["xz"].ToString(), + dRowF["yx"].ToString(), + dRowF["yy"].ToString(), + dRowF["yz"].ToString() + }, } ; readPart.features.Add( readFeature) ; } diff --git a/IntegrationEgaltech/Properties/AssemblyInfo.cs b/IntegrationEgaltech/Properties/AssemblyInfo.cs index 20a715a..12c80d2 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.2.1.5")] -[assembly: AssemblyFileVersion("2.2.1.5")] +[assembly: AssemblyVersion("2.2.2.1")] +[assembly: AssemblyFileVersion("2.2.2.1")]