aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-11-03 10:50:52 +0200
committerRoy <Roy.mail.net@gmail.com>2022-11-03 10:50:52 +0200
commit32438c457c4e5c0103c7ba2a3c86b4a5638d6335 (patch)
tree3389378c2bd3755b963f27533bd94db731b8c356 /Software/Visual_Studio
parentbcfaaf57b60a63acacf0651f5a69b45304abc132 (diff)
downloadTango-32438c457c4e5c0103c7ba2a3c86b4a5638d6335.tar.gz
Tango-32438c457c4e5c0103c7ba2a3c86b4a5638d6335.zip
Statistics hell.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs71
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/JobRunComposition.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationBrushStop.cs34
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationJob.cs18
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationLiquidVolume.cs15
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationSegment.cs20
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj4
7 files changed, 162 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);
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/JobRunComposition.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/JobRunComposition.cs
index 643f5a63c..a6d0f52d4 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/JobRunComposition.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/JobRunComposition.cs
@@ -10,11 +10,13 @@ namespace Tango.PPC.Shared.Statistics
public class JobRunComposition
{
public JobRunDTO JobRun { get; set; }
+ public PresentationJob Job { get; set; }
public List<MachinesEventDTO> Events { get; set; }
public JobRunComposition()
{
Events = new List<MachinesEventDTO>();
+ Job = new PresentationJob();
}
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationBrushStop.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationBrushStop.cs
new file mode 100644
index 000000000..91f5faee0
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationBrushStop.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Enumerations;
+
+namespace Tango.PPC.Shared.Statistics
+{
+ public class PresentationBrushStop
+ {
+ public ColorSpaces ColorSpace { get; set; }
+ public double StartMeters { get; set; }
+ public int Red { get; set; }
+ public int Green { get; set; }
+ public int Blue { get; set; }
+ public double L { get; set; }
+ public double A { get; set; }
+ public double B { get; set; }
+ public double Cyan { get; set; }
+ public double Magenta { get; set; }
+ public double Yellow { get; set; }
+ public double Black { get; set; }
+ public String Catalog { get; set; }
+ public String CatalogItem { get; set; }
+
+ public List<PresentationLiquidVolume> LiquidVolumes { get; set; }
+
+ public PresentationBrushStop()
+ {
+ LiquidVolumes = new List<PresentationLiquidVolume>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationJob.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationJob.cs
new file mode 100644
index 000000000..ac6b6dcab
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationJob.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Shared.Statistics
+{
+ public class PresentationJob
+ {
+ public List<PresentationSegment> Segments { get; set; }
+
+ public PresentationJob()
+ {
+ Segments = new List<PresentationSegment>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationLiquidVolume.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationLiquidVolume.cs
new file mode 100644
index 000000000..c370d1f5d
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationLiquidVolume.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Enumerations;
+
+namespace Tango.PPC.Shared.Statistics
+{
+ public class PresentationLiquidVolume
+ {
+ public LiquidTypes LiquidType { get; set; }
+ public double Volume { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationSegment.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationSegment.cs
new file mode 100644
index 000000000..69cf03c8f
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationSegment.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Shared.Statistics
+{
+ public class PresentationSegment
+ {
+ public int Length { get; set; }
+
+ public List<PresentationBrushStop> Stops { get; set; }
+
+ public PresentationSegment()
+ {
+ Stops = new List<PresentationBrushStop>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj
index 4f06312c6..7761d401b 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj
@@ -127,7 +127,11 @@
<Compile Include="Statistics\GetStatisticsRequiredFiltersResponse.cs" />
<Compile Include="Statistics\GetStatisticsResponse.cs" />
<Compile Include="Statistics\JobRunComposition.cs" />
+ <Compile Include="Statistics\PresentationLiquidVolume.cs" />
<Compile Include="Statistics\RequiredFiltersData.cs" />
+ <Compile Include="Statistics\PresentationBrushStop.cs" />
+ <Compile Include="Statistics\PresentationJob.cs" />
+ <Compile Include="Statistics\PresentationSegment.cs" />
<Compile Include="Statistics\StatisticsResult.cs" />
<Compile Include="Updates\GetUpdatesAndPackagesRequest.cs" />
<Compile Include="Updates\GetUpdatesAndPackagesResponse.cs" />