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 --- .../Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs') 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."); -- cgit v1.3.1 From f73b77c8619d0fb49af93e4ac5c73dd13d5d1b1a Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 13 Dec 2019 16:49:52 +0200 Subject: Implemented site catalogs ! --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes .../SQLExaminer Projects/Provision Machine.sdeproj | 327 ++++++++++++++++++++- Software/DB/TCC/TCC.mdf | Bin 8388608 -> 8388608 bytes Software/DB/TCC/TCC_log.ldf | Bin 8388608 -> 8388608 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../ViewModels/MainViewVM.cs | 2 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 4 +- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 10 +- .../ViewModels/MainViewVM.cs | 15 +- .../Tango.PPC.MachineSettings/Views/MainView.xaml | 2 +- .../PPC/Tango.PPC.Common/PPCSettings.cs | 6 + .../PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs | 4 +- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 4 +- .../Tango.BL/Builders/CatalogBuilder.cs | 49 +++ .../Tango.BL/Builders/CatalogsCollectionBuilder.cs | 41 +++ .../Tango.BL/Builders/ColorCatalogBuilder.cs | 49 --- .../Tango.BL/Builders/RmlsCollectionBuilder.cs | 26 +- .../Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs | 14 + .../Tango.BL/DTO/SitesCatalogDTOBase.cs | 41 +++ .../Tango.BL/Entities/HardwareBlowerBase.cs | 4 - .../Tango.BL/Entities/SitesCatalog.cs | 12 + .../Tango.BL/Entities/SitesCatalogBase.cs | 86 ++++++ .../Visual_Studio/Tango.BL/ObservablesContext.cs | 8 + .../ObservablesEntitiesAdapterExtension.cs | 38 +++ .../ObservablesStaticCollectionsExtension.cs | 38 +++ Software/Visual_Studio/Tango.BL/Tango.BL.csproj | 7 +- .../Tango.DAL.Remote/DB/RemoteADO.Context.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 33 +++ .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 153 +++++----- .../Tango.DAL.Remote/DB/SITES_CATALOGS.cs | 23 ++ .../Tango.DAL.Remote/Tango.DAL.Remote.csproj | 3 + .../Configurations/ProvisionMachine.xml | Bin 73758 -> 87374 bytes .../SQLExaminer/Configurations/UpdateMachine.xml | Bin 40278 -> 54676 bytes 35 files changed, 846 insertions(+), 154 deletions(-) create mode 100644 Software/Visual_Studio/Tango.BL/Builders/CatalogBuilder.cs create mode 100644 Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs delete mode 100644 Software/Visual_Studio/Tango.BL/Builders/ColorCatalogBuilder.cs create mode 100644 Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs create mode 100644 Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTOBase.cs create mode 100644 Software/Visual_Studio/Tango.BL/Entities/SitesCatalog.cs create mode 100644 Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs create mode 100644 Software/Visual_Studio/Tango.DAL.Remote/DB/SITES_CATALOGS.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 35dde42f3..ec8ed5ec8 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 60f6da390..91c5d6631 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj b/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj index 5f4b977ae..ede868748 100644 --- a/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj +++ b/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj @@ -95,6 +95,8 @@ + + @@ -125,6 +127,8 @@ + + @@ -133,6 +137,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -156,6 +211,7 @@ + @@ -369,6 +425,15 @@ + + + + + + + + + @@ -499,6 +564,8 @@ + + @@ -538,6 +605,8 @@ + + @@ -625,6 +694,11 @@ + + + + + @@ -638,6 +712,7 @@ + @@ -766,6 +841,8 @@ + + @@ -798,6 +875,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -831,6 +936,21 @@ + + + + + + + + + + + + + + + @@ -842,6 +962,7 @@ + @@ -957,7 +1078,7 @@ - + @@ -1035,7 +1156,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1103,7 +1224,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1113,6 +1234,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' + @@ -1165,7 +1287,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1240,7 +1362,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1312,7 +1434,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@']]> - + @@ -1390,7 +1512,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1420,6 +1542,11 @@ WHERE MACHINES.SERIAL_NUMBER = '@' + + + + + @@ -1498,7 +1625,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + @@ -1560,7 +1687,185 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+
+
+ @@ -1621,7 +1926,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@']]> - + @@ -1697,7 +2002,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' - + diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf index 7acd2ca82..c6f9a4e37 100644 Binary files a/Software/DB/TCC/TCC.mdf and b/Software/DB/TCC/TCC.mdf differ diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf index d61145d85..bb23dc9c6 100644 Binary files a/Software/DB/TCC/TCC_log.ldf and b/Software/DB/TCC/TCC_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index ddfd3abd8..4b4e5b56d 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 58b7b4e60..369c83d64 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs index 3cc4406d6..4d88a71d9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs @@ -197,7 +197,7 @@ namespace Tango.MachineStudio.Catalogs.ViewModels _activeCatalogContext = ObservablesContext.CreateDefault(); - ActiveCatalog = await new ColorCatalogBuilder(_activeCatalogContext).Set(SelectedCatalog.Guid).WithGroups().WithItems().WithRecipes().BuildAsync(); + ActiveCatalog = await new CatalogBuilder(_activeCatalogContext).Set(SelectedCatalog.Guid).WithGroups().WithItems().WithRecipes().BuildAsync(); SelectedGroup = ActiveCatalog.ColorCatalogsGroups.FirstOrDefault(); RMLS = await _activeCatalogContext.Rmls.ToListAsync(); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index dac8f9e49..0a5167900 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -468,7 +468,7 @@ namespace Tango.PPC.Jobs.ViewModels Job.ValidateOnPropertyChanged = true; LogManager.Log("Loading RMLS..."); - Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().BuildAsync()).ToList(); + Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().WithSite(MachineProvider.Machine.SiteGuid).BuildAsync()).ToList(); LogManager.Log("Loading Color Spaces..."); ColorSpaces = await _db.ColorSpaces.ToListAsync(); LogManager.Log("Loading Spool Types..."); @@ -478,7 +478,7 @@ namespace Tango.PPC.Jobs.ViewModels if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) { - SelectedCatalog = await new ColorCatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync(); + SelectedCatalog = await new CatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync(); if (SelectedCatalog != null) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index e80154413..798b333e7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -48,7 +48,8 @@ namespace Tango.PPC.Jobs.ViewModels public class JobsViewVM : PPCViewModel { private ObservablesContext _db; //Holds the db context for the job list. - private ObservableCollection _catalogs; //Holds the available color catalogs. + private ObservableCollection _catalogs; //Holds the available color catalogs for the site. + private ObservableCollection _rmls; //Holds the available RML for the site. public enum JobsCategory { @@ -505,7 +506,7 @@ namespace Tango.PPC.Jobs.ViewModels job.ColorSpaceGuid = Adapter.ColorSpaces.FirstOrDefault(x => x.Code == vm.SelectedColorSpace.ToInt32()).Guid; job.MachineGuid = MachineProvider.Machine.Guid; job.UserGuid = AuthenticationProvider.CurrentUser.Guid; - job.RmlGuid = Settings.DefaultRmlGuid != null ? Settings.DefaultRmlGuid : Adapter.Rmls.FirstOrDefault().Guid; + job.RmlGuid = Settings.DefaultRmlGuid != null ? Settings.DefaultRmlGuid : _rmls.FirstOrDefault().Guid; job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; job.SpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; @@ -726,9 +727,10 @@ namespace Tango.PPC.Jobs.ViewModels StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Pulse.Extension, HandlePulseFileLoaded); //Load catalogs. - using (ObservablesContext c = ObservablesContext.CreateDefault()) + using (ObservablesContext db = ObservablesContext.CreateDefault()) { - _catalogs = (await c.ColorCatalogs.ToListAsync()).ToObservableCollection(); + _catalogs = await new CatalogsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildAsync(); + _rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildAsync(); } MachineDataSynchronizer.SynchronizationEnded += MachineDataSynchronizer_SynchronizationEnded; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 1af9b8609..d12617264 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Data; using Tango.BL; +using Tango.BL.Builders; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core.Commands; @@ -52,6 +53,13 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _selectedColorSpaces = value; RaisePropertyChangedAuto(); } } + private ObservableCollection _rmls; + public ObservableCollection Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + private bool _enableHotSpot; public bool EnableHotSpot { @@ -211,11 +219,16 @@ namespace Tango.PPC.MachineSettings.ViewModels } - public override void OnApplicationReady() + public async override void OnApplicationReady() { base.OnApplicationReady(); MachineDataSynchronizer.SynchronizationStarted += (_, __) => InvalidateRelayCommands(); MachineDataSynchronizer.SynchronizationEnded += (_, __) => InvalidateRelayCommands(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + Rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildAsync(); + } } public override void OnNavigatedTo() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index e8bd657a0..017649f8e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -137,7 +137,7 @@ Default Thread - + Default Spool diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 0c3800d53..2f470df12 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -204,6 +204,11 @@ namespace Tango.PPC.Common /// public String LastPowerUpSelectedRmlGuid { get; set; } + /// + /// Gets or sets the power up screen timeout. + /// + public TimeSpan PowerUpScreenTimeout { get; set; } + /// /// Gets the machine service address. /// @@ -243,6 +248,7 @@ namespace Tango.PPC.Common SynchronizeDiagnostics = true; SynchronizationInterval = TimeSpan.FromMinutes(60); FirmwareVersion = "1.0.0.0"; + PowerUpScreenTimeout = TimeSpan.FromSeconds(20); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs index 22e489ffa..413b8453d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpViewVM.cs @@ -5,6 +5,8 @@ using System.Text; using System.Threading.Tasks; using System.Timers; using Tango.BL.Entities; +using Tango.PPC.Common; +using Tango.Settings; using Tango.SharedUI; namespace Tango.PPC.UI.Dialogs @@ -83,7 +85,7 @@ namespace Tango.PPC.UI.Dialogs public PowerUpViewVM() { - RemainingSeconds = 20; + RemainingSeconds = (int)SettingsManager.Default.GetOrCreate().PowerUpScreenTimeout.TotalSeconds; CanClose = false; IsMinimalTemperature = true; IsTimeoutEnabled = true; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index 48e59562c..c3fa97d13 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -109,7 +109,7 @@ namespace Tango.PPC.UI.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { - rmls = await db.Rmls.ToListAsync(); + rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildListAsync(); } var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LastPowerUpSelectedRmlGuid); @@ -143,7 +143,7 @@ namespace Tango.PPC.UI.ViewModels } else { - var rmlsToAvg = new RmlsCollectionBuilder(db).SetAll().WithActiveParametersGroup().Build(); + var rmlsToAvg = new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).WithActiveParametersGroup().Build(); processTables = rmlsToAvg.Select(x => x.GetActiveProcessGroup()).SelectMany(x => x.ProcessParametersTables).ToList(); } diff --git a/Software/Visual_Studio/Tango.BL/Builders/CatalogBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/CatalogBuilder.cs new file mode 100644 index 000000000..ffe6924dd --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Builders/CatalogBuilder.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using System.Data.Entity; + +namespace Tango.BL.Builders +{ + public class CatalogBuilder : EntityBuilderBase + { + public CatalogBuilder(ObservablesContext context) : base(context) + { + + } + + public virtual CatalogBuilder WithGroups() + { + return AddQueryStep(1, (query) => + { + return query.Include(x => x.ColorCatalogsGroups); + }); + } + + public virtual CatalogBuilder WithItems() + { + return AddQueryStep(2, (query) => + { + return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems)); + }); + } + + public virtual CatalogBuilder WithRecipes(Rml rml = null) + { + return AddQueryStep(3, (query) => + { + if (rml != null) + { + return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes.Where(r => r.RmlGuid == rml.Guid)))); + } + else + { + return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes))); + } + }); + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs new file mode 100644 index 000000000..9b24899c4 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using System.Data.Entity; + +namespace Tango.BL.Builders +{ + public class CatalogsCollectionBuilder : EntityCollectionBuilderBase + { + public CatalogsCollectionBuilder(ObservablesContext context) : base(context) + { + } + + public virtual CatalogsCollectionBuilder WithSite(String siteGuid) + { + return AddQueryStep(1, (query) => + { + if (siteGuid != null) + { + var siteCatalogsGuids = Context.SitesCatalogs.Where(x => x.SiteGuid == siteGuid).ToList().Select(x => x.CatalogGuid).Where(x => x != null).Distinct().ToArray(); + + if (siteCatalogsGuids.Length > 0) + { + return query.Where(x => siteCatalogsGuids.Contains(x.Guid)); + } + else + { + return query; + } + } + else + { + return query; + } + }); + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Builders/ColorCatalogBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/ColorCatalogBuilder.cs deleted file mode 100644 index 5ddc84bc5..000000000 --- a/Software/Visual_Studio/Tango.BL/Builders/ColorCatalogBuilder.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL.Entities; -using System.Data.Entity; - -namespace Tango.BL.Builders -{ - public class ColorCatalogBuilder : EntityBuilderBase - { - public ColorCatalogBuilder(ObservablesContext context) : base(context) - { - - } - - public virtual ColorCatalogBuilder WithGroups() - { - return AddQueryStep(1, (query) => - { - return query.Include(x => x.ColorCatalogsGroups); - }); - } - - public virtual ColorCatalogBuilder WithItems() - { - return AddQueryStep(2, (query) => - { - return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems)); - }); - } - - public virtual ColorCatalogBuilder WithRecipes(Rml rml = null) - { - return AddQueryStep(3, (query) => - { - if (rml != null) - { - return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes.Where(r => r.RmlGuid == rml.Guid)))); - } - else - { - return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes))); - } - }); - } - } -} diff --git a/Software/Visual_Studio/Tango.BL/Builders/RmlsCollectionBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/RmlsCollectionBuilder.cs index 055f02474..9408d714b 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/RmlsCollectionBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/RmlsCollectionBuilder.cs @@ -14,9 +14,33 @@ namespace Tango.BL.Builders { } - public virtual RmlsCollectionBuilder WithCCT() + public virtual RmlsCollectionBuilder WithSite(String siteGuid) { return AddQueryStep(1, (query) => + { + if (siteGuid != null) + { + var siteRmlsGuids = Context.SitesRmls.Where(x => x.SiteGuid == siteGuid).ToList().Select(x => x.RmlGuid).Where(x => x != null).Distinct().ToArray(); + + if (siteRmlsGuids.Length > 0) + { + return query.Where(x => siteRmlsGuids.Contains(x.Guid)); + } + else + { + return query; + } + } + else + { + return query; + } + }); + } + + public virtual RmlsCollectionBuilder WithCCT() + { + return AddQueryStep(2, (query) => { return query.Include(x => x.Cct); }); diff --git a/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs new file mode 100644 index 000000000..4e1d44e6d --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTO.cs @@ -0,0 +1,14 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.DTO +{ + public class SitesCatalogDTO : SitesCatalogDTOBase + { + + } +} diff --git a/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTOBase.cs new file mode 100644 index 000000000..b673d5660 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/DTO/SitesCatalogDTOBase.cs @@ -0,0 +1,41 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Tango Observables Generator +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. Do not modify! +// +//------------------------------------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.BL.DTO +{ + public abstract class SitesCatalogDTOBase : ObservableEntityDTO + { + + /// + /// site guid + /// + public String SiteGuid + { + get; set; + } + + /// + /// catalog guid + /// + public String CatalogGuid + { + get; set; + } + + } +} diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs index bbc55d245..c6c166498 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs @@ -129,10 +129,6 @@ namespace Tango.BL.Entities /// [Column("VOLTAGE")] - - [Description("Voltage Description")] - [Range(-10000,1000000)] - public Double Voltage { get diff --git a/Software/Visual_Studio/Tango.BL/Entities/SitesCatalog.cs b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalog.cs new file mode 100644 index 000000000..886d06719 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalog.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.Entities +{ + public class SitesCatalog : SitesCatalogBase + { + } +} diff --git a/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs new file mode 100644 index 000000000..85175d6ad --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs @@ -0,0 +1,86 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Tango Observables Generator +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. Do not modify! +// +//------------------------------------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Xml.Serialization; +using Newtonsoft.Json; +using System.Linq; +using Tango.DAL.Remote.DB; +using Tango.Core; +using System.ComponentModel; + +namespace Tango.BL.Entities +{ + [Table("SITES_CATALOGS")] + public abstract class SitesCatalogBase : ObservableEntity + { + + protected String _siteguid; + + /// + /// Gets or sets the sitescatalogbase site guid. + /// + + [Column("SITE_GUID")] + + public String SiteGuid + { + get + { + return _siteguid; + } + + set + { + if (_siteguid != value) + { + _siteguid = value; + + } + } + } + + protected String _catalogguid; + + /// + /// Gets or sets the sitescatalogbase catalog guid. + /// + + [Column("CATALOG_GUID")] + + public String CatalogGuid + { + get + { + return _catalogguid; + } + + set + { + if (_catalogguid != value) + { + _catalogguid = value; + + } + } + } + + /// + /// Initializes a new instance of the class. + /// + public SitesCatalogBase() : base() + { + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs index d47f6514b..4eaf256d2 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs @@ -518,6 +518,14 @@ namespace Tango.BL get; set; } + /// + /// Gets or sets the SitesCatalogs. + /// + public DbSet SitesCatalogs + { + get; set; + } + /// /// Gets or sets the SitesRmls. /// diff --git a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs index 139c90158..c86933713 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs @@ -2249,6 +2249,42 @@ namespace Tango.BL } + private ObservableCollection _sitescatalogs; + /// + /// Gets or sets the SitesCatalogs. + /// + public ObservableCollection SitesCatalogs + { + get + { + return _sitescatalogs; + } + + set + { + _sitescatalogs = value; RaisePropertyChanged(nameof(SitesCatalogs)); + } + + } + + private ICollectionView _sitescatalogsViewSource; + /// + /// Gets or sets the SitesCatalogs View Source. + /// + public ICollectionView SitesCatalogsViewSource + { + get + { + return _sitescatalogsViewSource; + } + + set + { + _sitescatalogsViewSource = value; RaisePropertyChanged(nameof(SitesCatalogsViewSource)); + } + + } + private ObservableCollection _sitesrmls; /// /// Gets or sets the SitesRmls. @@ -2919,6 +2955,8 @@ namespace Tango.BL SitesViewSource = CreateCollectionView(Sites); + SitesCatalogsViewSource = CreateCollectionView(SitesCatalogs); + SitesRmlsViewSource = CreateCollectionView(SitesRmls); SpoolTypesViewSource = CreateCollectionView(SpoolTypes); diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs index e509d0e3c..efa188fec 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs @@ -2249,6 +2249,42 @@ namespace Tango.BL } + private ObservableCollection _sitescatalogs; + /// + /// Gets or sets the SitesCatalogs. + /// + public ObservableCollection SitesCatalogs + { + get + { + return _sitescatalogs; + } + + set + { + _sitescatalogs = value; RaisePropertyChanged(nameof(SitesCatalogs)); + } + + } + + private ICollectionView _sitescatalogsViewSource; + /// + /// Gets or sets the SitesCatalogs View Source. + /// + public ICollectionView SitesCatalogsViewSource + { + get + { + return _sitescatalogsViewSource; + } + + set + { + _sitescatalogsViewSource = value; RaisePropertyChanged(nameof(SitesCatalogsViewSource)); + } + + } + private ObservableCollection _sitesrmls; /// /// Gets or sets the SitesRmls. @@ -2919,6 +2955,8 @@ namespace Tango.BL SitesViewSource = CreateCollectionView(Sites); + SitesCatalogsViewSource = CreateCollectionView(SitesCatalogs); + SitesRmlsViewSource = CreateCollectionView(SitesRmls); SpoolTypesViewSource = CreateCollectionView(SpoolTypes); diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index d75cdc0c1..99855796d 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -84,7 +84,7 @@ GlobalVersionInfo.cs - + @@ -93,6 +93,7 @@ + @@ -236,6 +237,8 @@ + + @@ -339,6 +342,8 @@ + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs index 9f81121ca..3ef793f7f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs @@ -87,6 +87,7 @@ namespace Tango.DAL.Remote.DB public virtual DbSet ROLES_PERMISSIONS { get; set; } public virtual DbSet SEGMENTS { get; set; } public virtual DbSet SITES { get; set; } + public virtual DbSet SITES_CATALOGS { get; set; } public virtual DbSet SITES_RMLS { get; set; } public virtual DbSet SPOOL_TYPES { get; set; } public virtual DbSet SPOOLS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 2c003669e..fe8f0194b 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -933,6 +933,16 @@ + + + + + + + + + + @@ -2252,6 +2262,7 @@ + @@ -2660,6 +2671,7 @@ + @@ -4080,6 +4092,16 @@ + + + + + + + + + + @@ -6351,6 +6373,17 @@ + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index e7b00e86f..6abe85e1b 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,82 +5,83 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/SITES_CATALOGS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/SITES_CATALOGS.cs new file mode 100644 index 000000000..df712045c --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/SITES_CATALOGS.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.DAL.Remote.DB +{ + using System; + using System.Collections.Generic; + + public partial class SITES_CATALOGS + { + public int ID { get; set; } + public string GUID { get; set; } + public System.DateTime LAST_UPDATED { get; set; } + public string SITE_GUID { get; set; } + public string CATALOG_GUID { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj index 4150c2771..75fa9179c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj +++ b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj @@ -264,6 +264,9 @@ RemoteADO.tt + + RemoteADO.tt + RemoteADO.tt diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml index 733b4ae8e..c36c6a9b7 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml differ diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml index 083c7cf12..97dad3717 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml differ -- cgit v1.3.1