ResultsParser project added, ver. 1.0.0
This commit is contained in:
parent
3812438e97
commit
5c53929efe
2
.gitignore
vendored
2
.gitignore
vendored
@ -40,6 +40,8 @@ Results/bin/
|
||||
Results/obj/
|
||||
ResultsBrowser/bin/
|
||||
ResultsBrowser/obj/
|
||||
ResultsParser/bin/
|
||||
ResultsParser/obj/
|
||||
Statistics/bin/
|
||||
Statistics/obj/
|
||||
TBF/bin/
|
||||
|
||||
6
ResultsParser/App.config
Normal file
6
ResultsParser/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
123
ResultsParser/Program.cs
Normal file
123
ResultsParser/Program.cs
Normal file
@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using Results;
|
||||
using Results.Entities;
|
||||
using System.IO;
|
||||
|
||||
namespace ResultsParser
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static ISessionFactory sessionFactory;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Bench: [WR15]");
|
||||
string bench = Console.ReadLine();
|
||||
if (bench == string.Empty) bench = "WR15";
|
||||
|
||||
string connStr = GetConnectionString(bench);
|
||||
|
||||
IList<WaterMeter> strangeWMs = new List<WaterMeter>();
|
||||
|
||||
try
|
||||
{
|
||||
var session = Fluently.Configure()
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(connStr))
|
||||
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<WaterMeterData>())
|
||||
.ExposeConfiguration(BuildSchema)
|
||||
.BuildSessionFactory()
|
||||
.OpenSession();
|
||||
|
||||
var mtrs1 = session.QueryOver<MeterTestRslt>()
|
||||
.Where(mtr => mtr.Error < -2)
|
||||
.And(mtr => mtr.Passed == true)
|
||||
.List();
|
||||
|
||||
var mtrs2 = session.QueryOver<MeterTestRslt>()
|
||||
.Where(mtr => mtr.Error > 2)
|
||||
.And(mtr => mtr.Passed == true)
|
||||
.List();
|
||||
|
||||
foreach (var lst in new IList<MeterTestRslt>[] { mtrs1, mtrs2 })
|
||||
{
|
||||
foreach (var mtr in lst)
|
||||
{
|
||||
if (mtr.TestRslt.Name() == "Q2" &&
|
||||
mtr.WaterMeter.Passed &&
|
||||
!string.IsNullOrEmpty(mtr.WaterMeter.SerialNr) &&
|
||||
mtr.WaterMeter.WaterMeterData.MetrologicalClass == "R800")
|
||||
{
|
||||
strangeWMs.Add(mtr.WaterMeter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using (TextWriter writer = new StreamWriter(string.Format("strangeWMs-{0}.csv", bench)))
|
||||
{
|
||||
foreach (var wm in strangeWMs)
|
||||
{
|
||||
writer.WriteLine(string.Format("'{0};{1};{2};{3};{4:dd.MM.yyyy HH:mm};{5:dd.MM.yyyy HH:mm};v.{6};{7}",
|
||||
wm.SerialNr, bench, wm.WMPosition, wm.Batch.BatchNr, wm.Batch.StartTime, wm.Batch.EndTime, wm.Batch.ProgramVersion, wm.Batch.ProcedureName));
|
||||
}
|
||||
}
|
||||
|
||||
session.Close();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine("Exception occured:");
|
||||
Console.WriteLine(exc.Message);
|
||||
if (exc.InnerException != null)
|
||||
{
|
||||
Console.WriteLine("Inner exception:");
|
||||
Console.WriteLine(exc.InnerException.Message);
|
||||
}
|
||||
|
||||
Console.ReadLine();
|
||||
Console.WriteLine(exc.StackTrace);
|
||||
}
|
||||
|
||||
Console.WriteLine(string.Format("{0} strange water meters found", strangeWMs.Count));
|
||||
Console.WriteLine("Press ENTER to close");
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
static string GetConnectionString(string bench = "WR15")
|
||||
{
|
||||
Console.WriteLine("Server: [localhost]");
|
||||
var server = Console.ReadLine();
|
||||
if (server == string.Empty) server = "localhost";
|
||||
|
||||
|
||||
Console.WriteLine(string.Format("Database: [st-{0}-r]", bench.ToLower()));
|
||||
var db = Console.ReadLine();
|
||||
if (db == string.Empty) db = string.Format("st-{0}-r", bench.ToLower());
|
||||
|
||||
Console.WriteLine("User: [root]");
|
||||
var uid = Console.ReadLine();
|
||||
if (uid == string.Empty) uid = "root";
|
||||
|
||||
Console.WriteLine("Password:");
|
||||
var pw = Console.ReadLine();
|
||||
|
||||
var connStr = string.Format("SERVER={0}; DATABASE={1}; UID={2}; PASSWORD={3}; CHARSET=utf8;", server, db, uid, pw);
|
||||
Console.WriteLine("Connection string is\r\n {0}", connStr);
|
||||
Console.WriteLine();
|
||||
return connStr;
|
||||
}
|
||||
|
||||
static void BuildSchema(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
|
||||
new NHibernate.Tool.hbm2ddl.SchemaExport(config).SetOutputFile("db_schema");
|
||||
}
|
||||
}
|
||||
}
|
||||
36
ResultsParser/Properties/AssemblyInfo.cs
Normal file
36
ResultsParser/Properties/AssemblyInfo.cs
Normal file
@ -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("ResultsParser")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ResultsParser")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[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("90a47d44-c3ab-4528-b19b-0440a521b9af")]
|
||||
|
||||
// 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")]
|
||||
84
ResultsParser/ResultsParser.csproj
Normal file
84
ResultsParser/ResultsParser.csproj
Normal file
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" 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>{2E08C19B-C0A9-4056-8564-E5B74477959D}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ResultsParser</RootNamespace>
|
||||
<AssemblyName>ResultsParser</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
<HintPath>..\..\Production-Monitoring\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Iesi.Collections">
|
||||
<HintPath>..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data">
|
||||
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate">
|
||||
<HintPath>..\packages\NHibernate.4.0.4.4000\lib\net40\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<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.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Common.csproj">
|
||||
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Config\Config.csproj">
|
||||
<Project>{743df7db-c7b6-42eb-986d-0f485e5588e4}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Results\Results.csproj">
|
||||
<Project>{9d0dcc88-dc81-47eb-9fdd-4c3907871bfb}</Project>
|
||||
<Name>Results</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
12
TBF.sln
12
TBF.sln
@ -83,6 +83,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MergeResultsDBs", "MergeRes
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FeatureVectorCalculator", "FeatureVectorCalculator\FeatureVectorCalculator.csproj", "{6280F3F9-139A-48E3-8C88-25EB4124E982}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultsParser", "ResultsParser\ResultsParser.csproj", "{2E08C19B-C0A9-4056-8564-E5B74477959D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -367,6 +369,16 @@ Global
|
||||
{6280F3F9-139A-48E3-8C88-25EB4124E982}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{6280F3F9-139A-48E3-8C88-25EB4124E982}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{6280F3F9-139A-48E3-8C88-25EB4124E982}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Loading…
Reference in New Issue
Block a user