From 0f528e971035e5e9b11f98f1e5e401a5172a7b1c Mon Sep 17 00:00:00 2001 From: DarioS Date: Sat, 28 Aug 2021 12:17:21 +0200 Subject: [PATCH] Integratione 2.3h1 : - gestione riferimento di posizionamento per pareti - gestione feature Variant. --- IntegrationEgaltech/BTL.cs | 18 ++++---- IntegrationEgaltech/Generator.cs | 46 ++++++++++++++++--- .../Properties/AssemblyInfo.cs | 4 +- 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/IntegrationEgaltech/BTL.cs b/IntegrationEgaltech/BTL.cs index a97d65f..7b2b9a8 100644 --- a/IntegrationEgaltech/BTL.cs +++ b/IntegrationEgaltech/BTL.cs @@ -13,17 +13,14 @@ namespace ib.essetre.integration.egaltech public class BTL { public string projectNumber ; + public int productionId ; + public int patternId ; public string barLength ; public string panelLength ; public string panelWidth ; public string barLoad90 ; + public int RefPos ; public List parts ; - // I seguenti Id servono per il nome del file BTL - public int productionId ; - public int patternId ; - public int projectId ; - public int elementId ; - public string fileName ; // Contatore entità di contorno libero private int _FcEnt ; @@ -57,6 +54,7 @@ namespace ib.essetre.integration.egaltech tw.WriteLine( Constants.USERATTRIBUTE + "\"BARLEN\":" + "\"" + barLength + "\"") ; tw.WriteLine( Constants.USERATTRIBUTE + "\"PANELLEN\":" + "\"" + panelLength + "\"") ; tw.WriteLine( Constants.USERATTRIBUTE + "\"PANELWIDTH\":" + "\"" + panelWidth + "\"") ; + tw.WriteLine( Constants.USERATTRIBUTE + "\"REFPOS\":" + "\"" + RefPos.ToString() + "\"") ; tw.WriteLine( Constants.USERATTRIBUTE + "\"PROJECT\":" + "\"" + ( IsFromProject ? "1" : "0") + "\"") ; foreach ( Part singlePart in parts) { @@ -131,8 +129,12 @@ namespace ib.essetre.integration.egaltech } // Altri processi else { + bool bIsVariant = singleFeature.processKey.Contains("-900-") ; // Tipo di Process - tw.WriteLine( Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation) ; + if ( bIsVariant) + tw.WriteLine( Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.processParameters[26]) ; + else + tw.WriteLine( Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation) ; // Eventuale sistema di riferimto WriteReference( singleFeature, tw) ; // Parametri standard del Process ( 1 .. 26) @@ -148,7 +150,7 @@ namespace ib.essetre.integration.egaltech // 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")) { + if ( ! singleParameter.Equals( "0") && ( ! bIsVariant || i != 1)) { singleParameter = singleParameter.Replace( ",", ".") ; tw.WriteLine( Constants.USERATTRIBUTE + "\"Q" + i.ToString( "D2") + "\":\"" + singleParameter + "\" ") ; } diff --git a/IntegrationEgaltech/Generator.cs b/IntegrationEgaltech/Generator.cs index 5855f64..3661dce 100644 --- a/IntegrationEgaltech/Generator.cs +++ b/IntegrationEgaltech/Generator.cs @@ -570,12 +570,13 @@ namespace ib.essetre.integration.egaltech DataRow dRow0 = dTab.Rows[0] ; btlObject.projectNumber = dRow0["projectId"].ToString() ; - btlObject.barLength = GetBarLengthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ; - btlObject.barLoad90 = GetBarLoad90P( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( CultureInfo.InvariantCulture) ; - btlObject.panelLength = GetBarLengthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ; - btlObject.panelWidth = GetBarWidthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ; btlObject.productionId = (int)dRow0["productionId"] ; btlObject.patternId = (int)dRow0["patternId"] ; + btlObject.barLength = GetBarLengthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ; + btlObject.panelLength = GetBarLengthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ; + btlObject.panelWidth = GetBarWidthP( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( "F3", CultureInfo.InvariantCulture) ; + btlObject.barLoad90 = GetBarLoad90P( (int)dRow0["patternId"], (int)dRow0["productionId"]).ToString( CultureInfo.InvariantCulture) ; + btlObject.RefPos = GetBarOriginP( (int)dRow0["patternId"], (int)dRow0["productionId"]) ; btlObject.parts = new List() ; List ListaCutParts = GetListaCutIdP() ; @@ -716,15 +717,14 @@ namespace ib.essetre.integration.egaltech DataRow dRow0 = dTab.Rows[0] ; btlObject.projectNumber = dRow0["projectId"].ToString() ; btlObject.barLength = GetBarLengthO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ; - btlObject.barLoad90 = "0" ; btlObject.panelLength = GetPanelLengthO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ; double dAngRot = (double)dRow0["rotated"] ; if ( Math.Abs( dAngRot - 90) < 0.1 || Math.Abs( dAngRot - 270) < 0.1) btlObject.panelWidth = GetPanelHeightO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ; else btlObject.panelWidth = GetPanelWidthO( (int)dRow0["elementId"], (int)dRow0["projectId"]).ToString( "F3", CultureInfo.InvariantCulture) ; - btlObject.projectId = (int)dRow0["projectId"] ; - btlObject.elementId = (int)dRow0["elementId"] ; + btlObject.barLoad90 = "0" ; + btlObject.RefPos = 1 ; btlObject.parts = new List() ; List ListaCutParts = new List( 1) ; @@ -1062,6 +1062,38 @@ namespace ib.essetre.integration.egaltech return nLoad90 ; } + //------------------------------------------------------------------------------------------------------------- + // Recupera l'indice dell'origine del pannello nel caso Produzione (colonna "RefPos") + private static int GetBarOriginP( int patternId, int productionId) + { + int nRefPos = 0 ; + + string sqlBarLength = "SELECT RefPos " + + "FROM dbo.vw_Pattern " + + "WHERE patternId = @firstId " + + "AND productionId = @secondId" ; + + // Connessione al DB ed esecuzione query + try { + using ( SqlConnection cn = new SqlConnection( _SqlConnectionStr)) { + cn.Open() ; + using ( SqlCommand sqlCommand = new SqlCommand( sqlBarLength, cn)) { + sqlCommand.Parameters.Add( "@firstId", SqlDbType.Int) ; + sqlCommand.Parameters.Add( "@secondId", SqlDbType.Int) ; + sqlCommand.Parameters["@firstId"].Value = patternId ; + sqlCommand.Parameters["@secondId"].Value = productionId ; + SqlDataReader reader = sqlCommand.ExecuteReader() ; + while ( reader.Read()) { + nRefPos = Convert.ToInt32( reader["RefPos"]) ; + } + } + } + } + catch {} + + return ( nRefPos + 1) ; + } + //------------------------------------------------------------------------------------------------------------- // Recupera lo stato della barra nel caso Produzione (colonna "state") private static int GetBarStateP( int patternId, int productionId) diff --git a/IntegrationEgaltech/Properties/AssemblyInfo.cs b/IntegrationEgaltech/Properties/AssemblyInfo.cs index 38e57a6..a7e914d 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.7.4")] -[assembly: AssemblyFileVersion("2.3.7.4")] +[assembly: AssemblyVersion("2.3.8.1")] +[assembly: AssemblyFileVersion("2.3.8.1")]