From cc2b95c9144d8a3486314766b645021a9a914d25 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 13 Dec 2019 02:14:37 +0200 Subject: Implemented power up screen. Implemented power on emulator. Implemented power via machine operator. --- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index 01a47539e..48e59562c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -4,6 +4,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Threading; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; using Tango.Core.DI; using Tango.Integration.ExternalBridge; using Tango.Integration.Operation; @@ -17,6 +20,7 @@ using Tango.PPC.Common.Notifications; using Tango.PPC.Common.WatchDog; using Tango.PPC.UI.Dialogs; using Tango.SharedUI; +using System.Data.Entity; namespace Tango.PPC.UI.ViewModels { @@ -58,6 +62,7 @@ namespace Tango.PPC.UI.ViewModels { base.OnApplicationReady(); MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived; + MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted; } #region Event Handlers @@ -92,6 +97,72 @@ namespace Tango.PPC.UI.ViewModels }); } + private async void MachineOperator_PowerUpStarted(object sender, EventArgs e) + { + LogManager.Log("Power up detected, showing power up screen..."); + + PowerUpViewVM vm; + + try + { + List rmls = new List(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + rmls = await db.Rmls.ToListAsync(); + } + + var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LastPowerUpSelectedRmlGuid); + + vm = new PowerUpViewVM(); + vm.Rmls = rmls; + vm.SelectedRml = selectedRml != null ? selectedRml : rmls.FirstOrDefault(); + vm.IsSelectedRml = selectedRml != null; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error initializing power up screen."); + return; + } + + InvokeUI(async () => + { + await NotificationProvider.ShowDialog(vm); + + await Task.Factory.StartNew(() => + { + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + List processTables = new List(); + + if (vm.IsSelectedRml) + { + processTables = new RmlBuilder(db).Set(vm.SelectedRml.Guid).WithActiveParametersGroup().Build().GetActiveProcessGroup().ProcessParametersTables.ToList(); + } + else + { + var rmlsToAvg = new RmlsCollectionBuilder(db).SetAll().WithActiveParametersGroup().Build(); + processTables = rmlsToAvg.Select(x => x.GetActiveProcessGroup()).SelectMany(x => x.ProcessParametersTables).ToList(); + } + + var processToLoad = processTables.OrderBy(x => x.GetAverageTemperature()).First(); + + var r = MachineProvider.MachineOperator.UploadProcessParameters(processToLoad).Result; + + Settings.LastPowerUpSelectedRmlGuid = vm.IsSelectedRml ? vm.SelectedRml.Guid : null; + Settings.Save(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error occurred while trying to get and upload the proper process parameters after power screen closed."); + } + }); + }); + } + #endregion } } -- cgit v1.3.1 From f73b77c8619d0fb49af93e4ac5c73dd13d5d1b1a Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 13 Dec 2019 16:49:52 +0200 Subject: Implemented site catalogs ! --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes .../SQLExaminer Projects/Provision Machine.sdeproj | 327 ++++++++++++++++++++- Software/DB/TCC/TCC.mdf | Bin 8388608 -> 8388608 bytes Software/DB/TCC/TCC_log.ldf | Bin 8388608 -> 8388608 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../ViewModels/MainViewVM.cs | 2 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 4 +- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 10 +- .../ViewModels/MainViewVM.cs | 15 +- .../Tango.PPC.MachineSettings/Views/MainView.xaml | 2 +- .../PPC/Tango.PPC.Common/PPCSettings.cs | 6 + .../PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs | 4 +- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 4 +- .../Tango.BL/Builders/CatalogBuilder.cs | 49 +++ .../Tango.BL/Builders/CatalogsCollectionBuilder.cs | 41 +++ .../Tango.BL/Builders/ColorCatalogBuilder.cs | 49 --- .../Tango.BL/Builders/RmlsCollectionBuilder.cs | 26 +- .../Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs | 14 + .../Tango.BL/DTO/SitesCatalogDTOBase.cs | 41 +++ .../Tango.BL/Entities/HardwareBlowerBase.cs | 4 - .../Tango.BL/Entities/SitesCatalog.cs | 12 + .../Tango.BL/Entities/SitesCatalogBase.cs | 86 ++++++ .../Visual_Studio/Tango.BL/ObservablesContext.cs | 8 + .../ObservablesEntitiesAdapterExtension.cs | 38 +++ .../ObservablesStaticCollectionsExtension.cs | 38 +++ Software/Visual_Studio/Tango.BL/Tango.BL.csproj | 7 +- .../Tango.DAL.Remote/DB/RemoteADO.Context.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 33 +++ .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 153 +++++----- .../Tango.DAL.Remote/DB/SITES_CATALOGS.cs | 23 ++ .../Tango.DAL.Remote/Tango.DAL.Remote.csproj | 3 + .../Configurations/ProvisionMachine.xml | Bin 73758 -> 87374 bytes .../SQLExaminer/Configurations/UpdateMachine.xml | Bin 40278 -> 54676 bytes 35 files changed, 846 insertions(+), 154 deletions(-) create mode 100644 Software/Visual_Studio/Tango.BL/Builders/CatalogBuilder.cs create mode 100644 Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs delete mode 100644 Software/Visual_Studio/Tango.BL/Builders/ColorCatalogBuilder.cs create mode 100644 Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs create mode 100644 Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTOBase.cs create mode 100644 Software/Visual_Studio/Tango.BL/Entities/SitesCatalog.cs create mode 100644 Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs create mode 100644 Software/Visual_Studio/Tango.DAL.Remote/DB/SITES_CATALOGS.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 35dde42f3..ec8ed5ec8 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 60f6da390..91c5d6631 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj b/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj index 5f4b977ae..ede868748 100644 --- a/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj +++ b/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj @@ -95,6 +95,8 @@ + + @@ -125,6 +127,8 @@ + + @@ -133,6 +137,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -156,6 +211,7 @@ + @@ -369,6 +425,15 @@ + + + + + + + + + @@ -499,6 +564,8 @@ + + @@ -538,6 +605,8 @@ + + @@ -625,6 +694,11 @@ + + + + + @@ -638,6 +712,7 @@ + @@ -766,6 +841,8 @@ + + @@ -798,6 +875,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -831,6 +936,21 @@ + + + + + + + + + + + + + + + @@ -842,6 +962,7 @@ + @@ -957,7 +1078,7 @@ - + @@ -1035,7 +1156,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1103,7 +1224,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1113,6 +1234,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' + @@ -1165,7 +1287,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1240,7 +1362,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1312,7 +1434,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@']]> - + @@ -1390,7 +1512,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1420,6 +1542,11 @@ WHERE MACHINES.SERIAL_NUMBER = '@' + + + + + @@ -1498,7 +1625,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1560,7 +1687,185 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+
+
+ @@ -1621,7 +1926,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@']]> - + @@ -1697,7 +2002,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf index 7acd2ca82..c6f9a4e37 100644 Binary files a/Software/DB/TCC/TCC.mdf and b/Software/DB/TCC/TCC.mdf differ diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf index d61145d85..bb23dc9c6 100644 Binary files a/Software/DB/TCC/TCC_log.ldf and b/Software/DB/TCC/TCC_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index ddfd3abd8..4b4e5b56d 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 58b7b4e60..369c83d64 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.Catalogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs index 3cc4406d6..4d88a71d9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs @@ -197,7 +197,7 @@ namespace Tango.MachineStudio.Catalogs.ViewModels _activeCatalogContext = ObservablesContext.CreateDefault(); - ActiveCatalog = await new ColorCatalogBuilder(_activeCatalogContext).Set(SelectedCatalog.Guid).WithGroups().WithItems().WithRecipes().BuildAsync(); + ActiveCatalog = await new CatalogBuilder(_activeCatalogContext).Set(SelectedCatalog.Guid).WithGroups().WithItems().WithRecipes().BuildAsync(); SelectedGroup = ActiveCatalog.ColorCatalogsGroups.FirstOrDefault(); RMLS = await _activeCatalogContext.Rmls.ToListAsync(); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index dac8f9e49..0a5167900 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -468,7 +468,7 @@ namespace Tango.PPC.Jobs.ViewModels Job.ValidateOnPropertyChanged = true; LogManager.Log("Loading RMLS..."); - Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().BuildAsync()).ToList(); + Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().WithSite(MachineProvider.Machine.SiteGuid).BuildAsync()).ToList(); LogManager.Log("Loading Color Spaces..."); ColorSpaces = await _db.ColorSpaces.ToListAsync(); LogManager.Log("Loading Spool Types..."); @@ -478,7 +478,7 @@ namespace Tango.PPC.Jobs.ViewModels if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) { - SelectedCatalog = await new ColorCatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync(); + SelectedCatalog = await new CatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync(); if (SelectedCatalog != null) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index e80154413..798b333e7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -48,7 +48,8 @@ namespace Tango.PPC.Jobs.ViewModels public class JobsViewVM : PPCViewModel { private ObservablesContext _db; //Holds the db context for the job list. - private ObservableCollection _catalogs; //Holds the available color catalogs. + private ObservableCollection _catalogs; //Holds the available color catalogs for the site. + private ObservableCollection _rmls; //Holds the available RML for the site. public enum JobsCategory { @@ -505,7 +506,7 @@ namespace Tango.PPC.Jobs.ViewModels job.ColorSpaceGuid = Adapter.ColorSpaces.FirstOrDefault(x => x.Code == vm.SelectedColorSpace.ToInt32()).Guid; job.MachineGuid = MachineProvider.Machine.Guid; job.UserGuid = AuthenticationProvider.CurrentUser.Guid; - job.RmlGuid = Settings.DefaultRmlGuid != null ? Settings.DefaultRmlGuid : Adapter.Rmls.FirstOrDefault().Guid; + job.RmlGuid = Settings.DefaultRmlGuid != null ? Settings.DefaultRmlGuid : _rmls.FirstOrDefault().Guid; job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; job.SpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; @@ -726,9 +727,10 @@ namespace Tango.PPC.Jobs.ViewModels StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Pulse.Extension, HandlePulseFileLoaded); //Load catalogs. - using (ObservablesContext c = ObservablesContext.CreateDefault()) + using (ObservablesContext db = ObservablesContext.CreateDefault()) { - _catalogs = (await c.ColorCatalogs.ToListAsync()).ToObservableCollection(); + _catalogs = await new CatalogsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildAsync(); + _rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildAsync(); } MachineDataSynchronizer.SynchronizationEnded += MachineDataSynchronizer_SynchronizationEnded; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 1af9b8609..d12617264 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Data; using Tango.BL; +using Tango.BL.Builders; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core.Commands; @@ -52,6 +53,13 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _selectedColorSpaces = value; RaisePropertyChangedAuto(); } } + private ObservableCollection _rmls; + public ObservableCollection Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + private bool _enableHotSpot; public bool EnableHotSpot { @@ -211,11 +219,16 @@ namespace Tango.PPC.MachineSettings.ViewModels } - public override void OnApplicationReady() + public async override void OnApplicationReady() { base.OnApplicationReady(); MachineDataSynchronizer.SynchronizationStarted += (_, __) => InvalidateRelayCommands(); MachineDataSynchronizer.SynchronizationEnded += (_, __) => InvalidateRelayCommands(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + Rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildAsync(); + } } public override void OnNavigatedTo() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index e8bd657a0..017649f8e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -137,7 +137,7 @@ Default Thread - + Default Spool diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 0c3800d53..2f470df12 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -204,6 +204,11 @@ namespace Tango.PPC.Common /// public String LastPowerUpSelectedRmlGuid { get; set; } + /// + /// Gets or sets the power up screen timeout. + /// + public TimeSpan PowerUpScreenTimeout { get; set; } + /// /// Gets the machine service address. /// @@ -243,6 +248,7 @@ namespace Tango.PPC.Common SynchronizeDiagnostics = true; SynchronizationInterval = TimeSpan.FromMinutes(60); FirmwareVersion = "1.0.0.0"; + PowerUpScreenTimeout = TimeSpan.FromSeconds(20); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs index 22e489ffa..413b8453d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs @@ -5,6 +5,8 @@ using System.Text; using System.Threading.Tasks; using System.Timers; using Tango.BL.Entities; +using Tango.PPC.Common; +using Tango.Settings; using Tango.SharedUI; namespace Tango.PPC.UI.Dialogs @@ -83,7 +85,7 @@ namespace Tango.PPC.UI.Dialogs public PowerUpViewVM() { - RemainingSeconds = 20; + RemainingSeconds = (int)SettingsManager.Default.GetOrCreate().PowerUpScreenTimeout.TotalSeconds; CanClose = false; IsMinimalTemperature = true; IsTimeoutEnabled = true; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index 48e59562c..c3fa97d13 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -109,7 +109,7 @@ namespace Tango.PPC.UI.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { - rmls = await db.Rmls.ToListAsync(); + rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildListAsync(); } var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LastPowerUpSelectedRmlGuid); @@ -143,7 +143,7 @@ namespace Tango.PPC.UI.ViewModels } else { - var rmlsToAvg = new RmlsCollectionBuilder(db).SetAll().WithActiveParametersGroup().Build(); + var rmlsToAvg = new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).WithActiveParametersGroup().Build(); processTables = rmlsToAvg.Select(x => x.GetActiveProcessGroup()).SelectMany(x => x.ProcessParametersTables).ToList(); } diff --git a/Software/Visual_Studio/Tango.BL/Builders/CatalogBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/CatalogBuilder.cs new file mode 100644 index 000000000..ffe6924dd --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Builders/CatalogBuilder.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using System.Data.Entity; + +namespace Tango.BL.Builders +{ + public class CatalogBuilder : EntityBuilderBase + { + public CatalogBuilder(ObservablesContext context) : base(context) + { + + } + + public virtual CatalogBuilder WithGroups() + { + return AddQueryStep(1, (query) => + { + return query.Include(x => x.ColorCatalogsGroups); + }); + } + + public virtual CatalogBuilder WithItems() + { + return AddQueryStep(2, (query) => + { + return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems)); + }); + } + + public virtual CatalogBuilder WithRecipes(Rml rml = null) + { + return AddQueryStep(3, (query) => + { + if (rml != null) + { + return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes.Where(r => r.RmlGuid == rml.Guid)))); + } + else + { + return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes))); + } + }); + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs new file mode 100644 index 000000000..9b24899c4 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using System.Data.Entity; + +namespace Tango.BL.Builders +{ + public class CatalogsCollectionBuilder : EntityCollectionBuilderBase + { + public CatalogsCollectionBuilder(ObservablesContext context) : base(context) + { + } + + public virtual CatalogsCollectionBuilder WithSite(String siteGuid) + { + return AddQueryStep(1, (query) => + { + if (siteGuid != null) + { + var siteCatalogsGuids = Context.SitesCatalogs.Where(x => x.SiteGuid == siteGuid).ToList().Select(x => x.CatalogGuid).Where(x => x != null).Distinct().ToArray(); + + if (siteCatalogsGuids.Length > 0) + { + return query.Where(x => siteCatalogsGuids.Contains(x.Guid)); + } + else + { + return query; + } + } + else + { + return query; + } + }); + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Builders/ColorCatalogBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/ColorCatalogBuilder.cs deleted file mode 100644 index 5ddc84bc5..000000000 --- a/Software/Visual_Studio/Tango.BL/Builders/ColorCatalogBuilder.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL.Entities; -using System.Data.Entity; - -namespace Tango.BL.Builders -{ - public class ColorCatalogBuilder : EntityBuilderBase - { - public ColorCatalogBuilder(ObservablesContext context) : base(context) - { - - } - - public virtual ColorCatalogBuilder WithGroups() - { - return AddQueryStep(1, (query) => - { - return query.Include(x => x.ColorCatalogsGroups); - }); - } - - public virtual ColorCatalogBuilder WithItems() - { - return AddQueryStep(2, (query) => - { - return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems)); - }); - } - - public virtual ColorCatalogBuilder WithRecipes(Rml rml = null) - { - return AddQueryStep(3, (query) => - { - if (rml != null) - { - return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes.Where(r => r.RmlGuid == rml.Guid)))); - } - else - { - return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes))); - } - }); - } - } -} diff --git a/Software/Visual_Studio/Tango.BL/Builders/RmlsCollectionBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/RmlsCollectionBuilder.cs index 055f02474..9408d714b 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/RmlsCollectionBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/RmlsCollectionBuilder.cs @@ -14,9 +14,33 @@ namespace Tango.BL.Builders { } - public virtual RmlsCollectionBuilder WithCCT() + public virtual RmlsCollectionBuilder WithSite(String siteGuid) { return AddQueryStep(1, (query) => + { + if (siteGuid != null) + { + var siteRmlsGuids = Context.SitesRmls.Where(x => x.SiteGuid == siteGuid).ToList().Select(x => x.RmlGuid).Where(x => x != null).Distinct().ToArray(); + + if (siteRmlsGuids.Length > 0) + { + return query.Where(x => siteRmlsGuids.Contains(x.Guid)); + } + else + { + return query; + } + } + else + { + return query; + } + }); + } + + public virtual RmlsCollectionBuilder WithCCT() + { + return AddQueryStep(2, (query) => { return query.Include(x => x.Cct); }); diff --git a/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs new file mode 100644 index 000000000..4e1d44e6d --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs @@ -0,0 +1,14 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.DTO +{ + public class SitesCatalogDTO : SitesCatalogDTOBase + { + + } +} diff --git a/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTOBase.cs new file mode 100644 index 000000000..b673d5660 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTOBase.cs @@ -0,0 +1,41 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Tango Observables Generator +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. Do not modify! +// +//------------------------------------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.BL.DTO +{ + public abstract class SitesCatalogDTOBase : ObservableEntityDTO + { + + /// + /// site guid + /// + public String SiteGuid + { + get; set; + } + + /// + /// catalog guid + /// + public String CatalogGuid + { + get; set; + } + + } +} diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs index bbc55d245..c6c166498 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs @@ -129,10 +129,6 @@ namespace Tango.BL.Entities /// [Column("VOLTAGE")] - - [Description("Voltage Description")] - [Range(-10000,1000000)] - public Double Voltage { get diff --git a/Software/Visual_Studio/Tango.BL/Entities/SitesCatalog.cs b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalog.cs new file mode 100644 index 000000000..886d06719 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalog.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.Entities +{ + public class SitesCatalog : SitesCatalogBase + { + } +} diff --git a/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs new file mode 100644 index 000000000..85175d6ad --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs @@ -0,0 +1,86 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Tango Observables Generator +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. Do not modify! +// +//------------------------------------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Xml.Serialization; +using Newtonsoft.Json; +using System.Linq; +using Tango.DAL.Remote.DB; +using Tango.Core; +using System.ComponentModel; + +namespace Tango.BL.Entities +{ + [Table("SITES_CATALOGS")] + public abstract class SitesCatalogBase : ObservableEntity + { + + protected String _siteguid; + + /// + /// Gets or sets the sitescatalogbase site guid. + /// + + [Column("SITE_GUID")] + + public String SiteGuid + { + get + { + return _siteguid; + } + + set + { + if (_siteguid != value) + { + _siteguid = value; + + } + } + } + + protected String _catalogguid; + + /// + /// Gets or sets the sitescatalogbase catalog guid. + /// + + [Column("CATALOG_GUID")] + + public String CatalogGuid + { + get + { + return _catalogguid; + } + + set + { + if (_catalogguid != value) + { + _catalogguid = value; + + } + } + } + + /// + /// Initializes a new instance of the class. + /// + public SitesCatalogBase() : base() + { + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs index d47f6514b..4eaf256d2 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs @@ -518,6 +518,14 @@ namespace Tango.BL get; set; } + /// + /// Gets or sets the SitesCatalogs. + /// + public DbSet SitesCatalogs + { + get; set; + } + /// /// Gets or sets the SitesRmls. /// diff --git a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs index 139c90158..c86933713 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs @@ -2249,6 +2249,42 @@ namespace Tango.BL } + private ObservableCollection _sitescatalogs; + /// + /// Gets or sets the SitesCatalogs. + /// + public ObservableCollection SitesCatalogs + { + get + { + return _sitescatalogs; + } + + set + { + _sitescatalogs = value; RaisePropertyChanged(nameof(SitesCatalogs)); + } + + } + + private ICollectionView _sitescatalogsViewSource; + /// + /// Gets or sets the SitesCatalogs View Source. + /// + public ICollectionView SitesCatalogsViewSource + { + get + { + return _sitescatalogsViewSource; + } + + set + { + _sitescatalogsViewSource = value; RaisePropertyChanged(nameof(SitesCatalogsViewSource)); + } + + } + private ObservableCollection _sitesrmls; /// /// Gets or sets the SitesRmls. @@ -2919,6 +2955,8 @@ namespace Tango.BL SitesViewSource = CreateCollectionView(Sites); + SitesCatalogsViewSource = CreateCollectionView(SitesCatalogs); + SitesRmlsViewSource = CreateCollectionView(SitesRmls); SpoolTypesViewSource = CreateCollectionView(SpoolTypes); diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs index e509d0e3c..efa188fec 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs @@ -2249,6 +2249,42 @@ namespace Tango.BL } + private ObservableCollection _sitescatalogs; + /// + /// Gets or sets the SitesCatalogs. + /// + public ObservableCollection SitesCatalogs + { + get + { + return _sitescatalogs; + } + + set + { + _sitescatalogs = value; RaisePropertyChanged(nameof(SitesCatalogs)); + } + + } + + private ICollectionView _sitescatalogsViewSource; + /// + /// Gets or sets the SitesCatalogs View Source. + /// + public ICollectionView SitesCatalogsViewSource + { + get + { + return _sitescatalogsViewSource; + } + + set + { + _sitescatalogsViewSource = value; RaisePropertyChanged(nameof(SitesCatalogsViewSource)); + } + + } + private ObservableCollection _sitesrmls; /// /// Gets or sets the SitesRmls. @@ -2919,6 +2955,8 @@ namespace Tango.BL SitesViewSource = CreateCollectionView(Sites); + SitesCatalogsViewSource = CreateCollectionView(SitesCatalogs); + SitesRmlsViewSource = CreateCollectionView(SitesRmls); SpoolTypesViewSource = CreateCollectionView(SpoolTypes); diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index d75cdc0c1..99855796d 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -84,7 +84,7 @@ GlobalVersionInfo.cs - + @@ -93,6 +93,7 @@ + @@ -236,6 +237,8 @@ + + @@ -339,6 +342,8 @@ + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs index 9f81121ca..3ef793f7f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs @@ -87,6 +87,7 @@ namespace Tango.DAL.Remote.DB public virtual DbSet ROLES_PERMISSIONS { get; set; } public virtual DbSet SEGMENTS { get; set; } public virtual DbSet SITES { get; set; } + public virtual DbSet SITES_CATALOGS { get; set; } public virtual DbSet SITES_RMLS { get; set; } public virtual DbSet SPOOL_TYPES { get; set; } public virtual DbSet SPOOLS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 2c003669e..fe8f0194b 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -933,6 +933,16 @@ + + + + + + + + + + @@ -2252,6 +2262,7 @@ + @@ -2660,6 +2671,7 @@ + @@ -4080,6 +4092,16 @@ + + + + + + + + + + @@ -6351,6 +6373,17 @@ + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index e7b00e86f..6abe85e1b 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,82 +5,83 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/SITES_CATALOGS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/SITES_CATALOGS.cs new file mode 100644 index 000000000..df712045c --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/SITES_CATALOGS.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.DAL.Remote.DB +{ + using System; + using System.Collections.Generic; + + public partial class SITES_CATALOGS + { + public int ID { get; set; } + public string GUID { get; set; } + public System.DateTime LAST_UPDATED { get; set; } + public string SITE_GUID { get; set; } + public string CATALOG_GUID { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj index 4150c2771..75fa9179c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj +++ b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj @@ -264,6 +264,9 @@ RemoteADO.tt + + RemoteADO.tt + RemoteADO.tt diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml index 733b4ae8e..c36c6a9b7 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml differ diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml index 083c7cf12..97dad3717 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml differ -- cgit v1.3.1 From db58a90f0c08242491b96476e228b0d7f4a92a86 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 14 Dec 2019 01:42:51 +0200 Subject: Implemented full transparent color support on infra and PPC! Fixed issue with fine tunning causing delay in job load. Added async support for IColorConverter. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/TCC/TCC.mdf | Bin 8388608 -> 8388608 bytes Software/DB/TCC/TCC_log.ldf | Bin 8388608 -> 8388608 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../PMR/Messages/Exports/JobFileBrushStop.proto | 1 + .../FirmwareUpgrade/VersionFileDescriptor.proto | 4 +- .../Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml | 3 + .../Tango.PPC.Jobs/Controls/RunningJobViewer.xaml | 3 + .../Tango.PPC.Jobs/Images/JobView/transparent.jpg | Bin 0 -> 27097 bytes .../Images/JobView/transparent_small.jpg | Bin 0 -> 10743 bytes .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 8 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 66 ++++-- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 233 ++++++++++++++------- .../PPC/Tango.PPC.Common/Models/FineTuneItem.cs | 2 + .../PPC/Tango.PPC.Common/PPCSettings.cs | 6 + .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 14 ++ .../Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs | 8 + .../Visual_Studio/Tango.BL/Entities/BrushStop.cs | 23 +- .../Tango.BL/Entities/BrushStopBase.cs | 38 ++++ .../Visual_Studio/Tango.BL/Entities/Segment.cs | 4 +- Software/Visual_Studio/Tango.BL/LiquidVolume.cs | 12 ++ .../Tango.ColorConversion/DefaultColorConverter.cs | 24 +++ .../Tango.ColorConversion/IColorConverter.cs | 3 + .../Tango.DAL.Remote/DB/BRUSH_STOPS.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 3 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 154 +++++++------- .../DefaultGradientGenerationConfiguration.cs | 2 +- .../Tango.Integration/Operation/MachineOperator.cs | 27 ++- .../Tango.PMR/Exports/JobFileBrushStop.cs | 36 +++- 31 files changed, 481 insertions(+), 194 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index ec8ed5ec8..a204a2664 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 91c5d6631..38b8da37b 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf index c6f9a4e37..37ed9b842 100644 Binary files a/Software/DB/TCC/TCC.mdf and b/Software/DB/TCC/TCC.mdf differ diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf index bb23dc9c6..616875f6b 100644 Binary files a/Software/DB/TCC/TCC_log.ldf and b/Software/DB/TCC/TCC_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 4b4e5b56d..5650526a0 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 369c83d64..6a5c87335 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Exports/JobFileBrushStop.proto b/Software/PMR/Messages/Exports/JobFileBrushStop.proto index fae9f77c0..bbcedbf4a 100644 --- a/Software/PMR/Messages/Exports/JobFileBrushStop.proto +++ b/Software/PMR/Messages/Exports/JobFileBrushStop.proto @@ -28,4 +28,5 @@ message JobFileBrushStop bool Corrected = 21; string ColorCatalogGuid = 22; string ColorCatalogItemGuid = 23; + bool IsTransparent = 25; } \ No newline at end of file diff --git a/Software/PMR/Messages/FirmwareUpgrade/VersionFileDescriptor.proto b/Software/PMR/Messages/FirmwareUpgrade/VersionFileDescriptor.proto index 9e74cdee6..2907cfd36 100644 --- a/Software/PMR/Messages/FirmwareUpgrade/VersionFileDescriptor.proto +++ b/Software/PMR/Messages/FirmwareUpgrade/VersionFileDescriptor.proto @@ -10,4 +10,6 @@ message VersionFileDescriptor string FileName = 1; string Version = 2; VersionFileDestination Destination = 3; -} \ No newline at end of file +} + +//Do not put type 'bytes' in this file. It will cause the json deserialization to fail !!! \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml index ba6c13e91..afe331145 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml @@ -66,6 +66,9 @@ + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml index 97aedcf89..5d3f3f1fc 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml @@ -57,6 +57,9 @@ + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg new file mode 100644 index 000000000..cf1d94d12 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg new file mode 100644 index 000000000..c682a4c7e Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 02343c0cc..5e1fd39bd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -497,10 +497,16 @@ + + + + + + - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 0a5167900..5ec1c34ec 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -412,7 +412,7 @@ namespace Tango.PPC.Jobs.ViewModels RepeatSampleDyeCommand = new RelayCommand(RepeatSampleDye); AnotherSampleCommand = new RelayCommand(DyeAnotherSample); InvokeFineTuningPaletteCommand = new RelayCommand(InvokeFineTuningPalette); - ResetFineTuningCommand = new RelayCommand(ResetFineTuning); + ResetFineTuningCommand = new RelayCommand(() => ResetFineTuning(true)); StartFineTuningCommand = new RelayCommand(StartFineTuning, () => FineTuneItems.Any(x => x.IsSelected) && CanStartJob()); RepeatFineTuningCommand = new RelayCommand(RepeatFineTuning); ApproveFineTuningCommand = new RelayCommand(ApproveFineTuning); @@ -670,7 +670,7 @@ namespace Tango.PPC.Jobs.ViewModels { return Job != null && Job.Validate(_db) && - !Job.Segments.SelectMany(x => x.BrushStops).ToList().Exists(x => x.IsOutOfGamut); + !Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent).ToList().Exists(x => x.IsOutOfGamut); } #endregion @@ -902,22 +902,28 @@ namespace Tango.PPC.Jobs.ViewModels if (vm == null || vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.MoreOptions) { - conversionOutput = _converter.Convert(brushStop, true); + NotificationProvider.SetGlobalBusyMessage("Generating color hive..."); - suggestions = conversionOutput.CreateHiveSuggestions(); - - if (vm == null) + await Task.Factory.StartNew(() => { - var center = suggestions.GetCenterSuggestion(); - center.Coordinates.Red = brushStop.Red; - center.Coordinates.Green = brushStop.Green; - center.Coordinates.Blue = brushStop.Blue; - - center.Coordinates.L = brushStop.L; - center.Coordinates.A = brushStop.A; - center.Coordinates.B = brushStop.B; - } + conversionOutput = _converter.Convert(brushStop, true); + + suggestions = conversionOutput.CreateHiveSuggestions(); + if (vm == null) + { + var center = suggestions.GetCenterSuggestion(); + center.Coordinates.Red = brushStop.Red; + center.Coordinates.Green = brushStop.Green; + center.Coordinates.Blue = brushStop.Blue; + + center.Coordinates.L = brushStop.L; + center.Coordinates.A = brushStop.A; + center.Coordinates.B = brushStop.B; + } + }); + + NotificationProvider.ReleaseGlobalBusyMessage(); LogManager.Log("Invoking hive color conversion dialog..."); vm = await NotificationProvider.ShowDialog(new AdvancedColorCorrectionViewVM() { @@ -963,6 +969,7 @@ namespace Tango.PPC.Jobs.ViewModels } finally { + NotificationProvider.ReleaseGlobalBusyMessage(); DyeCommand.RaiseCanExecuteChanged(); } } @@ -1112,7 +1119,7 @@ namespace Tango.PPC.Jobs.ViewModels /// /// Synchronizes the fine tune items to brush stops. /// - private void SyncFineTuneItemsToBrushStops() + private async void SyncFineTuneItemsToBrushStops(bool displayBusy = false) { try { @@ -1124,18 +1131,27 @@ namespace Tango.PPC.Jobs.ViewModels } else { + if (displayBusy) + { + NotificationProvider.SetGlobalBusyMessage("Generating suggestions..."); + } + FineTuneItems.Clear(); - foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.ColorSpace.Space == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace.Space == BL.Enumerations.ColorSpaces.LAB).DistinctBy(x => x.Color)) + foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent).Where(x => x.ColorSpace.Space == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace.Space == BL.Enumerations.ColorSpaces.LAB).DistinctBy(x => x.Color)) { - FineTuneItem item = new FineTuneItem(_converter.Convert(stop, true)); + var conversionoutput = await _converter.ConvertAsync(stop, true); + FineTuneItem item = new FineTuneItem(conversionoutput); + item.BrushStop = stop; item.BrushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.Color == stop.Color).ToList(); - item.SelectedSuggestion = item.Suggestions[item.Suggestions.Count / 2]; + item.SelectedSuggestion = item.Suggestions.GetCenterSuggestion(); item.SelectedChanged += () => StartFineTuningCommand.RaiseCanExecuteChanged(); FineTuneItems.Add(item); } _jobs_fine_tune_items[Job.Guid] = FineTuneItems.ToList(); + + NotificationProvider.ReleaseGlobalBusyMessage(); } ApprovalFineTuneItems = FineTuneItems.Where(x => x.IsSelected).ToObservableCollection(); @@ -1147,6 +1163,10 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log(ex, "Error while trying to synchronize fine tuning items with brush stops."); } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + } } /// @@ -1173,19 +1193,23 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Error invoking the fine tunning palette"); await NotificationProvider.ShowError("An error occurred while trying to display the fine tunning palette."); } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + } } /// /// Resets the fine tuning. /// - private void ResetFineTuning() + private void ResetFineTuning(bool displayBusy = false) { if (Job != null && _jobs_fine_tune_items.ContainsKey(Job.Guid)) { _jobs_fine_tune_items.Remove(Job.Guid); } - SyncFineTuneItemsToBrushStops(); + SyncFineTuneItemsToBrushStops(displayBusy); } /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 5f59549dd..9b28d7709 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -26,6 +26,8 @@ + + + @@ -147,6 +164,17 @@ + + + + + + Transparent + + + + + @@ -172,7 +200,10 @@ - + + + + @@ -214,7 +245,11 @@ - + + + + + + + + + + @@ -247,77 +302,90 @@ - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + Transparent + + + + + + + + + + + + + + + + + + + + + + + + @@ -334,13 +402,14 @@ - - - - - + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Models/FineTuneItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Models/FineTuneItem.cs index 2eea5c3ce..c03be1ae9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Models/FineTuneItem.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Models/FineTuneItem.cs @@ -18,6 +18,8 @@ namespace Tango.PPC.Common.Models { public event Action SelectedChanged; + public BrushStop BrushStop { get; set; } + /// /// Gets or sets the brush stops. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 2f470df12..acdfb6a8a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -204,6 +204,11 @@ namespace Tango.PPC.Common /// public String LastPowerUpSelectedRmlGuid { get; set; } + /// + /// Gets or sets a value indicating whether to display the power up screen. + /// + public bool DisplayPowerUpScreen { get; set; } + /// /// Gets or sets the power up screen timeout. /// @@ -248,6 +253,7 @@ namespace Tango.PPC.Common SynchronizeDiagnostics = true; SynchronizationInterval = TimeSpan.FromMinutes(60); FirmwareVersion = "1.0.0.0"; + DisplayPowerUpScreen = true; PowerUpScreenTimeout = TimeSpan.FromSeconds(20); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index c3fa97d13..8a4d20b76 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -101,10 +101,18 @@ namespace Tango.PPC.UI.ViewModels { LogManager.Log("Power up detected, showing power up screen..."); + if (!Settings.DisplayPowerUpScreen) + { + LogManager.Log("Power up screen disabled. skipping..."); + return; + } + PowerUpViewVM vm; try { + LogManager.Log("Loading site rmls..."); + List rmls = new List(); using (ObservablesContext db = ObservablesContext.CreateDefault()) @@ -131,6 +139,8 @@ namespace Tango.PPC.UI.ViewModels await Task.Factory.StartNew(() => { + LogManager.Log("Power up screen closed."); + try { using (ObservablesContext db = ObservablesContext.CreateDefault()) @@ -139,16 +149,20 @@ namespace Tango.PPC.UI.ViewModels if (vm.IsSelectedRml) { + LogManager.Log($"Selected rml '{vm.SelectedRml.Name}'..."); processTables = new RmlBuilder(db).Set(vm.SelectedRml.Guid).WithActiveParametersGroup().Build().GetActiveProcessGroup().ProcessParametersTables.ToList(); } else { + LogManager.Log("Selected minimal temperature..."); var rmlsToAvg = new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).WithActiveParametersGroup().Build(); processTables = rmlsToAvg.Select(x => x.GetActiveProcessGroup()).SelectMany(x => x.ProcessParametersTables).ToList(); } var processToLoad = processTables.OrderBy(x => x.GetAverageTemperature()).First(); + LogManager.Log($"Selected process parameters:\nRML: {processToLoad.ProcessParametersTablesGroup.Rml.Name}\nGroup: {processToLoad.ProcessParametersTablesGroup.Name}\nProcess Table: {processToLoad.Name}"); + LogManager.Log("Uploading process parameters..."); var r = MachineProvider.MachineOperator.UploadProcessParameters(processToLoad).Result; Settings.LastPowerUpSelectedRmlGuid = vm.IsSelectedRml ? vm.SelectedRml.Guid : null; diff --git a/Software/Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs index 41fa3ed57..e561871d7 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs @@ -285,5 +285,13 @@ namespace Tango.BL.DTO get; set; } + /// + /// is transparent + /// + public Boolean IsTransparent + { + get; set; + } + } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs index 8c755455f..b4655c8e6 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs @@ -79,6 +79,7 @@ namespace Tango.BL.Entities _colorPropertyNames.Add(nameof(Color)); _colorPropertyNames.Add(nameof(ColorCatalogsItem)); + _colorPropertyNames.Add(nameof(IsTransparent)); } /// @@ -283,7 +284,7 @@ namespace Tango.BL.Entities [JsonIgnore] public bool IsOutOfGamut { - get { return _isOutOfGamut; } + get { return _isOutOfGamut && !IsTransparent; } set { if (_isOutOfGamut != value) @@ -621,6 +622,17 @@ namespace Tango.BL.Entities PerformColorSynchronization(propName); } + protected override void OnIsTransparentChanged(bool istransparent) + { + base.OnIsTransparentChanged(istransparent); + RaisePropertyChanged(nameof(IsOutOfGamut)); + OutOfGamutChecked = false; + if (Segment != null) + { + Segment.RaiseHasOutOfGamutBrushStop(); + } + } + #endregion #region Properties Changed @@ -717,7 +729,14 @@ namespace Tango.BL.Entities try { var tables = Segment.Job.Rml.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); - return (tables[1].MaxInkUptake / tables[0].MaxInkUptake) * 100; + if (tables.Count > 1) + { + return (tables[1].MaxInkUptake / tables[0].MaxInkUptake) * 100; + } + else + { + return MAX_TOTAL_LIQUID_VOLUME; + } } catch { diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs index e02d3f613..0f742cc0b 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs @@ -84,6 +84,8 @@ namespace Tango.BL.Entities public event EventHandler CorrectedChanged; + public event EventHandler IsTransparentChanged; + public event EventHandler ColorCatalogChanged; public event EventHandler ColorCatalogsItemChanged; @@ -979,6 +981,33 @@ namespace Tango.BL.Entities } } + protected Boolean _istransparent; + + /// + /// Gets or sets the brushstopbase is transparent. + /// + + [Column("IS_TRANSPARENT")] + + public Boolean IsTransparent + { + get + { + return _istransparent; + } + + set + { + if (_istransparent != value) + { + _istransparent = value; + + OnIsTransparentChanged(value); + + } + } + } + protected ColorCatalog _colorcatalog; /// @@ -1368,6 +1397,15 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(Corrected)); } + /// + /// Called when the IsTransparent has changed. + /// + protected virtual void OnIsTransparentChanged(Boolean istransparent) + { + IsTransparentChanged?.Invoke(this, istransparent); + RaisePropertyChanged(nameof(IsTransparent)); + } + /// /// Called when the ColorCatalog has changed. /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/Segment.cs b/Software/Visual_Studio/Tango.BL/Entities/Segment.cs index 56d863299..ab0211b73 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Segment.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Segment.cs @@ -228,7 +228,7 @@ namespace Tango.BL.Entities foreach (var stop in BrushStops.ToList().OrderBy(x => x.StopIndex).ToList()) { - stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); + stops.Add(new GradientStop(stop.IsTransparent ? Colors.Transparent : stop.Color, stop.OffsetPercent / 100d)); } LinearGradientBrush brush = new LinearGradientBrush(); @@ -244,7 +244,7 @@ namespace Tango.BL.Entities { for (int i = 0; i < BrushStops.Count; i++) { - _brush.GradientStops[i].Color = BrushStops[i].Color; + _brush.GradientStops[i].Color = BrushStops[i].IsTransparent ? Colors.Transparent : BrushStops[i].Color; _brush.GradientStops[i].Offset = BrushStops[i].OffsetPercent / 100d; } diff --git a/Software/Visual_Studio/Tango.BL/LiquidVolume.cs b/Software/Visual_Studio/Tango.BL/LiquidVolume.cs index 723356ef6..793f94212 100644 --- a/Software/Visual_Studio/Tango.BL/LiquidVolume.cs +++ b/Software/Visual_Studio/Tango.BL/LiquidVolume.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Tango.Core; using Tango.BL.Dispensing; using Tango.BL.Entities; +using Tango.BL.Enumerations; namespace Tango.BL { @@ -66,6 +67,12 @@ namespace Tango.BL } } + [JsonIgnore] + public LiquidTypes LiquidType + { + get { return (LiquidTypes)IdsPack.LiquidType.Code; } + } + [JsonIgnore] public DispenserStepDivisions DispenserStepDivision { @@ -203,5 +210,10 @@ namespace Tango.BL cloned.Volume = Volume; return cloned; } + + public override string ToString() + { + return $"{LiquidType}, {Volume}"; + } } } diff --git a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs index 7137145f8..14569fdc0 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs @@ -272,5 +272,29 @@ namespace Tango.ColorConversion return processParameters; } + + public Task ConvertAsync(BrushStop stop, Configuration configuration, Rml rml, bool generateHive) + { + return Task.Factory.StartNew(() => + { + return Convert(stop, configuration, rml, generateHive); + }); + } + + public Task ConvertAsync(BrushStop stop, bool generateHive) + { + return Task.Factory.StartNew(() => + { + return Convert(stop, generateHive); + }); + } + + public Task ConvertAsync(Job job, Color color, bool generateHive) + { + return Task.Factory.StartNew(() => + { + return Convert(job, color, generateHive); + }); + } } } diff --git a/Software/Visual_Studio/Tango.ColorConversion/IColorConverter.cs b/Software/Visual_Studio/Tango.ColorConversion/IColorConverter.cs index 64615f4ae..5206509a9 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/IColorConverter.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/IColorConverter.cs @@ -18,6 +18,9 @@ namespace Tango.ColorConversion ConversionOutput Convert(BrushStop stop, Configuration configuration, Rml rml, bool generateHive); ConversionOutput Convert(BrushStop stop, bool generateHive); ConversionOutput Convert(Job job, Color color, bool generateHive); + Task ConvertAsync(BrushStop stop, Configuration configuration, Rml rml, bool generateHive); + Task ConvertAsync(BrushStop stop, bool generateHive); + Task ConvertAsync(Job job, Color color, bool generateHive); bool IsOutOfGamut(BrushStop stop); ProcessParametersTable GetRecommendedProcessParameters(Job job); ProcessParametersTable GetRecommendedProcessParameters(Job job, ProcessParametersTablesGroup group); diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs index 60d4a2e98..6ba539edb 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs @@ -50,6 +50,7 @@ namespace Tango.DAL.Remote.DB public bool CORRECTED { get; set; } public string COLOR_CATALOG_GUID { get; set; } public string COLOR_CATALOGS_ITEM_GUID { get; set; } + public bool IS_TRANSPARENT { get; set; } public virtual COLOR_CATALOGS COLOR_CATALOGS { get; set; } public virtual COLOR_CATALOGS_ITEMS COLOR_CATALOGS_ITEMS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index fe8f0194b..83e251c1e 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -90,6 +90,7 @@ + @@ -3110,6 +3111,7 @@ + @@ -5436,6 +5438,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 6abe85e1b..77b14d7c2 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,83 +5,83 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs index acc0c6723..42ad58c17 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs @@ -92,7 +92,7 @@ namespace Tango.Integration.Operation stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters); } - if (stop.BrushColorSpace == ColorSpaces.RGB || stop.BrushColorSpace == ColorSpaces.LAB) + if ((stop.BrushColorSpace == ColorSpaces.RGB || stop.BrushColorSpace == ColorSpaces.LAB) && !stop.IsTransparent) { var output = converter.Convert(segment.Job, stop.Color, false); output.ApplyOnBrushStop(stop, processParameters); diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 6baefa370..a96693bdf 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -1707,7 +1707,7 @@ namespace Tango.Integration.Operation if (stop.ColorCatalogsItem.Cyan > 0) { - var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Cyan.ToInt32()); + var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Cyan); if (liquidVolume == null) { @@ -1719,7 +1719,7 @@ namespace Tango.Integration.Operation if (stop.ColorCatalogsItem.Magenta > 0) { - var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Magenta.ToInt32()); + var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Magenta); if (liquidVolume == null) { @@ -1731,7 +1731,7 @@ namespace Tango.Integration.Operation if (stop.ColorCatalogsItem.Yellow > 0) { - var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Yellow.ToInt32()); + var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Yellow); if (liquidVolume == null) { @@ -1743,7 +1743,7 @@ namespace Tango.Integration.Operation if (stop.ColorCatalogsItem.Black > 0) { - var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Black.ToInt32()); + var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Black); if (liquidVolume == null) { @@ -1770,7 +1770,7 @@ namespace Tango.Integration.Operation if (job.EnableLubrication) { - var lubricantVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack != null && x.IdsPack.LiquidType != null && x.IdsPack.LiquidType.Code == LiquidTypes.Lubricant.ToInt32()); + var lubricantVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack != null && x.IdsPack.LiquidType != null && x.LiquidType == LiquidTypes.Lubricant); if (lubricantVolume != null) { @@ -1807,6 +1807,23 @@ namespace Tango.Integration.Operation job.NumberOfUnits = 1; } + //Modify transparent brush stops. (Transparent stops should be all zeros and 100% TI) + foreach (var stop in job.Segments.SelectMany(x => x.BrushStops).Where(x => x.IsTransparent).ToList()) + { + foreach (var liquidVolume in stop.LiquidVolumes.Where(x => x.LiquidType != LiquidTypes.TransparentInk && x.LiquidType != LiquidTypes.Lubricant).ToList()) + { + liquidVolume.Volume = 0; + } + + var tiLiquid = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack != null && x.IdsPack.LiquidType != null && x.LiquidType == LiquidTypes.TransparentInk); + + if (tiLiquid != null) + { + tiLiquid.Volume = 100; + } + } + //Modify transparent brush stops. + if (EnableJobLiquidQuantityValidation) { ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration); diff --git a/Software/Visual_Studio/Tango.PMR/Exports/JobFileBrushStop.cs b/Software/Visual_Studio/Tango.PMR/Exports/JobFileBrushStop.cs index 36da58b4e..2b4d84ac6 100644 --- a/Software/Visual_Studio/Tango.PMR/Exports/JobFileBrushStop.cs +++ b/Software/Visual_Studio/Tango.PMR/Exports/JobFileBrushStop.cs @@ -23,7 +23,7 @@ namespace Tango.PMR.Exports { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChZKb2JGaWxlQnJ1c2hTdG9wLnByb3RvEhFUYW5nby5QTVIuRXhwb3J0cxoZ", - "Sm9iRmlsZUxpcXVpZFZvbHVtZS5wcm90byLUAgoQSm9iRmlsZUJydXNoU3Rv", + "Sm9iRmlsZUxpcXVpZFZvbHVtZS5wcm90byLrAgoQSm9iRmlsZUJydXNoU3Rv", "cBIWCg5Db2xvclNwYWNlR3VpZBgBIAEoCRIVCg1PZmZzZXRQZXJjZW50GAIg", "ASgBEgwKBEN5YW4YAyABKAESDwoHTWFnZW50YRgEIAEoARIOCgZZZWxsb3cY", "BSABKAESDQoFQmxhY2sYBiABKAESCwoDUmVkGAcgASgFEg0KBUdyZWVuGAgg", @@ -31,12 +31,12 @@ namespace Tango.PMR.Exports { "DCABKAESPQoNTGlxdWlkVm9sdW1lcxgYIAMoCzImLlRhbmdvLlBNUi5FeHBv", "cnRzLkpvYkZpbGVMaXF1aWRWb2x1bWUSEQoJQ29ycmVjdGVkGBUgASgIEhgK", "EENvbG9yQ2F0YWxvZ0d1aWQYFiABKAkSHAoUQ29sb3JDYXRhbG9nSXRlbUd1", - "aWQYFyABKAlCHQobY29tLnR3aW5lLnRhbmdvLnBtci5leHBvcnRzYgZwcm90", - "bzM=")); + "aWQYFyABKAkSFQoNSXNUcmFuc3BhcmVudBgZIAEoCEIdChtjb20udHdpbmUu", + "dGFuZ28ucG1yLmV4cG9ydHNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Exports.JobFileLiquidVolumeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Exports.JobFileBrushStop), global::Tango.PMR.Exports.JobFileBrushStop.Parser, new[]{ "ColorSpaceGuid", "OffsetPercent", "Cyan", "Magenta", "Yellow", "Black", "Red", "Green", "Blue", "L", "A", "B", "LiquidVolumes", "Corrected", "ColorCatalogGuid", "ColorCatalogItemGuid" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Exports.JobFileBrushStop), global::Tango.PMR.Exports.JobFileBrushStop.Parser, new[]{ "ColorSpaceGuid", "OffsetPercent", "Cyan", "Magenta", "Yellow", "Black", "Red", "Green", "Blue", "L", "A", "B", "LiquidVolumes", "Corrected", "ColorCatalogGuid", "ColorCatalogItemGuid", "IsTransparent" }, null, null, null) })); } #endregion @@ -83,6 +83,7 @@ namespace Tango.PMR.Exports { corrected_ = other.corrected_; colorCatalogGuid_ = other.colorCatalogGuid_; colorCatalogItemGuid_ = other.colorCatalogItemGuid_; + isTransparent_ = other.isTransparent_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -265,6 +266,17 @@ namespace Tango.PMR.Exports { } } + /// Field number for the "IsTransparent" field. + public const int IsTransparentFieldNumber = 25; + private bool isTransparent_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool IsTransparent { + get { return isTransparent_; } + set { + isTransparent_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as JobFileBrushStop); @@ -294,6 +306,7 @@ namespace Tango.PMR.Exports { if (Corrected != other.Corrected) return false; if (ColorCatalogGuid != other.ColorCatalogGuid) return false; if (ColorCatalogItemGuid != other.ColorCatalogItemGuid) return false; + if (IsTransparent != other.IsTransparent) return false; return true; } @@ -316,6 +329,7 @@ namespace Tango.PMR.Exports { if (Corrected != false) hash ^= Corrected.GetHashCode(); if (ColorCatalogGuid.Length != 0) hash ^= ColorCatalogGuid.GetHashCode(); if (ColorCatalogItemGuid.Length != 0) hash ^= ColorCatalogItemGuid.GetHashCode(); + if (IsTransparent != false) hash ^= IsTransparent.GetHashCode(); return hash; } @@ -387,6 +401,10 @@ namespace Tango.PMR.Exports { output.WriteString(ColorCatalogItemGuid); } liquidVolumes_.WriteTo(output, _repeated_liquidVolumes_codec); + if (IsTransparent != false) { + output.WriteRawTag(200, 1); + output.WriteBool(IsTransparent); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -438,6 +456,9 @@ namespace Tango.PMR.Exports { if (ColorCatalogItemGuid.Length != 0) { size += 2 + pb::CodedOutputStream.ComputeStringSize(ColorCatalogItemGuid); } + if (IsTransparent != false) { + size += 2 + 1; + } return size; } @@ -492,6 +513,9 @@ namespace Tango.PMR.Exports { if (other.ColorCatalogItemGuid.Length != 0) { ColorCatalogItemGuid = other.ColorCatalogItemGuid; } + if (other.IsTransparent != false) { + IsTransparent = other.IsTransparent; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -566,6 +590,10 @@ namespace Tango.PMR.Exports { liquidVolumes_.AddEntriesFrom(input, _repeated_liquidVolumes_codec); break; } + case 200: { + IsTransparent = input.ReadBool(); + break; + } } } } -- cgit v1.3.1 From 1208554e06da8aec1b074932df488769572ffcfb Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 19 Dec 2019 18:01:01 +0200 Subject: Implemented auto thread loading. Implemented advanced settings for technician. Implemented thread loading on emulator. Removed PowerUpSelectedRML from settings. Now using LoadedRml settings for ThreadLoading and PowerUp. --- Software/PMR/Messages/Common/MessageType.proto | 2 + .../ThreadLoading/StopThreadLoadingRequest.proto | 9 ++ .../ThreadLoading/StopThreadLoadingResponse.proto | 9 ++ .../Tango.PPC.MachineSettings/Views/MainView.xaml | 62 +++++++- .../Connection/DefaultMachineProvider.cs | 3 +- .../PPC/Tango.PPC.Common/PPCSettings.cs | 25 ++- .../PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml | 2 +- .../Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml | 47 ++++++ .../Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml.cs | 28 ++++ .../Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs | 155 +++++++++++++++++++ .../PPC/Tango.PPC.UI/Images/thread_loading.gif | Bin 0 -> 4467469 bytes .../PPC/Tango.PPC.UI/Images/thread_loading.png | Bin 0 -> 7209 bytes .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 12 +- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 76 ++++++++- .../Tango.BL/Entities/ProcessParametersTable.cs | 8 + .../Tango.Emulations/Emulators/MachineEmulator.cs | 64 +++++++- .../ExternalBridge/EmulatorExternalBridge.cs | 1 + .../ExternalBridge/ExternalBridgeTcpClient.cs | 1 + .../Operation/IMachineOperator.cs | 31 ++++ .../Tango.Integration/Operation/MachineOperator.cs | 170 ++++++++++++++++++++- .../ThreadLoadingConfirmationRequiredEventArgs.cs | 27 ++++ .../Tango.Integration/Tango.Integration.csproj | 3 +- .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 9 +- .../Tango.PMR/Power/PowerDownState.cs | 28 +++- Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 4 +- .../ThreadLoading/StopThreadLoadingRequest.cs | 131 ++++++++++++++++ .../ThreadLoading/StopThreadLoadingResponse.cs | 131 ++++++++++++++++ .../Tango.MachineEM.UI/ViewModels/MainViewVM.cs | 33 ++++ .../Tango.MachineEM.UI/Views/MainView.xaml | 143 +++++++++-------- 29 files changed, 1124 insertions(+), 90 deletions(-) create mode 100644 Software/PMR/Messages/ThreadLoading/StopThreadLoadingRequest.proto create mode 100644 Software/PMR/Messages/ThreadLoading/StopThreadLoadingResponse.proto create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.gif create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.png create mode 100644 Software/Visual_Studio/Tango.Integration/Operation/ThreadLoadingConfirmationRequiredEventArgs.cs create mode 100644 Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingResponse.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs') diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index 65acd1054..3e5b54456 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -278,4 +278,6 @@ enum MessageType StartThreadLoadingResponse = 11001; ContinueThreadLoadingRequest = 11002; ContinueThreadLoadingResponse = 11003; + StopThreadLoadingRequest = 11004; + StopThreadLoadingResponse = 11005; } diff --git a/Software/PMR/Messages/ThreadLoading/StopThreadLoadingRequest.proto b/Software/PMR/Messages/ThreadLoading/StopThreadLoadingRequest.proto new file mode 100644 index 000000000..03f5df91f --- /dev/null +++ b/Software/PMR/Messages/ThreadLoading/StopThreadLoadingRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.ThreadLoading; +option java_package = "com.twine.tango.pmr.threadloading"; + +message StopThreadLoadingRequest +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/ThreadLoading/StopThreadLoadingResponse.proto b/Software/PMR/Messages/ThreadLoading/StopThreadLoadingResponse.proto new file mode 100644 index 000000000..4725d3647 --- /dev/null +++ b/Software/PMR/Messages/ThreadLoading/StopThreadLoadingResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.ThreadLoading; +option java_package = "com.twine.tango.pmr.threadloading"; + +message StopThreadLoadingResponse +{ + +} \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 4a2f1e253..5f453c874 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -11,7 +11,7 @@ xmlns:global="clr-namespace:Tango.PPC.MachineSettings" xmlns:local="clr-namespace:Tango.PPC.MachineSettings.Views" mc:Ignorable="d" - d:DesignHeight="3000" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + d:DesignHeight="3600" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> @@ -242,12 +242,70 @@ - Once enabled, synchronization occurres automatically in the background. you can choose to synchronize right now. + Once enabled, synchronization occurs automatically in the background. you can choose to synchronize right now. Synchronize Now + + + + + + + Embedded COM Port + + + + + Emergency COM Port + + + + + Enable Emergency Screen + + + + + Enable Embedded Debug Logs + + + + + Enable Automatic Thread Loading Support + + + + + Display PowerUp Screen + + + + + Enable Job Liquid Quantity Validation + + + + + Always Start in Technician Mode + + + + + Gradient Resolution CM + + + + + + + Please restart the application for advanced settings to take effect. + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index eae09a7e7..6d90ece73 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -82,7 +82,8 @@ namespace Tango.PPC.Common.Connection MachineOperator.UseKeepAlive = true; MachineOperator.EnableMachineStatusUpdates = true; MachineOperator.EnableDiagnostics = false; - MachineOperator.EnableEmbeddedDebugging = true; + MachineOperator.EnableEmbeddedDebugging = settings.EnableEmbeddedDebugLogs; + MachineOperator.EnableAutomaticThreadLoading = settings.EnableAutomaticThreadLoading; MachineOperator.FirmwareUpgradeMode = Integration.Upgrade.FirmwareUpgradeModes.DFU | Integration.Upgrade.FirmwareUpgradeModes.TFP_PACKAGE; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index cb17f5be3..96fe39a9b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -199,11 +199,6 @@ namespace Tango.PPC.Common /// public String FirmwareVersion { get; set; } - /// - /// Gets or sets the last power up selected RML. - /// - public String LastPowerUpSelectedRmlGuid { get; set; } - /// /// Gets or sets a value indicating whether to display the power up screen. /// @@ -219,6 +214,21 @@ namespace Tango.PPC.Common /// public bool AutoCheckForUpdates { get; set; } + /// + /// Gets or sets a value indicating whether to enable the automatic thread loading support. + /// + public bool EnableAutomaticThreadLoading { get; set; } + + /// + /// Gets or sets a value indicating whether to display the thread loading screen. + /// + public bool DisplayAutomaticThreadLoadingScreen { get; set; } + + /// + /// Gets or sets a value indicating whether to enable embedded debug logs. + /// + public bool EnableEmbeddedDebugLogs { get; set; } + /// /// Gets the machine service address. /// @@ -259,8 +269,11 @@ namespace Tango.PPC.Common SynchronizationInterval = TimeSpan.FromMinutes(60); FirmwareVersion = "1.0.0.0"; DisplayPowerUpScreen = true; - PowerUpScreenTimeout = TimeSpan.FromSeconds(20); + PowerUpScreenTimeout = TimeSpan.FromSeconds(60); AutoCheckForUpdates = true; + EnableAutomaticThreadLoading = true; + DisplayAutomaticThreadLoadingScreen = true; + EnableEmbeddedDebugLogs = true; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml index 776233955..28f922898 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml @@ -20,7 +20,7 @@ Minimal temperature - CONTINUE + CONTINUE auto select in diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml new file mode 100644 index 000000000..98f2e1381 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml @@ -0,0 +1,47 @@ + + + + + + Thread Loading + + + + + The machine is ready for loading the thread. Please load the selected thread below and press 'continue'. + + + CONTINUE + + + + The machine is now loading the thread. please wait... + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml.cs new file mode 100644 index 000000000..d4c737bcc --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Dialogs +{ + /// + /// Interaction logic for PowerUpView.xaml + /// + public partial class ThreadLoadingView : UserControl + { + public ThreadLoadingView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs new file mode 100644 index 000000000..5e5370416 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.Integration.Operation; +using Tango.PMR.ThreadLoading; +using Tango.PPC.Common.Connection; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class ThreadLoadingViewVM : DialogViewVM + { + public class ThreadLoadingResult + { + public bool IsCompleted { get; set; } + public Exception FailedException { get; set; } + } + + private ThreadLoadingConfirmationRequiredEventArgs _confirmationArgs; + + public ThreadLoadingResult Result { get; set; } + + public IMachineProvider MachineProvider { get; set; } + + private StartThreadLoadingResponse _status; + public StartThreadLoadingResponse Status + { + get { return _status; } + set { _status = value; RaisePropertyChangedAuto(); } + } + + private bool _isFinalizing; + public bool IsFinalizing + { + get { return _isFinalizing; } + set { _isFinalizing = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public List Rmls { get; set; } + + private Rml _selectedRml; + public Rml SelectedRml + { + get { return _selectedRml; } + set { _selectedRml = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public RelayCommand ContinueCommand { get; set; } + + public ThreadLoadingViewVM(IMachineProvider machineProvider, ThreadLoadingConfirmationRequiredEventArgs confirmationArgs) + { + CanClose = true; + _confirmationArgs = confirmationArgs; + ContinueCommand = new RelayCommand(ContinueThreadLoading, () => !IsFinalizing && SelectedRml != null); + MachineProvider = machineProvider; + MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged; + MachineProvider.MachineOperator.ThreadLoadingCompleted += MachineOperator_ThreadLoadingCompleted; + MachineProvider.MachineOperator.ThreadLoadingFailed += MachineOperator_ThreadLoadingFailed; + } + + private async void ContinueThreadLoading() + { + IsFinalizing = true; + + try + { + await Task.Factory.StartNew(() => { _confirmationArgs.Confirm(SelectedRml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault()); }); + } + catch (Exception ex) + { + Result = new ThreadLoadingResult() + { + FailedException = ex, + }; + + IsFinalizing = false; + + if (IsVisible) + { + InvokeUI(() => + { + Accept(); + }); + } + } + } + + private void MachineOperator_ThreadLoadingCompleted(object sender, StartThreadLoadingResponse e) + { + Result = new ThreadLoadingResult() + { + IsCompleted = true + }; + + if (IsVisible) + { + InvokeUI(() => + { + Accept(); + }); + } + } + + private void MachineOperator_ThreadLoadingFailed(object sender, StartThreadLoadingResponse e) + { + Result = new ThreadLoadingResult() + { + FailedException = new Exception(e.ErrorReason), + }; + + if (IsVisible) + { + InvokeUI(() => + { + Accept(); + }); + } + } + + private void MachineOperator_ThreadLoadingStatusChanged(object sender, StartThreadLoadingResponse e) + { + Status = e; + + if(Status.State == ThreadLoadingState.Finalizing) + { + IsFinalizing = true; + } + } + + protected override void Cancel() + { + IsFinalizing = false; + ClearEvents(); + base.Cancel(); + } + + protected override void Accept() + { + IsFinalizing = false; + ClearEvents(); + base.Accept(); + } + + private void ClearEvents() + { + MachineProvider.MachineOperator.ThreadLoadingStatusChanged -= MachineOperator_ThreadLoadingStatusChanged; + MachineProvider.MachineOperator.ThreadLoadingCompleted -= MachineOperator_ThreadLoadingCompleted; + MachineProvider.MachineOperator.ThreadLoadingFailed -= MachineOperator_ThreadLoadingFailed; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.gif new file mode 100644 index 000000000..a89f37004 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.png new file mode 100644 index 000000000..5d536e7ae Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 49b0c81d1..0dbabbf56 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -136,6 +136,9 @@ InsufficientLiquidQuantityView.xaml + + ThreadLoadingView.xaml + PowerUpView.xaml @@ -149,6 +152,7 @@ + UpdateFromFileView.xaml @@ -246,6 +250,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -409,6 +417,8 @@ + + @@ -671,7 +681,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index 8a4d20b76..eeb11ffab 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -63,6 +63,7 @@ namespace Tango.PPC.UI.ViewModels base.OnApplicationReady(); MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived; MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted; + MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired += MachineOperator_ThreadLoadingConfirmationRequired; } #region Event Handlers @@ -120,7 +121,7 @@ namespace Tango.PPC.UI.ViewModels rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildListAsync(); } - var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LastPowerUpSelectedRmlGuid); + var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LoadedRmlGuid); vm = new PowerUpViewVM(); vm.Rmls = rmls; @@ -165,7 +166,7 @@ namespace Tango.PPC.UI.ViewModels LogManager.Log("Uploading process parameters..."); var r = MachineProvider.MachineOperator.UploadProcessParameters(processToLoad).Result; - Settings.LastPowerUpSelectedRmlGuid = vm.IsSelectedRml ? vm.SelectedRml.Guid : null; + Settings.LoadedRmlGuid = vm.IsSelectedRml ? vm.SelectedRml.Guid : null; Settings.Save(); } } @@ -177,6 +178,77 @@ namespace Tango.PPC.UI.ViewModels }); } + private async void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e) + { + LogManager.Log("Thread loading confirmation detected, showing thread loading screen..."); + + if (!Settings.DisplayAutomaticThreadLoadingScreen) + { + LogManager.Log("Thread loading screen disabled. skipping..."); + return; + } + + ThreadLoadingViewVM vm; + + try + { + LogManager.Log("Loading site rmls..."); + + List rmls = new List(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).WithActiveParametersGroup().BuildListAsync(); + } + + var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LoadedRmlGuid); + + vm = new ThreadLoadingViewVM(MachineProvider, e); + vm.Rmls = rmls; + vm.SelectedRml = selectedRml != null ? selectedRml : rmls.FirstOrDefault(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error initializing thread loading screen."); + return; + } + + InvokeUI(async () => + { + await NotificationProvider.ShowDialog(vm); + + LogManager.Log("Thread loading screen closed."); + + if (!vm.DialogResult) + { + LogManager.Log("Thread loading screen aborted by user. No operation was performed."); + return; + } + + try + { + if (vm.Result.IsCompleted) + { + await NotificationProvider.ShowSuccess("Thread loading completed successfully."); + } + else + { + await NotificationProvider.ShowError($"Thread loading failed due to the following reason:\n{vm.Result.FailedException.FlattenException()}"); + } + + if (vm.SelectedRml != null) + { + Settings.LoadedRmlGuid = vm.SelectedRml.Guid; + Settings.Save(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error occurred after thread loading screen closed."); + } + }); + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs index a0df58c08..729d01951 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs @@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.ExtensionMethods; namespace Tango.BL.Entities { @@ -58,5 +59,12 @@ namespace Tango.BL.Entities return heaters.Average(); } + + public PMR.Printing.ProcessParameters ToProcessParametersPMR() + { + PMR.Printing.ProcessParameters p = new PMR.Printing.ProcessParameters(); + this.MapPrimitivesTo(p); + return p; + } } } diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index e4b081e9e..7537e4676 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -33,6 +33,7 @@ using System.Diagnostics; using Tango.Core.ExtensionMethods; using Tango.PMR.MachineStatus; using Tango.PMR.Power; +using Tango.PMR.ThreadLoading; namespace Tango.Emulations.Emulators { @@ -51,6 +52,7 @@ namespace Tango.Emulations.Emulators } private const int MAX_CHUNK_LENGTH = 4000; + private static Random _rnd = new Random(); private StartDiagnosticsRequest _diagnosticsRequest; private bool _cancelJob; private List _motorJoggingRequestTypes; @@ -76,6 +78,8 @@ namespace Tango.Emulations.Emulators private FileUploadRequest _lastFileUploadRequest; private bool _isAfterReset; private bool _abortPowerDown; + private bool _isThreadLoadingStarted; + private String _threadLoadingToken; #region Properties @@ -405,6 +409,12 @@ namespace Tango.Emulations.Emulators case MessageType.AbortPowerDownRequest: HandleAbortPowerDownRequest(MessageFactory.ParseTangoMessageFromContainer(container)); break; + case MessageType.StartThreadLoadingRequest: + HandleStartThreadLoadingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; + case MessageType.ContinueThreadLoadingRequest: + HandleContinueThreadLoadingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; } } @@ -1383,7 +1393,7 @@ namespace Tango.Emulations.Emulators { ProgressPercentage = 100, Message = "Machine is turned off", - State = PowerDownState.Completed + State = PowerDownState.PowerOffCompleted }, request.Container.Token, true); }); } @@ -1395,6 +1405,38 @@ namespace Tango.Emulations.Emulators await Transporter.SendResponse(new AbortPowerDownResponse(), request.Container.Token); } + private async void HandleStartThreadLoadingRequest(TangoMessage request) + { + _isThreadLoadingStarted = true; + _threadLoadingToken = request.Container.Token; + await Transporter.SendResponse(new StartThreadLoadingResponse(), request.Container.Token); + } + + private async void HandleContinueThreadLoadingRequest(TangoMessage request) + { + if (_threadLoadingToken != null) + { + await Transporter.SendResponse(new ContinueThreadLoadingResponse(), request.Container.Token); + + await Task.Delay(1000); + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.Finalizing }, _threadLoadingToken); + await Task.Delay(8000); + + if (_rnd.Next(0, 100) > 50) + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.Completed }, _threadLoadingToken); + } + else + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator random error." }, _threadLoadingToken); + } + } + else + { + await Transporter.SendResponse(new ContinueThreadLoadingResponse(), request.Container.Token, null, ErrorCode.GeneralError, "StartThreadLoadingRequest was never sent."); + } + } + #endregion #region Public Methods @@ -1410,6 +1452,26 @@ namespace Tango.Emulations.Emulators return response.Message.Index; } + public async void StartThreadLoading() + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.ReadyForLoading }, _threadLoadingToken); + } + + public async void FinalizeThreadLoading() + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.Finalizing }, _threadLoadingToken); + await Task.Delay(3000); + + if (_rnd.Next(0, 100) > 50) + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.Completed }, _threadLoadingToken); + } + else + { + await Transporter.SendResponse(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator random error." }, _threadLoadingToken); + } + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs b/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs index c1aaa3cd6..1fba528f8 100644 --- a/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs +++ b/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs @@ -44,6 +44,7 @@ namespace Tango.Emulations.ExternalBridge EnableDiagnostics = true; EnableEmbeddedDebugging = true; EnableEventsNotification = true; + EnableAutomaticThreadLoading = true; String address = new string(Guid.NewGuid().ToString().Replace("-", "").TakeLast(4).ToArray()); diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs index 3bbef3eb6..d3344aa16 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs @@ -133,6 +133,7 @@ namespace Tango.Integration.ExternalBridge OnEnableEventsNotification(EnableEventsNotification); OnEnableApplicationLogsChanged(EnableApplicationLogs); OnEnableMachineStatusUpdatesChanged(EnableMachineStatusUpdates); + OnEnableAutomaticThreadLoadingChanged(EnableAutomaticThreadLoading); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index b5b7b7393..8156ef8c7 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -23,6 +23,7 @@ using Tango.PMR.FirmwareUpgrade; using Tango.Integration.JobRuns; using Tango.Integration.Emergency; using Tango.PMR.MachineStatus; +using Tango.PMR.ThreadLoading; namespace Tango.Integration.Operation { @@ -63,6 +64,11 @@ namespace Tango.Integration.Operation /// MachineStatus MachineStatus { get; } + /// + /// Gets the current thread loading status. + /// + StartThreadLoadingResponse ThreadLoadingStatus { get; } + /// /// Gets or sets the firmware upgrade mode. /// @@ -198,6 +204,26 @@ namespace Tango.Integration.Operation /// event EventHandler PowerDownStarted; + /// + /// Occurs when the thread loading status has changed. + /// + event EventHandler ThreadLoadingStatusChanged; + + /// + /// Occurs when a thread loading confirmation is required. + /// + event EventHandler ThreadLoadingConfirmationRequired; + + /// + /// Occurs when thread loading has completed. + /// + event EventHandler ThreadLoadingCompleted; + + /// + /// Occurs when thread loading has failed. + /// + event EventHandler ThreadLoadingFailed; + /// /// Gets or sets a value indicating whether direct the embedded device to send diagnostics messages. /// @@ -223,6 +249,11 @@ namespace Tango.Integration.Operation /// bool EnableMachineStatusUpdates { get; set; } + /// + /// Gets or sets a value indicating whether to enable automatic thread loading support. + /// + bool EnableAutomaticThreadLoading { get; set; } + /// /// Gets the last process parameters table sent to the embedded device. /// diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index e142066b6..74c64930b 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -42,6 +42,7 @@ using Newtonsoft.Json; using Tango.PMR.Integration; using System.Globalization; using Tango.PMR.Power; +using Tango.PMR.ThreadLoading; namespace Tango.Integration.Operation { @@ -68,6 +69,7 @@ namespace Tango.Integration.Operation private bool _eventsSent; private bool _debugSent; private bool _machineStatusSent; + private bool _threadLoadingSent; private EmbeddedLogItem _last_embedded_debug_log; private static RunningJobStatus _last_job_status; private bool _isPowerDownRequestInProgress; @@ -224,6 +226,26 @@ namespace Tango.Integration.Operation /// public event EventHandler PowerDownStarted; + /// + /// Occurs when the thread loading status has changed. + /// + public event EventHandler ThreadLoadingStatusChanged; + + /// + /// Occurs when a thread loading confirmation is required. + /// + public event EventHandler ThreadLoadingConfirmationRequired; + + /// + /// Occurs when thread loading has completed. + /// + public event EventHandler ThreadLoadingCompleted; + + /// + /// Occurs when thread loading has failed. + /// + public event EventHandler ThreadLoadingFailed; + #endregion #region Properties @@ -271,7 +293,17 @@ namespace Tango.Integration.Operation public MachineStatus MachineStatus { get { return _machineStatus; } - set { _machineStatus = value; RaisePropertyChangedAuto(); } + private set { _machineStatus = value; RaisePropertyChangedAuto(); } + } + + private StartThreadLoadingResponse _threadLoadingStatus; + /// + /// Gets the current thread loading status. + /// + public StartThreadLoadingResponse ThreadLoadingStatus + { + get { return _threadLoadingStatus; } + private set { _threadLoadingStatus = value; RaisePropertyChangedAuto(); } } /// @@ -409,6 +441,21 @@ namespace Tango.Integration.Operation } } + private bool _enableAutomaticThreadLoading; + /// + /// Gets or sets a value indicating whether to enable automatic thread loading support. + /// + public bool EnableAutomaticThreadLoading + { + get { return _enableAutomaticThreadLoading; } + set + { + _enableAutomaticThreadLoading = value; + RaisePropertyChangedAuto(); + OnEnableAutomaticThreadLoadingChanged(value); + } + } + private bool _enableJobResume; /// /// Gets or sets a value indicating whether to check whether a job is in progress after connection was successful. @@ -745,6 +792,65 @@ namespace Tango.Integration.Operation } } + protected virtual async void OnEnableAutomaticThreadLoadingChanged(bool value) + { + if (value && State == TransportComponentState.Connected && !_threadLoadingSent) + { + var request = new StartThreadLoadingRequest(); + + bool responseLogged = false; + _threadLoadingSent = true; + + SendContinuousRequest(request).ObserveOn(new NewThreadScheduler()).Subscribe( + (response) => + { + OnThreadLoadingStatusChanged(response); + + if (!responseLogged) + { + LogResponseReceived(response.Message); + responseLogged = true; + } + }, + (ex) => + { + _threadLoadingSent = false; + + if (!(ex is ContinuousResponseAbortedException)) + { + LogRequestFailed(request, ex); + } + }, + () => + { + _threadLoadingSent = false; + LogManager.Log("Thread loading response completed!?", LogCategory.Warning); + }); + + LogRequestSent(request); + } + else if (_threadLoadingSent) + { + _threadLoadingSent = false; + + if (State == TransportComponentState.Connected) + { + var req = new StopThreadLoadingRequest(); + + try + { + LogRequestSent(req); + var res = await SendRequest(req); + LogResponseReceived(res.Message); + } + catch (Exception ex) + { + LogRequestFailed(req, ex); + } + } + } + } + /// /// Invokes the event. /// @@ -797,7 +903,7 @@ namespace Tango.Integration.Operation } /// - /// Called when the machine status has been update + /// Called when the machine status has been updated. /// /// The response. protected async virtual void OnMachineStatusChanged(StartMachineStatusUpdateResponse response) @@ -824,9 +930,9 @@ namespace Tango.Integration.Operation case MachineState.Ready: Status = MachineStatuses.ReadyToDye; break; - //case MachineState.Sleep: - // Status = MachineStatuses.Standby; - // break; + case MachineState.Sleep: + Status = MachineStatuses.Standby; + break; case MachineState.PowerOff: Status = MachineStatuses.ShuttingDown; if (!_isPowerDownRequestInProgress) @@ -845,6 +951,59 @@ namespace Tango.Integration.Operation } } + /// + /// Called when the thread loading status has been changed. + /// + /// The response. + protected virtual void OnThreadLoadingStatusChanged(StartThreadLoadingResponse response) + { + bool changed = (ThreadLoadingStatus == null || response.State != ThreadLoadingStatus.State || response.ErrorReason != ThreadLoadingStatus.ErrorReason); + + if (changed) + { + ThreadLoadingStatus = response; + ThreadLoadingStatusChanged?.Invoke(this, response); + + LogManager.Log($"Thread Loading Status Changed: {ThreadLoadingStatus.State}."); + + switch (ThreadLoadingStatus.State) + { + case ThreadLoadingState.ReadyForLoading: + + LogManager.Log("Thread loading is ready for loading. Invoking confirmation event..."); + + ThreadLoadingConfirmationRequired?.Invoke(this, new ThreadLoadingConfirmationRequiredEventArgs((processTable) => + { + //Confirm Action + try + { + var process = processTable.ToProcessParametersPMR(); + LogManager.Log($"Thread loading confirmation received with process parameters:\n{process.ToJsonString()}"); + LogManager.Log("Sending continue thread loading request..."); + var r = SendRequest(new ContinueThreadLoadingRequest() + { + ProcessParameters = process, + }).Result; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error confirming thread loading sequence."); + } + }) + { + Status = ThreadLoadingStatus, + }); + break; + case ThreadLoadingState.Completed: + ThreadLoadingCompleted?.Invoke(this, ThreadLoadingStatus); + break; + case ThreadLoadingState.FinalizationError: + ThreadLoadingFailed?.Invoke(this, ThreadLoadingStatus); + break; + } + } + } + /// /// Called when the request has been sent /// @@ -1065,6 +1224,7 @@ namespace Tango.Integration.Operation OnEnableEmbeddedDebuggingChanged(EnableEmbeddedDebugging); OnEnableEventsNotification(EnableEventsNotification); OnEnableMachineStatusUpdatesChanged(EnableMachineStatusUpdates); + OnEnableAutomaticThreadLoadingChanged(EnableAutomaticThreadLoading); if (EnableJobResume) { diff --git a/Software/Visual_Studio/Tango.Integration/Operation/ThreadLoadingConfirmationRequiredEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Operation/ThreadLoadingConfirmationRequiredEventArgs.cs new file mode 100644 index 000000000..e5594dd01 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Operation/ThreadLoadingConfirmationRequiredEventArgs.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.PMR.ThreadLoading; + +namespace Tango.Integration.Operation +{ + public class ThreadLoadingConfirmationRequiredEventArgs : EventArgs + { + private Action _confirm; + + public StartThreadLoadingResponse Status { get; set; } + + internal ThreadLoadingConfirmationRequiredEventArgs(Action confirm) + { + _confirm = confirm; + } + + public void Confirm(ProcessParametersTable processTable) + { + _confirm.Invoke(processTable); + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 5a4fcadf1..a3feac546 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -112,6 +112,7 @@ + @@ -198,7 +199,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index 77ebbef51..d50803fed 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static MessageTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqwNgoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirvNgoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhEKDUVycm9yUmVzcG9uc2UQARIUChBDYWxj", "dWxhdGVSZXF1ZXN0EAMSFQoRQ2FsY3VsYXRlUmVzcG9uc2UQBBITCg9Qcm9n", "cmVzc1JlcXVlc3QQBRIUChBQcm9ncmVzc1Jlc3BvbnNlEAYSHAoYU3R1YkNh", @@ -177,8 +177,9 @@ namespace Tango.PMR.Common { "Ym9ydFBvd2VyRG93blJlc3BvbnNlEJNOEh4KGVN0YXJ0VGhyZWFkTG9hZGlu", "Z1JlcXVlc3QQ+FUSHwoaU3RhcnRUaHJlYWRMb2FkaW5nUmVzcG9uc2UQ+VUS", "IQocQ29udGludWVUaHJlYWRMb2FkaW5nUmVxdWVzdBD6VRIiCh1Db250aW51", - "ZVRocmVhZExvYWRpbmdSZXNwb25zZRD7VUIcChpjb20udHdpbmUudGFuZ28u", - "cG1yLmNvbW1vbmIGcHJvdG8z")); + "ZVRocmVhZExvYWRpbmdSZXNwb25zZRD7VRIdChhTdG9wVGhyZWFkTG9hZGlu", + "Z1JlcXVlc3QQ/FUSHgoZU3RvcFRocmVhZExvYWRpbmdSZXNwb25zZRD9VUIc", + "Chpjb20udHdpbmUudGFuZ28ucG1yLmNvbW1vbmIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -470,6 +471,8 @@ namespace Tango.PMR.Common { [pbr::OriginalName("StartThreadLoadingResponse")] StartThreadLoadingResponse = 11001, [pbr::OriginalName("ContinueThreadLoadingRequest")] ContinueThreadLoadingRequest = 11002, [pbr::OriginalName("ContinueThreadLoadingResponse")] ContinueThreadLoadingResponse = 11003, + [pbr::OriginalName("StopThreadLoadingRequest")] StopThreadLoadingRequest = 11004, + [pbr::OriginalName("StopThreadLoadingResponse")] StopThreadLoadingResponse = 11005, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Power/PowerDownState.cs b/Software/Visual_Studio/Tango.PMR/Power/PowerDownState.cs index 92ac94dc2..2d0396ddc 100644 --- a/Software/Visual_Studio/Tango.PMR/Power/PowerDownState.cs +++ b/Software/Visual_Studio/Tango.PMR/Power/PowerDownState.cs @@ -22,9 +22,15 @@ namespace Tango.PMR.Power { static PowerDownStateReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChRQb3dlckRvd25TdGF0ZS5wcm90bxIPVGFuZ28uUE1SLlBvd2VyKikKDlBv", - "d2VyRG93blN0YXRlEggKBE5vbmUQABINCglDb21wbGV0ZWQQAUIbChljb20u", - "dHdpbmUudGFuZ28ucG1yLnBvd2VyYgZwcm90bzM=")); + "ChRQb3dlckRvd25TdGF0ZS5wcm90bxIPVGFuZ28uUE1SLlBvd2VyKqYCCg5Q", + "b3dlckRvd25TdGF0ZRIICgROb25lEAASCAoESW5pdBABEhIKDlN0b3BSdW5u", + "aW5nSm9iEAISDQoJSGVhZENsZWFuEAMSDgoKTWl4ZXJGbHVzaBAEEg4KCkhl", + "YXRlcnNPZmYQBRINCglTdG9yZURhdGEQBhIUChBTZXRWYWx2ZVBvc2l0aW9u", + "EAcSFgoSV2FpdEZvclRlbXBlcmF0dXJlEAgSFAoQV2FpdEZvclByb2Nlc3Nl", + "cxAJEhMKD1R1cm5PZmZEcnllckZhbhAKEhEKDVR1cm5PZmZDb29sZXIQCxIR", + "Cg1UdXJuT2ZmQmxvd2VyEAwSFQoRUG93ZXJPZmZDb21wbGV0ZWQQDRIJCgVF", + "cnJvchAOEg0KCUNhbmNlbGxlZBAPQhsKGWNvbS50d2luZS50YW5nby5wbXIu", + "cG93ZXJiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Power.PowerDownState), }, null)); @@ -38,7 +44,21 @@ namespace Tango.PMR.Power { ///Fill the states. /// [pbr::OriginalName("None")] None = 0, - [pbr::OriginalName("Completed")] Completed = 1, + [pbr::OriginalName("Init")] Init = 1, + [pbr::OriginalName("StopRunningJob")] StopRunningJob = 2, + [pbr::OriginalName("HeadClean")] HeadClean = 3, + [pbr::OriginalName("MixerFlush")] MixerFlush = 4, + [pbr::OriginalName("HeatersOff")] HeatersOff = 5, + [pbr::OriginalName("StoreData")] StoreData = 6, + [pbr::OriginalName("SetValvePosition")] SetValvePosition = 7, + [pbr::OriginalName("WaitForTemperature")] WaitForTemperature = 8, + [pbr::OriginalName("WaitForProcesses")] WaitForProcesses = 9, + [pbr::OriginalName("TurnOffDryerFan")] TurnOffDryerFan = 10, + [pbr::OriginalName("TurnOffCooler")] TurnOffCooler = 11, + [pbr::OriginalName("TurnOffBlower")] TurnOffBlower = 12, + [pbr::OriginalName("PowerOffCompleted")] PowerOffCompleted = 13, + [pbr::OriginalName("Error")] Error = 14, + [pbr::OriginalName("Cancelled")] Cancelled = 15, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index c725a3121..02b8552ad 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -301,6 +301,8 @@ + + @@ -319,7 +321,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingRequest.cs b/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingRequest.cs new file mode 100644 index 000000000..10fe59a73 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingRequest.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: StopThreadLoadingRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.ThreadLoading { + + /// Holder for reflection information generated from StopThreadLoadingRequest.proto + public static partial class StopThreadLoadingRequestReflection { + + #region Descriptor + /// File descriptor for StopThreadLoadingRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static StopThreadLoadingRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch5TdG9wVGhyZWFkTG9hZGluZ1JlcXVlc3QucHJvdG8SF1RhbmdvLlBNUi5U", + "aHJlYWRMb2FkaW5nIhoKGFN0b3BUaHJlYWRMb2FkaW5nUmVxdWVzdEIjCiFj", + "b20udHdpbmUudGFuZ28ucG1yLnRocmVhZGxvYWRpbmdiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ThreadLoading.StopThreadLoadingRequest), global::Tango.PMR.ThreadLoading.StopThreadLoadingRequest.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class StopThreadLoadingRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StopThreadLoadingRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.ThreadLoading.StopThreadLoadingRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StopThreadLoadingRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StopThreadLoadingRequest(StopThreadLoadingRequest other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StopThreadLoadingRequest Clone() { + return new StopThreadLoadingRequest(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StopThreadLoadingRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StopThreadLoadingRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StopThreadLoadingRequest other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingResponse.cs b/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingResponse.cs new file mode 100644 index 000000000..e25210ceb --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingResponse.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: StopThreadLoadingResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.ThreadLoading { + + /// Holder for reflection information generated from StopThreadLoadingResponse.proto + public static partial class StopThreadLoadingResponseReflection { + + #region Descriptor + /// File descriptor for StopThreadLoadingResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static StopThreadLoadingResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch9TdG9wVGhyZWFkTG9hZGluZ1Jlc3BvbnNlLnByb3RvEhdUYW5nby5QTVIu", + "VGhyZWFkTG9hZGluZyIbChlTdG9wVGhyZWFkTG9hZGluZ1Jlc3BvbnNlQiMK", + "IWNvbS50d2luZS50YW5nby5wbXIudGhyZWFkbG9hZGluZ2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ThreadLoading.StopThreadLoadingResponse), global::Tango.PMR.ThreadLoading.StopThreadLoadingResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class StopThreadLoadingResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StopThreadLoadingResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.ThreadLoading.StopThreadLoadingResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StopThreadLoadingResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StopThreadLoadingResponse(StopThreadLoadingResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StopThreadLoadingResponse Clone() { + return new StopThreadLoadingResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StopThreadLoadingResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StopThreadLoadingResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StopThreadLoadingResponse other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs index 1662a3ede..f42e7f161 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs @@ -20,6 +20,7 @@ namespace Tango.MachineEM.UI.ViewModels private TcpServer TcpServer; private bool _running; private LogManager logManager = LogManager.Default; + private bool _isThreadLoading; #region Properties @@ -101,6 +102,16 @@ namespace Tango.MachineEM.UI.ViewModels /// public RelayCommand ValidateCartridgeCommand { get; set; } + /// + /// Gets or sets the start thread loading sequence command. + /// + public RelayCommand StartThreadLoadingCommand { get; set; } + + /// + /// Gets or sets the finalize thread loading command. + /// + public RelayCommand FinalizeThreadLoadingCommand { get; set; } + #endregion #region Constructors @@ -131,6 +142,8 @@ namespace Tango.MachineEM.UI.ViewModels CancelCommand = new RelayCommand(Cancel, (x) => _running); ClearCommand = new RelayCommand(() => Log = String.Empty); ValidateCartridgeCommand = new RelayCommand(ValidateCartridge, (x) => Emulator.IsStarted); + StartThreadLoadingCommand = new RelayCommand(StartThreadLoading, (x) => Emulator.IsStarted && !_isThreadLoading); + FinalizeThreadLoadingCommand = new RelayCommand(FinalizeThreadLoading, (x) => Emulator.IsStarted && _isThreadLoading); Ports = new List() { @@ -218,6 +231,26 @@ namespace Tango.MachineEM.UI.ViewModels } } + private async void StartThreadLoading() + { + LogManager.Log("Starting thread loading sequence..."); + Emulator.StartThreadLoading(); + _isThreadLoading = true; + InvalidateRelayCommands(); + + await Task.Delay(10000); + _isThreadLoading = false; + InvalidateRelayCommands(); + } + + private void FinalizeThreadLoading() + { + LogManager.Log("Finalizing thread loading sequence..."); + Emulator.FinalizeThreadLoading(); + _isThreadLoading = false; + InvalidateRelayCommands(); + } + #endregion } } diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml index 58fbfef4c..23154aafd 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml @@ -53,17 +53,95 @@ + - + + + + + + + + + STATUS + + + + + + + + IDS Packs Levels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MACHINE STATE + + + + OVERALL TEMPERATURE + + + + + + + + + + + - + HARDWARE EVENTS - + + diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs index 1b45e959d..c12b622a4 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs @@ -56,73 +56,73 @@ namespace Tango.BL { if (!_initialized) { - progressLog.Invoke("Loading static collections..."); + progressLog?.Invoke("Loading static collections..."); db = ObservablesContext.CreateDefault(); WindingMethods = db.WindingMethods.ToObservableCollection(); - progressLog.Invoke("Loading color spaces..."); + progressLog?.Invoke("Loading color spaces..."); ColorSpaces = db.ColorSpaces.ToObservableCollection(); - progressLog.Invoke("Loading spools..."); + progressLog?.Invoke("Loading spools..."); SpoolTypes = db.SpoolTypes.ToObservableCollection(); - progressLog.Invoke("Loading event..."); + progressLog?.Invoke("Loading event..."); EventTypes = db.EventTypes.ToObservableCollection(); - progressLog.Invoke("Loading blowers..."); + progressLog?.Invoke("Loading blowers..."); HardwareBlowerTypes = db.HardwareBlowerTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareBlowers = db.HardwareBlowers.ToObservableCollection(); - progressLog.Invoke("Loading break sensors..."); + progressLog?.Invoke("Loading break sensors..."); HardwareBreakSensorTypes = db.HardwareBreakSensorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareBreakSensors = db.HardwareBreakSensors.ToObservableCollection(); - progressLog.Invoke("Loading dancers..."); + progressLog?.Invoke("Loading dancers..."); HardwareDancerTypes = db.HardwareDancerTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareDancers = db.HardwareDancers.ToObservableCollection(); - progressLog.Invoke("Loading motors..."); + progressLog?.Invoke("Loading motors..."); HardwareMotorTypes = db.HardwareMotorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareMotors = db.HardwareMotors.ToObservableCollection(); - progressLog.Invoke("Loading pid controls..."); + progressLog?.Invoke("Loading pid controls..."); HardwarePidControlTypes = db.HardwarePidControlTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwarePidControls = db.HardwarePidControls.ToObservableCollection(); - progressLog.Invoke("Loading speed sensors..."); + progressLog?.Invoke("Loading speed sensors..."); HardwareSpeedSensorTypes = db.HardwareSpeedSensorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareSpeedSensors = db.HardwareSpeedSensors.ToObservableCollection(); - progressLog.Invoke("Loading winders..."); + progressLog?.Invoke("Loading winders..."); HardwareWinderTypes = db.HardwareWinderTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareWinders = db.HardwareWinders.ToObservableCollection(); - progressLog.Invoke("Loading tech controllers..."); + progressLog?.Invoke("Loading tech controllers..."); TechControllers = db.TechControllers.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading tech dispensers..."); + progressLog?.Invoke("Loading tech dispensers..."); TechDispensers = db.TechDispensers.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading tech io's..."); + progressLog?.Invoke("Loading tech io's..."); TechIos = db.TechIos.ToObservableCollection(); - progressLog.Invoke("Loading tech monitors..."); + progressLog?.Invoke("Loading tech monitors..."); TechMonitors = db.TechMonitors.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading tech valves..."); + progressLog?.Invoke("Loading tech valves..."); TechValves = db.TechValves.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading tech heaters..."); + progressLog?.Invoke("Loading tech heaters..."); TechHeaters = db.TechHeaters.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading machines..."); + progressLog?.Invoke("Loading machines..."); Machines = db.Machines.Include(x => x.Organization).ToObservableCollection(); - progressLog.Invoke("Loading users..."); + progressLog?.Invoke("Loading users..."); Users = db.Users.Where(x => !x.Deleted).Include(x => x.Contact).ToObservableCollection(); - progressLog.Invoke("Loading machine versions..."); + progressLog?.Invoke("Loading machine versions..."); MachineVersions = db.MachineVersions.ToObservableCollection(); //Load later... diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 1bb025217..6ac2e3657 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -71,7 +71,7 @@ namespace Tango.MachineService.Controllers { String machine_guid = RequestToken.Object.MachineGuid; - var machine = db.Machines.SingleOrDefault(x => x.Guid == machine_guid); + var machine = db.Machines.Include(x => x.Organization).SingleOrDefault(x => x.Guid == machine_guid); if (machine == null) { @@ -151,6 +151,7 @@ namespace Tango.MachineService.Controllers response.SetupUWF = machine.SetupUwf; response.SetupFirmware = machine.SetupFirmware; response.IsDemo = machine.IsDemo; + response.Organization = machine.Organization.Name; TangoUpdate tangoUpdate = new TangoUpdate(); tangoUpdate.ApplicationVersion = latest_machine_version.Version; -- cgit v1.3.1