aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels
diff options
context:
space:
mode:
authorRoy Ben Shabat <roy.mail.net@gmail.com>2025-10-19 16:20:01 +0300
committerRoy Ben Shabat <roy.mail.net@gmail.com>2025-10-19 16:20:01 +0300
commit72fc39f873de467c1431d928bce4d39442205691 (patch)
treefc92559db7b57bb44606e040cd8ed4bd34494256 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels
parent22ddd9e0b6efe5aef685c7fc9886e3d93cb350c0 (diff)
downloadTango-72fc39f873de467c1431d928bce4d39442205691.tar.gz
Tango-72fc39f873de467c1431d928bce4d39442205691.zip
MS LITE
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs61
1 files changed, 46 insertions, 15 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 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<RmlActiveSitesDialogVM, RmlActiveSitesDialog>(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)