diff --git a/IntegrationEgaltech/BTL.cs b/IntegrationEgaltech/BTL.cs index 30dd9b4..c459924 100644 --- a/IntegrationEgaltech/BTL.cs +++ b/IntegrationEgaltech/BTL.cs @@ -80,10 +80,10 @@ namespace ib.essetre.integration.egaltech string posZ = singlePart.z.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ; tw.WriteLine( Constants.USERATTRIBUTE + "\"POSZ\":" + "\"" + posZ + "\"") ; - string inv = singlePart.inverted.ToString() ; + string inv = singlePart.inverted.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ; tw.WriteLine( Constants.USERATTRIBUTE + "\"INVERTED\":" + "\"" + inv + "\"") ; - string rot = singlePart.rotated.ToString() ; + string rot = singlePart.rotated.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ; tw.WriteLine( Constants.USERATTRIBUTE + "\"ROTATED\":" + "\"" + rot + "\"") ; string CutId = ( IsFromProject ? singlePart.elementId : singlePart.cutId).ToString() ; @@ -224,15 +224,15 @@ namespace ib.essetre.integration.egaltech } // se altrimenti FineArco else if ( flagArco) { + string[] PrevParts = arrParam[i - 1].Split(separators); tw.Write( ( bOutline ? Constants.OUTLINE_KEY : Constants.APERTURE_KEY)) ; tw.Write( Constants.SIDE + sSide + " ") ; tw.Write( Constants.PROCESS + singleFeature.process + " ") ; tw.Write( "P01:" + MultAndConvertTo8(parts[1]) + " "); // x (EndPoint Arc) tw.Write( "P02:" + MultAndConvertTo8(parts[2]) + " "); // y (EndPoint Arc) tw.Write( "P03:" + MultAndConvertTo8(parts[3]) + " "); // z (Endpoint Arc) - tw.Write( "P06:" + Constants.EIGHT_ZEROS + " "); + tw.Write( "P06:" + MultAndConvertTo8(PrevParts[5]) + " "); // side ang tw.Write( "P08:" + "00000200" + " "); - string[] PrevParts = arrParam[i - 1].Split(separators); tw.Write( "P10:" + MultAndConvertTo8(PrevParts[1]) + " "); // x (Point on Arc) tw.Write( "P11:" + MultAndConvertTo8(PrevParts[2]) + " "); // y (Point on Arc) tw.Write( "P12:" + MultAndConvertTo8(PrevParts[3]) + " "); // z (Point on Arc) @@ -241,13 +241,14 @@ namespace ib.essetre.integration.egaltech } // altrimenti FineSegmento else { + string[] PrevParts = arrParam[i - 1].Split(separators); tw.Write( ( bOutline ? Constants.OUTLINE_KEY : Constants.APERTURE_KEY)) ; tw.Write( Constants.SIDE + sSide + " ") ; tw.Write( Constants.PROCESS + singleFeature.process + " ") ; tw.Write( "P01:" + MultAndConvertTo8(parts[1]) + " "); // x tw.Write( "P02:" + MultAndConvertTo8(parts[2]) + " "); // y tw.Write( "P03:" + MultAndConvertTo8(parts[3]) + " "); // z - tw.Write( "P06:" + Constants.EIGHT_ZEROS + " "); + tw.Write( "P06:" + MultAndConvertTo8(PrevParts[5]) + " "); // side ang tw.Write( "P08:" + "00000100" + " "); tw.Write( "P10:" + Constants.EIGHT_ZEROS + " "); tw.Write( "P11:" + Constants.EIGHT_ZEROS + " "); @@ -334,20 +335,20 @@ namespace ib.essetre.integration.egaltech // se altrimenti FineArco else if ( flagArco) { ++ _FcEnt ; + string[] PrevParts = arrParam[i - 1].Split(separators); tw.WriteLine(Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation); tw.Write(Constants.PROCESS_PARAMETERS); tw.Write("P01:" + MultAndConvertTo8(parts[1]) + " "); // x (EndPoint Arc) tw.Write("P02:" + MultAndConvertTo8(parts[2]) + " "); // y (EndPoint Arc) tw.Write("P03:" + MultAndConvertTo8(parts[3]) + " "); // z (Endpoint Arc) tw.Write("P05:" + Constants.EIGHT_ZEROS + " "); - tw.Write("P06:" + Constants.EIGHT_ZEROS + " "); + tw.Write("P06:" + MultAndConvertTo8(PrevParts[5]) + " "); // side ang tw.Write("P07:" + Constants.EIGHT_ZEROS + " "); tw.Write("P08:" + "00000200" + " "); if ( i == arrParam.Length - 1) tw.Write("P09:" + Constants.EIGHT_ZEROS + " "); else tw.Write("P09:" + MultAndConvertTo8( (_FcEnt + 1).ToString()) + " "); - string[] PrevParts = arrParam[i - 1].Split(separators); tw.Write("P10:" + MultAndConvertTo8(PrevParts[1]) + " "); // x (Point on Arc) tw.Write("P11:" + MultAndConvertTo8(PrevParts[2]) + " "); // y (Point on Arc) tw.Write("P12:" + MultAndConvertTo8(PrevParts[3]) + " "); // z (Point on Arc) @@ -362,13 +363,14 @@ namespace ib.essetre.integration.egaltech // altrimenti FineSegmento else { ++ _FcEnt ; + string[] PrevParts = arrParam[i - 1].Split(separators); tw.WriteLine(Constants.PROCESS_KEY + singleFeature.processKey + " " + singleFeature.designation); tw.Write(Constants.PROCESS_PARAMETERS); tw.Write("P01:" + MultAndConvertTo8(parts[1]) + " "); // x tw.Write("P02:" + MultAndConvertTo8(parts[2]) + " "); // y tw.Write("P03:" + MultAndConvertTo8(parts[3]) + " "); // z tw.Write("P05:" + Constants.EIGHT_ZEROS + " "); - tw.Write("P06:" + Constants.EIGHT_ZEROS + " "); + tw.Write("P06:" + MultAndConvertTo8(PrevParts[5]) + " "); // side ang tw.Write("P07:" + Constants.EIGHT_ZEROS + " "); tw.Write("P08:" + "00000100" + " "); if ( i == arrParam.Length - 1) @@ -453,8 +455,8 @@ namespace ib.essetre.integration.egaltech public List features ; public double x ; public double z ; - public string inverted ; - public string rotated ; + public double inverted ; + public double rotated ; public int elementId ; public int cutId ; } diff --git a/IntegrationEgaltech/Generator.cs b/IntegrationEgaltech/Generator.cs index 8485093..ccc3b39 100644 --- a/IntegrationEgaltech/Generator.cs +++ b/IntegrationEgaltech/Generator.cs @@ -531,15 +531,15 @@ namespace ib.essetre.integration.egaltech continue ; if ( bFirst) { - readPart.singleMemberNumber = dRowF["cutId"].ToString() ; + readPart.singleMemberNumber = GetElementSN( (int)dRowF["elementId"], (int)dRowF["projectId"]) ; readPart.count = "1" ; readPart.length = dRowF["length"].ToString() ; readPart.height = dRowF["height"].ToString() ; readPart.width = dRowF["width"].ToString() ; readPart.x = (double)dRowF["x"] ; readPart.z = (double)dRowF["z"] ; - readPart.inverted = dRowF["inverted"].ToString() ; - readPart.rotated = dRowF["rotated"].ToString() ; + readPart.inverted = (double)dRowF["inverted"] ; + readPart.rotated = (double)dRowF["rotated"] ; readPart.cutId = (int)dRowF["cutId"] ; bFirst = false ; readPart.features = new List() ; @@ -671,15 +671,15 @@ namespace ib.essetre.integration.egaltech continue ; if ( bFirst) { - readPart.singleMemberNumber = dRowF["elementId"].ToString() ; + readPart.singleMemberNumber = GetElementSN( (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 = Constants.HeadOverMat ; - readPart.inverted = dRowF["inverted"].ToString() ; - readPart.rotated = dRowF["rotated"].ToString() ; + readPart.inverted = (double)dRowF["inverted"] ; + readPart.rotated = (double)dRowF["rotated"] ; readPart.elementId = (int)dRowF["elementId"] ; bFirst = false ; readPart.features = new List() ; @@ -781,6 +781,35 @@ namespace ib.essetre.integration.egaltech return ListaCutId ; } + //------------------------------------------------------------------------------------------------------------- + // Recupera il singlemembernumber dell'Elemento (colonna "sn") + private static string GetElementSN( int ElementId, int ProjectId) + { + string SN = "000" ; + + string sqlElementSN = "SELECT sn " + + "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()) { + SN = Convert.ToString( reader["sn"]) ; + } + } + } + + return SN ; + } + //------------------------------------------------------------------------------------------------------------- // Recupera la lunghezza della barra nel caso Produzione (colonna "l") private static double GetBarLengthP( int patternId, int productionId) diff --git a/IntegrationEgaltech/Properties/AssemblyInfo.cs b/IntegrationEgaltech/Properties/AssemblyInfo.cs index 3ca7bfc..b2d0a30 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.6.2")] -[assembly: AssemblyFileVersion("2.2.6.2")] +[assembly: AssemblyVersion("2.2.7.1")] +[assembly: AssemblyFileVersion("2.2.7.1")]