diff options
| author | Roy Ben Shabat <roy.mail.net@gmail.com> | 2025-09-09 06:51:14 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <roy.mail.net@gmail.com> | 2025-09-09 06:51:14 +0300 |
| commit | 1cbef6c4d79a1db8c8d3923edfec2e50277caa51 (patch) | |
| tree | 6487fb1a2e4c85327bc74348018ad1621cc28fba /Software/Visual_Studio/Tango.Telemetry | |
| parent | 987e4992d01a0bc84170498c40dad0621542f46c (diff) | |
| download | Tango-1cbef6c4d79a1db8c8d3923edfec2e50277caa51.tar.gz Tango-1cbef6c4d79a1db8c8d3923edfec2e50277caa51.zip | |
RMl Default Liquid Factor + Machine Type + Improved RML Filter Loading.
Diffstat (limited to 'Software/Visual_Studio/Tango.Telemetry')
| -rw-r--r-- | Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs | 54 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Telemetry/Telemetries/TelemetryJobRun.cs | 40 |
2 files changed, 77 insertions, 17 deletions
diff --git a/Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs b/Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs index 8d8023c95..81bff1eb4 100644 --- a/Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs +++ b/Software/Visual_Studio/Tango.Telemetry/Mappers/JobRunMapper.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Data.Entity; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Tango.BL; @@ -63,6 +64,8 @@ namespace Tango.Telemetry.Mappers } } + + public static TelemetryJobRun MapJobRun(JobRun run) { Init(); @@ -106,23 +109,7 @@ namespace Tango.Telemetry.Mappers tRun.Status = run.JobRunStatus.ToString(); - tRun.OutputCyan = run.CyanQuantity; - tRun.OutputMagenta = run.MagentaQuantity; - tRun.OutputYellow = run.YellowQuantity; - tRun.OutputBlack = run.BlackQuantity; - tRun.OutputLightCyan = run.LightCyanQuantity; - tRun.OutputLightMagenta = run.LightMagentaQuantity; - tRun.OutputLightYellow = run.LightYellowQuantity; - tRun.OutputBlue = run.BlueQuantity; - tRun.OutputLightBlue = run.LightBlueQuantity; - tRun.OutputOrange = run.OrangeQuantity; - tRun.OutputLightOrange = run.LightOrangeQuantity; - tRun.OutputRubine = run.RubineQuantity; - tRun.OutputLightRubine = run.LightRubineQuantity; - tRun.OutputNavy = run.NavyQuantity; - tRun.OutputViolet = run.VioletQuantity; - tRun.OutputTransparent = run.TransparentQuantity; - tRun.OutputLubricant = run.LubricantQuantity; + MapToOutputs(run, tRun); tRun.FailureReason = run.FailedMessage; @@ -319,5 +306,38 @@ namespace Tango.Telemetry.Mappers return tRun; } + + public static void MapToOutputs(JobRun run, TelemetryJobRun tRun) + { + if (run == null || tRun == null) return; + + var runProps = run.GetType() + .GetProperties(BindingFlags.Instance | BindingFlags.Public) + .Where(p => p.CanRead && p.PropertyType == typeof(long)) + .Where(p => p.Name.EndsWith("Quantity", StringComparison.OrdinalIgnoreCase)) + .ToDictionary(p => p.Name.ToLower(), p => p); + + var tRunProps = tRun.GetType() + .GetProperties(BindingFlags.Instance | BindingFlags.Public) + .Where(p => p.CanWrite && p.PropertyType == typeof(long)) + .Where(p => p.Name.StartsWith("Output", StringComparison.OrdinalIgnoreCase)) + .ToDictionary(p => p.Name.ToLower(), p => p); + + foreach (var tProp in tRunProps.Values) + { + // "OutputCyan" -> "CyanQuantity" + var baseName = tProp.Name.Substring("Output".Length); + var runKey = (baseName + "Quantity").ToLower(); + + if (!runProps.TryGetValue(runKey, out var runProp)) + { + LogManager.Default.Log($"Could not locate liquid quantity field {runKey} for JobRun Telemetry object.", LogCategory.Warning); + continue; + } + + var value = (long)(runProp.GetValue(run) ?? 0L); + tProp.SetValue(tRun, value); + } + } } } diff --git a/Software/Visual_Studio/Tango.Telemetry/Telemetries/TelemetryJobRun.cs b/Software/Visual_Studio/Tango.Telemetry/Telemetries/TelemetryJobRun.cs index c5f4da8ea..1c52fb2c4 100644 --- a/Software/Visual_Studio/Tango.Telemetry/Telemetries/TelemetryJobRun.cs +++ b/Software/Visual_Studio/Tango.Telemetry/Telemetries/TelemetryJobRun.cs @@ -122,6 +122,46 @@ namespace Tango.Telemetry.Telemetries public long OutputTransparent { get; set; } public long OutputLubricant { get; set; } + public long OutputTwTransparentInk { get; set; } + public long OutputC1Ti { get; set; } + public long OutputTwCyan { get; set; } + public long OutputTwLightCyan { get; set; } + public long OutputTwMagenta { get; set; } + public long OutputTwLightMagenta { get; set; } + public long OutputTwYellow { get; set; } + public long OutputTwLightYellow { get; set; } + public long OutputC1Yellow { get; set; } + public long OutputC1LightYellow { get; set; } + public long OutputTwBlack { get; set; } + public long OutputTwViolet { get; set; } + public long OutputTwLightViolet { get; set; } + public long OutputCtBlue { get; set; } + public long OutputCtLightBlue { get; set; } + public long OutputCtRubine { get; set; } + public long OutputCtLightRubine { get; set; } + public long OutputCtOrange { get; set; } + public long OutputCtLightOrange { get; set; } + public long OutputCtNavy { get; set; } + public long OutputHdBlue { get; set; } + public long OutputHdLightBlue { get; set; } + public long OutputHdRubine { get; set; } + public long OutputHdLightRubine { get; set; } + public long OutputHdOrange { get; set; } + public long OutputHdLightOrange { get; set; } + public long OutputHdNavy { get; set; } + public long OutputHdLightNavy { get; set; } + public long OutputAmBlue { get; set; } + public long OutputAmLightBlue { get; set; } + public long OutputAmRed { get; set; } + public long OutputAmLightRed { get; set; } + public long OutputAmOrange { get; set; } + public long OutputAmLightOrange { get; set; } + public long OutputAmYellow { get; set; } + public long OutputAmLightYellow { get; set; } + public long OutputAmBlack { get; set; } + + + //The error that has occurred when Status = "Failed" public String FailureReason { get; set; } |
