diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-12-17 00:02:49 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-12-17 00:02:49 +0200 |
| commit | bdf56799cd6c4c42ec7a8dc36f56ddd17a5feeab (patch) | |
| tree | 00ff21d8d2ee3d81b76fa12bc92460117cc693be /Software | |
| parent | e8ee7dfb8e166e34c7950e90d5fe9bcf31dc351b (diff) | |
| download | Tango-bdf56799cd6c4c42ec7a8dc36f56ddd17a5feeab.tar.gz Tango-bdf56799cd6c4c42ec7a8dc36f56ddd17a5feeab.zip | |
Added SOURCE to JOB.
Added IS_SYNCHRONIZED to TANGO_UPDATE.
Added OfflineUpdates to Synchronization.
Added TangoUpdates on PPC side.
Diffstat (limited to 'Software')
31 files changed, 518 insertions, 102 deletions
diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf Binary files differindex 8bce1236f..8ad9bc103 100644 --- a/Software/DB/PPC/Tango.mdf +++ b/Software/DB/PPC/Tango.mdf diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf Binary files differindex 9e9f5d60a..9bce4a9c4 100644 --- a/Software/DB/PPC/Tango_log.ldf +++ b/Software/DB/PPC/Tango_log.ldf diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf Binary files differindex f77c2e733..3540a7786 100644 --- a/Software/DB/TCC/TCC.mdf +++ b/Software/DB/TCC/TCC.mdf diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf Binary files differindex 048d3ccb0..94b99ac61 100644 --- a/Software/DB/TCC/TCC_log.ldf +++ b/Software/DB/TCC/TCC_log.ldf diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 6af55afc8..e70e0e6e3 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 33e76f9de..e65b718bb 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf 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 4f517165b..71cbd9ffe 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 @@ -50,6 +50,7 @@ using Tango.Core.ExtensionMethods; using Tango.ColorConversion; using Tango.PMR.Exports; using Microsoft.WindowsAPICodePack.Dialogs; +using Tango.BL.Enumerations; namespace Tango.MachineStudio.Developer.ViewModels { @@ -2211,6 +2212,8 @@ namespace Tango.MachineStudio.Developer.ViewModels var settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>(); Job newJob = new Job(); + newJob.LastUpdated = DateTime.UtcNow; + newJob.JobSource = JobSource.Remote; newJob.Name = jobName; newJob.CreationDate = DateTime.UtcNow; newJob.UserGuid = AuthenticationProvider.CurrentUser.Guid; 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 785472d0d..1eb7e1f04 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 @@ -500,6 +500,8 @@ namespace Tango.PPC.Jobs.ViewModels settings.Save(); Job job = new Job(); + job.LastUpdated = DateTime.UtcNow; + job.JobSource = JobSource.Local; job.Name = "untitled"; job.NumberOfHeads = 1; job.NumberOfUnits = 1; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index dfa9b833b..582eec83b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -11,6 +11,8 @@ using System.Net.Http.Headers; using System.Text; using System.Threading; using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; using Tango.Core; using Tango.Core.DB; using Tango.Core.ExtensionMethods; @@ -29,6 +31,7 @@ using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.SQLExaminer; using Tango.Transport.Web; +using System.Data.Entity; namespace Tango.PPC.Common.MachineSetup { @@ -45,6 +48,7 @@ namespace Tango.PPC.Common.MachineSetup private PPCWebClient _client; private List<LogItemBase> _logs; private bool _isUpdating; + private DateTime _setupStartDate; #region Events @@ -164,6 +168,28 @@ namespace Tango.PPC.Common.MachineSetup } } + if (response != null) + { + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + TangoUpdate update = new TangoUpdate(); + update.ApplicationVersion = response.Version; + update.FirmwareVersion = response.FirmwareVersion; + update.MachineGuid = (await db.Machines.FirstAsync()).Guid; + update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.SetupCompleted; + update.StartDate = _setupStartDate; + update.EndDate = DateTime.UtcNow; + await db.SaveChangesAsync(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving tango setup information to database."); + } + } + _isUpdating = false; } @@ -191,6 +217,7 @@ namespace Tango.PPC.Common.MachineSetup TaskCompletionSource<MachineSetupResult> result = new TaskCompletionSource<MachineSetupResult>(); MachineSetupResponse setup_response = null; + _setupStartDate = DateTime.UtcNow; try { 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 088e80f61..666b6813c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -10,6 +10,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using Tango.BL; +using Tango.BL.Entities; using Tango.Core; using Tango.Core.DB; using Tango.Core.ExtensionMethods; @@ -29,6 +30,7 @@ using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.SQLExaminer; using Tango.Transport.Web; +using System.Data.Entity; namespace Tango.PPC.Common.MachineUpdate { @@ -42,6 +44,7 @@ namespace Tango.PPC.Common.MachineUpdate private System.Timers.Timer _checkForUpdateTimer; private bool _isUpdating; private PPCSettings _settings; + private DateTime _updateStartDate; #region Events @@ -140,7 +143,7 @@ namespace Tango.PPC.Common.MachineUpdate }); } - private async void OnFailed(Exception ex, TaskCompletionSource<MachineUpdateResult> completionSource, DownloadUpdateResponse response, bool performDatabaseRollback, String dbBackupFile, String backupsFolder, String tempDbName, Tango.Core.DataSource localDataSource, String tempUpdatePackageFolder = null) + private async void OnFailed(Exception ex, TaskCompletionSource<MachineUpdateResult> completionSource, DownloadUpdateResponse response, bool performDatabaseRollback, String dbBackupFile, String backupsFolder, String tempDbName, Tango.Core.DataSource localDataSource, String tempUpdatePackageFolder = null, PublishInfo tupPublishInfo = null) { LogManager.Log(ex, "An error occurred in machine update."); @@ -217,6 +220,8 @@ namespace Tango.PPC.Common.MachineUpdate completionSource.SetException(ex); + String logs = GetLogsStringAndClear(); + if (response != null) { try @@ -226,19 +231,65 @@ namespace Tango.PPC.Common.MachineUpdate Token = response.NotifyCompletedToken, Status = BL.Enumerations.TangoUpdateStatuses.UpdateFailed, FailedReason = ex.FlattenMessage(), - FailedLog = GetLogsStringAndClear(), + FailedLog = logs, }); } catch (Exception xx) { LogManager.Log(xx, "Error notifying update failed."); } + + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + TangoUpdate update = new TangoUpdate(); + update.ApplicationVersion = response.Version; + update.FirmwareVersion = response.FirmwareVersion; + update.MachineGuid = _machineProvider.Machine.Guid; + update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.UpdateFailed; + update.StartDate = _updateStartDate; + update.EndDate = DateTime.UtcNow; + update.FailedReason = ex.FlattenMessage(); + update.FailedLog = logs; + await db.SaveChangesAsync(); + } + } + catch (Exception xxx) + { + LogManager.Log(xxx, "Error saving tango update information to database."); + } + } + + + if (tupPublishInfo != null) + { + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + TangoUpdate update = new TangoUpdate(); + update.ApplicationVersion = tupPublishInfo.ApplicationVersion; + update.FirmwareVersion = tupPublishInfo.GetFirmwareVersion(); + update.MachineGuid = _machineProvider.Machine.Guid; + update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.OfflineUpdateFailed; + update.StartDate = _updateStartDate; + update.EndDate = DateTime.UtcNow; + update.FailedReason = ex.FlattenMessage(); + update.FailedLog = logs; + await db.SaveChangesAsync(); + } + } + catch (Exception xxx) + { + LogManager.Log(xxx, "Error saving tango offline update information to database."); + } } _isUpdating = false; } - private async void OnCompleted(MachineUpdateResult result, TaskCompletionSource<MachineUpdateResult> completionSource, DownloadUpdateResponse response, String tempDbName, String backupsFolder, Core.DataSource localDataSource) + private async void OnCompleted(MachineUpdateResult result, TaskCompletionSource<MachineUpdateResult> completionSource, DownloadUpdateResponse response, String tempDbName, String backupsFolder, Core.DataSource localDataSource, PublishInfo tupPublishInfo = null) { await Task.Factory.StartNew(() => { @@ -299,26 +350,47 @@ namespace Tango.PPC.Common.MachineUpdate { LogManager.Log(ex, "Error notifying update completed."); } + + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + TangoUpdate update = new TangoUpdate(); + update.ApplicationVersion = response.Version; + update.FirmwareVersion = response.FirmwareVersion; + update.MachineGuid = (await db.Machines.FirstAsync()).Guid; + update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.UpdateCompleted; + update.StartDate = _updateStartDate; + update.EndDate = DateTime.UtcNow; + await db.SaveChangesAsync(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving tango update information to database."); + } } - _isUpdating = false; - } - private void OnCompleted(UpdateDBResponse response) - { - if (response != null) + if (tupPublishInfo != null) { try { - var r = _client.NotifyUpdateCompleted(new MachineUpdateCompletedRequest() + using (ObservablesContext db = ObservablesContext.CreateDefault()) { - Token = response.NotifyCompletedToken, - Status = BL.Enumerations.TangoUpdateStatuses.DatabaseCompleted, - }).Result; + TangoUpdate update = new TangoUpdate(); + update.ApplicationVersion = tupPublishInfo.ApplicationVersion; + update.FirmwareVersion = tupPublishInfo.GetFirmwareVersion(); + update.MachineGuid = _machineProvider.Machine.Guid; + update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.OfflineUpdateCompleted; + update.StartDate = _updateStartDate; + update.EndDate = DateTime.UtcNow; + await db.SaveChangesAsync(); + } } - catch (Exception ex) + catch (Exception xxx) { - LogManager.Log(ex, "Error notifying database completed."); + LogManager.Log(xxx, "Error saving tango offline update information to database."); } } @@ -357,6 +429,8 @@ namespace Tango.PPC.Common.MachineUpdate } } + String logs = GetLogsStringAndClear(); + if (response != null) { try @@ -366,13 +440,74 @@ namespace Tango.PPC.Common.MachineUpdate Token = response.NotifyCompletedToken, Status = BL.Enumerations.TangoUpdateStatuses.DatabaseFailed, FailedReason = ex.FlattenMessage(), - FailedLog = GetLogsStringAndClear(), + FailedLog = logs, }).Result; } catch (Exception xx) { LogManager.Log(xx, "Error notifying database failed."); } + + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + TangoUpdate update = new TangoUpdate(); + update.ApplicationVersion = _app_manager.Version.ToString(); + update.FirmwareVersion = _app_manager.FirmwareVersion.ToString(); + update.MachineGuid = _machineProvider.Machine.Guid; + update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.DatabaseFailed; + update.StartDate = _updateStartDate; + update.EndDate = DateTime.UtcNow; + update.FailedReason = ex.FlattenMessage(); + update.FailedLog = logs; + db.SaveChanges(); + } + } + catch (Exception exx) + { + LogManager.Log(exx, "Error saving database update information to database."); + } + } + + _isUpdating = false; + } + + private void OnCompleted(UpdateDBResponse response) + { + if (response != null) + { + try + { + var r = _client.NotifyUpdateCompleted(new MachineUpdateCompletedRequest() + { + Token = response.NotifyCompletedToken, + Status = BL.Enumerations.TangoUpdateStatuses.DatabaseCompleted, + }).Result; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error notifying database completed."); + } + + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + TangoUpdate update = new TangoUpdate(); + update.ApplicationVersion = _app_manager.Version.ToString(); + update.FirmwareVersion = _app_manager.FirmwareVersion.ToString(); + update.MachineGuid = _machineProvider.Machine.Guid; + update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.DatabaseCompleted; + update.StartDate = _updateStartDate; + update.EndDate = DateTime.UtcNow; + db.SaveChanges(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving database update information to database."); + } } _isUpdating = false; @@ -404,6 +539,7 @@ namespace Tango.PPC.Common.MachineUpdate /// <exception cref="System.InvalidProgramException">Database tango does not exists.</exception> public async Task<MachineUpdateResult> Update(bool setupFirmware, bool setupFPGA) { + _updateStartDate = DateTime.UtcNow; _logs.Clear(); TaskCompletionSource<MachineUpdateResult> result = new TaskCompletionSource<MachineUpdateResult>(); @@ -739,6 +875,7 @@ namespace Tango.PPC.Common.MachineUpdate /// <returns></returns> public Task UpdateDB(DbCompareResult dbCompareResult, String serialNumber) { + _updateStartDate = DateTime.UtcNow; _logs.Clear(); return Task.Factory.StartNew(() => @@ -975,6 +1112,7 @@ namespace Tango.PPC.Common.MachineUpdate /// <returns></returns> public async Task<MachineUpdateResult> UpdateFromTUP(string fileName, bool setupFirmware, bool setupFPGA) { + _updateStartDate = DateTime.UtcNow; _logs.Clear(); TaskCompletionSource<MachineUpdateResult> result = new TaskCompletionSource<MachineUpdateResult>(); @@ -986,6 +1124,7 @@ namespace Tango.PPC.Common.MachineUpdate String tempDbFileName = tempDbName + ".bak"; String backupsFolder = "C:\\Backups"; bool replaceBinaries = false; + PublishInfo publishInfo = null; String serialNumber = _machineProvider.Machine.SerialNumber; @@ -1035,7 +1174,7 @@ namespace Tango.PPC.Common.MachineUpdate //Extracting publish info UpdateProgress("Exploring package", "Verifying..."); - PublishInfo publishInfo = PublishInfo.FromJson(File.ReadAllText(Path.Combine(_newPackageTempFolder, "version.json"))); + publishInfo = PublishInfo.FromJson(File.ReadAllText(Path.Combine(_newPackageTempFolder, "version.json"))); if (!publishInfo.IsMachineTupPackage) { @@ -1214,7 +1353,7 @@ namespace Tango.PPC.Common.MachineUpdate handler.Failed += (_, ex) => { stream.Dispose(); - OnFailed(ex, result, null, performDatabaseRollback, dbBackupFile, backupsFolder, tempDbName, localDataSource, _newPackageTempFolder); + OnFailed(ex, result, null, performDatabaseRollback, dbBackupFile, backupsFolder, tempDbName, localDataSource, _newPackageTempFolder, publishInfo); }; handler.Completed += (_, __) => { @@ -1224,12 +1363,12 @@ namespace Tango.PPC.Common.MachineUpdate { UpdatePackagePath = _newPackageTempFolder, RequiresBinariesUpdate = replaceBinaries, - }, result, null, tempDbName, backupsFolder, localDataSource); + }, result, null, tempDbName, backupsFolder, localDataSource, publishInfo); }; handler.Canceled += (_, __) => { stream.Dispose(); - OnFailed(new Exception("The operation has been canceled."), result, null, performDatabaseRollback, dbBackupFile, backupsFolder, tempDbName, localDataSource, _newPackageTempFolder); + OnFailed(new Exception("The operation has been canceled."), result, null, performDatabaseRollback, dbBackupFile, backupsFolder, tempDbName, localDataSource, _newPackageTempFolder, publishInfo); }; handler.Progress += (_, e) => { @@ -1242,12 +1381,12 @@ namespace Tango.PPC.Common.MachineUpdate { UpdatePackagePath = _newPackageTempFolder, RequiresBinariesUpdate = replaceBinaries, - }, result, null, tempDbName, backupsFolder, localDataSource); + }, result, null, tempDbName, backupsFolder, localDataSource, publishInfo); } } catch (Exception ex) { - OnFailed(ex, result, null, performDatabaseRollback, dbBackupFile, backupsFolder, tempDbName, localDataSource, _newPackageTempFolder); + OnFailed(ex, result, null, performDatabaseRollback, dbBackupFile, backupsFolder, tempDbName, localDataSource, _newPackageTempFolder, publishInfo); } return await result.Task; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs index df5690a05..1bbdb80d0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs @@ -32,5 +32,21 @@ namespace Tango.PPC.Common.Publish { return JsonConvert.DeserializeObject<PublishInfo>(json); } + + public String GetFirmwareVersion() + { + Version version = new Version("1.0.0.0"); + + var s = Firmware.FileDescriptors.FirstOrDefault(x => x.Destination == VersionFileDestination.Mcu); + if (s != null) + { + if (Version.TryParse(s.Version,out version)) + { + return version.ToString(); + } + } + + return version.ToString(); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs index 8260eb4b3..22c3dbe20 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs @@ -40,6 +40,7 @@ namespace Tango.PPC.Common.Synchronization public int MaxJobs { get; set; } public int MaxJobRuns { get; set; } public int MaxMachinesEvents { get; set; } + public int MaxOfflineUpdates { get; set; } private SynchronizationStatus _currentStatus; public SynchronizationStatus CurrentStatus @@ -80,6 +81,7 @@ namespace Tango.PPC.Common.Synchronization MaxJobs = 10; MaxJobRuns = 100; MaxMachinesEvents = 100; + MaxOfflineUpdates = 50; var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); Interval = settings.SynchronizationInterval; @@ -190,6 +192,21 @@ namespace Tango.PPC.Common.Synchronization request.MachineEvents.Add(dto); } } + + if (syncDiagnostics) + { + LogManager.Log("Checking Offline Updates..."); + + var tangoUpdates = await db.TangoUpdates.Where(x => !x.IsSynchronized && (x.Status == (int)TangoUpdateStatuses.OfflineUpdateCompleted || x.Status == (int)TangoUpdateStatuses.OfflineUpdateFailed)).Take(MaxOfflineUpdates).OrderByDescending(x => x.LastUpdated).ToListAsync(); + List<TangoUpdateDTO> dtos = new List<TangoUpdateDTO>(); + + foreach (var tangoUpdate in tangoUpdates) + { + tangoUpdate.IsSynchronized = true; + var dto = TangoUpdateDTO.FromObservable(tangoUpdate); + request.OfflineUpdates.Add(dto); + } + } } return request; @@ -247,6 +264,22 @@ namespace Tango.PPC.Common.Synchronization } } + //Finalize tango updates + foreach (var tangoUpdate in request.OfflineUpdates) + { + var failedTangoUpdate = response.FailedOfflineUpdates.SingleOrDefault(x => x.Guid == tangoUpdate.Guid); + + if (failedTangoUpdate == null) + { + var dbTangoUpdate = await db.TangoUpdates.SingleOrDefaultAsync(x => x.Guid == tangoUpdate.Guid); + dbTangoUpdate.IsSynchronized = true; + } + else + { + LogManager.Log($"Synchronization Error - TangoUpdate '{tangoUpdate.ID}' cannot be stored on the server due to the following reason:\n{failedTangoUpdate.Reason}", LogCategory.Error); + } + } + await db.SaveChangesAsync(); } } 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 63d870834..a857a20a1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs @@ -12,6 +12,7 @@ namespace Tango.PPC.Common.Web public bool IsUpdateAvailable { get; set; } public bool IsDatabaseUpdateAvailable { get; set; } public String Version { get; set; } + public String FirmwareVersion { get; set; } public bool SetupFirmware { get; set; } public bool SetupFPGA { get; set; } public UpdateDBResponse UpdateDBResponse { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateResponse.cs index b092aedbe..2fc7e4810 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateResponse.cs @@ -14,6 +14,8 @@ namespace Tango.PPC.Common.Web public String Version { get; set; } + public String FirmwareVersion { get; set; } + public String BlobAddress { get; set; } public String CdnAddress { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs index 714a413ab..a642eddf2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs @@ -14,6 +14,8 @@ namespace Tango.PPC.Common.Web public String Version { get; set; } + public String FirmwareVersion { get; set; } + public String BlobAddress { get; set; } public String CdnAddress { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadMachineDataRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadMachineDataRequest.cs index dc0b05988..d7475819c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadMachineDataRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadMachineDataRequest.cs @@ -14,6 +14,7 @@ namespace Tango.PPC.Common.Web public List<JobDTO> Jobs { get; set; } public List<JobRunDTO> JobRuns { get; set; } public List<MachinesEventDTO> MachineEvents { get; set; } + public List<TangoUpdateDTO> OfflineUpdates { get; set; } public String ApplicationVersion { get; set; } public String FirmwareVersion { get; set; } @@ -22,6 +23,7 @@ namespace Tango.PPC.Common.Web Jobs = new List<JobDTO>(); JobRuns = new List<JobRunDTO>(); MachineEvents = new List<MachinesEventDTO>(); + OfflineUpdates = new List<TangoUpdateDTO>(); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadMachineDataResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadMachineDataResponse.cs index e4dda4013..0119c07b6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadMachineDataResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadMachineDataResponse.cs @@ -14,6 +14,7 @@ namespace Tango.PPC.Common.Web public List<SynchronizationFailedEntity> FailedJobs { get; set; } public List<SynchronizationFailedEntity> FailedJobRuns { get; set; } public List<SynchronizationFailedEntity> FailedMachineEvents { get; set; } + public List<SynchronizationFailedEntity> FailedOfflineUpdates { get; set; } public String NotifyCompletedToken { get; set; } public UploadMachineDataResponse() @@ -21,6 +22,7 @@ namespace Tango.PPC.Common.Web FailedJobs = new List<SynchronizationFailedEntity>(); FailedJobRuns = new List<SynchronizationFailedEntity>(); FailedMachineEvents = new List<SynchronizationFailedEntity>(); + FailedOfflineUpdates = new List<SynchronizationFailedEntity>(); } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/JobDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/JobDTOBase.cs index c3c418f1f..2960381fc 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/JobDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/JobDTOBase.cs @@ -282,5 +282,13 @@ namespace Tango.BL.DTO get; set; } + /// <summary> + /// source + /// </summary> + public Int32 Source + { + get; set; + } + } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTOBase.cs index 5eb16841c..8e87df812 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTOBase.cs @@ -85,5 +85,13 @@ namespace Tango.BL.DTO get; set; } + /// <summary> + /// is synchronized + /// </summary> + public Boolean IsSynchronized + { + get; set; + } + } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs index d2a416271..c4847c5e9 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs @@ -101,6 +101,17 @@ namespace Tango.BL.Entities } /// <summary> + /// Gets or sets the origin of the job. + /// </summary> + [NotMapped] + [JsonIgnore] + public JobSource JobSource + { + get { return (JobSource)Source; } + set { Source = value.ToInt32(); RaisePropertyChangedAuto(); } + } + + /// <summary> /// Gets or sets the job <see cref="Type"/> property as <see cref="JobType"/> enum instead of int. /// </summary> [NotMapped] diff --git a/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs b/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs index 599e379a8..45e0e3437 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs @@ -83,6 +83,8 @@ namespace Tango.BL.Entities public event EventHandler<Boolean> IsSynchronizedChanged; + public event EventHandler<Int32> SourceChanged; + public event EventHandler<ColorCatalog> ColorCatalogChanged; public event EventHandler<ColorSpace> ColorSpaceChanged; @@ -1022,6 +1024,34 @@ namespace Tango.BL.Entities } } + protected Int32 _source; + + /// <summary> + /// 0 = Remote + /// 1 = Local + /// </summary> + + [Column("SOURCE")] + + public Int32 Source + { + get + { + return _source; + } + + set + { + if (_source != value) + { + _source = value; + + OnSourceChanged(value); + + } + } + } + protected ColorCatalog _colorcatalog; /// <summary> @@ -1538,6 +1568,15 @@ namespace Tango.BL.Entities } /// <summary> + /// Called when the Source has changed. + /// </summary> + protected virtual void OnSourceChanged(Int32 source) + { + SourceChanged?.Invoke(this, source); + RaisePropertyChanged(nameof(Source)); + } + + /// <summary> /// Called when the ColorCatalog has changed. /// </summary> protected virtual void OnColorCatalogChanged(ColorCatalog colorcatalog) diff --git a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs index 4ab67b7c5..f290618cb 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs @@ -80,6 +80,19 @@ namespace Tango.BL.Entities [NotMapped] [JsonIgnore] + public bool IsOfflineUpdate + { + get + { + return + UpdateStatus == TangoUpdateStatuses.OfflineUpdateStarted || + UpdateStatus == TangoUpdateStatuses.OfflineUpdateCompleted || + UpdateStatus == TangoUpdateStatuses.OfflineUpdateFailed; + } + } + + [NotMapped] + [JsonIgnore] public bool IsStarted { get @@ -88,7 +101,8 @@ namespace Tango.BL.Entities UpdateStatus == TangoUpdateStatuses.SetupStarted || UpdateStatus == TangoUpdateStatuses.UpdateStarted || UpdateStatus == TangoUpdateStatuses.DatabaseStarted || - UpdateStatus == TangoUpdateStatuses.SynchronizationStarted; + UpdateStatus == TangoUpdateStatuses.SynchronizationStarted || + UpdateStatus == TangoUpdateStatuses.OfflineUpdateStarted; } } @@ -102,7 +116,8 @@ namespace Tango.BL.Entities UpdateStatus == TangoUpdateStatuses.SetupCompleted || UpdateStatus == TangoUpdateStatuses.UpdateCompleted || UpdateStatus == TangoUpdateStatuses.DatabaseCompleted || - UpdateStatus == TangoUpdateStatuses.SynchronizationCompleted; + UpdateStatus == TangoUpdateStatuses.SynchronizationCompleted || + UpdateStatus == TangoUpdateStatuses.OfflineUpdateCompleted; } } @@ -116,7 +131,8 @@ namespace Tango.BL.Entities UpdateStatus == TangoUpdateStatuses.SetupFailed || UpdateStatus == TangoUpdateStatuses.UpdateFailed || UpdateStatus == TangoUpdateStatuses.DatabaseFailed || - UpdateStatus == TangoUpdateStatuses.SynchronizationFailed; + UpdateStatus == TangoUpdateStatuses.SynchronizationFailed || + UpdateStatus == TangoUpdateStatuses.OfflineUpdateFailed; } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs index 9f75b0021..57475977b 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs @@ -40,6 +40,8 @@ namespace Tango.BL.Entities public event EventHandler<Nullable<DateTime>> EndDateChanged; + public event EventHandler<Boolean> IsSynchronizedChanged; + protected String _applicationversion; /// <summary> @@ -254,6 +256,33 @@ namespace Tango.BL.Entities } } + protected Boolean _issynchronized; + + /// <summary> + /// Gets or sets the tangoupdatebase is synchronized. + /// </summary> + + [Column("IS_SYNCHRONIZED")] + + public Boolean IsSynchronized + { + get + { + return _issynchronized; + } + + set + { + if (_issynchronized != value) + { + _issynchronized = value; + + OnIsSynchronizedChanged(value); + + } + } + } + /// <summary> /// Called when the ApplicationVersion has changed. /// </summary> @@ -318,6 +347,15 @@ namespace Tango.BL.Entities } /// <summary> + /// Called when the IsSynchronized has changed. + /// </summary> + protected virtual void OnIsSynchronizedChanged(Boolean issynchronized) + { + IsSynchronizedChanged?.Invoke(this, issynchronized); + RaisePropertyChanged(nameof(IsSynchronized)); + } + + /// <summary> /// Initializes a new instance of the <see cref="TangoUpdateBase" /> class. /// </summary> public TangoUpdateBase() : base() diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/JobSource.cs b/Software/Visual_Studio/Tango.BL/Enumerations/JobSource.cs new file mode 100644 index 000000000..2327f5b66 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Enumerations/JobSource.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.Enumerations +{ + public enum JobSource + { + /// <summary> + /// The job was originated from an application that is working directly against the main db (Machine Studio etc.) + /// </summary> + Remote = 0, + /// <summary> + /// The job was originated from an application that is working against a private local db (PPC etc.). + /// </summary> + Local = 1, + } +} diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TangoUpdateStatuses.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TangoUpdateStatuses.cs index 855d8b29b..5fdf24e22 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/TangoUpdateStatuses.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TangoUpdateStatuses.cs @@ -36,5 +36,12 @@ namespace Tango.BL.Enumerations SynchronizationCompleted = 301, [Description("Synchronization failed")] SynchronizationFailed = 302, + + [Description("Offline update started but did not complete")] + OfflineUpdateStarted = 400, + [Description("Offline update completed successfully")] + OfflineUpdateCompleted = 401, + [Description("Offline update failed")] + OfflineUpdateFailed = 402, } } diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index 99855796d..6111a1a35 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -370,6 +370,7 @@ <Compile Include="Entities\WindingMethodBase.cs" /> <Compile Include="Enumerations\CatalogDesignType.cs" /> <Compile Include="Enumerations\ColorCatalogsItems.cs" /> + <Compile Include="Enumerations\JobSource.cs" /> <Compile Include="Enumerations\TangoUpdateStatuses.cs" /> <Compile Include="IObservableEntityDTO.cs" /> <Compile Include="ObservableEntityDTO.cs" /> @@ -579,7 +580,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs index 923cceacf..f30b43230 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs @@ -57,6 +57,7 @@ namespace Tango.DAL.Remote.DB public int EDITING_STATE { get; set; } public double LENGTH_PERCENTAGE_FACTOR { get; set; } public bool IS_SYNCHRONIZED { get; set; } + public int SOURCE { get; set; } public virtual COLOR_CATALOGS COLOR_CATALOGS { get; set; } public virtual COLOR_SPACES COLOR_SPACES { 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 83e251c1e..f8f4f9505 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -637,6 +637,7 @@ <Property Name="EDITING_STATE" Type="int" Nullable="false" /> <Property Name="LENGTH_PERCENTAGE_FACTOR" Type="float" Nullable="false" /> <Property Name="IS_SYNCHRONIZED" Type="bit" Nullable="false" /> + <Property Name="SOURCE" Type="int" Nullable="false" /> </EntityType> <EntityType Name="LINEAR_MASS_DENSITY_UNITS"> <Key> @@ -1015,6 +1016,7 @@ <Property Name="FAILED_LOG" Type="nvarchar(max)" /> <Property Name="START_DATE" Type="datetime2" Precision="3" Nullable="false" /> <Property Name="END_DATE" Type="datetime2" Precision="3" /> + <Property Name="IS_SYNCHRONIZED" Type="bit" Nullable="false" /> </EntityType> <EntityType Name="TANGO_VERSIONS"> <Key> @@ -3734,6 +3736,7 @@ <Property Name="EDITING_STATE" Type="Int32" Nullable="false" /> <Property Name="LENGTH_PERCENTAGE_FACTOR" Type="Double" Nullable="false" /> <Property Name="IS_SYNCHRONIZED" Type="Boolean" Nullable="false" /> + <Property Name="SOURCE" Type="Int32" Nullable="false" /> <NavigationProperty Name="COLOR_CATALOGS" Relationship="RemoteModel.FK_JOBS_COLOR_CATALOGS" FromRole="JOB" ToRole="COLOR_CATALOGS" /> <NavigationProperty Name="COLOR_SPACES" Relationship="RemoteModel.FK_JOBS_COLOR_SPACES" FromRole="JOB" ToRole="COLOR_SPACES" /> <NavigationProperty Name="CUSTOMER" Relationship="RemoteModel.FK_JOBS_CUSTOMERS" FromRole="JOB" ToRole="CUSTOMER" /> @@ -4172,6 +4175,7 @@ <Property Name="FAILED_LOG" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" /> <Property Name="START_DATE" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="END_DATE" Type="DateTime" Precision="3" /> + <Property Name="IS_SYNCHRONIZED" Type="Boolean" Nullable="false" /> </EntityType> <EntityType Name="TANGO_VERSIONS"> <Key> @@ -6020,6 +6024,7 @@ <EntitySetMapping Name="JOBS"> <EntityTypeMapping TypeName="RemoteModel.JOB"> <MappingFragment StoreEntitySet="JOBS"> + <ScalarProperty Name="SOURCE" ColumnName="SOURCE" /> <ScalarProperty Name="IS_SYNCHRONIZED" ColumnName="IS_SYNCHRONIZED" /> <ScalarProperty Name="LENGTH_PERCENTAGE_FACTOR" ColumnName="LENGTH_PERCENTAGE_FACTOR" /> <ScalarProperty Name="EDITING_STATE" ColumnName="EDITING_STATE" /> @@ -6442,6 +6447,7 @@ <EntitySetMapping Name="TANGO_UPDATES"> <EntityTypeMapping TypeName="RemoteModel.TANGO_UPDATES"> <MappingFragment StoreEntitySet="TANGO_UPDATES"> + <ScalarProperty Name="IS_SYNCHRONIZED" ColumnName="IS_SYNCHRONIZED" /> <ScalarProperty Name="END_DATE" ColumnName="END_DATE" /> <ScalarProperty Name="START_DATE" ColumnName="START_DATE" /> <ScalarProperty Name="FAILED_LOG" ColumnName="FAILED_LOG" /> 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 77b14d7c2..f13138208 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,83 +5,83 @@ <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1"> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="0.75" PointY="6.375" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="47.75" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="41.875" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="44.875" /> - <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="15" PointY="19.625" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="5.25" PointY="68.625" /> - <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="7.5" PointY="18.5" /> - <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="0.75" PointY="22.75" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="8.25" PointY="9.75" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_GROUPS" Width="1.5" PointX="10.5" PointY="10.75" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_ITEMS" Width="1.5" PointX="12.75" PointY="9.5" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_ITEMS_RECIPES" Width="1.5" PointX="8.25" PointY="26.375" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="3" PointY="11" /> - <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="44.5" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="0.75" PointY="10.5" /> - <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="8.25" PointY="36.125" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="3" PointY="61.875" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="5.25" PointY="61.25" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="39" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="11.25" PointY="30" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="15.625" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="18.625" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="7.75" PointY="68.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="10" PointY="57.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="0.75" PointY="55.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="3" PointY="51" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="0.75" PointY="59.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="3" PointY="55.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="7.75" PointY="64.125" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="10" PointY="48" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="7.75" PointY="60.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="10" PointY="40.375" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="3.75" PointY="41.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="6" PointY="45" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="50.625" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="3.75" PointY="72.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="6" PointY="49" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="5.25" PointY="35" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="7.5" PointY="39.25" /> - <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="5.75" PointY="3" /> - <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="10.5" PointY="19.125" /> - <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="35.25" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="5.25" PointY="30.125" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="8.25" PointY="22.75" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="10.5" PointY="35.875" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3" PointY="15.625" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="5.25" PointY="19.375" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="13.5" PointY="29.25" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="26.5" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="29.5" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="32.375" /> - <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="5.25" PointY="65.5" /> - <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="14.25" PointY="5.875" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="53.125" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="54.75" /> - <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="19.5" /> - <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="11.25" PointY="15.875" /> - <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="16.5" PointY="15.875" /> - <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="12.75" PointY="22.75" /> - <EntityTypeShape EntityType="RemoteModel.SITE" Width="1.5" PointX="7.75" PointY="3" /> - <EntityTypeShape EntityType="RemoteModel.SITES_CATALOGS" Width="1.5" PointX="5.75" PointY="7" /> - <EntityTypeShape EntityType="RemoteModel.SITES_RMLS" Width="1.5" PointX="7.75" PointY="6" /> - <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="3" PointY="7" /> - <EntityTypeShape EntityType="RemoteModel.SPOOL" Width="1.5" PointX="13.5" PointY="15.5" /> - <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="9.75" PointY="3" /> - <EntityTypeShape EntityType="RemoteModel.TANGO_UPDATES" Width="1.5" PointX="14.75" PointY="10" /> - <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="16.5" PointY="29.875" /> - <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="9.75" PointY="6" /> - <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="16.75" PointY="3" /> - <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="16.75" PointY="6" /> - <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="16.75" PointY="9" /> - <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="17.75" PointY="20" /> - <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="18.75" PointY="3" /> - <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="8.25" PointY="30.875" /> - <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="13.5" PointY="33.875" /> - <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="8.25" PointY="14.625" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="6.75" PointY="45.75" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="6.75" PointY="36" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="6.75" PointY="25.875" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="6.75" PointY="28.75" /> + <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="19" PointY="22.5" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="17.25" PointY="4.875" /> + <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="16.5" PointY="21.375" /> + <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="0.75" PointY="31.125" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="1.5" PointY="4.375" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_GROUPS" Width="1.5" PointX="0.75" PointY="9.75" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_ITEMS" Width="1.5" PointX="3" PointY="8.5" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_ITEMS_RECIPES" Width="1.5" PointX="5.25" PointY="21.375" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="9" PointY="9.125" /> + <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="9" PointY="31.375" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="6.75" PointY="41.875" /> + <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="11.25" PointY="28.875" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="15" PointY="8.875" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="17.25" PointY="8.25" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="6.75" PointY="38.875" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="14.25" PointY="13" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="17.375" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="14.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="6.75" PointY="17.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="9" PointY="36.875" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="9.75" PointY="52.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="12" PointY="40" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="15.75" PointY="48.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="18" PointY="40.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="12.75" PointY="44.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="15" PointY="30" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="15.75" PointY="44.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="18" PointY="32.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="9.75" PointY="48.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="12" PointY="36" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="6.75" PointY="31.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="12.75" PointY="48.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="15" PointY="40.125" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="17.25" PointY="12.5" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="19.5" PointY="12.5" /> + <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="3.75" PointY="1.875" /> + <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="13.5" PointY="18" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="25.25" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="14.25" PointY="3.875" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="8.25" PointY="21.625" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="13.5" PointY="51.75" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="9" PointY="5.875" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="11.25" PointY="18.375" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="16.5" PointY="16.25" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="21.875" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="28.125" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="34.375" /> + <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="17.25" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="9" PointY="44" /> + <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="20.25" PointY="32.75" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="52.25" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="53.875" /> + <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="18.5" /> + <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="20.25" PointY="3.625" /> + <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="22.5" PointY="3.75" /> + <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="15.75" PointY="25.625" /> + <EntityTypeShape EntityType="RemoteModel.SITE" Width="1.5" PointX="5.75" PointY="1.875" /> + <EntityTypeShape EntityType="RemoteModel.SITES_CATALOGS" Width="1.5" PointX="5.75" PointY="4.875" /> + <EntityTypeShape EntityType="RemoteModel.SITES_RMLS" Width="1.5" PointX="5.75" PointY="7.875" /> + <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="9" PointY="26.875" /> + <EntityTypeShape EntityType="RemoteModel.SPOOL" Width="1.5" PointX="19.5" PointY="18.375" /> + <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="7.75" PointY="1.875" /> + <EntityTypeShape EntityType="RemoteModel.TANGO_UPDATES" Width="1.5" PointX="5.75" PointY="10.875" /> + <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="19.5" PointY="7.875" /> + <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="9.75" PointY="1.875" /> + <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="11.75" PointY="8.875" /> + <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="7.75" PointY="13.875" /> + <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="21.75" PointY="7.875" /> + <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="21.75" PointY="16.875" /> + <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="2.75" PointY="14.875" /> + <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="11.25" PointY="12.625" /> + <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="22.5" PointY="13.75" /> + <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="11.25" PointY="32" /> <AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" /> <AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" /> <AssociationConnector Association="RemoteModel.FK_CONFIGURATIONS_APPLICATION_DISPLAY_PANEL_VERSIONS" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_UPDATES.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_UPDATES.cs index d91e9920c..b591f562c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_UPDATES.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_UPDATES.cs @@ -25,5 +25,6 @@ namespace Tango.DAL.Remote.DB public string FAILED_LOG { get; set; } public System.DateTime START_DATE { get; set; } public Nullable<System.DateTime> END_DATE { get; set; } + public bool IS_SYNCHRONIZED { get; set; } } } diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 77b3a180f..4bde9148a 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -107,6 +107,7 @@ namespace Tango.MachineService.Controllers var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); response.Version = latest_machine_version.Version; + response.FirmwareVersion = latest_machine_version.FirmwareVersion; var manager = new BlobStorageManager(); var container = manager.GetContainer(MachineServiceConfig.TANGO_VERSIONS_CONTAINER); @@ -195,6 +196,7 @@ namespace Tango.MachineService.Controllers var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); response.Version = latest_machine_version.Version; + response.FirmwareVersion = latest_machine_version.FirmwareVersion; var manager = new BlobStorageManager(); var container = manager.GetContainer(MachineServiceConfig.TANGO_VERSIONS_CONTAINER); @@ -313,6 +315,7 @@ namespace Tango.MachineService.Controllers } response.Version = latest_machine_version.Version; + response.FirmwareVersion = latest_machine_version.FirmwareVersion; //Compare database @@ -588,6 +591,34 @@ namespace Tango.MachineService.Controllers } } } + + //Insert TangoUpdates. + foreach (var dto in request.OfflineUpdates) + { + using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + { + try + { + var update = dto.ToObservable(); + update.ID = 0; + update.IsSynchronized = true; + + if (db.TangoUpdates.SingleOrDefault(x => x.Guid == update.Guid) == null) + { + db.TangoUpdates.Add(update); + db.SaveChanges(); + } + } + catch (Exception ex) + { + response.FailedOfflineUpdates.Add(new SynchronizationFailedEntity() + { + Guid = dto.Guid, + Reason = ex.FlattenMessage(), + }); + } + } + } } catch (Exception ex) { |
