From 72fc39f873de467c1431d928bce4d39442205691 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 19 Oct 2025 16:20:01 +0300 Subject: MS LITE --- .../Tango.MachineStudio.RML/Images/threads.png | Bin 315399 -> 44355 bytes .../Tango.MachineStudio.RML/Models/RmlModel.cs | 2 + .../ViewModels/MainViewVM.cs | 61 ++++++++++++++++----- .../Views/CalibrationDataView.xaml | 2 +- .../Views/ProcessParametersView.xaml | 4 +- .../Tango.MachineStudio.RML/Views/RmlView.xaml | 6 +- .../Tango.MachineStudio.RML/Views/RmlsView.xaml | 16 ++++-- 7 files changed, 65 insertions(+), 26 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png index 86eb0b335..6d7c680ec 100644 Binary files a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png differ 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 c2245bcb2..74bebef45 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 @@ -47,6 +47,8 @@ namespace Tango.MachineStudio.RML.Models public MachineTypes? MachineType { get; set; } + public double DefaultLiquidFactor { get; set; } + public RmlModel() { DyeingSpeed = "-"; 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 2fcb87c59..a8ec6a9ff 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 @@ -30,6 +30,7 @@ using Tango.ColorConversion; using Tango.CSV; using Tango.Core; using Tango.SharedUI.Helpers; +using Tango.MachineStudio.Common.Buid; namespace Tango.MachineStudio.RML.ViewModels { @@ -39,6 +40,7 @@ namespace Tango.MachineStudio.RML.ViewModels private IAuthenticationProvider _authentication; private IActionLogManager _actionLogManager; private RmlDTO _rmlBeforeSave; + private IBuildProvider _buildProvider; private ObservablesContext _active_context; @@ -320,8 +322,9 @@ namespace Tango.MachineStudio.RML.ViewModels #endregion - public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) + public MainViewVM(IBuildProvider buildProvider, INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { + _buildProvider = buildProvider; _notification = notificationProvider; _authentication = authentication; _actionLogManager = actionLogManager; @@ -362,7 +365,7 @@ namespace Tango.MachineStudio.RML.ViewModels public override void OnApplicationReady() { - + } private async Task LoadRmls() @@ -375,8 +378,7 @@ namespace Tango.MachineStudio.RML.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { - - var rmls = await db.Rmls.Where(x => x.Name.ToLower().Contains(filter) || x.DisplayName.ToLower().Contains(filter)) + var rmls = await db.Rmls.Where(x => x.CreatedByOrganizationGuid == _authentication.CurrentUser.Organization.Guid || _buildProvider.BuildType == MSBuildType.Default).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)) @@ -395,11 +397,12 @@ namespace Tango.MachineStudio.RML.ViewModels x.HeadType, x.LastUpdated, x.MachineType, + x.DefaultLiquidFactor, BtsrApplicationType = x.BtsrApplicationType != null ? x.BtsrApplicationType.Name : String.Empty, BtsrYarnType = x.BtsrYarnType != null ? x.BtsrYarnType.Name : String.Empty, - //LiquidTypesRmls = x.LiquidTypesRmls, - //LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType), - ProcessParametersTables = x.ProcessParametersTablesGroups + //LiquidTypesRmls = x.LiquidTypesRmls, + //LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType), + ProcessParametersTables = x.ProcessParametersTablesGroups }).ToListAsync(); @@ -446,6 +449,7 @@ namespace Tango.MachineStudio.RML.ViewModels model.HeadType = (HeadTypes)rml.HeadType; model.Btsr = (String.IsNullOrEmpty(rml.BtsrApplicationType) ? "N/A" : rml.BtsrApplicationType) + ", " + (String.IsNullOrEmpty(rml.BtsrYarnType) ? "N/A" : rml.BtsrYarnType); model.MachineType = (MachineTypes?)rml.MachineType; + model.DefaultLiquidFactor = rml.DefaultLiquidFactor; if (tableZone1 != null) { @@ -570,7 +574,7 @@ namespace Tango.MachineStudio.RML.ViewModels ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); - var tables= ActiveRML.ProcessParametersTablesGroups.ToList(); + var tables = ActiveRML.ProcessParametersTablesGroups.ToList(); var zone1 = tables[0].ProcessParametersTables; /* * */ @@ -760,6 +764,16 @@ namespace Tango.MachineStudio.RML.ViewModels rml.QualificationDate = DateTime.UtcNow; rml.Manufacturer = "Twine"; rml.DefaultLiquidFactor = 140; + rml.ColorConversionVersion = 6; + rml.CreatedByUserGuid = _authentication.CurrentUser.Guid; + rml.CreatedByOrganizationGuid = _authentication.CurrentUser.Organization.Guid; + rml.VMax = 5; + rml.UseLightInks = true; + + if (_buildProvider.BuildType == MSBuildType.Lite) + { + rml.ForMachineType = _authentication.Machine.Type; + } using (ObservablesContext db = ObservablesContext.CreateDefault()) { @@ -787,13 +801,28 @@ namespace Tango.MachineStudio.RML.ViewModels group.Active = true; group.ProcessParametersTables.Add(new ProcessParametersTable() { - Name = "Process Table 1", + Name = "Zone 1", + }); + group.ProcessParametersTables.Add(new ProcessParametersTable() + { + Name = "Zone 2", }); group.Rml = rml; _active_context.ProcessParametersTablesGroups.Add(group); _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]); + _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[1]); + + LiquidTypesRml lubricantRelation = new LiquidTypesRml(); + lubricantRelation.LiquidTypeGuid = _active_context.LiquidTypes.FirstOrDefault(x => x.Code == (int)LiquidTypes.Lubricant).Guid; + lubricantRelation.RmlGuid = rml.Guid; + lubricantRelation.MaxNlPerCm = 1; + + _active_context.LiquidTypesRmls.Add(lubricantRelation); + + rml.CctGuid = _active_context.Ccts.OrderByDescending(x => x.LastUpdated).Take(1).Select(x => x.Guid).ToList().First(); + _active_context.Rmls.Add(rml); await _active_context.SaveChangesAsync(); @@ -903,6 +932,8 @@ namespace Tango.MachineStudio.RML.ViewModels cloned.DisplayName = name; cloned.RmlQualificationLevel = RmlQualifications.Provisional; cloned.QualificationDate = DateTime.UtcNow; + cloned.CreatedByUserGuid = _authentication.CurrentUser.Guid; + cloned.CreatedByOrganizationGuid = _authentication.CurrentUser.Organization.Guid; ProcessParametersTablesGroup group = new ProcessParametersTablesGroup(); group.Name = rml.GetActiveProcessGroup().Name; @@ -1183,7 +1214,7 @@ namespace Tango.MachineStudio.RML.ViewModels private async void ActivatedInSitesDialog() { - if(SelectedRML == null) + if (SelectedRML == null) return; try @@ -1191,9 +1222,9 @@ namespace Tango.MachineStudio.RML.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { IsFree = false; - - var selSites = await db.SitesRmls.OrderBy(x => x.ID).Where(y => y.RmlGuid == SelectedRML.Guid).Include(x=>x.Site).Select(x => x.Site.Name).ToListAsync(); - + + var selSites = await db.SitesRmls.OrderBy(x => x.ID).Where(y => y.RmlGuid == SelectedRML.Guid).Include(x => x.Site).Select(x => x.Site.Name).ToListAsync(); + var vm = new RmlActiveSitesDialogVM(selSites, SelectedRML.Name); _notification.ShowModalDialog(vm, (x) => { }, () => { }); @@ -1214,7 +1245,7 @@ namespace Tango.MachineStudio.RML.ViewModels IsFree = true; } } - + private async void BackToRmls() { View.NavigateTo(RmlNavigationView.RmlsView); @@ -1717,7 +1748,7 @@ namespace Tango.MachineStudio.RML.ViewModels { var json = File.ReadAllText(file); var rmlFile = await Rml.FromRmlFile(db, json); - + db.Rmls.Add(rmlFile); if (rmlFile.RmlsExtensions != null && rmlFile.RmlsExtensions.Count > 0) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml index f1995283c..9d1c4a947 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml @@ -21,7 +21,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml index b9e9f30c3..12571ed6e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml @@ -158,12 +158,12 @@ - + - +