From a906e7316bc179888f475f6bcff5ddc20a501346 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 9 Jul 2023 14:00:24 +0300 Subject: MS RML list Related Work Items: #8383 --- .../Tango.MachineStudio.RML/Models/RmlModel.cs | 23 +++++++- .../ViewModels/MainViewVM.cs | 65 ++++++++++++++++++++-- .../Tango.MachineStudio.RML/Views/RmlsView.xaml | 26 +++++---- 3 files changed, 96 insertions(+), 18 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/RmlModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/RmlModel.cs index b1be35a38..dce3432e2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/RmlModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/RmlModel.cs @@ -11,10 +11,16 @@ namespace Tango.MachineStudio.RML.Models { public class RmlModel : ExtendedObject { + public class LiquidTypeColorValue + { + public int Color { get; set; } + + public double LiquidTypeValue { get; set; } + } public String Guid { get; set; } public String Name { get; set; } - + public String DisplayName { get; set; } public String CCT { get; set; } @@ -27,8 +33,23 @@ namespace Tango.MachineStudio.RML.Models public String Btsr { get; set; } + public String DyeingSpeed { get; set; } + + public String Zone1InkUptake { get; set; } + + public String Zone2InkUptake { get; set; } + public DateTime LastUpdated { get; set; } public List LiquidTypes { get; set; } + + public List LiquidTypesR { get; set; } + + public RmlModel() + { + DyeingSpeed = "-"; + Zone1InkUptake = "-"; + Zone2InkUptake = "-"; + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index fd276ea65..7eb6e9058 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -28,6 +28,7 @@ using Tango.BL.Enumerations; using Google.Protobuf; using Tango.ColorConversion; using Tango.CSV; +using Tango.Core; namespace Tango.MachineStudio.RML.ViewModels { @@ -345,18 +346,21 @@ namespace Tango.MachineStudio.RML.ViewModels private async Task LoadRmls() { var filter = RMLFilter.ToStringOrEmpty().ToLower(); - + using (ObservablesContext db = ObservablesContext.CreateDefault()) { + var rmls = await db.Rmls.Where(x => x.Name.ToLower().Contains(filter) || x.DisplayName.ToLower().Contains(filter)) .Include(x => x.Cct.FileName) + .Include(x => x.LiquidTypesRmls) .Include(x => x.LiquidTypesRmls.Select(y => y.LiquidType)) .Include(x => x.BtsrApplicationType.Name) .Include(x => x.BtsrYarnType.Name) + .Include(x => x.ProcessParametersTablesGroups) .Select(x => new { - x.Guid, x.Name, + x.Guid, x.DisplayName, x.Cct.FileName, x.ColorConversionVersion, @@ -366,13 +370,44 @@ namespace Tango.MachineStudio.RML.ViewModels x.LastUpdated, BtsrApplicationType = x.BtsrApplicationType != null ? x.BtsrApplicationType.Name : String.Empty, BtsrYarnType = x.BtsrYarnType != null ? x.BtsrYarnType.Name : String.Empty, - LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType) + LiquidTypesRmls = x.LiquidTypesRmls, + LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType), + ProcessParametersTables = x.ProcessParametersTablesGroups }).ToListAsync(); + List models = new List(); + //var tables = ActiveRML.GetActiveProcessGroup().ProcessParametersTables; + foreach (var rml in rmls.OrderBy(x => x.Name).ToList()) { + ProcessParametersTable tableZone1 = null; + ProcessParametersTable tableZone2 = null; + if (rml.ProcessParametersTables != null) + { + var activeTablesGroup = rml.ProcessParametersTables.Where(x=>x.Active).FirstOrDefault(); + if ( activeTablesGroup != null) + { + try + { + var tables = await db.ProcessParametersTables.Where(x => x.ProcessParametersTablesGroupGuid == activeTablesGroup.Guid).OrderBy(x => x.TableIndex).ToListAsync(); + if (tables.Count > 0) + { + tableZone1 = tables[0]; + } + if (tables.Count > 1) + { + tableZone2 = tables[1]; + } + } + catch (Exception ex) + { + LogManager.Log($"Error loading ProcessParametersTables {ex.Message}"); + } + }; + } + RmlModel model = new RmlModel(); model.Guid = rml.Guid; model.Name = rml.Name; @@ -383,8 +418,21 @@ namespace Tango.MachineStudio.RML.ViewModels model.UseLightInks = rml.UseLightInks; model.HeadType = (HeadTypes)rml.HeadType; model.Btsr = (String.IsNullOrEmpty(rml.BtsrApplicationType) ? "N/A" : rml.BtsrApplicationType) + ", " + (String.IsNullOrEmpty(rml.BtsrYarnType) ? "N/A" : rml.BtsrYarnType); - model.LiquidTypes = rml.LiquidTypes.OrderBy(x => x.Code).Select(x => x.Color).ToList(); + + if( tableZone1 != null) + { + model.Zone1InkUptake = String.Format($"{tableZone1.MinInkUptake}-{tableZone1.MaxInkUptake}"); + model.DyeingSpeed = tableZone1.DyeingSpeed.ToString(); + } + if(tableZone2 != null) + { + model.DyeingSpeed += String.Format($"-{tableZone2.DyeingSpeed}"); + model.Zone2InkUptake = tableZone2 == null ? "-" : String.Format($"{tableZone2.MinInkUptake}-{tableZone2.MaxInkUptake}"); + } + model.LiquidTypes = rml.LiquidTypes.OrderBy(x => x.Code).Select(x => x.Color).ToList(); + model.LiquidTypesR = rml.LiquidTypesRmls.OrderBy(x => x.LiquidType.Code).ToList().Select((n) => new RmlModel.LiquidTypeColorValue(){ Color = n.LiquidType.Color, LiquidTypeValue = n.MaxNlPerCm }).ToList(); + models.Add(model); } @@ -482,6 +530,11 @@ namespace Tango.MachineStudio.RML.ViewModels } ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); + + var tables= ActiveRML.ProcessParametersTablesGroups.ToList(); + var zone1 = tables[0].ProcessParametersTables; + /* + * */ ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables); ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending)); @@ -1075,10 +1128,10 @@ namespace Tango.MachineStudio.RML.ViewModels } } - private void BackToRmls() + private async void BackToRmls() { View.NavigateTo(RmlNavigationView.RmlsView); - LoadRmls(); + await LoadRmls(); } #region Batch Conversion diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml index d5f4165c9..9c684c052 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -81,7 +81,7 @@ - + - + - - + + () - - + + + + + - - + + - + - + @@ -123,11 +126,12 @@ - + + -- cgit v1.3.1