From 68902601817604f65cc2ec67f28002e9c20f51c8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 28 Oct 2019 16:52:47 +0200 Subject: Added import /export to hardware version in machine studio. --- .../ViewModels/MainViewVM.cs | 89 +++++++++++++++++++++- 1 file changed, 87 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 918eb02d4..40dc82d29 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -14,6 +14,8 @@ using System.Runtime.CompilerServices; using Tango.MachineStudio.Common; using Tango.Core.ExtensionMethods; using Tango.MachineStudio.HardwareDesigner.Views; +using Microsoft.Win32; +using System.IO; namespace Tango.MachineStudio.HardwareDesigner.ViewModels { @@ -87,7 +89,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels return name; } } - + private ObservableCollection _hardwareVersions; public ObservableCollection HardwareVersions { @@ -107,6 +109,10 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels public RelayCommand OpenComparisonWizardCommand { get; set; } + public RelayCommand ExportHardwareVersionCommand { get; set; } + + public RelayCommand ImportHardwareVersionCommand { get; set; } + public MainViewVM(INotificationProvider notification) { _notification = notification; @@ -122,7 +128,86 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels CopyParametersCommand = new RelayCommand(CopyParameters, (x) => SelectedVersion != null && IsFree); CloneCommand = new RelayCommand(CloneCurrentVersion, () => SelectedVersion != null && IsFree); - OpenComparisonWizardCommand = new RelayCommand(OpenComparisonWizard); + OpenComparisonWizardCommand = new RelayCommand(OpenComparisonWizard, () => IsFree); + ExportHardwareVersionCommand = new RelayCommand(ExportHardwareVersion, () => IsFree && SelectedVersion != null && CurrentVersion != null); + ImportHardwareVersionCommand = new RelayCommand(ImportHardwareVersion, () => IsFree); + } + + private async void ExportHardwareVersion() + { + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Export hardware version"; + dlg.DefaultExt = ".hv"; + dlg.Filter = "Hardware Version Files|*.hv"; + + if (dlg.ShowDialog().Value) + { + try + { + var json = await CurrentVersion.ToHardwareVersionFile(); + File.WriteAllText(dlg.FileName, json); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error exporting hardware version."); + _notification.ShowError($"An error occurred while trying to export the selected hardware version.\n{ex.FlattenMessage()}"); + } + } + } + + private async void ImportHardwareVersion() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Title = "Import hardware version"; + dlg.DefaultExt = ".hv"; + dlg.Filter = "Hardware Version Files|*.hv"; + + if (dlg.ShowDialog().Value) + { + try + { + var hv = await HardwareVersion.FromHardwareVersionFile(File.ReadAllText(dlg.FileName)); + + String name = _notification.ShowTextInput("Enter hardware version name", "Name", hv.Name); + if (!String.IsNullOrWhiteSpace(name)) + { + using (_notification.PushTaskItem("Importing hardware version...")) + { + try + { + IsFree = false; + + hv.Name = name; + hv.Version = HardwareVersions.Max(x => x.Version) + 1; + + _db.HardwareVersions.Add(hv); + await _db.SaveChangesAsync(); + + RefreshVersions(); + + InvokeUI(() => + { + SelectedVersion = HardwareVersions.SingleOrDefault(x => x.Guid == hv.Guid); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error importing hardware version."); + _notification.ShowError($"An error occurred while trying to import the selected hardware version.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error importing hardware version."); + _notification.ShowError($"An error occurred while trying to load the selected hardware version file.\n{ex.FlattenMessage()}"); + } + } } public override void OnApplicationReady() -- cgit v1.3.1 From 36bde2234f457f4bb93caf6d1f2e47ddf895be39 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 6 Dec 2019 21:10:57 +0200 Subject: Added new PID and heaters to hw, diagnostics and tech. Implemented proper sorting on hw version and tech board. (DB CHANGE!) Related Work Items: #1595 --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/TCC/TCC.mdf | Bin 8388608 -> 8388608 bytes Software/DB/TCC/TCC_log.ldf | Bin 8388608 -> 8388608 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Messages/Diagnostics/DiagnosticsMonitors.proto | 57 +++ Software/PMR/Messages/Diagnostics/HeaterType.proto | 16 + .../PMR/Messages/Hardware/HardwareBlowerType.proto | 9 + .../Messages/Hardware/HardwarePidControlType.proto | 30 ++ .../ViewModels/MainViewVM.cs | 14 +- .../Tango.BL/Enumerations/HardwareBlowerTypes.cs | 18 + .../Enumerations/HardwarePidControlTypes.cs | 60 +++ .../Tango.BL/Enumerations/TechHeaters.cs | 48 +++ .../Tango.BL/Enumerations/TechMonitors.cs | 114 +++++ .../Tango.BL/ObservablesStaticCollections.cs | 26 +- .../ExtensionMethods/IEnumerableExtensions.cs | 17 + .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 65 +-- .../Debugging/SetupDebugDisributorsRequest.cs | 73 +++- .../Tango.PMR/Diagnostics/DiagnosticsMonitors.cs | 478 ++++++++++++++++++++- .../Tango.PMR/Diagnostics/HeaterType.cs | 17 +- .../Diagnostics/StartThreadLoadingUpdateRequest.cs | 132 ++++++ .../StartThreadLoadingUpdateResponse.cs | 162 +++++++ .../Tango.PMR/Diagnostics/ThreadLoadingState.cs | 97 +++++ .../Tango.PMR/Hardware/HardwareBlowerType.cs | 17 +- .../Tango.PMR/Hardware/HardwarePidControlType.cs | 50 ++- Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 5 +- .../ObservableCollectionToViewSourceConverter.cs | 49 +++ .../Tango.SharedUI/Tango.SharedUI.csproj | 3 +- 29 files changed, 1473 insertions(+), 84 deletions(-) create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/StartThreadLoadingUpdateRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/StartThreadLoadingUpdateResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/ThreadLoadingState.cs create mode 100644 Software/Visual_Studio/Tango.SharedUI/Converters/ObservableCollectionToViewSourceConverter.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 90c4e518d..5fc6097f0 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 7eb593592..d987dddda 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf index 784d78c65..809896c55 100644 Binary files a/Software/DB/TCC/TCC.mdf and b/Software/DB/TCC/TCC.mdf differ diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf index 374c2823f..1ad0a610a 100644 Binary files a/Software/DB/TCC/TCC_log.ldf and b/Software/DB/TCC/TCC_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 8b4cdac9e..b047fb660 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 5b45434b8..c2157b368 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Diagnostics/DiagnosticsMonitors.proto b/Software/PMR/Messages/Diagnostics/DiagnosticsMonitors.proto index 9a988beb8..d3a9079a3 100644 --- a/Software/PMR/Messages/Diagnostics/DiagnosticsMonitors.proto +++ b/Software/PMR/Messages/Diagnostics/DiagnosticsMonitors.proto @@ -216,4 +216,61 @@ message DiagnosticsMonitors //Overall Temperature (Min = 0, Max = 100, PPF = 1) repeated double OverallTemperature = 66; + //Head Zone 7 Heater Current (Min = 0, Max = 100, PPF = 1) + repeated double HeadZone7HeaterCurrent = 67; + + //Head Zone 7 (Min = 0, Max = 300, PPF = 10) + repeated double HeadZone7Temperature = 68; + + //Head Zone 8 Heater Current (Min = 0, Max = 100, PPF = 1) + repeated double HeadZone8HeaterCurrent = 69; + + //Head Zone 8 (Min = 0, Max = 300, PPF = 10) + repeated double HeadZone8Temperature = 70; + + //Head Zone 9 Heater Current (Min = 0, Max = 100, PPF = 1) + repeated double HeadZone9HeaterCurrent = 71; + + //Head Zone 9 (Min = 0, Max = 300, PPF = 10) + repeated double HeadZone9Temperature = 72; + + //Head Zone 10 Heater Current (Min = 0, Max = 100, PPF = 1) + repeated double HeadZone10HeaterCurrent = 73; + + //Head Zone 10 (Min = 0, Max = 300, PPF = 10) + repeated double HeadZone10Temperature = 74; + + //Head Zone 11 Heater Current (Min = 0, Max = 100, PPF = 1) + repeated double HeadZone11HeaterCurrent = 75; + + //Head Zone 11 (Min = 0, Max = 300, PPF = 10) + repeated double HeadZone11Temperature = 76; + + //Head Zone 12 Heater Current (Min = 0, Max = 100, PPF = 1) + repeated double HeadZone12HeaterCurrent = 77; + + //Head Zone 12 (Min = 0, Max = 300, PPF = 10) + repeated double HeadZone12Temperature = 78; + + //Head Blower Voltage 1 (Min = 0, Max = 100, PPF = 10) + repeated double HeadBlowerVoltage1 = 79; + + //Head Blower Voltage 2 (Min = 0, Max = 100, PPF = 10) + repeated double HeadBlowerVoltage2 = 80; + + //Head Cover Heater 1 Current (Min = 0, Max = 100, PPF = 1) + repeated double HeadCoverHeater1Current = 81; + + //Head Cover Heater 1 Temperature (Min = 0, Max = 300, PPF = 10) + repeated double HeadCoverHeater1Temperature = 82; + + //Head Cover Heater 2 Current (Min = 0, Max = 100, PPF = 1) + repeated double HeadCoverHeater2Current = 83; + + //Head Cover Heater 2 Temperature (Min = 0, Max = 300, PPF = 10) + repeated double HeadCoverHeater2Temperature = 84; + + //WHS Blower 2 Voltage (Min = 0, Max = 100, PPF = 10) + repeated double WHSBlower2Voltage = 85; + } diff --git a/Software/PMR/Messages/Diagnostics/HeaterType.proto b/Software/PMR/Messages/Diagnostics/HeaterType.proto index da657b3ea..475f2e7bb 100644 --- a/Software/PMR/Messages/Diagnostics/HeaterType.proto +++ b/Software/PMR/Messages/Diagnostics/HeaterType.proto @@ -36,4 +36,20 @@ enum HeaterType MixerHeater = 9; + HeaterZone7 = 10; + + HeaterZone8 = 11; + + HeaterZone9 = 12; + + HeaterZone10 = 13; + + HeaterZone11 = 14; + + HeaterZone12 = 15; + + HeadCoverHeater1 = 16; + + HeadCoverHeater2 = 17; + } diff --git a/Software/PMR/Messages/Hardware/HardwareBlowerType.proto b/Software/PMR/Messages/Hardware/HardwareBlowerType.proto index b28eab584..90fb545e1 100644 --- a/Software/PMR/Messages/Hardware/HardwareBlowerType.proto +++ b/Software/PMR/Messages/Hardware/HardwareBlowerType.proto @@ -19,4 +19,13 @@ enum HardwareBlowerType //Default Blower DefaultBlower = 0; + //Head Blower 1 + HeadBlower11 = 1; + + //Head Blower 2 + HeadBlower2 = 2; + + //WHS Blower 2 + WHSBlower2 = 3; + } diff --git a/Software/PMR/Messages/Hardware/HardwarePidControlType.proto b/Software/PMR/Messages/Hardware/HardwarePidControlType.proto index 867a7e4b2..1107f6501 100644 --- a/Software/PMR/Messages/Hardware/HardwarePidControlType.proto +++ b/Software/PMR/Messages/Hardware/HardwarePidControlType.proto @@ -85,4 +85,34 @@ enum HardwarePidControlType //Dispenser 8 Dispenser8 = 22; + //Head Heater Zone 7 + HeadHeaterZ7 = 23; + + //Head Heater Zone 8 + HeadHeaterZ8 = 24; + + //Head Heater Zone 9 + HeadHeaterZ9 = 25; + + //Head Heater Zone 10 + HeadHeaterZ10 = 26; + + //Head Heater Zone 11 + HeadHeaterZ11 = 27; + + //Head Heater Zone 12 + HeadHeaterZ12 = 28; + + //Head Cover Heater 1 + HeadCoverHeater1 = 29; + + //Head Cover Heater 2 + HeadCoverHeater2 = 30; + + //Head Blower 1 + HeadBlower_1 = 31; + + //Head Blower 2 + HeadBlower_2 = 32; + } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 40dc82d29..7ebcbeb55 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -236,13 +236,13 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels _db = ObservablesContext.CreateDefault(); - CurrentVersion.HardwareMotors = _db.HardwareMotorTypes.ToList().Select(x => new HardwareMotor() { HardwareMotorType = x }).ToSynchronizedObservableCollection(); - CurrentVersion.HardwareDancers = _db.HardwareDancerTypes.ToList().Select(x => new HardwareDancer() { HardwareDancerType = x }).ToSynchronizedObservableCollection(); - CurrentVersion.HardwarePidControls = _db.HardwarePidControlTypes.ToList().Select(x => new HardwarePidControl() { HardwarePidControlType = x }).ToSynchronizedObservableCollection(); - CurrentVersion.HardwareWinders = _db.HardwareWinderTypes.ToList().Select(x => new HardwareWinder() { HardwareWinderType = x }).ToSynchronizedObservableCollection(); - CurrentVersion.HardwareSpeedSensors = _db.HardwareSpeedSensorTypes.ToList().Select(x => new HardwareSpeedSensor() { HardwareSpeedSensorType = x }).ToSynchronizedObservableCollection(); - CurrentVersion.HardwareBlowers = _db.HardwareBlowerTypes.ToList().Select(x => new HardwareBlower() { HardwareBlowerType = x }).ToSynchronizedObservableCollection(); - CurrentVersion.HardwareBreakSensors = _db.HardwareBreakSensorTypes.ToList().Select(x => new HardwareBreakSensor() { HardwareBreakSensorType = x }).ToSynchronizedObservableCollection(); + CurrentVersion.HardwareMotors = _db.HardwareMotorTypes.ToList().Select(x => new HardwareMotor() { HardwareMotorType = x }).OrderByAlphaNumeric(x => x.HardwareMotorType.Description).ToSynchronizedObservableCollection(); + CurrentVersion.HardwareDancers = _db.HardwareDancerTypes.ToList().Select(x => new HardwareDancer() { HardwareDancerType = x }).OrderByAlphaNumeric(x => x.HardwareDancerType.Description).ToSynchronizedObservableCollection(); + CurrentVersion.HardwarePidControls = _db.HardwarePidControlTypes.ToList().Select(x => new HardwarePidControl() { HardwarePidControlType = x }).OrderByAlphaNumeric(x => x.HardwarePidControlType.Description).ToSynchronizedObservableCollection(); + CurrentVersion.HardwareWinders = _db.HardwareWinderTypes.ToList().Select(x => new HardwareWinder() { HardwareWinderType = x }).OrderByAlphaNumeric(x => x.HardwareWinderType.Description).ToSynchronizedObservableCollection(); + CurrentVersion.HardwareSpeedSensors = _db.HardwareSpeedSensorTypes.ToList().Select(x => new HardwareSpeedSensor() { HardwareSpeedSensorType = x }).OrderByAlphaNumeric(x => x.HardwareSpeedSensorType.Description).ToSynchronizedObservableCollection(); + CurrentVersion.HardwareBlowers = _db.HardwareBlowerTypes.ToList().Select(x => new HardwareBlower() { HardwareBlowerType = x }).OrderByAlphaNumeric(x => x.HardwareBlowerType.Description).ToSynchronizedObservableCollection(); + CurrentVersion.HardwareBreakSensors = _db.HardwareBreakSensorTypes.ToList().Select(x => new HardwareBreakSensor() { HardwareBreakSensorType = x }).OrderByAlphaNumeric(x => x.HardwareBreakSensorType.Description).ToSynchronizedObservableCollection(); } private void RefreshVersions() diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/HardwareBlowerTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/HardwareBlowerTypes.cs index 1f2a3deec..53c30ce7e 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/HardwareBlowerTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/HardwareBlowerTypes.cs @@ -25,5 +25,23 @@ namespace Tango.BL.Enumerations [Description("Default Blower")] DefaultBlower = 0, + /// + /// (Head Blower 1) + /// + [Description("Head Blower 1")] + HeadBlower11 = 1, + + /// + /// (Head Blower 2) + /// + [Description("Head Blower 2")] + HeadBlower2 = 2, + + /// + /// (WHS Blower 2) + /// + [Description("WHS Blower 2")] + WHSBlower2 = 3, + } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs index 6322ba4e1..85e302598 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs @@ -157,5 +157,65 @@ namespace Tango.BL.Enumerations [Description("Dispenser 8")] Dispenser8 = 22, + /// + /// (Head Heater Zone 7) + /// + [Description("Head Heater Zone 7")] + HeadHeaterZ7 = 23, + + /// + /// (Head Heater Zone 8) + /// + [Description("Head Heater Zone 8")] + HeadHeaterZ8 = 24, + + /// + /// (Head Heater Zone 9) + /// + [Description("Head Heater Zone 9")] + HeadHeaterZ9 = 25, + + /// + /// (Head Heater Zone 10) + /// + [Description("Head Heater Zone 10")] + HeadHeaterZ10 = 26, + + /// + /// (Head Heater Zone 11) + /// + [Description("Head Heater Zone 11")] + HeadHeaterZ11 = 27, + + /// + /// (Head Heater Zone 12) + /// + [Description("Head Heater Zone 12")] + HeadHeaterZ12 = 28, + + /// + /// (Head Cover Heater 1) + /// + [Description("Head Cover Heater 1")] + HeadCoverHeater1 = 29, + + /// + /// (Head Cover Heater 2) + /// + [Description("Head Cover Heater 2")] + HeadCoverHeater2 = 30, + + /// + /// (Head Blower 1) + /// + [Description("Head Blower 1")] + HeadBlower_1 = 31, + + /// + /// (Head Blower 2) + /// + [Description("Head Blower 2")] + HeadBlower_2 = 32, + } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TechHeaters.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TechHeaters.cs index a73fbb244..9731e5b61 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/TechHeaters.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TechHeaters.cs @@ -79,5 +79,53 @@ namespace Tango.BL.Enumerations [Description("Mixer Heater")] MixerHeater = 9, + /// + /// (Heater Zone 7) + /// + [Description("Heater Zone 7")] + HeaterZone7 = 10, + + /// + /// (Heater Zone 8) + /// + [Description("Heater Zone 8")] + HeaterZone8 = 11, + + /// + /// (Heater Zone 9) + /// + [Description("Heater Zone 9")] + HeaterZone9 = 12, + + /// + /// (Heater Zone 10) + /// + [Description("Heater Zone 10")] + HeaterZone10 = 13, + + /// + /// (Heater Zone 11) + /// + [Description("Heater Zone 11")] + HeaterZone11 = 14, + + /// + /// (Heater Zone 12) + /// + [Description("Heater Zone 12")] + HeaterZone12 = 15, + + /// + /// (Head Cover Heater 1) + /// + [Description("Head Cover Heater 1")] + HeadCoverHeater1 = 16, + + /// + /// (Head Cover Heater 2) + /// + [Description("Head Cover Heater 2")] + HeadCoverHeater2 = 17, + } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TechMonitors.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TechMonitors.cs index ad77d945c..e1761c86f 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/TechMonitors.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TechMonitors.cs @@ -241,6 +241,78 @@ namespace Tango.BL.Enumerations [Description("Head Air Flow")] HeadAirFlow = 13, + /// + /// (Head Blower Voltage 1) + /// + [Description("Head Blower Voltage 1")] + HeadBlowerVoltage1 = 212, + + /// + /// (Head Blower Voltage 2) + /// + [Description("Head Blower Voltage 2")] + HeadBlowerVoltage2 = 213, + + /// + /// (Head Cover Heater 1 Current) + /// + [Description("Head Cover Heater 1 Current")] + HeadCoverHeater1Current = 214, + + /// + /// (Head Cover Heater 1 Temperature) + /// + [Description("Head Cover Heater 1 Temperature")] + HeadCoverHeater1Temperature = 215, + + /// + /// (Head Cover Heater 2 Current) + /// + [Description("Head Cover Heater 2 Current")] + HeadCoverHeater2Current = 216, + + /// + /// (Head Cover Heater 2 Temperature) + /// + [Description("Head Cover Heater 2 Temperature")] + HeadCoverHeater2Temperature = 217, + + /// + /// (Head Zone 10 Heater Current) + /// + [Description("Head Zone 10 Heater Current")] + HeadZone10HeaterCurrent = 206, + + /// + /// (Head Zone 10) + /// + [Description("Head Zone 10")] + HeadZone10Temperature = 207, + + /// + /// (Head Zone 11 Heater Current) + /// + [Description("Head Zone 11 Heater Current")] + HeadZone11HeaterCurrent = 208, + + /// + /// (Head Zone 11) + /// + [Description("Head Zone 11")] + HeadZone11Temperature = 209, + + /// + /// (Head Zone 12 Heater Current) + /// + [Description("Head Zone 12 Heater Current")] + HeadZone12HeaterCurrent = 210, + + /// + /// (Head Zone 12) + /// + [Description("Head Zone 12")] + HeadZone12Temperature = 211, + /// /// (Head Zone 1 Heater Current) /// @@ -307,6 +379,42 @@ namespace Tango.BL.Enumerations [Description("Head Zone 6")] HeadZone6Temperature = 38, + /// + /// (Head Zone 7 Heater Current) + /// + [Description("Head Zone 7 Heater Current")] + HeadZone7HeaterCurrent = 200, + + /// + /// (Head Zone 7) + /// + [Description("Head Zone 7")] + HeadZone7Temperature = 201, + + /// + /// (Head Zone 8 Heater Current) + /// + [Description("Head Zone 8 Heater Current")] + HeadZone8HeaterCurrent = 202, + + /// + /// (Head Zone 8) + /// + [Description("Head Zone 8")] + HeadZone8Temperature = 203, + + /// + /// (Head Zone 9 Heater Current) + /// + [Description("Head Zone 9 Heater Current")] + HeadZone9HeaterCurrent = 204, + + /// + /// (Head Zone 9) + /// + [Description("Head Zone 9")] + HeadZone9Temperature = 205, + /// /// (Mid Tank 1 Level) /// @@ -403,6 +511,12 @@ namespace Tango.BL.Enumerations [Description("Thread Speed")] ThreadSpeed = 8, + /// + /// (WHS Blower 2 Voltage) + /// + [Description("WHS Blower 2 Voltage")] + WHSBlower2Voltage = 300, + /// /// (Winder Motor) /// diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs index 1e0d5546d..5d1c3e148 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs @@ -58,8 +58,6 @@ namespace Tango.BL { db = ObservablesContext.CreateDefault(); - TaskSequencer sequencer = new TaskSequencer(); - WindingMethods = db.WindingMethods.ToObservableCollection(); ColorSpaces = db.ColorSpaces.ToObservableCollection(); @@ -67,33 +65,33 @@ namespace Tango.BL EventTypes = db.EventTypes.ToObservableCollection(); - HardwareBlowerTypes = db.HardwareBlowerTypes.ToObservableCollection(); + HardwareBlowerTypes = db.HardwareBlowerTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); HardwareBlowers = db.HardwareBlowers.ToObservableCollection(); - HardwareBreakSensorTypes = db.HardwareBreakSensorTypes.ToObservableCollection(); + HardwareBreakSensorTypes = db.HardwareBreakSensorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); HardwareBreakSensors = db.HardwareBreakSensors.ToObservableCollection(); - HardwareDancerTypes = db.HardwareDancerTypes.ToObservableCollection(); + HardwareDancerTypes = db.HardwareDancerTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); HardwareDancers = db.HardwareDancers.ToObservableCollection(); - HardwareMotorTypes = db.HardwareMotorTypes.ToObservableCollection(); + HardwareMotorTypes = db.HardwareMotorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); HardwareMotors = db.HardwareMotors.ToObservableCollection(); - HardwarePidControlTypes = db.HardwarePidControlTypes.ToObservableCollection(); + HardwarePidControlTypes = db.HardwarePidControlTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); HardwarePidControls = db.HardwarePidControls.ToObservableCollection(); - HardwareSpeedSensorTypes = db.HardwareSpeedSensorTypes.ToObservableCollection(); + HardwareSpeedSensorTypes = db.HardwareSpeedSensorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); HardwareSpeedSensors = db.HardwareSpeedSensors.ToObservableCollection(); - HardwareWinderTypes = db.HardwareWinderTypes.ToObservableCollection(); + HardwareWinderTypes = db.HardwareWinderTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); HardwareWinders = db.HardwareWinders.ToObservableCollection(); - TechControllers = db.TechControllers.ToObservableCollection(); - TechDispensers = db.TechDispensers.ToObservableCollection(); + TechControllers = db.TechControllers.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); + TechDispensers = db.TechDispensers.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); TechIos = db.TechIos.ToObservableCollection(); - TechMonitors = db.TechMonitors.ToObservableCollection(); - TechValves = db.TechValves.ToObservableCollection(); - TechHeaters = db.TechHeaters.ToObservableCollection(); + TechMonitors = db.TechMonitors.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); + TechValves = db.TechValves.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); + TechHeaters = db.TechHeaters.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); Machines = db.Machines.Include(x => x.Organization).ToObservableCollection(); diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs index f4192a88b..68594d8ac 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using Tango.Core; @@ -104,5 +105,21 @@ public static class IEnumerableExtensions { return source.GroupBy(property).Select(g => g.First()); } + + /// + /// Orders the collection by natural alphanumeric string. + /// + /// + /// The source. + /// The selector. + /// + public static IOrderedEnumerable OrderByAlphaNumeric(this IEnumerable source, Func selector) + { + int max = source + .SelectMany(i => Regex.Matches(selector(i), @"\d+").Cast().Select(m => (int?)m.Value.Length)) + .Max() ?? 0; + + return source.OrderBy(i => Regex.Replace(selector(i), @"\d+", m => m.Value.PadLeft(max, '0'))); + } } diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index 6ae399816..38e58a257 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static MessageTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirvMwoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiq2NAoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhEKDUVycm9yUmVzcG9uc2UQARIUChBDYWxj", "dWxhdGVSZXF1ZXN0EAMSFQoRQ2FsY3VsYXRlUmVzcG9uc2UQBBITCg9Qcm9n", "cmVzc1JlcXVlc3QQBRIUChBQcm9ncmVzc1Jlc3BvbnNlEAYSHAoYU3R1YkNh", @@ -142,36 +142,37 @@ namespace Tango.PMR.Common { "RGVidWdMb2dSZXF1ZXN0EKAfEhoKFVN0YXJ0RGVidWdMb2dSZXNwb25zZRCh", "HxIYChNTdG9wRGVidWdMb2dSZXF1ZXN0EKIfEhkKFFN0b3BEZWJ1Z0xvZ1Jl", "c3BvbnNlEKMfEh8KGlNldERlYnVnTG9nQ2F0ZWdvcnlSZXF1ZXN0EKQfEiAK", - "G1NldERlYnVnTG9nQ2F0ZWdvcnlSZXNwb25zZRClHxInCiJVcGxvYWRIYXJk", - "d2FyZUNvbmZpZ3VyYXRpb25SZXF1ZXN0EIgnEigKI1VwbG9hZEhhcmR3YXJl", - "Q29uZmlndXJhdGlvblJlc3BvbnNlEIknEhcKElN5c3RlbVJlc2V0UmVxdWVz", - "dBCKJxIYChNTeXN0ZW1SZXNldFJlc3BvbnNlEIsnEhUKEEtlZXBBbGl2ZVJl", - "cXVlc3QQ8C4SFgoRS2VlcEFsaXZlUmVzcG9uc2UQ8S4SEwoOQ29ubmVjdFJl", - "cXVlc3QQ8i4SFAoPQ29ubmVjdFJlc3BvbnNlEPMuEhYKEURpc2Nvbm5lY3RS", - "ZXF1ZXN0EPQuEhcKEkRpc2Nvbm5lY3RSZXNwb25zZRD1LhIWChFGaWxlVXBs", - "b2FkUmVxdWVzdBDYNhIXChJGaWxlVXBsb2FkUmVzcG9uc2UQ2TYSGwoWRmls", - "ZUNodW5rVXBsb2FkUmVxdWVzdBDaNhIcChdGaWxlQ2h1bmtVcGxvYWRSZXNw", - "b25zZRDbNhIaChVFeGVjdXRlUHJvY2Vzc1JlcXVlc3QQ3DYSGwoWRXhlY3V0", - "ZVByb2Nlc3NSZXNwb25zZRDdNhIXChJLaWxsUHJvY2Vzc1JlcXVlc3QQ3jYS", - "GAoTS2lsbFByb2Nlc3NSZXNwb25zZRDfNhISCg1DcmVhdGVSZXF1ZXN0EOA2", - "EhMKDkNyZWF0ZVJlc3BvbnNlEOE2EhIKDURlbGV0ZVJlcXVlc3QQ4jYSEwoO", - "RGVsZXRlUmVzcG9uc2UQ4zYSGgoVR2V0U3RvcmFnZUluZm9SZXF1ZXN0EOQ2", - "EhsKFkdldFN0b3JhZ2VJbmZvUmVzcG9uc2UQ5TYSFAoPR2V0RmlsZXNSZXF1", - "ZXN0EOY2EhUKEEdldEZpbGVzUmVzcG9uc2UQ5zYSGAoTRmlsZURvd25sb2Fk", - "UmVxdWVzdBDoNhIZChRGaWxlRG93bmxvYWRSZXNwb25zZRDpNhIdChhGaWxl", - "Q2h1bmtEb3dubG9hZFJlcXVlc3QQ6jYSHgoZRmlsZUNodW5rRG93bmxvYWRS", - "ZXNwb25zZRDrNhIbChZWYWxpZGF0ZVZlcnNpb25SZXF1ZXN0EOw2EhwKF1Zh", - "bGlkYXRlVmVyc2lvblJlc3BvbnNlEO02EhsKFkFjdGl2YXRlVmVyc2lvblJl", - "cXVlc3QQ7jYSHAoXQWN0aXZhdGVWZXJzaW9uUmVzcG9uc2UQ7zYSGQoURGlz", - "cGVuc2VyRGF0YVJlcXVlc3QQwD4SGgoVRGlzcGVuc2VyRGF0YVJlc3BvbnNl", - "EME+EhwKF01pZFRhbmtEYXRhU2V0dXBSZXF1ZXN0EMI+Eh0KGE1pZFRhbmtE", - "YXRhU2V0dXBSZXNwb25zZRDDPhIiCh1NYWNoaW5lQ2FsaWJyYXRpb25EYXRh", - "UmVxdWVzdBDEPhIjCh5NYWNoaW5lQ2FsaWJyYXRpb25EYXRhUmVzcG9uc2UQ", - "xT4SJAofU3RhcnRNYWNoaW5lU3RhdHVzVXBkYXRlUmVxdWVzdBCoRhIlCiBT", - "dGFydE1hY2hpbmVTdGF0dXNVcGRhdGVSZXNwb25zZRCpRhIjCh5TdG9wTWFj", - "aGluZVN0YXR1c1VwZGF0ZVJlcXVlc3QQqkYSJAofU3RvcE1hY2hpbmVTdGF0", - "dXNVcGRhdGVSZXNwb25zZRCrRkIcChpjb20udHdpbmUudGFuZ28ucG1yLmNv", - "bW1vbmIGcHJvdG8z")); + "G1NldERlYnVnTG9nQ2F0ZWdvcnlSZXNwb25zZRClHxIhChxTZXR1cERlYnVn", + "RGlzcmlidXRvcnNSZXF1ZXN0EKYfEiIKHVNldHVwRGVidWdEaXNyaWJ1dG9y", + "c1Jlc3BvbnNlEKcfEicKIlVwbG9hZEhhcmR3YXJlQ29uZmlndXJhdGlvblJl", + "cXVlc3QQiCcSKAojVXBsb2FkSGFyZHdhcmVDb25maWd1cmF0aW9uUmVzcG9u", + "c2UQiScSFwoSU3lzdGVtUmVzZXRSZXF1ZXN0EIonEhgKE1N5c3RlbVJlc2V0", + "UmVzcG9uc2UQiycSFQoQS2VlcEFsaXZlUmVxdWVzdBDwLhIWChFLZWVwQWxp", + "dmVSZXNwb25zZRDxLhITCg5Db25uZWN0UmVxdWVzdBDyLhIUCg9Db25uZWN0", + "UmVzcG9uc2UQ8y4SFgoRRGlzY29ubmVjdFJlcXVlc3QQ9C4SFwoSRGlzY29u", + "bmVjdFJlc3BvbnNlEPUuEhYKEUZpbGVVcGxvYWRSZXF1ZXN0ENg2EhcKEkZp", + "bGVVcGxvYWRSZXNwb25zZRDZNhIbChZGaWxlQ2h1bmtVcGxvYWRSZXF1ZXN0", + "ENo2EhwKF0ZpbGVDaHVua1VwbG9hZFJlc3BvbnNlENs2EhoKFUV4ZWN1dGVQ", + "cm9jZXNzUmVxdWVzdBDcNhIbChZFeGVjdXRlUHJvY2Vzc1Jlc3BvbnNlEN02", + "EhcKEktpbGxQcm9jZXNzUmVxdWVzdBDeNhIYChNLaWxsUHJvY2Vzc1Jlc3Bv", + "bnNlEN82EhIKDUNyZWF0ZVJlcXVlc3QQ4DYSEwoOQ3JlYXRlUmVzcG9uc2UQ", + "4TYSEgoNRGVsZXRlUmVxdWVzdBDiNhITCg5EZWxldGVSZXNwb25zZRDjNhIa", + "ChVHZXRTdG9yYWdlSW5mb1JlcXVlc3QQ5DYSGwoWR2V0U3RvcmFnZUluZm9S", + "ZXNwb25zZRDlNhIUCg9HZXRGaWxlc1JlcXVlc3QQ5jYSFQoQR2V0RmlsZXNS", + "ZXNwb25zZRDnNhIYChNGaWxlRG93bmxvYWRSZXF1ZXN0EOg2EhkKFEZpbGVE", + "b3dubG9hZFJlc3BvbnNlEOk2Eh0KGEZpbGVDaHVua0Rvd25sb2FkUmVxdWVz", + "dBDqNhIeChlGaWxlQ2h1bmtEb3dubG9hZFJlc3BvbnNlEOs2EhsKFlZhbGlk", + "YXRlVmVyc2lvblJlcXVlc3QQ7DYSHAoXVmFsaWRhdGVWZXJzaW9uUmVzcG9u", + "c2UQ7TYSGwoWQWN0aXZhdGVWZXJzaW9uUmVxdWVzdBDuNhIcChdBY3RpdmF0", + "ZVZlcnNpb25SZXNwb25zZRDvNhIZChREaXNwZW5zZXJEYXRhUmVxdWVzdBDA", + "PhIaChVEaXNwZW5zZXJEYXRhUmVzcG9uc2UQwT4SHAoXTWlkVGFua0RhdGFT", + "ZXR1cFJlcXVlc3QQwj4SHQoYTWlkVGFua0RhdGFTZXR1cFJlc3BvbnNlEMM+", + "EiIKHU1hY2hpbmVDYWxpYnJhdGlvbkRhdGFSZXF1ZXN0EMQ+EiMKHk1hY2hp", + "bmVDYWxpYnJhdGlvbkRhdGFSZXNwb25zZRDFPhIkCh9TdGFydE1hY2hpbmVT", + "dGF0dXNVcGRhdGVSZXF1ZXN0EKhGEiUKIFN0YXJ0TWFjaGluZVN0YXR1c1Vw", + "ZGF0ZVJlc3BvbnNlEKlGEiMKHlN0b3BNYWNoaW5lU3RhdHVzVXBkYXRlUmVx", + "dWVzdBCqRhIkCh9TdG9wTWFjaGluZVN0YXR1c1VwZGF0ZVJlc3BvbnNlEKtG", + "QhwKGmNvbS50d2luZS50YW5nby5wbXIuY29tbW9uYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -388,6 +389,8 @@ namespace Tango.PMR.Common { [pbr::OriginalName("StopDebugLogResponse")] StopDebugLogResponse = 4003, [pbr::OriginalName("SetDebugLogCategoryRequest")] SetDebugLogCategoryRequest = 4004, [pbr::OriginalName("SetDebugLogCategoryResponse")] SetDebugLogCategoryResponse = 4005, + [pbr::OriginalName("SetupDebugDisributorsRequest")] SetupDebugDisributorsRequest = 4006, + [pbr::OriginalName("SetupDebugDisributorsResponse")] SetupDebugDisributorsResponse = 4007, /// ///Hardware /// diff --git a/Software/Visual_Studio/Tango.PMR/Debugging/SetupDebugDisributorsRequest.cs b/Software/Visual_Studio/Tango.PMR/Debugging/SetupDebugDisributorsRequest.cs index 363edab57..a17852dcf 100644 --- a/Software/Visual_Studio/Tango.PMR/Debugging/SetupDebugDisributorsRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Debugging/SetupDebugDisributorsRequest.cs @@ -23,13 +23,15 @@ namespace Tango.PMR.Debugging { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiJTZXR1cERlYnVnRGlzcmlidXRvcnNSZXF1ZXN0LnByb3RvEhNUYW5nby5Q", - "TVIuRGVidWdnaW5nIjkKHFNldHVwRGVidWdEaXNyaWJ1dG9yc1JlcXVlc3QS", - "GQoRRGlzdHJpYnV0b3JBY3RpdmUYASADKAhCHwodY29tLnR3aW5lLnRhbmdv", - "LnBtci5kZWJ1Z2dpbmdiBnByb3RvMw==")); + "TVIuRGVidWdnaW5nGhpEZWJ1Z0Rpc3RyaWJ1dG9yVHlwZS5wcm90byJ+ChxT", + "ZXR1cERlYnVnRGlzcmlidXRvcnNSZXF1ZXN0EkMKEERlYnVnRGlzdHJpYnV0", + "b3IYASABKA4yKS5UYW5nby5QTVIuRGVidWdnaW5nLkRlYnVnRGlzdHJpYnV0", + "b3JUeXBlEhkKEURpc3RyaWJ1dG9yQWN0aXZlGAIgASgIQh8KHWNvbS50d2lu", + "ZS50YW5nby5wbXIuZGVidWdnaW5nYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, + new pbr::FileDescriptor[] { global::Tango.PMR.Debugging.DebugDistributorTypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Debugging.SetupDebugDisributorsRequest), global::Tango.PMR.Debugging.SetupDebugDisributorsRequest.Parser, new[]{ "DistributorActive" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Debugging.SetupDebugDisributorsRequest), global::Tango.PMR.Debugging.SetupDebugDisributorsRequest.Parser, new[]{ "DebugDistributor", "DistributorActive" }, null, null, null) })); } #endregion @@ -60,7 +62,8 @@ namespace Tango.PMR.Debugging { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SetupDebugDisributorsRequest(SetupDebugDisributorsRequest other) : this() { - distributorActive_ = other.distributorActive_.Clone(); + debugDistributor_ = other.debugDistributor_; + distributorActive_ = other.distributorActive_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -68,14 +71,26 @@ namespace Tango.PMR.Debugging { return new SetupDebugDisributorsRequest(this); } + /// Field number for the "DebugDistributor" field. + public const int DebugDistributorFieldNumber = 1; + private global::Tango.PMR.Debugging.DebugDistributorType debugDistributor_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.Debugging.DebugDistributorType DebugDistributor { + get { return debugDistributor_; } + set { + debugDistributor_ = value; + } + } + /// Field number for the "DistributorActive" field. - public const int DistributorActiveFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_distributorActive_codec - = pb::FieldCodec.ForBool(10); - private readonly pbc::RepeatedField distributorActive_ = new pbc::RepeatedField(); + public const int DistributorActiveFieldNumber = 2; + private bool distributorActive_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField DistributorActive { + public bool DistributorActive { get { return distributorActive_; } + set { + distributorActive_ = value; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -91,14 +106,16 @@ namespace Tango.PMR.Debugging { if (ReferenceEquals(other, this)) { return true; } - if(!distributorActive_.Equals(other.distributorActive_)) return false; + if (DebugDistributor != other.DebugDistributor) return false; + if (DistributorActive != other.DistributorActive) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - hash ^= distributorActive_.GetHashCode(); + if (DebugDistributor != 0) hash ^= DebugDistributor.GetHashCode(); + if (DistributorActive != false) hash ^= DistributorActive.GetHashCode(); return hash; } @@ -109,13 +126,25 @@ namespace Tango.PMR.Debugging { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - distributorActive_.WriteTo(output, _repeated_distributorActive_codec); + if (DebugDistributor != 0) { + output.WriteRawTag(8); + output.WriteEnum((int) DebugDistributor); + } + if (DistributorActive != false) { + output.WriteRawTag(16); + output.WriteBool(DistributorActive); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - size += distributorActive_.CalculateSize(_repeated_distributorActive_codec); + if (DebugDistributor != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) DebugDistributor); + } + if (DistributorActive != false) { + size += 1 + 1; + } return size; } @@ -124,7 +153,12 @@ namespace Tango.PMR.Debugging { if (other == null) { return; } - distributorActive_.Add(other.distributorActive_); + if (other.DebugDistributor != 0) { + DebugDistributor = other.DebugDistributor; + } + if (other.DistributorActive != false) { + DistributorActive = other.DistributorActive; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -135,9 +169,12 @@ namespace Tango.PMR.Debugging { default: input.SkipLastField(); break; - case 10: case 8: { - distributorActive_.AddEntriesFrom(input, _repeated_distributorActive_codec); + debugDistributor_ = (global::Tango.PMR.Debugging.DebugDistributorType) input.ReadEnum(); + break; + } + case 16: { + DistributorActive = input.ReadBool(); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DiagnosticsMonitors.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DiagnosticsMonitors.cs index ea6dfb0cb..dae46d41b 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/DiagnosticsMonitors.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DiagnosticsMonitors.cs @@ -23,7 +23,7 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChlEaWFnbm9zdGljc01vbml0b3JzLnByb3RvEhVUYW5nby5QTVIuRGlhZ25v", - "c3RpY3MaEURvdWJsZUFycmF5LnByb3RvIp8QChNEaWFnbm9zdGljc01vbml0", + "c3RpY3MaEURvdWJsZUFycmF5LnByb3RvIvgUChNEaWFnbm9zdGljc01vbml0", "b3JzEhQKDERhbmNlcjFBbmdsZRgBIAMoARIUCgxEYW5jZXIyQW5nbGUYAiAD", "KAESFAoMRGFuY2VyM0FuZ2xlGAMgAygBEhwKFEZlZWRlck1vdG9yRnJlcXVl", "bmN5GAQgAygBEhIKCkRyeWVyTW90b3IYBSADKAESEwoLUG9sbGVyTW90b3IY", @@ -69,12 +69,26 @@ namespace Tango.PMR.Diagnostics { "YXRlckN1cnJlbnQYPyADKAESPgoSRGlzcGVuc2Vyc0lua0xldmVsGEAgAygL", "MiIuVGFuZ28uUE1SLkRpYWdub3N0aWNzLkRvdWJsZUFycmF5EjwKEE1pZFRh", "bmtzSW5rTGV2ZWwYQSADKAsyIi5UYW5nby5QTVIuRGlhZ25vc3RpY3MuRG91", - "YmxlQXJyYXkSGgoST3ZlcmFsbFRlbXBlcmF0dXJlGEIgAygBQiEKH2NvbS50", - "d2luZS50YW5nby5wbXIuZGlhZ25vc3RpY3NiBnByb3RvMw==")); + "YmxlQXJyYXkSGgoST3ZlcmFsbFRlbXBlcmF0dXJlGEIgAygBEh4KFkhlYWRa", + "b25lN0hlYXRlckN1cnJlbnQYQyADKAESHAoUSGVhZFpvbmU3VGVtcGVyYXR1", + "cmUYRCADKAESHgoWSGVhZFpvbmU4SGVhdGVyQ3VycmVudBhFIAMoARIcChRI", + "ZWFkWm9uZThUZW1wZXJhdHVyZRhGIAMoARIeChZIZWFkWm9uZTlIZWF0ZXJD", + "dXJyZW50GEcgAygBEhwKFEhlYWRab25lOVRlbXBlcmF0dXJlGEggAygBEh8K", + "F0hlYWRab25lMTBIZWF0ZXJDdXJyZW50GEkgAygBEh0KFUhlYWRab25lMTBU", + "ZW1wZXJhdHVyZRhKIAMoARIfChdIZWFkWm9uZTExSGVhdGVyQ3VycmVudBhL", + "IAMoARIdChVIZWFkWm9uZTExVGVtcGVyYXR1cmUYTCADKAESHwoXSGVhZFpv", + "bmUxMkhlYXRlckN1cnJlbnQYTSADKAESHQoVSGVhZFpvbmUxMlRlbXBlcmF0", + "dXJlGE4gAygBEhoKEkhlYWRCbG93ZXJWb2x0YWdlMRhPIAMoARIaChJIZWFk", + "Qmxvd2VyVm9sdGFnZTIYUCADKAESHwoXSGVhZENvdmVySGVhdGVyMUN1cnJl", + "bnQYUSADKAESIwobSGVhZENvdmVySGVhdGVyMVRlbXBlcmF0dXJlGFIgAygB", + "Eh8KF0hlYWRDb3ZlckhlYXRlcjJDdXJyZW50GFMgAygBEiMKG0hlYWRDb3Zl", + "ckhlYXRlcjJUZW1wZXJhdHVyZRhUIAMoARIZChFXSFNCbG93ZXIyVm9sdGFn", + "ZRhVIAMoAUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0aWNzYgZw", + "cm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.DoubleArrayReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DiagnosticsMonitors), global::Tango.PMR.Diagnostics.DiagnosticsMonitors.Parser, new[]{ "Dancer1Angle", "Dancer2Angle", "Dancer3Angle", "FeederMotorFrequency", "DryerMotor", "PollerMotor", "WinderMotor", "ScrewMotor", "ThreadSpeed", "MixerTemperature", "HeadZone1Temperature", "HeadZone2Temperature", "HeadZone3Temperature", "HeadAirFlow", "FeederTension", "PullerTension", "DryerZone1Temperature", "DryerZone2Temperature", "DryerZone3Temperature", "DryerAirFlow", "WinderTension", "DispensersMotorsFrequency", "DispensersAngularEncoders", "DispensersLinearPositions", "DispensersPressure", "FilterDeltaPressure", "ChillerTemperature", "Dispenser1MotorFrequency", "Dispenser2MotorFrequency", "Dispenser3MotorFrequency", "Dispenser4MotorFrequency", "Dispenser5MotorFrequency", "Dispenser6MotorFrequency", "Dispenser7MotorFrequency", "Dispenser8MotorFrequency", "HeadZone4Temperature", "HeadZone5Temperature", "HeadZone6Temperature", "BlowerVoltage", "Dispenser1Pressure", "Dispenser2Pressure", "Dispenser3Pressure", "Dispenser4Pressure", "Dispenser5Pressure", "Dispenser6Pressure", "Dispenser7Pressure", "Dispenser8Pressure", "MidTank1Level", "MidTank2Level", "MidTank3Level", "MidTank4Level", "MidTank5Level", "MidTank6Level", "MidTank7Level", "MidTank8Level", "DrierZone1HeaterCurrent", "DrierZone2HeaterCurrent", "HeadZone1HeaterCurrent", "HeadZone2HeaterCurrent", "HeadZone3HeaterCurrent", "HeadZone4HeaterCurrent", "HeadZone56HeaterCurrent", "Mixer1HeaterCurrent", "DispensersInkLevel", "MidTanksInkLevel", "OverallTemperature" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DiagnosticsMonitors), global::Tango.PMR.Diagnostics.DiagnosticsMonitors.Parser, new[]{ "Dancer1Angle", "Dancer2Angle", "Dancer3Angle", "FeederMotorFrequency", "DryerMotor", "PollerMotor", "WinderMotor", "ScrewMotor", "ThreadSpeed", "MixerTemperature", "HeadZone1Temperature", "HeadZone2Temperature", "HeadZone3Temperature", "HeadAirFlow", "FeederTension", "PullerTension", "DryerZone1Temperature", "DryerZone2Temperature", "DryerZone3Temperature", "DryerAirFlow", "WinderTension", "DispensersMotorsFrequency", "DispensersAngularEncoders", "DispensersLinearPositions", "DispensersPressure", "FilterDeltaPressure", "ChillerTemperature", "Dispenser1MotorFrequency", "Dispenser2MotorFrequency", "Dispenser3MotorFrequency", "Dispenser4MotorFrequency", "Dispenser5MotorFrequency", "Dispenser6MotorFrequency", "Dispenser7MotorFrequency", "Dispenser8MotorFrequency", "HeadZone4Temperature", "HeadZone5Temperature", "HeadZone6Temperature", "BlowerVoltage", "Dispenser1Pressure", "Dispenser2Pressure", "Dispenser3Pressure", "Dispenser4Pressure", "Dispenser5Pressure", "Dispenser6Pressure", "Dispenser7Pressure", "Dispenser8Pressure", "MidTank1Level", "MidTank2Level", "MidTank3Level", "MidTank4Level", "MidTank5Level", "MidTank6Level", "MidTank7Level", "MidTank8Level", "DrierZone1HeaterCurrent", "DrierZone2HeaterCurrent", "HeadZone1HeaterCurrent", "HeadZone2HeaterCurrent", "HeadZone3HeaterCurrent", "HeadZone4HeaterCurrent", "HeadZone56HeaterCurrent", "Mixer1HeaterCurrent", "DispensersInkLevel", "MidTanksInkLevel", "OverallTemperature", "HeadZone7HeaterCurrent", "HeadZone7Temperature", "HeadZone8HeaterCurrent", "HeadZone8Temperature", "HeadZone9HeaterCurrent", "HeadZone9Temperature", "HeadZone10HeaterCurrent", "HeadZone10Temperature", "HeadZone11HeaterCurrent", "HeadZone11Temperature", "HeadZone12HeaterCurrent", "HeadZone12Temperature", "HeadBlowerVoltage1", "HeadBlowerVoltage2", "HeadCoverHeater1Current", "HeadCoverHeater1Temperature", "HeadCoverHeater2Current", "HeadCoverHeater2Temperature", "WHSBlower2Voltage" }, null, null, null) })); } #endregion @@ -171,6 +185,25 @@ namespace Tango.PMR.Diagnostics { dispensersInkLevel_ = other.dispensersInkLevel_.Clone(); midTanksInkLevel_ = other.midTanksInkLevel_.Clone(); overallTemperature_ = other.overallTemperature_.Clone(); + headZone7HeaterCurrent_ = other.headZone7HeaterCurrent_.Clone(); + headZone7Temperature_ = other.headZone7Temperature_.Clone(); + headZone8HeaterCurrent_ = other.headZone8HeaterCurrent_.Clone(); + headZone8Temperature_ = other.headZone8Temperature_.Clone(); + headZone9HeaterCurrent_ = other.headZone9HeaterCurrent_.Clone(); + headZone9Temperature_ = other.headZone9Temperature_.Clone(); + headZone10HeaterCurrent_ = other.headZone10HeaterCurrent_.Clone(); + headZone10Temperature_ = other.headZone10Temperature_.Clone(); + headZone11HeaterCurrent_ = other.headZone11HeaterCurrent_.Clone(); + headZone11Temperature_ = other.headZone11Temperature_.Clone(); + headZone12HeaterCurrent_ = other.headZone12HeaterCurrent_.Clone(); + headZone12Temperature_ = other.headZone12Temperature_.Clone(); + headBlowerVoltage1_ = other.headBlowerVoltage1_.Clone(); + headBlowerVoltage2_ = other.headBlowerVoltage2_.Clone(); + headCoverHeater1Current_ = other.headCoverHeater1Current_.Clone(); + headCoverHeater1Temperature_ = other.headCoverHeater1Temperature_.Clone(); + headCoverHeater2Current_ = other.headCoverHeater2Current_.Clone(); + headCoverHeater2Temperature_ = other.headCoverHeater2Temperature_.Clone(); + wHSBlower2Voltage_ = other.wHSBlower2Voltage_.Clone(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1036,6 +1069,253 @@ namespace Tango.PMR.Diagnostics { get { return overallTemperature_; } } + /// Field number for the "HeadZone7HeaterCurrent" field. + public const int HeadZone7HeaterCurrentFieldNumber = 67; + private static readonly pb::FieldCodec _repeated_headZone7HeaterCurrent_codec + = pb::FieldCodec.ForDouble(538); + private readonly pbc::RepeatedField headZone7HeaterCurrent_ = new pbc::RepeatedField(); + /// + ///Head Zone 7 Heater Current (Min = 0, Max = 100, PPF = 1) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone7HeaterCurrent { + get { return headZone7HeaterCurrent_; } + } + + /// Field number for the "HeadZone7Temperature" field. + public const int HeadZone7TemperatureFieldNumber = 68; + private static readonly pb::FieldCodec _repeated_headZone7Temperature_codec + = pb::FieldCodec.ForDouble(546); + private readonly pbc::RepeatedField headZone7Temperature_ = new pbc::RepeatedField(); + /// + ///Head Zone 7 (Min = 0, Max = 300, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone7Temperature { + get { return headZone7Temperature_; } + } + + /// Field number for the "HeadZone8HeaterCurrent" field. + public const int HeadZone8HeaterCurrentFieldNumber = 69; + private static readonly pb::FieldCodec _repeated_headZone8HeaterCurrent_codec + = pb::FieldCodec.ForDouble(554); + private readonly pbc::RepeatedField headZone8HeaterCurrent_ = new pbc::RepeatedField(); + /// + ///Head Zone 8 Heater Current (Min = 0, Max = 100, PPF = 1) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone8HeaterCurrent { + get { return headZone8HeaterCurrent_; } + } + + /// Field number for the "HeadZone8Temperature" field. + public const int HeadZone8TemperatureFieldNumber = 70; + private static readonly pb::FieldCodec _repeated_headZone8Temperature_codec + = pb::FieldCodec.ForDouble(562); + private readonly pbc::RepeatedField headZone8Temperature_ = new pbc::RepeatedField(); + /// + ///Head Zone 8 (Min = 0, Max = 300, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone8Temperature { + get { return headZone8Temperature_; } + } + + /// Field number for the "HeadZone9HeaterCurrent" field. + public const int HeadZone9HeaterCurrentFieldNumber = 71; + private static readonly pb::FieldCodec _repeated_headZone9HeaterCurrent_codec + = pb::FieldCodec.ForDouble(570); + private readonly pbc::RepeatedField headZone9HeaterCurrent_ = new pbc::RepeatedField(); + /// + ///Head Zone 9 Heater Current (Min = 0, Max = 100, PPF = 1) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone9HeaterCurrent { + get { return headZone9HeaterCurrent_; } + } + + /// Field number for the "HeadZone9Temperature" field. + public const int HeadZone9TemperatureFieldNumber = 72; + private static readonly pb::FieldCodec _repeated_headZone9Temperature_codec + = pb::FieldCodec.ForDouble(578); + private readonly pbc::RepeatedField headZone9Temperature_ = new pbc::RepeatedField(); + /// + ///Head Zone 9 (Min = 0, Max = 300, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone9Temperature { + get { return headZone9Temperature_; } + } + + /// Field number for the "HeadZone10HeaterCurrent" field. + public const int HeadZone10HeaterCurrentFieldNumber = 73; + private static readonly pb::FieldCodec _repeated_headZone10HeaterCurrent_codec + = pb::FieldCodec.ForDouble(586); + private readonly pbc::RepeatedField headZone10HeaterCurrent_ = new pbc::RepeatedField(); + /// + ///Head Zone 10 Heater Current (Min = 0, Max = 100, PPF = 1) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone10HeaterCurrent { + get { return headZone10HeaterCurrent_; } + } + + /// Field number for the "HeadZone10Temperature" field. + public const int HeadZone10TemperatureFieldNumber = 74; + private static readonly pb::FieldCodec _repeated_headZone10Temperature_codec + = pb::FieldCodec.ForDouble(594); + private readonly pbc::RepeatedField headZone10Temperature_ = new pbc::RepeatedField(); + /// + ///Head Zone 10 (Min = 0, Max = 300, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone10Temperature { + get { return headZone10Temperature_; } + } + + /// Field number for the "HeadZone11HeaterCurrent" field. + public const int HeadZone11HeaterCurrentFieldNumber = 75; + private static readonly pb::FieldCodec _repeated_headZone11HeaterCurrent_codec + = pb::FieldCodec.ForDouble(602); + private readonly pbc::RepeatedField headZone11HeaterCurrent_ = new pbc::RepeatedField(); + /// + ///Head Zone 11 Heater Current (Min = 0, Max = 100, PPF = 1) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone11HeaterCurrent { + get { return headZone11HeaterCurrent_; } + } + + /// Field number for the "HeadZone11Temperature" field. + public const int HeadZone11TemperatureFieldNumber = 76; + private static readonly pb::FieldCodec _repeated_headZone11Temperature_codec + = pb::FieldCodec.ForDouble(610); + private readonly pbc::RepeatedField headZone11Temperature_ = new pbc::RepeatedField(); + /// + ///Head Zone 11 (Min = 0, Max = 300, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone11Temperature { + get { return headZone11Temperature_; } + } + + /// Field number for the "HeadZone12HeaterCurrent" field. + public const int HeadZone12HeaterCurrentFieldNumber = 77; + private static readonly pb::FieldCodec _repeated_headZone12HeaterCurrent_codec + = pb::FieldCodec.ForDouble(618); + private readonly pbc::RepeatedField headZone12HeaterCurrent_ = new pbc::RepeatedField(); + /// + ///Head Zone 12 Heater Current (Min = 0, Max = 100, PPF = 1) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone12HeaterCurrent { + get { return headZone12HeaterCurrent_; } + } + + /// Field number for the "HeadZone12Temperature" field. + public const int HeadZone12TemperatureFieldNumber = 78; + private static readonly pb::FieldCodec _repeated_headZone12Temperature_codec + = pb::FieldCodec.ForDouble(626); + private readonly pbc::RepeatedField headZone12Temperature_ = new pbc::RepeatedField(); + /// + ///Head Zone 12 (Min = 0, Max = 300, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadZone12Temperature { + get { return headZone12Temperature_; } + } + + /// Field number for the "HeadBlowerVoltage1" field. + public const int HeadBlowerVoltage1FieldNumber = 79; + private static readonly pb::FieldCodec _repeated_headBlowerVoltage1_codec + = pb::FieldCodec.ForDouble(634); + private readonly pbc::RepeatedField headBlowerVoltage1_ = new pbc::RepeatedField(); + /// + ///Head Blower Voltage 1 (Min = 0, Max = 100, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadBlowerVoltage1 { + get { return headBlowerVoltage1_; } + } + + /// Field number for the "HeadBlowerVoltage2" field. + public const int HeadBlowerVoltage2FieldNumber = 80; + private static readonly pb::FieldCodec _repeated_headBlowerVoltage2_codec + = pb::FieldCodec.ForDouble(642); + private readonly pbc::RepeatedField headBlowerVoltage2_ = new pbc::RepeatedField(); + /// + ///Head Blower Voltage 2 (Min = 0, Max = 100, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadBlowerVoltage2 { + get { return headBlowerVoltage2_; } + } + + /// Field number for the "HeadCoverHeater1Current" field. + public const int HeadCoverHeater1CurrentFieldNumber = 81; + private static readonly pb::FieldCodec _repeated_headCoverHeater1Current_codec + = pb::FieldCodec.ForDouble(650); + private readonly pbc::RepeatedField headCoverHeater1Current_ = new pbc::RepeatedField(); + /// + ///Head Cover Heater 1 Current (Min = 0, Max = 100, PPF = 1) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadCoverHeater1Current { + get { return headCoverHeater1Current_; } + } + + /// Field number for the "HeadCoverHeater1Temperature" field. + public const int HeadCoverHeater1TemperatureFieldNumber = 82; + private static readonly pb::FieldCodec _repeated_headCoverHeater1Temperature_codec + = pb::FieldCodec.ForDouble(658); + private readonly pbc::RepeatedField headCoverHeater1Temperature_ = new pbc::RepeatedField(); + /// + ///Head Cover Heater 1 Temperature (Min = 0, Max = 300, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadCoverHeater1Temperature { + get { return headCoverHeater1Temperature_; } + } + + /// Field number for the "HeadCoverHeater2Current" field. + public const int HeadCoverHeater2CurrentFieldNumber = 83; + private static readonly pb::FieldCodec _repeated_headCoverHeater2Current_codec + = pb::FieldCodec.ForDouble(666); + private readonly pbc::RepeatedField headCoverHeater2Current_ = new pbc::RepeatedField(); + /// + ///Head Cover Heater 2 Current (Min = 0, Max = 100, PPF = 1) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadCoverHeater2Current { + get { return headCoverHeater2Current_; } + } + + /// Field number for the "HeadCoverHeater2Temperature" field. + public const int HeadCoverHeater2TemperatureFieldNumber = 84; + private static readonly pb::FieldCodec _repeated_headCoverHeater2Temperature_codec + = pb::FieldCodec.ForDouble(674); + private readonly pbc::RepeatedField headCoverHeater2Temperature_ = new pbc::RepeatedField(); + /// + ///Head Cover Heater 2 Temperature (Min = 0, Max = 300, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField HeadCoverHeater2Temperature { + get { return headCoverHeater2Temperature_; } + } + + /// Field number for the "WHSBlower2Voltage" field. + public const int WHSBlower2VoltageFieldNumber = 85; + private static readonly pb::FieldCodec _repeated_wHSBlower2Voltage_codec + = pb::FieldCodec.ForDouble(682); + private readonly pbc::RepeatedField wHSBlower2Voltage_ = new pbc::RepeatedField(); + /// + ///WHS Blower 2 Voltage (Min = 0, Max = 100, PPF = 10) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField WHSBlower2Voltage { + get { return wHSBlower2Voltage_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as DiagnosticsMonitors); @@ -1115,6 +1395,25 @@ namespace Tango.PMR.Diagnostics { if(!dispensersInkLevel_.Equals(other.dispensersInkLevel_)) return false; if(!midTanksInkLevel_.Equals(other.midTanksInkLevel_)) return false; if(!overallTemperature_.Equals(other.overallTemperature_)) return false; + if(!headZone7HeaterCurrent_.Equals(other.headZone7HeaterCurrent_)) return false; + if(!headZone7Temperature_.Equals(other.headZone7Temperature_)) return false; + if(!headZone8HeaterCurrent_.Equals(other.headZone8HeaterCurrent_)) return false; + if(!headZone8Temperature_.Equals(other.headZone8Temperature_)) return false; + if(!headZone9HeaterCurrent_.Equals(other.headZone9HeaterCurrent_)) return false; + if(!headZone9Temperature_.Equals(other.headZone9Temperature_)) return false; + if(!headZone10HeaterCurrent_.Equals(other.headZone10HeaterCurrent_)) return false; + if(!headZone10Temperature_.Equals(other.headZone10Temperature_)) return false; + if(!headZone11HeaterCurrent_.Equals(other.headZone11HeaterCurrent_)) return false; + if(!headZone11Temperature_.Equals(other.headZone11Temperature_)) return false; + if(!headZone12HeaterCurrent_.Equals(other.headZone12HeaterCurrent_)) return false; + if(!headZone12Temperature_.Equals(other.headZone12Temperature_)) return false; + if(!headBlowerVoltage1_.Equals(other.headBlowerVoltage1_)) return false; + if(!headBlowerVoltage2_.Equals(other.headBlowerVoltage2_)) return false; + if(!headCoverHeater1Current_.Equals(other.headCoverHeater1Current_)) return false; + if(!headCoverHeater1Temperature_.Equals(other.headCoverHeater1Temperature_)) return false; + if(!headCoverHeater2Current_.Equals(other.headCoverHeater2Current_)) return false; + if(!headCoverHeater2Temperature_.Equals(other.headCoverHeater2Temperature_)) return false; + if(!wHSBlower2Voltage_.Equals(other.wHSBlower2Voltage_)) return false; return true; } @@ -1187,6 +1486,25 @@ namespace Tango.PMR.Diagnostics { hash ^= dispensersInkLevel_.GetHashCode(); hash ^= midTanksInkLevel_.GetHashCode(); hash ^= overallTemperature_.GetHashCode(); + hash ^= headZone7HeaterCurrent_.GetHashCode(); + hash ^= headZone7Temperature_.GetHashCode(); + hash ^= headZone8HeaterCurrent_.GetHashCode(); + hash ^= headZone8Temperature_.GetHashCode(); + hash ^= headZone9HeaterCurrent_.GetHashCode(); + hash ^= headZone9Temperature_.GetHashCode(); + hash ^= headZone10HeaterCurrent_.GetHashCode(); + hash ^= headZone10Temperature_.GetHashCode(); + hash ^= headZone11HeaterCurrent_.GetHashCode(); + hash ^= headZone11Temperature_.GetHashCode(); + hash ^= headZone12HeaterCurrent_.GetHashCode(); + hash ^= headZone12Temperature_.GetHashCode(); + hash ^= headBlowerVoltage1_.GetHashCode(); + hash ^= headBlowerVoltage2_.GetHashCode(); + hash ^= headCoverHeater1Current_.GetHashCode(); + hash ^= headCoverHeater1Temperature_.GetHashCode(); + hash ^= headCoverHeater2Current_.GetHashCode(); + hash ^= headCoverHeater2Temperature_.GetHashCode(); + hash ^= wHSBlower2Voltage_.GetHashCode(); return hash; } @@ -1263,6 +1581,25 @@ namespace Tango.PMR.Diagnostics { dispensersInkLevel_.WriteTo(output, _repeated_dispensersInkLevel_codec); midTanksInkLevel_.WriteTo(output, _repeated_midTanksInkLevel_codec); overallTemperature_.WriteTo(output, _repeated_overallTemperature_codec); + headZone7HeaterCurrent_.WriteTo(output, _repeated_headZone7HeaterCurrent_codec); + headZone7Temperature_.WriteTo(output, _repeated_headZone7Temperature_codec); + headZone8HeaterCurrent_.WriteTo(output, _repeated_headZone8HeaterCurrent_codec); + headZone8Temperature_.WriteTo(output, _repeated_headZone8Temperature_codec); + headZone9HeaterCurrent_.WriteTo(output, _repeated_headZone9HeaterCurrent_codec); + headZone9Temperature_.WriteTo(output, _repeated_headZone9Temperature_codec); + headZone10HeaterCurrent_.WriteTo(output, _repeated_headZone10HeaterCurrent_codec); + headZone10Temperature_.WriteTo(output, _repeated_headZone10Temperature_codec); + headZone11HeaterCurrent_.WriteTo(output, _repeated_headZone11HeaterCurrent_codec); + headZone11Temperature_.WriteTo(output, _repeated_headZone11Temperature_codec); + headZone12HeaterCurrent_.WriteTo(output, _repeated_headZone12HeaterCurrent_codec); + headZone12Temperature_.WriteTo(output, _repeated_headZone12Temperature_codec); + headBlowerVoltage1_.WriteTo(output, _repeated_headBlowerVoltage1_codec); + headBlowerVoltage2_.WriteTo(output, _repeated_headBlowerVoltage2_codec); + headCoverHeater1Current_.WriteTo(output, _repeated_headCoverHeater1Current_codec); + headCoverHeater1Temperature_.WriteTo(output, _repeated_headCoverHeater1Temperature_codec); + headCoverHeater2Current_.WriteTo(output, _repeated_headCoverHeater2Current_codec); + headCoverHeater2Temperature_.WriteTo(output, _repeated_headCoverHeater2Temperature_codec); + wHSBlower2Voltage_.WriteTo(output, _repeated_wHSBlower2Voltage_codec); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1334,6 +1671,25 @@ namespace Tango.PMR.Diagnostics { size += dispensersInkLevel_.CalculateSize(_repeated_dispensersInkLevel_codec); size += midTanksInkLevel_.CalculateSize(_repeated_midTanksInkLevel_codec); size += overallTemperature_.CalculateSize(_repeated_overallTemperature_codec); + size += headZone7HeaterCurrent_.CalculateSize(_repeated_headZone7HeaterCurrent_codec); + size += headZone7Temperature_.CalculateSize(_repeated_headZone7Temperature_codec); + size += headZone8HeaterCurrent_.CalculateSize(_repeated_headZone8HeaterCurrent_codec); + size += headZone8Temperature_.CalculateSize(_repeated_headZone8Temperature_codec); + size += headZone9HeaterCurrent_.CalculateSize(_repeated_headZone9HeaterCurrent_codec); + size += headZone9Temperature_.CalculateSize(_repeated_headZone9Temperature_codec); + size += headZone10HeaterCurrent_.CalculateSize(_repeated_headZone10HeaterCurrent_codec); + size += headZone10Temperature_.CalculateSize(_repeated_headZone10Temperature_codec); + size += headZone11HeaterCurrent_.CalculateSize(_repeated_headZone11HeaterCurrent_codec); + size += headZone11Temperature_.CalculateSize(_repeated_headZone11Temperature_codec); + size += headZone12HeaterCurrent_.CalculateSize(_repeated_headZone12HeaterCurrent_codec); + size += headZone12Temperature_.CalculateSize(_repeated_headZone12Temperature_codec); + size += headBlowerVoltage1_.CalculateSize(_repeated_headBlowerVoltage1_codec); + size += headBlowerVoltage2_.CalculateSize(_repeated_headBlowerVoltage2_codec); + size += headCoverHeater1Current_.CalculateSize(_repeated_headCoverHeater1Current_codec); + size += headCoverHeater1Temperature_.CalculateSize(_repeated_headCoverHeater1Temperature_codec); + size += headCoverHeater2Current_.CalculateSize(_repeated_headCoverHeater2Current_codec); + size += headCoverHeater2Temperature_.CalculateSize(_repeated_headCoverHeater2Temperature_codec); + size += wHSBlower2Voltage_.CalculateSize(_repeated_wHSBlower2Voltage_codec); return size; } @@ -1408,6 +1764,25 @@ namespace Tango.PMR.Diagnostics { dispensersInkLevel_.Add(other.dispensersInkLevel_); midTanksInkLevel_.Add(other.midTanksInkLevel_); overallTemperature_.Add(other.overallTemperature_); + headZone7HeaterCurrent_.Add(other.headZone7HeaterCurrent_); + headZone7Temperature_.Add(other.headZone7Temperature_); + headZone8HeaterCurrent_.Add(other.headZone8HeaterCurrent_); + headZone8Temperature_.Add(other.headZone8Temperature_); + headZone9HeaterCurrent_.Add(other.headZone9HeaterCurrent_); + headZone9Temperature_.Add(other.headZone9Temperature_); + headZone10HeaterCurrent_.Add(other.headZone10HeaterCurrent_); + headZone10Temperature_.Add(other.headZone10Temperature_); + headZone11HeaterCurrent_.Add(other.headZone11HeaterCurrent_); + headZone11Temperature_.Add(other.headZone11Temperature_); + headZone12HeaterCurrent_.Add(other.headZone12HeaterCurrent_); + headZone12Temperature_.Add(other.headZone12Temperature_); + headBlowerVoltage1_.Add(other.headBlowerVoltage1_); + headBlowerVoltage2_.Add(other.headBlowerVoltage2_); + headCoverHeater1Current_.Add(other.headCoverHeater1Current_); + headCoverHeater1Temperature_.Add(other.headCoverHeater1Temperature_); + headCoverHeater2Current_.Add(other.headCoverHeater2Current_); + headCoverHeater2Temperature_.Add(other.headCoverHeater2Temperature_); + wHSBlower2Voltage_.Add(other.wHSBlower2Voltage_); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1742,6 +2117,101 @@ namespace Tango.PMR.Diagnostics { overallTemperature_.AddEntriesFrom(input, _repeated_overallTemperature_codec); break; } + case 538: + case 537: { + headZone7HeaterCurrent_.AddEntriesFrom(input, _repeated_headZone7HeaterCurrent_codec); + break; + } + case 546: + case 545: { + headZone7Temperature_.AddEntriesFrom(input, _repeated_headZone7Temperature_codec); + break; + } + case 554: + case 553: { + headZone8HeaterCurrent_.AddEntriesFrom(input, _repeated_headZone8HeaterCurrent_codec); + break; + } + case 562: + case 561: { + headZone8Temperature_.AddEntriesFrom(input, _repeated_headZone8Temperature_codec); + break; + } + case 570: + case 569: { + headZone9HeaterCurrent_.AddEntriesFrom(input, _repeated_headZone9HeaterCurrent_codec); + break; + } + case 578: + case 577: { + headZone9Temperature_.AddEntriesFrom(input, _repeated_headZone9Temperature_codec); + break; + } + case 586: + case 585: { + headZone10HeaterCurrent_.AddEntriesFrom(input, _repeated_headZone10HeaterCurrent_codec); + break; + } + case 594: + case 593: { + headZone10Temperature_.AddEntriesFrom(input, _repeated_headZone10Temperature_codec); + break; + } + case 602: + case 601: { + headZone11HeaterCurrent_.AddEntriesFrom(input, _repeated_headZone11HeaterCurrent_codec); + break; + } + case 610: + case 609: { + headZone11Temperature_.AddEntriesFrom(input, _repeated_headZone11Temperature_codec); + break; + } + case 618: + case 617: { + headZone12HeaterCurrent_.AddEntriesFrom(input, _repeated_headZone12HeaterCurrent_codec); + break; + } + case 626: + case 625: { + headZone12Temperature_.AddEntriesFrom(input, _repeated_headZone12Temperature_codec); + break; + } + case 634: + case 633: { + headBlowerVoltage1_.AddEntriesFrom(input, _repeated_headBlowerVoltage1_codec); + break; + } + case 642: + case 641: { + headBlowerVoltage2_.AddEntriesFrom(input, _repeated_headBlowerVoltage2_codec); + break; + } + case 650: + case 649: { + headCoverHeater1Current_.AddEntriesFrom(input, _repeated_headCoverHeater1Current_codec); + break; + } + case 658: + case 657: { + headCoverHeater1Temperature_.AddEntriesFrom(input, _repeated_headCoverHeater1Temperature_codec); + break; + } + case 666: + case 665: { + headCoverHeater2Current_.AddEntriesFrom(input, _repeated_headCoverHeater2Current_codec); + break; + } + case 674: + case 673: { + headCoverHeater2Temperature_.AddEntriesFrom(input, _repeated_headCoverHeater2Temperature_codec); + break; + } + case 682: + case 681: { + wHSBlower2Voltage_.AddEntriesFrom(input, _repeated_wHSBlower2Voltage_codec); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/HeaterType.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/HeaterType.cs index 0f1606597..304e0ebe6 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/HeaterType.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/HeaterType.cs @@ -22,13 +22,16 @@ namespace Tango.PMR.Diagnostics { static HeaterTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChBIZWF0ZXJUeXBlLnByb3RvEhVUYW5nby5QTVIuRGlhZ25vc3RpY3MqxgEK", + "ChBIZWF0ZXJUeXBlLnByb3RvEhVUYW5nby5QTVIuRGlhZ25vc3RpY3Mq2wIK", "CkhlYXRlclR5cGUSEgoORHJ5ZXJBaXJIZWF0ZXIQABITCg9Ecnllck1haW5I", "ZWF0ZXIQARIYChREcnllclNlY29uZGFyeUhlYXRlchACEg8KC0hlYXRlclpv", "bmUxEAMSDwoLSGVhdGVyWm9uZTIQBBIPCgtIZWF0ZXJab25lMxAFEg8KC0hl", "YXRlclpvbmU0EAYSDwoLSGVhdGVyWm9uZTUQBxIPCgtIZWF0ZXJab25lNhAI", - "Eg8KC01peGVySGVhdGVyEAlCIQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFn", - "bm9zdGljc2IGcHJvdG8z")); + "Eg8KC01peGVySGVhdGVyEAkSDwoLSGVhdGVyWm9uZTcQChIPCgtIZWF0ZXJa", + "b25lOBALEg8KC0hlYXRlclpvbmU5EAwSEAoMSGVhdGVyWm9uZTEwEA0SEAoM", + "SGVhdGVyWm9uZTExEA4SEAoMSGVhdGVyWm9uZTEyEA8SFAoQSGVhZENvdmVy", + "SGVhdGVyMRAQEhQKEEhlYWRDb3ZlckhlYXRlcjIQEUIhCh9jb20udHdpbmUu", + "dGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Diagnostics.HeaterType), }, null)); @@ -48,6 +51,14 @@ namespace Tango.PMR.Diagnostics { [pbr::OriginalName("HeaterZone5")] HeaterZone5 = 7, [pbr::OriginalName("HeaterZone6")] HeaterZone6 = 8, [pbr::OriginalName("MixerHeater")] MixerHeater = 9, + [pbr::OriginalName("HeaterZone7")] HeaterZone7 = 10, + [pbr::OriginalName("HeaterZone8")] HeaterZone8 = 11, + [pbr::OriginalName("HeaterZone9")] HeaterZone9 = 12, + [pbr::OriginalName("HeaterZone10")] HeaterZone10 = 13, + [pbr::OriginalName("HeaterZone11")] HeaterZone11 = 14, + [pbr::OriginalName("HeaterZone12")] HeaterZone12 = 15, + [pbr::OriginalName("HeadCoverHeater1")] HeadCoverHeater1 = 16, + [pbr::OriginalName("HeadCoverHeater2")] HeadCoverHeater2 = 17, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/StartThreadLoadingUpdateRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/StartThreadLoadingUpdateRequest.cs new file mode 100644 index 000000000..a466722ad --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/StartThreadLoadingUpdateRequest.cs @@ -0,0 +1,132 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: StartThreadLoadingUpdateRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from StartThreadLoadingUpdateRequest.proto + public static partial class StartThreadLoadingUpdateRequestReflection { + + #region Descriptor + /// File descriptor for StartThreadLoadingUpdateRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static StartThreadLoadingUpdateRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiVTdGFydFRocmVhZExvYWRpbmdVcGRhdGVSZXF1ZXN0LnByb3RvEhVUYW5n", + "by5QTVIuRGlhZ25vc3RpY3MiIQofU3RhcnRUaHJlYWRMb2FkaW5nVXBkYXRl", + "UmVxdWVzdEIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0aWNzYgZw", + "cm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.StartThreadLoadingUpdateRequest), global::Tango.PMR.Diagnostics.StartThreadLoadingUpdateRequest.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class StartThreadLoadingUpdateRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StartThreadLoadingUpdateRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.StartThreadLoadingUpdateRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StartThreadLoadingUpdateRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StartThreadLoadingUpdateRequest(StartThreadLoadingUpdateRequest other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StartThreadLoadingUpdateRequest Clone() { + return new StartThreadLoadingUpdateRequest(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StartThreadLoadingUpdateRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StartThreadLoadingUpdateRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StartThreadLoadingUpdateRequest other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/StartThreadLoadingUpdateResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/StartThreadLoadingUpdateResponse.cs new file mode 100644 index 000000000..0c62e31c7 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/StartThreadLoadingUpdateResponse.cs @@ -0,0 +1,162 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: StartThreadLoadingUpdateResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from StartThreadLoadingUpdateResponse.proto + public static partial class StartThreadLoadingUpdateResponseReflection { + + #region Descriptor + /// File descriptor for StartThreadLoadingUpdateResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static StartThreadLoadingUpdateResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiZTdGFydFRocmVhZExvYWRpbmdVcGRhdGVSZXNwb25zZS5wcm90bxIVVGFu", + "Z28uUE1SLkRpYWdub3N0aWNzGhhUaHJlYWRMb2FkaW5nU3RhdGUucHJvdG8i", + "aQogU3RhcnRUaHJlYWRMb2FkaW5nVXBkYXRlUmVzcG9uc2USRQoSVGhyZWFk", + "TG9hZGluZ1N0YXRlGAEgASgOMikuVGFuZ28uUE1SLkRpYWdub3N0aWNzLlRo", + "cmVhZExvYWRpbmdTdGF0ZUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdu", + "b3N0aWNzYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.ThreadLoadingStateReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.StartThreadLoadingUpdateResponse), global::Tango.PMR.Diagnostics.StartThreadLoadingUpdateResponse.Parser, new[]{ "ThreadLoadingState" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class StartThreadLoadingUpdateResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StartThreadLoadingUpdateResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.StartThreadLoadingUpdateResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StartThreadLoadingUpdateResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StartThreadLoadingUpdateResponse(StartThreadLoadingUpdateResponse other) : this() { + threadLoadingState_ = other.threadLoadingState_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StartThreadLoadingUpdateResponse Clone() { + return new StartThreadLoadingUpdateResponse(this); + } + + /// Field number for the "ThreadLoadingState" field. + public const int ThreadLoadingStateFieldNumber = 1; + private global::Tango.PMR.Diagnostics.ThreadLoadingState threadLoadingState_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.Diagnostics.ThreadLoadingState ThreadLoadingState { + get { return threadLoadingState_; } + set { + threadLoadingState_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StartThreadLoadingUpdateResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StartThreadLoadingUpdateResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ThreadLoadingState != other.ThreadLoadingState) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ThreadLoadingState != 0) hash ^= ThreadLoadingState.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (ThreadLoadingState != 0) { + output.WriteRawTag(8); + output.WriteEnum((int) ThreadLoadingState); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ThreadLoadingState != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ThreadLoadingState); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StartThreadLoadingUpdateResponse other) { + if (other == null) { + return; + } + if (other.ThreadLoadingState != 0) { + ThreadLoadingState = other.ThreadLoadingState; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + threadLoadingState_ = (global::Tango.PMR.Diagnostics.ThreadLoadingState) input.ReadEnum(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/ThreadLoadingState.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/ThreadLoadingState.cs new file mode 100644 index 000000000..8322cbef4 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/ThreadLoadingState.cs @@ -0,0 +1,97 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ThreadLoadingState.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from ThreadLoadingState.proto + public static partial class ThreadLoadingStateReflection { + + #region Descriptor + /// File descriptor for ThreadLoadingState.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ThreadLoadingStateReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChhUaHJlYWRMb2FkaW5nU3RhdGUucHJvdG8SFVRhbmdvLlBNUi5EaWFnbm9z", + "dGljcyq1AwoSVGhyZWFkTG9hZGluZ1N0YXRlEhIKDlRocmVhZExvYWRJbml0", + "EAASGAoUVGhyZWFkTG9hZFJlZHVjZUhlYXQQARInCiNUaHJlYWRMb2FkU2V0", + "TG9hZEFybVRvU3RhcnRQb3NpdGlvbhACEhgKFFRocmVhZExvYWRPcGVuQ292", + "ZXJzEAMSGQoVVGhyZWFkTG9hZExpZnREYW5jZXJzEAQSGQoVVGhyZWFkTG9h", + "ZExpZnRSb2NrZXJzEAUSHAoYVGhyZWFkTG9hZEluaXRpYWxUZW5zaW9uEAYS", + "GgoWVGhyZWFkTG9hZENsb3NlUm9ja2VycxAHEhoKFlRocmVhZExvYWRDbG9z", + "ZURhbmNlcnMQCBIXChNUaHJlYWRMb2FkQ2xvc2VMaWRzEAkSJAogVGhyZWFk", + "TG9hZEpvZ0ZlZWRlclRvTWlkZGxlUG9pbnQQChIaChZUaHJlYWRMb2FkRHJ5", + "ZXJMb2FkaW5nEAsSGwoXVGhyZWFkTG9hZFJlc3VtZUhlYXRpbmcQDBIXChNU", + "aHJlYWRMb2FkSm9nVGhyZWFkEA0SEQoNVGhyZWFkTG9hZEVuZBAOQiEKH2Nv", + "bS50d2luZS50YW5nby5wbXIuZGlhZ25vc3RpY3NiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Diagnostics.ThreadLoadingState), }, null)); + } + #endregion + + } + #region Enums + public enum ThreadLoadingState { + [pbr::OriginalName("ThreadLoadInit")] ThreadLoadInit = 0, + /// + ///Heaters Off; Dryer Blower Off; Blower Low; + /// + [pbr::OriginalName("ThreadLoadReduceHeat")] ThreadLoadReduceHeat = 1, + /// + ///Use Notation How Many Rotations In The Dryer; Or Check Against Stopper. Move Slowly + /// + [pbr::OriginalName("ThreadLoadSetLoadArmToStartPosition")] ThreadLoadSetLoadArmToStartPosition = 2, + /// + ///Open Dyeing Head Cover And Dryer Lid + /// + [pbr::OriginalName("ThreadLoadOpenCovers")] ThreadLoadOpenCovers = 3, + [pbr::OriginalName("ThreadLoadLiftDancers")] ThreadLoadLiftDancers = 4, + /// + ///Machine Is Ready. Send Message; Start Timer To Close Lids; Wait For Operator Response + /// + [pbr::OriginalName("ThreadLoadLiftRockers")] ThreadLoadLiftRockers = 5, + /// + ///Check Spool Presencerun Winder Until Break Sensor Is Identifieing Movement For A Second + /// + [pbr::OriginalName("ThreadLoadInitialTension")] ThreadLoadInitialTension = 6, + [pbr::OriginalName("ThreadLoadCloseRockers")] ThreadLoadCloseRockers = 7, + /// + ///Send Dancer Motors To Preset Location; Check That The Dancers Are On The Thread + /// + [pbr::OriginalName("ThreadLoadCloseDancers")] ThreadLoadCloseDancers = 8, + [pbr::OriginalName("ThreadLoadCloseLids")] ThreadLoadCloseLids = 9, + /// + ///Jog The Feeder Motor Until The Feeder Dancer Is At Middle Position + /// + [pbr::OriginalName("ThreadLoadJogFeederToMiddlePoint")] ThreadLoadJogFeederToMiddlePoint = 10, + /// + ///Start Feeder Pid Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40 + /// + [pbr::OriginalName("ThreadLoadDryerLoading")] ThreadLoadDryerLoading = 11, + /// + ///Keep Notation How Many Rotations In The Dryer + /// + [pbr::OriginalName("ThreadLoadResumeHeating")] ThreadLoadResumeHeating = 12, + /// + ///Jog Thread Shortly To Make Sure Spool Is Running. Report End Of Loading + /// + [pbr::OriginalName("ThreadLoadJogThread")] ThreadLoadJogThread = 13, + [pbr::OriginalName("ThreadLoadEnd")] ThreadLoadEnd = 14, + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Hardware/HardwareBlowerType.cs b/Software/Visual_Studio/Tango.PMR/Hardware/HardwareBlowerType.cs index eae9c9809..339224396 100644 --- a/Software/Visual_Studio/Tango.PMR/Hardware/HardwareBlowerType.cs +++ b/Software/Visual_Studio/Tango.PMR/Hardware/HardwareBlowerType.cs @@ -23,8 +23,9 @@ namespace Tango.PMR.Hardware { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChhIYXJkd2FyZUJsb3dlclR5cGUucHJvdG8SElRhbmdvLlBNUi5IYXJkd2Fy", - "ZSonChJIYXJkd2FyZUJsb3dlclR5cGUSEQoNRGVmYXVsdEJsb3dlchAAQh4K", - "HGNvbS50d2luZS50YW5nby5wbXIuaGFyZHdhcmViBnByb3RvMw==")); + "ZSpaChJIYXJkd2FyZUJsb3dlclR5cGUSEQoNRGVmYXVsdEJsb3dlchAAEhAK", + "DEhlYWRCbG93ZXIxMRABEg8KC0hlYWRCbG93ZXIyEAISDgoKV0hTQmxvd2Vy", + "MhADQh4KHGNvbS50d2luZS50YW5nby5wbXIuaGFyZHdhcmViBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Hardware.HardwareBlowerType), }, null)); @@ -38,6 +39,18 @@ namespace Tango.PMR.Hardware { ///Default Blower /// [pbr::OriginalName("DefaultBlower")] DefaultBlower = 0, + /// + ///Head Blower 1 + /// + [pbr::OriginalName("HeadBlower11")] HeadBlower11 = 1, + /// + ///Head Blower 2 + /// + [pbr::OriginalName("HeadBlower2")] HeadBlower2 = 2, + /// + ///WHS Blower 2 + /// + [pbr::OriginalName("WHSBlower2")] Whsblower2 = 3, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Hardware/HardwarePidControlType.cs b/Software/Visual_Studio/Tango.PMR/Hardware/HardwarePidControlType.cs index 23609d642..f2769eb81 100644 --- a/Software/Visual_Studio/Tango.PMR/Hardware/HardwarePidControlType.cs +++ b/Software/Visual_Studio/Tango.PMR/Hardware/HardwarePidControlType.cs @@ -23,7 +23,7 @@ namespace Tango.PMR.Hardware { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChxIYXJkd2FyZVBpZENvbnRyb2xUeXBlLnByb3RvEhJUYW5nby5QTVIuSGFy", - "ZHdhcmUqsgMKFkhhcmR3YXJlUGlkQ29udHJvbFR5cGUSFwoTRHJ5ZXJBaXJU", + "ZHdhcmUq8QQKFkhhcmR3YXJlUGlkQ29udHJvbFR5cGUSFwoTRHJ5ZXJBaXJU", "ZW1wZXJhdHVyZRAAEhMKD0RyeWVySGVhdGVyTWFpbhABEhgKFERyeWVySGVh", "dGVyU2Vjb25kYXJ5EAISEAoMSGVhZEhlYXRlcloxEAMSEAoMSGVhZEhlYXRl", "cloyEAQSEAoMSGVhZEhlYXRlclozEAUSEAoMSGVhZEhlYXRlclo0EAYSEAoM", @@ -32,8 +32,12 @@ namespace Tango.PMR.Hardware { "b3JGZWVkZXIQDBIPCgtNb3RvclBvb2xlchANEg8KC01vdG9yV2luZGVyEA4S", "DgoKRGlzcGVuc2VyMRAPEg4KCkRpc3BlbnNlcjIQEBIOCgpEaXNwZW5zZXIz", "EBESDgoKRGlzcGVuc2VyNBASEg4KCkRpc3BlbnNlcjUQExIOCgpEaXNwZW5z", - "ZXI2EBQSDgoKRGlzcGVuc2VyNxAVEg4KCkRpc3BlbnNlcjgQFkIeChxjb20u", - "dHdpbmUudGFuZ28ucG1yLmhhcmR3YXJlYgZwcm90bzM=")); + "ZXI2EBQSDgoKRGlzcGVuc2VyNxAVEg4KCkRpc3BlbnNlcjgQFhIQCgxIZWFk", + "SGVhdGVyWjcQFxIQCgxIZWFkSGVhdGVyWjgQGBIQCgxIZWFkSGVhdGVyWjkQ", + "GRIRCg1IZWFkSGVhdGVyWjEwEBoSEQoNSGVhZEhlYXRlcloxMRAbEhEKDUhl", + "YWRIZWF0ZXJaMTIQHBIUChBIZWFkQ292ZXJIZWF0ZXIxEB0SFAoQSGVhZENv", + "dmVySGVhdGVyMhAeEhAKDEhlYWRCbG93ZXJfMRAfEhAKDEhlYWRCbG93ZXJf", + "MhAgQh4KHGNvbS50d2luZS50YW5nby5wbXIuaGFyZHdhcmViBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Hardware.HardwarePidControlType), }, null)); @@ -135,6 +139,46 @@ namespace Tango.PMR.Hardware { ///Dispenser 8 /// [pbr::OriginalName("Dispenser8")] Dispenser8 = 22, + /// + ///Head Heater Zone 7 + /// + [pbr::OriginalName("HeadHeaterZ7")] HeadHeaterZ7 = 23, + /// + ///Head Heater Zone 8 + /// + [pbr::OriginalName("HeadHeaterZ8")] HeadHeaterZ8 = 24, + /// + ///Head Heater Zone 9 + /// + [pbr::OriginalName("HeadHeaterZ9")] HeadHeaterZ9 = 25, + /// + ///Head Heater Zone 10 + /// + [pbr::OriginalName("HeadHeaterZ10")] HeadHeaterZ10 = 26, + /// + ///Head Heater Zone 11 + /// + [pbr::OriginalName("HeadHeaterZ11")] HeadHeaterZ11 = 27, + /// + ///Head Heater Zone 12 + /// + [pbr::OriginalName("HeadHeaterZ12")] HeadHeaterZ12 = 28, + /// + ///Head Cover Heater 1 + /// + [pbr::OriginalName("HeadCoverHeater1")] HeadCoverHeater1 = 29, + /// + ///Head Cover Heater 2 + /// + [pbr::OriginalName("HeadCoverHeater2")] HeadCoverHeater2 = 30, + /// + ///Head Blower 1 + /// + [pbr::OriginalName("HeadBlower_1")] HeadBlower1 = 31, + /// + ///Head Blower 2 + /// + [pbr::OriginalName("HeadBlower_2")] HeadBlower2 = 32, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index ad4e8e170..8a3c8a73a 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -131,6 +131,8 @@ + + @@ -141,6 +143,7 @@ + @@ -309,7 +312,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/ObservableCollectionToViewSourceConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/ObservableCollectionToViewSourceConverter.cs new file mode 100644 index 000000000..a2363575a --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/ObservableCollectionToViewSourceConverter.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace Tango.SharedUI.Converters +{ + public class ObservableCollectionToViewSourceConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + String sortMember = parameter != null ? parameter.ToString() : null; + IList list = value as IList; + if (list != null) + { + var view = CollectionViewSource.GetDefaultView(list); + view.SortDescriptions.Clear(); + + //Delay because the DataGrid clears the sort description after source change. + Task.Factory.StartNew(() => + { + Thread.Sleep(10); + + Application.Current.Dispatcher.BeginInvoke(new Action(() => + { + view.SortDescriptions.Add(new SortDescription(sortMember, ListSortDirection.Ascending)); + view.Refresh(); + })); + }); + return view; + } + + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index 4ee00a06e..a65ac7322 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -114,6 +114,7 @@ + @@ -238,7 +239,7 @@ - + \ No newline at end of file -- cgit v1.3.1 From 3cd59dd3b04168ad91cb1fe51231e9b3ddd74705 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 8 Dec 2019 00:19:54 +0200 Subject: Implemented fast database update detection of RMLL, Hardware Versions & Color Catalogs. Related Work Items: #1622 --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes .../ViewModels/MainViewVM.cs | 1 + .../ViewModels/MainViewVM.cs | 1 + .../MachineUpdate/MachineUpdateManager.cs | 23 +++++++++++++-- .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 3 +- .../Tango.PPC.Common/Web/CheckForUpdateRequest.cs | 11 ++++++++ .../Tango.PPC.Common/Web/CheckForUpdateResponse.cs | 7 +++++ .../PPC/Tango.PPC.Common/Web/UpdatedEntity.cs | 31 +++++++++++++++++++++ .../UpdateAvailableNotificationItem.cs | 10 +++++++ .../UpdateAvailableNotificationItemView.xaml | 16 +++++++---- .../Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 13 ++++++++- .../Controllers/PPCController.cs | 28 +++++++++++++++++++ 13 files changed, 134 insertions(+), 10 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdatedEntity.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index a84785a6e..92884377a 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index e97b6d351..9a2dcca84 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs index 652ad3093..3cc4406d6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs @@ -305,6 +305,7 @@ namespace Tango.MachineStudio.Catalogs.ViewModels try { IsFree = false; + ActiveCatalog.LastUpdated = DateTime.UtcNow; await _activeCatalogContext.SaveChangesAsync(); await LoadCatalogs(); _notification.ShowInfo("Catalog updated successfully."); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 7ebcbeb55..256ed24d6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -418,6 +418,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels await Task.Factory.StartNew(() => { + CurrentVersion.LastUpdated = DateTime.UtcNow; _db.SaveChanges(); RefreshVersions(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index e98f6d717..5296a9f34 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using Tango.BL; using Tango.Core; using Tango.Core.DB; using Tango.Core.ExtensionMethods; @@ -594,6 +595,8 @@ namespace Tango.PPC.Common.MachineUpdate { return Task.Factory.StartNew(() => { + _isUpdating = true; + var machineServiceAddress = SettingsManager.Default.GetOrCreate().GetMachineServiceAddress(); LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); @@ -606,12 +609,28 @@ namespace Tango.PPC.Common.MachineUpdate request.SerialNumber = serialNumber; request.Version = _app_manager.Version.ToString(); + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + request.Rmls = db.Rmls.ToList().Select(x => new UpdatedEntity(x)).ToList(); + request.HardwareVersions = db.HardwareVersions.ToList().Select(x => new UpdatedEntity(x)).ToList(); + request.Catalogs = db.ColorCatalogs.ToList().Select(x => new UpdatedEntity(x)).ToList(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to fill the existing database entities before checking for updates."); + } + CheckForUpdateResponse update_response = null; update_response = _client.CheckForUpdates(request).Result; LogManager.Log($"Check for update response received: {Environment.NewLine}{update_response.ToJsonString()}"); + _isUpdating = false; + return update_response; }); } @@ -977,10 +996,10 @@ namespace Tango.PPC.Common.MachineUpdate try { var response = await CheckForUpdate(_machineProvider.Machine.SerialNumber); - if (response.IsUpdateAvailable) + if (response.IsUpdateAvailable || response.IsDatabaseUpdateAvailable) { _checkForUpdateTimer.Interval = TimeSpan.FromMinutes(60).TotalMilliseconds; - LogManager.Log($"New application version detected ({response.Version}). Raising event..."); + LogManager.Log($"New {(response.IsDatabaseUpdateAvailable ? "database updates" : "application version")} detected ({response.Version}). Raising event..."); UpdateAvailable?.Invoke(this, response); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 671cac4f1..e3a23903e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -226,6 +226,7 @@ + @@ -406,7 +407,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs index b98848e4f..0feb32aaf 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs @@ -11,5 +11,16 @@ namespace Tango.PPC.Common.Web { public String SerialNumber { get; set; } public String Version { get; set; } + + public List Rmls { get; set; } + public List HardwareVersions { get; set; } + public List Catalogs { get; set; } + + public CheckForUpdateRequest() + { + Rmls = new List(); + HardwareVersions = new List(); + Catalogs = new List(); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs index 370c0f5ea..63d870834 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs @@ -10,8 +10,15 @@ namespace Tango.PPC.Common.Web public class CheckForUpdateResponse : WebResponseMessage { public bool IsUpdateAvailable { get; set; } + public bool IsDatabaseUpdateAvailable { get; set; } public String Version { get; set; } public bool SetupFirmware { get; set; } public bool SetupFPGA { get; set; } + public UpdateDBResponse UpdateDBResponse { get; set; } + + public CheckForUpdateResponse() + { + UpdateDBResponse = new UpdateDBResponse(); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdatedEntity.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdatedEntity.cs new file mode 100644 index 000000000..faee20678 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdatedEntity.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; + +namespace Tango.PPC.Common.Web +{ + public class UpdatedEntity + { + public UpdatedEntity() + { + + } + + public UpdatedEntity(IObservableEntity entity) : this() + { + Guid = entity.Guid; + LastUpdated = entity.LastUpdated; + } + + public String Guid { get; set; } + public DateTime LastUpdated { get; set; } + + public override string ToString() + { + return $"{Guid} | {LastUpdated}"; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItem.cs index 4dea142b0..9e336f276 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItem.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItem.cs @@ -31,6 +31,16 @@ namespace Tango.PPC.UI.Notifications.NotificationItems set { _version = value; RaisePropertyChangedAuto(); } } + private bool _isDatabaseUpdate; + /// + /// Gets or sets a value indicating whether this instance is database update. + /// + public bool IsDatabaseUpdate + { + get { return _isDatabaseUpdate; } + set { _isDatabaseUpdate = value; RaisePropertyChangedAuto(); } + } + /// /// Gets or sets the view type. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItemView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItemView.xaml index c4533b843..fc9b05b9b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItemView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/UpdateAvailableNotificationItemView.xaml @@ -14,12 +14,16 @@ - - Version - - is available! - Tap to start updating your system. - + + + + Version + + is available! + Tap to start updating your system. + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index 25a4f8c4b..0371e94da 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -162,6 +162,16 @@ namespace Tango.PPC.UI.ViewModels LatestVersion = response.Version; await NavigateTo(MachineUpdateView.UpdateAvailableView); } + else if (response.IsDatabaseUpdateAvailable) + { + IsDbUpdate = true; + _db_compare_result = new DbCompareResult() + { + RequiresUpdate = true, + UpdateDBResponse = response.UpdateDBResponse + }; + await NavigateTo(MachineUpdateView.UpdateAvailableView); + } else { _db_compare_result = await MachineUpdateManager.UpdateDBCheck(MachineProvider.Machine.SerialNumber); @@ -418,12 +428,13 @@ namespace Tango.PPC.UI.ViewModels { if (!IsVisible && _updateNotificationItem == null) { - LogManager.Log($"New application version detected ({e.Version}). Pushing notification..."); + LogManager.Log($"New {(e.IsDatabaseUpdateAvailable ? "database updates" : "application version")} detected ({e.Version}). Pushing notification..."); InvokeUI(() => { _updateNotificationItem = new UpdateAvailableNotificationItem(); _updateNotificationItem.Version = Version.Parse(e.Version).ToString(3); + _updateNotificationItem.IsDatabaseUpdate = e.IsDatabaseUpdateAvailable && !e.IsUpdateAvailable; _updateNotificationItem.Pressed += (_, __) => { _updateNotificationItem = null; diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index f0239978f..2dee09e69 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -314,6 +314,34 @@ namespace Tango.MachineService.Controllers response.Version = latest_machine_version.Version; + //Compare database + + var rmls = db.Rmls.Select(x => new { x.Guid, x.LastUpdated }).ToList(); + var hardwareVersions = db.HardwareVersions.Select(x => new { x.Guid, x.LastUpdated }).ToList(); + var catalogs = db.ColorCatalogs.Select(x => new { x.Guid, x.LastUpdated }).ToList(); + + bool hasDatabaseUpdates = false; + + hasDatabaseUpdates = rmls.Exists(x => request.Rmls.Exists(y => x.Guid == y.Guid && x.LastUpdated > y.LastUpdated) || !request.Rmls.Exists(y => x.Guid == y.Guid)); + + if (!hasDatabaseUpdates) + { + hasDatabaseUpdates = hardwareVersions.Exists(x => request.HardwareVersions.Exists(y => x.Guid == y.Guid && x.LastUpdated > y.LastUpdated) || !request.HardwareVersions.Exists(y => x.Guid == y.Guid)); + } + + if (!hasDatabaseUpdates) + { + hasDatabaseUpdates = catalogs.Exists(x => request.Catalogs.Exists(y => x.Guid == y.Guid && x.LastUpdated > y.LastUpdated) || !request.Catalogs.Exists(y => x.Guid == y.Guid)); + } + + if (hasDatabaseUpdates) + { + response.IsDatabaseUpdateAvailable = true; + response.UpdateDBResponse = UpdateDB(new UpdateDBRequest() { SerialNumber = request.SerialNumber }); + } + + //Compare database + if (machine.ForceVersionUpdate) { response.IsUpdateAvailable = true; -- cgit v1.3.1 From 3f069bb4a5303b2c732ba1263229f62526acc693 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 10 Dec 2019 00:39:06 +0200 Subject: Refactored Object mapping extension methods ! Removed FK from JOB_RUNS => JOBS Added MACHINE_GUID to JOB_RUNS Refactored MS Statistics module for the new changes. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../ViewModels/MainViewVM.cs | 2 +- .../ViewModels/MainViewVM.cs | 2 +- .../Models/JobRunModel.cs | 45 +++++++ .../Tango.MachineStudio.Statistics.csproj | 1 + .../ViewModels/MainViewVM.cs | 23 ++-- .../ViewModels/ConnectedMachineViewVM.cs | 6 +- .../ViewModels/MainViewVM.cs | 2 +- .../Tango.BL/Builders/JobRunsBuilder.cs | 12 -- .../Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs | 8 ++ Software/Visual_Studio/Tango.BL/Entities/Job.cs | 4 +- .../Visual_Studio/Tango.BL/Entities/JobBase.cs | 38 ------ .../Visual_Studio/Tango.BL/Entities/JobRunBase.cs | 67 ++++------ .../ExtensionMethods/ObjectExtensions.cs | 113 ++++++++-------- Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs | 3 - .../Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs | 3 +- .../Tango.DAL.Remote/DB/RemoteADO.Designer.cs | 2 +- .../Tango.DAL.Remote/DB/RemoteADO.edmx | 61 +++------ .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 147 ++++++++++----------- .../JobRuns/BasicJobRunsLogger.cs | 3 + .../Remote/RemoteDBComparer.cs | 4 +- Software/Visual_Studio/Tango.sln | 13 +- .../Utilities/Tango.JobRunsGenerator/Program.cs | 81 +++--------- 24 files changed, 278 insertions(+), 362 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index f50c8b7fb..0336edc76 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 5b78ee141..dd9945ab8 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.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 256ed24d6..9a80eb9d9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -221,7 +221,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels private void CopyParameters(object obj) { - obj.MapPrimitivesTo(SelectedHardwareObject, + obj.MapPropertiesTo(SelectedHardwareObject, MappingFlags.PrimitivesOnly, (prop) => !prop.PropertyType.IsEnum && 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 ee21b9ac3..9939e4876 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 @@ -471,7 +471,7 @@ namespace Tango.MachineStudio.RML.ViewModels var rml = await new RmlBuilder(context).Set(SelectedRML.Guid).WithActiveParametersGroup().WithLiquidFactors().BuildAsync(); Rml cloned = new Rml(); - rml.MapPrimitivesWithStrings(cloned); + rml.MapPropertiesTo(cloned, MappingFlags.NoReferenceTypes); cloned.Code = Rmls.Max(x => x.Code) + 1; cloned.Guid = Guid.NewGuid().ToString(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs new file mode 100644 index 000000000..8e5642e3d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs @@ -0,0 +1,45 @@ + +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.Core.ExtensionMethods; + +namespace Tango.MachineStudio.Statistics.Models +{ + public class JobRunModel : JobRun + { + private static Dictionary _machines = new Dictionary(); + + public JobRunModel() + { + + } + + public JobRunModel(JobRun run) + { + run.MapPropertiesTo(this, MappingFlags.NoReferenceTypes); + } + + public Task LoadMachine(ObservablesContext context) + { + return Task.Factory.StartNew(() => + { + if (!_machines.ContainsKey(MachineGuid)) + { + Machine = context.Machines.SingleOrDefault(x => x.Guid == MachineGuid); + _machines.Add(MachineGuid, Machine); + } + else + { + Machine = _machines[MachineGuid]; + } + }); + } + + public Machine Machine { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj index 243663c5a..36c371165 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj @@ -73,6 +73,7 @@ + PieChartTooltipControl.xaml 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 ef9561d0b..dfbfe2648 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 @@ -7,20 +7,20 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Media; using Tango.BL; -using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core.Helpers; using Tango.MachineStudio.Common; using Tango.MachineStudio.Statistics.Models; using System.Data.Entity; using Tango.MachineStudio.Common.Notifications; +using Tango.BL.Entities; namespace Tango.MachineStudio.Statistics.ViewModels { public class MainViewVM : StudioViewModel { private ObservablesContext _context; - private List _job_runs; + private List _job_runs; private bool rendered; private INotificationProvider _notification; private bool _loaded; @@ -74,7 +74,6 @@ namespace Tango.MachineStudio.Statistics.ViewModels set { _maxDate = value; RaisePropertyChangedAuto(); } } - public MainViewVM(INotificationProvider notificationProvider) { _notification = notificationProvider; @@ -88,12 +87,12 @@ namespace Tango.MachineStudio.Statistics.ViewModels } - private List GetJobRunsByDateRange(DateTime startDate, DateTime endTime, JobRunStatus? status = null) + private List GetJobRunsByDateRange(DateTime startDate, DateTime endTime, JobRunStatus? status = null) { return _job_runs.Where(x => x.StartDate.ToLocalTime() >= startDate && x.StartDate.ToLocalTime() <= endTime && (status == null || x.JobRunStatus == status)).ToList(); } - private List GetJobRunsByDate(DateTime date, JobRunStatus? status = null) + private List GetJobRunsByDate(DateTime date, JobRunStatus? status = null) { return _job_runs.Where(x => x.StartDate.ToLocalTime().Date == date.Date && (status == null || x.JobRunStatus == status)).ToList(); } @@ -106,8 +105,6 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } - - public override async void OnNavigatedTo() { base.OnNavigatedTo(); @@ -124,7 +121,11 @@ namespace Tango.MachineStudio.Statistics.ViewModels await Task.Factory.StartNew(() => { _context = ObservablesContext.CreateDefault(); - _job_runs = _context.JobRuns.Include(x => x.Job).Include(x => x.Job.Machine).OrderBy(x => x.StartDate).ToList(); + _job_runs = _context.JobRuns.OrderBy(x => x.StartDate).ToList().Select(x => new JobRunModel(x)).ToList(); + foreach (var run in _job_runs) + { + run.LoadMachine(_context).GetAwaiter().GetResult(); + } }); if (_job_runs.Count > 0) @@ -282,12 +283,12 @@ namespace Tango.MachineStudio.Statistics.ViewModels private void GeneratePrintPerWeekChart() { - List range_job_runs = GetJobRunsByDateRange(StartDate, EndDate); + List range_job_runs = GetJobRunsByDateRange(StartDate, EndDate); Dictionary> weeks_print_avg = new Dictionary>(); //Init machines weeks averages dictionary. - foreach (var machine in range_job_runs.Select(x => x.Job.Machine).OrderBy(x => x.Name).DistinctBy(x => x.Guid)) + foreach (var machine in range_job_runs.Select(x => x.Machine).OrderBy(x => x.Name).DistinctBy(x => x.Guid)) { weeks_print_avg[machine] = new List(); } @@ -305,7 +306,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels { var week_job_runs = range_job_runs.Where(x => x.EndPosition > 10 && x.StartDate >= current_sunday && x.StartDate <= current_sunday.AddDays(7)).ToList(); - foreach (var machine_job_runs in week_job_runs.GroupBy(x => x.Job.Machine)) + foreach (var machine_job_runs in week_job_runs.GroupBy(x => x.Machine)) { weeks_print_avg[machine_job_runs.Key].Add(machine_job_runs.Select(x => x.EndPosition).Average()); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs index 16f6938a0..40479895d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -95,11 +95,11 @@ namespace Tango.MachineStudio.UI.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { - var jobs = await db.Jobs.Include(x => x.JobRuns).Where(x => x.MachineGuid == ApplicationManager.Machine.Guid).ToListAsync(); + var jobRuns = await db.JobRuns.Where(x => x.MachineGuid == ApplicationManager.Machine.Guid).ToListAsync(); - TotalMachineWorkTime = TimeSpan.FromHours(jobs.SelectMany(x => x.JobRuns).Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToString(@"hh\:mm\:ss"); + TotalMachineWorkTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToString(@"hh\:mm\:ss"); - int meters = (int)jobs.SelectMany(x => x.JobRuns).Select(x => x.EndPosition).Sum(); + int meters = (int)jobRuns.Select(x => x.EndPosition).Sum(); TotalMachineMeters = $"{meters.ToString("N0")} meters"; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 598b1a194..3cceba6c9 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -155,7 +155,7 @@ namespace Tango.PPC.MachineSettings.ViewModels { Settings.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList(); Settings.SupportedColorSpaces = SelectedColorSpaces.SynchedSource.ToList(); - Machine.MapPrimitivesWithStrings(MachineProvider.Machine); + Machine.MapPropertiesTo(MachineProvider.Machine, MappingFlags.NoReferenceTypes); Settings.EnableHotSpot = EnableHotSpot; Settings.HotSpotPassword = HotSpotPassword; diff --git a/Software/Visual_Studio/Tango.BL/Builders/JobRunsBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/JobRunsBuilder.cs index 0a02c6a23..ca755a04c 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/JobRunsBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/JobRunsBuilder.cs @@ -15,17 +15,5 @@ namespace Tango.BL.Builders } - protected override IQueryable OnSetQuery(IQueryable query) - { - return query.Include(x => x.Job); - } - - public virtual JobRunsBuilder WithJobEvents() - { - return AddStep(2, () => - { - Context.MachinesEvents.Where(x => x.MachineGuid == Entity.Job.MachineGuid && x.DateTime >= Entity.StartDate && x.DateTime <= Entity.EndDate).OrderBy(x => x.DateTime).ToList(); - }); - } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs index 112694e1a..9726f16a7 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs @@ -26,6 +26,14 @@ namespace Tango.BL.DTO public abstract class JobRunDTOBase : ObservableEntityDTO { + /// + /// machine guid + /// + public String MachineGuid + { + get; set; + } + /// /// job guid /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs index 3cb6494d4..19f374951 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs @@ -628,7 +628,7 @@ namespace Tango.BL.Entities foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) { JobFileBrushStop st = new JobFileBrushStop(); - stop.MapPrimitivesWithStringsNoNullsTo(st); + stop.MapPropertiesTo(st, MappingFlags.NoReferenceTypes | MappingFlags.NoNullStrings); st.ColorCatalogItemGuid = stop.ColorCatalogsItemGuid.ToStringOrEmpty(); foreach (var idsPack in machine.Configuration.NoneEmptyIdsPacks) @@ -755,7 +755,7 @@ namespace Tango.BL.Entities BrushStop st = new BrushStop(); st.StopIndex = j + 1; st.SegmentGuid = s.Guid; - stop.MapPrimitivesWithStringsNoNullsTo(st); + stop.MapPropertiesTo(st, MappingFlags.NoReferenceTypes | MappingFlags.NoNullStrings); foreach (var volume in stop.LiquidVolumes) { diff --git a/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs b/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs index c5354f2c7..b356ecbfe 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs @@ -87,8 +87,6 @@ namespace Tango.BL.Entities public event EventHandler CustomerChanged; - public event EventHandler> JobRunsChanged; - public event EventHandler MachineChanged; public event EventHandler RmlChanged; @@ -1091,31 +1089,6 @@ namespace Tango.BL.Entities } } - protected SynchronizedObservableCollection _jobruns; - - /// - /// Gets or sets the jobbase job runs. - /// - - public virtual SynchronizedObservableCollection JobRuns - { - get - { - return _jobruns; - } - - set - { - if (_jobruns != value) - { - _jobruns = value; - - OnJobRunsChanged(value); - - } - } - } - protected Machine _machine; /// @@ -1553,15 +1526,6 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(Customer)); } - /// - /// Called when the JobRuns has changed. - /// - protected virtual void OnJobRunsChanged(SynchronizedObservableCollection jobruns) - { - JobRunsChanged?.Invoke(this, jobruns); - RaisePropertyChanged(nameof(JobRuns)); - } - /// /// Called when the Machine has changed. /// @@ -1622,8 +1586,6 @@ namespace Tango.BL.Entities public JobBase() : base() { - JobRuns = new SynchronizedObservableCollection(); - Segments = new SynchronizedObservableCollection(); } diff --git a/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs b/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs index 4d53a6d66..16351179f 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs @@ -41,7 +41,30 @@ namespace Tango.BL.Entities public event EventHandler FailedMessageChanged; - public event EventHandler JobChanged; + protected String _machineguid; + + /// + /// Gets or sets the jobrunbase machine guid. + /// + + [Column("MACHINE_GUID")] + + public String MachineGuid + { + get + { + return _machineguid; + } + + set + { + if (_machineguid != value) + { + _machineguid = value; + + } + } + } protected String _jobguid; @@ -50,7 +73,6 @@ namespace Tango.BL.Entities /// [Column("JOB_GUID")] - [ForeignKey("Job")] public String JobGuid { @@ -206,38 +228,6 @@ namespace Tango.BL.Entities } } - protected Job _job; - - /// - /// Gets or sets the jobrunbase job. - /// - - [XmlIgnore] - [JsonIgnore] - public virtual Job Job - { - get - { - return _job; - } - - set - { - if (_job != value) - { - _job = value; - - if (Job != null) - { - JobGuid = Job.Guid; - } - - OnJobChanged(value); - - } - } - } - /// /// Called when the StartDate has changed. /// @@ -283,15 +273,6 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(FailedMessage)); } - /// - /// Called when the Job has changed. - /// - protected virtual void OnJobChanged(Job job) - { - JobChanged?.Invoke(this, job); - RaisePropertyChanged(nameof(Job)); - } - /// /// Initializes a new instance of the class. /// diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs index fe2c7ff9a..e8ef9addd 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs @@ -12,6 +12,34 @@ using Tango.Serialization; namespace Tango.Core.ExtensionMethods { + public enum MappingFlags + { + /// + /// All properties will be mapped. + /// + All = 1, + + /// + /// Do not map string properties. + /// + NoStrings = 2, + + /// + /// Do not map string properties with value of null. + /// + NoNullStrings = 4, + + /// + /// Do not map reference types. + /// + NoReferenceTypes = 8, + + /// + /// Map only primitive values. + /// + PrimitivesOnly, + } + /// /// Contains extension methods. /// @@ -58,85 +86,62 @@ namespace Tango.Core.ExtensionMethods } /// - /// Maps the object properties values to the destination object. + /// Maps the object primitive properties values to the destination object. /// - /// The source. - /// The destination. - public static void MapPrimitivesTo(this object source, object destination) + /// The source object. + /// The destination object. + /// The mapping flags. + /// Optional condition. + public static void MapPropertiesTo(this object source, object destination, MappingFlags flags = MappingFlags.NoReferenceTypes, Func condition = null) { - foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive)) + foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) { - var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance); + var propType = prop.PropertyType; + var value = prop.GetValue(source); - if (desProp != null && desProp.PropertyType.IsPrimitive && desProp.SetMethod != null) + if (condition != null) { - desProp.SetValue(destination, prop.GetValue(source)); + if (!condition(prop)) continue; } - } - } - /// - /// Maps the object properties values to the destination object including strings and without assigning null string values from the source. - /// - /// The source. - /// The destination. - public static void MapPrimitivesWithStringsNoNullsTo(this object source, object destination) - { - foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(String))) - { - var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance); + if (!propType.IsPrimitive && flags.HasFlag(MappingFlags.PrimitivesOnly)) + { + continue; + } - if (desProp != null && (desProp.PropertyType.IsPrimitive || desProp.PropertyType == typeof(String)) && desProp.SetMethod != null) + if (propType == typeof(String) && flags.HasFlag(MappingFlags.NoStrings)) { - var value = prop.GetValue(source); + continue; + } - if (desProp.PropertyType != typeof(String) || !String.IsNullOrEmpty(value as String)) - { - desProp.SetValue(destination, value); - } + if (propType.IsClass && propType != typeof(String) && flags.HasFlag(MappingFlags.NoReferenceTypes)) + { + continue; + } + + if (flags.HasFlag(MappingFlags.NoNullStrings) && propType == typeof(String) && String.IsNullOrEmpty(value as String)) + { + continue; } - } - } - /// - /// Maps the object properties values to the destination object including strings and without assigning null string values from the source. - /// - /// The source. - /// The destination. - public static void MapPrimitivesWithStrings(this object source, object destination) - { - foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(String))) - { var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance); - if (desProp != null && (desProp.PropertyType.IsPrimitive || desProp.PropertyType == typeof(String)) && desProp.SetMethod != null) + if (desProp != null && desProp.PropertyType == prop.PropertyType && desProp.SetMethod != null) { - var value = prop.GetValue(source); - desProp.SetValue(destination, value); } } } + /// - /// Maps the object properties values to the destination object. + /// Maps the object primitive properties values to the destination object. /// /// The source. /// The destination. - public static void MapPrimitivesTo(this object source, object destination, Func condition) + public static void MapPrimitivesTo(this object source, object destination) { - foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive)) - { - var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance); - - if (desProp != null && desProp.PropertyType.IsPrimitive && desProp.SetMethod != null) - { - if (condition(prop)) - { - desProp.SetValue(destination, prop.GetValue(source)); - } - } - } + source.MapPropertiesTo(destination, MappingFlags.PrimitivesOnly); } /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs index eb8c0a998..17ec544c0 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs @@ -17,7 +17,6 @@ namespace Tango.DAL.Remote.DB [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public JOB() { - this.JOB_RUNS = new HashSet(); this.SEGMENTS = new HashSet(); } @@ -61,8 +60,6 @@ namespace Tango.DAL.Remote.DB public virtual COLOR_CATALOGS COLOR_CATALOGS { get; set; } public virtual COLOR_SPACES COLOR_SPACES { get; set; } public virtual CUSTOMER CUSTOMER { get; set; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection JOB_RUNS { get; set; } public virtual MACHINE MACHINE { get; set; } public virtual RML RML { get; set; } public virtual SPOOL_TYPES SPOOL_TYPES { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs index fb591afa0..24f61f03c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs @@ -17,13 +17,12 @@ namespace Tango.DAL.Remote.DB public int ID { get; set; } public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } + public string MACHINE_GUID { get; set; } public string JOB_GUID { get; set; } public System.DateTime START_DATE { get; set; } public System.DateTime END_DATE { get; set; } public int STATUS { get; set; } public double END_POSITION { get; set; } public string FAILED_MESSAGE { get; set; } - - public virtual JOB JOB { get; set; } } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs index 17bc2683d..d26e67908 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs @@ -1,4 +1,4 @@ -// T4 code generation is enabled for model 'D:\Development\Tango\Software\Visual_Studio\Tango.DAL.Remote\DB\RemoteADO.edmx'. +// T4 code generation is enabled for model 'C:\DATA\Development\Tango\Software\Visual_Studio\Tango.DAL.Remote\DB\RemoteADO.edmx'. // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model // is open in the designer. diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 8607b9f07..8c8b66a5c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -586,7 +586,8 @@ - + + @@ -1614,20 +1615,6 @@ - - - - - - - - - - - - - - @@ -1679,7 +1666,9 @@ - + + + @@ -2077,7 +2066,9 @@ - + + + @@ -2402,10 +2393,6 @@ - - - - @@ -2863,10 +2850,6 @@ - - - - @@ -3658,13 +3641,13 @@ - + + - @@ -3709,7 +3692,6 @@ - @@ -4925,20 +4907,6 @@ - - - - - - - - - - - - - - @@ -4954,7 +4922,9 @@ - + + + @@ -5286,7 +5256,9 @@ - + + + @@ -5958,6 +5930,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index c0574cb9e..2feb68642 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,80 +5,80 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -130,7 +130,6 @@ - diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs index bacae9324..9eb010ec2 100644 --- a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs +++ b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs @@ -117,6 +117,7 @@ namespace Tango.Integration.JobRuns StartDate = _start_date, EndDate = DateTime.UtcNow, JobGuid = _job.Guid, + MachineGuid = _job.MachineGuid, JobRunStatus = JobRunStatus.Failed, EndPosition = e.JobHandler.Status.Progress, FailedMessage = e.Exception.Message, @@ -161,6 +162,7 @@ namespace Tango.Integration.JobRuns StartDate = _start_date, EndDate = DateTime.UtcNow, JobGuid = _job.Guid, + MachineGuid = _job.MachineGuid, EndPosition = e.JobHandler.Status.Progress, JobRunStatus = JobRunStatus.Aborted, }); @@ -204,6 +206,7 @@ namespace Tango.Integration.JobRuns StartDate = _start_date, EndDate = DateTime.UtcNow, JobGuid = _job.Guid, + MachineGuid = _job.MachineGuid, EndPosition = e.JobHandler.Status.Progress, JobRunStatus = JobRunStatus.Completed, }); diff --git a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs index aaf4706a3..7022d1ae3 100644 --- a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs +++ b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs @@ -143,7 +143,7 @@ namespace Tango.Synchronization.Remote var remote_jobs = remote_machines.SelectMany(x => x.JOBS).ToList(); OnProgress(LogManager.Log("Querying all remote job runs...")); - var remote_jobs_runs = remote_jobs.SelectMany(x => x.JOB_RUNS).ToList(); + //var remote_jobs_runs = remote_jobs.SelectMany(x => x.JOB_RUNS).ToList(); OnProgress(LogManager.Log("Querying all remote segments...")); var remote_segments = remote_jobs.SelectMany(x => x.SEGMENTS).ToList(); @@ -196,7 +196,7 @@ namespace Tango.Synchronization.Remote CompareCollections(remote_jobs, local_jobs, _remoteDB.JOBS, _localDB.JOBS); OnProgress(LogManager.Log("Comparing job runs")); - CompareCollections(remote_jobs_runs, local_job_runs, _remoteDB.JOB_RUNS, _localDB.JOB_RUNS); + //CompareCollections(remote_jobs_runs, local_job_runs, _remoteDB.JOB_RUNS, _localDB.JOB_RUNS); OnProgress(LogManager.Log("Comparing segments")); CompareCollections(remote_segments, local_segments, _remoteDB.SEGMENTS, _localDB.SEGMENTS); diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 5d601ae52..8dc160543 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -3841,6 +3841,7 @@ Global {4EDCF067-E377-42CB-A18C-8368CF484577}.AppVeyor|x86.ActiveCfg = Release|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.AppVeyor|x86.Build.0 = Release|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|Any CPU.Build.0 = Debug|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|ARM.ActiveCfg = Debug|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|ARM.Build.0 = Debug|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|ARM64.ActiveCfg = Debug|Any CPU @@ -5885,12 +5886,12 @@ Global {DA391B02-AE28-4EA1-A80F-D0F4C8029FFA} = {E728CBD9-1AF4-4814-A218-E4BD26E7EDEA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} - BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear - BuildVersion_UpdateAssemblyVersion = True - BuildVersion_UpdateFileVersion = False - BuildVersion_StartDate = 2000/1/1 - BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs BuildVersion_UseGlobalSettings = False + BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs + BuildVersion_StartDate = 2000/1/1 + BuildVersion_UpdateFileVersion = False + BuildVersion_UpdateAssemblyVersion = True + BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear + SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} EndGlobalSection EndGlobal diff --git a/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs b/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs index 6c3c62606..61e74957c 100644 --- a/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Tango.BL; using Tango.BL.Builders; using Tango.BL.Entities; +using Tango.Core; namespace Tango.JobRunsGenerator { @@ -13,75 +14,27 @@ namespace Tango.JobRunsGenerator { static void Main(string[] args) { - Console.WriteLine("Job Runs Generator Started..."); - - DateTime now = DateTime.UtcNow; - DateTime yearago = DateTime.UtcNow.AddYears(-1); - Random rnd = new Random(); - List messages = new List() - { - "Timeout failure", - "Thread Break", - "Application Exception", - "Over Temperature", - "Communication Error" - }; - - int count = 0; - - using (ObservablesContext db = ObservablesContext.CreateDefault("localhost\\SQLEXPRESS")) + DataSource dataSource = new DataSource(); + dataSource.Catalog = "Tango_DEV"; + dataSource.Address = "twine.database.windows.net"; + dataSource.IntegratedSecurity = false; + dataSource.UserName = "Roy"; + dataSource.Password = "Aa123456"; + + using (ObservablesContext db = ObservablesContext.CreateDefault(dataSource)) { - var machines = db.Machines.ToList(); - - foreach (var machine in machines) + foreach (var run in db.JobRuns.OrderBy(x => x.JobGuid)) { - new MachineBuilder(db).Set(machine).WithJobs().Build(); - - foreach (var job in machine.Jobs) - { - using (ObservablesContext db2 = ObservablesContext.CreateDefault("localhost\\SQLEXPRESS")) - { - for (DateTime date = yearago; date < now; date = date.AddDays(1)) - { - Console.WriteLine($"Adding job runs for machine '{machine.SerialNumber}' job '{job.Name}' date {date.ToShortDateString()}..."); - - for (int i = 0; i < rnd.Next(0, 9); i++) - { - int status = rnd.Next(0, 3); - String message = messages[rnd.Next(0, messages.Count)]; - - db2.JobRuns.Add(new JobRun() - { - StartDate = date, - EndDate = date.AddMinutes(rnd.Next(10, 61)), - JobGuid = job.Guid, - EndPosition = job.Length / rnd.Next(1, 11), - Status = status, - FailedMessage = status == 2 ? message : null, - }); - - count++; - } - } - - db2.SaveChanges(); - } - } + var job = db.Jobs.SingleOrDefault(x => x.Guid == run.JobGuid); + Console.WriteLine($"Fixing job {job.Name}..."); + run.MachineGuid = job.MachineGuid; } - Console.WriteLine($"The generator is about to insert {count} job runs to the database are you sure? [Y/N]:"); - var key = Console.ReadKey().Key; + Console.WriteLine("Saving changed..."); + db.SaveChanges(); - if (key == ConsoleKey.Y) - { - Console.WriteLine("Saving changes to database..."); - Console.WriteLine("Done!"); - Console.ReadLine(); - } - else - { - return; - } + Console.WriteLine("Done!"); + Console.ReadLine(); } } } -- cgit v1.3.1 From 76cdf188e28544cd5056c30f35d77590d9a79cae Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 20 Dec 2019 21:34:50 +0200 Subject: Improvements to ActionLogs. Implemented ActionLogs for hw comparison. --- .../ViewModels/MainViewVM.cs | 26 +++++++++++++++++++++- .../ActionLogs/DefaultActionLogComparer.cs | 21 ++++++++++++++--- .../Tango.BL/ActionLogs/DefaultActionLogManager.cs | 5 ++++- .../Tango.BL/DTO/ColorCatalogsItemsRecipeDTO.cs | 6 ++++- .../Tango.BL/DTO/HardwareBlowerDTO.cs | 7 ++++++ .../Tango.BL/DTO/HardwareBreakSensorDTO.cs | 7 ++++++ .../Tango.BL/DTO/HardwareDancerDTO.cs | 7 ++++++ .../Visual_Studio/Tango.BL/DTO/HardwareMotorDTO.cs | 7 ++++++ .../Tango.BL/DTO/HardwarePidControlDTO.cs | 7 ++++++ .../Tango.BL/DTO/HardwareSpeedSensorDTO.cs | 7 ++++++ .../Tango.BL/DTO/HardwareVersionDTO.cs | 22 ++++++++++++++++++ .../Tango.BL/DTO/HardwareWinderDTO.cs | 7 ++++++ .../Tango.BL/DTO/LiquidTypesRmlDTO.cs | 6 +++-- .../Tango.BL/ObservableDTOPropertyAttribute.cs | 14 ++++++++++++ .../Visual_Studio/Tango.BL/ObservableEntityDTO.cs | 15 +++++++++++++ Software/Visual_Studio/Tango.BL/Tango.BL.csproj | 3 ++- .../Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs | 12 ++++++++++ 17 files changed, 170 insertions(+), 9 deletions(-) create mode 100644 Software/Visual_Studio/Tango.BL/ObservableDTOPropertyAttribute.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 9a80eb9d9..7c95ce270 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -16,6 +16,9 @@ using Tango.Core.ExtensionMethods; using Tango.MachineStudio.HardwareDesigner.Views; using Microsoft.Win32; using System.IO; +using Tango.BL.ActionLogs; +using Tango.MachineStudio.Common.Authentication; +using Tango.BL.DTO; namespace Tango.MachineStudio.HardwareDesigner.ViewModels { @@ -24,6 +27,9 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels private INotificationProvider _notification; private bool _isNew; private ObservablesContext _db; + private IActionLogManager _actionLogManager; + private IAuthenticationProvider _authentication; + private HardwareVersionDTO _hwBeforeSave; private HardwareVersion _selectedVersion; public HardwareVersion SelectedVersion @@ -45,6 +51,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels get { return _selectedHardwareObject; } set { + _selectedHardwareObject = null; + RaisePropertyChangedAuto(); _selectedHardwareObject = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(SelectedHardwareObjectTypeName)); @@ -113,9 +121,11 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels public RelayCommand ImportHardwareVersionCommand { get; set; } - public MainViewVM(INotificationProvider notification) + public MainViewVM(INotificationProvider notification, IActionLogManager actionLogManager, IAuthenticationProvider authentication) { _notification = notification; + _actionLogManager = actionLogManager; + _authentication = authentication; CurrentVersion = new HardwareVersion(); @@ -337,6 +347,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels }); CurrentVersion.HardwareBreakSensors = CurrentVersion.HardwareBreakSensors.OrderBy(x => x.HardwareBreakSensorType.Code).ToSynchronizedObservableCollection(); + + _hwBeforeSave = HardwareVersionDTO.FromObservable(CurrentVersion); }); } @@ -391,6 +403,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels _db.HardwareVersions.Add(CurrentVersion); _db.SaveChanges(); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionCreated, _authentication.CurrentUser, CurrentVersion.Name, CurrentVersion, "New hardware version created using Machine Studio."); + RefreshVersions(); InvokeUI(() => @@ -420,6 +434,11 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels { CurrentVersion.LastUpdated = DateTime.UtcNow; _db.SaveChanges(); + + var dtoAfter = HardwareVersionDTO.FromObservable(CurrentVersion); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionSaved, _authentication.CurrentUser, CurrentVersion.Name, _hwBeforeSave, dtoAfter, "Hardware Version saved using Machine Studio."); + _hwBeforeSave = dtoAfter; + RefreshVersions(); InvokeUI(() => @@ -461,6 +480,9 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels cloned.Version = HardwareVersions.Max(x => x.Version) + 1; _db.HardwareVersions.Add(cloned); _db.SaveChanges(); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionCreated, _authentication.CurrentUser, cloned.Name, cloned, "New hardware version created (cloned) using Machine Studio."); + RefreshVersions(); InvokeUI(() => @@ -496,6 +518,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels await CurrentVersion.DeleteCascadeAsync(_db); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionDeleted, _authentication.CurrentUser, CurrentVersion.Name, _hwBeforeSave, "Hardware version deleted using Machine Studio.", true); + await Task.Factory.StartNew(() => { SelectedVersion = null; diff --git a/Software/Visual_Studio/Tango.BL/ActionLogs/DefaultActionLogComparer.cs b/Software/Visual_Studio/Tango.BL/ActionLogs/DefaultActionLogComparer.cs index b6c028137..0b29dcc8c 100644 --- a/Software/Visual_Studio/Tango.BL/ActionLogs/DefaultActionLogComparer.cs +++ b/Software/Visual_Studio/Tango.BL/ActionLogs/DefaultActionLogComparer.cs @@ -108,6 +108,10 @@ namespace Tango.BL.ActionLogs { IList beforeCollection = null; IList afterCollection = null; + ActionLogDifference listDiff = new ActionLogDifference() + { + Name = prop.Name + }; if (before != null) { @@ -119,18 +123,22 @@ namespace Tango.BL.ActionLogs afterCollection = prop.GetValue(after) as IList; } + int listCount = 0; + if (beforeCollection != null && afterCollection == null) { for (int i = 0; i < beforeCollection.Count; i++) { - Compare(AddChildDiff(diff, GetActionLogName(beforeCollection[i], prop.Name)), beforeCollection[i], null, scannedObjects); + listCount++; + Compare(AddChildDiff(listDiff, GetActionLogName(beforeCollection[i], prop.Name)), beforeCollection[i], null, scannedObjects); } } else if (beforeCollection == null && afterCollection != null) { for (int i = 0; i < afterCollection.Count; i++) { - Compare(AddChildDiff(diff, GetActionLogName(afterCollection[i], prop.Name)), null, afterCollection[i], scannedObjects); + listCount++; + Compare(AddChildDiff(listDiff, GetActionLogName(afterCollection[i], prop.Name)), null, afterCollection[i], scannedObjects); } } @@ -140,9 +148,16 @@ namespace Tango.BL.ActionLogs { var beforeItem = i < beforeCollection.Count ? beforeCollection[i] : null; var afterItem = i < afterCollection.Count ? afterCollection[i] : null; - Compare(AddChildDiff(diff, GetActionLogName(beforeItem, prop.Name)), beforeItem, afterItem, scannedObjects); + + listCount++; + Compare(AddChildDiff(listDiff, GetActionLogName(beforeItem, prop.Name)), beforeItem, afterItem, scannedObjects); } } + + if (listCount > 0) + { + diff.Children.Add(listDiff); + } } } } diff --git a/Software/Visual_Studio/Tango.BL/ActionLogs/DefaultActionLogManager.cs b/Software/Visual_Studio/Tango.BL/ActionLogs/DefaultActionLogManager.cs index b8f427e3a..0f5d6bd51 100644 --- a/Software/Visual_Studio/Tango.BL/ActionLogs/DefaultActionLogManager.cs +++ b/Software/Visual_Studio/Tango.BL/ActionLogs/DefaultActionLogManager.cs @@ -108,6 +108,8 @@ namespace Tango.BL.ActionLogs { ActionLogDifference diff = new ActionLogDifference(); + bool insertWhenNoDifference = false; + if (ActionLogComparer != null) { try @@ -116,10 +118,11 @@ namespace Tango.BL.ActionLogs } catch (Exception ex) { + insertWhenNoDifference = true; LogManager.Log(ex, $"Error while comparing for action log '{type}'."); } - if (diff.Children.Count > 0) + if (diff.Children.Count > 0 || insertWhenNoDifference) { InsertLog(type, userGuid, relatedObjectName, GetRelatedObjectGuid(relatedObjectBefore, relatedObjectAfter), diff, message); } diff --git a/Software/Visual_Studio/Tango.BL/DTO/ColorCatalogsItemsRecipeDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/ColorCatalogsItemsRecipeDTO.cs index 34b061df8..06979a3bb 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/ColorCatalogsItemsRecipeDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/ColorCatalogsItemsRecipeDTO.cs @@ -4,14 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class ColorCatalogsItemsRecipeDTO : ColorCatalogsItemsRecipeDTOBase { + [ObservableDTOProperty(MapsTo = nameof(ColorCatalogsItemsRecipe.Rml) + "." + nameof(ColorCatalogsItemsRecipe.Rml.Name))] + public String RmlName { get; set; } + protected override string OnGetActionLogName() { - return $"Color Recipe for RML '{RmlGuid}'"; + return $"Color Recipe for RML '{(RmlName != null ? RmlName : RmlGuid)}'"; } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwareBlowerDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwareBlowerDTO.cs index be8a50ca1..85d5ef9f7 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwareBlowerDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwareBlowerDTO.cs @@ -4,11 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class HardwareBlowerDTO : HardwareBlowerDTOBase { + [ObservableDTOProperty(MapsTo = nameof(HardwareBlower.HardwareBlowerType) + "." + nameof(HardwareBlower.HardwareBlowerType.Description))] + public String HardwareBlowerTypeDescription { get; set; } + protected override string OnGetActionLogName() + { + return $"Blower '{HardwareBlowerTypeDescription}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwareBreakSensorDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwareBreakSensorDTO.cs index 968070be0..1b1790a4d 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwareBreakSensorDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwareBreakSensorDTO.cs @@ -4,11 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class HardwareBreakSensorDTO : HardwareBreakSensorDTOBase { + [ObservableDTOProperty(MapsTo = nameof(HardwareBreakSensor.HardwareBreakSensorType) + "." + nameof(HardwareBreakSensor.HardwareBreakSensorType.Description))] + public String HardwareBreakSensorTypeDescription { get; set; } + protected override string OnGetActionLogName() + { + return $"Break Sensor '{HardwareBreakSensorTypeDescription}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwareDancerDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwareDancerDTO.cs index 1963ae9d7..2527a3e45 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwareDancerDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwareDancerDTO.cs @@ -4,11 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class HardwareDancerDTO : HardwareDancerDTOBase { + [ObservableDTOProperty(MapsTo = nameof(HardwareDancer.HardwareDancerType) + "." + nameof(HardwareDancer.HardwareDancerType.Description))] + public String HardwareDancerTypeDescription { get; set; } + protected override string OnGetActionLogName() + { + return $"Dancer '{HardwareDancerTypeDescription}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwareMotorDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwareMotorDTO.cs index 41d53bf2a..cc1147f4c 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwareMotorDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwareMotorDTO.cs @@ -4,11 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class HardwareMotorDTO : HardwareMotorDTOBase { + [ObservableDTOProperty(MapsTo = nameof(HardwareMotor.HardwareMotorType) + "." + nameof(HardwareMotor.HardwareMotorType.Description))] + public String HardwareMotorTypeDescription { get; set; } + protected override string OnGetActionLogName() + { + return $"Motor '{HardwareMotorTypeDescription}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwarePidControlDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwarePidControlDTO.cs index bd6e344a7..d65b5d68f 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwarePidControlDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwarePidControlDTO.cs @@ -4,11 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class HardwarePidControlDTO : HardwarePidControlDTOBase { + [ObservableDTOProperty(MapsTo = nameof(HardwarePidControl.HardwarePidControlType) + "." + nameof(HardwarePidControl.HardwarePidControlType.Description))] + public String HardwarePidControlTypeDescription { get; set; } + protected override string OnGetActionLogName() + { + return $"PID Control '{HardwarePidControlTypeDescription}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwareSpeedSensorDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwareSpeedSensorDTO.cs index 14eae14ae..88145cce4 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwareSpeedSensorDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwareSpeedSensorDTO.cs @@ -4,11 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class HardwareSpeedSensorDTO : HardwareSpeedSensorDTOBase { + [ObservableDTOProperty(MapsTo = nameof(HardwareSpeedSensor.HardwareSpeedSensorType) + "." + nameof(HardwareSpeedSensor.HardwareSpeedSensorType.Description))] + public String HardwareSpeedSensorTypeDescription { get; set; } + protected override string OnGetActionLogName() + { + return $"Speed Sensor '{HardwareSpeedSensorTypeDescription}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwareVersionDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwareVersionDTO.cs index 55065b301..36681162b 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwareVersionDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwareVersionDTO.cs @@ -9,6 +9,28 @@ namespace Tango.BL.DTO { public class HardwareVersionDTO : HardwareVersionDTOBase { + public List HardwareBlowers { get; set; } + public List HardwareBreakSensors { get; set; } + public List HardwareDancers { get; set; } + public List HardwareMotors { get; set; } + public List HardwarePidControls { get; set; } + public List HardwareSpeedSensors { get; set; } + public List HardwareWinders { get; set; } + public HardwareVersionDTO() + { + HardwareBlowers = new List(); + HardwareBreakSensors = new List(); + HardwareDancers = new List(); + HardwareMotors = new List(); + HardwarePidControls = new List(); + HardwareSpeedSensors = new List(); + HardwareWinders = new List(); + } + + protected override string OnGetActionLogName() + { + return $"Hardware Version '{Name} v{Version}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwareWinderDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwareWinderDTO.cs index a65d81791..c84c4eeaf 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwareWinderDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwareWinderDTO.cs @@ -4,11 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class HardwareWinderDTO : HardwareWinderDTOBase { + [ObservableDTOProperty(MapsTo = nameof(HardwareWinder.HardwareWinderType) + "." + nameof(HardwareWinder.HardwareWinderType.Description))] + public String HardwareWinderTypeDescription { get; set; } + protected override string OnGetActionLogName() + { + return $"Winder '{HardwareWinderTypeDescription}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/LiquidTypesRmlDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/LiquidTypesRmlDTO.cs index 2366b9727..e7d940ca4 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/LiquidTypesRmlDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/LiquidTypesRmlDTO.cs @@ -4,16 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class LiquidTypesRmlDTO : LiquidTypesRmlDTOBase { - public LiquidTypeDTO LiquidType { get; set; } + [ObservableDTOProperty(MapsTo = nameof(LiquidTypesRml.LiquidType) + "." + nameof(LiquidTypesRml.LiquidType.Name))] + public String LiquidTypeName { get; set; } protected override string OnGetActionLogName() { - return this.LiquidType != null ? $"Liquid Factor '{LiquidType.Name}'" : $"Liquid Factor '{Guid}'"; + return LiquidTypeName != null ? $"Liquid Factor '{LiquidTypeName}'" : $"Liquid Factor '{Guid}'"; } } } diff --git a/Software/Visual_Studio/Tango.BL/ObservableDTOPropertyAttribute.cs b/Software/Visual_Studio/Tango.BL/ObservableDTOPropertyAttribute.cs new file mode 100644 index 000000000..48e07c271 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/ObservableDTOPropertyAttribute.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL +{ + [AttributeUsage(AttributeTargets.Property)] + public class ObservableDTOPropertyAttribute : Attribute + { + public String MapsTo { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs b/Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs index ee8d2f40f..4c5ca6ae4 100644 --- a/Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs +++ b/Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs @@ -1,12 +1,14 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using Tango.BL.ActionLogs; using Tango.BL.ValueObjects; +using Tango.Core.ExtensionMethods; namespace Tango.BL { @@ -72,6 +74,19 @@ namespace Tango.BL prop.SetValue(dto, collection); } } + else if (prop.GetCustomAttribute() != null) + { + var att = prop.GetCustomAttribute(); + + try + { + prop.SetValue(dto, observable.GetPropertyValueByPath(att.MapsTo)); + } + catch + { + Debug.WriteLine($"Error mapping '{typeof(DTO).Name}.{prop.PropertyType}' to '{typeof(T)}.{att.MapsTo}'."); + } + } } return dto; diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index fb8ec84a3..5c599bb5e 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -384,6 +384,7 @@ + @@ -591,7 +592,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs index 58a05ee83..a574f7ea0 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs @@ -38,5 +38,17 @@ namespace Tango.UnitTesting.BL Assert.IsTrue(configDTO.Equals(config)); } } + + [TestMethod] + public void DTOPropertyAttribute_Is_Working() + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var hwBlower = db.HardwareBlowers.Include(x => x.HardwareBlowerType).First(); + var dto = HardwareBlowerDTO.FromObservable(hwBlower); + + Assert.AreEqual(dto.HardwareBlowerTypeDescription, hwBlower.HardwareBlowerType.Description); + } + } } } -- cgit v1.3.1 From 582c05b00aa1d0fd9086b4a245dcc987eee9fc39 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 21 Dec 2019 19:14:00 +0200 Subject: Working some more on ActionLogs across MS. --- .../ViewModels/MainViewVM.cs | 4 +-- .../ViewModels/MainViewVM.cs | 10 +++--- .../ViewModels/MainViewVM.cs | 6 ++-- .../ViewModels/MainViewVM.cs | 32 +++++++++++++++-- .../ViewModels/MainViewVM.cs | 28 ++++++++++++++- .../ViewModels/MainViewVM.cs | 13 +++++-- .../ViewModels/SiteDetailsViewVM.cs | 42 +++++++++++++++++++--- Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs | 10 ++++++ .../Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs | 21 +++++++++++ Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs | 25 ++++++++++--- Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs | 16 +++++++++ Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs | 4 +++ Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs | 25 +++++++++++++ Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs | 6 +++- Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs | 7 ++++ .../Tango.BL/Enumerations/ActionLogType.cs | 6 ++++ .../Controllers/PPCController.cs | 2 ++ 17 files changed, 230 insertions(+), 27 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs index ae763167b..e306d0997 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs @@ -244,7 +244,7 @@ namespace Tango.MachineStudio.Catalogs.ViewModels { IsFree = false; await SelectedCatalog.DeleteCascadeAsync(_catalogsContext); - _actionLogManager.InsertLog(ActionLogType.CatalogDeleted, _authentication.CurrentUser, SelectedCatalog.Name, SelectedCatalog, "Catalog deleted using Machine Studio."); + _actionLogManager.InsertLog(ActionLogType.CatalogDeleted, _authentication.CurrentUser, SelectedCatalog.Name, SelectedCatalog, "Catalog deleted using Machine Studio.", false); SelectedCatalog = null; } catch (Exception ex) @@ -322,7 +322,7 @@ namespace Tango.MachineStudio.Catalogs.ViewModels await _activeCatalogContext.SaveChangesAsync(); var activeCatalogDTO = ColorCatalogDTO.FromObservable(ActiveCatalog); - _actionLogManager.InsertLog(ActionLogType.CatalogSaved, _authentication.CurrentUser, ActiveCatalog.Name, _catalogBeforeSave, activeCatalogDTO, "Catalog created using Machine Studio."); + _actionLogManager.InsertLog(ActionLogType.CatalogSaved, _authentication.CurrentUser, _catalogBeforeSave.Name, _catalogBeforeSave, activeCatalogDTO, "Catalog created using Machine Studio."); _catalogBeforeSave = activeCatalogDTO; await LoadCatalogs(); 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 8b235a13a..a641c87b6 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 @@ -1726,6 +1726,8 @@ namespace Tango.MachineStudio.Developer.ViewModels using (_notification.PushTaskItem("Saving Parameters Group...")) { + var processGroupBefore = ProcessParametersTablesGroupDTO.FromObservable(SelectedRML.GetActiveProcessGroup()); + using (var db = ObservablesContext.CreateDefault()) { var active_groups = db.ProcessParametersTablesGroups.Where(x => x.RmlGuid == SelectedRML.Guid && x.Active).ToList(); @@ -1753,8 +1755,6 @@ namespace Tango.MachineStudio.Developer.ViewModels tables.Add(newTable); } - var rmlBeforeDTO = RmlDTO.FromObservable(SelectedRML); - group.Active = true; group.ProcessParametersTables = tables.ToSynchronizedObservableCollection(); group.Rml = SelectedRML; @@ -1769,7 +1769,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SelectedRML.ProcessParametersTablesGroups.Add(group); await SelectedRML.SaveAsync(_activeJobDbContext); - _actionLogManager.InsertLog(ActionLogType.RmlSaved, AuthenticationProvider.CurrentUser, SelectedRML.Name, rmlBeforeDTO, RmlDTO.FromObservable(SelectedRML), "Active process parameters changed from Machine Studio Research module."); + _actionLogManager.InsertLog(ActionLogType.RmlActiveProcessParametersChanged, AuthenticationProvider.CurrentUser, SelectedRML.Name, processGroupBefore, ProcessParametersTablesGroupDTO.FromObservable(SelectedRML.GetActiveProcessGroup()), "RML Active process parameters changed from Machine Studio Research module."); InvalidateLiquidFactorsAndProcessTables(); } @@ -2421,7 +2421,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var job in SelectedJobs) { - _actionLogManager.InsertLog(ActionLogType.JobCreated, AuthenticationProvider.CurrentUser, job.Name, job, "Job created using Machine Studio."); + _actionLogManager.InsertLog(ActionLogType.JobCreated, AuthenticationProvider.CurrentUser, job.Name, job, "Job cloned using Machine Studio."); } CanWork = true; @@ -2664,7 +2664,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var job in jobsToReport) { - _actionLogManager.InsertLog(ActionLogType.JobImported, AuthenticationProvider.CurrentUser, job.Name, job, "New job imported using Machine Studio."); + _actionLogManager.InsertLog(ActionLogType.JobImported, AuthenticationProvider.CurrentUser, job.Name, job, "Job imported using Machine Studio."); } IsFree = true; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 7c95ce270..0a8780346 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -193,6 +193,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels _db.HardwareVersions.Add(hv); await _db.SaveChangesAsync(); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionImported, _authentication.CurrentUser, CurrentVersion.Name, CurrentVersion, "New hardware version imported using Machine Studio."); + RefreshVersions(); InvokeUI(() => @@ -436,7 +438,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels _db.SaveChanges(); var dtoAfter = HardwareVersionDTO.FromObservable(CurrentVersion); - _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionSaved, _authentication.CurrentUser, CurrentVersion.Name, _hwBeforeSave, dtoAfter, "Hardware Version saved using Machine Studio."); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionSaved, _authentication.CurrentUser, _hwBeforeSave.Name, _hwBeforeSave, dtoAfter, "Hardware Version saved using Machine Studio."); _hwBeforeSave = dtoAfter; RefreshVersions(); @@ -481,7 +483,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels _db.HardwareVersions.Add(cloned); _db.SaveChanges(); - _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionCreated, _authentication.CurrentUser, cloned.Name, cloned, "New hardware version created (cloned) using Machine Studio."); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionCreated, _authentication.CurrentUser, cloned.Name, cloned, "New hardware version cloned using Machine Studio."); RefreshVersions(); 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 fd31cd950..7b6ae7ef0 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 @@ -25,14 +25,21 @@ using Tango.Core.Threading; using Tango.MachineStudio.RML.ViewModels; using Tango.Settings; using Tango.MachineStudio.RML.Models; +using Tango.BL.ActionLogs; +using Tango.MachineStudio.Common.Authentication; +using Tango.BL.DTO; namespace Tango.MachineStudio.MachineDesigner.ViewModels { public class MainViewVM : StudioViewModel { private INotificationProvider _notification; + private IActionLogManager _actionLogManager; + private IAuthenticationProvider _authentication; private ActionTimer _machines_action_timer; private ActionTimer _dispensers_action_timer; + private MachineDTO _machineBeforeSave; + private bool _isNewMachine; #region Properties @@ -233,10 +240,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// /// Initializes a new instance of the class. /// - public MainViewVM(INotificationProvider notification) + public MainViewVM(INotificationProvider notification, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { MachinesAdapter = new ObservablesStaticCollections(ObservablesContext.CreateDefault()); _notification = notification; + _authentication = authentication; + _actionLogManager = actionLogManager; _machines_action_timer = new ActionTimer(TimeSpan.FromMilliseconds(200)); _dispensers_action_timer = new ActionTimer(TimeSpan.FromMilliseconds(200)); @@ -428,6 +437,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels private async void LoadSelectedMachine(bool newMachine = false, bool clone = false, MachineVersion selectedVersion = null) { + _isNewMachine = false; + using (_notification.PushTaskItem("Loading machine details...")) { try @@ -462,9 +473,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels if (!newMachine) { ActiveMachine = (await new MachineBuilder(ActiveMachineAdapter.Context).Set(SelectedMachine.Guid).WithOrganization().WithConfiguration().WithSpools().BuildAsync()); + _machineBeforeSave = MachineDTO.FromObservable(ActiveMachine); + if (clone) { + _isNewMachine = true; ActiveMachine = ActiveMachine.Clone(); ActiveMachine.Name = ""; ActiveMachine.SerialNumber = ""; @@ -476,6 +490,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } else { + _isNewMachine = true; + if (selectedVersion == null) { ActiveMachine = new Machine(); @@ -668,16 +684,25 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachine.ConfigurationGuid = ActiveMachine.Configuration.Guid; ActiveMachine.LastUpdated = DateTime.UtcNow; - ActiveMachine.ProductionDate = DateTime.UtcNow; ActiveMachine.SiteGuid = SelectedSite == null ? null : (SelectedSite.ID == -1 ? null : SelectedSite.Guid); ColorCalibrationViewVM.Save(); var hwConfig = HardwareConfigurationViewVM.GetResultingHardwareConfiguration(); ActiveMachine.Configuration.SetHardwareConfiguration(hwConfig); - await ActiveMachineAdapter.Context.SaveChangesAsync(); + if (_isNewMachine) + { + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineCreated, _authentication.CurrentUser, ActiveMachine.Name, ActiveMachine, "New machine created using Machine Studio."); + } + else + { + var machineAfterDTO = MachineDTO.FromObservable(ActiveMachine); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineSaved, _authentication.CurrentUser, _machineBeforeSave.Name, _machineBeforeSave, machineAfterDTO, "Machine saved using Machine Studio."); + _machineBeforeSave = machineAfterDTO; + } + if (SelectedMachine != null) { await SelectedMachine.Reload(MachinesAdapter.Context); @@ -725,6 +750,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels IsFree = false; await SelectedMachine.DeleteCascadeAsync(MachinesAdapter.Context); MachinesAdapter.Context.Machines.Remove(SelectedMachine); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineDeleted, _authentication.CurrentUser, SelectedMachine.Name, SelectedMachine, "Machine deleted using Machine Studio."); } catch (Exception ex) { 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 9939e4876..527159aa5 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 @@ -21,12 +21,18 @@ using Tango.MachineStudio.RML.Views; using Tango.PMR.ColorLab; using System.Data.Entity; using Tango.Core.ExtensionMethods; +using Tango.MachineStudio.Common.Authentication; +using Tango.BL.ActionLogs; +using Tango.BL.DTO; namespace Tango.MachineStudio.RML.ViewModels { public class MainViewVM : StudioViewModel { private INotificationProvider _notification; + private IAuthenticationProvider _authentication; + private IActionLogManager _actionLogManager; + private RmlDTO _rmlBeforeSave; private ObservablesContext _rmls_context; private ObservablesContext _active_context; @@ -185,9 +191,11 @@ namespace Tango.MachineStudio.RML.ViewModels public RelayCommand ImportRMLFileCommand { get; set; } - public MainViewVM(INotificationProvider notificationProvider) + public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { _notification = notificationProvider; + _authentication = authentication; + _actionLogManager = actionLogManager; ManageRmlCommand = new RelayCommand(() => LoadActiveRML(SelectedRML.Guid), () => SelectedRML != null); RemoveRmlCommand = new RelayCommand(RemoveSelectedRml, () => SelectedRML != null); CloneRmlCommand = new RelayCommand(CloneSelectedRml, () => SelectedRML != null); @@ -334,6 +342,8 @@ namespace Tango.MachineStudio.RML.ViewModels LiquidTypesRmls = LiquidTypesRmls, }; + _rmlBeforeSave = RmlDTO.FromObservable(ActiveRML); + View.NavigateTo(RmlNavigationView.RmlView); InvalidateRelayCommands(); @@ -423,6 +433,9 @@ namespace Tango.MachineStudio.RML.ViewModels _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]); _active_context.Rmls.Add(rml); await _active_context.SaveChangesAsync(); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, rml.Name, rml, "Rml created using Machine Studio."); + LoadActiveRML(rml.Guid); IsFree = true; @@ -441,6 +454,9 @@ namespace Tango.MachineStudio.RML.ViewModels try { await SelectedRML.DeleteCascadeAsync(_rmls_context); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlDeleted, _authentication.CurrentUser, SelectedRML.Name, SelectedRML, "RML deleted from Machine Studio."); + LoadRmls(); } catch (Exception ex) @@ -504,6 +520,8 @@ namespace Tango.MachineStudio.RML.ViewModels context.Rmls.Add(cloned); await context.SaveChangesAsync(); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, cloned.Name, cloned, "RML cloned from Machine Studio."); } LoadRmls(); @@ -665,7 +683,13 @@ namespace Tango.MachineStudio.RML.ViewModels } } + var rmlAfter = RmlDTO.FromObservable(ActiveRML); + await _active_context.SaveChangesAsync(); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlSaved, _authentication.CurrentUser, _rmlBeforeSave.Name, _rmlBeforeSave, rmlAfter, "RML saved using Machine Studio."); + + _rmlBeforeSave = rmlAfter; } } catch (Exception ex) @@ -804,6 +828,8 @@ namespace Tango.MachineStudio.RML.ViewModels var rmlFile = await Rml.FromRmlFile(db, json); db.Rmls.Add(rmlFile); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlImported, _authentication.CurrentUser, rmlFile.Name, rmlFile, "RML imported from Machine Studio."); } await db.SaveChangesAsync(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/MainViewVM.cs index 486c8b46f..bcbcb6d16 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/MainViewVM.cs @@ -5,10 +5,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL; +using Tango.BL.ActionLogs; using Tango.BL.Entities; using Tango.Core.Commands; using Tango.Core.Threading; using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Sites.Contracts; using Tango.MachineStudio.Sites.Models; @@ -19,6 +21,8 @@ namespace Tango.MachineStudio.Sites.ViewModels { private ObservablesContext _db; private INotificationProvider _notification; + private IAuthenticationProvider _authentication; + private IActionLogManager _actionLogManager; private ActionTimer _filter_timer; private List _sites; @@ -57,9 +61,11 @@ namespace Tango.MachineStudio.Sites.ViewModels public RelayCommand BackToSitesCommand { get; set; } - public MainViewVM(INotificationProvider notificationProvider) + public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { _notification = notificationProvider; + _authentication = authentication; + _actionLogManager = actionLogManager; _filter_timer = new ActionTimer(TimeSpan.FromMilliseconds(500)); ManageSiteCommand = new RelayCommand(() => LoadSelectedSite(), () => SelectedSite != null); @@ -82,6 +88,7 @@ namespace Tango.MachineStudio.Sites.ViewModels var site = _db.Sites.SingleOrDefault(x => x.Guid == SelectedSite.Guid); site.Delete(_db); _db.SaveChanges(); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.SiteDeleted, _authentication.CurrentUser, site.Name, site, "Site deleted using Machine Studio."); Sites.Remove(SelectedSite); LoadSites(); }); @@ -110,7 +117,7 @@ namespace Tango.MachineStudio.Sites.ViewModels IsFree = false; SiteDetailsViewVM = new SiteDetailsViewVM(); SiteDetailsViewVM.Saved += SiteDetailsViewVM_Saved; - await SiteDetailsViewVM.Init(SelectedSite?.Guid, _notification, true, name); + await SiteDetailsViewVM.Init(SelectedSite?.Guid, _notification, _authentication, _actionLogManager, true, name); View.NavigateTo(SitesNavigationView.SiteDetailsView); } } @@ -134,7 +141,7 @@ namespace Tango.MachineStudio.Sites.ViewModels IsFree = false; SiteDetailsViewVM = new SiteDetailsViewVM(); SiteDetailsViewVM.Saved += SiteDetailsViewVM_Saved; - await SiteDetailsViewVM.Init(SelectedSite.Guid, _notification, false); + await SiteDetailsViewVM.Init(SelectedSite.Guid, _notification, _authentication, _actionLogManager, false); View.NavigateTo(SitesNavigationView.SiteDetailsView); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs index 0e4dcbb47..73d4c49cb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs @@ -10,6 +10,9 @@ using Tango.SharedUI; using Tango.SharedUI.Components; using System.Data.Entity; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.Authentication; +using Tango.BL.ActionLogs; +using Tango.BL.DTO; namespace Tango.MachineStudio.Sites.ViewModels { @@ -17,6 +20,10 @@ namespace Tango.MachineStudio.Sites.ViewModels { private ObservablesContext _db; private INotificationProvider _notification; + private IAuthenticationProvider _authentication; + private IActionLogManager _actionLogManager; + private bool _isNew; + private SiteDTO _siteBeforeSave; public event EventHandler Saved; @@ -69,9 +76,11 @@ namespace Tango.MachineStudio.Sites.ViewModels SaveCommand = new RelayCommand(Save, () => IsFree); } - public async Task Init(String siteGuid, INotificationProvider notification, bool isNew, string newSiteName = null) + public async Task Init(String siteGuid, INotificationProvider notification, IAuthenticationProvider authentication, IActionLogManager actionLogManager, bool isNew, string newSiteName = null) { _notification = notification; + _authentication = authentication; + _actionLogManager = actionLogManager; _db = ObservablesContext.CreateDefault(); Organizations = await _db.Organizations.ToListAsync(); @@ -82,9 +91,12 @@ namespace Tango.MachineStudio.Sites.ViewModels Site.Name = newSiteName; Site.Description = "My site description"; _db.Sites.Add(Site); + + _isNew = true; } else { + _isNew = false; Site = await _db.Sites.SingleOrDefaultAsync(x => x.Guid == siteGuid); } @@ -100,6 +112,8 @@ namespace Tango.MachineStudio.Sites.ViewModels Catalogs = new SelectedObjectCollection(catalogs.ToObservableCollection(), catalogs.Where(catalog => site_catalogs.Exists(siteCatalog => siteCatalog.CatalogGuid == catalog.Guid)).ToObservableCollection()); SelectedOrganization = Organizations.SingleOrDefault(x => x.Guid == Site.OrganizationGuid); + + _siteBeforeSave = SiteDTO.FromObservable(Site, site_rmls, site_catalogs, SelectedOrganization.Name); } private async void Save() @@ -121,20 +135,38 @@ namespace Tango.MachineStudio.Sites.ViewModels var site_rmls = await _db.SitesRmls.Where(x => x.SiteGuid == Site.Guid).ToListAsync(); var site_catalogs = await _db.SitesCatalogs.Where(x => x.SiteGuid == Site.Guid).ToListAsync(); - _db.SitesRmls.RemoveRange(site_rmls); - _db.SitesCatalogs.RemoveRange(site_catalogs); + //_db.SitesRmls.RemoveRange(site_rmls); + //_db.SitesCatalogs.RemoveRange(site_catalogs); + + //Remove site rmls. + site_rmls.ToList().Where(x => !Rmls.SynchedSource.ToList().Exists(y => y.Guid == x.RmlGuid)).ToList().ForEach(x => _db.SitesRmls.Remove(x)); + site_catalogs.ToList().Where(x => !Catalogs.SynchedSource.ToList().Exists(y => y.Guid == x.CatalogGuid)).ToList().ForEach(x => _db.SitesCatalogs.Remove(x)); - foreach (var selectedRml in Rmls.SynchedSource) + foreach (var selectedRml in Rmls.SynchedSource.Where(x => !site_rmls.Exists(y => y.RmlGuid == x.Guid))) { _db.SitesRmls.Add(new SitesRml() { SiteGuid = Site.Guid, RmlGuid = selectedRml.Guid }); } - foreach (var selectedCatalog in Catalogs.SynchedSource) + foreach (var selectedCatalog in Catalogs.SynchedSource.Where(x => !site_catalogs.Exists(y => y.CatalogGuid == x.Guid))) { _db.SitesCatalogs.Add(new SitesCatalog() { SiteGuid = Site.Guid, CatalogGuid = selectedCatalog.Guid }); } await _db.SaveChangesAsync(); + + var final_site_rmls = _db.SitesRmls.ToList(); + var final_site_catalogs = _db.SitesCatalogs.ToList(); + + if (_isNew) + { + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.SiteCreated, _authentication.CurrentUser, Site.Name, Site, "Site created using Machine Studio."); + } + else + { + SiteDTO siteAfter = SiteDTO.FromObservable(Site, final_site_rmls, final_site_catalogs, SelectedOrganization.Name); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.SiteSaved, _authentication.CurrentUser, _siteBeforeSave.Name, _siteBeforeSave, siteAfter, "Site saved using Machine Studio."); + _siteBeforeSave = siteAfter; + } } _db.Dispose(); Saved?.Invoke(this, new EventArgs()); diff --git a/Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs index 43d24848b..b5dc8e264 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs @@ -4,11 +4,21 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class CatDTO : CatDTOBase { + [ObservableDTOProperty(MapsTo = nameof(Cat.LiquidType) + "." + nameof(Cat.LiquidType.Name))] + public String LiquidTypeName { get; set; } + [ObservableDTOProperty(MapsTo = nameof(Cat.Rml) + "." + nameof(Cat.Rml.Name))] + public String RmlName { get; set; } + + protected override string OnGetActionLogName() + { + return $"'{RmlName}' => '{LiquidTypeName}' Calibration"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs index 605a905db..75049fa88 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { @@ -11,9 +12,29 @@ namespace Tango.BL.DTO { public List IdsPacks { get; set; } + [ObservableDTOProperty(MapsTo = nameof(Configuration.ApplicationDisplayPanelVersion) + "." + nameof(Configuration.ApplicationDisplayPanelVersion.Name))] + public String ApplicationDisplayPanelVersionName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(Configuration.ApplicationFirmwareVersion) + "." + nameof(Configuration.ApplicationFirmwareVersion.Name))] + public String ApplicationFirmwareVersionName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(Configuration.ApplicationOsVersion) + "." + nameof(Configuration.ApplicationOsVersion.Name))] + public String ApplicationOsVersionName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(Configuration.EmbeddedFirmwareVersion) + "." + nameof(Configuration.EmbeddedFirmwareVersion.Name))] + public String EmbeddedFirmwareVersionName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(Configuration.HardwareVersion) + "." + nameof(Configuration.HardwareVersion.Name))] + public String HardwareVersionName { get; set; } + public ConfigurationDTO() { IdsPacks = new List(); } + + protected override string OnGetActionLogName() + { + return "Configuration"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs index 3ca1e798b..071eb8bdf 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs @@ -4,15 +4,30 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class IdsPackDTO : IdsPackDTOBase { - public CartridgeTypeDTO CartridgeType { get; set; } - public IdsPackFormulaDTO IdsPackFormula { get; set; } - public LiquidTypeDTO LiquidType { get; set; } - public MidTankTypeDTO MidTankType { get; set; } - public DispenserDTO Dispenser { get; set; } + [ObservableDTOProperty(MapsTo = nameof(IdsPack.CartridgeType) + "." + nameof(IdsPack.CartridgeType.Name))] + public String CartridgeTypeName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(IdsPack.IdsPackFormula) + "." + nameof(IdsPack.IdsPackFormula.Name))] + public String IdsPackFormulaName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(IdsPack.LiquidType) + "." + nameof(IdsPack.LiquidType.Name))] + public String LiquidTypeName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(IdsPack.MidTankType) + "." + nameof(IdsPack.MidTankType.Name))] + public String MidTankTypeName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(IdsPack.Dispenser) + "." + nameof(IdsPack.Dispenser.SerialNumber))] + public String DispenserSerialNumber { get; set; } + + protected override string OnGetActionLogName() + { + return $"IDS Pack '{PackIndex}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs index 41eca6693..43535074d 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs @@ -9,6 +9,22 @@ namespace Tango.BL.DTO { public class MachineDTO : MachineDTOBase { + public ConfigurationDTO Configuration { get; set; } + //This is a bit more complicated to support. + //public List Cats { get; set; } + + public List Spools { get; set; } + + public MachineDTO() + { + //Cats = new List(); + Spools = new List(); + } + + protected override string OnGetActionLogName() + { + return $"Machine '{SerialNumber}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs index a221a760c..8931a4b3e 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { @@ -13,6 +14,9 @@ namespace Tango.BL.DTO public List LiquidTypesRmls { get; set; } + [ObservableDTOProperty(MapsTo = nameof(Rml.Cct) + "." + nameof(Rml.Cct.FileName))] + public String CctFileName { get; set; } + public RmlDTO() { ProcessParametersTablesGroups = new List(); diff --git a/Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs index 320de2763..2ba9ca693 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs @@ -4,11 +4,36 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class SiteDTO : SiteDTOBase { + public List SiteRmls { get; set; } + public List SiteCatalogs { get; set; } + + public String OrganizationName { get; set; } + + public SiteDTO() + { + SiteRmls = new List(); + SiteCatalogs = new List(); + } + + public static SiteDTO FromObservable(Site observable, IEnumerable siteRmls, IEnumerable siteCatalogs, String organizationName) + { + SiteDTO dto = FromObservable(observable); + dto.OrganizationName = organizationName; + dto.SiteRmls = siteRmls.Select(x => SitesRmlDTO.FromObservable(x)).ToList(); + dto.SiteCatalogs = siteCatalogs.Select(x => SitesCatalogDTO.FromObservable(x)).ToList(); + return dto; + } + + protected override string OnGetActionLogName() + { + return $"Site '{Name}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs index 527d710d0..0a5089072 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs @@ -4,11 +4,15 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class SitesRmlDTO : SitesRmlDTOBase { - + protected override string OnGetActionLogName() + { + return $"RML '{RmlGuid}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs index bf25d1e71..d6d79b1be 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs @@ -4,11 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class SpoolDTO : SpoolDTOBase { + [ObservableDTOProperty(MapsTo = nameof(Spool.SpoolType) + "." + nameof(Spool.SpoolType.Name))] + public String SpoolTypeName { get; set; } + protected override string OnGetActionLogName() + { + return $"'{(SpoolTypeName != null ? SpoolTypeName : SpoolTypeGuid)}' Calibration"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/ActionLogType.cs b/Software/Visual_Studio/Tango.BL/Enumerations/ActionLogType.cs index 5114538ef..76c790a9f 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/ActionLogType.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/ActionLogType.cs @@ -34,6 +34,8 @@ namespace Tango.BL.Enumerations HardwareVersionDeleted = 101, [Description("Hardware Version Saved")] HardwareVersionSaved = 102, + [Description("Hardware Version Imported")] + HardwareVersionImported = 103, //RML [Description("RML Created")] @@ -42,6 +44,10 @@ namespace Tango.BL.Enumerations RmlDeleted = 201, [Description("RML Saved")] RmlSaved = 202, + [Description("RML Imported")] + RmlImported = 203, + [Description("RML Active Process Parameters Changed")] + RmlActiveProcessParametersChanged = 204, //Jobs [Description("Job Created")] diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 10a732221..ade8f88bc 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -160,6 +160,8 @@ namespace Tango.MachineService.Controllers tangoUpdate.UpdateStatus = TangoUpdateStatuses.SetupStarted; db.TangoUpdates.Add(tangoUpdate); + machine.ProductionDate = DateTime.UtcNow; + db.SaveChanges(); _pendingUpdates.Add(new PPCPendingUpdate() -- cgit v1.3.1