diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs index 38413b24c..6a1c830b5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs @@ -928,6 +928,8 @@ namespace Tango.PPC.Jobs.ViewModels rmlGuid = Settings.DefaultRmlGuid; } + var machine = await new MachineBuilder(db).SetFirst().WithConfiguration().BuildAsync(); + Job job = new Job(); job.LastUpdated = DateTime.UtcNow; job.JobSource = JobSource.Local; @@ -954,8 +956,11 @@ namespace Tango.PPC.Jobs.ViewModels IColorConverter converter = new DefaultColorConverter(); + int segmentIndex = 0; + foreach (var stop in segments.SelectMany(x => x.BrushStops).Where(x => x.BrushColorSpace != ColorSpaces.RGB)) { + segmentIndex++; var output = converter.Convert(stop, false); var suggestion = output.CreateSingleSuggestion(); stop.Red = suggestion.Color.R; @@ -964,13 +969,20 @@ namespace Tango.PPC.Jobs.ViewModels stop.BestMatchR = suggestion.Color.R; stop.BestMatchG = suggestion.Color.G; stop.BestMatchB = suggestion.Color.B; + + stop.SetLiquidVolumes(machine.Configuration, job.Rml, job.Rml.GetActiveProcessGroup().ProcessParametersTables[suggestion.ProcessParametersTableIndex]); + + if (stop.IsLiquidVolumesOutOfRange) + { + throw new InvalidOperationException($"Volumes out of range for thread '{job.Rml.FinalName}' at segment {segmentIndex}."); + } } db.Jobs.Add(job); await db.SaveChangesAsync(); } - LoadJobs(() => + LoadJobs(() => { NotificationProvider.PushNotification(new MessageNotificationItem($"Csv job '{e.Name}' received successfully.", "", MessageNotificationItem.MessageNotificationItemTypes.Success, () => { }, NotificationItem.NotificationPriority.Low)); e.Confirm(); |
