From 2f91af8a799782b821acf4e66c84ea7aefa27048 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 30 Oct 2019 16:31:07 +0200 Subject: Added firmware version to TANGO_VERSIONS. Added total version info to TUP file as 'version.json'. --- .../Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpload.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Models') diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpload.cs b/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpload.cs index b97d8b6c8..408fd74dc 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpload.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpload.cs @@ -11,6 +11,8 @@ namespace Tango.MachineService.Models public String Version { get; set; } + public String FirmwareVersion { get; set; } + public String UserGuid { get; set; } public String Comments { get; set; } -- cgit v1.3.1 From 242cb9fd566647406792d63547b61ec1d6a5f3bc Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 28 Nov 2019 16:12:39 +0200 Subject: Added PPC pending updates... --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 4 +- .../Tango.PPC.Common/Web/DownloadUpdateResponse.cs | 2 + .../Tango.PPC.Common/Web/MachineSetupResponse.cs | 2 + .../Web/MachineUpdateCompletedRequest.cs | 18 ++ .../Web/MachineUpdateCompletedResponse.cs | 15 + .../PPC/Tango.PPC.Common/Web/UpdateDBResponse.cs | 1 + .../Tango alarm events handling chart_Rev12.xlsx | Bin 0 -> 54281 bytes .../Visual_Studio/Tango.BL/DTO/TangoUpdateDTO.cs | 14 + .../Tango.BL/DTO/TangoUpdateDTOBase.cs | 89 ++++++ .../Visual_Studio/Tango.BL/Entities/TangoUpdate.cs | 31 ++ .../Tango.BL/Entities/TangoUpdateBase.cs | 327 +++++++++++++++++++++ .../Tango.BL/Enumerations/TangoUpdateStatuses.cs | 23 ++ .../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 | 55 +++- .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 147 ++++----- .../Tango.DAL.Remote/DB/TANGO_UPDATES.cs | 29 ++ .../Tango.DAL.Remote/Tango.DAL.Remote.csproj | 5 +- .../Tango.EventsTypesGenerator/Program.cs | 18 +- .../Tango.EventsTypesGenerator.csproj | 4 + .../Controllers/PPCController.cs | 94 +++++- .../Models/PPCPendingUpdate.cs | 13 + .../Tango.MachineService.csproj | 3 +- 28 files changed, 901 insertions(+), 85 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineUpdateCompletedRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineUpdateCompletedResponse.cs create mode 100644 Software/Visual_Studio/Resources/Tango alarm events handling chart_Rev12.xlsx create mode 100644 Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTO.cs create mode 100644 Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTOBase.cs create mode 100644 Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs create mode 100644 Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs create mode 100644 Software/Visual_Studio/Tango.BL/Enumerations/TangoUpdateStatuses.cs create mode 100644 Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_UPDATES.cs create mode 100644 Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpdate.cs (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Models') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 333cea67e..51d66c795 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 7ea023205..11fa7fe18 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 6375140d7..e7124634f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -167,11 +167,13 @@ + + @@ -393,7 +395,7 @@ - + \ No newline at end of file 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 3b09c1525..4396ce67a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateResponse.cs @@ -10,6 +10,8 @@ namespace Tango.PPC.Common.Web { public class DownloadUpdateResponse : WebResponseMessage { + public String NotifyCompletedToken { get; set; } + public String Version { get; set; } public String BlobAddress { 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 b5a4c425d..73cdc8609 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs @@ -10,6 +10,8 @@ namespace Tango.PPC.Common.Web { public class MachineSetupResponse : WebResponseMessage { + public String NotifyCompletedToken { get; set; } + public String Version { get; set; } public String BlobAddress { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineUpdateCompletedRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineUpdateCompletedRequest.cs new file mode 100644 index 000000000..63cfed824 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineUpdateCompletedRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.Web +{ + public class MachineUpdateCompletedRequest : WebRequestMessage + { + public String Token { get; set; } + public TangoUpdateStatuses Status { get; set; } + public String FailedReason { get; set; } + public String FailedLog { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineUpdateCompletedResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineUpdateCompletedResponse.cs new file mode 100644 index 000000000..1017ffdb2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineUpdateCompletedResponse.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.Web +{ + public class MachineUpdateCompletedResponse : WebResponseMessage + { + public String ReportBlobAddress { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBResponse.cs index be7c0d076..179cb7934 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBResponse.cs @@ -10,6 +10,7 @@ namespace Tango.PPC.Common.Web { public class UpdateDBResponse : WebResponseMessage { + public String NotifyCompletedToken { get; set; } public DataSource DataSource { get; set; } public bool PerformSchemaUpdate { get; set; } } diff --git a/Software/Visual_Studio/Resources/Tango alarm events handling chart_Rev12.xlsx b/Software/Visual_Studio/Resources/Tango alarm events handling chart_Rev12.xlsx new file mode 100644 index 000000000..3d79ca650 Binary files /dev/null and b/Software/Visual_Studio/Resources/Tango alarm events handling chart_Rev12.xlsx differ diff --git a/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTO.cs new file mode 100644 index 000000000..97b53746f --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTO.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 TangoUpdateDTO : TangoUpdateDTOBase + { + + } +} diff --git a/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTOBase.cs new file mode 100644 index 000000000..5eb16841c --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/DTO/TangoUpdateDTOBase.cs @@ -0,0 +1,89 @@ + +//------------------------------------------------------------------------------ +// +// 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 TangoUpdateDTOBase : ObservableEntityDTO + { + + /// + /// application version + /// + public String ApplicationVersion + { + get; set; + } + + /// + /// firmware version + /// + public String FirmwareVersion + { + get; set; + } + + /// + /// machine guid + /// + public String MachineGuid + { + get; set; + } + + /// + /// status + /// + public Int32 Status + { + get; set; + } + + /// + /// failed reason + /// + public String FailedReason + { + get; set; + } + + /// + /// failed log + /// + public String FailedLog + { + get; set; + } + + /// + /// start date + /// + public DateTime StartDate + { + get; set; + } + + /// + /// end date + /// + public Nullable EndDate + { + get; set; + } + + } +} diff --git a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs new file mode 100644 index 000000000..86908ee6b --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdate.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; + +namespace Tango.BL.Entities +{ + public class TangoUpdate : TangoUpdateBase + { + public TangoUpdateStatuses UpdateStatus + { + get + { + return (TangoUpdateStatuses)Status; + } + set + { + Status = (int)value; + RaisePropertyChangedAuto(); + } + } + + protected override void OnStatusChanged(int status) + { + base.OnStatusChanged(status); + RaisePropertyChanged(nameof(UpdateStatus)); + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs new file mode 100644 index 000000000..9f75b0021 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs @@ -0,0 +1,327 @@ +//------------------------------------------------------------------------------ +// +// 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("TANGO_UPDATES")] + public abstract class TangoUpdateBase : ObservableEntity + { + + public event EventHandler ApplicationVersionChanged; + + public event EventHandler FirmwareVersionChanged; + + public event EventHandler StatusChanged; + + public event EventHandler FailedReasonChanged; + + public event EventHandler FailedLogChanged; + + public event EventHandler StartDateChanged; + + public event EventHandler> EndDateChanged; + + protected String _applicationversion; + + /// + /// Gets or sets the tangoupdatebase application version. + /// + + [Column("APPLICATION_VERSION")] + + public String ApplicationVersion + { + get + { + return _applicationversion; + } + + set + { + if (_applicationversion != value) + { + _applicationversion = value; + + OnApplicationVersionChanged(value); + + } + } + } + + protected String _firmwareversion; + + /// + /// Gets or sets the tangoupdatebase firmware version. + /// + + [Column("FIRMWARE_VERSION")] + + public String FirmwareVersion + { + get + { + return _firmwareversion; + } + + set + { + if (_firmwareversion != value) + { + _firmwareversion = value; + + OnFirmwareVersionChanged(value); + + } + } + } + + protected String _machineguid; + + /// + /// Gets or sets the tangoupdatebase machine guid. + /// + + [Column("MACHINE_GUID")] + + public String MachineGuid + { + get + { + return _machineguid; + } + + set + { + if (_machineguid != value) + { + _machineguid = value; + + } + } + } + + protected Int32 _status; + + /// + /// Gets or sets the tangoupdatebase status. + /// + + [Column("STATUS")] + + public Int32 Status + { + get + { + return _status; + } + + set + { + if (_status != value) + { + _status = value; + + OnStatusChanged(value); + + } + } + } + + protected String _failedreason; + + /// + /// Gets or sets the tangoupdatebase failed reason. + /// + + [Column("FAILED_REASON")] + + public String FailedReason + { + get + { + return _failedreason; + } + + set + { + if (_failedreason != value) + { + _failedreason = value; + + OnFailedReasonChanged(value); + + } + } + } + + protected String _failedlog; + + /// + /// Gets or sets the tangoupdatebase failed log. + /// + + [Column("FAILED_LOG")] + + public String FailedLog + { + get + { + return _failedlog; + } + + set + { + if (_failedlog != value) + { + _failedlog = value; + + OnFailedLogChanged(value); + + } + } + } + + protected DateTime _startdate; + + /// + /// Gets or sets the tangoupdatebase start date. + /// + + [Column("START_DATE")] + + public DateTime StartDate + { + get + { + return _startdate; + } + + set + { + if (_startdate != value) + { + _startdate = value; + + OnStartDateChanged(value); + + } + } + } + + protected Nullable _enddate; + + /// + /// Gets or sets the tangoupdatebase end date. + /// + + [Column("END_DATE")] + + public Nullable EndDate + { + get + { + return _enddate; + } + + set + { + if (_enddate != value) + { + _enddate = value; + + OnEndDateChanged(value); + + } + } + } + + /// + /// Called when the ApplicationVersion has changed. + /// + protected virtual void OnApplicationVersionChanged(String applicationversion) + { + ApplicationVersionChanged?.Invoke(this, applicationversion); + RaisePropertyChanged(nameof(ApplicationVersion)); + } + + /// + /// Called when the FirmwareVersion has changed. + /// + protected virtual void OnFirmwareVersionChanged(String firmwareversion) + { + FirmwareVersionChanged?.Invoke(this, firmwareversion); + RaisePropertyChanged(nameof(FirmwareVersion)); + } + + /// + /// Called when the Status has changed. + /// + protected virtual void OnStatusChanged(Int32 status) + { + StatusChanged?.Invoke(this, status); + RaisePropertyChanged(nameof(Status)); + } + + /// + /// Called when the FailedReason has changed. + /// + protected virtual void OnFailedReasonChanged(String failedreason) + { + FailedReasonChanged?.Invoke(this, failedreason); + RaisePropertyChanged(nameof(FailedReason)); + } + + /// + /// Called when the FailedLog has changed. + /// + protected virtual void OnFailedLogChanged(String failedlog) + { + FailedLogChanged?.Invoke(this, failedlog); + RaisePropertyChanged(nameof(FailedLog)); + } + + /// + /// Called when the StartDate has changed. + /// + protected virtual void OnStartDateChanged(DateTime startdate) + { + StartDateChanged?.Invoke(this, startdate); + RaisePropertyChanged(nameof(StartDate)); + } + + /// + /// Called when the EndDate has changed. + /// + protected virtual void OnEndDateChanged(Nullable enddate) + { + EndDateChanged?.Invoke(this, enddate); + RaisePropertyChanged(nameof(EndDate)); + } + + /// + /// Initializes a new instance of the class. + /// + public TangoUpdateBase() : base() + { + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TangoUpdateStatuses.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TangoUpdateStatuses.cs new file mode 100644 index 000000000..ee657e0a9 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TangoUpdateStatuses.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.Enumerations +{ + public enum TangoUpdateStatuses + { + SetupStarted = 0, + SetupCompleted = 1, + SetupFailed = 2, + + UpdateStarted = 100, + UpdateCompleted = 101, + UpdateFailed = 102, + + DatabaseStarted = 200, + DatabaseCompleted = 201, + DatabaseFailed = 202, + } +} diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs index 9a7816eee..5e75822ab 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs @@ -534,6 +534,14 @@ namespace Tango.BL get; set; } + /// + /// Gets or sets the TangoUpdates. + /// + public DbSet TangoUpdates + { + get; set; + } + /// /// Gets or sets the TangoVersions. /// diff --git a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs index 90b4f0bc8..c6b9bfb9f 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs @@ -2321,6 +2321,42 @@ namespace Tango.BL } + private ObservableCollection _tangoupdates; + /// + /// Gets or sets the TangoUpdates. + /// + public ObservableCollection TangoUpdates + { + get + { + return _tangoupdates; + } + + set + { + _tangoupdates = value; RaisePropertyChanged(nameof(TangoUpdates)); + } + + } + + private ICollectionView _tangoupdatesViewSource; + /// + /// Gets or sets the TangoUpdates View Source. + /// + public ICollectionView TangoUpdatesViewSource + { + get + { + return _tangoupdatesViewSource; + } + + set + { + _tangoupdatesViewSource = value; RaisePropertyChanged(nameof(TangoUpdatesViewSource)); + } + + } + private ObservableCollection _tangoversions; /// /// Gets or sets the TangoVersions. @@ -2815,6 +2851,8 @@ namespace Tango.BL SysdiagramsViewSource = CreateCollectionView(Sysdiagrams); + TangoUpdatesViewSource = CreateCollectionView(TangoUpdates); + TangoVersionsViewSource = CreateCollectionView(TangoVersions); TechControllersViewSource = CreateCollectionView(TechControllers); diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs index ae6aee8ba..f5054f89d 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs @@ -2321,6 +2321,42 @@ namespace Tango.BL } + private ObservableCollection _tangoupdates; + /// + /// Gets or sets the TangoUpdates. + /// + public ObservableCollection TangoUpdates + { + get + { + return _tangoupdates; + } + + set + { + _tangoupdates = value; RaisePropertyChanged(nameof(TangoUpdates)); + } + + } + + private ICollectionView _tangoupdatesViewSource; + /// + /// Gets or sets the TangoUpdates View Source. + /// + public ICollectionView TangoUpdatesViewSource + { + get + { + return _tangoupdatesViewSource; + } + + set + { + _tangoupdatesViewSource = value; RaisePropertyChanged(nameof(TangoUpdatesViewSource)); + } + + } + private ObservableCollection _tangoversions; /// /// Gets or sets the TangoVersions. @@ -2815,6 +2851,8 @@ namespace Tango.BL SysdiagramsViewSource = CreateCollectionView(Sysdiagrams); + TangoUpdatesViewSource = CreateCollectionView(TangoUpdates); + TangoVersionsViewSource = CreateCollectionView(TangoVersions); TechControllersViewSource = CreateCollectionView(TechControllers); diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index 4d2c7ddd9..2bca408a4 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -239,6 +239,8 @@ + + @@ -336,6 +338,8 @@ + + @@ -352,6 +356,7 @@ + @@ -560,7 +565,7 @@ - + \ No newline at end of file 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 a1cc4d407..b24e297ca 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs @@ -89,6 +89,7 @@ namespace Tango.DAL.Remote.DB public virtual DbSet SPOOL_TYPES { get; set; } public virtual DbSet SPOOLS { get; set; } public virtual DbSet sysdiagrams { get; set; } + public virtual DbSet TANGO_UPDATES { get; set; } public virtual DbSet TANGO_VERSIONS { get; set; } public virtual DbSet TECH_CONTROLLERS { get; set; } public virtual DbSet TECH_DISPENSERS { 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 19fb2c9fc..8607b9f07 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -963,6 +963,22 @@ + + + + + + + + + + + + + + + + @@ -971,7 +987,7 @@ - + @@ -2223,6 +2239,7 @@ + @@ -2631,6 +2648,7 @@ + @@ -4079,6 +4097,22 @@ + + + + + + + + + + + + + + + + @@ -4087,7 +4121,7 @@ - + @@ -6315,6 +6349,23 @@ + + + + + + + + + + + + + + + + + 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 79b65efb0..c0574cb9e 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,79 +5,80 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_UPDATES.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_UPDATES.cs new file mode 100644 index 000000000..d91e9920c --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_UPDATES.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// 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 TANGO_UPDATES + { + public int ID { get; set; } + public string GUID { get; set; } + public System.DateTime LAST_UPDATED { get; set; } + public string APPLICATION_VERSION { get; set; } + public string FIRMWARE_VERSION { get; set; } + public string MACHINE_GUID { get; set; } + public int STATUS { get; set; } + public string FAILED_REASON { get; set; } + public string FAILED_LOG { get; set; } + public System.DateTime START_DATE { get; set; } + public Nullable END_DATE { 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 b6b4d18c8..a7e392def 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj +++ b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj @@ -273,6 +273,9 @@ RemoteADO.tt + + RemoteADO.tt + RemoteADO.tt @@ -353,7 +356,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Program.cs b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Program.cs index 83440291c..033797765 100644 --- a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Program.cs @@ -16,7 +16,7 @@ namespace Tango.EventsTypesGenerator { class Program { - private static string EVENTS_FILE = "Tango alarm events handling chart_Rev11.xlsx"; + private static string EVENTS_FILE = "Tango alarm events handling chart_Rev12.xlsx"; private class ExcelEventType { @@ -47,6 +47,22 @@ namespace Tango.EventsTypesGenerator ExcelReader reader = new ExcelReader(PathHelper.GetStartupPath() + "\\" + EVENTS_FILE); var results = reader.GetDataByIndex("ALARM EVENTS HANDLING", 2); + //First validate excel + foreach (var evx in results) + { + try + { + EventType te = new EventType(); + MapExcelEventToEventType(evx, te); + } + catch (Exception ex) + { + Console.WriteLine($"Invalid record found\n{evx.ToString()}\n\n{ex}"); + Console.ReadLine(); + return; + } + } + using (ObservablesContext db = ObservablesContext.CreateDefault()) { foreach (var evx in results) diff --git a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Tango.EventsTypesGenerator.csproj b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Tango.EventsTypesGenerator.csproj index 49baaab15..c92f4e62f 100644 --- a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Tango.EventsTypesGenerator.csproj +++ b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Tango.EventsTypesGenerator.csproj @@ -60,6 +60,10 @@ Tango alarm events handling chart_Rev11.xlsx PreserveNewest + + Tango alarm events handling chart_Rev12.xlsx + PreserveNewest + diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index a77212787..4c39aad80 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -30,7 +30,9 @@ namespace Tango.MachineService.Controllers public class PPCController : TangoController { private static List _pendingUploads; + private static List _pendingUpdates; private ActiveDirectoryManager _ad_manager; + private const int SQL_TEMP_CREDENTIALS_EXP_MINUTS = 20; public class TokenObject { @@ -44,6 +46,7 @@ namespace Tango.MachineService.Controllers static PPCController() { _pendingUploads = new List(); + _pendingUpdates = new List(); } public PPCController() @@ -60,6 +63,7 @@ namespace Tango.MachineService.Controllers public MachineSetupResponse MachineSetup(MachineSetupRequest request) { MachineSetupResponse response = new MachineSetupResponse(); + response.NotifyCompletedToken = Guid.NewGuid().ToString(); LogManager.Log("Setup request received: " + request.ToString()); @@ -98,8 +102,6 @@ namespace Tango.MachineService.Controllers machine.DeviceId = request.DeviceID; machine.IsDeviceRegistered = true; - db.SaveChanges(); - var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); @@ -118,7 +120,7 @@ namespace Tango.MachineService.Controllers { credentials = smo.CreateRandomLoginAndUser(); - Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith((x) => + Task.Delay(TimeSpan.FromMinutes(SQL_TEMP_CREDENTIALS_EXP_MINUTS)).ContinueWith((x) => { using (SmoManager m = new SmoManager()) { @@ -143,6 +145,22 @@ namespace Tango.MachineService.Controllers response.SetupUWF = machine.SetupUwf; response.SetupFirmware = machine.SetupFirmware; response.IsDemo = machine.IsDemo; + + TangoUpdate tangoUpdate = new TangoUpdate(); + tangoUpdate.ApplicationVersion = latest_machine_version.Version; + tangoUpdate.FirmwareVersion = latest_machine_version.FirmwareVersion; + tangoUpdate.MachineGuid = machine.Guid; + tangoUpdate.StartDate = DateTime.UtcNow; + tangoUpdate.UpdateStatus = TangoUpdateStatuses.SetupStarted; + db.TangoUpdates.Add(tangoUpdate); + + db.SaveChanges(); + + _pendingUpdates.Add(new PPCPendingUpdate() + { + Token = response.NotifyCompletedToken, + TangoUpdateGuid = tangoUpdate.Guid, + }); } return response; @@ -153,6 +171,7 @@ namespace Tango.MachineService.Controllers public DownloadUpdateResponse MachineUpdate(DownloadUpdateRequest request) { DownloadUpdateResponse response = new DownloadUpdateResponse(); + response.NotifyCompletedToken = Guid.NewGuid().ToString(); using (ObservablesContext db = ObservablesContextHelper.CreateContext()) { @@ -184,7 +203,7 @@ namespace Tango.MachineService.Controllers { credentials = smo.CreateRandomLoginAndUser(); - Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith((x) => + Task.Delay(TimeSpan.FromMinutes(SQL_TEMP_CREDENTIALS_EXP_MINUTS)).ContinueWith((x) => { using (SmoManager m = new SmoManager()) { @@ -202,11 +221,56 @@ namespace Tango.MachineService.Controllers IntegratedSecurity = false, Type = DataSourceType.SQLServer, }; + + TangoUpdate tangoUpdate = new TangoUpdate(); + tangoUpdate.ApplicationVersion = latest_machine_version.Version; + tangoUpdate.FirmwareVersion = latest_machine_version.FirmwareVersion; + tangoUpdate.MachineGuid = machine.Guid; + tangoUpdate.StartDate = DateTime.UtcNow; + tangoUpdate.UpdateStatus = TangoUpdateStatuses.UpdateStarted; + db.TangoUpdates.Add(tangoUpdate); + + db.SaveChanges(); + + _pendingUpdates.Add(new PPCPendingUpdate() + { + Token = response.NotifyCompletedToken, + TangoUpdateGuid = tangoUpdate.Guid, + }); } return response; } + [HttpPost] + [JwtTokenFilter] + public MachineUpdateCompletedResponse NotifyUpdateCompleted(MachineUpdateCompletedRequest request) + { + var pendingUpdate = _pendingUpdates.SingleOrDefault(x => x.Token == request.Token); + if (pendingUpdate != null) + { + _pendingUpdates.Remove(pendingUpdate); + + using (ObservablesContext db = ObservablesContextHelper.CreateContext()) + { + var tangoUpdate = db.TangoUpdates.SingleOrDefault(x => x.Guid == pendingUpdate.TangoUpdateGuid); + + if (tangoUpdate != null) + { + tangoUpdate.LastUpdated = DateTime.UtcNow; + tangoUpdate.UpdateStatus = request.Status; + tangoUpdate.EndDate = DateTime.UtcNow; + tangoUpdate.FailedReason = request.FailedReason; + tangoUpdate.FailedLog = request.FailedLog; + + db.SaveChanges(); + } + } + } + + return new MachineUpdateCompletedResponse(); + } + [HttpPost] [JwtTokenFilter] public CheckForUpdateResponse CheckForUpdates(CheckForUpdateRequest request) @@ -255,6 +319,7 @@ namespace Tango.MachineService.Controllers public UpdateDBResponse UpdateDB(UpdateDBRequest request) { UpdateDBResponse response = new UpdateDBResponse(); + response.NotifyCompletedToken = Guid.NewGuid().ToString(); using (ObservablesContext db = ObservablesContextHelper.CreateContext()) { @@ -276,7 +341,7 @@ namespace Tango.MachineService.Controllers { credentials = manager.CreateRandomLoginAndUser(); - Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith((x) => + Task.Delay(TimeSpan.FromMinutes(SQL_TEMP_CREDENTIALS_EXP_MINUTS)).ContinueWith((x) => { using (SmoManager m = new SmoManager()) { @@ -294,6 +359,25 @@ namespace Tango.MachineService.Controllers IntegratedSecurity = false, Type = DataSourceType.SQLServer, }; + + var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); + var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); + + TangoUpdate tangoUpdate = new TangoUpdate(); + tangoUpdate.ApplicationVersion = latest_machine_version.Version; + tangoUpdate.FirmwareVersion = latest_machine_version.FirmwareVersion; + tangoUpdate.MachineGuid = machine.Guid; + tangoUpdate.StartDate = DateTime.UtcNow; + tangoUpdate.UpdateStatus = TangoUpdateStatuses.DatabaseStarted; + db.TangoUpdates.Add(tangoUpdate); + + db.SaveChanges(); + + _pendingUpdates.Add(new PPCPendingUpdate() + { + Token = response.NotifyCompletedToken, + TangoUpdateGuid = tangoUpdate.Guid, + }); } return response; diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpdate.cs b/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpdate.cs new file mode 100644 index 000000000..12504a1a5 --- /dev/null +++ b/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpdate.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Tango.MachineService.Models +{ + public class PPCPendingUpdate + { + public String Token { get; set; } + public String TangoUpdateGuid { get; set; } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj index 2c20fdadb..56ca19e96 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj +++ b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj @@ -288,6 +288,7 @@ + @@ -420,7 +421,7 @@ False - + -- cgit v1.3.1