diff options
| author | Roy Ben-Shabat <Roy.mail.net@gmail.com> | 2023-07-27 04:12:12 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy.mail.net@gmail.com> | 2023-07-27 04:12:12 +0300 |
| commit | 2e5ee293c310f5d4c8de46993f2b812742ae9188 (patch) | |
| tree | 878d2466963a9d689960bda728880f41071e2694 /Software/Visual_Studio/PPC | |
| parent | 08b0f6c9ea547cec0e21f7210f0e10f17f899b6f (diff) | |
| parent | d9d009df1da8630ec6726ed506865ca9818d1eff (diff) | |
| download | Tango-2e5ee293c310f5d4c8de46993f2b812742ae9188.tar.gz Tango-2e5ee293c310f5d4c8de46993f2b812742ae9188.zip | |
Merge branch 'eureka' of https://twinetfs.visualstudio.com/Tango/_git/Tango into eureka
Diffstat (limited to 'Software/Visual_Studio/PPC')
16 files changed, 666 insertions, 110 deletions
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..28184eee1 --- /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<JobResumeModel> _collection; + + private static Lazy<JobResumeDB> _default = new Lazy<JobResumeDB>(() => 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")};connection=shared"); + _collection = _db.GetCollection<JobResumeModel>("JobResume"); + } + + public void Update(JobResumeModel model) + { + _collection.Update(model); + } + + public void Add(JobResumeModel model) + { + _collection.Insert(model); + } + + public List<JobResumeModel> 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 @@ <DependentUpon>ColorCorrectionReport.xaml</DependentUpon> </Compile> <Compile Include="Reports\ColorCorrectionRepotVM.cs" /> + <Compile Include="Resume\JobResumeDB.cs" /> + <Compile Include="Resume\JobResumeModel.cs" /> <Compile Include="UndoRedoCommands\AddBrushStopCommand.cs" /> <Compile Include="UndoRedoCommands\AddNewSegmentCommand.cs" /> <Compile Include="UndoRedoCommands\ChangeLengthCommand.cs" /> @@ -754,7 +756,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <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/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index 14a09fe57..46898210e 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 { @@ -99,7 +101,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) && !HasResumeModel; } } private ICollectionView _segmentsCollectionView; @@ -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)); RaisePropertyChanged(nameof(CanEdit)); } + } + + public bool HasResumeModel + { + get { return ResumeModel != null; } + } #endregion @@ -336,7 +353,9 @@ namespace Tango.PPC.Jobs.ViewModels public RelayCommand<SegmentsGroupModel> DeleteSegmentsGroupCommand { get; set; } public RelayCommand<SegmentsGroupModel> RepeatSegmentsGroupCommand { get; set; } - public RelayCommand NavigateBackToJobs { get; set; } + public RelayCommand NavigateBackToJobs { get; set; } + + public RelayCommand DropResumeCommand { get; set; } #endregion @@ -410,6 +429,8 @@ namespace Tango.PPC.Jobs.ViewModels CopyCommand = new RelayCommand(Copy); UndoCommand = new RelayCommand(Undo);//(x) => { return UndoRedoManager.Instance.IsEnableUndoOperation(); } RedoCommand = new RelayCommand(Redo);//(x) => { return UndoRedoManager.Instance.IsEnableRedoOperation();} + DropResumeCommand = new RelayCommand(DropResume); + NavigateBackToJobs = new RelayCommand(NavigateBack); IsFullMode = true; @@ -417,13 +438,13 @@ namespace Tango.PPC.Jobs.ViewModels _not_show_warning = false; } - #endregion + #endregion #region Job Management /// <summary> - /// Loads the job. - /// </summary> + /// Loads the job. + /// </summary> private async void LoadJob() { try @@ -480,6 +501,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 +541,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 && Job.Segments[0].BrushStops.Count == 1) { IsBasicMode = true; } else IsBasicMode = false; - IsWeightView = false; + IsWeightView = false; LoadJobModel(); @@ -592,7 +627,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<string, SegmentsGroupModel> guidToGroup = new Dictionary<string, SegmentsGroupModel>(); @@ -725,7 +760,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 +968,7 @@ namespace Tango.PPC.Jobs.ViewModels .WithSpools() .BuildAsync(); if (JobModel != null) - { + { JobModel.Rml = Job.Rml; } @@ -936,7 +981,7 @@ namespace Tango.PPC.Jobs.ViewModels { innerSegment.UpdateWeightOnRMLChange(IsWeightView); innerSegment.UpdateBrushStops(); - + } else if (segment is SegmentsGroupModel group) { @@ -1275,21 +1320,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)); - } - /// <summary> /// Called when the navigation system has navigated to this VM view. /// </summary> @@ -1362,14 +1392,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<JobsV2Module>(nameof(JobsView)); } - + } } @@ -1490,11 +1520,11 @@ namespace Tango.PPC.Jobs.ViewModels DyeCommand.RaiseCanExecuteChanged(); } - private void SetOrDiscardAll() + private void SetOrDiscardAll() { InvokeUI(async () => { - IsBasicMode = await MessageDiscardAllChanges(); + IsBasicMode = await MessageDiscardAllChanges(); }); } @@ -1509,7 +1539,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 +1552,7 @@ namespace Tango.PPC.Jobs.ViewModels firstSegment.BrushStops.Add(firstbrush); firstSegment.ArrangeBrushStopsIndexes(); } - + return true; } return false; @@ -1737,5 +1767,97 @@ 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)); + + if (BuildProvider.IsEureka) + { + 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."); + } + } + + private async void DropResume() + { + if (Job != null && HasResumeModel) + { + if (await NotificationProvider.ShowQuestion("Drop resume information and enable job editing?")) + { + JobResumeDB.Default.Delete(Job.Guid); + ResumeModel = null; + } + } + } + + #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..811bd5c9a 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 @@ -823,13 +823,13 @@ </UserControl.Resources> - <Grid Background="{StaticResource TangoMidBackgroundBrush}" SnapsToDevicePixels="False" IsEnabled="{Binding CanEdit}"> + <Grid Background="{StaticResource TangoMidBackgroundBrush}" SnapsToDevicePixels="False"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <touch:TouchLoadingPanel x:Name="GeneralSettings" Grid.Row="1" IsLoading="{Binding IsBusy}" Margin="10 7 10 0"> + <touch:TouchLoadingPanel x:Name="GeneralSettings" Grid.Row="1" IsLoading="{Binding IsBusy}" Margin="10 7 10 0" IsEnabled="{Binding CanEdit}"> <Border Grid.Row="1" x:Name="jobDetailsBorder" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="2" BorderBrush="{StaticResource TangoLightBorderBrush}" Margin="0 7 0 7"> <Grid x:Name="job_details" HorizontalAlignment="Stretch" > @@ -943,7 +943,7 @@ </Border> </touch:TouchLoadingPanel> - <touch:TouchLoadingPanel Grid.Row="2" IsLoading="{Binding IsBusy}" > + <touch:TouchLoadingPanel Grid.Row="2" IsLoading="{Binding IsBusy}" IsEnabled="{Binding CanEdit}"> <Grid > <Grid.RowDefinitions> <RowDefinition Height="1*"/> @@ -1348,7 +1348,7 @@ </Style> </touch:TouchIconButton.Style> </touch:TouchIconButton>--> - <touch:TouchTextBox Margin="20 6 240 0" Text="{Binding JobModel.Name,FallbackValue='Job Name'}" ToolTip="{Binding JobModel.Name}" VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold"></touch:TouchTextBox> + <touch:TouchTextBox IsEnabled="{Binding CanEdit}" Margin="20 6 240 0" Text="{Binding JobModel.Name,FallbackValue='Job Name'}" ToolTip="{Binding JobModel.Name}" VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold"></touch:TouchTextBox> <!--<touch:TouchButton Margin="0 0 0 0" VerticalAlignment="Center" Width="50" Height="50" HorizontalAlignment="Left" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding EditJobDetailsCommand}" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" components:TransformationHelper.TransformWhenPressed ="False"> <Border Height="24" Width="24" Margin="0 0 0 0" BorderThickness="0" Background="Transparent" HorizontalAlignment="Center"> @@ -1358,7 +1358,21 @@ </DockPanel> <Canvas ClipToBounds="False" HorizontalAlignment="Right" Width="200"> - <touch:TouchButton Content="DYE" VerticalAlignment="Center" Height="55" Canvas.Top="10" Width="200" CornerRadius="30" BlurRadius="10" EnableDropShadow="False" Command="{Binding DyeCommand}" IsEnabled="{Binding MachineProvider.MachineOperator.CanPrint}"></touch:TouchButton> + <touch:TouchButton VerticalAlignment="Center" Height="55" Canvas.Top="10" Width="200" CornerRadius="30" BlurRadius="10" EnableDropShadow="False" Command="{Binding DyeCommand}" IsEnabled="{Binding MachineProvider.MachineOperator.CanPrint}"> + <touch:TouchButton.Style> + <Style TargetType="touch:TouchButton" BasedOn="{StaticResource {x:Type touch:TouchButton}}"> + <Setter Property="Content" Value="DYE"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HasResumeModel}" Value="True"> + <Setter Property="Content" Value="RESUME"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchButton.Style> + </touch:TouchButton> + <touch:TouchIconButton Visibility="{Binding HasResumeModel,Converter={StaticResource BooleanToVisibilityConverter}}" Icon="DeleteSweep" VerticalAlignment="Center" BorderThickness="0 0 1 0" BorderBrush="White" Height="55" Canvas.Left="-75" Canvas.Top="10" Background="{StaticResource TangoMidAccentBrush}" Padding="15" Width="100" CornerRadius="30 0 0 30" BlurRadius="10" EnableDropShadow="False" Command="{Binding DropResumeCommand}"> + + </touch:TouchIconButton> </Canvas> </Grid> </Border> 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 @@ <Compile Include="Helpers\GuideHelper.cs" /> <Compile Include="MaintenanceCommand.cs" /> <Compile Include="MaintenanceModule.cs" /> + <Compile Include="MaitenanceModuleSettings.cs" /> <Compile Include="Models\MidTankLevelModel.cs" /> <Compile Include="Models\OverallTemperatureModel.cs" /> <Compile Include="Properties\AssemblyInfo.cs"> @@ -325,7 +326,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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 4dbd26fdc..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 { @@ -35,18 +36,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 { @@ -198,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; } @@ -279,6 +311,8 @@ namespace Tango.PPC.Maintenance.ViewModels }); RaisePropertyChanged(nameof(DispenseCleanerLiquidCommand)); + _enableHeaters = true; + RaisePropertyChanged( nameof(EnableHeaters)); } public async void CresteRMLS() @@ -611,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<MaitenanceModuleSettings>(); + + 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 f418361e6..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 @@ -112,43 +112,77 @@ </StackPanel> <Grid > <Grid.ColumnDefinitions> - <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> <Grid > - <StackPanel Orientation="Vertical" Margin="80 0 0 0" Width="300" > + <UniformGrid Columns="2" Margin="80 0 90 20"> <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding HeadCleaningCommand}">RUN HEAD CLEANING</touch:TouchButton> <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ViewBitResultsCommand}">VIEW BIT RESULTS</touch:TouchButton> - </StackPanel> + + <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding DispenseCleanerLiquidCommand}">DISPENSE CLEANING LIQUID</touch:TouchButton> + <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ExportLogsCommand}" Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}">EXPORT SYSTEM LOGS</touch:TouchButton> + </UniformGrid> + </Grid> </Grid> - <!--</StackPanel>--> - - <!--</touch:TouchDropShadowBorder>--> + + <touch:TouchDropShadowBorder Margin="0 0 0 0" Padding="0" MinHeight="216"> + <StackPanel Orientation="Vertical"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="30 0 30 0" Height="116"> + <TextBlock VerticalAlignment="Center" Text="Reset Specific Board:" FontSize="{StaticResource TangoExpanderHeaderFontSize}" Width="210"></TextBlock> + <Border Margin="55 0 0 0" x:Name="emborder" BorderThickness="1 1 1 1" Height="50" CornerRadius="25" BorderBrush="{StaticResource TangoMidAccentBrush}"> + <touch:TouchComboBox Margin="20 0 10 0" ItemsSource="{Binding ListBoards}" SelectedItem="{Binding SelecteadBoard,Mode=TwoWay}" Focusable="False" KeyboardNavigation.TabNavigation ="None" Width="260" DisplayMemberPath=""> + <touch:TouchComboBox.ItemTemplate> + <DataTemplate> + <TextBlock Margin="20 10 10 10" TextTrimming="CharacterEllipsis" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"/> - <touch:TouchDropShadowBorder Margin="0 0 0 0" Padding="0" MinHeight="116"> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="30 0 30 0" Height="116"> - <TextBox VerticalAlignment="Center" Text="Reset Specific Boards:" FontSize="{StaticResource TangoExpanderHeaderFontSize}"></TextBox> - <Border Margin="49 0 0 0" BorderThickness="1" Height="50" CornerRadius="22" BorderBrush="{StaticResource TangoMidAccentBrush}"> - <touch:TouchComboBox Margin="20 0 10 0" ItemsSource="{Binding ListBoards}" SelectedItem="{Binding SelecteadBoard,Mode=TwoWay}" Focusable="False" KeyboardNavigation.TabNavigation ="None" Width="260"> - <touch:TouchComboBox.ItemTemplate> - <DataTemplate> - <TextBlock Margin="20 10 10 10" TextTrimming="CharacterEllipsis" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"/> + </DataTemplate> + </touch:TouchComboBox.ItemTemplate> + <touch:TouchComboBox.SelectedItemTemplate> + <DataTemplate> + <TextBlock Margin="0 0 0 5" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}" VerticalAlignment="Center" Height="36"></TextBlock> + </DataTemplate> + </touch:TouchComboBox.SelectedItemTemplate> + </touch:TouchComboBox> + </Border> + <touch:TouchButton Margin="30 0 0 0" Width="120" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ResetBoardCommand}">RUN</touch:TouchButton> - </DataTemplate> - </touch:TouchComboBox.ItemTemplate> - <touch:TouchComboBox.SelectedItemTemplate> - <DataTemplate> - <TextBlock Margin="0 0 0 5" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}" VerticalAlignment="Center"></TextBlock> - </DataTemplate> - </touch:TouchComboBox.SelectedItemTemplate> - </touch:TouchComboBox> - </Border> - <touch:TouchButton Margin="30 0 0 0" Width="120" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ResetBoardCommand}">RUN</touch:TouchButton> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="30 0 30 0" Height="100"> + <TextBlock VerticalAlignment="Center" Text="Machine Heaters:" FontSize="{StaticResource TangoExpanderHeaderFontSize}" Width="210"></TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding EnableHeaters}" Margin="55 0 0 0" HorizontalAlignment="Right" Width="90"> + <touch:TouchToggleSlider.Style> + <Style TargetType="touch:TouchToggleSlider" BasedOn="{StaticResource TangoToggleButtonGrayAccent}"> + <Setter Property="IsEnabled" Value="False" /> + <Setter Property="touch:TouchToggleSlider.BorderBrush" Value="{StaticResource TangoGrayBrush}" /> + <Setter Property="touch:TouchToggleSlider.ThumbBrush" Value="{StaticResource TangoGrayBrush}" /> + <Style.Triggers> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.CanPrint}" Value="True" > + <Setter Property="touch:TouchToggleSlider.IsEnabled" Value="True" /> + <Setter Property="touch:TouchToggleSlider.BorderBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + <Setter Property="touch:TouchToggleSlider.ThumbBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </DataTrigger> + <DataTrigger Binding="{Binding MachineProvider.MachineOperator.Status}" Value="9" > + <Setter Property="IsEnabled" Value="true" /> + <Setter Property="touch:TouchToggleSlider.BorderBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + <Setter Property="touch:TouchToggleSlider.ThumbBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </DataTrigger> + <DataTrigger Binding="{Binding EnableHeaters}" Value="False" > + <Setter Property="IsEnabled" Value="true" /> + <Setter Property="touch:TouchToggleSlider.BorderBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + <Setter Property="touch:TouchToggleSlider.ThumbBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchToggleSlider.Style> + </touch:TouchToggleSlider> + </StackPanel> </StackPanel> + </touch:TouchDropShadowBorder> </StackPanel> </touch:TouchDropShadowBorder> @@ -175,7 +209,7 @@ </touch:TouchComboBox.ItemTemplate> <touch:TouchComboBox.SelectedItemTemplate> <DataTemplate> - <TextBlock Margin="0 0 0 0" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding FinalName}" VerticalAlignment="Center" ></TextBlock> + <TextBlock Margin="0 0 0 0" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding FinalName}" VerticalAlignment="Center" Height="36" ></TextBlock> </DataTemplate> </touch:TouchComboBox.SelectedItemTemplate> </touch:TouchComboBox> @@ -184,12 +218,12 @@ <StackPanel Orientation="Horizontal"> <touch:TouchButton Width="280" HorizontalAlignment="Left" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding MoveToLoadPositionCommand}">MOVE TO LOAD POSITION</touch:TouchButton> - <TextBlock Width="340" VerticalAlignment="Center" Margin="10 0 0 0" TextAlignment="Left" FontSize="{StaticResource TangoSmallFontSize}" FontWeight="Normal" Text="Press when the Thread Loading Jig is installed on the Thread Traveler, and is holding the incoming thread." TextWrapping="Wrap"/> + <TextBlock Width="380" VerticalAlignment="Center" Margin="10 0 0 0" TextAlignment="Left" FontSize="{StaticResource TangoSmallFontSize}" FontWeight="Normal" Text="Press when the Thread Loading Jig is installed on the Thread Traveler, and is holding the incoming thread." TextWrapping="Wrap"/> </StackPanel> <StackPanel Orientation="Horizontal"> <touch:TouchButton Width="280" HorizontalAlignment="Left" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding StartDryerWindingCommand}">START DRYER WINDING</touch:TouchButton> - <TextBlock Width="340" VerticalAlignment="Center" Margin="10 0 0 0" TextAlignment="Left" FontSize="{StaticResource TangoSmallFontSize}" FontWeight="Normal" + <TextBlock Width="380" VerticalAlignment="Center" Margin="10 0 0 0" TextAlignment="Left" FontSize="{StaticResource TangoSmallFontSize}" FontWeight="Normal" Text="Press only when: 1. The Thread Traveler reached the dryer load position 2. The Thread Loading Jig is installed on the Dryer 3. The Loading Comb is released"/> </StackPanel> 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); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs index 815936137..ff406cefd 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs @@ -8,6 +8,8 @@ namespace Tango.PPC.Common.Printing { public class PrintingConfiguration { - + public int RemainingUnits { get; set; } + public double GlobalStartPosition { get; set; } + public double FirstUnitStartPosition { get; set; } } } 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}"> <Grid Margin="20"> <DockPanel> @@ -16,11 +16,12 @@ <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center"> <Image Source="../Images/logo.png" RenderOptions.BitmapScalingMode="Fant" Width="157" Height="51" Stretch="Uniform" HorizontalAlignment="Center" Margin="0 10 0 10"/> - <TextBlock VerticalAlignment="Center" Margin="0 30 0 0" FontSize="{StaticResource TangoHeaderFontSize}">General Information</TextBlock> + </StackPanel> - <Grid Margin="0 30 0 0"> - <FlowDocumentScrollViewer VerticalScrollBarVisibility="Disabled" > + <StackPanel Margin="0 20 0 0" Orientation="Vertical"> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 30 0 0" FontSize="{StaticResource TangoDialogFontSize}">Machine information:</TextBlock> + <FlowDocumentScrollViewer VerticalScrollBarVisibility="Disabled" Margin="0 10 0 0"> <FlowDocument> <Table CellSpacing="0" FontFamily="{StaticResource TangoFlexoFontFamily}"> <Table.Resources> @@ -41,6 +42,32 @@ </Table.Columns> <TableRowGroup> + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Machine S/N:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.Machine.SerialNumber,Mode=OneWay,IsAsync=True,FallbackValue='0000'}"/> + </Paragraph> + </TableCell> + </TableRow> + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Site:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding SiteName,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> <TableRow> <TableCell> @@ -55,31 +82,44 @@ </Paragraph> </TableCell> </TableRow> + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>IP Address:</TextBlock> + </Paragraph> + </TableCell> + <TableCell> + <Paragraph> + <TextBlock Text="{Binding IPAddress,Mode=OneWay,FallbackValue=0}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> <TableRow> <TableCell> <Paragraph> - <TextBlock>Application Version:</TextBlock> + <TextBlock>Up Time:</TextBlock> </Paragraph> </TableCell> <TableCell> <Paragraph> - <TextBlock Text="{Binding ApplicationManager.VersionAndTag,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + <TextBlock Text="{Binding UpTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"></TextBlock> </Paragraph> </TableCell> </TableRow> + <TableRow> <TableCell> <Paragraph> - <TextBlock>Site:</TextBlock> + <TextBlock>Total Dye Time:</TextBlock> </Paragraph> </TableCell> <TableCell> <Paragraph> - <TextBlock Text="{Binding SiteName,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + <TextBlock Text="{Binding TotalDyeTime,Mode=OneWay,FallbackValue=0}"></TextBlock> </Paragraph> </TableCell> </TableRow> @@ -87,90 +127,153 @@ <TableRow> <TableCell> <Paragraph> - <TextBlock>Machine S/N:</TextBlock> + <TextBlock>Total Dye Meters:</TextBlock> </Paragraph> </TableCell> <TableCell> <Paragraph> - <TextBlock Text="{Binding MachineProvider.Machine.SerialNumber,Mode=OneWay,IsAsync=True,FallbackValue='0000'}"/> + <TextBlock Text="{Binding TotalDyeMeters,Mode=OneWay,FallbackValue=0}"></TextBlock> </Paragraph> </TableCell> </TableRow> + </TableRowGroup> + </Table> + </FlowDocument> + </FlowDocumentScrollViewer> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoDialogFontSize}">Installed Software & Firmware:</TextBlock> + <FlowDocumentScrollViewer VerticalScrollBarVisibility="Disabled" Margin="0 10 0 0"> + <FlowDocument> + <Table CellSpacing="0" FontFamily="{StaticResource TangoFlexoFontFamily}"> + <Table.Resources> + <Style TargetType="{x:Type TableRowGroup}"> + <Setter Property="FontSize" Value="{StaticResource TangoDefaultFontSize}"/> + </Style> + + <Style TargetType="TableCell"> + <Setter Property="BorderThickness" Value="0 0 0 1"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoGrayBrush}"></Setter> + <Setter Property="Padding" Value="5"></Setter> + </Style> + </Table.Resources> + <Table.Columns> + <TableColumn Width="160" /> + <TableColumn /> + <TableColumn /> + </Table.Columns> + + <TableRowGroup> <TableRow> <TableCell> <Paragraph> - <TextBlock>Firmware Version:</TextBlock> + <TextBlock>Application Version:</TextBlock> </Paragraph> </TableCell> <TableCell> <Paragraph> - <TextBlock Text="{Binding MachineProvider.MachineOperator.DeviceInformation.Version,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + <TextBlock Text="{Binding ApplicationManager.VersionAndTag,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> </Paragraph> </TableCell> </TableRow> <TableRow> <TableCell> <Paragraph> - <TextBlock>Up Time:</TextBlock> + <TextBlock>Main Firmware:</TextBlock> </Paragraph> </TableCell> <TableCell> <Paragraph> - <TextBlock Text="{Binding UpTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"></TextBlock> + <TextBlock Text="{Binding MachineProvider.MachineOperator.DeviceInformation.Version,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> </Paragraph> </TableCell> </TableRow> + <TableRow> <TableCell> <Paragraph> - <TextBlock>IP Address:</TextBlock> + <TextBlock>Head Firmware:</TextBlock> </Paragraph> </TableCell> <TableCell> <Paragraph> - <TextBlock Text="{Binding IPAddress,Mode=OneWay,FallbackValue=0}"></TextBlock> + <TextBlock Text="{Binding HeadFirmware,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> </Paragraph> </TableCell> </TableRow> + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Dryer Firmware:</TextBlock> + </Paragraph> + </TableCell> + <TableCell> + <Paragraph> + <TextBlock Text="{Binding DryerFirmware,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> <TableRow> <TableCell> <Paragraph> - <TextBlock>Total Dye Time:</TextBlock> + <TextBlock>Mid-tanks Firmware:</TextBlock> </Paragraph> </TableCell> <TableCell> <Paragraph> - <TextBlock Text="{Binding TotalDyeTime,Mode=OneWay,FallbackValue=0}"></TextBlock> + <TextBlock Text="{Binding MidtanksFirmware,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> </Paragraph> </TableCell> </TableRow> + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Lubricant Firmware:</TextBlock> + </Paragraph> + </TableCell> + <TableCell> + <Paragraph> + <TextBlock Text="{Binding LubricantFirmware,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> <TableRow> <TableCell> <Paragraph> - <TextBlock>Total Dye Meters:</TextBlock> + <TextBlock>Dispensers Firmware:</TextBlock> </Paragraph> </TableCell> <TableCell> <Paragraph> - <TextBlock Text="{Binding TotalDyeMeters,Mode=OneWay,FallbackValue=0}"></TextBlock> + <TextBlock Text="{Binding DispensersFWFirmware,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> </Paragraph> </TableCell> </TableRow> + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Winders Firmware:</TextBlock> + </Paragraph> + </TableCell> + <TableCell> + <Paragraph> + <TextBlock Text="{Binding WindersFWFirmware,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> </TableRowGroup> </Table> </FlowDocument> </FlowDocumentScrollViewer> - </Grid> + </StackPanel> </DockPanel> </Grid> </UserControl> 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<VersionFileDescriptor> 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/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs index f4a3f643d..10f417edc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs @@ -109,6 +109,14 @@ namespace Tango.PPC.UI.Printing job.SpoolType = spoolType; + if (printConfig.GlobalStartPosition > 0) + { + config.ResumeConfig = new AdditionalJobConfiguration.ResumeConfiguration(); + config.ResumeConfig.FirstUnitStartPosition = printConfig.FirstUnitStartPosition; + config.ResumeConfig.GlobalStartPosition = printConfig.GlobalStartPosition; + config.ResumeConfig.RemainingUnits = printConfig.RemainingUnits; + } + handler = await _machineProvider.MachineOperator.Print(job, config); _notificationProvider.ReleaseGlobalBusyMessage(); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml index b08aab298..1e864c7e3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml @@ -16,7 +16,7 @@ <Grid Margin="0 30 0 0"> <touch:TouchGifAnimation Source="/Images/power_off_2.gif" EnableAnimation="{Binding IsVisible}" HorizontalAlignment="Center" /> <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="DemiBold" HorizontalAlignment="Center" Margin="0 50 0 0"> - <Run Text="{Binding Status.ProgressPercentage, TargetNullValue=0}"/>% + <Run Text="{Binding Status.ProgressPercentage, TargetNullValue=0, StringFormat=0}"/>% </TextBlock> </Grid> <TextBlock HorizontalAlignment="Center" Margin="0 60 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Machine is turning Off</TextBlock> 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. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> |
