From 417b9159f79d8060d3b0056903c0a4907fa877cb Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 20 Jan 2021 01:12:24 +0200 Subject: Light Inks Display Improvements. --- .../Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml | 5 +++-- .../Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml index b13ffb87b..9253ac440 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml @@ -134,7 +134,7 @@ - + 1 2 3 @@ -143,6 +143,7 @@ 6 7 8 + 9 @@ -155,7 +156,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml index f72344905..fadb9ece0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -69,7 +69,7 @@ - + 1 2 3 @@ -78,6 +78,7 @@ 6 7 8 + 9 @@ -91,7 +92,7 @@ - + -- cgit v1.3.1 From 84de71b6eaccb99c99f0a874a0eb076fe067c692 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 20 Jan 2021 03:17:07 +0200 Subject: "Light Inks Installed" & "Use Light Inks When Possible" --- .../Views/MachineSettingsView.xaml | 4 +- .../Tango.PPC.MachineSettings.csproj | 6 +- .../ViewModels/MainViewVM.cs | 16 ++ .../Tango.PPC.MachineSettings/Views/MainView.xaml | 2 + .../Dialogs/CleanerDispensingViewVM.cs | 11 +- .../Visual_Studio/Tango.BL/DTO/MachineDTOBase.cs | 8 + .../Visual_Studio/Tango.BL/Entities/MachineBase.cs | 38 +++++ .../ColorConversionSettings.cs | 19 +++ .../Tango.ColorConversion/DefaultColorConverter.cs | 15 +- .../Tango.ColorConversion/IColorConverter.cs | 4 +- .../Tango.ColorConversion.csproj | 5 + .../Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 3 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 168 ++++++++++----------- .../Configurations/ProvisionMachine.xml | Bin 76348 -> 77024 bytes .../SQLExaminer/Configurations/UpdateMachine.xml | Bin 77930 -> 78606 bytes 16 files changed, 204 insertions(+), 96 deletions(-) create mode 100644 Software/Visual_Studio/Tango.ColorConversion/ColorConversionSettings.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml index 76517ec37..9b50de49c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml @@ -109,8 +109,8 @@ Force Version Update - Update Schema on Update - + Light Inks Installed + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj index 00cc18382..d6bacb50c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj @@ -112,6 +112,10 @@ {f441feee-322a-4943-b566-110e12fd3b72} Tango.BL + + {b4fe6485-4161-4b36-bc08-67e0b53d01b7} + Tango.ColorConversion + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core @@ -166,7 +170,7 @@ - + \ No newline at end of file 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 523934985..1565cda5a 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 @@ -12,6 +12,7 @@ using Tango.BL; using Tango.BL.Builders; using Tango.BL.Entities; using Tango.BL.Enumerations; +using Tango.ColorConversion; using Tango.Core.Commands; using Tango.Core.DI; using Tango.Core.ExtensionMethods; @@ -22,6 +23,7 @@ using Tango.PPC.Common.Lubrication; using Tango.PPC.Common.Messages; using Tango.PPC.Common.OS; using Tango.PPC.Common.UWF; +using Tango.Settings; using Tango.SharedUI.Components; using Tango.WiFi; @@ -234,6 +236,14 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _selectedLubricationLevel = value; RaisePropertyChangedAuto(); } } + private bool _useLightInks; + public bool UseLightInks + { + get { return _useLightInks; } + set { _useLightInks = value; RaisePropertyChangedAuto(); } + } + + #endregion #region Commands @@ -292,6 +302,9 @@ namespace Tango.PPC.MachineSettings.ViewModels MachineDataSynchronizer.IsEnabled = SynchronizeJobs || SynchronizeDiagnostics; + var colorConversionSettings = SettingsManager.Default.GetOrCreate(); + colorConversionSettings.UseLightInks = UseLightInks; + Settings.Save(); await MachineProvider.SaveMachine(); @@ -422,6 +435,9 @@ namespace Tango.PPC.MachineSettings.ViewModels AutoCheckForUpdates = Settings.AutoCheckForUpdates; + var colorConversionSettings = SettingsManager.Default.GetOrCreate(); + UseLightInks = colorConversionSettings.UseLightInks; + SelectedTimeZone = TimeZones.SingleOrDefault(x => x.StandardName == TimeZone.CurrentTimeZone.StandardName); _previousTimeZone = SelectedTimeZone; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index e69c57753..b3056c36e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -160,6 +160,8 @@ Default Segment Length + Use Light Inks When Possible + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs index e37be417f..d1a02a940 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs @@ -78,7 +78,16 @@ namespace Tango.PPC.Maintenance.Dialogs Status = "Dispensing cleaner liquid..."; - var cleanerPack = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.FirstOrDefault(x => x.LiquidType.Type == BL.Enumerations.LiquidTypes.Cleaner); + IdsPack cleanerPack = null; + + if (MachineProvider.Machine.LightInksInstalled) + { + cleanerPack = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.FirstOrDefault(x => x.LiquidType.Type == BL.Enumerations.LiquidTypes.TransparentInk); + } + else + { + cleanerPack = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.FirstOrDefault(x => x.LiquidType.Type == BL.Enumerations.LiquidTypes.Cleaner); + } if (cleanerPack == null) { diff --git a/Software/Visual_Studio/Tango.BL/DTO/MachineDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/MachineDTOBase.cs index f88f164cd..c35052204 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/MachineDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/MachineDTOBase.cs @@ -277,5 +277,13 @@ namespace Tango.BL.DTO get; set; } + /// + /// light inks installed + /// + public Boolean LightInksInstalled + { + get; set; + } + } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachineBase.cs b/Software/Visual_Studio/Tango.BL/Entities/MachineBase.cs index cbfd43789..b3d910082 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachineBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachineBase.cs @@ -75,6 +75,8 @@ namespace Tango.BL.Entities public event EventHandler ActivationKeyChanged; + public event EventHandler LightInksInstalledChanged; + public event EventHandler> CatsChanged; public event EventHandler ConfigurationChanged; @@ -942,6 +944,33 @@ namespace Tango.BL.Entities } } + protected Boolean _lightinksinstalled; + + /// + /// Gets or sets the machinebase light inks installed. + /// + + [Column("LIGHT_INKS_INSTALLED")] + + public Boolean LightInksInstalled + { + get + { + return _lightinksinstalled; + } + + set + { + if (_lightinksinstalled != value) + { + _lightinksinstalled = value; + + OnLightInksInstalledChanged(value); + + } + } + } + protected SynchronizedObservableCollection _cats; /// @@ -1379,6 +1408,15 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(ActivationKey)); } + /// + /// Called when the LightInksInstalled has changed. + /// + protected virtual void OnLightInksInstalledChanged(Boolean lightinksinstalled) + { + LightInksInstalledChanged?.Invoke(this, lightinksinstalled); + RaisePropertyChanged(nameof(LightInksInstalled)); + } + /// /// Called when the Cats has changed. /// diff --git a/Software/Visual_Studio/Tango.ColorConversion/ColorConversionSettings.cs b/Software/Visual_Studio/Tango.ColorConversion/ColorConversionSettings.cs new file mode 100644 index 000000000..4fd29ebe9 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorConversion/ColorConversionSettings.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.ColorConversion +{ + public class ColorConversionSettings : SettingsBase + { + public bool UseLightInks { get; set; } + + public ColorConversionSettings() + { + UseLightInks = true; + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs index b0dc2e80f..efa198577 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs @@ -15,6 +15,7 @@ using System.Diagnostics; using Tango.Logging; using System.IO; using Tango.Core.Helpers; +using Tango.Settings; namespace Tango.ColorConversion { @@ -64,7 +65,7 @@ namespace Tango.ColorConversion return output; } - public ConversionOutput Convert(BrushStop stop, Configuration configuration, Rml rml, bool generateHive) + public ConversionOutput Convert(BrushStop stop, Configuration configuration, Rml rml, bool generateHive, bool lightInksInstalled) { if (stop == null) { @@ -128,7 +129,9 @@ namespace Tango.ColorConversion conversionInput.ThreadA = rml.WhitePointA; conversionInput.ThreadB = rml.WhitePointB; - conversionInput.UseLightInks = rml.UseLightInks; + var settings = SettingsManager.Default.GetOrCreate(); + + conversionInput.UseLightInks = rml.UseLightInks && lightInksInstalled && settings.UseLightInks; conversionInput.ForwardData = ByteString.CopyFrom(rml.Cct.Data); @@ -192,7 +195,7 @@ namespace Tango.ColorConversion throw new ArgumentNullException("The specified brush stop is associated with a job that is not a part of any machine or the machine does not have any configuration."); } - return Convert(stop, stop.Segment.Job.Machine.Configuration, stop.Segment.Job.Rml, generateHive); + return Convert(stop, stop.Segment.Job.Machine.Configuration, stop.Segment.Job.Rml, generateHive, stop.Segment.Job.Machine.LightInksInstalled); } public ConversionOutput Convert(Job job, Color color, bool generateHive) @@ -219,7 +222,7 @@ namespace Tango.ColorConversion }; stop.Color = color; - return Convert(stop, job.Machine.Configuration, job.Rml, generateHive); + return Convert(stop, job.Machine.Configuration, job.Rml, generateHive, job.Machine.LightInksInstalled); } public bool IsOutOfGamut(BrushStop stop) @@ -321,11 +324,11 @@ namespace Tango.ColorConversion return processParameters; } - public Task ConvertAsync(BrushStop stop, Configuration configuration, Rml rml, bool generateHive) + public Task ConvertAsync(BrushStop stop, Configuration configuration, Rml rml, bool generateHive, bool lightInksInstalled) { return Task.Factory.StartNew(() => { - return Convert(stop, configuration, rml, generateHive); + return Convert(stop, configuration, rml, generateHive, lightInksInstalled); }); } diff --git a/Software/Visual_Studio/Tango.ColorConversion/IColorConverter.cs b/Software/Visual_Studio/Tango.ColorConversion/IColorConverter.cs index aa0ff2ab9..0a8b01f80 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/IColorConverter.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/IColorConverter.cs @@ -15,10 +15,10 @@ namespace Tango.ColorConversion public interface IColorConverter { ConversionOutput Convert(ConversionInput conversionInput, int version); - ConversionOutput Convert(BrushStop stop, Configuration configuration, Rml rml, bool generateHive); + ConversionOutput Convert(BrushStop stop, Configuration configuration, Rml rml, bool generateHive, bool lightInksInstalled); ConversionOutput Convert(BrushStop stop, bool generateHive); ConversionOutput Convert(Job job, Color color, bool generateHive); - Task ConvertAsync(BrushStop stop, Configuration configuration, Rml rml, bool generateHive); + Task ConvertAsync(BrushStop stop, Configuration configuration, Rml rml, bool generateHive, bool lightInksInstalled); Task ConvertAsync(BrushStop stop, bool generateHive); Task ConvertAsync(Job job, Color color, bool generateHive); bool IsOutOfGamut(BrushStop stop); diff --git a/Software/Visual_Studio/Tango.ColorConversion/Tango.ColorConversion.csproj b/Software/Visual_Studio/Tango.ColorConversion/Tango.ColorConversion.csproj index 182de5d30..40d16e599 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/Tango.ColorConversion.csproj +++ b/Software/Visual_Studio/Tango.ColorConversion/Tango.ColorConversion.csproj @@ -48,6 +48,7 @@ GlobalVersionInfo.cs + @@ -75,6 +76,10 @@ {e4927038-348d-4295-aaf4-861c58cb3943} Tango.PMR + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs index 14fe4f04e..b5958b2f2 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs @@ -59,6 +59,7 @@ namespace Tango.DAL.Remote.DB public string DEVICE_NAME { get; set; } public int HEAD_TYPE { get; set; } public string ACTIVATION_KEY { get; set; } + public bool LIGHT_INKS_INSTALLED { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection CATS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 7e88c6e5a..a365ae5b8 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -822,6 +822,7 @@ + @@ -4300,6 +4301,7 @@ + @@ -6875,6 +6877,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 883676327..31eb5296d 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,90 +5,90 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml index f3b845010..9dcc4a159 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml differ diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml index b70bc1ff4..03e41b4fb 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml differ -- cgit v1.3.1 From 60dae81ccd16a1bd4f5af3b2c5b561e201ec97da Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 28 Jan 2021 20:40:01 +0200 Subject: Added support for light inks cleaner 10' ids pack ! --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../FSE/Tango.FSE.Common/Controls/MachineView.xaml | 5 +- .../ViewModels/MainViewVM.cs | 4 +- .../Views/ConfigurationView.xaml | 5 +- .../Views/MachineView.xaml | 5 +- .../Dialogs/CleanerDispensingViewVM.cs | 11 +- .../Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs | 16 +++ .../Tango.BL/Entities/BrushStopBase.cs | 76 ++++++++++ .../Tango.DAL.Remote/DB/BRUSH_STOPS.cs | 2 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 6 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 158 ++++++++++----------- .../Tango.Emulations/Emulators/MachineEmulator.cs | 2 +- 15 files changed, 192 insertions(+), 98 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index b4ea2b8a2..10a4a8923 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 a1f2ace90..987d86d8b 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index e2aef1aa6..ac0c70c0d 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 a4af854e7..04aad2339 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml index 920795f43..c82b5b460 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml @@ -53,7 +53,7 @@ --> - + 1 2 3 @@ -63,6 +63,7 @@ 7 8 9 + 10 @@ -76,7 +77,7 @@ - + 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 ea9470bb1..3aab57481 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 @@ -263,7 +263,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels _machines_action_timer = new ActionTimer(TimeSpan.FromMilliseconds(200)); _dispensers_action_timer = new ActionTimer(TimeSpan.FromMilliseconds(200)); - AddIdsCommand = new RelayCommand(AddIds, (x) => ActiveMachine != null && ActiveMachine.Configuration != null && ActiveMachine.Configuration.IdsPacks.Count < 9); + AddIdsCommand = new RelayCommand(AddIds, (x) => ActiveMachine != null && ActiveMachine.Configuration != null && ActiveMachine.Configuration.IdsPacks.Count < 10); RemoveIdsCommand = new RelayCommand(RemoveIds, (x) => SelectedIds != null); EditMachineCommand = new RelayCommand(() => LoadSelectedMachine(), () => SelectedMachine != null); BackToMachinesCommand = new RelayCommand(() => View.NavigateTo(MachineDesignerNavigationView.MachinesView)); @@ -546,7 +546,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels if ((newMachine || clone) && machineCreationDialogVM.GenerateDispensers) { - for (int i = 0; i < 9; i++) + for (int i = 0; i < 10; i++) { var serial = machineCreationDialogVM.SerialNumber + "-" + (i + 1); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml index 9253ac440..dbebd270c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml @@ -134,7 +134,7 @@ - + 1 2 3 @@ -144,6 +144,7 @@ 7 8 9 + 10 @@ -156,7 +157,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml index fadb9ece0..54e47c0d4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -69,7 +69,7 @@ - + 1 2 3 @@ -79,6 +79,7 @@ 7 8 9 + 10 @@ -92,7 +93,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs index d1a02a940..e37be417f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs @@ -78,16 +78,7 @@ namespace Tango.PPC.Maintenance.Dialogs Status = "Dispensing cleaner liquid..."; - IdsPack cleanerPack = null; - - if (MachineProvider.Machine.LightInksInstalled) - { - cleanerPack = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.FirstOrDefault(x => x.LiquidType.Type == BL.Enumerations.LiquidTypes.TransparentInk); - } - else - { - cleanerPack = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.FirstOrDefault(x => x.LiquidType.Type == BL.Enumerations.LiquidTypes.Cleaner); - } + var cleanerPack = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.FirstOrDefault(x => x.LiquidType.Type == BL.Enumerations.LiquidTypes.Cleaner); if (cleanerPack == null) { diff --git a/Software/Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs index a26f54847..4b687488a 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/BrushStopDTOBase.cs @@ -277,6 +277,22 @@ namespace Tango.BL.DTO get; set; } + /// + /// v9 + /// + public Double V9 + { + get; set; + } + + /// + /// v9 div + /// + public Int32 V9Div + { + get; set; + } + /// /// corrected /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs index a752651e2..aa602bc77 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs @@ -87,6 +87,10 @@ namespace Tango.BL.Entities public event EventHandler V8DivChanged; + public event EventHandler V9Changed; + + public event EventHandler V9DivChanged; + public event EventHandler CorrectedChanged; public event EventHandler IsTransparentChanged; @@ -961,6 +965,60 @@ namespace Tango.BL.Entities } } + protected Double _v9; + + /// + /// Gets or sets the brushstopbase v9. + /// + + [Column("V9")] + + public Double V9 + { + get + { + return _v9; + } + + set + { + if (_v9 != value) + { + _v9 = value; + + OnV9Changed(value); + + } + } + } + + protected Int32 _v9div; + + /// + /// Gets or sets the brushstopbase v9 div. + /// + + [Column("V9_DIV")] + + public Int32 V9Div + { + get + { + return _v9div; + } + + set + { + if (_v9div != value) + { + _v9div = value; + + OnV9DivChanged(value); + + } + } + } + protected Boolean _corrected; /// @@ -1465,6 +1523,24 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(V8Div)); } + /// + /// Called when the V9 has changed. + /// + protected virtual void OnV9Changed(Double v9) + { + V9Changed?.Invoke(this, v9); + RaisePropertyChanged(nameof(V9)); + } + + /// + /// Called when the V9Div has changed. + /// + protected virtual void OnV9DivChanged(Int32 v9div) + { + V9DivChanged?.Invoke(this, v9div); + RaisePropertyChanged(nameof(V9Div)); + } + /// /// Called when the Corrected has changed. /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs index d8f7776c6..34384cb8f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs @@ -49,6 +49,8 @@ namespace Tango.DAL.Remote.DB public int V7_DIV { get; set; } public double V8 { get; set; } public int V8_DIV { get; set; } + public double V9 { get; set; } + public int V9_DIV { get; set; } public bool CORRECTED { get; set; } public string COLOR_CATALOG_GUID { get; set; } public string COLOR_CATALOGS_ITEM_GUID { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 1f8eb6454..b12a9f2c0 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -103,6 +103,8 @@ + + @@ -3487,6 +3489,8 @@ + + @@ -6119,6 +6123,8 @@ + + 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 be7e5f5e5..3c5a48489 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,90 +5,90 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 5e56191da..ca8bacaa4 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -158,7 +158,7 @@ namespace Tango.Emulations.Emulators MachineStatus = new MachineStatus(); MachineStatus.State = MachineState.Ready; - for (int i = 0; i < 9; i++) + for (int i = 0; i < 10; i++) { MachineStatus.IDSPacksLevels.Add(new IDSPackLevel() { -- cgit v1.3.1 From 7219d145b82c9c4e9aaeac34a0bc1198bfe65974 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 13 Feb 2021 15:27:22 +0200 Subject: Machine creation improvements for light inks. --- .../ViewModels/MainViewVM.cs | 28 ++++++++++++++++++++-- .../Views/ConfigurationView.xaml | 1 + .../Views/MachineCreationDialog.xaml | 6 ++--- 3 files changed, 30 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views') 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 3aab57481..dc29515c8 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 @@ -577,7 +577,19 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels if (newMachine) { dispenser.NlPerPulse = machineCreationDialogVM.DispenserFactor; - dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.First().Guid; + + if (i == 8) + { + dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.LubricantDispenser.ToInt32()).Guid; + } + else if (i == 9) + { + dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.CleanerDispenser.ToInt32()).Guid; + } + else + { + dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.StandardDispenser.ToInt32()).Guid; + } } else { @@ -586,7 +598,19 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels if (packBefore != null) { dispenser.NlPerPulse = packBefore.Dispenser.NlPerPulse; - dispenser.DispenserTypeGuid = packBefore.Dispenser.DispenserType.Guid; + + if (i == 8) + { + dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.LubricantDispenser.ToInt32()).Guid; + } + else if (i == 9) + { + dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.CleanerDispenser.ToInt32()).Guid; + } + else + { + dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.StandardDispenser.ToInt32()).Guid; + } } else { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml index dbebd270c..03043d04e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml @@ -441,6 +441,7 @@ + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml index 0640b846e..41e0fa685 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml @@ -63,10 +63,10 @@ Name - + - Automatically generate 8 dispensers for this machine - (-1-8) + Automatically generate 10 dispensers for this machine + (-1-10) -- cgit v1.3.1 From 29ffa937475d82d2c32cbccfb97c2f5f7c8f24cd Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 15 Feb 2021 04:26:39 +0200 Subject: Implemented MS machine prototypes. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../ViewModels/MachineCreationDialogVM.cs | 23 +-- .../ViewModels/MainViewVM.cs | 155 ++++----------------- .../Views/MachineCreationDialog.xaml | 16 +-- .../Tango.BL/Entities/MachinePrototype.cs | 103 +++++++++++++- .../Tango.BL/Entities/MachineVersion.cs | 85 ----------- 7 files changed, 132 insertions(+), 250 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 95714e5c0..45f004182 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 47eb3901b..5035ba95d 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.MachineDesigner/ViewModels/MachineCreationDialogVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs index 4584d3508..340f92edd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs @@ -10,9 +10,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { public class MachineCreationDialogVM : DialogViewVM { - public List MachineVersions { get; set; } + public List Prototypes { get; set; } - public MachineVersion SelectedMachineVersion { get; set; } + public MachinePrototype SelectedPrototype { get; set; } private bool _isNewMachine; public bool IsNewMachine @@ -35,25 +35,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels set { _name = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } - private bool _generateDispensers; - public bool GenerateDispensers - { - get { return _generateDispensers; } - set { _generateDispensers = value; RaisePropertyChangedAuto(); } - } - - private double _dispenserFactor; - public double DispenserFactor - { - get { return _dispenserFactor; } - set { _dispenserFactor = value; RaisePropertyChangedAuto(); } - } - - public MachineCreationDialogVM() : base() - { - DispenserFactor = 2.34; - } - protected override bool CanOK() { return base.CanOK() && !String.IsNullOrWhiteSpace(SerialNumber) && !String.IsNullOrWhiteSpace(Name); 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 dc29515c8..6ddf86ddb 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 @@ -287,7 +287,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public override async void OnApplicationReady() { MachinesAdapter.MachineVersions = (await MachinesAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection(); - + MachinesAdapter.MachinePrototypes = (await MachinesAdapter.Context.MachinePrototypes.ToListAsync()).ToObservableCollection(); } #endregion @@ -513,7 +513,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { IsNewMachine = true; - if (machineCreationDialogVM.SelectedMachineVersion == null) + if (machineCreationDialogVM.SelectedPrototype == null) { ActiveMachine = new Machine(); ActiveMachine.Configuration = new Configuration(); @@ -526,9 +526,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels try { initHwConfig = false; - ActiveMachine = await machineCreationDialogVM.SelectedMachineVersion.CreatePrototypeMachine(ActiveMachineAdapter.Context); - ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber; - ActiveMachine.Name = machineCreationDialogVM.Name; + ActiveMachine = machineCreationDialogVM.SelectedPrototype.CreateMachine(machineCreationDialogVM.SerialNumber, machineCreationDialogVM.Name); + ActiveMachine.MachineVersion = ActiveMachineAdapter.MachineVersions.FirstOrDefault(x => x.Guid == ActiveMachine.MachineVersionGuid); ActiveMachineAdapter.Context.Machines.Add(ActiveMachine); HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification); @@ -537,105 +536,13 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } catch (Exception ex) { - _notification.ShowError($"Invalid machine version prototype.\n{ex.FlattenMessage()}"); + _notification.ShowError($"Invalid machine prototype.\n{ex.FlattenMessage()}"); View.NavigateTo(MachineDesignerNavigationView.MachinesView); return; } } } - if ((newMachine || clone) && machineCreationDialogVM.GenerateDispensers) - { - for (int i = 0; i < 10; i++) - { - var serial = machineCreationDialogVM.SerialNumber + "-" + (i + 1); - - var existingDispenser = await ActiveMachineAdapter.Context.Dispensers.Include(x => x.IdsPacks).SingleOrDefaultAsync(x => x.SerialNumber == serial); - - if (existingDispenser != null) - { - if (existingDispenser.IsInstalled) - { - _notification.ShowError($"Dispenser '{serial}' already exists. Cannot create machine."); - return; - } - else - { - if (!_notification.ShowErrorQuestion($"Dispenser '{serial}' already exists and is not installed. Do you wish to assign the existing dispenser to this machine?")) - { - return; - } - } - } - - Dispenser dispenser = new Dispenser(); - - if (existingDispenser == null) - { - dispenser.SerialNumber = serial; - - if (newMachine) - { - dispenser.NlPerPulse = machineCreationDialogVM.DispenserFactor; - - if (i == 8) - { - dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.LubricantDispenser.ToInt32()).Guid; - } - else if (i == 9) - { - dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.CleanerDispenser.ToInt32()).Guid; - } - else - { - dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.StandardDispenser.ToInt32()).Guid; - } - } - else - { - var packBefore = machineConfigBeforeClone.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i); - - if (packBefore != null) - { - dispenser.NlPerPulse = packBefore.Dispenser.NlPerPulse; - - if (i == 8) - { - dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.LubricantDispenser.ToInt32()).Guid; - } - else if (i == 9) - { - dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.CleanerDispenser.ToInt32()).Guid; - } - else - { - dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.FirstOrDefault(x => x.Code == BL.Enumerations.DispenserTypes.StandardDispenser.ToInt32()).Guid; - } - } - else - { - continue; - } - } - - dispenser.ProductionDate = DateTime.UtcNow; - - ActiveMachineAdapter.Context.Dispensers.Add(dispenser); - } - else - { - dispenser = existingDispenser; - } - - var idsPack = ActiveMachine.Configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i); - - if (idsPack != null) - { - idsPack.Dispenser = dispenser; - idsPack.DispenserGuid = dispenser.Guid; - } - } - } ActiveMachine.OrganizationChanged -= ActiveMachine_OrganizationChanged; ActiveMachine.OrganizationChanged += ActiveMachine_OrganizationChanged; @@ -888,7 +795,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { MachineCreationDialogVM vm = new MachineCreationDialogVM(); vm.IsNewMachine = true; - vm.MachineVersions = MachinesAdapter.MachineVersions.ToList(); + vm.Prototypes = MachinesAdapter.MachinePrototypes.ToList(); _notification.ShowModalDialog(vm, (x) => { if (MachinesAdapter.Context.Machines.Any(y => y.SerialNumber == vm.SerialNumber || y.Name.ToLower() == vm.Name.ToLower())) @@ -897,12 +804,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels return; } - if (vm.SelectedMachineVersion != null && String.IsNullOrWhiteSpace(vm.SelectedMachineVersion.PrototypeMachineData)) - { - _notification.ShowError("The selected version does not contain any prototype machine data."); - return; - } - LoadSelectedMachine(true, false, vm); }, () => { }); } @@ -946,36 +847,32 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels private async void MakePrototype() { - if (ActiveMachine.MachineVersion == null) - { - _notification.ShowError("Machine version must be selected in order to make a prototype."); - return; - } + String protoName = _notification.ShowTextInput("Enter prototype name", "name"); - if (_notification.ShowQuestion($"Are you sure you wish to make this machine configuration as a prototype for version '{ActiveMachine.MachineVersion.Name}' ?")) + if (!protoName.IsNotNullOrWhiteSpace()) return; + + using (_notification.PushTaskItem($"Saving machine prototype '{protoName}'...")) { - using (_notification.PushTaskItem($"Making prototype machine for '{ActiveMachine.MachineVersion.Name}'...")) + try { - try - { - IsFree = false; + IsFree = false; - using (var db = ObservablesContext.CreateDefault()) - { - var machineVersion = await db.MachineVersions.SingleOrDefaultAsync(x => x.Guid == ActiveMachine.MachineVersionGuid); - await machineVersion.ApplyPrototypeMachine(ActiveMachine, db); - await db.SaveChangesAsync(); - } - } - catch (Exception ex) - { - _notification.ShowError($"Error making machine version prototype\n{ex.FlattenMessage()}"); - } - finally + using (var db = ObservablesContext.CreateDefault()) { - IsFree = true; + MachinePrototype prototype = MachinePrototype.CreateNew(ActiveMachine, protoName, protoName); + db.MachinePrototypes.Add(prototype); + await db.SaveChangesAsync(); + MachinesAdapter.MachinePrototypes = (await MachinesAdapter.Context.MachinePrototypes.ToListAsync()).ToObservableCollection(); } } + catch (Exception ex) + { + _notification.ShowError($"Error creating machine prototype\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } } } @@ -985,7 +882,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { MachineCreationDialogVM vm = new MachineCreationDialogVM(); vm.IsNewMachine = false; - vm.MachineVersions = MachinesAdapter.MachineVersions.ToList(); + vm.Prototypes = MachinesAdapter.MachinePrototypes.ToList(); _notification.ShowModalDialog(vm, (x) => { if (MachinesAdapter.Context.Machines.Any(y => y.SerialNumber == vm.SerialNumber || y.Name.ToLower() == vm.Name.ToLower())) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml index 41e0fa685..f69606e29 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml @@ -52,28 +52,16 @@ - Please specify the machine version in order to prototype the new machine with default machine settings and configuration. + Specify a machine prototype to create the new machine with default settings and configuration. - + Serial Number Name - - - - Automatically generate 10 dispensers for this machine - (-1-10) - - - - - Dispenser max nl/cm - - diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachinePrototype.cs b/Software/Visual_Studio/Tango.BL/Entities/MachinePrototype.cs index 58e3c861f..d83572ab6 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachinePrototype.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachinePrototype.cs @@ -20,11 +20,112 @@ using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; using Tango.Core.CustomAttributes; +using System.Threading.Tasks; +using Tango.BL.Builders; +using Tango.BL.Serialization; +using System.Data.Entity; namespace Tango.BL.Entities { - public abstract class MachinePrototype : MachinePrototypeBase + public class MachinePrototype : MachinePrototypeBase { + public void SetPrototypeMachine(Machine machine) + { + PrototypeJson = machine.ToJson(new EntitySerializationStrategy() + .Include(() => machine.Configuration) + .Include(() => new IdsPack().Dispenser) + .Ignore(() => new IdsPack().Dispenser.IdsPacks) + .Ignore(() => machine.Name) + .Ignore(() => machine.MachinesEvents) + .Ignore(() => machine.Configuration.Machines) + .Ignore(() => machine.Jobs) + .Ignore(() => machine.SerialNumber) + .Ignore(() => machine.DefaultRmlGuid) + .Ignore(() => machine.DefaultColorSpaceGuid) + .Ignore(() => machine.DefaultSpoolTypeGuid) + .Ignore(() => machine.LoadedRmlGuid) + .Ignore(() => machine.DeviceId) + .Ignore(() => machine.DeviceName) + .Ignore(() => machine.IsDeviceRegistered) + .Ignore(() => machine.SiteGuid) + .Ignore(() => machine.ActivationKey), + EntitySerializationFlags.IgnoreGuids | EntitySerializationFlags.IgnoreReferenceTypes); + } + + public Machine CreateMachine(String serialNumber, String name) + { + Machine m = new Machine(); + + Machine machine = Machine.FromJson(PrototypeJson, new EntitySerializationStrategy() + .Include(() => m.Configuration) + .Include(() => new IdsPack().Dispenser) + .Ignore(() => m.Name) + .Ignore(() => m.MachinesEvents) + .Ignore(() => m.Configuration.Machines) + .Ignore(() => m.Jobs) + .Ignore(() => m.SerialNumber) + .Ignore(() => m.DefaultRmlGuid) + .Ignore(() => m.DefaultColorSpaceGuid) + .Ignore(() => m.DefaultSpoolTypeGuid) + .Ignore(() => m.LoadedRmlGuid) + .Ignore(() => m.DeviceId) + .Ignore(() => m.DeviceName) + .Ignore(() => m.IsDeviceRegistered) + .Ignore(() => m.SiteGuid) + .Ignore(() => m.ActivationKey), + + EntitySerializationFlags.IgnoreGuids | EntitySerializationFlags.IgnoreReferenceTypes); + + + machine.OrganizationGuid = null; + machine.ConfigurationGuid = null; + machine.ConfigurationGuid = machine.Configuration.Guid; + + + foreach (var cat in machine.Cats) + { + cat.MachineGuid = machine.Guid; + } + + machine.SerialNumber = serialNumber; + machine.Name = name; + machine.ProductionDate = DateTime.UtcNow; + + foreach (var idsPack in machine.Configuration.IdsPacks.OrderBy(x => x.PackIndex)) + { + if (idsPack.Dispenser != null) + { + idsPack.Dispenser.ID = 0; + idsPack.Dispenser.LastUpdated = DateTime.UtcNow; + idsPack.Dispenser.SerialNumber = $"{serialNumber}-{idsPack.PackIndex + 1}"; + idsPack.DispenserGuid = idsPack.Dispenser.Guid; + } + + idsPack.ConfigurationGuid = machine.ConfigurationGuid; + } + + foreach (var spool in machine.Spools) + { + spool.MachineGuid = machine.Guid; + } + + machine.DefaultColorSpaceGuid = null; + machine.DefaultRmlGuid = null; + machine.DefaultSpoolTypeGuid = null; + + return machine; + } + + public static MachinePrototype CreateNew(Machine machine, String name, String description) + { + MachinePrototype prototype = new MachinePrototype(); + prototype.Name = name; + prototype.Description = description; + prototype.LastUpdated = DateTime.UtcNow; + prototype.SetPrototypeMachine(machine); + return prototype; + + } } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs b/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs index 7b90623d8..5832e8a74 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs @@ -11,91 +11,6 @@ namespace Tango.BL.Entities { public partial class MachineVersion : MachineVersionBase { - public async Task ApplyPrototypeMachine(Machine machine, ObservablesContext context) - { - machine = await new MachineBuilder(context) - .Set(machine) - .WithOrganization() - .WithConfiguration() - .WithSpools() - .WithCats() - .BuildAsync(); - - PrototypeMachineData = machine.ToJson(new EntitySerializationStrategy() - .Include(() => machine.Configuration) - .Ignore(() => machine.Name) - .Ignore(() => machine.MachinesEvents) - .Ignore(() => machine.Configuration.Machines) - .Ignore(() => machine.Jobs) - .Ignore(() => machine.SerialNumber) - .Ignore(() => machine.DefaultRmlGuid) - .Ignore(() => machine.DefaultColorSpaceGuid) - .Ignore(() => machine.DefaultSpoolTypeGuid) - .Ignore(() => machine.LoadedRmlGuid) - .Ignore(() => machine.DeviceId) - .Ignore(() => machine.DeviceName) - .Ignore(() => machine.IsDeviceRegistered) - .Ignore(() => machine.SiteGuid), - - EntitySerializationFlags.IgnoreGuids | EntitySerializationFlags.IgnoreReferenceTypes); - } - - public async Task CreatePrototypeMachine(ObservablesContext context) - { - Machine m = new Machine(); - - String protoTypeData = (await context.MachineVersions.SingleOrDefaultAsync(x => x.Guid == Guid)).PrototypeMachineData; - - Machine machine = Machine.FromJson(protoTypeData, new EntitySerializationStrategy() - .Include(() => m.Configuration) - .Ignore(() => m.Name) - .Ignore(() => m.MachinesEvents) - .Ignore(() => m.Configuration.Machines) - .Ignore(() => m.Jobs) - .Ignore(() => m.SerialNumber) - .Ignore(() => m.DefaultRmlGuid) - .Ignore(() => m.DefaultColorSpaceGuid) - .Ignore(() => m.DefaultSpoolTypeGuid) - .Ignore(() => m.LoadedRmlGuid) - .Ignore(() => m.DeviceId) - .Ignore(() => m.DeviceName) - .Ignore(() => m.IsDeviceRegistered) - .Ignore(() => m.SiteGuid), - - EntitySerializationFlags.IgnoreGuids | EntitySerializationFlags.IgnoreReferenceTypes); - - - machine.OrganizationGuid = null; - machine.ConfigurationGuid = null; - machine.ConfigurationGuid = machine.Configuration.Guid; - - - foreach (var cat in machine.Cats) - { - cat.MachineGuid = machine.Guid; - } - - machine.MachineVersionGuid = Guid; - machine.ProductionDate = DateTime.UtcNow; - - foreach (var idsPack in machine.Configuration.IdsPacks) - { - idsPack.DispenserGuid = null; - idsPack.ConfigurationGuid = machine.ConfigurationGuid; - } - - foreach (var spool in machine.Spools) - { - spool.MachineGuid = machine.Guid; - } - - machine.DefaultColorSpaceGuid = null; - machine.DefaultRmlGuid = null; - machine.DefaultSpoolTypeGuid = null; - - return machine; - } - /// /// Initializes a new instance of the class. /// -- cgit v1.3.1