aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/UpdatePackages
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-11-20 18:11:28 +0200
committerRoy <Roy.mail.net@gmail.com>2022-11-20 18:11:28 +0200
commita000661c3b2ffb3b0603548386cded1cf3488df6 (patch)
tree5e064cda37fdd22662ecdb54b3084fd7f12b48c5 /Software/Visual_Studio/PPC/UpdatePackages
parent4cd4807ca5a7490c8d7edac496a19d618bf9197e (diff)
downloadTango-a000661c3b2ffb3b0603548386cded1cf3488df6.tar.gz
Tango-a000661c3b2ffb3b0603548386cded1cf3488df6.zip
Stats DeltaE + VFT Export additions.
Diffstat (limited to 'Software/Visual_Studio/PPC/UpdatePackages')
-rw-r--r--Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/App.config41
-rw-r--r--Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/JobRunsPatch.cs95
-rw-r--r--Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/Properties/AssemblyInfo.cs36
-rw-r--r--Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/Tango.PPC.Packages.JobRunsUpdater.csproj95
-rw-r--r--Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/packages.config5
5 files changed, 272 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/App.config b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/App.config
new file mode 100644
index 000000000..fe4d34eda
--- /dev/null
+++ b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/App.config
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/JobRunsPatch.cs b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/JobRunsPatch.cs
new file mode 100644
index 000000000..5179a2553
--- /dev/null
+++ b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/JobRunsPatch.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Builders;
+using Tango.Core;
+using Tango.PPC.Common;
+using Tango.PPC.Common.UpdatePackages;
+using Tango.PPC.Shared.Updates;
+using Tango.Settings;
+
+namespace Tango.PPC.Packages.JobRunsUpdater
+{
+ [PPCPackage(PackageType.Pre, "JobRuns Statistics Patch", false)]
+ public class JobRunsPatch : ExtendedObject, IPPCPackage
+ {
+ public Task Run(PackageContext context)
+ {
+ return Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ LogManager.Log("Applying JobRuns Statistics Patch...");
+
+ context.ReportProgress("Applying job runs statistics patch...");
+
+ Thread.Sleep(2000); //Just so we can see something happened.
+
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ foreach (var jobRun in db.JobRuns.Where(x => x.JobLogicalLength == 0))
+ {
+ try
+ {
+ var job = new JobBuilder(db).Set(jobRun.JobGuid).WithSegments().WithBrushStops().Build();
+ jobRun.JobLogicalLength = job.Length;
+ jobRun.NumberOfUnits = job.NumberOfUnits;
+ jobRun.ApplicationVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();
+ jobRun.FirmwareVersion = SettingsManager.Default.GetOrCreate<PPCSettings>().PreviousApplicationVersion;
+
+ var rml = new RmlBuilder(db).Set(job.RmlGuid).WithActiveParametersGroup().Build();
+ jobRun.CeVersion = rml.ColorConversionVersion.ToString();
+ jobRun.ProcessParametersTableGuid = rml.GetActiveProcessGroup().ProcessParametersTables[0].Guid;
+
+ var jobFile = jobRun.JobFile;
+
+ int segmentIndex = 0;
+
+ foreach (var segment in jobFile.Segments)
+ {
+ segmentIndex++;
+
+ var jobSegment = job.Segments.FirstOrDefault(x => x.SegmentIndex == segmentIndex);
+
+ foreach (var stop in segment.BrushStops)
+ {
+ var jobStop = jobSegment.BrushStops.FirstOrDefault(x => x.StopIndex == stop.StopIndex);
+
+ if (jobStop.BestMatchR != null)
+ {
+ stop.BestMatchR = jobStop.BestMatchR.Value;
+ stop.BestMatchG = jobStop.BestMatchG.Value;
+ stop.BestMatchB = jobStop.BestMatchB.Value;
+ }
+ else
+ {
+ stop.BestMatchR = jobStop.Red;
+ stop.BestMatchG = jobStop.Green;
+ stop.BestMatchB = jobStop.Blue;
+ }
+ }
+ }
+
+ jobRun.JobString = jobFile.ToString();
+ db.SaveChanges();
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error updating JobRun '{jobRun.ID}'.");
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error occurred while trying to apply the job runs statistics patch.");
+ }
+ });
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..b7b8bdd66
--- /dev/null
+++ b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tango.PPC.Packages.JobRunsUpdater")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Tango.PPC.Packages.JobRunsUpdater")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b57d4067-6464-4029-9d55-b1555de5ddb7")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/Tango.PPC.Packages.JobRunsUpdater.csproj b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/Tango.PPC.Packages.JobRunsUpdater.csproj
new file mode 100644
index 000000000..43b2ec96e
--- /dev/null
+++ b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/Tango.PPC.Packages.JobRunsUpdater.csproj
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{B57D4067-6464-4029-9D55-B1555DE5DDB7}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tango.PPC.Packages.JobRunsUpdater</RootNamespace>
+ <AssemblyName>Tango.PPC.Packages.JobRunsUpdater</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\Build\PPC\Debug\Packages\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\..\Build\PPC\Release\Packages\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
+ <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="JobRunsPatch.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj">
+ <Project>{F441FEEE-322A-4943-B566-110E12FD3B72}</Project>
+ <Name>Tango.BL</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{A34EE0F0-649D-41C8-8489-B6F1CC6924EE}</Project>
+ <Name>Tango.Core</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj">
+ <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project>
+ <Name>Tango.Logging</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj">
+ <Project>{E4927038-348D-4295-AAF4-861C58CB3943}</Project>
+ <Name>Tango.PMR</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj">
+ <Project>{D8F1AD85-526A-4F50-B6DC-D437AF63D8D8}</Project>
+ <Name>Tango.Settings</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.PPC.Common\Tango.PPC.Common.csproj">
+ <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project>
+ <Name>Tango.PPC.Common</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.PPC.Shared\Tango.PPC.Shared.csproj">
+ <Project>{208c8bd8-72c6-4e3c-acaa-351091a2acc7}</Project>
+ <Name>Tango.PPC.Shared</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/packages.config b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/packages.config
new file mode 100644
index 000000000..08b9dd27c
--- /dev/null
+++ b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsUpdater/packages.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
+ <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
+</packages> \ No newline at end of file