From 721e03d7e6926055111d4edbbdf5f700a11ed58a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 30 Dec 2018 15:23:34 +0200 Subject: Working on new Machine Designer. --- .../Views/MachineSettingsView.xaml | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml') 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 new file mode 100644 index 000000000..63d1d2305 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + Serial Number + + + Name + + + Machine Version + + + Organization + + + Default RML + + + Loaded RML + + + Default Color Space + + + Default Segment Length + + + Default Spool Type + + + OS Key + + + + + Auto Login + + + Auto Check For Updates + + + Setup Activation + + + Setup Remote Assistance + + + Setup UWF + + + Setup Firmware + + + Setup FPGA + + + Is Demo Machine + + + + + + + + -- 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.MachineDesigner/Views/MachineSettingsView.xaml') 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