diff options
| author | Roy <Roy.mail.net@gmail.com> | 2022-11-03 10:50:52 +0200 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2022-11-03 10:50:52 +0200 |
| commit | 32438c457c4e5c0103c7ba2a3c86b4a5638d6335 (patch) | |
| tree | 3389378c2bd3755b963f27533bd94db731b8c356 /Software/Visual_Studio/PPC/Tango.PPC.Common | |
| parent | bcfaaf57b60a63acacf0651f5a69b45304abc132 (diff) | |
| download | Tango-32438c457c4e5c0103c7ba2a3c86b4a5638d6335.tar.gz Tango-32438c457c4e5c0103c7ba2a3c86b4a5638d6335.zip | |
Statistics hell.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs index a603410d0..c69a959b0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs @@ -5,6 +5,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL; +using Tango.BL.DTO; +using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.Core; using Tango.Core.DI; using Tango.Integration.ExternalBridge; @@ -87,9 +90,73 @@ namespace Tango.PPC.Common.Statistics db_JobRuns = db_JobRuns.Where(x => x.JobLength < filters.MinLength && x.JobLength >= filters.MaxLength); - var runs_db = await db_JobRuns.ToListAsync(); + var jobRuns = await db_JobRuns.ToListAsync(); - runs_db.ForEach(x => x.LiquidQuantityString = null); + jobRuns.ForEach(x => x.LiquidQuantityString = null); + + var colorSpaces = await db.ColorSpaces.ToListAsync(); + var rmls = await db.Rmls.ToListAsync(); + var catalogs = await db.ColorCatalogs.ToListAsync(); + var color_catalog_Items = await db.ColorCatalogsItems.ToListAsync(); + + foreach (var jobRun in jobRuns) + { + JobRunComposition jobRunComposition = new JobRunComposition(); + jobRunComposition.JobRun = JobRunDTO.FromObservable(jobRun); + + PresentationJob pj = new PresentationJob(); + jobRunComposition.Job = pj; + + foreach (var segment in jobRun.JobFile.Segments) + { + PresentationSegment ps = new PresentationSegment(); + ps.Length = (int)segment.Length; + pj.Segments.Add(ps); + + foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex).ToList()) + { + PresentationBrushStop pbs = new PresentationBrushStop(); + pbs.ColorSpace = colorSpaces.First(x => x.Guid == stop.ColorSpaceGuid).Space; + pbs.StartMeters = segment.Length * (stop.OffsetPercent / 100d); ; + + foreach (var liquidType in stop.LiquidVolumes) + { + PresentationLiquidVolume plt = new PresentationLiquidVolume(); + plt.LiquidType = (LiquidTypes)Enum.Parse(typeof(LiquidTypes), liquidType.LiquidTypeName); + plt.Volume = liquidType.Volume; + pbs.LiquidVolumes.Add(plt); + } + + switch (pbs.ColorSpace) + { + case ColorSpaces.RGB: + pbs.Red = stop.Red; + pbs.Green = stop.Green; + pbs.Blue = stop.Blue; + break; + case ColorSpaces.LAB: + pbs.L = stop.L; + pbs.A = stop.B; + pbs.B = stop.B; + break; + case ColorSpaces.Volume: + pbs.Cyan = pbs.LiquidVolumes.First(x => x.LiquidType == LiquidTypes.Cyan).Volume; + pbs.Magenta = pbs.LiquidVolumes.First(x => x.LiquidType == LiquidTypes.Magenta).Volume; + pbs.Yellow = pbs.LiquidVolumes.First(x => x.LiquidType == LiquidTypes.Yellow).Volume; + pbs.Black = pbs.LiquidVolumes.First(x => x.LiquidType == LiquidTypes.Black).Volume; + break; + case ColorSpaces.Catalog: + pbs.Catalog = catalogs.FirstOrDefault(x => x.Guid == stop.ColorCatalogGuid)?.Name; + pbs.CatalogItem = color_catalog_Items.FirstOrDefault(x => x.Guid == stop.ColorCatalogItemGuid)?.Name; + break; + } + + ps.Stops.Add(pbs); + } + } + + response.Result.JobRuns.Add(jobRunComposition); + } } await receiver.SendGenericResponse(response, token); |
