From 97ea085d1fac43aedc5258486ef355eb13abc195 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 13 Dec 2018 17:16:43 +0200 Subject: Fixed issues in segment indices !!! Fixed issue with PPC fine tuning. Added support to Twine & Panton in color conversion. --- .../Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index b75a84a6c..55ef56ce4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1708,7 +1708,7 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Setting selected segment..."); - _selectedSegment = ActiveJob.Segments.FirstOrDefault(); + _selectedSegment = ActiveJob.OrderedSegments.FirstOrDefault(); ActiveJob.LengthChanged -= ActiveJob_LengthChanged; ActiveJob.LengthChanged += ActiveJob_LengthChanged; @@ -2153,10 +2153,14 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.LogFormat("Duplicating {0} segments...", SelectedSegments.Count); + int start_index = SelectedSegments.Max(x => x.SegmentIndex); + + ActiveJob.Segments.Where(x => x.SegmentIndex > start_index).ToList().ForEach(x => x.SegmentIndex = x.SegmentIndex + SelectedSegments.Count); + foreach (var segment in SelectedSegments.OrderBy(x => x.SegmentIndex)) { var cloned = segment.Clone(); - cloned.SegmentIndex = ActiveJob.Segments.Max(x => x.SegmentIndex) + 1; + cloned.SegmentIndex = start_index++; ActiveJob.Segments.Add(cloned); SelectedSegment = cloned; } -- cgit v1.3.1 From fbf514c96a53c464019290da0412410989dfb3d1 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 19 Dec 2018 17:54:36 +0200 Subject: Improved RML Builder loading time.. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 20578304 -> 20578304 bytes .../ViewModels/MainViewVM.cs | 2 +- .../ViewModels/MainViewVM.cs | 1 - .../Visual_Studio/Tango.BL/Builders/RmlBuilder.cs | 34 +++++++++------------ 5 files changed, 15 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index c5ed078e6..29c02c4ab 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 9f4498621..1c5b90031 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.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 55ef56ce4..12f69ba7f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1482,7 +1482,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.Log("Invalidating liquid factors, process parameters and process group history..."); - _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().WithMediaProperties().Build(); + _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().Build(); if (_selectedRML.Ccts.Count == 0) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index ef6fc816b..f8966b729 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -206,7 +206,6 @@ namespace Tango.MachineStudio.RML.ViewModels .Set(guid) .WithActiveParametersGroup() .WithLiquidFactors() - .WithMediaProperties() .BuildAsync(); if (ActiveRML.ProcessParametersTablesGroups.ToList().Count == 0) diff --git a/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs index a67a2cf7a..7b5d9b7ff 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs @@ -16,16 +16,24 @@ namespace Tango.BL.Builders } + protected override IQueryable OnSetQuery(IQueryable query) + { + return query. + Include(x => x.MediaMaterial). + Include(x => x.MediaColor). + Include(x => x.MediaPurpose). + Include(x => x.MediaCondition). + Include(x => x.LinearMassDensityUnit). + Include(x => x.FiberShape). + Include(x => x.FiberSynth); + } + public virtual RmlBuilder WithAllParametersGroup() { return AddStep(1, () => { - var groups = Context.ProcessParametersTablesGroups.Where(x => x.RmlGuid == Entity.Guid).ToList(); - - foreach (var group in groups) - { - Context.ProcessParametersTables.Where(x => x.ProcessParametersTablesGroupGuid == group.Guid).OrderBy(x => x.TableIndex).ToList(); - } + Context.ProcessParametersTablesGroups.Where(x => x.RmlGuid == Entity.Guid).ToList(); + Context.ProcessParametersTables.Where(x => x.ProcessParametersTablesGroup.RmlGuid == Entity.Guid).OrderBy(x => x.TableIndex).ToList(); }); } @@ -65,19 +73,5 @@ namespace Tango.BL.Builders Context.LiquidTypesRmls.Where(x => x.RmlGuid == Entity.Guid).Include(x => x.LiquidType).OrderBy(x => x.LiquidType.Code).ToList(); }); } - - public virtual RmlBuilder WithMediaProperties() - { - return AddStep(6, () => - { - Context.MediaMaterials.SingleOrDefault(x => x.Guid == Entity.MediaMaterialGuid); - Context.MediaColors.SingleOrDefault(x => x.Guid == Entity.MediaColorGuid); - Context.MediaPurposes.SingleOrDefault(x => x.Guid == Entity.MediaPurposeGuid); - Context.MediaConditions.SingleOrDefault(x => x.Guid == Entity.MediaConditionGuid); - Context.LinearMassDensityUnits.SingleOrDefault(x => x.Guid == Entity.LinearMassDensityUnitGuid); - Context.FiberShapes.SingleOrDefault(x => x.Guid == Entity.FiberShapeGuid); - Context.FiberSynths.SingleOrDefault(x => x.Guid == Entity.FiberSynthGuid); - }); - } } } -- cgit v1.3.1 From 59839a4cf53ce9ef07348926d9cf5f8e8d020c91 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 19 Dec 2018 18:08:24 +0200 Subject: Improved Job Builder speed. --- .../Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 9 ++++++++- Software/Visual_Studio/Tango.BL/Builders/JobBuilder.cs | 5 +---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 12f69ba7f..333a31802 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1482,7 +1482,14 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.Log("Invalidating liquid factors, process parameters and process group history..."); - _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().Build(); + if (_selectedRML != ActiveJob.Rml) + { + _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().Build(); + } + else + { + _selectedRML = ActiveJob.Rml; + } if (_selectedRML.Ccts.Count == 0) { diff --git a/Software/Visual_Studio/Tango.BL/Builders/JobBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/JobBuilder.cs index da418a990..3b0d1b0e1 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/JobBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/JobBuilder.cs @@ -39,10 +39,7 @@ namespace Tango.BL.Builders { return AddStep(2, () => { - foreach (var segment in Entity.Segments.ToList()) - { - Context.BrushStops.Where(x => x.SegmentGuid == segment.Guid).Include(x => x.ColorSpace).Include(x => x.ColorCatalog).OrderBy(x => x.StopIndex).ToList(); - } + Context.BrushStops.Where(x => x.Segment.JobGuid == Entity.Guid).Include(x => x.ColorSpace).Include(x => x.ColorCatalog).OrderBy(x => x.StopIndex).ToList(); }); } -- cgit v1.3.1 From 3e71ab50870db524f7e17aa9d2042da52b15ad63 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 26 Dec 2018 14:04:34 +0200 Subject: Implemented integration IJobRunsLogger. Implemented DEBUG/RELEASE JsonController. Implemented Local/Remote machine studio setting. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 20578304 -> 22675456 bytes .../ViewModels/MainViewVM.cs | 5 + .../Views/MachineJobSelectionView.xaml | 2 +- .../ViewModels/MainViewVM.cs | 7 +- .../JobRunsLogging/DefaultJobRunsLogger.cs | 113 ----------- .../JobRunsLogging/IJobRunsLogger.cs | 14 -- .../MachineStudioSettings.cs | 12 ++ .../Tango.MachineStudio.Common.csproj | 4 +- .../DefaultAuthenticationProvider.cs | 6 +- .../DefaultStudioApplicationManager.cs | 6 +- .../Tango.MachineStudio.UI/ViewModelLocator.cs | 3 - .../ViewModels/LoginViewVM.cs | 2 +- .../JobRuns/BasicJobRunsLogger.cs | 221 +++++++++++++++++++++ .../Tango.Integration/JobRuns/IJobRunsLogger.cs | 41 ++++ .../Operation/IMachineOperator.cs | 6 + .../Tango.Integration/Operation/MachineOperator.cs | 8 + .../Tango.Integration/Tango.Integration.csproj | 4 +- .../Tango.Web/Controllers/JsonController.cs | 4 + .../MachineService - Web Deploy.pubxml | 2 +- 20 files changed, 315 insertions(+), 145 deletions(-) delete mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/JobRunsLogging/DefaultJobRunsLogger.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/JobRunsLogging/IJobRunsLogger.cs create mode 100644 Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs create mode 100644 Software/Visual_Studio/Tango.Integration/JobRuns/IJobRunsLogger.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index ec34a5443..7752f6ed6 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 91c25afa9..ae6147d84 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.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 333a31802..84fffcc74 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1845,6 +1845,11 @@ namespace Tango.MachineStudio.Developer.ViewModels { await _machineDbContext.Jobs.Where(x => x.MachineGuid == SelectedMachine.Guid).Include(x => x.User).Include(x => x.User.Contact).LoadAsync(); + foreach (var job in SelectedMachine.Jobs) + { + await job.Reload(_machineDbContext); + } + await _machineDbContext.ColorSpaces.LoadAsync(); await Task.Factory.StartNew(() => diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml index 1cb8536e0..ab97d7858 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -196,7 +196,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs index 492ccd30e..fd897e811 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs @@ -78,8 +78,11 @@ namespace Tango.MachineStudio.Statistics.ViewModels InvokeUIOnIdle(() => { - GenerateTimelineJobStatusChart(); - GeneratePieFailedReasonsChart(); + if (_job_runs.Count > 0) + { + GenerateTimelineJobStatusChart(); + GeneratePieFailedReasonsChart(); + } }); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/JobRunsLogging/DefaultJobRunsLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/JobRunsLogging/DefaultJobRunsLogger.cs deleted file mode 100644 index b405a6729..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/JobRunsLogging/DefaultJobRunsLogger.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL; -using Tango.BL.Entities; -using Tango.BL.Enumerations; -using Tango.Core; -using Tango.Core.DI; -using Tango.Integration.ExternalBridge; -using Tango.Integration.Operation; -using Tango.MachineStudio.Common.StudioApplication; - -namespace Tango.MachineStudio.Common.JobRunsLogging -{ - public class DefaultJobRunsLogger : ExtendedObject, IJobRunsLogger - { - private ObservablesContext _context; - private DateTime _start_date; - private Job _job; - private IStudioApplicationManager applicationManager; - - public void Init(IStudioApplicationManager appManager) - { - applicationManager = appManager; - _context = ObservablesContext.CreateDefault(); - applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; - } - - private void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machine) - { - if (machine != null) - { - machine.PrintingStarted -= Machine_PrintingStarted; - machine.PrintingStarted += Machine_PrintingStarted; - machine.PrintingCompleted -= Machine_PrintingCompleted; - machine.PrintingCompleted += Machine_PrintingCompleted; - machine.PrintingAborted -= Machine_PrintingAborted; - machine.PrintingAborted += Machine_PrintingAborted; - machine.PrintingFailed -= Machine_PrintingFailed; - machine.PrintingFailed += Machine_PrintingFailed; - } - } - - private void Machine_PrintingFailed(object sender, PrintingFailedEventArgs e) - { - if (e.Job.Guid == _job.Guid) - { - Task.Factory.StartNew(() => - { - _context.JobRuns.Add(new JobRun() - { - StartDate = _start_date, - EndDate = DateTime.UtcNow, - JobGuid = _job.Guid, - JobRunStatus = JobRunStatus.Failed, - EndPosition = e.JobHandler.Status.Progress, - FailedMessage = e.Exception.Message, - }); - - _context.SaveChanges(); - }); - } - } - - private void Machine_PrintingAborted(object sender, PrintingEventArgs e) - { - if (e.Job.Guid == _job.Guid) - { - Task.Factory.StartNew(() => - { - _context.JobRuns.Add(new JobRun() - { - StartDate = _start_date, - EndDate = DateTime.UtcNow, - JobGuid = _job.Guid, - EndPosition = e.JobHandler.Status.Progress, - JobRunStatus = JobRunStatus.Aborted, - }); - - _context.SaveChanges(); - }); - } - } - - private void Machine_PrintingCompleted(object sender, PrintingEventArgs e) - { - if (e.Job.Guid == _job.Guid) - { - Task.Factory.StartNew(() => - { - _context.JobRuns.Add(new JobRun() - { - StartDate = _start_date, - EndDate = DateTime.UtcNow, - JobGuid = _job.Guid, - EndPosition = e.JobHandler.Status.Progress, - JobRunStatus = JobRunStatus.Completed, - }); - - _context.SaveChanges(); - }); - } - } - - private void Machine_PrintingStarted(object sender, PrintingEventArgs e) - { - _job = e.Job; - _start_date = DateTime.UtcNow; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/JobRunsLogging/IJobRunsLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/JobRunsLogging/IJobRunsLogger.cs deleted file mode 100644 index c3eca953b..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/JobRunsLogging/IJobRunsLogger.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.MachineStudio.Common.StudioApplication; - -namespace Tango.MachineStudio.Common.JobRunsLogging -{ - public interface IJobRunsLogger - { - void Init(IStudioApplicationManager appManager); - } -} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index 1d3660c5f..2de954cbe 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -18,6 +18,12 @@ namespace Tango.MachineStudio.Common public WindowState State { get; set; } } + public enum WorkingEnvironment + { + Remote, + Local + } + /// /// Gets or sets the last login email. /// @@ -88,6 +94,11 @@ namespace Tango.MachineStudio.Common /// public String LastMainModuleName { get; set; } + /// + /// Gets or sets the working environment. + /// + public WorkingEnvironment Environment { get; set; } + /// /// Initializes a new instance of the class. /// @@ -98,6 +109,7 @@ namespace Tango.MachineStudio.Common MachineServiceAddress = "http://machineservice.twine-srv.com/"; DefaultIssueReportTags = new List(); StudioModulesBounds = new List(); + Environment = WorkingEnvironment.Remote; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index cd99b00d0..85b194173 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -104,8 +104,6 @@ - - @@ -310,7 +308,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index 4acc76c25..19192020e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -54,6 +54,7 @@ namespace Tango.MachineStudio.UI.Authentication { var settings = SettingsManager.Default.GetOrCreate(); + IWebTransportClient service = new WebTransportClient(); var response = service.PostJson(settings.MachineServiceAddress + "/api/MachineStudio/Login", new LoginRequest() { @@ -65,7 +66,10 @@ namespace Tango.MachineStudio.UI.Authentication AccessToken = response.Token; - ObservablesContext.OverrideSettingsDataSource(response.DataSource); + if (settings.Environment == MachineStudioSettings.WorkingEnvironment.Remote) + { + ObservablesContext.OverrideSettingsDataSource(response.DataSource); + } ObservablesStaticCollections.Instance.Initialize(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index ccedde974..baa550017 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -26,7 +26,6 @@ using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.UI.Views; using Tango.Integration.Operation; using Tango.MachineStudio.UI.Windows; -using Tango.MachineStudio.Common.JobRunsLogging; namespace Tango.MachineStudio.UI.StudioApplication { @@ -40,7 +39,6 @@ namespace Tango.MachineStudio.UI.StudioApplication private INavigationManager _navigationManager; private IStudioModuleLoader _moduleLoader; private INotificationProvider _notification; - private IJobRunsLogger _jobRunsLogger; private List _openedWindows; private List _notified_view_models; @@ -53,9 +51,8 @@ namespace Tango.MachineStudio.UI.StudioApplication /// Initializes a new instance of the class. /// /// The navigation manager. - public DefaultStudioApplicationManager(INavigationManager navigationManager, IStudioModuleLoader moduleLoader, INotificationProvider notification, IJobRunsLogger jobRunsLogger) + public DefaultStudioApplicationManager(INavigationManager navigationManager, IStudioModuleLoader moduleLoader, INotificationProvider notification) { - _jobRunsLogger = jobRunsLogger; _moduleLoader = moduleLoader; _navigationManager = navigationManager; _notification = notification; @@ -350,7 +347,6 @@ namespace Tango.MachineStudio.UI.StudioApplication }); ApplicationReady?.Invoke(this, new EventArgs()); - _jobRunsLogger.Init(this); } /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index cac4ee0c0..3c548855d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -8,7 +8,6 @@ using Tango.MachineStudio.Common.Diagnostics; using Tango.MachineStudio.Common.EventLogging; using Tango.MachineStudio.Common.FirmwareUpgrade; using Tango.MachineStudio.Common.Html; -using Tango.MachineStudio.Common.JobRunsLogging; using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common.Navigation; using Tango.MachineStudio.Common.Notifications; @@ -71,7 +70,6 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); - TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); @@ -80,7 +78,6 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); - TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs index 59cc69a57..730027a67 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -139,7 +139,7 @@ namespace Tango.MachineStudio.UI.ViewModels catch (Exception ex) { LogManager.Log(ex, "Login Error."); - _notificationProvider.ShowError($"The specified email or password was incorrect, or you don't have a permission to run this application.\nError: {ex.Message}"); + _notificationProvider.ShowError($"The specified email or password was incorrect, or you don't have a permission to run this application.\nError: {ex.FlattenMessage()}"); } finally { diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs new file mode 100644 index 000000000..07844af17 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs @@ -0,0 +1,221 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Integration.Operation; + +namespace Tango.Integration.JobRuns +{ + /// + /// Represents a basic database job runs logger. + /// + /// + public class BasicJobRunsLogger : IJobRunsLogger + { + private DateTime _start_date; + private Job _job; + + #region Properties + + /// + /// Gets the machine operator. + /// + public IMachineOperator MachineOperator { get; private set; } + + /// + /// Gets a value indicating whether this instance is started. + /// + public bool IsStarted { get; private set; } + + /// + /// Gets or sets the job designations of which the logger should log (supports multiple flags). + /// + public JobDesignations JobDesignation { get; set; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The machine operator. + public BasicJobRunsLogger(IMachineOperator machineOperator) + { + JobDesignation = JobDesignations.Default; + MachineOperator = machineOperator; + Init(); + } + + #endregion + + #region Private Methods + + /// + /// Initializes this instance. + /// + private void Init() + { + MachineOperator.PrintingStarted -= Machine_PrintingStarted; + MachineOperator.PrintingStarted += Machine_PrintingStarted; + MachineOperator.PrintingCompleted -= Machine_PrintingCompleted; + MachineOperator.PrintingCompleted += Machine_PrintingCompleted; + MachineOperator.PrintingAborted -= Machine_PrintingAborted; + MachineOperator.PrintingAborted += Machine_PrintingAborted; + MachineOperator.PrintingFailed -= Machine_PrintingFailed; + MachineOperator.PrintingFailed += Machine_PrintingFailed; + } + + private bool ShouldLog() + { + return IsStarted && _job != null && JobDesignation.HasFlag(_job.Designation); + } + + #endregion + + #region Public Methods + + /// + /// Starts the logger. + /// + public void Start() + { + IsStarted = true; + } + + /// + /// Stops the logger. + /// + public void Stop() + { + IsStarted = false; + } + + #endregion + + #region Event Handlers + + private void Machine_PrintingFailed(object sender, PrintingFailedEventArgs e) + { + if (ShouldLog()) + { + if (e.Job.Guid == _job.Guid) + { + Task.Factory.StartNew(() => + { + using (var db = ObservablesContext.CreateDefault()) + { + db.JobRuns.Add(new JobRun() + { + StartDate = _start_date, + EndDate = DateTime.UtcNow, + JobGuid = _job.Guid, + JobRunStatus = JobRunStatus.Failed, + EndPosition = e.JobHandler.Status.Progress, + FailedMessage = e.Exception.Message, + }); + + e.Job.LastRun = DateTime.UtcNow; + _job.LastRun = DateTime.UtcNow; + + var job = db.Jobs.SingleOrDefault(x => x.Guid == _job.Guid); + + if (job != null) + { + job.LastRun = DateTime.UtcNow; + } + + db.SaveChanges(); + } + }); + } + } + } + + private void Machine_PrintingAborted(object sender, PrintingEventArgs e) + { + if (ShouldLog()) + { + if (e.Job.Guid == _job.Guid) + { + Task.Factory.StartNew(() => + { + using (var db = ObservablesContext.CreateDefault()) + { + db.JobRuns.Add(new JobRun() + { + StartDate = _start_date, + EndDate = DateTime.UtcNow, + JobGuid = _job.Guid, + EndPosition = e.JobHandler.Status.Progress, + JobRunStatus = JobRunStatus.Aborted, + }); + + e.Job.LastRun = DateTime.UtcNow; + _job.LastRun = DateTime.UtcNow; + + var job = db.Jobs.SingleOrDefault(x => x.Guid == _job.Guid); + + if (job != null) + { + job.LastRun = DateTime.UtcNow; + } + + db.SaveChanges(); + } + }); + } + } + } + + private void Machine_PrintingCompleted(object sender, PrintingEventArgs e) + { + if (ShouldLog()) + { + if (e.Job.Guid == _job.Guid) + { + Task.Factory.StartNew(() => + { + using (var db = ObservablesContext.CreateDefault()) + { + db.JobRuns.Add(new JobRun() + { + StartDate = _start_date, + EndDate = DateTime.UtcNow, + JobGuid = _job.Guid, + EndPosition = e.JobHandler.Status.Progress, + JobRunStatus = JobRunStatus.Completed, + }); + + e.Job.LastRun = DateTime.UtcNow; + _job.LastRun = DateTime.UtcNow; + + var job = db.Jobs.SingleOrDefault(x => x.Guid == _job.Guid); + + if (job != null) + { + job.LastRun = DateTime.UtcNow; + } + + db.SaveChanges(); + } + }); + } + } + } + + private void Machine_PrintingStarted(object sender, PrintingEventArgs e) + { + _job = e.Job; + _start_date = DateTime.UtcNow; + } + + + + #endregion + } +} diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/IJobRunsLogger.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/IJobRunsLogger.cs new file mode 100644 index 000000000..8c4174311 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/JobRuns/IJobRunsLogger.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; +using Tango.Integration.Operation; + +namespace Tango.Integration.JobRuns +{ + /// + /// Represents a machine operator job runs logger + /// + public interface IJobRunsLogger + { + /// + /// Gets the machine operator. + /// + IMachineOperator MachineOperator { get; } + + /// + /// Gets or sets the job designations of which the logger should log (supports multiple flags). + /// + JobDesignations JobDesignation { get; set; } + + /// + /// Gets a value indicating whether this instance is started. + /// + bool IsStarted { get; } + + /// + /// Starts the logger. + /// + void Start(); + + /// + /// Stops the logger. + /// + void Stop(); + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index d0eb0ae17..d2293bcd0 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -20,6 +20,7 @@ using System.IO; using Tango.Integration.Upgrade; using Tango.PMR.IO; using Tango.PMR.FirmwareUpgrade; +using Tango.Integration.JobRuns; namespace Tango.Integration.Operation { @@ -164,6 +165,11 @@ namespace Tango.Integration.Operation /// IMachineEventsStateProvider MachineEventsStateProvider { get; set; } + /// + /// Gets or sets the job runs logger. + /// + IJobRunsLogger JobRunsLogger { get; set; } + /// /// Prints the specified job. /// The process parameters table will be calculated using color conversion gamut region. diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 45b2943c1..2efd2fc9b 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -32,6 +32,7 @@ using Tango.PMR.IO; using Tango.Integration.Upgrade; using Tango.PMR.FirmwareUpgrade; using Tango.Integration.Logging; +using Tango.Integration.JobRuns; namespace Tango.Integration.Operation { @@ -79,6 +80,8 @@ namespace Tango.Integration.Operation { DeviceInformation = new DeviceInformation(); MachineEventsStateProvider = new DefaultMachineEventsStateProvider(); + JobRunsLogger = new BasicJobRunsLogger(this); + JobRunsLogger.Start(); EnableEventsNotification = true; EnableJobResume = true; LogEmbeddedDebuggingToFile = true; @@ -329,6 +332,11 @@ namespace Tango.Integration.Operation /// public IMachineEventsStateProvider MachineEventsStateProvider { get; set; } + /// + /// Gets or sets the job runs logger. + /// + public IJobRunsLogger JobRunsLogger { get; set; } + /// /// Gets the last process parameters table sent to the embedded device. /// diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 8edb04384..eebee5e81 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -87,6 +87,8 @@ + + @@ -168,7 +170,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs b/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs index 9d9016d5a..1fae9cccc 100644 --- a/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs +++ b/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs @@ -65,7 +65,11 @@ namespace Tango.Web.Controllers code = HttpStatusCode.Unauthorized; } +#if DEBUG throw new HttpResponseException(Request.CreateErrorResponse(code, ex.ToString())); +#else + throw new HttpResponseException(Request.CreateErrorResponse(code, ex.FlattenMessage())); +#endif } } } diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/MachineService - Web Deploy.pubxml b/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/MachineService - Web Deploy.pubxml index 277a89d38..612e38bfb 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/MachineService - Web Deploy.pubxml +++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/MachineService - Web Deploy.pubxml @@ -9,7 +9,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt /subscriptions/10c8aa60-3b15-4e0d-b412-6aeef90e5e91/resourceGroups/Tango/providers/Microsoft.Web/sites/MachineService Tango AzureWebSite - Release + Debug Any CPU http://machineservice.azurewebsites.net True -- cgit v1.3.1 From 4760444d7276aec024dac5fbbc202becc41105dd Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 30 Dec 2018 18:33:30 +0200 Subject: Machine designer working with spools ! PMR of dispenser & spools changed. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../PMR/Messages/Hardware/HardwareDispenser.proto | 4 +- Software/PMR/Messages/Printing/JobSpool.proto | 10 +- .../ViewModels/MainViewVM.cs | 3 + .../Tango.MachineStudio.MachineDesigner.csproj | 7 + .../ViewModels/MainViewVM.cs | 44 +++++ .../Views/MachineDetailsView.xaml | 2 +- .../Views/MachineSettingsView.xaml | 2 +- .../Views/SpoolsView.xaml | 81 +++++++++ .../Views/SpoolsView.xaml.cs | 28 +++ .../Tango.BL/Builders/MachineBuilder.cs | 4 +- Software/Visual_Studio/Tango.BL/Entities/Spool.cs | 188 ++++++++++++++++++--- .../Visual_Studio/Tango.BL/Entities/SpoolType.cs | 152 ----------------- .../Tango.DAL.Remote/DB/RemoteADO.edmx | 38 ++--- .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 152 ++++++++--------- .../Visual_Studio/Tango.DAL.Remote/DB/SPOOL.cs | 6 +- .../Tango.DAL.Remote/DB/SPOOL_TYPES.cs | 4 - .../Tango.Integration/Operation/MachineOperator.cs | 12 ++ .../Tango.PMR/Hardware/HardwareDispenser.cs | 56 +++--- .../Visual_Studio/Tango.PMR/Printing/JobSpool.cs | 88 +++++----- .../Utilities/Tango.PMRGenerator.CLI/Program.cs | 13 ++ 22 files changed, 534 insertions(+), 360 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index ddbc9be45..2da0d929f 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 3dff3f627..f758ff284 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Hardware/HardwareDispenser.proto b/Software/PMR/Messages/Hardware/HardwareDispenser.proto index 0326aa7f8..7167ac517 100644 --- a/Software/PMR/Messages/Hardware/HardwareDispenser.proto +++ b/Software/PMR/Messages/Hardware/HardwareDispenser.proto @@ -22,8 +22,8 @@ message HardwareDispenser int32 Index = 2; - double NlPerPulse = 3; + double Capacity = 3; - double Capacity = 4; + double NlPerPulse = 4; } diff --git a/Software/PMR/Messages/Printing/JobSpool.proto b/Software/PMR/Messages/Printing/JobSpool.proto index ba140aaaa..a1d6b65ab 100644 --- a/Software/PMR/Messages/Printing/JobSpool.proto +++ b/Software/PMR/Messages/Printing/JobSpool.proto @@ -26,14 +26,14 @@ message JobSpool double Diameter = 4; - int32 StartOffsetPulses = 5; + double RotationsPerPassage = 5; - int32 BackingRate = 6; + int32 StartOffsetPulses = 6; - int32 SegmentOffsetPulses = 7; + int32 BackingRate = 7; - int32 BottomBackingRate = 8; + int32 SegmentOffsetPulses = 8; - double RotationsPerPassage = 9; + int32 BottomBackingRate = 9; } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 84fffcc74..8b0a89336 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1695,6 +1695,9 @@ namespace Tango.MachineStudio.Developer.ViewModels WindingMethods = _activeJobDbContext.WindingMethods.ToObservableCollection(); SpoolTypes = _activeJobDbContext.SpoolTypes.ToObservableCollection(); + LogManager.Log("Loading machine spools..."); + _activeJobDbContext.Spools.Where(x => x.MachineGuid == SelectedMachine.Guid).Load(); + LogManager.Log("Setting active job..."); ActiveJob = new JobBuilder(_activeJobDbContext).Set(SelectedMachineJob.Guid).WithUser().WithSegments().WithBrushStops().WithConfiguration().WithRML().Build(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index a55d7e696..6857df3c7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -102,6 +102,9 @@ MainView.xaml + + SpoolsView.xaml + Designer MSBuild:Compile @@ -130,6 +133,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index b0b97d7d4..a5b54fed2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -101,6 +101,14 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); } } + private Spool _selectedSpool; + public Spool SelectedSpool + { + get { return _selectedSpool; } + set { _selectedSpool = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + #endregion #region Commands @@ -140,6 +148,16 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// public RelayCommand BackToMachinesCommand { get; set; } + /// + /// Gets or sets the add spool command. + /// + public RelayCommand AddSpoolCommand { get; set; } + + /// + /// Gets or sets the remove spool command. + /// + public RelayCommand RemoveSpoolCommand { get; set; } + #endregion #region Constructors @@ -165,8 +183,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels SaveCommand = new RelayCommand(SaveMachine); AddMachineCommand = new RelayCommand(AddNewMachine); RemoveMachineCommand = new RelayCommand(RemoveSelectedMachine,() => SelectedMachine != null); + AddSpoolCommand = new RelayCommand(AddNewSpool); + RemoveSpoolCommand = new RelayCommand(RemoveSpool,() => SelectedSpool != null); } + #endregion #region Application Ready @@ -489,6 +510,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } } + if (ActiveMachine.Spools.GroupBy(x => x.SpoolType).Any(x => x.Count() > 1)) + { + errors.Add($"Same spool type is registered multiple times."); + } + if (errors.Count > 0) { String errorsString = "Please fix the following validation errors before trying to save." + Environment.NewLine + Environment.NewLine; @@ -508,6 +534,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachine.LastUpdated = DateTime.UtcNow; ActiveMachine.ProductionDate = DateTime.UtcNow; await ActiveMachineAdapter.Context.SaveChangesAsync(); + await SelectedMachine.Reload(MachinesAdapter.Context); } } catch (Exception ex) @@ -554,6 +581,23 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels #endregion + private void AddNewSpool() + { + _activeMachineAdapter.Context.Spools.Add(new Spool() + { + Machine = ActiveMachine, + }); + } + + private void RemoveSpool() + { + if (SelectedSpool != null) + { + _activeMachineAdapter.Context.Spools.Remove(SelectedSpool); + ActiveMachine.Spools.Remove(SelectedSpool); + } + } + private async void OnFilterChanged() { if (Filter != null) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml index 4b021e424..5db96a3a1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml @@ -50,7 +50,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml index 63d1d2305..afd52f38d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml @@ -28,7 +28,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml new file mode 100644 index 000000000..d04389ae7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml.cs new file mode 100644 index 000000000..90a0c37f2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.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.MachineStudio.MachineDesigner.Views +{ + /// + /// Interaction logic for SpoolsView.xaml + /// + public partial class SpoolsView : UserControl + { + public SpoolsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Builders/MachineBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/MachineBuilder.cs index c75c7cec0..dd27d94f0 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/MachineBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/MachineBuilder.cs @@ -47,9 +47,9 @@ namespace Tango.BL.Builders public virtual MachineBuilder WithSpools() { - return AddStep(3, () => + return AddStep(4, () => { - Context.Spools.Where(x => x.MachineGuide == Entity.Guid).Include(x => x.SpoolType).ToList(); + Context.Spools.Where(x => x.MachineGuid == Entity.Guid).Include(x => x.SpoolType).ToList(); }); } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/Spool.cs b/Software/Visual_Studio/Tango.BL/Entities/Spool.cs index a38c1eb48..fa8816ec5 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Spool.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Spool.cs @@ -25,9 +25,15 @@ namespace Tango.BL.Entities public partial class Spool : ObservableEntity { - public event EventHandler MachineGuideChanged; + public event EventHandler StartOffsetPulsesChanged; - public event EventHandler MachineeChanged; + public event EventHandler BackingRateChanged; + + public event EventHandler SegmentOffsetPulsesChanged; + + public event EventHandler BottomBackingRateChanged; + + public event EventHandler MachineChanged; public event EventHandler SpoolTypeChanged; @@ -56,35 +62,140 @@ namespace Tango.BL.Entities } } - protected String _machineguide; + protected String _machineguid; + + /// + /// Gets or sets the spool machine guid. + /// + + [Column("MACHINE_GUID")] + [ForeignKey("Machine")] + + public String MachineGuid + { + get + { + return _machineguid; + } + + set + { + if (_machineguid != value) + { + _machineguid = value; + } + } + } + + protected Int32 _startoffsetpulses; + + /// + /// Gets or sets the spool start offset pulses. + /// + + [Column("START_OFFSET_PULSES")] + + public Int32 StartOffsetPulses + { + get + { + return _startoffsetpulses; + } + + set + { + if (_startoffsetpulses != value) + { + _startoffsetpulses = value; + + OnStartOffsetPulsesChanged(value); + + } + } + } + + protected Int32 _backingrate; + + /// + /// Gets or sets the spool backing rate. + /// + + [Column("BACKING_RATE")] + + public Int32 BackingRate + { + get + { + return _backingrate; + } + + set + { + if (_backingrate != value) + { + _backingrate = value; + + OnBackingRateChanged(value); + + } + } + } + + protected Int32 _segmentoffsetpulses; + + /// + /// Gets or sets the spool segment offset pulses. + /// + + [Column("SEGMENT_OFFSET_PULSES")] + + public Int32 SegmentOffsetPulses + { + get + { + return _segmentoffsetpulses; + } + + set + { + if (_segmentoffsetpulses != value) + { + _segmentoffsetpulses = value; + + OnSegmentOffsetPulsesChanged(value); + + } + } + } + + protected Int32 _bottombackingrate; /// - /// Gets or sets the spool machine guide. + /// Gets or sets the spool bottom backing rate. /// - [Column("MACHINE_GUIDE")] - [ForeignKey("Machinee")] + [Column("BOTTOM_BACKING_RATE")] - public String MachineGuide + public Int32 BottomBackingRate { get { - return _machineguide; + return _bottombackingrate; } set { - if (_machineguide != value) + if (_bottombackingrate != value) { - _machineguide = value; + _bottombackingrate = value; - OnMachineGuideChanged(value); + OnBottomBackingRateChanged(value); } } } - protected Machine _machinee; + protected Machine _machine; /// /// Gets or sets the spool machine. @@ -92,20 +203,20 @@ namespace Tango.BL.Entities [XmlIgnore] [JsonIgnore] - public virtual Machine Machinee + public virtual Machine Machine { get { - return _machinee; + return _machine; } set { - if (_machinee != value) + if (_machine != value) { - _machinee = value; + _machine = value; - OnMachineeChanged(value); + OnMachineChanged(value); } } @@ -139,21 +250,48 @@ namespace Tango.BL.Entities } /// - /// Called when the MachineGuide has changed. + /// Called when the StartOffsetPulses has changed. + /// + protected virtual void OnStartOffsetPulsesChanged(Int32 startoffsetpulses) + { + StartOffsetPulsesChanged?.Invoke(this, startoffsetpulses); + RaisePropertyChanged(nameof(StartOffsetPulses)); + } + + /// + /// Called when the BackingRate has changed. + /// + protected virtual void OnBackingRateChanged(Int32 backingrate) + { + BackingRateChanged?.Invoke(this, backingrate); + RaisePropertyChanged(nameof(BackingRate)); + } + + /// + /// Called when the SegmentOffsetPulses has changed. + /// + protected virtual void OnSegmentOffsetPulsesChanged(Int32 segmentoffsetpulses) + { + SegmentOffsetPulsesChanged?.Invoke(this, segmentoffsetpulses); + RaisePropertyChanged(nameof(SegmentOffsetPulses)); + } + + /// + /// Called when the BottomBackingRate has changed. /// - protected virtual void OnMachineGuideChanged(String machineguide) + protected virtual void OnBottomBackingRateChanged(Int32 bottombackingrate) { - MachineGuideChanged?.Invoke(this, machineguide); - RaisePropertyChanged(nameof(MachineGuide)); + BottomBackingRateChanged?.Invoke(this, bottombackingrate); + RaisePropertyChanged(nameof(BottomBackingRate)); } /// - /// Called when the Machinee has changed. + /// Called when the Machine has changed. /// - protected virtual void OnMachineeChanged(Machine machinee) + protected virtual void OnMachineChanged(Machine machine) { - MachineeChanged?.Invoke(this, machinee); - RaisePropertyChanged(nameof(Machinee)); + MachineChanged?.Invoke(this, machine); + RaisePropertyChanged(nameof(Machine)); } /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/SpoolType.cs b/Software/Visual_Studio/Tango.BL/Entities/SpoolType.cs index eafc39a25..a469220c5 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/SpoolType.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/SpoolType.cs @@ -35,14 +35,6 @@ namespace Tango.BL.Entities public event EventHandler DiameterChanged; - public event EventHandler StartOffsetPulsesChanged; - - public event EventHandler BackingRateChanged; - - public event EventHandler SegmentOffsetPulsesChanged; - - public event EventHandler BottomBackingRateChanged; - public event EventHandler RotationsPerPassageChanged; public event EventHandler> JobsChanged; @@ -186,114 +178,6 @@ namespace Tango.BL.Entities } } - protected Int32 _startoffsetpulses; - - /// - /// Gets or sets the spooltype start offset pulses. - /// - - [Column("START_OFFSET_PULSES")] - - public Int32 StartOffsetPulses - { - get - { - return _startoffsetpulses; - } - - set - { - if (_startoffsetpulses != value) - { - _startoffsetpulses = value; - - OnStartOffsetPulsesChanged(value); - - } - } - } - - protected Int32 _backingrate; - - /// - /// Gets or sets the spooltype backing rate. - /// - - [Column("BACKING_RATE")] - - public Int32 BackingRate - { - get - { - return _backingrate; - } - - set - { - if (_backingrate != value) - { - _backingrate = value; - - OnBackingRateChanged(value); - - } - } - } - - protected Int32 _segmentoffsetpulses; - - /// - /// Gets or sets the spooltype segment offset pulses. - /// - - [Column("SEGMENT_OFFSET_PULSES")] - - public Int32 SegmentOffsetPulses - { - get - { - return _segmentoffsetpulses; - } - - set - { - if (_segmentoffsetpulses != value) - { - _segmentoffsetpulses = value; - - OnSegmentOffsetPulsesChanged(value); - - } - } - } - - protected Int32 _bottombackingrate; - - /// - /// Gets or sets the spooltype bottom backing rate. - /// - - [Column("BOTTOM_BACKING_RATE")] - - public Int32 BottomBackingRate - { - get - { - return _bottombackingrate; - } - - set - { - if (_bottombackingrate != value) - { - _bottombackingrate = value; - - OnBottomBackingRateChanged(value); - - } - } - } - protected Double _rotationsperpassage; /// @@ -441,42 +325,6 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(Diameter)); } - /// - /// Called when the StartOffsetPulses has changed. - /// - protected virtual void OnStartOffsetPulsesChanged(Int32 startoffsetpulses) - { - StartOffsetPulsesChanged?.Invoke(this, startoffsetpulses); - RaisePropertyChanged(nameof(StartOffsetPulses)); - } - - /// - /// Called when the BackingRate has changed. - /// - protected virtual void OnBackingRateChanged(Int32 backingrate) - { - BackingRateChanged?.Invoke(this, backingrate); - RaisePropertyChanged(nameof(BackingRate)); - } - - /// - /// Called when the SegmentOffsetPulses has changed. - /// - protected virtual void OnSegmentOffsetPulsesChanged(Int32 segmentoffsetpulses) - { - SegmentOffsetPulsesChanged?.Invoke(this, segmentoffsetpulses); - RaisePropertyChanged(nameof(SegmentOffsetPulses)); - } - - /// - /// Called when the BottomBackingRate has changed. - /// - protected virtual void OnBottomBackingRateChanged(Int32 bottombackingrate) - { - BottomBackingRateChanged?.Invoke(this, bottombackingrate); - RaisePropertyChanged(nameof(BottomBackingRate)); - } - /// /// Called when the RotationsPerPassage has changed. /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index bb3d1be20..eecb142ee 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -932,10 +932,6 @@ - - - - @@ -946,7 +942,11 @@ - + + + + + @@ -2071,7 +2071,7 @@ - + @@ -2080,7 +2080,7 @@ - + @@ -4107,10 +4107,6 @@ - - - - @@ -4124,7 +4120,11 @@ - + + + + + @@ -5180,7 +5180,7 @@ - + @@ -5189,7 +5189,7 @@ - + @@ -6370,10 +6370,6 @@ - - - - @@ -6388,7 +6384,11 @@ - + + + + + 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 d42da3d76..dc1208fee 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,82 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/SPOOL.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/SPOOL.cs index 0194eb67f..74996acd0 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/SPOOL.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/SPOOL.cs @@ -18,7 +18,11 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public string SPOOL_TYPE_GUID { get; set; } - public string MACHINE_GUIDE { get; set; } + public string MACHINE_GUID { get; set; } + public int START_OFFSET_PULSES { get; set; } + public int BACKING_RATE { get; set; } + public int SEGMENT_OFFSET_PULSES { get; set; } + public int BOTTOM_BACKING_RATE { get; set; } public virtual MACHINE MACHINE { get; set; } public virtual SPOOL_TYPES SPOOL_TYPES { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/SPOOL_TYPES.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/SPOOL_TYPES.cs index dc264ea58..1d8b75f90 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/SPOOL_TYPES.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/SPOOL_TYPES.cs @@ -30,10 +30,6 @@ namespace Tango.DAL.Remote.DB public double LENGTH { get; set; } public double WEIGHT { get; set; } public double DIAMETER { get; set; } - public int START_OFFSET_PULSES { get; set; } - public int BACKING_RATE { get; set; } - public int SEGMENT_OFFSET_PULSES { get; set; } - public int BOTTOM_BACKING_RATE { get; set; } public double ROTATIONS_PER_PASSAGE { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index aa5f93b11..868a87d97 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -1213,6 +1213,18 @@ namespace Tango.Integration.Operation ticket.Spool = new JobSpool(); job.SpoolType.MapPrimitivesTo(ticket.Spool); + + var spool = job.Machine.Spools.SingleOrDefault(x => x.SpoolType == job.SpoolType); + + if (spool == null) + { + throw new InvalidOperationException("Job spool type is not registered with this machine."); + } + else + { + spool.MapPrimitivesTo(ticket.Spool); + } + ticket.Spool.JobSpoolType = (JobSpoolType)job.SpoolType.Code; ProcessParameters process = new ProcessParameters(); diff --git a/Software/Visual_Studio/Tango.PMR/Hardware/HardwareDispenser.cs b/Software/Visual_Studio/Tango.PMR/Hardware/HardwareDispenser.cs index 9e5920f01..25a6742a3 100644 --- a/Software/Visual_Studio/Tango.PMR/Hardware/HardwareDispenser.cs +++ b/Software/Visual_Studio/Tango.PMR/Hardware/HardwareDispenser.cs @@ -26,12 +26,12 @@ namespace Tango.PMR.Hardware { "GhtIYXJkd2FyZURpc3BlbnNlclR5cGUucHJvdG8ikgEKEUhhcmR3YXJlRGlz", "cGVuc2VyEkgKFUhhcmR3YXJlRGlzcGVuc2VyVHlwZRgBIAEoDjIpLlRhbmdv", "LlBNUi5IYXJkd2FyZS5IYXJkd2FyZURpc3BlbnNlclR5cGUSDQoFSW5kZXgY", - "AiABKAUSEgoKTmxQZXJQdWxzZRgDIAEoARIQCghDYXBhY2l0eRgEIAEoAUIe", + "AiABKAUSEAoIQ2FwYWNpdHkYAyABKAESEgoKTmxQZXJQdWxzZRgEIAEoAUIe", "Chxjb20udHdpbmUudGFuZ28ucG1yLmhhcmR3YXJlYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Hardware.HardwareDispenserTypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Hardware.HardwareDispenser), global::Tango.PMR.Hardware.HardwareDispenser.Parser, new[]{ "HardwareDispenserType", "Index", "NlPerPulse", "Capacity" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Hardware.HardwareDispenser), global::Tango.PMR.Hardware.HardwareDispenser.Parser, new[]{ "HardwareDispenserType", "Index", "Capacity", "NlPerPulse" }, null, null, null) })); } #endregion @@ -64,8 +64,8 @@ namespace Tango.PMR.Hardware { public HardwareDispenser(HardwareDispenser other) : this() { hardwareDispenserType_ = other.hardwareDispenserType_; index_ = other.index_; - nlPerPulse_ = other.nlPerPulse_; capacity_ = other.capacity_; + nlPerPulse_ = other.nlPerPulse_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -95,19 +95,8 @@ namespace Tango.PMR.Hardware { } } - /// Field number for the "NlPerPulse" field. - public const int NlPerPulseFieldNumber = 3; - private double nlPerPulse_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double NlPerPulse { - get { return nlPerPulse_; } - set { - nlPerPulse_ = value; - } - } - /// Field number for the "Capacity" field. - public const int CapacityFieldNumber = 4; + public const int CapacityFieldNumber = 3; private double capacity_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double Capacity { @@ -117,6 +106,17 @@ namespace Tango.PMR.Hardware { } } + /// Field number for the "NlPerPulse" field. + public const int NlPerPulseFieldNumber = 4; + private double nlPerPulse_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double NlPerPulse { + get { return nlPerPulse_; } + set { + nlPerPulse_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as HardwareDispenser); @@ -132,8 +132,8 @@ namespace Tango.PMR.Hardware { } if (HardwareDispenserType != other.HardwareDispenserType) return false; if (Index != other.Index) return false; - if (NlPerPulse != other.NlPerPulse) return false; if (Capacity != other.Capacity) return false; + if (NlPerPulse != other.NlPerPulse) return false; return true; } @@ -142,8 +142,8 @@ namespace Tango.PMR.Hardware { int hash = 1; if (HardwareDispenserType != 0) hash ^= HardwareDispenserType.GetHashCode(); if (Index != 0) hash ^= Index.GetHashCode(); - if (NlPerPulse != 0D) hash ^= NlPerPulse.GetHashCode(); if (Capacity != 0D) hash ^= Capacity.GetHashCode(); + if (NlPerPulse != 0D) hash ^= NlPerPulse.GetHashCode(); return hash; } @@ -162,13 +162,13 @@ namespace Tango.PMR.Hardware { output.WriteRawTag(16); output.WriteInt32(Index); } - if (NlPerPulse != 0D) { + if (Capacity != 0D) { output.WriteRawTag(25); - output.WriteDouble(NlPerPulse); + output.WriteDouble(Capacity); } - if (Capacity != 0D) { + if (NlPerPulse != 0D) { output.WriteRawTag(33); - output.WriteDouble(Capacity); + output.WriteDouble(NlPerPulse); } } @@ -181,10 +181,10 @@ namespace Tango.PMR.Hardware { if (Index != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Index); } - if (NlPerPulse != 0D) { + if (Capacity != 0D) { size += 1 + 8; } - if (Capacity != 0D) { + if (NlPerPulse != 0D) { size += 1 + 8; } return size; @@ -201,12 +201,12 @@ namespace Tango.PMR.Hardware { if (other.Index != 0) { Index = other.Index; } - if (other.NlPerPulse != 0D) { - NlPerPulse = other.NlPerPulse; - } if (other.Capacity != 0D) { Capacity = other.Capacity; } + if (other.NlPerPulse != 0D) { + NlPerPulse = other.NlPerPulse; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -226,11 +226,11 @@ namespace Tango.PMR.Hardware { break; } case 25: { - NlPerPulse = input.ReadDouble(); + Capacity = input.ReadDouble(); break; } case 33: { - Capacity = input.ReadDouble(); + NlPerPulse = input.ReadDouble(); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Printing/JobSpool.cs b/Software/Visual_Studio/Tango.PMR/Printing/JobSpool.cs index afe846303..7261ba19b 100644 --- a/Software/Visual_Studio/Tango.PMR/Printing/JobSpool.cs +++ b/Software/Visual_Studio/Tango.PMR/Printing/JobSpool.cs @@ -25,15 +25,15 @@ namespace Tango.PMR.Printing { "Cg5Kb2JTcG9vbC5wcm90bxISVGFuZ28uUE1SLlByaW50aW5nGhJKb2JTcG9v", "bFR5cGUucHJvdG8i+QEKCEpvYlNwb29sEjYKDEpvYlNwb29sVHlwZRgBIAEo", "DjIgLlRhbmdvLlBNUi5QcmludGluZy5Kb2JTcG9vbFR5cGUSDgoGTGVuZ3Ro", - "GAIgASgBEg4KBldlaWdodBgDIAEoARIQCghEaWFtZXRlchgEIAEoARIZChFT", - "dGFydE9mZnNldFB1bHNlcxgFIAEoBRITCgtCYWNraW5nUmF0ZRgGIAEoBRIb", - "ChNTZWdtZW50T2Zmc2V0UHVsc2VzGAcgASgFEhkKEUJvdHRvbUJhY2tpbmdS", - "YXRlGAggASgFEhsKE1JvdGF0aW9uc1BlclBhc3NhZ2UYCSABKAFCHgocY29t", + "GAIgASgBEg4KBldlaWdodBgDIAEoARIQCghEaWFtZXRlchgEIAEoARIbChNS", + "b3RhdGlvbnNQZXJQYXNzYWdlGAUgASgBEhkKEVN0YXJ0T2Zmc2V0UHVsc2Vz", + "GAYgASgFEhMKC0JhY2tpbmdSYXRlGAcgASgFEhsKE1NlZ21lbnRPZmZzZXRQ", + "dWxzZXMYCCABKAUSGQoRQm90dG9tQmFja2luZ1JhdGUYCSABKAVCHgocY29t", "LnR3aW5lLnRhbmdvLnBtci5wcmludGluZ2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Printing.JobSpoolTypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.JobSpool), global::Tango.PMR.Printing.JobSpool.Parser, new[]{ "JobSpoolType", "Length", "Weight", "Diameter", "StartOffsetPulses", "BackingRate", "SegmentOffsetPulses", "BottomBackingRate", "RotationsPerPassage" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.JobSpool), global::Tango.PMR.Printing.JobSpool.Parser, new[]{ "JobSpoolType", "Length", "Weight", "Diameter", "RotationsPerPassage", "StartOffsetPulses", "BackingRate", "SegmentOffsetPulses", "BottomBackingRate" }, null, null, null) })); } #endregion @@ -68,11 +68,11 @@ namespace Tango.PMR.Printing { length_ = other.length_; weight_ = other.weight_; diameter_ = other.diameter_; + rotationsPerPassage_ = other.rotationsPerPassage_; startOffsetPulses_ = other.startOffsetPulses_; backingRate_ = other.backingRate_; segmentOffsetPulses_ = other.segmentOffsetPulses_; bottomBackingRate_ = other.bottomBackingRate_; - rotationsPerPassage_ = other.rotationsPerPassage_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -124,8 +124,19 @@ namespace Tango.PMR.Printing { } } + /// Field number for the "RotationsPerPassage" field. + public const int RotationsPerPassageFieldNumber = 5; + private double rotationsPerPassage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double RotationsPerPassage { + get { return rotationsPerPassage_; } + set { + rotationsPerPassage_ = value; + } + } + /// Field number for the "StartOffsetPulses" field. - public const int StartOffsetPulsesFieldNumber = 5; + public const int StartOffsetPulsesFieldNumber = 6; private int startOffsetPulses_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int StartOffsetPulses { @@ -136,7 +147,7 @@ namespace Tango.PMR.Printing { } /// Field number for the "BackingRate" field. - public const int BackingRateFieldNumber = 6; + public const int BackingRateFieldNumber = 7; private int backingRate_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int BackingRate { @@ -147,7 +158,7 @@ namespace Tango.PMR.Printing { } /// Field number for the "SegmentOffsetPulses" field. - public const int SegmentOffsetPulsesFieldNumber = 7; + public const int SegmentOffsetPulsesFieldNumber = 8; private int segmentOffsetPulses_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int SegmentOffsetPulses { @@ -158,7 +169,7 @@ namespace Tango.PMR.Printing { } /// Field number for the "BottomBackingRate" field. - public const int BottomBackingRateFieldNumber = 8; + public const int BottomBackingRateFieldNumber = 9; private int bottomBackingRate_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int BottomBackingRate { @@ -168,17 +179,6 @@ namespace Tango.PMR.Printing { } } - /// Field number for the "RotationsPerPassage" field. - public const int RotationsPerPassageFieldNumber = 9; - private double rotationsPerPassage_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double RotationsPerPassage { - get { return rotationsPerPassage_; } - set { - rotationsPerPassage_ = value; - } - } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as JobSpool); @@ -196,11 +196,11 @@ namespace Tango.PMR.Printing { if (Length != other.Length) return false; if (Weight != other.Weight) return false; if (Diameter != other.Diameter) return false; + if (RotationsPerPassage != other.RotationsPerPassage) return false; if (StartOffsetPulses != other.StartOffsetPulses) return false; if (BackingRate != other.BackingRate) return false; if (SegmentOffsetPulses != other.SegmentOffsetPulses) return false; if (BottomBackingRate != other.BottomBackingRate) return false; - if (RotationsPerPassage != other.RotationsPerPassage) return false; return true; } @@ -211,11 +211,11 @@ namespace Tango.PMR.Printing { if (Length != 0D) hash ^= Length.GetHashCode(); if (Weight != 0D) hash ^= Weight.GetHashCode(); if (Diameter != 0D) hash ^= Diameter.GetHashCode(); + if (RotationsPerPassage != 0D) hash ^= RotationsPerPassage.GetHashCode(); if (StartOffsetPulses != 0) hash ^= StartOffsetPulses.GetHashCode(); if (BackingRate != 0) hash ^= BackingRate.GetHashCode(); if (SegmentOffsetPulses != 0) hash ^= SegmentOffsetPulses.GetHashCode(); if (BottomBackingRate != 0) hash ^= BottomBackingRate.GetHashCode(); - if (RotationsPerPassage != 0D) hash ^= RotationsPerPassage.GetHashCode(); return hash; } @@ -242,26 +242,26 @@ namespace Tango.PMR.Printing { output.WriteRawTag(33); output.WriteDouble(Diameter); } + if (RotationsPerPassage != 0D) { + output.WriteRawTag(41); + output.WriteDouble(RotationsPerPassage); + } if (StartOffsetPulses != 0) { - output.WriteRawTag(40); + output.WriteRawTag(48); output.WriteInt32(StartOffsetPulses); } if (BackingRate != 0) { - output.WriteRawTag(48); + output.WriteRawTag(56); output.WriteInt32(BackingRate); } if (SegmentOffsetPulses != 0) { - output.WriteRawTag(56); + output.WriteRawTag(64); output.WriteInt32(SegmentOffsetPulses); } if (BottomBackingRate != 0) { - output.WriteRawTag(64); + output.WriteRawTag(72); output.WriteInt32(BottomBackingRate); } - if (RotationsPerPassage != 0D) { - output.WriteRawTag(73); - output.WriteDouble(RotationsPerPassage); - } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -279,6 +279,9 @@ namespace Tango.PMR.Printing { if (Diameter != 0D) { size += 1 + 8; } + if (RotationsPerPassage != 0D) { + size += 1 + 8; + } if (StartOffsetPulses != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(StartOffsetPulses); } @@ -291,9 +294,6 @@ namespace Tango.PMR.Printing { if (BottomBackingRate != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(BottomBackingRate); } - if (RotationsPerPassage != 0D) { - size += 1 + 8; - } return size; } @@ -314,6 +314,9 @@ namespace Tango.PMR.Printing { if (other.Diameter != 0D) { Diameter = other.Diameter; } + if (other.RotationsPerPassage != 0D) { + RotationsPerPassage = other.RotationsPerPassage; + } if (other.StartOffsetPulses != 0) { StartOffsetPulses = other.StartOffsetPulses; } @@ -326,9 +329,6 @@ namespace Tango.PMR.Printing { if (other.BottomBackingRate != 0) { BottomBackingRate = other.BottomBackingRate; } - if (other.RotationsPerPassage != 0D) { - RotationsPerPassage = other.RotationsPerPassage; - } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -355,24 +355,24 @@ namespace Tango.PMR.Printing { Diameter = input.ReadDouble(); break; } - case 40: { - StartOffsetPulses = input.ReadInt32(); + case 41: { + RotationsPerPassage = input.ReadDouble(); break; } case 48: { - BackingRate = input.ReadInt32(); + StartOffsetPulses = input.ReadInt32(); break; } case 56: { - SegmentOffsetPulses = input.ReadInt32(); + BackingRate = input.ReadInt32(); break; } case 64: { - BottomBackingRate = input.ReadInt32(); + SegmentOffsetPulses = input.ReadInt32(); break; } - case 73: { - RotationsPerPassage = input.ReadDouble(); + case 72: { + BottomBackingRate = input.ReadInt32(); break; } } diff --git a/Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI/Program.cs index fda19dbd1..849dd5cde 100644 --- a/Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.PMRGenerator.CLI/Program.cs @@ -214,6 +214,14 @@ namespace Tango.PMRGenerator.CLI } } + foreach (var prop in typeof(Dispenser).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive)) + { + if (prop.Name != nameof(Dispenser.IsInstalled)) + { + messageFile.Properties.Add(new ProtoProperty(prop.Name, CoercePropertyType(prop.PropertyType), GetDbDescription(prop))); + } + } + String enumString = enumFile.GenerateCode(); String messageString = messageFile.GenerateCode(); @@ -534,6 +542,11 @@ namespace Tango.PMRGenerator.CLI } } + foreach (var prop in typeof(Spool).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(x => x.PropertyType.IsPrimitive)) + { + messageFile.Properties.Add(new ProtoProperty(prop.Name, CoercePropertyType(prop.PropertyType))); + } + String enumString = enumFile.GenerateCode(); String messageString = messageFile.GenerateCode(); -- cgit v1.3.1