aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs248
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs16
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs4
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs3
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs10
6 files changed, 190 insertions, 93 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs
index 596eb9316..752ae08b2 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs
@@ -1,6 +1,8 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Data.Entity;
using System.IO;
using System.Linq;
using System.Text;
@@ -12,6 +14,7 @@ using Tango.BL;
using Tango.BL.Builders;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
+using Tango.BL.FineTuning;
using Tango.Core;
using Tango.Core.Commands;
using Tango.Core.DI;
@@ -38,6 +41,7 @@ namespace Tango.PPC.Jobs.Dialogs
public class VectorFineTuningDialogVM : DialogViewVM
{
private JobHandler _handler;
+ private String _sessionID;
#region Properties
@@ -68,7 +72,7 @@ namespace Tango.PPC.Jobs.Dialogs
/// </summary>
[TangoInject]
public IPrintingManager PrintingManager { get; set; }
-
+
[TangoInject]
public INavigationManager NavigationManager { get; set; }
@@ -236,7 +240,7 @@ namespace Tango.PPC.Jobs.Dialogs
}
}
}
-
+
protected Double _cyan;
/// <summary>
@@ -371,11 +375,11 @@ namespace Tango.PPC.Jobs.Dialogs
get { return _selectedLog; }
set
{
-
- _selectedLog = value;
- RaisePropertyChangedAuto();
- OKCommand.RaiseCanExecuteChanged();
-
+
+ _selectedLog = value;
+ RaisePropertyChangedAuto();
+ OKCommand.RaiseCanExecuteChanged();
+
}
}
@@ -394,14 +398,16 @@ namespace Tango.PPC.Jobs.Dialogs
public bool IsJobRunning
{
get { return _isJobRunning; }
- set { _isJobRunning = value;
+ set
+ {
+ _isJobRunning = value;
RaisePropertyChangedAuto();
- Application.Current.Dispatcher.Invoke(() =>
- {
- OKCommand.RaiseCanExecuteChanged();
- RaisePropertyChanged(nameof(IsDisableInputLAB));
- });
- }
+ Application.Current.Dispatcher.Invoke(() =>
+ {
+ OKCommand.RaiseCanExecuteChanged();
+ RaisePropertyChanged(nameof(IsDisableInputLAB));
+ });
+ }
}
private bool _isJobFailed;
@@ -455,7 +461,7 @@ namespace Tango.PPC.Jobs.Dialogs
TestCommand = new RelayCommand(StartJob, CanStartJob);
StopCommand = new RelayCommand(StopTest);
DeleteTrialCommand = new RelayCommand(DeleteTrialLog);
- PressedCommand = new RelayCommand((x)=>{ });;
+ PressedCommand = new RelayCommand((x) => { }); ;
IsExpanderOpened = true;
@@ -464,16 +470,19 @@ namespace Tango.PPC.Jobs.Dialogs
public void Init(BrushStopModel brushstop, double l, double a, double b, System.Windows.Media.Color targetColor)
{
+ _sessionID = brushstop.Guid + $"{l}{a}{b}";
+
MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted;
MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded;
MachineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted;
+ MachineProvider.MachineOperator.JobRunsLogger.JobRunAvailable += JobRunsLogger_JobRunAvailable;
BrushStopModel = brushstop.Clone();
BrushStopModel.Guid = brushstop.Guid;
TargetL = l;
TargetB = b;
TargetA = a;
-
+
TargetColor = targetColor;
BrushStopModel.ConvertColorToVolume();
@@ -497,18 +506,18 @@ namespace Tango.PPC.Jobs.Dialogs
TrialsLogitems = new SynchronizedObservableCollection<TrialsLogModel>();
TrialsLogitems.Add(ActiveLogModel);
//TEST
- //for(int i = 1; i < 10; i++)
- //{
- // var model = new TrialsLogModel(i , Cyan, Magenta, Yellow, Black);
- // TrialsLogitems.Insert(0, model);
- //}
-
+ //for(int i = 1; i < 10; i++)
+ //{
+ // var model = new TrialsLogModel(i , Cyan, Magenta, Yellow, Black);
+ // TrialsLogitems.Insert(0, model);
+ //}
+
}
else
{
- TrialsLogitems = new SynchronizedObservableCollection<TrialsLogModel>(TestColor.TrialslogList.OrderByDescending(x=>x.TrialNumber));
-
- int maxTrialsNumber = TrialsLogitems.Max( x=>x.TrialNumber);
+ TrialsLogitems = new SynchronizedObservableCollection<TrialsLogModel>(TestColor.TrialslogList.OrderByDescending(x => x.TrialNumber));
+
+ int maxTrialsNumber = TrialsLogitems.Max(x => x.TrialNumber);
ActiveLogModel = TrialsLogitems.FirstOrDefault(x => x.TrialNumber == maxTrialsNumber);
if (ActiveLogModel == null)
{
@@ -520,7 +529,7 @@ namespace Tango.PPC.Jobs.Dialogs
}
if (ActiveLogModel.IsTested == false)
{
- if(ActiveLogModel.L != null)
+ if (ActiveLogModel.L != null)
{
MeasuredL = ActiveLogModel.L;
}
@@ -537,13 +546,13 @@ namespace Tango.PPC.Jobs.Dialogs
ActiveLogModel.IsActiveTrial = true;
ActiveLogModel.IsSelectionEnable = true;
-
+
var minValue = TrialsLogitems.Min(x => x.DeltaE);
- if(minValue != null && minValue < 2)
+ if (minValue != null && minValue < 2)
{
- TrialsLogitems.Where(x=>x.DeltaE == minValue).ToList().ForEach(i => i.IsBest = true);
+ TrialsLogitems.Where(x => x.DeltaE == minValue).ToList().ForEach(i => i.IsBest = true);
}
-
+
OKCommand.RaiseCanExecuteChanged();
TestCommand.RaiseCanExecuteChanged();
@@ -580,8 +589,8 @@ namespace Tango.PPC.Jobs.Dialogs
// Filter = ExplorerFileDefinition.PDFFile.Extension,
// Title = "Save Color Correction Report",
// });
-
- // if (result != null)
+
+ // if (result != null)
{
DateTime reportDateTime = DateTime.UtcNow.ToLocalTime();
ColorCorrectionRepotVM vm = new ColorCorrectionRepotVM()
@@ -606,13 +615,13 @@ namespace Tango.PPC.Jobs.Dialogs
PdfWpfWriter writer = new PdfWpfWriter();
writer.AddElement(new ColorCorrectionReport() { DataContext = vm });
string path = StorageProvider.Drive.Name + "\\Color Correction Report_" + reportDateTime.ToString(@"MM_dd_y_HH_mm") + ExplorerFileDefinition.PDFFile.Extension;
- if(File.Exists(path))
+ if (File.Exists(path))
{
path = StorageProvider.Drive.Name + "\\Color Correction Report_" + reportDateTime.ToString(@"MM_dd_y_HH_mm") + "_1" + ExplorerFileDefinition.PDFFile.Extension;
}
writer.Save(path);
await NotificationProvider.ShowSuccess("Color Correction Report saved successfully.");
- LogManager.Log( $"Color Correction Report saved successfully to file {path}.");
+ LogManager.Log($"Color Correction Report saved successfully to file {path}.");
}
catch (Exception ex)
{
@@ -630,7 +639,7 @@ namespace Tango.PPC.Jobs.Dialogs
{
return;
}
- ActiveLogModel = TrialsLogitems.FirstOrDefault(x=> x.TrialNumber == 0);
+ ActiveLogModel = TrialsLogitems.FirstOrDefault(x => x.TrialNumber == 0);
ActiveLogModel.L = ActiveLogModel.A = ActiveLogModel.B = null;
ActiveLogModel.NewSuggestionL = ActiveLogModel.NewSuggestionA = ActiveLogModel.NewSuggestionB = 0;
ActiveLogModel.DeltaE = null;
@@ -650,22 +659,22 @@ namespace Tango.PPC.Jobs.Dialogs
private void DeleteTrialLog(object obj)
{
- if (SelectedLog != null )
+ if (SelectedLog != null)
{
- if (SelectedLog.TrialNumber != 0 )
+ if (SelectedLog.TrialNumber != 0)
{
bool isLastItem = (TrialsLogitems.Count - 1) == SelectedLog.TrialNumber;
TrialsLogitems.Remove(SelectedLog);
-
+
int trialNumber = 0;
- foreach ( var trial in TrialsLogitems.OrderBy(x=>x.TrialNumber))
+ foreach (var trial in TrialsLogitems.OrderBy(x => x.TrialNumber))
{
trial.TrialNumber = trialNumber;
trialNumber++;
}
- var max = TrialsLogitems.Max(x=>x.TrialNumber);
+ var max = TrialsLogitems.Max(x => x.TrialNumber);
ActiveLogModel = TrialsLogitems.FirstOrDefault(x => x.TrialNumber == max);
- if(isLastItem)
+ if (isLastItem)
{
ActiveLogModel.IsTested = false;
_measuredL = ActiveLogModel.L;
@@ -682,7 +691,7 @@ namespace Tango.PPC.Jobs.Dialogs
TestColor.TrialslogList.AddRange(TrialsLogitems);
TrialsLogEngine.Default.UpdateTest(TestColor);
}
-
+
RaisePropertyChanged(nameof(IsDisableInputLAB));
SelectedLog = null;
var minDelataE = TrialsLogitems.Min(x => x.DeltaE);
@@ -690,7 +699,7 @@ namespace Tango.PPC.Jobs.Dialogs
TrialsLogitems.ToList().ForEach(x => x.IsBest = (x.DeltaE == minDelataE));
RaisePropertyChanged(nameof(TrialNumber));
}
- else if( TrialsLogitems.Count == 1)
+ else if (TrialsLogitems.Count == 1)
{
ActiveLogModel.L = ActiveLogModel.A = ActiveLogModel.B = null;
ActiveLogModel.NewSuggestionL = ActiveLogModel.NewSuggestionA = ActiveLogModel.NewSuggestionB = 0;
@@ -715,44 +724,66 @@ namespace Tango.PPC.Jobs.Dialogs
protected override async void Accept()
{
- if(IsBusy)
+ if (IsBusy)
return;
IsBusy = true;
OnClose();
-
- if(SelectedLog.TrialNumber == 0 )
+
+ if (SelectedLog.TrialNumber == 0)
{
IsBusy = false;
base.Accept();
return;
}
- var prevtrial = TrialsLogitems.FirstOrDefault( x=> x.TrialNumber == (SelectedLog.TrialNumber -1));
- if(prevtrial != null && prevtrial.DeltaE >=2)
+ var prevtrial = TrialsLogitems.FirstOrDefault(x => x.TrialNumber == (SelectedLog.TrialNumber - 1));
+ if (prevtrial != null && prevtrial.DeltaE >= 2)
{
- if( false == await NotificationProvider.ShowQuestion("Please note that the color you have chosen is not the closest one."))
+ if (false == await NotificationProvider.ShowQuestion("Please note that the color you have chosen is not the closest one."))
{
IsBusy = false;
return;
}
}
-
+
BrushStopModel.PreventPropertyUpdate = true;
BrushStopModel.Cyan = SelectedLog.C;
BrushStopModel.Magenta = SelectedLog.M;
BrushStopModel.Yellow = SelectedLog.Y;
BrushStopModel.PreventPropertyUpdate = false;
BrushStopModel.Black = SelectedLog.K;
-
+
BrushStopModel.PreventPropertyUpdate = true;
BrushStopModel.L = SelectedLog.SuggestionL;
BrushStopModel.A = SelectedLog.SuggestionA;
BrushStopModel.B = SelectedLog.SuggestionB;
BrushStopModel.PreventPropertyUpdate = false;
-
+
+
+
if (TestColor != null)
{
TrialsLogEngine.Default.Delete(TestColor);
}
+
+ try
+ {
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ var selectedRun = await db.JobRuns.FirstOrDefaultAsync(x => x.Guid == SelectedLog.JobRunGuid);
+ if (selectedRun != null)
+ {
+ VectorFineTuningRunModel model = JsonConvert.DeserializeObject<VectorFineTuningRunModel>(selectedRun.FineTuningString);
+ model.Approved = true;
+ selectedRun.FineTuningString = JsonConvert.SerializeObject(model);
+ await db.SaveChangesAsync();
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error updating the selected job run fine tuning db entry.");
+ }
+
IsBusy = false;
base.Accept();
}
@@ -761,7 +792,7 @@ namespace Tango.PPC.Jobs.Dialogs
{
OnClose();
- if (TestColor != null )
+ if (TestColor != null)
{
if (TrialsLogitems.Count > 0)
{
@@ -776,7 +807,7 @@ namespace Tango.PPC.Jobs.Dialogs
//else
// TrialsLogEngine.Default.Delete(TestColor);
}
- else if(TrialsLogitems.Count > 0)
+ else if (TrialsLogitems.Count > 0)
{
TestColor = new TestColor();
TestColor.BrushStopGuid = BrushStopModel.Guid;
@@ -794,6 +825,7 @@ namespace Tango.PPC.Jobs.Dialogs
MachineProvider.MachineOperator.PrintingStarted -= MachineOperator_PrintingStarted;
MachineProvider.MachineOperator.PrintingEnded -= MachineOperator_PrintingEnded;
MachineProvider.MachineOperator.PrintingCompleted -= MachineOperator_PrintingCompleted;
+ MachineProvider.MachineOperator.JobRunsLogger.JobRunAvailable -= JobRunsLogger_JobRunAvailable;
}
private bool IsValidLAB()
@@ -805,7 +837,7 @@ namespace Tango.PPC.Jobs.Dialogs
return true;
}
- private void OnLABChanged()
+ private void OnLABChanged()
{
if (ActiveLogModel == null)
return;
@@ -822,7 +854,7 @@ namespace Tango.PPC.Jobs.Dialogs
//{
// await NotificationProvider.ShowInfo("Color is out of gamut!");
//}
-
+
var deltaE = DeltaE_CMC(TargetL, TargetA, TargetB, (double)MeasuredL, (double)MeasuredA, (double)MeasuredB);
ActiveLogModel.DeltaE = deltaE;
ValidationTests();
@@ -838,22 +870,24 @@ namespace Tango.PPC.Jobs.Dialogs
{
if (ActiveLogModel.DeltaE <= 0.5)
{
- if(true == await NotificationProvider.ShowQuestion("Previous trial seems to be very close; no more trials are recommended"))
+ if (true == await NotificationProvider.ShowQuestion("Previous trial seems to be very close; no more trials are recommended"))
return;
}
BrushStopModel.PreventPropertyUpdate = true;
-
- CalculateSuggestionLAB( ActiveLogModel);
-
+
+ CalculateSuggestionLAB(ActiveLogModel);
+
BrushStopModel.PreventPropertyUpdate = true;
BrushStopModel.L = ActiveLogModel.NewSuggestionL;
BrushStopModel.A = ActiveLogModel.NewSuggestionA;
BrushStopModel.B = ActiveLogModel.NewSuggestionB;
BrushStopModel.PreventPropertyUpdate = false;
-
+
+
+
//calculate CMYK
BrushStopModel.FineTuningConverter();
- if(BrushStopModel.IsOutOfGamut)
+ if (BrushStopModel.IsOutOfGamut)
{
ActiveLogModel.NewSuggestionL = BrushStopModel.L;
ActiveLogModel.NewSuggestionA = BrushStopModel.A;
@@ -866,20 +900,21 @@ namespace Tango.PPC.Jobs.Dialogs
using (ObservablesContext db = ObservablesContext.CreateDefault())
{
Job job = new Job();
+ job.Guid = BrushStopModel.SegmentModel.Job.Guid;
+ job.ID = BrushStopModel.SegmentModel.Job.ID;
job.EnableLubrication = true;
job.Designation = JobDesignations.FineTuning;
job.Machine = await new MachineBuilder(db).Set(MachineProvider.Machine.Guid).WithConfiguration().WithSpools().WithCats().WithVersion().BuildAsync();
var trialNumber = ActiveLogModel.TrialNumber + 1;
- job.Name = $"Manual color test #{trialNumber}";
+ job.Name = BrushStopModel.SegmentModel.Job.Name;
job.Rml = await new RmlBuilder(db).Set(BrushStopModel.SegmentModel.Job.Rml.Guid).WithActiveParametersGroup().WithCAT(MachineProvider.Machine.Guid).WithCCT().WithGbdAndLub().WithLiquidFactors().WithSpools().BuildAsync();
job.SpoolType = db.SpoolTypes.FirstOrDefault(x => x.Guid == settings.SpoolTypeGuid);
job.WindingMethod = db.WindingMethods.FirstOrDefault();
-
-
+ job.VectorFineTuningRunModel = CreateFineTuningRunModel();
Segment segment = new Segment();
- segment.Name = "Standard Segment";
+ segment.Name = "VFT Segment";
segment.Length = settings.FineTuningTrialLengthMeters;
segment.Job = job;
segment.JobGuid = job.Guid;
@@ -891,6 +926,14 @@ namespace Tango.PPC.Jobs.Dialogs
stop.ColorSpace = db.ColorSpaces.FirstOrDefault(x => x.Code == (int)ColorSpaces.Volume);
stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, job.Rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault());
+ stop.BestMatchR = BrushStopModel.BestMatchRed;
+ stop.BestMatchG = BrushStopModel.BestMatchGreen;
+ stop.BestMatchB = BrushStopModel.BestMatchBlue;
+
+ stop.L = BrushStopModel.L;
+ stop.A = BrushStopModel.A;
+ stop.B = BrushStopModel.B;
+
stop.SetVolume(LiquidTypes.Cyan, BrushStopModel.Cyan);
stop.SetVolume(LiquidTypes.Magenta, BrushStopModel.Magenta);
stop.SetVolume(LiquidTypes.Yellow, BrushStopModel.Yellow);
@@ -932,7 +975,7 @@ namespace Tango.PPC.Jobs.Dialogs
IsJobFailed = false;
IsJobRunning = true;
});
-
+
//e.JobHandler.CanCancelChanged += JobHandler_CanCancelChanged;
}
}
@@ -982,7 +1025,7 @@ namespace Tango.PPC.Jobs.Dialogs
private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e)
{
-
+
}
private void MachineOperator_PrintingCompleted(object sender, PrintingEventArgs e)
@@ -1049,9 +1092,9 @@ namespace Tango.PPC.Jobs.Dialogs
ActiveLogModel.SuggestionA = suggestionA;
ActiveLogModel.SuggestionB = suggestionB;
TrialsLogitems.Insert(0, ActiveLogModel);
- var minDelataE = TrialsLogitems.Min(x=>x.DeltaE);
- if(minDelataE != null && minDelataE < 2)
- TrialsLogitems.ToList().ForEach( x=> x.IsBest = (x.DeltaE == minDelataE));
+ var minDelataE = TrialsLogitems.Min(x => x.DeltaE);
+ if (minDelataE != null && minDelataE < 2)
+ TrialsLogitems.ToList().ForEach(x => x.IsBest = (x.DeltaE == minDelataE));
RaisePropertyChanged(nameof(TrialsLogitems));
_measuredL = null;
@@ -1143,7 +1186,7 @@ namespace Tango.PPC.Jobs.Dialogs
return Math.Sqrt(Math.Pow(L1 - L2, 2) + Math.Pow(a1 - a2, 2) + Math.Pow(b1 - b2, 2));
}
- private async void ValidationTests()
+ private async void ValidationTests()
{
//if (ActiveLogModel.DeltaE <= 0.5)
//{
@@ -1151,25 +1194,25 @@ namespace Tango.PPC.Jobs.Dialogs
// return ;
//}
if (TrialsLogitems.Count == 1 || ActiveLogModel.DeltaE == null)
- return ;
+ return;
int currentTrialNumber = ActiveLogModel.TrialNumber;
- if(TrialsLogitems.Count >= 3)
+ if (TrialsLogitems.Count >= 3)
{
- var item = TrialsLogitems.FirstOrDefault( x=>x.TrialNumber == currentTrialNumber - 2);
+ var item = TrialsLogitems.FirstOrDefault(x => x.TrialNumber == currentTrialNumber - 2);
var item1 = TrialsLogitems.FirstOrDefault(x => x.TrialNumber == currentTrialNumber - 1);
var item2 = ActiveLogModel;
- if(item1 != null && item2 != null && item != null)
+ if (item1 != null && item2 != null && item != null)
{//dEi+2- dEi+1>0.5 and dEi+1-dEi>0.5
- if (( item2.DeltaE - item1.DeltaE) > 0.5 && (item1.DeltaE - item.DeltaE) > 0.5)
+ if ((item2.DeltaE - item1.DeltaE) > 0.5 && (item1.DeltaE - item.DeltaE) > 0.5)
{
await NotificationProvider.ShowInfo("It seems that we can’t get you any closer");
- return ;
+ return;
}
//Math.Abs
//| dEi+1- dEi | and |dEi+2 -dEi+1|<=0.1.
- if(Math.Abs((double)item1.DeltaE - (double)item.DeltaE)<= 0.1 && Math.Abs((double)item2.DeltaE - (double)item1.DeltaE) <= 0.1)
+ if (Math.Abs((double)item1.DeltaE - (double)item.DeltaE) <= 0.1 && Math.Abs((double)item2.DeltaE - (double)item1.DeltaE) <= 0.1)
{
await NotificationProvider.ShowInfo("It seems that we can’t get you any closer");
return;
@@ -1180,7 +1223,7 @@ namespace Tango.PPC.Jobs.Dialogs
{
var item = TrialsLogitems.FirstOrDefault(x => x.TrialNumber == currentTrialNumber - 1);
var item1 = ActiveLogModel;
- if(item == null || item1 == null)
+ if (item == null || item1 == null)
return;
var deltaE_reg = DeltaE_regular(TargetL, TargetA, TargetB, (double)MeasuredL, (double)MeasuredA, (double)MeasuredB);
@@ -1190,7 +1233,7 @@ namespace Tango.PPC.Jobs.Dialogs
await NotificationProvider.ShowInfo("It seems that we can’t get you any closer");
return;
}
- if(Math.Abs((double)item1.C - (double)item.C) < 0.1
+ if (Math.Abs((double)item1.C - (double)item.C) < 0.1
&& Math.Abs((double)item1.M - (double)item.M) < 0.1
&& Math.Abs((double)item1.Y - (double)item.Y) < 0.1
&& Math.Abs((double)item1.K - (double)item.K) < 0.1)
@@ -1202,13 +1245,13 @@ namespace Tango.PPC.Jobs.Dialogs
return;
}
- private bool CalculateSuggestionLAB( TrialsLogModel trial)
+ private bool CalculateSuggestionLAB(TrialsLogModel trial)
{
- if(MeasuredL != null && MeasuredA != null && MeasuredB != null)
+ if (MeasuredL != null && MeasuredA != null && MeasuredB != null)
{
- trial.NewSuggestionL = LimitToRange((trial.SuggestionL + (TargetL - (double)MeasuredL)),0, 100) ;
+ trial.NewSuggestionL = LimitToRange((trial.SuggestionL + (TargetL - (double)MeasuredL)), 0, 100);
trial.NewSuggestionA = LimitToRange((trial.SuggestionA + (TargetA - (double)MeasuredA)), -128, 127);
- trial.NewSuggestionB = LimitToRange((trial.SuggestionB + (TargetB - (double)MeasuredB )), -128, 127);
+ trial.NewSuggestionB = LimitToRange((trial.SuggestionB + (TargetB - (double)MeasuredB)), -128, 127);
LogManager.Log($" Fine Tuning. Suggestion (calculated) LAB L:'{trial.NewSuggestionL}'A:'{trial.NewSuggestionA}' B:'{trial.NewSuggestionB}'.");
return true;
@@ -1231,5 +1274,38 @@ namespace Tango.PPC.Jobs.Dialogs
#endregion
+ #region JobRun Extensions
+
+ private VectorFineTuningRunModel CreateFineTuningRunModel()
+ {
+ VectorFineTuningRunModel model = new VectorFineTuningRunModel();
+
+ model.FineTuningSessionID = _sessionID;
+ model.FineTuningTrialNumber = ActiveLogModel.TrialNumber + 1;
+ model.JobName = BrushStopModel.SegmentModel.Job.Name;
+
+ model.FineTuningTargetL = TargetL;
+ model.FineTuningTargetA = TargetA;
+ model.FineTuningTargetB = TargetB;
+
+ model.FineTuningSuggestionL = BrushStopModel.L;
+ model.FineTuningSuggestionA = BrushStopModel.A;
+ model.FineTuningSuggestionB = BrushStopModel.B;
+
+ model.FineTuningMeasuredL = MeasuredL;
+ model.FineTuningMeasuredA = MeasuredA;
+ model.FineTuningMeasuredB = MeasuredB;
+
+ return model;
+ }
+
+ private void JobRunsLogger_JobRunAvailable(object sender, Integration.JobRuns.JobRunAvailableEventArgs e)
+ {
+ ActiveLogModel.JobRunGuid = e.JobRun.Guid;
+ }
+
+
+ #endregion
+
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
index f4a239c98..2a347df3d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
@@ -17,6 +17,7 @@ using Tango.Core.ExtensionMethods;
using Newtonsoft.Json;
using Tango.Settings;
using Tango.PPC.Common;
+using Tango.PMR.ColorLab;
namespace Tango.PPC.Jobs.Models
{
@@ -375,6 +376,10 @@ namespace Tango.PPC.Jobs.Models
}
}
+ public int BestMatchRed { get; set; }
+ public int BestMatchGreen { get; set; }
+ public int BestMatchBlue { get; set; }
+
protected Double _offsetpercent;
/// <summary>
@@ -1405,10 +1410,13 @@ namespace Tango.PPC.Jobs.Models
ColorSpaces colorSpace = ColorSpaces.LAB;
BrushStop stop = CreateBrushStop(colorSpace);
+
+ ConversionOutput output = null;
+
try
{
IsBusy = true;
- var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false);
+ output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false);
_cyan = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume);
_yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume);
@@ -1424,7 +1432,11 @@ namespace Tango.PPC.Jobs.Models
_l = output.SingleCoordinates.L;
_a = output.SingleCoordinates.A;
_b = output.SingleCoordinates.B;
- }
+ }
+
+ BestMatchRed = output.SingleCoordinates.Red;
+ BestMatchGreen = output.SingleCoordinates.Green;
+ BestMatchBlue = output.SingleCoordinates.Blue;
}
catch (Exception ex)
{
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs
index 2176b230a..d2ad7e96b 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs
@@ -20,6 +20,10 @@ namespace Tango.PPC.Jobs.Models
#region Properties
+ public String Guid { get; set; }
+
+ public int ID { get; set; }
+
protected String _name;
public String Name
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs
index a4913dbef..bae1df037 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs
@@ -12,6 +12,9 @@ namespace Tango.PPC.Jobs.Models
{
#region Properties
+ [BsonIgnore]
+ public String JobRunGuid { get; set; }
+
private int _trialNumber;
public int TrialNumber
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 3e94a42c5..60db14e21 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
@@ -515,6 +515,8 @@ namespace Tango.PPC.Jobs.ViewModels
var jobModel = new JobModel(ColorSpaces)
{
Name = Job.Name,
+ Guid = Job.Guid,
+ ID = Job.ID,
CreationDate = Job.CreationDate,
LengthPercentageFactor = Job.LengthPercentageFactor,
NumberOfUnits = Job.NumberOfUnits,
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs
index 769a9a5c9..1ceb47ebd 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs
@@ -143,11 +143,11 @@ namespace Tango.PPC.Jobs.ViewModels
}
else if (e.Job.Designation == BL.Enumerations.JobDesignations.FineTuning)
{
- NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' fine tuning completed successfully", e.Job.Name), "Tap to approve or repeat.", MessageNotificationItem.MessageNotificationItemTypes.Success, () =>
- {
- NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job, Intent = JobNavigationIntent.FineTuning });
- NavigationManager.ClearHistoryExcept<JobsView>();
- }));
+ //NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' fine tuning completed successfully", e.Job.Name), "Tap to approve or repeat.", MessageNotificationItem.MessageNotificationItemTypes.Success, () =>
+ //{
+ // NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job, Intent = JobNavigationIntent.FineTuning });
+ // NavigationManager.ClearHistoryExcept<JobsView>();
+ //}));
}
else
{