From cdd44e0f3e7a552890049f668ee2f94cea96da41 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 25 Jun 2021 15:37:25 +0200 Subject: [PATCH] Integration 2.3f4 : - nel BTL si scrive anche il tipo del pezzo (___, ELEMENT, LAYER). --- IntegrationEgaltech/BTL.cs | 3 ++ IntegrationEgaltech/Generator.cs | 33 ++++++++++++++++++- .../Properties/AssemblyInfo.cs | 4 +-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/IntegrationEgaltech/BTL.cs b/IntegrationEgaltech/BTL.cs index b9baa37..42170c7 100644 --- a/IntegrationEgaltech/BTL.cs +++ b/IntegrationEgaltech/BTL.cs @@ -87,6 +87,8 @@ namespace ib.essetre.integration.egaltech string rot = singlePart.rotated.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ; tw.WriteLine( Constants.USERATTRIBUTE + "\"ROTATED\":" + "\"" + rot + "\"") ; + tw.WriteLine( Constants.USERATTRIBUTE + "\"TYPE\":" + "\"" + singlePart.Type + "\"") ; + string CutId = ( IsFromProject ? singlePart.elementId : singlePart.cutId).ToString() ; tw.WriteLine( Constants.USERATTRIBUTE + "\"CUTID\":" + "\"" + CutId + "\"") ; @@ -480,6 +482,7 @@ namespace ib.essetre.integration.egaltech public string height ; public string width ; public string Material ; + public string Type ; public List features ; public double x ; public double z ; diff --git a/IntegrationEgaltech/Generator.cs b/IntegrationEgaltech/Generator.cs index 380bcb7..0e8df54 100644 --- a/IntegrationEgaltech/Generator.cs +++ b/IntegrationEgaltech/Generator.cs @@ -588,6 +588,7 @@ namespace ib.essetre.integration.egaltech if ( bFirst) { readPart.singleMemberNumber = GetElementSN( (int)dRowF["elementId"], (int)dRowF["projectId"]) ; readPart.Material = GetElementMaterial( (int)dRowF["elementId"], (int)dRowF["projectId"]) ; + readPart.Type = GetElementType( (int)dRowF["elementId"], (int)dRowF["projectId"]) ; readPart.count = "1" ; readPart.length = dRowF["length"].ToString() ; readPart.height = dRowF["height"].ToString() ; @@ -736,12 +737,13 @@ namespace ib.essetre.integration.egaltech if ( bFirst) { readPart.singleMemberNumber = GetElementSN( (int)dRow0["elementId"], (int)dRow0["projectId"]) ; readPart.Material = GetElementMaterial( (int)dRow0["elementId"], (int)dRow0["projectId"]) ; + readPart.Type = GetElementType( (int)dRow0["elementId"], (int)dRow0["projectId"]) ; readPart.count = "1" ; readPart.length = dRowF["length"].ToString() ; readPart.height = dRowF["height"].ToString() ; readPart.width = dRowF["width"].ToString() ; readPart.x = Constants.HeadOverMat ; - readPart.z = 0 ; // Constants.HeadOverMat ; + readPart.z = 0 ; readPart.inverted = (double)dRowF["inverted"] ; readPart.rotated = (double)dRowF["rotated"] ; readPart.elementId = (int)dRowF["elementId"] ; @@ -877,6 +879,35 @@ namespace ib.essetre.integration.egaltech return SN ; } + //------------------------------------------------------------------------------------------------------------- + // Recupera il Tipo dell'Elemento (colonna "Type") + private static string GetElementType( int ElementId, int ProjectId) + { + string Type = "" ; + + string sqlElementSN = "SELECT Type " + + "FROM dbo.vw_Element " + + "WHERE elementId = @firstId " + + "AND projectId = @secondId" ; + + // Connessione al DB ed esecuzione query + using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) { + cn.Open() ; + using ( SqlCommand sqlCommand = new SqlCommand( sqlElementSN, cn)) { + sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ; + sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ; + sqlCommand.Parameters["@firstId"].Value = ElementId ; + sqlCommand.Parameters["@secondId"].Value = ProjectId ; + SqlDataReader reader = sqlCommand.ExecuteReader() ; + while ( reader.Read()) { + Type = Convert.ToString( reader["Type"]) ; + } + } + } + + return Type ; + } + //------------------------------------------------------------------------------------------------------------- // Recupera il materiale dell'Elemento (colonna "MATERIAL" di ElementParam) private static string GetElementMaterial( int ElementId, int ProjectId) diff --git a/IntegrationEgaltech/Properties/AssemblyInfo.cs b/IntegrationEgaltech/Properties/AssemblyInfo.cs index d87602f..a131565 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.3.6.3")] -[assembly: AssemblyFileVersion("2.3.6.3")] +[assembly: AssemblyVersion("2.3.6.4")] +[assembly: AssemblyFileVersion("2.3.6.4")]