From 854f883509443230cc0360ea45c7d8085dd52882 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 17 Nov 2021 14:48:25 +0200 Subject: RML EXTANSION- item 5745, 5909, 5823. DataBase changes: table Rubbing results , remove GS 100 min and GS 100 max and add GS 100, remove GS 200 min and GS 200 max and add GS 200. Created new table COLOR_PROCESS_INK_UPTAKE --- .../Tango.MachineStudio.ThreadExtensions.csproj | 1 + 1 file changed, 1 insertion(+) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj index 35123f9b1..fdcef6361 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj @@ -94,6 +94,7 @@ + -- cgit v1.3.1 From b88f12398df6b1d3126369a4016eceecdfa4dbc8 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 18 Nov 2021 11:27:19 +0200 Subject: 5818 RML EXTANSION- EXPORT EXCEL FILE --- .../Models/ThreadCharacteristicsExelModel.cs | 46 ++++++++ .../Tango.MachineStudio.ThreadExtensions.csproj | 2 + .../Templates/ExportRMLTemplate.xlsx | Bin 0 -> 21466 bytes .../ViewModels/MainViewVM.cs | 120 +++++++++++++++++++++ .../Views/ThreadCharacteristicsView.xaml | 18 ++-- 5 files changed, 180 insertions(+), 6 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs new file mode 100644 index 000000000..dc205b7f5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class ThreadCharacteristicsExelModel + { + public String ThreadName { get; set; } + public String Manufacturer { get; set; } + public String Brand { get; set; } + public String Country { get; set; } + public String EndUse { get; set; } + public String Applications { get; set; } + public String IndustrySector { get; set; } + public String Material { get; set; } + public String Type { get; set; } + public String SubFamily { get; set; } + public String Family { get; set; } + public String Group { get; set; } + public String Texturing { get; set; } + public String Geometry { get; set; } + public String Color { get; set; } + public String GlossLevel { get; set; } + public double LinearDensity { get; set; } + public String Unit { get; set; } + public int Plies { get; set; } + public int FilamentCountPerPlie { get; set; } + public int LinearDensityCount { get; set; } + public int CountDen { get; set; } + public String FiberCount  { get; set; } + public int Twist { get; set; } + public String TwistDirection { get; set; } + + //public Color R_Color { get; set; } + //public String R_Name { get; set; } + //public String R_Media { get; set; } + //public double R_Cyan { get; set; } + //public double R_Magenta { get; set; } + //public double R_Yellow { get; set; } + //public double R_Black { get; set; } + //public int R_Region { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj index fdcef6361..dde2df976 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj @@ -100,6 +100,7 @@ + @@ -199,6 +200,7 @@ SettingsSingleFileGenerator Settings.Designer.cs + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx new file mode 100644 index 000000000..7cd21386f Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs index 12ae1aa89..954500b60 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs @@ -28,6 +28,8 @@ using Tango.MachineStudio.ThreadExtensions.Views; using Tango.MachineStudio.ThreadExtensions.Models; using Tango.Settings; using System.Reflection; +using Tango.Core.Helpers; +using Tango.Documents; namespace Tango.MachineStudio.ThreadExtensions.ViewModels { @@ -312,6 +314,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels #region commands public RelayCommand SaveCommand { get; set; } + public RelayCommand ExportToFileCommand { get; set; } public RelayCommand ManageRmlExtensionCommand { get; set; } @@ -790,6 +793,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels BackToThreadExtensionViewsCommand = new RelayCommand(BackToThreadExtensionViews, () => IsFree); SaveCommand = new RelayCommand(Save, () => IsFree); + ExportToFileCommand = new RelayCommand(ExportRMLToExcel, () => IsFree); ManageRmlExtensionCommand = new RelayCommand(() => LoadActiveRMLExtension(SelectedRMLExtension.Guid), () => SelectedRMLExtension != null); @@ -1201,5 +1205,121 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels } #endregion + + #region Export / Import Excel + + public void ExportRMLToExcel() + { + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "Excel Documents|*.xlsx"; + if (dlg.ShowDialog().Value) + { + using (_notification.PushTaskItem("Exporting RML to file...")) + { + Task.Factory.StartNew(() => + { + try + { + IsFree = false; + + Stream stream = null; + bool dispose = false; + String file = AssemblyHelper.GetCurrentAssemblyFolder() + "\\Templates\\ExportRMLTemplate.xlsx"; + + if (File.Exists(file)) + { + stream = File.OpenRead(file); + dispose = true; + } + else + { + stream = EmbeddedResourceHelper.GetEmbeddedResourceStream("Tango.MachineStudio.ThreadExtensions.Templates.ExportRMLTemplate.xlsx"); + } + + byte[] data = new byte[stream.Length]; + stream.Read(data, 0, data.Length); + File.WriteAllBytes(dlg.FileName, data); + + if (dispose) + { + stream.Dispose(); + } + + ExcelWriter writer = new ExcelWriter(dlg.FileName); + //ActiveRMLExtension = await new RmlExtensionsBuilder(_active_context) + // .Set(guid) + // .WithUser() + // .BuildAsync(); + + //ActiveRML = new RmlBuilder(_active_context) + // .Set(SelectedRMLExtension.RMLGuid) + // .Build(); + + List threadCharacteristicsExelModels = new List(); + ThreadCharacteristicsExelModel model = new ThreadCharacteristicsExelModel(); + model.ThreadName = ActiveRML.Name; + model.Manufacturer = ActiveRML.Manufacturer == null? "": ActiveRML.Manufacturer; + model.Brand = ActiveRMLExtension.YarnBrand == null ? "": ActiveRMLExtension.YarnBrand.Name; + model.Country = ActiveRMLExtension.Country == null? "" : ActiveRMLExtension.Country; + model.EndUse = ActiveRML.MediaPurpose == null ? "" : ActiveRML.MediaPurpose.Name; + model.Applications = ActiveRMLExtension.YarnApplication == null ? "" : ActiveRMLExtension.YarnApplication.Name; + model.IndustrySector = ActiveRMLExtension.YarnIndustrysector == null ? "" : ActiveRMLExtension.YarnIndustrysector.Name; + model.Material = ActiveRML.MediaMaterial == null ? "" : ActiveRML.MediaMaterial.Name; + model.Type = ActiveRMLExtension.YarnType == null ? "" : ActiveRMLExtension.YarnType.Name; + model.SubFamily = ActiveRMLExtension.YarnSubFamily == null ? "" : ActiveRMLExtension.YarnSubFamily.Name; + model.Family = ActiveRMLExtension.YarnFamily == null ? "" : ActiveRMLExtension.YarnFamily.Name; + model.Group = ActiveRMLExtension.YarnGroup == null ? "" : ActiveRMLExtension.YarnGroup.Name; + model.Texturing = ActiveRMLExtension.YarnTexturing == null ? "" : ActiveRMLExtension.YarnTexturing.Name; + model.Geometry = ActiveRML.FiberShape == null ? "" : ActiveRML.FiberShape.Name; + model.Color = ActiveRMLExtension.YarnWhiteShade == null ? "" : ActiveRMLExtension.YarnWhiteShade.Name; + model.GlossLevel = ActiveRMLExtension.YarnGlossLevel == null ? "" : ActiveRMLExtension.YarnGlossLevel.Name; + model.LinearDensity = ActiveRML.FiberSize; + model.Unit = ActiveRML.LinearMassDensityUnit == null ? "" : ActiveRML.LinearMassDensityUnit.Name; + model.Plies = (int) ActiveRML.RMLPlies; + model.FilamentCountPerPlie = ActiveRML.PliesPerFiber; + model.LinearDensityCount = ActiveRML.DencityCount; + model.CountDen = ActiveRML.DencityCount; + model.FiberCount = ActiveRML.FiberCount; + model.Twist = ActiveRMLExtension.TwistTpm; + model.TwistDirection = ActiveRMLExtension.YarnTwistDirections.ToDescription(); + threadCharacteristicsExelModels.Add(model); + writer.WriteData(threadCharacteristicsExelModels, "Thread characteristics"); + //List groups = ActiveCatalog.ColorCatalogsGroups.Select(x => new ColorGroup() + //{ + // GroupColor = x.Color, + // GroupName = x.Name, + // GroupIndex = x.GroupIndex, + //}).ToList(); + + //writer.WriteData(groups, "Groups"); + + //ActiveRMLExtension. + + writer.Dispose(); + + InvokeUI(() => + { + _notification.ShowInfo("RML extensions exported successfully."); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error exporting RML extensions to {dlg.FileName}"); + + InvokeUI(() => + { + _notification.ShowError($"An error occurred while trying to export the RML extensions. Make sure the selected excel file is closed and data is valid.\n{ex.FlattenMessage()}"); + }); + } + finally + { + IsFree = true; + } + }); + } + } + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml index aeedcb6df..05ad00b72 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ThreadCharacteristicsView.xaml @@ -225,12 +225,18 @@ - + + + + + + + -- cgit v1.3.1 From 62d65c64a9a1e44aca6421ddc7a385a6d4b7361e Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 25 Nov 2021 10:17:16 +0200 Subject: #5818 -Export to Excel file --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Models/ColorParametrsExcelModel.cs | 59 ++++++++ .../Models/TestResultsExcelModel.cs | 123 +++++++++++++++++ .../Models/ThreadCharacteristicsExelModel.cs | 11 +- .../Tango.MachineStudio.ThreadExtensions.csproj | 2 + .../Templates/ExportRMLTemplate.xlsx | Bin 21466 -> 31132 bytes .../ViewModels/ColorParametersVewVM.cs | 98 +++++++++++++ .../ViewModels/MainViewVM.cs | 37 +++-- .../ViewModels/TestResultViewVM.cs | 132 +----------------- .../ViewModels/TestResultsViewVM.cs | 151 +++++++++++++++++++++ .../Views/TestResultsView.xaml | 32 ++--- 14 files changed, 479 insertions(+), 166 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorParametrsExcelModel.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/TestResultsExcelModel.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index b51f29e48..b9d976281 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 708f76de7..48c8b317b 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 0666670d6..9973b1888 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index a9a17bfb1..700f5da9f 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorParametrsExcelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorParametrsExcelModel.cs new file mode 100644 index 000000000..b762c1042 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorParametrsExcelModel.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class ColorParametrsExcelModel + { + public String Thread_name { get; set; } + public String MachineNumber { get; set; } + public double White_point_L { get; set; } + public double White_point_a { get; set; } + public double White_point_B { get; set; } + public double Factor_100__C { get; set; } + public double Factor_100__Cyan_L { get; set; } + public double Factor_100__Cyan_A { get; set; } + public double Factor_100__Cyan_B { get; set; } + public double Factor_100__M { get; set; } + public double Factor_100__Magenta_L { get; set; } + public double Factor_100__Magenta_A { get; set; } + public double Factor_100__Magenta_B { get; set; } + + public double Factor_100__Y { get; set; } + public double Factor_100__Yellow_L { get; set; } + public double Factor_100__Yellow_A { get; set; } + public double Factor_100__Yellow_B { get; set; } + public double Factor_100_K { get; set; } + public double Factor_100__Key_L { get; set; } + public double Factor_100__Key_A { get; set; } + public double Factor_100__Key_B { get; set; } + public double Factor_200_C { get; set; } + public double Factor_200__Cyan_L { get; set; } + public double Factor_200__Cyan_A { get; set; } + public double Factor_200__Cyan_B { get; set; } + + public double Factor_200__Magenta { get; set; } + public double Factor_200__Magenta_L { get; set; } + public double Factor_200__Magenta_A { get; set; } + public double Factor_200__Magenta_B { get; set; } + + public double Factor_200__Yellow { get; set; } + public double Factor_200__Yellow_L { get; set; } + public double Factor_200__Yellow_A { get; set; } + public double Factor_200__Yellow_B { get; set; } + + public double Factor_200__Key { get; set; } + public double Factor_200__Key_L { get; set; } + public double Factor_200__Key_A { get; set; } + public double Factor_200__Key_B { get; set; } + + public int Min_Ink_Uptake_Zone1 { get; set; } + public int Min_Ink_Uptake_Zone2 { get; set; } + public int Max_Ink_Uptake_Zone1 { get; set; } + public int Max_ink_uptake__Zone2 { get; set; } + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/TestResultsExcelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/TestResultsExcelModel.cs new file mode 100644 index 000000000..fbd142362 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/TestResultsExcelModel.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class TestResultsExcelModel + { + public String Thread_name_test_results { get; set; } + public String Machine_number { get; set; } + public String Test_results_name__tab { get; set; } + + public int Dryer_temp { get; set; } + public int Dryer_flow { get; set; } + public int Tunnel_temp { get; set; } + public int Tunnel_flow { get; set; } + + public String Tension_in_head { get; set; } + public String Tension_after_dryer { get; set; } + public String Tension_in_winder { get; set; } + public String BTSR { get; set; } + public String Puller_tension { get; set; } + public String Winder_tension { get; set; } + + public double Rubbing_K_100___DE { get; set; } + public double Rubbing_K_100___GS { get; set; } + public double Rubbing_K_200___DE { get; set; } + public double Rubbing_K_200___GS { get; set; } + public double Rubbing_C_100___DE { get; set; } + public double Rubbing_C_100___GS { get; set; } + public double Rubbing_C_200___DE { get; set; } + public double Rubbing_C_200___GS { get; set; } + public double Rubbing_Y_100___DE { get; set; } + public double Rubbing_Y_100___GS { get; set; } + public double Rubbing_Y_200___DE { get; set; } + public double Rubbing_Y_200___GS { get; set; } + public double Rubbing_M_100___DE { get; set; } + public double Rubbing_M_100___GS { get; set; } + public double Rubbing_M_200___DE { get; set; } + public double Rubbing_M_200___GS { get; set; } + + public String Color_REF { get; set; } + public double Load__N_REF { get; set; } + public double STDEV_REF { get; set; } + public double REF_Strain { get; set; } + public double STDEV_Strain_REF { get; set; } + + public String Color_100_C { get; set; } + public int C_color_100_C { get; set; } + public double Load_N_100_C { get; set; } + public double STDEV_100_C { get; set; } + public double Change_100_C { get; set; } + public double Strain_100_C { get; set; } + public double STDEV_100_C_2 { get; set; } + public double Change_100_C_2 { get; set; } + + public String Color_100_K { get; set; } + public int C_color_100_K { get; set; } + public double Load__N_100_K { get; set; } + public double STDEV_100_K { get; set; } + public double Change__100_K { get; set; } + public double Strain_100_K { get; set; } + public double STDEV_100_K_2 { get; set; } + public double Change_100_K_2 { get; set; } + + public String Color_200_C { get; set; } + public int C_color_200_C { get; set; } + public double Load__N_200_C { get; set; } + public double STDEV_200_C { get; set; } + public double Change_200_C { get; set; } + public double Strain_200_C { get; set; } + public double STDEV_200_C_2 { get; set; } + public double Change_200_C_2 { get; set; } + + public String Color_200_K { get; set; } + public int C_color_200_K { get; set; } + public double Load__N_200_K { get; set; } + public double STDEV_200_K { get; set; } + public double Change_200_K { get; set; } + public double Strain_200_K { get; set; } + public double STDEV_200_K_2 { get; set; } + public double Change_200_K_2 { get; set; } + + public String Uniformity_Zone_1 { get; set; } + public String Uniformity_Zone_2 { get; set; } + + public double COF_REF { get; set; } + public double CV_REF { get; set; } + public double COF_Black { get; set; } + public double CV_Black { get; set; } + //for twine inly + public double lub_amount { get; set; } + + public String Comments { get; set; } + public String Conclusion { get; set; } + + public TestResultsExcelModel() + { + Comments = Conclusion = ""; + Color_100_C = "Cyan"; + C_color_100_C = 100; + Load__N_100_K = STDEV_100_K = Change__100_K = Strain_100_K = STDEV_100_K_2 = Change_100_K_2 = 0.0; + + Color_200_C = "Cyan"; + C_color_200_C = 200; + Load__N_200_C = STDEV_200_C = Change_200_C = Strain_200_C = STDEV_200_C_2 = Change_200_C_2 = 0.0; + + Color_100_K = "Black"; + C_color_100_K = 100; + Load__N_100_K = STDEV_100_K = Change__100_K = Strain_100_K = STDEV_100_K_2 = Change_100_K_2 = 0.0; + + Color_200_K = "Black"; + C_color_200_K = 200; + Load__N_200_K = STDEV_200_K = Change_200_K = Strain_200_K = STDEV_200_K_2 = Change_200_K_2 = 0.0; + + Color_REF = "REF"; + Load__N_REF = STDEV_REF = REF_Strain = STDEV_Strain_REF = 0; + } + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs index dc205b7f5..1f894d70b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Tango.MachineStudio.ThreadExtensions.Models { - public class ThreadCharacteristicsExelModel + public class ThreadCharacteristicsExcelModel { public String ThreadName { get; set; } public String Manufacturer { get; set; } @@ -33,14 +33,5 @@ namespace Tango.MachineStudio.ThreadExtensions.Models public String FiberCount  { get; set; } public int Twist { get; set; } public String TwistDirection { get; set; } - - //public Color R_Color { get; set; } - //public String R_Name { get; set; } - //public String R_Media { get; set; } - //public double R_Cyan { get; set; } - //public double R_Magenta { get; set; } - //public double R_Yellow { get; set; } - //public double R_Black { get; set; } - //public int R_Region { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj index dde2df976..5199245a3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj @@ -96,10 +96,12 @@ + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx index 7cd21386f..e9bdd6151 100644 Binary files a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs index c60c65216..e13e016c5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs @@ -782,6 +782,104 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels } #endregion + + #region export to excel + + public void WritetoExcel(ColorParametrsExcelModel colorParametrsExcelModel, string machineGuid) + { + if (_active_context == null) + { + _active_context = ObservablesContext.CreateDefault(); + } + var colorProcessParametercur = _active_context.ColorProcessParameters.Where(x => x.RmlsExtensionsGuid == RMLExtemtionGUID && x.MachineGuid == machineGuid).FirstOrDefault(); + if (colorProcessParametercur == null) + return; + var colorProcessParameter = new ColorProcessParametersBuilder(_active_context).Set(colorProcessParametercur.Guid).WithColorProcessData().WithColorProcessFactor().WithColorProcessInkUptake().Build(); + var factor_cyan100 = colorProcessParameter.ColorProcessFactors.Where(x => x.FactorColor == FactorColors.CYAN && x.FactorPercent == 100).FirstOrDefault(); + if (factor_cyan100 != null) + { + colorParametrsExcelModel.Factor_100__C = factor_cyan100.InkNlCm; + colorParametrsExcelModel.Factor_100__Cyan_L = factor_cyan100.L; + colorParametrsExcelModel.Factor_100__Cyan_A = factor_cyan100.A; + colorParametrsExcelModel.Factor_100__Cyan_B = factor_cyan100.B; + } + + var factor_magenta100 = colorProcessParameter.ColorProcessFactors.Where(x => x.FactorColor == FactorColors.MAGENTA && x.FactorPercent == 100).FirstOrDefault(); + if (factor_magenta100 != null) + { + colorParametrsExcelModel.Factor_100__M = factor_magenta100.InkNlCm; + colorParametrsExcelModel.Factor_100__Magenta_L = factor_magenta100.L; + colorParametrsExcelModel.Factor_100__Magenta_A = factor_magenta100.A; + colorParametrsExcelModel.Factor_100__Magenta_B = factor_magenta100.B; + } + + var factor_yellow100 = colorProcessParameter.ColorProcessFactors.Where(x => x.FactorColor == FactorColors.YELLOW && x.FactorPercent == 100).FirstOrDefault(); + if (factor_yellow100 != null) + { + colorParametrsExcelModel.Factor_100__Y = factor_yellow100.InkNlCm; + colorParametrsExcelModel.Factor_100__Yellow_L = factor_yellow100.L; + colorParametrsExcelModel.Factor_100__Yellow_A = factor_yellow100.A; + colorParametrsExcelModel.Factor_100__Yellow_B = factor_yellow100.B; + } + + var factor_key100 = colorProcessParameter.ColorProcessFactors.Where(x => x.FactorColor == FactorColors.BLACK && x.FactorPercent == 100).FirstOrDefault(); + if (factor_key100 != null) + { + colorParametrsExcelModel.Factor_100_K = factor_key100.InkNlCm; + colorParametrsExcelModel.Factor_100__Key_L = factor_key100.L; + colorParametrsExcelModel.Factor_100__Key_A = factor_key100.A; + colorParametrsExcelModel.Factor_100__Key_B = factor_key100.B; + } + + var factor_cyan200 = colorProcessParameter.ColorProcessFactors.Where(x => x.FactorColor == FactorColors.CYAN && x.FactorPercent == 200).FirstOrDefault(); + if (factor_cyan200 != null) + { + colorParametrsExcelModel.Factor_200_C = factor_cyan200.InkNlCm; + colorParametrsExcelModel.Factor_200__Cyan_L = factor_cyan200.L; + colorParametrsExcelModel.Factor_200__Cyan_A = factor_cyan200.A; + colorParametrsExcelModel.Factor_200__Cyan_B = factor_cyan200.B; + } + + var factor_magenta200 = colorProcessParameter.ColorProcessFactors.Where(x => x.FactorColor == FactorColors.MAGENTA && x.FactorPercent == 200).FirstOrDefault(); + if (factor_magenta200 != null) + { + colorParametrsExcelModel.Factor_200__Magenta = factor_magenta200.InkNlCm; + colorParametrsExcelModel.Factor_200__Magenta_L = factor_magenta200.L; + colorParametrsExcelModel.Factor_200__Magenta_A = factor_magenta200.A; + colorParametrsExcelModel.Factor_200__Magenta_B = factor_magenta200.B; + } + + var factor_yellow200 = colorProcessParameter.ColorProcessFactors.Where(x => x.FactorColor == FactorColors.YELLOW && x.FactorPercent == 200).FirstOrDefault(); + if (factor_yellow200 != null) + { + colorParametrsExcelModel.Factor_200__Yellow = factor_yellow200.InkNlCm; + colorParametrsExcelModel.Factor_200__Yellow_L = factor_yellow200.L; + colorParametrsExcelModel.Factor_200__Yellow_A = factor_yellow200.A; + colorParametrsExcelModel.Factor_200__Yellow_B = factor_yellow200.B; + } + + var factor_key200 = colorProcessParameter.ColorProcessFactors.Where(x => x.FactorColor == FactorColors.BLACK && x.FactorPercent == 200).FirstOrDefault(); + if (factor_key200 != null) + { + colorParametrsExcelModel.Factor_200__Key = factor_key200.InkNlCm; + colorParametrsExcelModel.Factor_200__Key_L = factor_key200.L; + colorParametrsExcelModel.Factor_200__Key_A = factor_key200.A; + colorParametrsExcelModel.Factor_200__Key_B = factor_key200.B; + } + + foreach (var inkUptakeZone in colorProcessParameter.ColorProcessInkUptake) + { + if (inkUptakeZone.InkUptakeZoneType == InkUptakeZoneTypes.MININKUPTAKEZONE1) + colorParametrsExcelModel.Min_Ink_Uptake_Zone1 = (inkUptakeZone.InkValue == null) ? 0 : (int)inkUptakeZone.InkValue; + else if (inkUptakeZone.InkUptakeZoneType == InkUptakeZoneTypes.MININKUPTAKEZONE2) + colorParametrsExcelModel.Min_Ink_Uptake_Zone2 = (inkUptakeZone.InkValue == null) ? 0 : (int)inkUptakeZone.InkValue; + else if (inkUptakeZone.InkUptakeZoneType == InkUptakeZoneTypes.MAXINKUPTAKEZONE1) + colorParametrsExcelModel.Max_Ink_Uptake_Zone1 = (inkUptakeZone.InkValue == null) ? 0 : (int)inkUptakeZone.InkValue; + else if (inkUptakeZone.InkUptakeZoneType == InkUptakeZoneTypes.MAXINKUPTAKEZONE2) + colorParametrsExcelModel.Max_ink_uptake__Zone2 = (inkUptakeZone.InkValue == null) ? 0 : (int)inkUptakeZone.InkValue; + } + } + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs index 954500b60..6b95cf190 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs @@ -1255,8 +1255,8 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels // .Set(SelectedRMLExtension.RMLGuid) // .Build(); - List threadCharacteristicsExelModels = new List(); - ThreadCharacteristicsExelModel model = new ThreadCharacteristicsExelModel(); + List threadCharacteristicsExelModels = new List(); + ThreadCharacteristicsExcelModel model = new ThreadCharacteristicsExcelModel(); model.ThreadName = ActiveRML.Name; model.Manufacturer = ActiveRML.Manufacturer == null? "": ActiveRML.Manufacturer; model.Brand = ActiveRMLExtension.YarnBrand == null ? "": ActiveRMLExtension.YarnBrand.Name; @@ -1283,18 +1283,33 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels model.Twist = ActiveRMLExtension.TwistTpm; model.TwistDirection = ActiveRMLExtension.YarnTwistDirections.ToDescription(); threadCharacteristicsExelModels.Add(model); - writer.WriteData(threadCharacteristicsExelModels, "Thread characteristics"); - //List groups = ActiveCatalog.ColorCatalogsGroups.Select(x => new ColorGroup() - //{ - // GroupColor = x.Color, - // GroupName = x.Name, - // GroupIndex = x.GroupIndex, - //}).ToList(); + writer.WriteData(threadCharacteristicsExelModels, "Thread characteristics", 2); - //writer.WriteData(groups, "Groups"); + List colorParametrsExcelList = new List(); - //ActiveRMLExtension. + List testResultsExcelModelList = new List(); + foreach(var machine in Machines) + { + if (machine.HasRMLTest) + { + ColorParametrsExcelModel colorParametrsExcelModel = new ColorParametrsExcelModel(); + colorParametrsExcelModel.Thread_name = ActiveRML.Name; + colorParametrsExcelModel.MachineNumber = machine.SerialNumber; + colorParametrsExcelModel.White_point_L = ActiveRML.WhitePointL; + colorParametrsExcelModel.White_point_a = ActiveRML.WhitePointA; + colorParametrsExcelModel.White_point_B = ActiveRML.WhitePointB; + ColorParametersVewVM.WritetoExcel(colorParametrsExcelModel, machine.Guid); + + colorParametrsExcelList.Add(colorParametrsExcelModel); + + TestResultsViewVM.LoadTestResultsExcel(testResultsExcelModelList, machine.Guid, machine.SerialNumber); + } + + } + writer.WriteData(colorParametrsExcelList, "Color parameters",2); + writer.WriteData(testResultsExcelModelList, "Machine tests results", 2); + writer.Dispose(); InvokeUI(() => diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultViewVM.cs index 52182cdd7..41be789ed 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultViewVM.cs @@ -12,6 +12,7 @@ using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core.Commands; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.ThreadExtensions.Models; using Tango.SharedUI; namespace Tango.MachineStudio.ThreadExtensions.ViewModels @@ -63,139 +64,14 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels #endregion - public RelayCommand ExportToFileCommand { get; set; } + public TestResultViewVM(INotificationProvider notification, IActionLogManager actionLogManager) { _notification = notification; _actionLogManager = actionLogManager; - ExportToFileCommand = new RelayCommand(ExportToFile); - } - - #region save - // public void Save(ObservablesContext active_context) - //{ - // try - // { - // IsFree = false; - - // TestResult.LastUpdated = DateTime.UtcNow; - - // var RmlExtensionTestResultAfterChange = RmlExtensionTestResultDTO.FromObservable(TestResult); - - // active_context.SaveChanges(); - // } - // catch (Exception ex) - // { - // LogManager.Log(ex, "Could not update RmlExtension TestResult."); - // _notification.ShowError($"An error occurred while trying to save RmlExtension TestResult.\n{ex.Message}"); - // } - // finally - // { - // IsFree = true; - // } - //} - #endregion - - private void ExportToFile() - { - SaveFileDialog dlg = new SaveFileDialog(); - try - { - dlg.Title = $"Export excel calibration file for {TestResult.Name}"; - dlg.Filter = "Text Files|*.txt"; - dlg.DefaultExt = ".txt"; - dlg.FileName = $"RML_EXTENSION_{TestResult.Name}.txt"; - if (dlg.ShowDialog().Value) - { - using (StreamWriter outputFile = new StreamWriter(dlg.FileName)) - { - outputFile.WriteLine(String.Format($" {TestResult.Name.ToUpper()} ")); - outputFile.WriteLine(""); - outputFile.WriteLine(""); - outputFile.WriteLine(" Dryer temperature"); - outputFile.WriteLine(""); - outputFile.WriteLine(String.Format($" Dryer temperature : {TestResult.DryerTemperature.ToString()}")); - outputFile.WriteLine(String.Format($" Tunnel temperature : {TestResult.TunnelTemperature.ToString()}")); - outputFile.WriteLine(String.Format($" Tunnel flow : {TestResult.TunnelFlow.ToString()}")); - outputFile.WriteLine(String.Format($" Tunnel AVG temperature : {TestResult.TunnelAvgTemperature.ToString()}")); - outputFile.WriteLine(""); - outputFile.WriteLine(""); - outputFile.WriteLine(" Tension through the thread path"); - outputFile.WriteLine(""); - outputFile.WriteLine(String.Format($" Head : {TestResult.TensionHeadMin.ToString()} - {TestResult.TensionHeadMax.ToString()}")); - outputFile.WriteLine(String.Format($" After dryer : {TestResult.TensionAfterDryerMin.ToString()} - {TestResult.TensioinAfterDryerMax.ToString()}")); - outputFile.WriteLine(String.Format($" Winder : {TestResult.BtsrMin.ToString()} - {TestResult.BtsrMax.ToString()}")); - outputFile.WriteLine(String.Format($" BTSR : {TestResult.TensionHeadMin.ToString()} - {TestResult.TensionHeadMax.ToString()}")); - outputFile.WriteLine(String.Format($" Puller tension : {TestResult.PullerTensionMin.ToString()} - {TestResult.PullerTensionMax.ToString()}")); - outputFile.WriteLine(String.Format($" Winder exit tension: {TestResult.ExitTensionMin.ToString()} - {TestResult.ExitTensionMax.ToString()}")); - - outputFile.WriteLine(""); - outputFile.WriteLine(" Rubbing results"); - outputFile.WriteLine(""); - outputFile.WriteLine(" Color DeltaE CIE 100 % GS 100% DeltaETestResult CIE 200 % GS 200% "); - foreach (var rubbingResult in TestResult.RubbingResults) - { - StringBuilder sb = new StringBuilder(); - //sb.Append(" Color: "); - sb.Append($" { rubbingResult.TestResultColor.ToString()} "); - //sb.Append(" DeltaE CIE 100 % : "); - sb.Append($" { rubbingResult.DeltaeCie100.ToString()} "); - //sb.Append(" GS 100% : "); - sb.Append($" { rubbingResult.Gs100.ToString()} "); - //sb.Append(" DeltaE CIE 200 % : "); - sb.Append($" { rubbingResult.DeltaeCie200.ToString()} "); - //sb.Append(" GS 200% : "); - sb.Append($" { rubbingResult.Gs200.ToString()} "); - outputFile.WriteLine(sb); - } - outputFile.WriteLine(""); - outputFile.WriteLine(" Mechanical properties"); - outputFile.WriteLine(""); - outputFile.WriteLine(" %Color Color Load at Maximum Load(N) STDEV Percentage Strain at Maximum Load STDEV "); - foreach (var result in TestResult.TensileResults) - { - StringBuilder sb = new StringBuilder(); - //sb.Append(" % Color: "); - sb.Append($" { result.ColorPercent.ToString()}"); - //sb.Append(" Color : "); - sb.Append($" { result.TestResultColor.ToString()}"); - //sb.Append(" Load at Maximum Load(N) : "); - sb.Append($" { result.MaxLoad.ToString()}"); - //sb.Append(" STDEV : "); - sb.Append($" { result.StdevMaxLoad.ToString()}"); - //sb.Append(" Percentage Strain at Maximum Load: "); - sb.Append($" {result.StrainMaxLoad.ToString()}"); - //sb.Append(" STDEV : "); - sb.Append($" { result.StdevStrainMaxLoad.ToString()}"); - outputFile.WriteLine(sb); - } - outputFile.WriteLine(""); - outputFile.WriteLine(" Uniformity"); - outputFile.WriteLine(""); - outputFile.WriteLine(String.Format($" Zone1 : {TestResult.SeverityZone1Min.ToString()} - {TestResult.SeverityZone1Max.ToString()}")); - outputFile.WriteLine(String.Format($" Zone2 : {TestResult.SeverityZone2Min.ToString()} - {TestResult.SeverityZone2Max.ToString()}")); - outputFile.WriteLine(""); - outputFile.WriteLine(" COF"); - outputFile.WriteLine(""); - outputFile.WriteLine(" Thread name Lub Version COF Lub amount "); - outputFile.WriteLine(String.Format($" REF {TestResult.RefLubVersion} {TestResult.RefCof.ToString()} {TestResult.RefLub.ToString()}")); - outputFile.WriteLine(String.Format($" {ThreadName} {TestResult.ThreadLubVersion} {TestResult.ThreadCof.ToString()} {TestResult.ThreadLub.ToString()}")); - - outputFile.WriteLine(""); - outputFile.WriteLine(String.Format($" Comments: {TestResult.Comment}")); - outputFile.WriteLine(String.Format($" Conclusion: {TestResult.Conclusions}")); - outputFile.WriteLine(""); - outputFile.Flush(); - } - - } - } - catch (Exception ex) - { - LogManager.Log(ex, "Error exporting excel file " + dlg.FileName); - _notification.ShowError("An error occurred while trying to export the test result data."); - } } + + } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs index eea7eb9fc..f7823a77c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs @@ -402,5 +402,156 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels } #endregion + + public async void LoadTestResultsExcel(List testResultsExcelModelList, string machineGUID, string machineSerialNumber) + { + try + { + IsFree = false; + if (_active_context == null) + { + _active_context = ObservablesContext.CreateDefault(); + } + + using (_notification.PushTaskItem("Loading Test Results Parameters for save in Excel file ...")) + { + SynchronizedObservableCollection testResults = SelectedTestResults; + if (SelectedMachineGUID != machineGUID) + { + var loadedtestResults = await new RMLExtensionTestResultsCollectionBuilder(_active_context).SetAll().ForRMLExtension(RMLExtemtionGUID).ForMachine(machineGUID).WithRubbingAndTensileResults().BuildAsync(); + testResults = loadedtestResults.OrderBy(x => x.ResultIndex).ToSynchronizedObservableCollection(); + + } + foreach (var testresult in testResults) + { + TestResultsExcelModel testResultsExcelModel = new TestResultsExcelModel(); + testResultsExcelModel.Thread_name_test_results = ThreadName; + testResultsExcelModel.Machine_number = machineSerialNumber; + testResultsExcelModel.Test_results_name__tab = testresult.Name; + + testResultsExcelModel.Dryer_temp = testresult.DryerTemperature == null ? 0 : (int)testresult.DryerTemperature; + testResultsExcelModel.Dryer_flow = 0; + testResultsExcelModel.Tunnel_temp = testresult.TunnelTemperature == null ? 0 : (int)testresult.TunnelTemperature; + testResultsExcelModel.Tunnel_flow = testresult.TunnelFlow == null ? 0 : (int)testresult.TunnelFlow; + + testResultsExcelModel.Tension_in_head = testresult.TensionHeadMin == null ? "" : testresult.TensionHeadMin.ToString(); + testResultsExcelModel.Tension_after_dryer = testresult.TensionAfterDryerMin == null ? "" : testresult.TensionAfterDryerMin.ToString(); + testResultsExcelModel.Tension_in_winder = testresult.TensionWinderMin == null ? "" : testresult.TensionWinderMin.ToString(); + testResultsExcelModel.BTSR = testresult.BtsrMin == null ? "" : testresult.BtsrMin.ToString(); + testResultsExcelModel.Puller_tension = testresult.PullerTensionMin == null ? "" : testresult.PullerTensionMin.ToString(); + testResultsExcelModel.Winder_tension = testresult.ExitTensionMin == null ? "" : testresult.ExitTensionMin.ToString(); + + foreach( var tensileResult in testresult.TensileResults) + { + if(tensileResult.TestResultColor == TestResultColors.CYAN) + { + if(tensileResult.ColorPercent == 100) + { + testResultsExcelModel.Load_N_100_C = tensileResult.MaxLoad == null ? 0 : (double)tensileResult.MaxLoad; + testResultsExcelModel.STDEV_100_C = tensileResult.StdevMaxLoad == null ? 0 : (double)tensileResult.StdevMaxLoad; + testResultsExcelModel.Change_100_C = tensileResult.PercentChangeLoad == null ? 0 : (double)tensileResult.PercentChangeLoad; + testResultsExcelModel.Strain_100_C = tensileResult.StrainMaxLoad == null ? 0 : (double)tensileResult.StrainMaxLoad; + testResultsExcelModel.STDEV_100_C_2 = tensileResult.StdevStrainMaxLoad == null ? 0 : (double)tensileResult.StdevStrainMaxLoad; + testResultsExcelModel.Change_100_C_2 = tensileResult.PercentChangeStrain == null ? 0 : (double)tensileResult.PercentChangeStrain; + } + else if(tensileResult.ColorPercent == 200) + { + testResultsExcelModel.Load__N_200_C = tensileResult.MaxLoad == null ? 0 : (double)tensileResult.MaxLoad; + testResultsExcelModel.STDEV_200_C = tensileResult.StdevMaxLoad == null ? 0 : (double)tensileResult.StdevMaxLoad; + testResultsExcelModel.Change_200_C = tensileResult.PercentChangeLoad == null ? 0 : (double)tensileResult.PercentChangeLoad; + testResultsExcelModel.Strain_200_C = tensileResult.StrainMaxLoad == null ? 0 : (double)tensileResult.StrainMaxLoad; + testResultsExcelModel.STDEV_200_C_2 = tensileResult.StdevStrainMaxLoad == null ? 0 : (double)tensileResult.StdevStrainMaxLoad; + testResultsExcelModel.Change_200_C_2 = tensileResult.PercentChangeStrain == null ? 0 : (double)tensileResult.PercentChangeStrain; + } + } + else if(tensileResult.TestResultColor == TestResultColors.BLACK) + { + if (tensileResult.ColorPercent == 100) + { + testResultsExcelModel.Load__N_100_K = tensileResult.MaxLoad == null ? 0 : (double)tensileResult.MaxLoad; + testResultsExcelModel.STDEV_100_K = tensileResult.StdevMaxLoad == null ? 0 : (double)tensileResult.StdevMaxLoad; + testResultsExcelModel.Change__100_K = tensileResult.PercentChangeLoad == null ? 0 : (double)tensileResult.PercentChangeLoad; + testResultsExcelModel.Strain_100_K = tensileResult.StrainMaxLoad == null ? 0 : (double)tensileResult.StrainMaxLoad; + testResultsExcelModel.STDEV_100_K_2 = tensileResult.StdevStrainMaxLoad == null ? 0 : (double)tensileResult.StdevStrainMaxLoad; + testResultsExcelModel.Change_100_K_2 = tensileResult.PercentChangeStrain == null ? 0 : (double)tensileResult.PercentChangeStrain; + } + else if (tensileResult.ColorPercent == 200) + { + testResultsExcelModel.Load__N_200_K = tensileResult.MaxLoad == null ? 0 : (double)tensileResult.MaxLoad; + testResultsExcelModel.STDEV_200_K = tensileResult.StdevMaxLoad == null ? 0 : (double)tensileResult.StdevMaxLoad; + testResultsExcelModel.Change_200_K = tensileResult.PercentChangeLoad == null ? 0 : (double)tensileResult.PercentChangeLoad; + testResultsExcelModel.Strain_200_K = tensileResult.StrainMaxLoad == null ? 0 : (double)tensileResult.StrainMaxLoad; + testResultsExcelModel.STDEV_200_K_2 = tensileResult.StdevStrainMaxLoad == null ? 0 : (double)tensileResult.StdevStrainMaxLoad; + testResultsExcelModel.Change_200_K_2 = tensileResult.PercentChangeStrain == null ? 0 : (double)tensileResult.PercentChangeStrain; + } + + } + else if (tensileResult.IsWhiteColor) + { + testResultsExcelModel.Load__N_REF = tensileResult.MaxLoad == null ? 0 : (double)tensileResult.MaxLoad; + testResultsExcelModel.STDEV_REF = tensileResult.StdevMaxLoad == null ? 0 : (double)tensileResult.StdevMaxLoad; + testResultsExcelModel.REF_Strain = tensileResult.StdevStrainMaxLoad == null ? 0 : (double)tensileResult.StdevStrainMaxLoad; + testResultsExcelModel.STDEV_Strain_REF = tensileResult.PercentChangeStrain == null ? 0 : (double)tensileResult.PercentChangeStrain; + } + + } + + foreach (var rubbingresult in testresult.RubbingResults) + { + if (rubbingresult.TestResultColor == TestResultColors.CYAN) + { + testResultsExcelModel.Rubbing_C_100___DE = rubbingresult.DeltaeCie100 == null ? 0.0 : (double)rubbingresult.DeltaeCie100; + testResultsExcelModel.Rubbing_C_100___GS = rubbingresult.Gs100 == null ? 0.0 : (double)rubbingresult.Gs100; + testResultsExcelModel.Rubbing_C_200___DE = rubbingresult.DeltaeCie200 == null ? 0.0 : (double)rubbingresult.DeltaeCie200; + testResultsExcelModel.Rubbing_C_200___GS = rubbingresult.Gs200 == null ? 0.0 : (double)rubbingresult.Gs200; + } + else if (rubbingresult.TestResultColor == TestResultColors.MAGENTA) + { + testResultsExcelModel.Rubbing_M_100___DE = rubbingresult.DeltaeCie100 == null ? 0.0 : (double)rubbingresult.DeltaeCie100; + testResultsExcelModel.Rubbing_M_100___GS = rubbingresult.Gs100 == null ? 0.0 : (double)rubbingresult.Gs100; + testResultsExcelModel.Rubbing_M_200___DE = rubbingresult.DeltaeCie200 == null ? 0.0 : (double)rubbingresult.DeltaeCie200; + testResultsExcelModel.Rubbing_M_200___GS = rubbingresult.Gs200 == null ? 0.0 : (double)rubbingresult.Gs200; + } + else if (rubbingresult.TestResultColor == TestResultColors.YELLOW) + { + testResultsExcelModel.Rubbing_Y_100___DE = rubbingresult.DeltaeCie100 == null ? 0.0 : (double)rubbingresult.DeltaeCie100; + testResultsExcelModel.Rubbing_Y_100___GS = rubbingresult.Gs100 == null ? 0.0 : (double)rubbingresult.Gs100; + testResultsExcelModel.Rubbing_Y_200___DE = rubbingresult.DeltaeCie200 == null ? 0.0 : (double)rubbingresult.DeltaeCie200; + testResultsExcelModel.Rubbing_Y_200___GS = rubbingresult.Gs200 == null ? 0.0 : (double)rubbingresult.Gs200; + } + else if (rubbingresult.TestResultColor == TestResultColors.BLACK) + { + testResultsExcelModel.Rubbing_K_100___DE = rubbingresult.DeltaeCie100 == null ? 0.0 : (double)rubbingresult.DeltaeCie100; + testResultsExcelModel.Rubbing_K_100___GS = rubbingresult.Gs100 == null ? 0.0 : (double)rubbingresult.Gs100; + testResultsExcelModel.Rubbing_K_200___DE = rubbingresult.DeltaeCie200 == null ? 0.0 : (double)rubbingresult.DeltaeCie200; + testResultsExcelModel.Rubbing_K_200___GS = rubbingresult.Gs200 == null ? 0.0 : (double)rubbingresult.Gs200; + } + } + + testResultsExcelModel.Uniformity_Zone_1 = testresult.SeverityZone1Min == null ? "" : testresult.SeverityZone1Min.ToString() + "-" + testresult.SeverityZone1Max == null ? "" : testresult.SeverityZone1Max.ToString(); + testResultsExcelModel.Uniformity_Zone_2 = testresult.SeverityZone2Min == null ? "" : testresult.SeverityZone2Min.ToString() + "-" + testresult.SeverityZone2Max == null ? "" : testresult.SeverityZone2Max.ToString(); + + testResultsExcelModel.COF_REF = testresult.RefCof == null ? 0.0 : (double)testresult.RefCof; + testResultsExcelModel.CV_REF = 0.0; + testResultsExcelModel.COF_Black = testresult.ThreadCof == null ? 0.0 : (double)testresult.ThreadCof; + testResultsExcelModel.CV_Black = 0.0; + testResultsExcelModel.lub_amount = testresult.ThreadLub == null ? 0.0 : (double)testresult.ThreadLub; + + testResultsExcelModel.Comments = testresult.Comment; + testResultsExcelModel.Conclusion = testresult.Conclusions; + testResultsExcelModelList.Add(testResultsExcelModel); + } + } + IsFree = true; + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error loading TestResults for saving in Excel file.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml index 53ed5dc2c..17a68afb0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml @@ -267,16 +267,14 @@ - - - + Conclusion: - + Comments: - + @@ -414,8 +412,8 @@ - - - + @@ -424,8 +422,8 @@ - - - + @@ -434,8 +432,8 @@ - - - + @@ -444,8 +442,8 @@ - - - + @@ -454,8 +452,8 @@ - - - + @@ -464,8 +462,8 @@ - - - + -- cgit v1.3.1 From 56ee03aba6d6f27bccaf22be8160c4bb835e53ea Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 25 Nov 2021 18:47:54 +0200 Subject: Save RML Extensions parameters in excel file. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Excel/ColorDataExcelModel.cs | 39 +++++++ .../Excel/ColorParametrsExcelModel.cs | 59 ++++++++++ .../Excel/TestResultsExcelModel.cs | 123 +++++++++++++++++++++ .../Excel/ThreadCharacteristicsExelModel.cs | 37 +++++++ .../Models/ColorDataExcelModel.cs | 39 ------- .../Models/ColorParametrsExcelModel.cs | 59 ---------- .../Models/TestResultsExcelModel.cs | 123 --------------------- .../Models/ThreadCharacteristicsExelModel.cs | 37 ------- .../Tango.MachineStudio.ThreadExtensions.csproj | 8 +- .../Templates/ExportRMLTemplate.xlsx | Bin 31132 -> 25478 bytes .../ViewModels/MainViewVM.cs | 8 +- .../ViewModels/TestResultsViewVM.cs | 29 ++--- 16 files changed, 282 insertions(+), 279 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ColorDataExcelModel.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ColorParametrsExcelModel.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/TestResultsExcelModel.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ThreadCharacteristicsExelModel.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorDataExcelModel.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorParametrsExcelModel.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/TestResultsExcelModel.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index b9d976281..e51e300c5 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 48c8b317b..35386efd1 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 9973b1888..790e06a31 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 700f5da9f..f11de8f77 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ColorDataExcelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ColorDataExcelModel.cs new file mode 100644 index 000000000..da7471e16 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ColorDataExcelModel.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Documents; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class ColorDataExcelModel + { + public int NlCm { get; set; } + public double L { get; set; } + public double A { get; set; } + public double B { get; set; } + + public ColorDataExcelModel() + { + NlCm = 0; + L = A = B = 0.0; + } + + public static void GetDataFromFile(string fileName, out List items, ref string errors) + { + items = null; + try + { + using (ExcelReader reader = new ExcelReader(fileName)) + { + items = reader.GetDataByIndex("Sheet1", 1); + } + } + catch (Exception ex) + { + errors = ex.Message; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ColorParametrsExcelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ColorParametrsExcelModel.cs new file mode 100644 index 000000000..72e31b3d7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ColorParametrsExcelModel.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class ColorParametrsExcelModel + { + public String Thread_name { get; set; } + public String MachineNumber { get; set; } + public double White_point_L { get; set; } + public double White_point_a { get; set; } + public double White_point_B { get; set; } + public double Factor_100__C { get; set; } + public double Factor_100__Cyan_L { get; set; } + public double Factor_100__Cyan_A { get; set; } + public double Factor_100__Cyan_B { get; set; } + public double Factor_100__M { get; set; } + public double Factor_100__Magenta_L { get; set; } + public double Factor_100__Magenta_A { get; set; } + public double Factor_100__Magenta_B { get; set; } + + public double Factor_100__Y { get; set; } + public double Factor_100__Yellow_L { get; set; } + public double Factor_100__Yellow_A { get; set; } + public double Factor_100__Yellow_B { get; set; } + public double Factor_100_K { get; set; } + public double Factor_100__Key_L { get; set; } + public double Factor_100__Key_A { get; set; } + public double Factor_100__Key_B { get; set; } + public double Factor_200_C { get; set; } + public double Factor_200__Cyan_L { get; set; } + public double Factor_200__Cyan_A { get; set; } + public double Factor_200__Cyan_B { get; set; } + + public double Factor_200__Magenta { get; set; } + public double Factor_200__Magenta_L { get; set; } + public double Factor_200__Magenta_A { get; set; } + public double Factor_200__Magenta_B { get; set; } + + public double Factor_200__Yellow { get; set; } + public double Factor_200__Yellow_L { get; set; } + public double Factor_200__Yellow_A { get; set; } + public double Factor_200__Yellow_B { get; set; } + + public double Factor_200__Key { get; set; } + public double Factor_200__Key_L { get; set; } + public double Factor_200__Key_A { get; set; } + public double Factor_200__Key_B { get; set; } + + public int Min_Ink_Uptake_Zone1 { get; set; } + public int Min_Ink_Uptake_Zone2 { get; set; } + public int Max_Ink_Uptake_Zone1 { get; set; } + public int Max_ink_uptake__Zone2 { get; set; } + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/TestResultsExcelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/TestResultsExcelModel.cs new file mode 100644 index 000000000..58d48f62e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/TestResultsExcelModel.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class TestResultsExcelModel + { + public String Thread_name_test_results { get; set; } + public String Machine_number { get; set; } + public String Test_results_name__tab { get; set; } + + public int Dryer_temp { get; set; } + public int Dryer_flow { get; set; } + public int Tunnel_temp { get; set; } + public int Tunnel_flow { get; set; } + + public String Tension_in_head { get; set; } + public String Tension_after_dryer { get; set; } + public String Tension_in_winder { get; set; } + public String BTSR { get; set; } + public String Puller_tension { get; set; } + public String Winder_tension { get; set; } + + public double Rubbing_K_100___DE { get; set; } + public double Rubbing_K_100___GS { get; set; } + public double Rubbing_K_200___DE { get; set; } + public double Rubbing_K_200___GS { get; set; } + public double Rubbing_C_100___DE { get; set; } + public double Rubbing_C_100___GS { get; set; } + public double Rubbing_C_200___DE { get; set; } + public double Rubbing_C_200___GS { get; set; } + public double Rubbing_Y_100___DE { get; set; } + public double Rubbing_Y_100___GS { get; set; } + public double Rubbing_Y_200___DE { get; set; } + public double Rubbing_Y_200___GS { get; set; } + public double Rubbing_M_100___DE { get; set; } + public double Rubbing_M_100___GS { get; set; } + public double Rubbing_M_200___DE { get; set; } + public double Rubbing_M_200___GS { get; set; } + + public String Color_REF { get; set; } + public double Load__N_REF { get; set; } + public double STDEV_REF { get; set; } + public double REF_Strain { get; set; } + public double STDEV_Strain_REF { get; set; } + + public int Color_100_C { get; set; } + public String C_color_100_C { get; set; } + public double Load_N_100_C { get; set; } + public double STDEV_100_C { get; set; } + public double Change_100_C { get; set; } + public double Strain_100_C { get; set; } + public double STDEV_100_C_2 { get; set; } + public double Change_100_C_2 { get; set; } + + public int Color_100_K { get; set; } + public String C_color_100_K { get; set; } + public double Load__N_100_K { get; set; } + public double STDEV_100_K { get; set; } + public double Change__100_K { get; set; } + public double Strain_100_K { get; set; } + public double STDEV_100_K_2 { get; set; } + public double Change_100_K_2 { get; set; } + + public int Color_200_C { get; set; } + public String C_color_200_C { get; set; } + public double Load__N_200_C { get; set; } + public double STDEV_200_C { get; set; } + public double Change_200_C { get; set; } + public double Strain_200_C { get; set; } + public double STDEV_200_C_2 { get; set; } + public double Change_200_C_2 { get; set; } + + public int Color_200_K { get; set; } + public String C_color_200_K { get; set; } + public double Load__N_200_K { get; set; } + public double STDEV_200_K { get; set; } + public double Change_200_K { get; set; } + public double Strain_200_K { get; set; } + public double STDEV_200_K_2 { get; set; } + public double Change_200_K_2 { get; set; } + + public String Uniformity_Zone_1 { get; set; } + public String Uniformity_Zone_2 { get; set; } + + public double COF_REF { get; set; } + public double CV_REF { get; set; } + public double COF_Black { get; set; } + public double CV_Black { get; set; } + //for twine inly + public double lub_amount { get; set; } + + public String Comments { get; set; } + public String Conclusion { get; set; } + + public TestResultsExcelModel() + { + Comments = Conclusion = ""; + C_color_100_C = "Cyan"; + Color_100_C = 100; + Load__N_100_K = STDEV_100_K = Change__100_K = Strain_100_K = STDEV_100_K_2 = Change_100_K_2 = 0.0; + + C_color_200_C = "Cyan"; + Color_200_C = 200; + Load__N_200_C = STDEV_200_C = Change_200_C = Strain_200_C = STDEV_200_C_2 = Change_200_C_2 = 0.0; + + C_color_100_K = "Black"; + Color_100_K = 100; + Load__N_100_K = STDEV_100_K = Change__100_K = Strain_100_K = STDEV_100_K_2 = Change_100_K_2 = 0.0; + + C_color_200_K = "Black"; + Color_200_K = 200; + Load__N_200_K = STDEV_200_K = Change_200_K = Strain_200_K = STDEV_200_K_2 = Change_200_K_2 = 0.0; + + Color_REF = "REF"; + Load__N_REF = STDEV_REF = REF_Strain = STDEV_Strain_REF = 0; + } + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ThreadCharacteristicsExelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ThreadCharacteristicsExelModel.cs new file mode 100644 index 000000000..1f894d70b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Excel/ThreadCharacteristicsExelModel.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.ThreadExtensions.Models +{ + public class ThreadCharacteristicsExcelModel + { + public String ThreadName { get; set; } + public String Manufacturer { get; set; } + public String Brand { get; set; } + public String Country { get; set; } + public String EndUse { get; set; } + public String Applications { get; set; } + public String IndustrySector { get; set; } + public String Material { get; set; } + public String Type { get; set; } + public String SubFamily { get; set; } + public String Family { get; set; } + public String Group { get; set; } + public String Texturing { get; set; } + public String Geometry { get; set; } + public String Color { get; set; } + public String GlossLevel { get; set; } + public double LinearDensity { get; set; } + public String Unit { get; set; } + public int Plies { get; set; } + public int FilamentCountPerPlie { get; set; } + public int LinearDensityCount { get; set; } + public int CountDen { get; set; } + public String FiberCount  { get; set; } + public int Twist { get; set; } + public String TwistDirection { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorDataExcelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorDataExcelModel.cs deleted file mode 100644 index da7471e16..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorDataExcelModel.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Documents; - -namespace Tango.MachineStudio.ThreadExtensions.Models -{ - public class ColorDataExcelModel - { - public int NlCm { get; set; } - public double L { get; set; } - public double A { get; set; } - public double B { get; set; } - - public ColorDataExcelModel() - { - NlCm = 0; - L = A = B = 0.0; - } - - public static void GetDataFromFile(string fileName, out List items, ref string errors) - { - items = null; - try - { - using (ExcelReader reader = new ExcelReader(fileName)) - { - items = reader.GetDataByIndex("Sheet1", 1); - } - } - catch (Exception ex) - { - errors = ex.Message; - } - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorParametrsExcelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorParametrsExcelModel.cs deleted file mode 100644 index b762c1042..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorParametrsExcelModel.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.MachineStudio.ThreadExtensions.Models -{ - public class ColorParametrsExcelModel - { - public String Thread_name { get; set; } - public String MachineNumber { get; set; } - public double White_point_L { get; set; } - public double White_point_a { get; set; } - public double White_point_B { get; set; } - public double Factor_100__C { get; set; } - public double Factor_100__Cyan_L { get; set; } - public double Factor_100__Cyan_A { get; set; } - public double Factor_100__Cyan_B { get; set; } - public double Factor_100__M { get; set; } - public double Factor_100__Magenta_L { get; set; } - public double Factor_100__Magenta_A { get; set; } - public double Factor_100__Magenta_B { get; set; } - - public double Factor_100__Y { get; set; } - public double Factor_100__Yellow_L { get; set; } - public double Factor_100__Yellow_A { get; set; } - public double Factor_100__Yellow_B { get; set; } - public double Factor_100_K { get; set; } - public double Factor_100__Key_L { get; set; } - public double Factor_100__Key_A { get; set; } - public double Factor_100__Key_B { get; set; } - public double Factor_200_C { get; set; } - public double Factor_200__Cyan_L { get; set; } - public double Factor_200__Cyan_A { get; set; } - public double Factor_200__Cyan_B { get; set; } - - public double Factor_200__Magenta { get; set; } - public double Factor_200__Magenta_L { get; set; } - public double Factor_200__Magenta_A { get; set; } - public double Factor_200__Magenta_B { get; set; } - - public double Factor_200__Yellow { get; set; } - public double Factor_200__Yellow_L { get; set; } - public double Factor_200__Yellow_A { get; set; } - public double Factor_200__Yellow_B { get; set; } - - public double Factor_200__Key { get; set; } - public double Factor_200__Key_L { get; set; } - public double Factor_200__Key_A { get; set; } - public double Factor_200__Key_B { get; set; } - - public int Min_Ink_Uptake_Zone1 { get; set; } - public int Min_Ink_Uptake_Zone2 { get; set; } - public int Max_Ink_Uptake_Zone1 { get; set; } - public int Max_ink_uptake__Zone2 { get; set; } - - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/TestResultsExcelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/TestResultsExcelModel.cs deleted file mode 100644 index fbd142362..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/TestResultsExcelModel.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.MachineStudio.ThreadExtensions.Models -{ - public class TestResultsExcelModel - { - public String Thread_name_test_results { get; set; } - public String Machine_number { get; set; } - public String Test_results_name__tab { get; set; } - - public int Dryer_temp { get; set; } - public int Dryer_flow { get; set; } - public int Tunnel_temp { get; set; } - public int Tunnel_flow { get; set; } - - public String Tension_in_head { get; set; } - public String Tension_after_dryer { get; set; } - public String Tension_in_winder { get; set; } - public String BTSR { get; set; } - public String Puller_tension { get; set; } - public String Winder_tension { get; set; } - - public double Rubbing_K_100___DE { get; set; } - public double Rubbing_K_100___GS { get; set; } - public double Rubbing_K_200___DE { get; set; } - public double Rubbing_K_200___GS { get; set; } - public double Rubbing_C_100___DE { get; set; } - public double Rubbing_C_100___GS { get; set; } - public double Rubbing_C_200___DE { get; set; } - public double Rubbing_C_200___GS { get; set; } - public double Rubbing_Y_100___DE { get; set; } - public double Rubbing_Y_100___GS { get; set; } - public double Rubbing_Y_200___DE { get; set; } - public double Rubbing_Y_200___GS { get; set; } - public double Rubbing_M_100___DE { get; set; } - public double Rubbing_M_100___GS { get; set; } - public double Rubbing_M_200___DE { get; set; } - public double Rubbing_M_200___GS { get; set; } - - public String Color_REF { get; set; } - public double Load__N_REF { get; set; } - public double STDEV_REF { get; set; } - public double REF_Strain { get; set; } - public double STDEV_Strain_REF { get; set; } - - public String Color_100_C { get; set; } - public int C_color_100_C { get; set; } - public double Load_N_100_C { get; set; } - public double STDEV_100_C { get; set; } - public double Change_100_C { get; set; } - public double Strain_100_C { get; set; } - public double STDEV_100_C_2 { get; set; } - public double Change_100_C_2 { get; set; } - - public String Color_100_K { get; set; } - public int C_color_100_K { get; set; } - public double Load__N_100_K { get; set; } - public double STDEV_100_K { get; set; } - public double Change__100_K { get; set; } - public double Strain_100_K { get; set; } - public double STDEV_100_K_2 { get; set; } - public double Change_100_K_2 { get; set; } - - public String Color_200_C { get; set; } - public int C_color_200_C { get; set; } - public double Load__N_200_C { get; set; } - public double STDEV_200_C { get; set; } - public double Change_200_C { get; set; } - public double Strain_200_C { get; set; } - public double STDEV_200_C_2 { get; set; } - public double Change_200_C_2 { get; set; } - - public String Color_200_K { get; set; } - public int C_color_200_K { get; set; } - public double Load__N_200_K { get; set; } - public double STDEV_200_K { get; set; } - public double Change_200_K { get; set; } - public double Strain_200_K { get; set; } - public double STDEV_200_K_2 { get; set; } - public double Change_200_K_2 { get; set; } - - public String Uniformity_Zone_1 { get; set; } - public String Uniformity_Zone_2 { get; set; } - - public double COF_REF { get; set; } - public double CV_REF { get; set; } - public double COF_Black { get; set; } - public double CV_Black { get; set; } - //for twine inly - public double lub_amount { get; set; } - - public String Comments { get; set; } - public String Conclusion { get; set; } - - public TestResultsExcelModel() - { - Comments = Conclusion = ""; - Color_100_C = "Cyan"; - C_color_100_C = 100; - Load__N_100_K = STDEV_100_K = Change__100_K = Strain_100_K = STDEV_100_K_2 = Change_100_K_2 = 0.0; - - Color_200_C = "Cyan"; - C_color_200_C = 200; - Load__N_200_C = STDEV_200_C = Change_200_C = Strain_200_C = STDEV_200_C_2 = Change_200_C_2 = 0.0; - - Color_100_K = "Black"; - C_color_100_K = 100; - Load__N_100_K = STDEV_100_K = Change__100_K = Strain_100_K = STDEV_100_K_2 = Change_100_K_2 = 0.0; - - Color_200_K = "Black"; - C_color_200_K = 200; - Load__N_200_K = STDEV_200_K = Change_200_K = Strain_200_K = STDEV_200_K_2 = Change_200_K_2 = 0.0; - - Color_REF = "REF"; - Load__N_REF = STDEV_REF = REF_Strain = STDEV_Strain_REF = 0; - } - - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs deleted file mode 100644 index 1f894d70b..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ThreadCharacteristicsExelModel.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.MachineStudio.ThreadExtensions.Models -{ - public class ThreadCharacteristicsExcelModel - { - public String ThreadName { get; set; } - public String Manufacturer { get; set; } - public String Brand { get; set; } - public String Country { get; set; } - public String EndUse { get; set; } - public String Applications { get; set; } - public String IndustrySector { get; set; } - public String Material { get; set; } - public String Type { get; set; } - public String SubFamily { get; set; } - public String Family { get; set; } - public String Group { get; set; } - public String Texturing { get; set; } - public String Geometry { get; set; } - public String Color { get; set; } - public String GlossLevel { get; set; } - public double LinearDensity { get; set; } - public String Unit { get; set; } - public int Plies { get; set; } - public int FilamentCountPerPlie { get; set; } - public int LinearDensityCount { get; set; } - public int CountDen { get; set; } - public String FiberCount  { get; set; } - public int Twist { get; set; } - public String TwistDirection { get; set; } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj index 5199245a3..9ea43ad0b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Tango.MachineStudio.ThreadExtensions.csproj @@ -95,14 +95,14 @@ - - + + - - + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx index e9bdd6151..19b6a0004 100644 Binary files a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Templates/ExportRMLTemplate.xlsx differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs index 6b95cf190..4802e0af1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs @@ -1295,7 +1295,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels { ColorParametrsExcelModel colorParametrsExcelModel = new ColorParametrsExcelModel(); colorParametrsExcelModel.Thread_name = ActiveRML.Name; - colorParametrsExcelModel.MachineNumber = machine.SerialNumber; + colorParametrsExcelModel.MachineNumber = machine.SerialNumber.ToString(); colorParametrsExcelModel.White_point_L = ActiveRML.WhitePointL; colorParametrsExcelModel.White_point_a = ActiveRML.WhitePointA; colorParametrsExcelModel.White_point_B = ActiveRML.WhitePointB; @@ -1305,10 +1305,10 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels TestResultsViewVM.LoadTestResultsExcel(testResultsExcelModelList, machine.Guid, machine.SerialNumber); } - } - writer.WriteData(colorParametrsExcelList, "Color parameters",2); - writer.WriteData(testResultsExcelModelList, "Machine tests results", 2); + + writer.WriteData(colorParametrsExcelList, "Color parameters"); + writer.WriteData(testResultsExcelModelList.OrderBy(x => x.Machine_number), "Machine tests results"); writer.Dispose(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs index f7823a77c..c1fb4497f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/TestResultsViewVM.cs @@ -441,20 +441,20 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels testResultsExcelModel.Puller_tension = testresult.PullerTensionMin == null ? "" : testresult.PullerTensionMin.ToString(); testResultsExcelModel.Winder_tension = testresult.ExitTensionMin == null ? "" : testresult.ExitTensionMin.ToString(); - foreach( var tensileResult in testresult.TensileResults) + foreach (var tensileResult in testresult.TensileResults) { - if(tensileResult.TestResultColor == TestResultColors.CYAN) + if (tensileResult.TestResultColor == TestResultColors.CYAN) { - if(tensileResult.ColorPercent == 100) + if (tensileResult.ColorPercent == 100) { testResultsExcelModel.Load_N_100_C = tensileResult.MaxLoad == null ? 0 : (double)tensileResult.MaxLoad; testResultsExcelModel.STDEV_100_C = tensileResult.StdevMaxLoad == null ? 0 : (double)tensileResult.StdevMaxLoad; - testResultsExcelModel.Change_100_C = tensileResult.PercentChangeLoad == null ? 0 : (double)tensileResult.PercentChangeLoad; + testResultsExcelModel.Change_100_C = tensileResult.PercentChangeLoad == null ? 0 : (double)tensileResult.PercentChangeLoad; testResultsExcelModel.Strain_100_C = tensileResult.StrainMaxLoad == null ? 0 : (double)tensileResult.StrainMaxLoad; testResultsExcelModel.STDEV_100_C_2 = tensileResult.StdevStrainMaxLoad == null ? 0 : (double)tensileResult.StdevStrainMaxLoad; testResultsExcelModel.Change_100_C_2 = tensileResult.PercentChangeStrain == null ? 0 : (double)tensileResult.PercentChangeStrain; } - else if(tensileResult.ColorPercent == 200) + else if (tensileResult.ColorPercent == 200) { testResultsExcelModel.Load__N_200_C = tensileResult.MaxLoad == null ? 0 : (double)tensileResult.MaxLoad; testResultsExcelModel.STDEV_200_C = tensileResult.StdevMaxLoad == null ? 0 : (double)tensileResult.StdevMaxLoad; @@ -464,7 +464,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels testResultsExcelModel.Change_200_C_2 = tensileResult.PercentChangeStrain == null ? 0 : (double)tensileResult.PercentChangeStrain; } } - else if(tensileResult.TestResultColor == TestResultColors.BLACK) + else if (tensileResult.TestResultColor == TestResultColors.BLACK) { if (tensileResult.ColorPercent == 100) { @@ -484,18 +484,18 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels testResultsExcelModel.STDEV_200_K_2 = tensileResult.StdevStrainMaxLoad == null ? 0 : (double)tensileResult.StdevStrainMaxLoad; testResultsExcelModel.Change_200_K_2 = tensileResult.PercentChangeStrain == null ? 0 : (double)tensileResult.PercentChangeStrain; } - + } else if (tensileResult.IsWhiteColor) { testResultsExcelModel.Load__N_REF = tensileResult.MaxLoad == null ? 0 : (double)tensileResult.MaxLoad; testResultsExcelModel.STDEV_REF = tensileResult.StdevMaxLoad == null ? 0 : (double)tensileResult.StdevMaxLoad; - testResultsExcelModel.REF_Strain = tensileResult.StdevStrainMaxLoad == null ? 0 : (double)tensileResult.StdevStrainMaxLoad; - testResultsExcelModel.STDEV_Strain_REF = tensileResult.PercentChangeStrain == null ? 0 : (double)tensileResult.PercentChangeStrain; + testResultsExcelModel.STDEV_Strain_REF = tensileResult.StdevStrainMaxLoad == null ? 0 : (double)tensileResult.StdevStrainMaxLoad; + testResultsExcelModel.REF_Strain = tensileResult.StrainMaxLoad == null ? 0 : (double)tensileResult.StrainMaxLoad; } } - + foreach (var rubbingresult in testresult.RubbingResults) { if (rubbingresult.TestResultColor == TestResultColors.CYAN) @@ -527,9 +527,12 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels testResultsExcelModel.Rubbing_K_200___GS = rubbingresult.Gs200 == null ? 0.0 : (double)rubbingresult.Gs200; } } - - testResultsExcelModel.Uniformity_Zone_1 = testresult.SeverityZone1Min == null ? "" : testresult.SeverityZone1Min.ToString() + "-" + testresult.SeverityZone1Max == null ? "" : testresult.SeverityZone1Max.ToString(); - testResultsExcelModel.Uniformity_Zone_2 = testresult.SeverityZone2Min == null ? "" : testresult.SeverityZone2Min.ToString() + "-" + testresult.SeverityZone2Max == null ? "" : testresult.SeverityZone2Max.ToString(); + string minZone = testresult.SeverityZone1Min == null ? "" : ((double)testresult.SeverityZone1Min).ToString(); + string maxZone = testresult.SeverityZone1Max == null ? "" : ((double)testresult.SeverityZone1Max).ToString(); + testResultsExcelModel.Uniformity_Zone_1 = $"{minZone} - {maxZone}"; + minZone = testresult.SeverityZone2Min == null ? "" : ((double)testresult.SeverityZone2Min).ToString(); + maxZone = testresult.SeverityZone2Max == null ? "" : ((double)testresult.SeverityZone2Max).ToString(); + testResultsExcelModel.Uniformity_Zone_2 = $"{minZone} - {maxZone}"; testResultsExcelModel.COF_REF = testresult.RefCof == null ? 0.0 : (double)testresult.RefCof; testResultsExcelModel.CV_REF = 0.0; -- cgit v1.3.1