aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs65
1 files changed, 59 insertions, 6 deletions
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<RmlModel> models = new List<RmlModel>();
+ //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