From 305a8e79c4b80f0c8578605ceff9514dd04d99d7 Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 20 Jul 2023 20:52:11 +0300 Subject: JOB RESUME BASICS --- .../Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs | 83 +++++++++ .../Tango.PPC.JobsV2/Resume/JobResumeModel.cs | 21 +++ .../Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj | 4 +- .../Tango.PPC.JobsV2/ViewModels/JobViewVM.cs | 185 ++++++++++++++++----- .../Tango.PPC.JobsV2/Views/JobEurekaView.xaml | 13 +- 5 files changed, 263 insertions(+), 43 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeModel.cs (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs new file mode 100644 index 000000000..b2dcffcdd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs @@ -0,0 +1,83 @@ +using LiteDB; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Jobs.Resume +{ + public class JobResumeDB : IDisposable + { + private LiteDatabase _db; + private ILiteCollection _collection; + + private static Lazy _default = new Lazy(() => new JobResumeDB()); + + public static JobResumeDB Default + { + get + { + return _default.Value; + } + } + + private JobResumeDB() + { + Init(); + } + + private void Init() + { + String dbFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Job Resume v2"); + Directory.CreateDirectory(dbFolder); + _db = new LiteDatabase($"Filename={Path.Combine(dbFolder, "job_resume.db")}"); + _collection = _db.GetCollection("JobResume"); + } + + public void Update(JobResumeModel model) + { + _collection.Update(model); + } + + public void Add(JobResumeModel model) + { + _collection.Insert(model); + } + + public List GetAll() + { + return _collection.FindAll().ToList(); + } + + public JobResumeModel Get(String jobGuild) + { + return _collection.FindOne(x => x.JobGuid == jobGuild); + } + + public void Delete(JobResumeModel model) + { + _collection.Delete(model.JobGuid); + } + + public void Delete(String jobGuid) + { + _collection.Delete(jobGuid); + } + + ~JobResumeDB() + { + Dispose(); + } + + public void Dispose() + { + try + { + _db?.Dispose(); + } + catch { } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeModel.cs new file mode 100644 index 000000000..4ded7e313 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeModel.cs @@ -0,0 +1,21 @@ +using LiteDB; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Jobs.Resume +{ + public class JobResumeModel + { + [BsonId] + public String JobGuid { get; set; } + + public int RemainingUnits { get; set; } + + public double GlobalStartPosition { get; set; } + + public double FirstUnitStartPosition { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj index 3aefa29a1..a55f1c91e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj @@ -351,6 +351,8 @@ ColorCorrectionReport.xaml + + @@ -754,7 +756,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index 14a09fe57..6b8a5169e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -46,6 +46,8 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Tango.PPC.Jobs.ColorCorrectionTool; using Tango.PPC.Common.Printing; +using Tango.PPC.Jobs.Resume; +using Tango.Core.ExtensionMethods; namespace Tango.PPC.Jobs.ViewModels { @@ -229,12 +231,12 @@ namespace Tango.PPC.Jobs.ViewModels get { return _isBasicMode; } set { - if(_isBasicMode != value) - { - if(value == true && JobModel != null && JobModel.Segments.Count > 0) + if (_isBasicMode != value) + { + if (value == true && JobModel != null && JobModel.Segments.Count > 0) { var firstSegment = JobModel.Segments.Where(x => x.SegmentIndex == 1).FirstOrDefault(); - if(JobModel.Segments.Count > 1 || firstSegment.IsGradient ) + if (JobModel.Segments.Count > 1 || firstSegment.IsGradient) { SetOrDiscardAll(); return; @@ -262,11 +264,12 @@ namespace Tango.PPC.Jobs.ViewModels public bool IsWeightView { get { return _isWeigthView; } - set { - if(_isWeigthView != value) + set + { + if (_isWeigthView != value) { _isWeigthView = value; - + RaisePropertyChangedAuto(); } } @@ -277,10 +280,24 @@ namespace Tango.PPC.Jobs.ViewModels public bool ShowAdvanced { get { return _showAdvanced; } - set { _showAdvanced = value; - RaisePropertyChangedAuto();} + set + { + _showAdvanced = value; + RaisePropertyChangedAuto(); + } + } + + private JobResumeModel _resumeModel; + public JobResumeModel ResumeModel + { + get { return _resumeModel; } + set { _resumeModel = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasResumeModel)); } } + public bool HasResumeModel + { + get { return ResumeModel != null; } + } #endregion @@ -336,7 +353,7 @@ namespace Tango.PPC.Jobs.ViewModels public RelayCommand DeleteSegmentsGroupCommand { get; set; } public RelayCommand RepeatSegmentsGroupCommand { get; set; } - public RelayCommand NavigateBackToJobs { get; set; } + public RelayCommand NavigateBackToJobs { get; set; } #endregion @@ -417,13 +434,13 @@ namespace Tango.PPC.Jobs.ViewModels _not_show_warning = false; } - #endregion + #endregion #region Job Management /// - /// Loads the job. - /// + /// Loads the job. + /// private async void LoadJob() { try @@ -480,6 +497,20 @@ namespace Tango.PPC.Jobs.ViewModels .WithSegmentsGroups() .BuildAsync(); + try + { + ResumeModel = JobResumeDB.Default.Get(Job.Guid); + + if (ResumeModel != null) + { + LogManager.Log($"Job resume info found:\n{ResumeModel.ToJsonString()}"); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error retrieving job resume info from db."); + } + RaisePropertyChanged(nameof(CanEdit)); Job.NameChanged -= Job_NameChanged; @@ -506,12 +537,12 @@ namespace Tango.PPC.Jobs.ViewModels RaisePropertyChanged(nameof(SelectedRML)); await LoadRML(_selectedRML); - if(BuildProvider.IsEureka && Job.Segments.Count <= 1) + if (BuildProvider.IsEureka && Job.Segments.Count <= 1) { IsBasicMode = true; } else IsBasicMode = false; - IsWeightView = false; + IsWeightView = false; LoadJobModel(); @@ -592,7 +623,7 @@ namespace Tango.PPC.Jobs.ViewModels JobType = Job.JobType, InterSegmentLength = Job.InterSegmentLength, EnableInterSegment = Job.EnableInterSegment, - NumberSpools = (BuildProvider.IsEureka? Job.Spools : 1), + NumberSpools = (BuildProvider.IsEureka ? Job.Spools : 1), Copies = (BuildProvider.IsEureka ? Job.NumberOfUnits * Job.Spools : Job.NumberOfUnits) }; Dictionary guidToGroup = new Dictionary(); @@ -725,7 +756,17 @@ namespace Tango.PPC.Jobs.ViewModels startingJob = true; LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); await Save(); - var handler = await PrintingManager.Print(Job, _db, new PrintingConfiguration() { }); + + var printConfig = new PrintingConfiguration(); + + if (HasResumeModel) + { + printConfig.FirstUnitStartPosition = ResumeModel.FirstUnitStartPosition; + printConfig.GlobalStartPosition = ResumeModel.GlobalStartPosition; + printConfig.RemainingUnits = ResumeModel.RemainingUnits; + } + + var handler = await PrintingManager.Print(Job, _db, printConfig); RaisePropertyChanged(nameof(CanEdit)); @@ -923,7 +964,7 @@ namespace Tango.PPC.Jobs.ViewModels .WithSpools() .BuildAsync(); if (JobModel != null) - { + { JobModel.Rml = Job.Rml; } @@ -936,7 +977,7 @@ namespace Tango.PPC.Jobs.ViewModels { innerSegment.UpdateWeightOnRMLChange(IsWeightView); innerSegment.UpdateBrushStops(); - + } else if (segment is SegmentsGroupModel group) { @@ -1275,21 +1316,6 @@ namespace Tango.PPC.Jobs.ViewModels MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; } - private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) - { - RaisePropertyChanged(nameof(CanEdit)); - } - - private void MachineOperator_PrintingEnded(object sender, Integration.Operation.PrintingEventArgs e) - { - if (IsVisible) - { - _start_printing_btn.Push(); - } - - RaisePropertyChanged(nameof(CanEdit)); - } - /// /// Called when the navigation system has navigated to this VM view. /// @@ -1362,14 +1388,14 @@ namespace Tango.PPC.Jobs.ViewModels private async void NavigateBack() { - if (IsFree ) + if (IsFree) { - if(await OnNavigateBackRequest()) + if (await OnNavigateBackRequest()) { LogManager.Log("Back command to Jobs pressed."); await NavigationManager.NavigateTo(nameof(JobsView)); } - + } } @@ -1490,11 +1516,11 @@ namespace Tango.PPC.Jobs.ViewModels DyeCommand.RaiseCanExecuteChanged(); } - private void SetOrDiscardAll() + private void SetOrDiscardAll() { InvokeUI(async () => { - IsBasicMode = await MessageDiscardAllChanges(); + IsBasicMode = await MessageDiscardAllChanges(); }); } @@ -1509,7 +1535,7 @@ namespace Tango.PPC.Jobs.ViewModels { //delete all var segments = JobModel.OrderedSegmentsWithGroups; - var firstSegment = JobModel.Segments.Where(x=>x.SegmentIndex == 1).FirstOrDefault(); + var firstSegment = JobModel.Segments.Where(x => x.SegmentIndex == 1).FirstOrDefault(); firstSegment.SegmentsGroupModel = null; JobModel.GroupingSegments.Clear(); JobModel.Segments.Clear(); @@ -1522,7 +1548,7 @@ namespace Tango.PPC.Jobs.ViewModels firstSegment.BrushStops.Add(firstbrush); firstSegment.ArrangeBrushStopsIndexes(); } - + return true; } return false; @@ -1737,5 +1763,82 @@ namespace Tango.PPC.Jobs.ViewModels } #endregion + + #region Machine Operator Events + + private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) + { + RaisePropertyChanged(nameof(CanEdit)); + } + + private void MachineOperator_PrintingEnded(object sender, Integration.Operation.PrintingEventArgs e) + { + if (IsVisible) + { + _start_printing_btn.Push(); + } + + RaisePropertyChanged(nameof(CanEdit)); + + UpdateJobResume(e); + } + + + #endregion + + #region Resume + + private void UpdateJobResume(PrintingEventArgs e) + { + try + { + if (!e.JobHandler.Status.IsCompleted) + { + if (e.JobHandler.JobStatus.Progress <= 0) return; + + var model = JobResumeDB.Default.Get(e.Job.Guid); + bool insert = false; + if (model == null) + { + model = new JobResumeModel(); + insert = true; + } + + model.JobGuid = e.Job.Guid; + model.FirstUnitStartPosition = e.JobHandler.Status.CurrentUnitProgress; + model.RemainingUnits = e.JobHandler.Status.RemainingUnits; + model.GlobalStartPosition = e.JobHandler.JobStatus.Progress; + + if (insert) + { + JobResumeDB.Default.Add(model); + } + else + { + JobResumeDB.Default.Update(model); + } + + if (Job.Guid == e.Job.Guid) + { + ResumeModel = model; + } + } + else + { + JobResumeDB.Default.Delete(e.Job.Guid); + + if (Job.Guid == e.Job.Guid) + { + ResumeModel = null; + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error inserting/updating job resume info on db."); + } + } + + #endregion } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml index fa8fc0b9d..aa54beb9a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml @@ -1358,7 +1358,18 @@ - + + + + + -- cgit v1.3.1 From 888321b9a6c284a02dafcc86b7332d2872c95cf4 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 24 Jul 2023 17:12:43 +0300 Subject: Reset Cards --- .../Tango.PPC.JobsV2/ViewModels/JobViewVM.cs | 4 +-- .../ViewModels/MaintenanceViewVM.cs | 33 ++++++++++++++++------ .../Views/EurekaMaintenanceView.xaml | 25 ++++++++-------- 3 files changed, 40 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index 14a09fe57..0b7d2ce88 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -99,7 +99,7 @@ namespace Tango.PPC.Jobs.ViewModels public bool CanEdit { - get { return !MachineProvider.MachineOperator.IsPrinting || MachineProvider.MachineOperator.RunningJob.Guid != Job.Guid; } + get { return !MachineProvider.MachineOperator.IsPrinting || MachineProvider.MachineOperator.RunningJob == null || MachineProvider.MachineOperator.RunningJob.Guid != Job.Guid; } } private ICollectionView _segmentsCollectionView; @@ -506,7 +506,7 @@ namespace Tango.PPC.Jobs.ViewModels RaisePropertyChanged(nameof(SelectedRML)); await LoadRML(_selectedRML); - if(BuildProvider.IsEureka && Job.Segments.Count <= 1) + if(BuildProvider.IsEureka && Job.Segments.Count == 1 && Job.Segments[0].BrushStops.Count == 1) { IsBasicMode = true; } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs index 4dbd26fdc..5c5c198ef 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs @@ -35,18 +35,35 @@ namespace Tango.PPC.Maintenance.ViewModels { [Description("Main")] Main = 1, - [Description("Dryer")] - Dryer = 2, [Description("Heads")] - Heads = 3, - [Description("Midtanks")] + Heads = 2, + [Description("Dryer")] + Dryer = 3, + [Description("Mid tanks")] Midtanks = 4, [Description("Lubricant")] Lubricant = 5, - [Description("Dispensers")] - Dispensers = 6, - [Description("Winders")] - Winders = 7 + [Description("Dispenser 1")] + Dispenser_1 = 6, + [Description("Dispenser 2")] + Dispenser_2 = 7, + [Description("Dispenser 3")] + Dispenser_3 = 8, + [Description("Dispenser 4")] + Dispenser_4 = 9, + [Description("Dispenser 5")] + Dispenser_5 = 10, + [Description("Dispenser 6")] + Dispenser_6 = 11, + [Description("Winder 1")] + Winder_1 = 12, + [Description("Winder 2")] + Winder_2 = 13, + [Description("Winder 3")] + Winder_3 = 14, + [Description("Winder 4")] + Winder_4 = 15, + } public class WasteStateModel : ExtendedObject { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml index f418361e6..6cb47161b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml @@ -112,25 +112,26 @@ - + - + RUN HEAD CLEANING VIEW BIT RESULTS - + + DISPENSE CLEANING LIQUID + EXPORT SYSTEM LOGS + + - - - - + - + @@ -141,7 +142,7 @@ - + @@ -175,7 +176,7 @@ - + @@ -184,12 +185,12 @@ MOVE TO LOAD POSITION - + START DRYER WINDING - -- cgit v1.3.1 From 95c5bd35287dd59f98550cfbb67c7c4d6ffbbb14 Mon Sep 17 00:00:00 2001 From: Roy Date: Mon, 24 Jul 2023 17:13:35 +0300 Subject: Change storage to documents. --- .../PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs index a76096725..db30c01b1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -113,7 +113,7 @@ namespace Tango.PPC.Storage.ViewModels { if (Settings.StorageRootPath == null) { - Settings.StorageRootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Storage"); + Settings.StorageRootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Twine", "Storage"); Directory.CreateDirectory(Settings.StorageRootPath); } } -- cgit v1.3.1 From abbfd75f45b636c3976f6769bbdc4615d88b16f8 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 25 Jul 2023 14:18:41 +0300 Subject: Added FirmwareVersion and arranged the about list Related Work Items: #8638 --- .../Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs | 2 +- .../Dialogs/GeneralInformationView.xaml | 145 ++++++++++++++++++--- .../Dialogs/GeneralInformationViewVM.cs | 80 +++++++++++- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../Tango.Emulations/Emulators/MachineEmulator.cs | 35 ++++- 5 files changed, 236 insertions(+), 28 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs index b2dcffcdd..28184eee1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Resume/JobResumeDB.cs @@ -32,7 +32,7 @@ namespace Tango.PPC.Jobs.Resume { String dbFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Job Resume v2"); Directory.CreateDirectory(dbFolder); - _db = new LiteDatabase($"Filename={Path.Combine(dbFolder, "job_resume.db")}"); + _db = new LiteDatabase($"Filename={Path.Combine(dbFolder, "job_resume.db")};connection=shared"); _collection = _db.GetCollection("JobResume"); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml index 8ae0f4354..fe9875009 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml @@ -6,7 +6,7 @@ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Dialogs" mc:Ignorable="d" - Background="{StaticResource TangoPrimaryBackgroundBrush}" Width="750" Height="700" d:DataContext="{d:DesignInstance Type=local:GeneralInformationViewVM, IsDesignTimeCreatable=False}"> + Background="{StaticResource TangoPrimaryBackgroundBrush}" Width="750" Height="1000" d:DataContext="{d:DesignInstance Type=local:GeneralInformationViewVM, IsDesignTimeCreatable=False}"> @@ -16,11 +16,12 @@ - General Information + - - + + Machine information: + @@ -41,6 +42,32 @@ + + + + Machine S/N: + + + + + + + + + + + + + Site: + + + + + + + + + @@ -55,31 +82,44 @@ + + + + IP Address: + + + + + + + + - Application Version: + Up Time: - + + - Site: + Total Dye Time: - + @@ -87,90 +127,153 @@ - Machine S/N: + Total Dye Meters: - + + +
+
+
+ Installed Software & Firmware: + + + + + + + + + + + + + + + - Firmware Version: + Application Version: - + - Up Time: + Main Firmware: - + + - IP Address: + Head Firmware: - + + + + + Dryer Firmware: + + + + + + + + - Total Dye Time: + Mid-tanks Firmware: - + + + + + Lubricant Firmware: + + + + + + + + - Total Dye Meters: + Dispensers Firmware: - + + + + + Winders Firmware: + + + + + + + +
-
+
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs index 7f810b2f3..1fd826af2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs @@ -23,7 +23,7 @@ using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using System.Timers; - +using Tango.PMR.FirmwareUpgrade; namespace Tango.PPC.UI.Dialogs { @@ -87,6 +87,53 @@ namespace Tango.PPC.UI.Dialogs get { return _upTime; } set { _upTime = value; RaisePropertyChangedAuto(); } } + private string _headFirmware; + + public string HeadFirmware + { + get { return _headFirmware; } + set { _headFirmware = value; RaisePropertyChangedAuto(); } + } + + private string _dryerFirmware; + + public string DryerFirmware + { + get { return _dryerFirmware; } + set { _dryerFirmware = value; RaisePropertyChangedAuto(); } + } + + private string _MidtanksFirmware; + + public string MidtanksFirmware + { + get { return _MidtanksFirmware; } + set { _MidtanksFirmware = value; RaisePropertyChangedAuto(); } + } + + private string _lubricantFirmware; + + public string LubricantFirmware + { + get { return _lubricantFirmware; } + set { _lubricantFirmware = value; RaisePropertyChangedAuto(); } + } + + private string _dispensersFWFirmware; + + public string DispensersFWFirmware + { + get { return _dispensersFWFirmware; } + set { _dispensersFWFirmware = value; RaisePropertyChangedAuto(); } + } + + private string _windersFWFirmware; + + public string WindersFWFirmware + { + get { return _windersFWFirmware; } + set { _windersFWFirmware = value; RaisePropertyChangedAuto(); } + } public GeneralInformationViewVM( IMachineProvider provider, IPPCApplicationManager appManager) { @@ -98,6 +145,11 @@ namespace Tango.PPC.UI.Dialogs InitTotalDyeProp(); UpTime = DateTime.Now - ApplicationManager.StartUpDate; } + public override void OnShow() + { + base.OnShow(); + GetFirmwareVersionDescriptors(); + } public async void InitSite() { @@ -157,6 +209,32 @@ namespace Tango.PPC.UI.Dialogs TotalDyeMeters = "error!"; } } + + public async void GetFirmwareVersionDescriptors() + { + try + { + var descriptors = await MachineProvider.MachineOperator.GetFirmwareVersionDescriptors(); + + HeadFirmware = GetVersionByFileDescriptor(descriptors, VersionFileDestination.HeadCardSw); + DryerFirmware = GetVersionByFileDescriptor(descriptors, VersionFileDestination.DryerCardSw); + MidtanksFirmware = GetVersionByFileDescriptor(descriptors, VersionFileDestination.MidTankCardSw); + LubricantFirmware = GetVersionByFileDescriptor(descriptors, VersionFileDestination.LubricantCardSw); + DispensersFWFirmware = GetVersionByFileDescriptor(descriptors, VersionFileDestination.PumpCardSw); + WindersFWFirmware = GetVersionByFileDescriptor(descriptors, VersionFileDestination.WinderCardSw); + } + catch (Exception ex) + { + LogManager.Log(ex, "GetFirmwareVersionDescriptors"); + } + } + private String GetVersionByFileDescriptor(List descriptors, VersionFileDestination dtype) + { + var descriptor = descriptors.Where(x => x.Destination == VersionFileDestination.HeadCardSw).FirstOrDefault(); + return descriptor != null ? descriptor.Version : ""; + } + + } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 31a7bfcdb..01a32b2b7 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -172,20 +172,21 @@ namespace Tango.Emulations.Emulators } for (int i = 0; i < 4; i++) { - if( i == 2) + if (i == 2) { MachineStatus.WindersInError.Add(false); MachineStatus.DancersInError.Add(true); MachineStatus.BtsrsInError.Add(true); } - else { + else + { MachineStatus.WindersInError.Add(false); MachineStatus.DancersInError.Add(false); MachineStatus.BtsrsInError.Add(false); } } - EventsStates = MachineEventState.GetAllEventsStates(); + EventsStates = MachineEventState.GetAllEventsStates(); _valveStates = new List(); _blower_states = new List(); @@ -228,7 +229,7 @@ namespace Tango.Emulations.Emulators }); } var tunnel = _heater_states.FirstOrDefault(x => x.HeaterType == HeaterType.ETunnelHeater); - if(tunnel != null) + if (tunnel != null) { tunnel.IsRampingUp = true; tunnel.CurrentValue = 108.5; @@ -526,6 +527,9 @@ namespace Tango.Emulations.Emulators case MessageType.InitiateInkFillingRequest: HandleInitiateInkFillingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); break; + case MessageType.GetVersionDescriptorsRequest: + HandleGetVersionDescriptorsRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; } } @@ -840,9 +844,16 @@ namespace Tango.Emulations.Emulators double dryerLength = _machineType == MachineType.Ts1800 ? (job.ProcessParameters.DryerBufferLength * ProcessParametersTable.DRYER_METERS_PER_CYCLE + ProcessParametersTable.DRYER_TO_SPOOL_LENGTH_METERS) : job.ProcessParameters.DryerBufferLength; //TODO Handle First Unit Length Decrease In Emulator! + double firstUnitStartPosition = request.Message.FirstUnitStartPosition; for (int i = 0; i < units; i++) { + //double unit_length = job.Length; + + if (i == 0 && firstUnitStartPosition > 0) + { + unit_length = unit_length - firstUnitStartPosition; + } while (progress < unit_length + (i == units - 1 ? dryerLength : 0) && !_cancelJob) { @@ -1928,6 +1939,22 @@ namespace Tango.Emulations.Emulators await Transporter.SendResponse(new InitiateInkFillingResponse(), request.Container.Token); } + private async void HandleGetVersionDescriptorsRequest(TangoMessage request) + { + GetVersionDescriptorsResponse response = new GetVersionDescriptorsResponse(); + + foreach (var destination in Enum.GetValues(typeof(PMR.FirmwareUpgrade.VersionFileDestination)).Cast().ToList()) + { + VersionFileDescriptor result = new VersionFileDescriptor(); + result.Destination = destination; + result.Version = "123456VP"; + + + response.Descriptors.Add(result); + } + await Transporter.SendResponse(response, request.Container.Token); + } + #endregion #region Public Methods -- cgit v1.3.1 From 3eeb82b7319e45119c9ac0a3e00c3661c458344a Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 25 Jul 2023 21:33:57 +0300 Subject: Add “Heaters On\Off” command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related Work Items: #8835 --- .../MaitenanceModuleSettings.cs | 14 +++++ .../Tango.PPC.Maintenance.csproj | 3 +- .../ViewModels/MaintenanceViewVM.cs | 57 ++++++++++++++++++++ .../Views/EurekaMaintenanceView.xaml | 63 +++++++++++++++------- 4 files changed, 117 insertions(+), 20 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaitenanceModuleSettings.cs (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaitenanceModuleSettings.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaitenanceModuleSettings.cs new file mode 100644 index 000000000..b4066a5d4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaitenanceModuleSettings.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.PPC.Maintenance +{ + public class MaitenanceModuleSettings : SettingsBase + { + + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj index 12597323e..bebdd63c7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj @@ -146,6 +146,7 @@ + @@ -325,7 +326,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs index 5c5c198ef..a8af047fc 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs @@ -26,6 +26,7 @@ using Tango.PPC.Maintenance.Helpers; using Tango.PPC.Maintenance.Models; using Tango.PPC.Maintenance.Views; using Tango.PPC.Storage; +using Tango.Settings; namespace Tango.PPC.Maintenance.ViewModels { @@ -215,7 +216,21 @@ namespace Tango.PPC.Maintenance.ViewModels } } + private bool _enableHeaters; + public bool EnableHeaters + { + get { return _enableHeaters; } + set { + if(_enableHeaters != value) + { + _enableHeaters = value; + OnHeatersStateChanged(); + RaisePropertyChangedAuto(); + } + } + } + public RelayCommand ExportLogsCommand { get; set; } public OpenCloseDyeingHeadCommand OpenCloseDyeingHeadCommand { get; set; } @@ -296,6 +311,8 @@ namespace Tango.PPC.Maintenance.ViewModels }); RaisePropertyChanged(nameof(DispenseCleanerLiquidCommand)); + _enableHeaters = true; + RaisePropertyChanged( nameof(EnableHeaters)); } public async void CresteRMLS() @@ -628,5 +645,45 @@ namespace Tango.PPC.Maintenance.ViewModels StartedDryerWinding = false; } } + + private async void OnHeatersStateChanged() + { + if(EnableHeaters == false)//turn off heaters + { + try + { + await MachineProvider.MachineOperator.UploadProcessParameters(new ProcessParametersTable()); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error resetting process parameters."); + } + } + else { + try + { + var currentProcessParameters = MachineProvider.MachineOperator.CurrentProcessParameters; + if (currentProcessParameters == null || currentProcessParameters.Guid == null) + { + var settings = SettingsManager.Default.GetOrCreate(); + + var defRmlGuid = Settings.DefaultRmlGuid ?? Rmls.First().Guid; + var rml = Rmls.Where(x => x.Guid == defRmlGuid).FirstOrDefault(); + if (rml != null && rml.GetActiveProcessGroup() != null) + { + currentProcessParameters = rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault(); + } + } + if (currentProcessParameters != null) + { + await MachineProvider.MachineOperator.UploadProcessParameters(currentProcessParameters); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error upload process parameters."); + } + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml index 6cb47161b..11a8a9a1d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml @@ -129,27 +129,52 @@ - - - - - - - - - - - - - - - - - - - RUN + + + + + + + + + + + + + + + + + + + + RUN + + + + + + + + + + -- cgit v1.3.1 From 3038323fb9bb7f37bf0cb35f3b7e08adae075b99 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 26 Jul 2023 08:18:07 +0300 Subject: Maintenance GUI little changes Related Work Items: #8835 --- .../Views/EurekaMaintenanceView.xaml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml index 11a8a9a1d..faef8be1a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/EurekaMaintenanceView.xaml @@ -133,8 +133,8 @@ - - + + @@ -143,7 +143,7 @@ - + @@ -153,19 +153,27 @@ - + --> - +