From c23e72b8b4eec5fe4b6ee77bc997980fcb356846 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 13 Nov 2022 10:36:11 +0200 Subject: PPC "Use Flat Spool" + SpoolType logic improvements. Added RML->SpoolType calibration new parameters. --- .../Tango.MachineStudio.RML/Views/SpoolsView.xaml | 2 + .../Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml | 8 + .../Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs | 2 + .../Tango.PPC.JobsV2/ViewModels/JobViewVM.cs | 203 +++++++++++++-------- .../Tango.PPC.Common/Printing/IPrintingManager.cs | 2 +- .../Printing/PrintingConfiguration.cs | 13 ++ .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 3 +- .../Printing/DefaultPrintingManager.cs | 9 +- .../Visual_Studio/Tango.BL/DTO/RmlsSpoolDTOBase.cs | 16 ++ .../Tango.BL/Entities/RmlsSpoolBase.cs | 76 ++++++++ .../Tango.DAL.Remote/DB/RMLS_SPOOLS.cs | 2 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 6 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 192 +++++++++---------- .../Tango.Integration/Operation/MachineOperator.cs | 6 + 14 files changed, 363 insertions(+), 177 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml index 9cab8ed02..6a23d767e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml @@ -71,6 +71,8 @@ + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml index 97fb1d590..19ef9cf4c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml @@ -136,6 +136,14 @@ + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs index a23345e59..bf3905104 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs @@ -94,6 +94,8 @@ namespace Tango.PPC.Jobs.Dialogs } } + public bool UseFlatSpool { get; set; } + private RmlLubricationLevel _lubricationLevel; public RmlLubricationLevel LubricationLevel { 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 d85fb73e9..3e94a42c5 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 @@ -45,6 +45,7 @@ using Tango.PPC.Jobs.UndoRedoCommands; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Tango.PPC.Jobs.ColorCorrectionTool; +using Tango.PPC.Common.Printing; namespace Tango.PPC.Jobs.ViewModels { @@ -69,6 +70,7 @@ namespace Tango.PPC.Jobs.ViewModels private List _catalogs; private string _jsonJobModelLoaded; + #region Properties private Job _job; @@ -196,7 +198,7 @@ namespace Tango.PPC.Jobs.ViewModels get { return _approvalFineTuneItems; } set { _approvalFineTuneItems = value; RaisePropertyChangedAuto(); } } - + private List _availableCatalogs; public List AvailableCatalogs { @@ -204,7 +206,7 @@ namespace Tango.PPC.Jobs.ViewModels set { _availableCatalogs = value; RaisePropertyChangedAuto(); } } - + private bool _isFullMode; @@ -223,7 +225,9 @@ namespace Tango.PPC.Jobs.ViewModels public bool IsSummaryOpened { get { return _isSummaryOpened; } - set { _isSummaryOpened = value; + set + { + _isSummaryOpened = value; RaisePropertyChangedAuto(); } } @@ -236,7 +240,7 @@ namespace Tango.PPC.Jobs.ViewModels /// Gets or sets the add solid segment command. /// public RelayCommand AddNewSegmentCommand { get; set; } - + /// /// Gets or sets the remove segment command. /// @@ -261,12 +265,12 @@ namespace Tango.PPC.Jobs.ViewModels /// Gets or sets the replace brush stop command. /// public RelayCommand ReplaceBrushStopCommand { get; set; } - + /// /// Gets or sets the dye command. /// public RelayCommand DyeCommand { get; set; } - + /// /// Gets or sets the export embroidery command. /// @@ -294,7 +298,7 @@ namespace Tango.PPC.Jobs.ViewModels public RelayCommand CopyCommand { get; set; } public RelayCommand UndoCommand { get; set; } public RelayCommand RedoCommand { get; set; } - + #endregion #region Constructors @@ -304,7 +308,7 @@ namespace Tango.PPC.Jobs.ViewModels /// static JobViewVM() { - + _jobs_fine_tune_items = new Dictionary>(); } @@ -327,7 +331,7 @@ namespace Tango.PPC.Jobs.ViewModels return customer.Name.ToLower().StartsWith(filter != null ? filter.ToLower() : String.Empty); }); - + //Initialize Commands AddNewSegmentCommand = new RelayCommand(AddNewSegment); RemoveSegmentCommand = new RelayCommand(RemoveSegment); @@ -363,7 +367,7 @@ namespace Tango.PPC.Jobs.ViewModels #endregion #region Job Management - + /// /// Loads the job. /// @@ -422,7 +426,7 @@ namespace Tango.PPC.Jobs.ViewModels .WithBrushStops() .WithSegmentsGroups() .BuildAsync(); - + Job.NameChanged -= Job_NameChanged; Job.NameChanged += Job_NameChanged; @@ -433,7 +437,7 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log("Loading RMLS..."); Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).OrderBy(x => x.FinalName).ToList(); - //Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().BuildAsync()).OrderBy(x => x.FinalName).ToList(); + //Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().BuildAsync()).OrderBy(x => x.FinalName).ToList(); LogManager.Log("Loading Color Spaces..."); ColorSpaces = await _db.ColorSpaces.Where(x => x.Code != (int)BL.Enumerations.ColorSpaces.CMYK).ToListAsync(); LogManager.Log("Loading Spool Types..."); @@ -449,7 +453,7 @@ namespace Tango.PPC.Jobs.ViewModels await LoadRML(_selectedRML); LoadJobModel(); - + _job_to_load = null; _current_job_string = Job.ToJobFileWhenLoaded().ToString(); @@ -459,7 +463,7 @@ namespace Tango.PPC.Jobs.ViewModels { Job.JobFineTuningStatus = BL.Enumerations.FineTuningStatuses.Unspecified; } - + LogManager.Log($"Job editing state = '{Job.JobEditingState}'."); //if (Job.JobEditingState == BL.Enumerations.EditingStates.SampleDye && Job.JobSampleDyeStatus == BL.Enumerations.SampleDyeStatuses.PendingApproval) @@ -472,7 +476,7 @@ namespace Tango.PPC.Jobs.ViewModels // LogManager.Log("Directing view to display fine tuning region."); // View.DisplayFineTuning(); //} - + IsFullMode = true; DyeCommand.RaiseCanExecuteChanged(); } @@ -492,7 +496,22 @@ namespace Tango.PPC.Jobs.ViewModels private void LoadJobModel() { - var PPCSpoolType = false == String.IsNullOrEmpty(Settings.SpoolTypeGuid) ? _spoolTypes.FirstOrDefault(x => x.Guid == Settings.SpoolTypeGuid) : _spoolTypes.FirstOrDefault(x => x.Guid == SpoolTypes.FirstOrDefault().Guid); + SpoolType PPCSpoolType = null; + + if (Settings.SpoolTypeGuid.IsNotNullOrEmpty()) + { + PPCSpoolType = _spoolTypes.FirstOrDefault(x => x.Guid == Settings.SpoolTypeGuid); + } + else + { + PPCSpoolType = _spoolTypes.FirstOrDefault(x => x.Type == BL.Enumerations.SpoolTypes.StandardSpool); + } + + if (Job.SpoolType.Type == BL.Enumerations.SpoolTypes.FlatSpool) + { + PPCSpoolType = _spoolTypes.FirstOrDefault(x => x.Type == BL.Enumerations.SpoolTypes.FlatSpool); + } + var jobModel = new JobModel(ColorSpaces) { Name = Job.Name, @@ -516,7 +535,7 @@ namespace Tango.PPC.Jobs.ViewModels int segmentindex = 1; foreach (var segm in Job.OrderedSegments) { - if(segm.BrushStops.Count > 1) + if (segm.BrushStops.Count > 1) { var brushes = segm.BrushStops; Segment currentSegment = segm; @@ -547,16 +566,16 @@ namespace Tango.PPC.Jobs.ViewModels else { SegmentModel segmentModel = LoadSegmentModel(segm, jobModel); - segmentModel.SegmentIndex = segmentindex++; + segmentModel.SegmentIndex = segmentindex++; jobModel.Segments.Add(segmentModel); } } - + } else { var segments = Job.OrderedSegmentsWithGroups; - foreach( var segment in segments) + foreach (var segment in segments) { if (segment is Segment simpleSegment) { @@ -566,7 +585,7 @@ namespace Tango.PPC.Jobs.ViewModels else if (segment is SegmentsGroup group) { SegmentsGroupModel segmentsGroupModel = new SegmentsGroupModel(jobModel) { SegmentIndex = group.SegmentIndex, Repeats = group.Repeats }; - + foreach (var innerSegment in group.OrderedSegments) { SegmentModel segmentModel = LoadSegmentModel(innerSegment, jobModel); @@ -578,7 +597,7 @@ namespace Tango.PPC.Jobs.ViewModels } } } - + jobModel.InterSegmentLength = Job.EnableInterSegment ? Job.InterSegmentLength : 0; jobModel.LoadGroupingSegments(); JobModel = jobModel; @@ -592,7 +611,7 @@ namespace Tango.PPC.Jobs.ViewModels ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore, PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects }; - _jsonJobModelLoaded = JsonConvert.SerializeObject(JobModel , Formatting.Indented, settings); + _jsonJobModelLoaded = JsonConvert.SerializeObject(JobModel, Formatting.Indented, settings); } /// @@ -626,7 +645,7 @@ namespace Tango.PPC.Jobs.ViewModels { DyeCommand.RaiseCanExecuteChanged(); } - + /// /// Starts the job. /// @@ -640,7 +659,7 @@ 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); + var handler = await PrintingManager.Print(Job, _db, new PrintingConfiguration() { }); await NavigationManager.NavigateTo(nameof(JobProgressView)); startingJob = false; } @@ -687,26 +706,45 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log("Editing the job details."); JobCreationViewVM vm = new JobCreationViewVM(_spoolTypes.ToList(), _rmls, JobModel.Rml.Guid, JobModel.InterSegmentLength, true); + vm.UseFlatSpool = Job.SpoolType.Type == BL.Enumerations.SpoolTypes.FlatSpool; vm.JobName = JobModel.Name; vm.SelectedSpoolType = JobModel.SpoolType; vm = await NotificationProvider.ShowDialog(vm); if (!vm.DialogResult) return; - + Job.Name = vm.JobName; JobModel.Name = vm.JobName; + if (vm.UseFlatSpool) + { + Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Type == BL.Enumerations.SpoolTypes.FlatSpool); + } + else + { + if (Settings.SpoolTypeGuid.IsNotNullOrEmpty()) + { + Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Guid == Settings.SpoolTypeGuid); + } + else + { + Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Type == BL.Enumerations.SpoolTypes.StandardSpool); + } + } + + JobModel.SpoolType = Job.SpoolType; + JobModel.SpoolTypeName = Job.SpoolType.Name; Job.InterSegmentLength = vm.WhiteGap; Job.EnableInterSegment = vm.WhiteGap > 0; JobModel.InterSegmentLength = vm.WhiteGap; JobModel.EnableInterSegment = vm.WhiteGap > 0; - - // Job.SpoolType = vm.SelectedSpoolType; - // JobModel.SpoolType = vm.SelectedSpoolType;//update length!!!! - - if(vm.SelectedRML.Guid != SelectedRML.Guid) + + // Job.SpoolType = vm.SelectedSpoolType; + // JobModel.SpoolType = vm.SelectedSpoolType;//update length!!!! + + if (vm.SelectedRML.Guid != SelectedRML.Guid) { - SelectedRML = _rmls.FirstOrDefault(x=>x.Guid == vm.SelectedRML.Guid); + SelectedRML = _rmls.FirstOrDefault(x => x.Guid == vm.SelectedRML.Guid); // for LAB color remove all available tests foreach (var segment in JobModel.OrderedSegmentsWithGroups) { @@ -743,7 +781,7 @@ namespace Tango.PPC.Jobs.ViewModels } } } - + if (vm.IsDuplicate) { try @@ -773,7 +811,7 @@ namespace Tango.PPC.Jobs.ViewModels { var maxLength = Job.SpoolType.Length; var maxRep = (maxLength == 0 ? 999 : (maxLength / JobModel.Length)); - + var vm = await NotificationProvider.ShowDialog(new RepeatJobViewVM("Repeat All", JobModel.NumberOfUnits) { MaxRepeations = (int)maxRep @@ -813,7 +851,7 @@ namespace Tango.PPC.Jobs.ViewModels .BuildAsync(); if (JobModel != null) JobModel.Rml = Job.Rml; - + if (updateRML && JobModel != null) { NotificationProvider.SetGlobalBusyMessage("Updating IsOutOfGammut due to the change RML..."); @@ -823,15 +861,15 @@ namespace Tango.PPC.Jobs.ViewModels { innerSegment.UpdateBrushStops(); } - else if ( segment is SegmentsGroupModel group) + else if (segment is SegmentsGroupModel group) { - foreach( var segm in group.Segments) + foreach (var segm in group.Segments) { segm.UpdateBrushStops(); } } } - + DyeCommand.RaiseCanExecuteChanged(); NotificationProvider.ReleaseGlobalBusyMessage(); } @@ -868,11 +906,11 @@ namespace Tango.PPC.Jobs.ViewModels try { LogManager.Log("Adding new segment..."); - + UndoRedoManager.Instance.InsertAndExecuteCommand(new AddNewSegmentCommand(JobModel, segment, Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10)); - ArrangeSegmentsIndixes(); + ArrangeSegmentsIndixes(); DyeCommand.RaiseCanExecuteChanged(); - if(segment.SegmentIndex >= (JobModel.GroupingSegments.Count() - 1)) + if (segment.SegmentIndex >= (JobModel.GroupingSegments.Count() - 1)) { View.ScrollToEnd(); } @@ -884,11 +922,11 @@ namespace Tango.PPC.Jobs.ViewModels } } - private async void RepeatSegmentsGroup( SegmentsGroupModel group) + private async void RepeatSegmentsGroup(SegmentsGroupModel group) { var maxLength = Job.SpoolType.Length == 0 ? 999 : Job.SpoolType.Length; - var maxRep = (maxLength - JobModel.Length)/ group.Length; - + var maxRep = (maxLength - JobModel.Length) / group.Length; + var vm = await NotificationProvider.ShowDialog(new RepeatJobViewVM($"Edit \"Group {group.SegmentIndex}\" Repeat", group.Repeats) { MaxRepeations = (int)maxRep @@ -937,10 +975,10 @@ namespace Tango.PPC.Jobs.ViewModels { if (await NotificationProvider.ShowQuestion("Are you sure you want to remove the selected group of segments?")) { - + UndoRedoManager.Instance.InsertAndExecuteCommand(new DeleteSegmentsGroupCommand(JobModel, segmentsGroup)); ArrangeSegmentsIndixes(); - + DyeCommand.RaiseCanExecuteChanged(); } } @@ -962,7 +1000,7 @@ namespace Tango.PPC.Jobs.ViewModels { UndoRedoManager.Instance.InsertAndExecuteCommand(new DuplicateSegmentCommand(JobModel, segment)); ArrangeSegmentsIndixes(); - + DyeCommand.RaiseCanExecuteChanged(); if (segment.SegmentIndex >= (JobModel.GroupingSegments.Count() - 1)) { @@ -979,7 +1017,7 @@ namespace Tango.PPC.Jobs.ViewModels #endregion #region Brush Stops Management - + /// /// Click on AddColor button. Add newBrush; /// @@ -1040,7 +1078,7 @@ namespace Tango.PPC.Jobs.ViewModels { UndoRedoManager.Instance.InsertAndExecuteCommand(new EditBrushStopColorCommand(segment, brushStop, vm.SelectedBrushStop)); DyeCommand.RaiseCanExecuteChanged(); - + } } @@ -1052,7 +1090,7 @@ namespace Tango.PPC.Jobs.ViewModels if (newBrushStop == null || segment == null) return; - if(segment.IsGradient) + if (segment.IsGradient) { if (false == _not_show_warning) { @@ -1065,7 +1103,7 @@ namespace Tango.PPC.Jobs.ViewModels } UndoRedoManager.Instance.InsertAndExecuteCommand(new AddBrushStopCommand(JobModel, segment, newBrushStop)); ArrangeSegmentsIndixes(); - + } #endregion @@ -1106,8 +1144,6 @@ namespace Tango.PPC.Jobs.ViewModels #endregion - - #region Export Embroidery @@ -1182,8 +1218,8 @@ namespace Tango.PPC.Jobs.ViewModels LoadJob(); } - - + + public override void OnBeforeNavigatedTo() { base.OnBeforeNavigatedTo(); @@ -1223,7 +1259,7 @@ namespace Tango.PPC.Jobs.ViewModels if (!_can_navigate_back) { await Save(); - + Job = null; JobModel = null; SegmentsCollectionView = null; @@ -1273,18 +1309,18 @@ namespace Tango.PPC.Jobs.ViewModels { if (false == JobModel.GroupingSegments.ToList().Any(x => x.IsSelected)) return; - + UndoRedoManager.Instance.InsertAndExecuteCommand(new ReverseCommand(JobModel)); - ArrangeSegmentsIndixes(); - + ArrangeSegmentsIndixes(); + } private async void DeleteSegments() { if (!JobModel.HasSelectedItems) return; - if(JobModel.GroupingSegments.ToList().Where(x => x.IsSelected).ToList().Count == JobModel.GroupingSegments.Count) + if (JobModel.GroupingSegments.ToList().Where(x => x.IsSelected).ToList().Count == JobModel.GroupingSegments.Count) { await NotificationProvider.ShowInfo("A job must contain at least one segment. Please, change selection."); return; @@ -1297,9 +1333,9 @@ namespace Tango.PPC.Jobs.ViewModels if (await NotificationProvider.ShowQuestion("Are you sure you want to remove these selected segments?")) { UndoRedoManager.Instance.InsertAndExecuteCommand(new RemoveSegmentsCommand(JobModel)); - + ArrangeSegmentsIndixes(); - + DyeCommand.RaiseCanExecuteChanged(); } } @@ -1317,7 +1353,7 @@ namespace Tango.PPC.Jobs.ViewModels private void RepeateSegments() { - if ( (JobModel.GroupingSegments.ToList().Where(x => x.IsSelected).Count()) < 2) + if ((JobModel.GroupingSegments.ToList().Where(x => x.IsSelected).Count()) < 2) return; UndoRedoManager.Instance.InsertAndExecuteCommand(new RepeatCommand(JobModel)); ArrangeSegmentsIndixes(); @@ -1366,15 +1402,28 @@ namespace Tango.PPC.Jobs.ViewModels UndoRedoManager.Instance.ClearAll(); var colorSpaces = await _db.ColorSpaces.ToListAsync(); - + Job.ColorSpace = colorSpaces.FirstOrDefault(); Job.Version = 2; Job.NumberOfUnits = JobModel.NumberOfUnits; Job.EnableInterSegment = JobModel.InterSegmentLength > 0; Job.InterSegmentLength = JobModel.InterSegmentLength; + if (Job.SpoolType.Type == BL.Enumerations.SpoolTypes.FlatSpool) + { + Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Code == (int)BL.Enumerations.SpoolTypes.FlatSpool); + } + else if (Settings.SpoolTypeGuid != null) + { + Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Guid == Settings.SpoolTypeGuid); + } + else + { + Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Code == (int)BL.Enumerations.SpoolTypes.StandardSpool); + } + var oldSegments = Job.Segments.ToList(); - + foreach (var segment in Job.OrderedSegmentsWithGroups.ToList()) { if (segment is Segment) @@ -1389,7 +1438,7 @@ namespace Tango.PPC.Jobs.ViewModels else if (segment is SegmentsGroup) { SegmentsGroup segmentsGroup = segment as SegmentsGroup; - foreach(var groupSegment in segmentsGroup.Segments.ToList()) + foreach (var groupSegment in segmentsGroup.Segments.ToList()) { groupSegment.BrushStops.ToList().ForEach(x => { @@ -1400,15 +1449,15 @@ namespace Tango.PPC.Jobs.ViewModels _db.SegmentsGroups.Remove(segmentsGroup); } } - + Job.Segments.Clear(); - + Dictionary segmentIndexToGroup = new Dictionary(); - + //foreach (var segment in JobModel.Segments.OrderBy(x => x.SegmentIndex).ToList()) - foreach(var segment in JobModel.OrderedSegmentsWithGroups) + foreach (var segment in JobModel.OrderedSegmentsWithGroups) { - if(segment is SegmentModel innerSegment) + if (segment is SegmentModel innerSegment) { var dbSegment = new Segment(); dbSegment.Guid = System.Guid.NewGuid().ToString(); @@ -1456,7 +1505,7 @@ namespace Tango.PPC.Jobs.ViewModels } _db.BrushStops.AddRange(brushStopList); } - else if( segment is SegmentsGroupModel group) + else if (segment is SegmentsGroupModel group) { SegmentsGroup dbSegmentsGroup = new SegmentsGroup(); dbSegmentsGroup.Guid = System.Guid.NewGuid().ToString(); @@ -1464,7 +1513,7 @@ namespace Tango.PPC.Jobs.ViewModels dbSegmentsGroup.SegmentIndex = group.SegmentIndex; dbSegmentsGroup.Job = Job; _db.SegmentsGroups.Add(dbSegmentsGroup); - foreach(var segm_group in group.Segments.OrderBy(x=>x.SegmentIndex)) + foreach (var segm_group in group.Segments.OrderBy(x => x.SegmentIndex)) { var dbSegment = new Segment(); dbSegment.Guid = System.Guid.NewGuid().ToString(); @@ -1517,7 +1566,7 @@ namespace Tango.PPC.Jobs.ViewModels Job.LastUpdated = DateTime.UtcNow; Job.IsSynchronized = false; - if(Job.JobStatus != JobStatuses.Draft ) + if (Job.JobStatus != JobStatuses.Draft) { JsonSerializerSettings settings = new JsonSerializerSettings() { @@ -1527,10 +1576,10 @@ namespace Tango.PPC.Jobs.ViewModels string jsonJobModelSaved = JsonConvert.SerializeObject(JobModel, Formatting.Indented, settings); var json1 = JObject.Parse(_jsonJobModelLoaded); var json2 = JObject.Parse(jsonJobModelSaved); - if(false == JToken.DeepEquals(json1, json2)) + if (false == JToken.DeepEquals(json1, json2)) Job.JobStatus = BL.Enumerations.JobStatuses.Draft; } - + RaiseMessage(new JobSavedMessage() { Job = Job }); await _db.SaveChangesAsync(); @@ -1543,7 +1592,7 @@ namespace Tango.PPC.Jobs.ViewModels _jsonJobModelLoaded = JsonConvert.SerializeObject(JobModel, Formatting.Indented, settings1); } - + #endregion } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/IPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/IPrintingManager.cs index 0047529b0..bc05138f0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/IPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/IPrintingManager.cs @@ -27,7 +27,7 @@ namespace Tango.PPC.Common.Printing /// The job. /// The context. /// - Task Print(Job job, ObservablesContext context); + Task Print(Job job, ObservablesContext context, PrintingConfiguration config = null); /// /// Creates a sample dye job from the specified job and prints it. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs new file mode 100644 index 000000000..815936137 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Printing/PrintingConfiguration.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.Printing +{ + public class PrintingConfiguration + { + + } +} 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 d0476647b..e1f4efdcb 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 @@ -185,6 +185,7 @@ + @@ -589,7 +590,7 @@ - + \ No newline at end of file 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 c5fc6c6b2..83f4d4f29 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs @@ -55,7 +55,7 @@ namespace Tango.PPC.UI.Printing /// The job. /// The context. /// - public async Task Print(Job job, ObservablesContext context) + public async Task Print(Job job, ObservablesContext context, PrintingConfiguration printConfig = null) { ThrowIfJobInvalid(job); @@ -99,7 +99,12 @@ namespace Tango.PPC.UI.Printing var spoolType = await context.SpoolTypes.FirstOrDefaultAsync(x => x.Guid == spoolTypeGuid); if (spoolType == null) { - spoolType = await context.SpoolTypes.FirstOrDefaultAsync(x => x.Code == (int)BL.Enumerations.SpoolTypes.StandardSpool); + spoolType = await context.SpoolTypes.FirstOrDefaultAsync(x => x.Code == (int)SpoolTypes.StandardSpool); + } + + if (job.SpoolType.Type == SpoolTypes.FlatSpool) + { + spoolType = await context.SpoolTypes.FirstOrDefaultAsync(x => x.Code == (int)SpoolTypes.FlatSpool); } job.SpoolType = spoolType; diff --git a/Software/Visual_Studio/Tango.BL/DTO/RmlsSpoolDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/RmlsSpoolDTOBase.cs index c17e2b426..d140c1435 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/RmlsSpoolDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/RmlsSpoolDTOBase.cs @@ -69,6 +69,22 @@ namespace Tango.BL.DTO get; set; } + /// + /// start offset pulses + /// + public Nullable StartOffsetPulses + { + get; set; + } + + /// + /// segment offset pulses + /// + public Nullable SegmentOffsetPulses + { + get; set; + } + /// /// btsr spool tension /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/RmlsSpoolBase.cs b/Software/Visual_Studio/Tango.BL/Entities/RmlsSpoolBase.cs index 0edd11cfd..a6ae877be 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/RmlsSpoolBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/RmlsSpoolBase.cs @@ -35,6 +35,10 @@ namespace Tango.BL.Entities public event EventHandler> BottomBackingRateChanged; + public event EventHandler> StartOffsetPulsesChanged; + + public event EventHandler> SegmentOffsetPulsesChanged; + public event EventHandler> BtsrSpoolTensionChanged; public event EventHandler RmlChanged; @@ -201,6 +205,60 @@ namespace Tango.BL.Entities } } + protected Nullable _startoffsetpulses; + + /// + /// Gets or sets the rmlsspoolbase start offset pulses. + /// + + [Column("START_OFFSET_PULSES")] + + public Nullable StartOffsetPulses + { + get + { + return _startoffsetpulses; + } + + set + { + if (_startoffsetpulses != value) + { + _startoffsetpulses = value; + + OnStartOffsetPulsesChanged(value); + + } + } + } + + protected Nullable _segmentoffsetpulses; + + /// + /// Gets or sets the rmlsspoolbase segment offset pulses. + /// + + [Column("SEGMENT_OFFSET_PULSES")] + + public Nullable SegmentOffsetPulses + { + get + { + return _segmentoffsetpulses; + } + + set + { + if (_segmentoffsetpulses != value) + { + _segmentoffsetpulses = value; + + OnSegmentOffsetPulsesChanged(value); + + } + } + } + protected Nullable _btsrspooltension; /// @@ -328,6 +386,24 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(BottomBackingRate)); } + /// + /// Called when the StartOffsetPulses has changed. + /// + protected virtual void OnStartOffsetPulsesChanged(Nullable startoffsetpulses) + { + StartOffsetPulsesChanged?.Invoke(this, startoffsetpulses); + RaisePropertyChanged(nameof(StartOffsetPulses)); + } + + /// + /// Called when the SegmentOffsetPulses has changed. + /// + protected virtual void OnSegmentOffsetPulsesChanged(Nullable segmentoffsetpulses) + { + SegmentOffsetPulsesChanged?.Invoke(this, segmentoffsetpulses); + RaisePropertyChanged(nameof(SegmentOffsetPulses)); + } + /// /// Called when the BtsrSpoolTension has changed. /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RMLS_SPOOLS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RMLS_SPOOLS.cs index e6f7d52f7..e89c734c8 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RMLS_SPOOLS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RMLS_SPOOLS.cs @@ -23,6 +23,8 @@ namespace Tango.DAL.Remote.DB public Nullable LENGTH { get; set; } public Nullable BACKING_RATE { get; set; } public Nullable BOTTOM_BACKING_RATE { get; set; } + public Nullable START_OFFSET_PULSES { get; set; } + public Nullable SEGMENT_OFFSET_PULSES { get; set; } public Nullable BTSR_SPOOL_TENSION { get; set; } public virtual RML RML { 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 f20679667..0e16606a7 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -1385,6 +1385,8 @@ + + @@ -6890,6 +6892,8 @@ + + @@ -10277,6 +10281,8 @@ + + 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 09dd59ad8..4c2849008 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,102 +5,102 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 997ac4b13..299f1bb4f 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -2799,6 +2799,8 @@ namespace Tango.Integration.Operation ticket.Spool.BackingRate = rmlSpool.BackingRate != null ? rmlSpool.BackingRate.Value : ticket.Spool.BackingRate; ticket.Spool.BottomBackingRate = rmlSpool.BottomBackingRate != null ? rmlSpool.BottomBackingRate.Value : ticket.Spool.BottomBackingRate; ticket.Spool.BtsrSpoolTension = rmlSpool.BtsrSpoolTension != null ? rmlSpool.BtsrSpoolTension.Value : ticket.Spool.BtsrSpoolTension; + ticket.Spool.StartOffsetPulses = rmlSpool.StartOffsetPulses != null ? rmlSpool.StartOffsetPulses.Value : ticket.Spool.StartOffsetPulses; + ticket.Spool.SegmentOffsetPulses = rmlSpool.SegmentOffsetPulses != null ? rmlSpool.SegmentOffsetPulses.Value : ticket.Spool.SegmentOffsetPulses; } //Override spool parameters from Machine Spool calibration @@ -2806,6 +2808,10 @@ namespace Tango.Integration.Operation if (machineSpool != null) { ticket.Spool.LimitSwitchStartPointOffset = machineSpool.LimitSwitchStartPointOffset != null ? machineSpool.LimitSwitchStartPointOffset.Value : ticket.Spool.LimitSwitchStartPointOffset; + ticket.Spool.StartOffsetPulses = machineSpool.StartOffsetPulses != null ? machineSpool.StartOffsetPulses.Value : ticket.Spool.StartOffsetPulses; + ticket.Spool.BackingRate = machineSpool.BackingRate != null ? machineSpool.BackingRate.Value : ticket.Spool.BackingRate; + ticket.Spool.SegmentOffsetPulses = machineSpool.SegmentOffsetPulses != null ? machineSpool.SegmentOffsetPulses.Value : ticket.Spool.SegmentOffsetPulses; + ticket.Spool.BottomBackingRate = machineSpool.BottomBackingRate != null ? machineSpool.BottomBackingRate.Value : ticket.Spool.BottomBackingRate; } //Thread Parameters -- cgit v1.3.1