Compare commits

..
Author SHA1 Message Date
Milan Hanajik 8d831ff468 IZRAEL_200 bug fix, ver. 2.18.1150 2019-02-25 11:24:58 +01:00
Milan Hanajik 8125970bde Reconfigured for IZRAEL PT200 2019-01-17 09:16:30 +02:00
956 changed files with 31556 additions and 164328 deletions
-2
View File
@@ -1,2 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
-7
View File
@@ -1,21 +1,15 @@
Config/bin/ Config/bin/
Config/obj/ Config/obj/
Decrypt/bin/
Decrypt/obj/
DeviceTest/bin/ DeviceTest/bin/
DeviceTest/obj/ DeviceTest/obj/
Dirichlet.Numerics/bin Dirichlet.Numerics/bin
Dirichlet.Numerics/obj Dirichlet.Numerics/obj
Encrypt/bin/
Encrypt/obj/
GemCard/bin GemCard/bin
GemCard/obj GemCard/obj
GraphLib/bin GraphLib/bin
GraphLib/obj GraphLib/obj
TracingDB/bin TracingDB/bin
TracingDB/obj TracingDB/obj
RestClient/bin
RestClient/obj
Results/bin/ Results/bin/
Results/obj/ Results/obj/
ResultsBrowser/bin/ ResultsBrowser/bin/
@@ -31,6 +25,5 @@ Users/obj/
UserManagement/bin/ UserManagement/bin/
UserManagement/obj/ UserManagement/obj/
Doc/ Doc/
.vs/
*.suo *.suo
*.bak *.bak
+10 -13
View File
@@ -10,30 +10,27 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Config</RootNamespace> <RootNamespace>Config</RootNamespace>
<AssemblyName>Config</AssemblyName> <AssemblyName>Config</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;KRAKOW_50;LANG_PL</DefineConstants> <DefineConstants>TRACE;DEBUG;IZRAEL_200</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks> <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;KRAKOW_50;LANG_PL</DefineConstants> <DefineConstants>TRACE;IZRAEL_200</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="FluentNHibernate"> <Reference Include="FluentNHibernate">
@@ -86,15 +83,15 @@
<Compile Include="Entities\MetersPath.cs" /> <Compile Include="Entities\MetersPath.cs" />
<Compile Include="Entities\OutputPath.cs" /> <Compile Include="Entities\OutputPath.cs" />
<Compile Include="Entities\Procedure.cs" /> <Compile Include="Entities\Procedure.cs" />
<Compile Include="Entities\Profile.cs" /> <Compile Include="Entities\ProcedureHistory.cs" />
<Compile Include="Entities\PTest.cs" />
<Compile Include="Entities\Test.cs" /> <Compile Include="Entities\Test.cs" />
<Compile Include="Entities\TransitionSequence.cs" /> <Compile Include="Entities\TransitionSequence.cs" />
<Compile Include="Entities\TransitionStep.cs" /> <Compile Include="Entities\TransitionStep.cs" />
<Compile Include="Entities\Uncertainty.cs" />
<Compile Include="Entities\User.cs" /> <Compile Include="Entities\User.cs" />
<Compile Include="Entities\VirtualBenchSequence.cs" /> <Compile Include="Entities\VirtualBenchSequence.cs" />
<Compile Include="Entities\VirtualBenchStep.cs" /> <Compile Include="Entities\VirtualBenchStep.cs" />
<Compile Include="Entities\Watermeter.cs" />
<Compile Include="Entities\WMType.cs" />
<Compile Include="FluentCommon.cs" /> <Compile Include="FluentCommon.cs" />
<Compile Include="Formulas.cs" /> <Compile Include="Formulas.cs" />
<Compile Include="Mappings\BenchPathMap.cs" /> <Compile Include="Mappings\BenchPathMap.cs" />
@@ -108,13 +105,14 @@
<Compile Include="Mappings\MetersPathMap.cs" /> <Compile Include="Mappings\MetersPathMap.cs" />
<Compile Include="Mappings\OutputPathMap.cs" /> <Compile Include="Mappings\OutputPathMap.cs" />
<Compile Include="Mappings\ProcedureMap.cs" /> <Compile Include="Mappings\ProcedureMap.cs" />
<Compile Include="Mappings\ProfileMap.cs" />
<Compile Include="Mappings\PTestMap.cs" />
<Compile Include="Mappings\TestMap.cs" /> <Compile Include="Mappings\TestMap.cs" />
<Compile Include="Mappings\TransitionSequenceMap.cs" /> <Compile Include="Mappings\TransitionSequenceMap.cs" />
<Compile Include="Mappings\TransitionStepMap.cs" /> <Compile Include="Mappings\TransitionStepMap.cs" />
<Compile Include="Mappings\UncertaintyMap.cs" />
<Compile Include="Mappings\UserMap.cs" /> <Compile Include="Mappings\UserMap.cs" />
<Compile Include="Mappings\VirtualBenchSequenceMap.cs" />
<Compile Include="Mappings\VirtualBenchStepMap.cs" />
<Compile Include="Mappings\WatermeterMap.cs" />
<Compile Include="Mappings\WMTypeMap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Strings.Designer.cs"> <Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
@@ -127,7 +125,6 @@
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Resources\Strings.cs.resx" /> <EmbeddedResource Include="Resources\Strings.cs.resx" />
<EmbeddedResource Include="Resources\Strings.de.resx" /> <EmbeddedResource Include="Resources\Strings.de.resx" />
<EmbeddedResource Include="Resources\Strings.fr.resx" />
<EmbeddedResource Include="Resources\Strings.it.resx" /> <EmbeddedResource Include="Resources\Strings.it.resx" />
<EmbeddedResource Include="Resources\Strings.pl.resx" /> <EmbeddedResource Include="Resources\Strings.pl.resx" />
<EmbeddedResource Include="Resources\Strings.resx"> <EmbeddedResource Include="Resources\Strings.resx">
+6 -22
View File
@@ -10,8 +10,8 @@ namespace Config
#if MUNICH #if MUNICH
public const int WMsCount = 3; public const int WMsCount = 3;
public const int LineSize = 3; public const int LineSize = 1;
public const int CompoundWMsCount = 3; public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0; public const int HeatMetersCount = 0;
public const int MaxPartNr = 3; public const int MaxPartNr = 3;
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200 #elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
@@ -20,24 +20,12 @@ namespace Config
public const int CompoundWMsCount = 1; public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0; public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize; public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || GENESIS || SLM_150 || PETERSBURG_200 #elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || PUCHONG_200 || GENESIS || SLM_150 || PETERSBURG_200
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif PUCHONG_200
public const int WMsCount = 6; public const int WMsCount = 6;
public const int LineSize = 6; public const int LineSize = 6;
public const int CompoundWMsCount = 3; public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0; public const int HeatMetersCount = 0;
public const int MaxPartNr = 3; public const int MaxPartNr = 3;
#elif DEWA_300 || ROMA_200
public const int WMsCount = 10;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif DUBAJ_50 #elif DUBAJ_50
public const int WMsCount = 10; public const int WMsCount = 10;
public const int LineSize = 5; public const int LineSize = 5;
@@ -62,7 +50,7 @@ namespace Config
public const int CompoundWMsCount = 1; public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0; public const int HeatMetersCount = 0;
public const int MaxPartNr = 1; public const int MaxPartNr = 1;
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || ALZIR_25 #elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50
public const int WMsCount = 20; public const int WMsCount = 20;
public const int LineSize = 10; public const int LineSize = 10;
public const int CompoundWMsCount = 1; public const int CompoundWMsCount = 1;
@@ -74,7 +62,7 @@ namespace Config
public const int CompoundWMsCount = 1; public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0; public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize; public const int MaxPartNr = WMsCount / LineSize;
#elif TURA_IPERL || TURA_IPERL_NEW #elif TURA_IPERL
public const int WMsCount = 40; public const int WMsCount = 40;
public const int LineSize = 20; public const int LineSize = 20;
public const int CompoundWMsCount = 1; public const int CompoundWMsCount = 1;
@@ -110,9 +98,5 @@ namespace Config
/// Database related: This object reference is set after a successful user login /// Database related: This object reference is set after a successful user login
/// ///
public static DatabaseSettings CurrentBench; public static DatabaseSettings CurrentBench;
}
public static double RealDensity = 0; /// true water density [kg/m3]
public static double AtTemperature = 0; /// measured at temperature [°C]
public static double Buoyancy = 0;
}
} }
+2 -3
View File
@@ -1,8 +1,9 @@
/// ///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s. /// Copyright (c) 2013-2015 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
namespace Config.Entities namespace Config.Entities
@@ -18,7 +19,6 @@ namespace Config.Entities
public virtual LogLevel Logging { get; set; } public virtual LogLevel Logging { get; set; }
public virtual string Parameters { get; set; } public virtual string Parameters { get; set; }
public virtual IList<MeasurementCorrection> Corrections { get; set; } public virtual IList<MeasurementCorrection> Corrections { get; set; }
public virtual IList<Uncertainty> Uncertainties { get; set; }
/// ------------- Additional stuff not mapped into the database ------------- /// ------------- Additional stuff not mapped into the database -------------
@@ -27,7 +27,6 @@ namespace Config.Entities
Name = string.Empty; Name = string.Empty;
ClassName = string.Empty; ClassName = string.Empty;
Corrections = new List<MeasurementCorrection>(); Corrections = new List<MeasurementCorrection>();
Uncertainties = new List<Uncertainty>();
} }
public static Component CreateFromCfg(string name, string className, string parentName, int itemNr, public static Component CreateFromCfg(string name, string className, string parentName, int itemNr,
+19 -209
View File
@@ -67,12 +67,12 @@ namespace Config.Entities
public class ProcedureInfo public class ProcedureInfo
{ {
public readonly string Name; public readonly string Name;
public readonly bool IsRemote; public readonly Users.Entities.DBKind DBKind;
public ProcedureInfo(string name, bool isRemote) public ProcedureInfo(string name, Users.Entities.DBKind dbKind)
{ {
Name = name; Name = name;
IsRemote = isRemote; DBKind = dbKind;
} }
} }
@@ -83,23 +83,6 @@ namespace Config.Entities
Count, Count,
} }
public enum ProfileType
{
Q3R,
QnClassColdWater,
QnClassHotWater,
QpQi,
Manual,
Count,
}
public enum ErrorLimitType
{
Manual,
QpClass,
Count,
}
/// <summary> Kind of meters for the procedure / test </summary> /// <summary> Kind of meters for the procedure / test </summary>
public enum MetersKind public enum MetersKind
{ {
@@ -107,10 +90,6 @@ namespace Config.Entities
[Description("Wasserzähler")] Single, [Description("Wasserzähler")] Single,
[Description("Verbundwasserzähler")] Combined, [Description("Verbundwasserzähler")] Combined,
[Description("Wärmezähler")] HeatMeter, [Description("Wärmezähler")] HeatMeter,
#elif LANG_FR
[Description("Compteurs eau")] Single,
[Description("Mètres composés")] Combined,
[Description("Thermomètres")] HeatMeter,
#elif LANG_CS #elif LANG_CS
[Description("Vodoměry")] Single, [Description("Vodoměry")] Single,
[Description("Kombinované vodoměry")] Combined, [Description("Kombinované vodoměry")] Combined,
@@ -146,9 +125,6 @@ namespace Config.Entities
#elif LANG_IT #elif LANG_IT
[Description("freddo")] ColdWater, [Description("freddo")] ColdWater,
[Description("caldo")] HotWater, [Description("caldo")] HotWater,
#elif LANG_FR
[Description("eau froide")] ColdWater,
[Description("eau chaude")] HotWater,
#else #else
[Description("cold")] ColdWater, [Description("cold")] ColdWater,
[Description("hot")] HotWater, [Description("hot")] HotWater,
@@ -264,11 +240,6 @@ namespace Config.Entities
[Description("immer")] Always = 1, [Description("immer")] Always = 1,
[Description("Bildschirm")] OnScreen = 2, [Description("Bildschirm")] OnScreen = 2,
[Description("intern")] Internal = 3, [Description("intern")] Internal = 3,
#elif LANG_FR
[Description("jamais")] Never = 0,
[Description("toujours")] Always = 1,
[Description("À l'écran")] OnScreen = 2,
[Description("interne")] Internal = 3,
#elif LANG_CS #elif LANG_CS
/// czech /// czech
[Description("nikdy")] Never = 0, [Description("nikdy")] Never = 0,
@@ -310,10 +281,6 @@ namespace Config.Entities
[Description("Waage")] Scale, [Description("Waage")] Scale,
[Description("Spanne")] Spread, [Description("Spanne")] Spread,
[Description("Standardabw.")] StdDev, [Description("Standardabw.")] StdDev,
#elif LANG_FR
[Description("Balance")] Scale,
[Description("Envergure")] Spread,
[Description("Déviation std.")] StdDev,
#elif LANG_CS #elif LANG_CS
/// cesky /// cesky
[Description("váhou")] Scale, [Description("váhou")] Scale,
@@ -324,16 +291,22 @@ namespace Config.Entities
[Description("Spread")] Spread, [Description("Spread")] Spread,
[Description("Std.dev.")] StdDev, [Description("Std.dev.")] StdDev,
#endif #endif
Count Count
} }
public enum TestProfile public enum TestRedType
{ {
UserDefined, Fix,
UserDefinedHeatMeter, /// etc.
Protected, /// The first protected one Count,
ProtectedHeatMeter, }
}
public enum FQC1
{
FQC1,
FQP1,
Count,
}
public enum Progress public enum Progress
{ {
@@ -372,14 +345,6 @@ namespace Config.Entities
[Description("Prüfpunktergebnisse")] TestResult, [Description("Prüfpunktergebnisse")] TestResult,
[Description("Wasserzelledaten")] MeterData, [Description("Wasserzelledaten")] MeterData,
[Description("Wasserzelleergebnisse")] MeterResult, [Description("Wasserzelleergebnisse")] MeterResult,
#elif LANG_FR
[Description("Autres")] Other,
[Description("Données de banc")] BenchData,
[Description("Résultats du banc")] BenchResult,
[Description("Données de test")] TestData,
[Description("Résultats de test")] TestResult,
[Description("Données du compteur d'eau")] MeterData,
[Description("Résultats du compteur d'eau")] MeterResult,
#else #else
[Description("Other")] Other, [Description("Other")] Other,
[Description("Bench data")] BenchData, [Description("Bench data")] BenchData,
@@ -389,7 +354,7 @@ namespace Config.Entities
[Description("Meter data")] MeterData, [Description("Meter data")] MeterData,
[Description("Meter result")] MeterResult, [Description("Meter result")] MeterResult,
#endif #endif
Count, Count,
} }
/// <summary> Possible modes of operation of components and devices. </summary> /// <summary> Possible modes of operation of components and devices. </summary>
@@ -406,17 +371,6 @@ namespace Config.Entities
[Description("Reply")] Reply, [Description("Reply")] Reply,
[Description("Simuliert")] Simulate, /// Test bench simulation, this mode does not require any hardware [Description("Simuliert")] Simulate, /// Test bench simulation, this mode does not require any hardware
[Description("Geerbt")] Inherit, [Description("Geerbt")] Inherit,
#elif LANG_FR
[Description("Détection automatique: Éteindre")] DetectedOff = -2,
[Description("Détection automatique: Allumé")] DetectedOn = -1,
[Description("Ordinaire")] Normal = 0,
[Description("Détection automatique")] AutoDetect,
[Description("Erreur d'exécution")] FailureDuringOperation,
[Description("Éteindre")] Off,
[Description("Record")] Record,
[Description("Répondre")] Reply,
[Description("Simuler")] Simulate,
[Description("Hériter")] Inherit,
#else #else
[Description("Detected off")] DetectedOff = -2, [Description("Detected off")] DetectedOff = -2,
[Description("Detected on")] DetectedOn = -1, [Description("Detected on")] DetectedOn = -1,
@@ -429,7 +383,7 @@ namespace Config.Entities
[Description("Simulate")] Simulate, /// Test bench simulation, this mode does not require any hardware [Description("Simulate")] Simulate, /// Test bench simulation, this mode does not require any hardware
[Description("Inherit")] Inherit, [Description("Inherit")] Inherit,
#endif #endif
Count, Count,
} }
public enum LogLevel public enum LogLevel
@@ -476,11 +430,6 @@ namespace Config.Entities
[Description("zentriert")] Center, [Description("zentriert")] Center,
[Description("rechts")] Right, [Description("rechts")] Right,
[Description("angepasst")] Justified, [Description("angepasst")] Justified,
#elif LANG_FR
[Description("gauche")] Left,
[Description("centré")] Center,
[Description("droit")] Right,
[Description("justifié")] Justified,
#else #else
[Description("Left")] Left, [Description("Left")] Left,
[Description("Center")] Center, [Description("Center")] Center,
@@ -530,10 +479,6 @@ namespace Config.Entities
[Description("aus")] Off, [Description("aus")] Off,
[Description("info")] Info, [Description("info")] Info,
[Description("ein")] On, [Description("ein")] On,
#elif LANG_FR
[Description("éteindre")] Off,
[Description("info")] Info,
[Description("allumé")] On,
#elif LANG_CS #elif LANG_CS
[Description("vypnuto")] Off, [Description("vypnuto")] Off,
[Description("info")] Info, [Description("info")] Info,
@@ -551,141 +496,6 @@ namespace Config.Entities
[Description("info")] Info, [Description("info")] Info,
[Description("on")] On, [Description("on")] On,
#endif #endif
Count Count
} }
public enum ErrorFlagShift
{
E1 = 0,
E2,
E3,
E4,
E5,
E6,
E7,
E8,
E9,
E10,
E11,
E12,
E13,
E14,
E15,
E16,
E17,
E18,
E19,
E20,
E21,
E22,
E23,
E24,
E25,
E26,
E27,
E28,
E29,
E30,
E31,
E32,
E33,
E34,
E35,
E36,
E37,
E38,
E39,
E40,
E41,
E42,
E43,
E44,
E45,
E46,
E47,
E48,
E49,
E50,
E51,
E52,
E53,
E54,
E55,
E56,
E57,
E58,
E59,
E60,
E61,
E62,
E63,
}
public enum ErrorFlagMask : long
{
E1 = (1 << (int)ErrorFlagShift.E1),
E2 = (1 << (int)ErrorFlagShift.E2),
E3 = (1 << (int)ErrorFlagShift.E3),
E4 = (1 << (int)ErrorFlagShift.E4),
E5 = (1 << (int)ErrorFlagShift.E5),
E6 = (1 << (int)ErrorFlagShift.E6),
E7 = (1 << (int)ErrorFlagShift.E7),
E8 = (1 << (int)ErrorFlagShift.E8),
E9 = (1 << (int)ErrorFlagShift.E9),
E10 = (1 << (int)ErrorFlagShift.E10),
E11 = (1 << (int)ErrorFlagShift.E11),
E12 = (1 << (int)ErrorFlagShift.E12),
E13 = (1 << (int)ErrorFlagShift.E13),
E14 = (1 << (int)ErrorFlagShift.E14),
E15 = (1 << (int)ErrorFlagShift.E15),
E16 = (1 << (int)ErrorFlagShift.E16),
E17 = (1 << (int)ErrorFlagShift.E17),
E18 = (1 << (int)ErrorFlagShift.E18),
E19 = (1 << (int)ErrorFlagShift.E19),
E20 = (1 << (int)ErrorFlagShift.E20),
E21 = (1 << (int)ErrorFlagShift.E21),
E22 = (1 << (int)ErrorFlagShift.E22),
E23 = (1 << (int)ErrorFlagShift.E23),
E24 = (1 << (int)ErrorFlagShift.E24),
E25 = (1 << (int)ErrorFlagShift.E25),
E26 = (1 << (int)ErrorFlagShift.E26),
E27 = (1 << (int)ErrorFlagShift.E27),
E28 = (1 << (int)ErrorFlagShift.E28),
E29 = (1 << (int)ErrorFlagShift.E29),
E30 = (1 << (int)ErrorFlagShift.E30),
E31 = (1 << (int)ErrorFlagShift.E31),
E32 = (1 << (int)ErrorFlagShift.E32),
E33 = (1 << (int)ErrorFlagShift.E33),
E34 = (1 << (int)ErrorFlagShift.E34),
E35 = (1 << (int)ErrorFlagShift.E35),
E36 = (1 << (int)ErrorFlagShift.E36),
E37 = (1 << (int)ErrorFlagShift.E37),
E38 = (1 << (int)ErrorFlagShift.E38),
E39 = (1 << (int)ErrorFlagShift.E39),
E40 = (1 << (int)ErrorFlagShift.E40),
E41 = (1 << (int)ErrorFlagShift.E41),
E42 = (1 << (int)ErrorFlagShift.E42),
E43 = (1 << (int)ErrorFlagShift.E43),
E44 = (1 << (int)ErrorFlagShift.E44),
E45 = (1 << (int)ErrorFlagShift.E45),
E46 = (1 << (int)ErrorFlagShift.E46),
E47 = (1 << (int)ErrorFlagShift.E47),
E48 = (1 << (int)ErrorFlagShift.E48),
E49 = (1 << (int)ErrorFlagShift.E49),
E50 = (1 << (int)ErrorFlagShift.E50),
E51 = (1 << (int)ErrorFlagShift.E51),
E52 = (1 << (int)ErrorFlagShift.E52),
E53 = (1 << (int)ErrorFlagShift.E53),
E54 = (1 << (int)ErrorFlagShift.E54),
E55 = (1 << (int)ErrorFlagShift.E55),
E56 = (1 << (int)ErrorFlagShift.E56),
E57 = (1 << (int)ErrorFlagShift.E57),
E58 = (1 << (int)ErrorFlagShift.E58),
E59 = (1 << (int)ErrorFlagShift.E59),
E60 = (1 << (int)ErrorFlagShift.E60),
E61 = (1 << (int)ErrorFlagShift.E61),
E62 = (1 << (int)ErrorFlagShift.E62),
E63 = (1 << (int)ErrorFlagShift.E63),
}
} }
+8 -11
View File
@@ -1,27 +1,24 @@
/// ///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic;
namespace Config.Entities namespace Config.Entities
{ {
public class Group public class Group
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual Users.Entities.GID GID { get; set; } public virtual int Gid { get; set; }
public virtual long AccessFlags { get; set; } /// Bitfield of access flags: bit0 .. bit62 public virtual string Name { get; set; }
public virtual IList<User> Users { get; set; } /// Group can be a member of a list of users
public Group() public Group()
{ {
Users = new List<User>();
} }
public Group(Users.Entities.GID gid) public Group(int gid, string name)
: this() {
{ Gid = gid;
GID = gid; Name = name;
} }
} }
} }
-8
View File
@@ -25,14 +25,6 @@ namespace Config.Entities
Count Count
} }
public enum Counting
{
Arbitrary,
Positive,
Negative,
Count
}
public enum OptoHeadState public enum OptoHeadState
{ {
Disabled, Disabled,
-337
View File
@@ -1,337 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
/// <summary>
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
/// </summary>
public class PTest : IHasName, IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s /// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
public virtual double CoefQfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual double CoefQto { get; set; } /// Water flow high limit in [m3/h]
public virtual double ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual double ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h
public virtual double TempLimLo { get; set; } /// Lower limit for the controlled temperature
public virtual double TempLimHi { get; set; } /// Upper limit for the controlled temperature
public virtual double PressLimLo { get; set; } /// [bar] min. water pressure
public virtual double PressLimHi { get; set; } /// [bar] max. water pressure
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual bool Evaluate { get; set; }
public virtual sbyte E1 { get; set; } ///
public virtual sbyte E2 { get; set; } ///
public virtual sbyte E3 { get; set; } ///
public virtual sbyte E4 { get; set; } ///
public virtual sbyte E5 { get; set; } ///
public virtual sbyte E6 { get; set; } ///
public virtual sbyte E7 { get; set; } ///
public virtual sbyte E8 { get; set; } ///
public virtual sbyte E9 { get; set; } /// 0=off, 1=info, 2=evaluate
public virtual sbyte E10 { get; set; } ///
public virtual sbyte E11 { get; set; } ///
public virtual sbyte E12 { get; set; } ///
public virtual sbyte E13 { get; set; } ///
public virtual sbyte E14 { get; set; } ///
public virtual sbyte E15 { get; set; } ///
public virtual sbyte E16 { get; set; } ///
public virtual sbyte E21 { get; set; } ///
public virtual double Delta_Q_pct { get; set; } /// [%] max deviation from the mean flow
public virtual double Delta_T { get; set; } /// [°C] max. T_up or T_down deviation from the mean temperature
public virtual double Delta_Tup_Tdn { get; set; } /// [°C] max. difference abs(T_up - T_down)
public virtual double TestTime_min { get; set; } /// [s]
public virtual double TestTime_max { get; set; } /// [s]
public virtual double AmbTemp_min { get; set; } /// [°C] min. ambient temperature
public virtual double AmbTemp_max { get; set; } /// [°C] max. ambient temperature
public virtual double Coef_E9 { get; set; } /// Coefficient used in E9, default 0.025
public virtual double Coef_E10 { get; set; } /// Coefficient used in E10, default 0.04
public virtual double Coef_E11 { get; set; } /// Coefficient used in E11, default 0.1
public virtual double Coef_E12 { get; set; } /// Coefficient used in E12, default 1
public virtual double Offset_E9 { get; set; } /// [s] default 0 (no offset)
public virtual double Offset_E12 { get; set; } /// [s] default 0 (no offset)
public virtual Profile Profile { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public PTest()
{
///
/// Default values
///
Part = 0;
CoefQfrom = 1.0;
CoefQto = 1.1;
ErrLimLo = -2.0; /// [%]
ErrLimHi = 2.0; /// [%]
TempLimLo = 15.0; /// [°C]
TempLimHi = 25.0; /// [°C]
PressLimLo = 0; /// [bar]
PressLimHi = 16.0; /// [bar]
Publish = (sbyte)Config.Entities.Publish.Always;
Evaluate = true;
E1 = (sbyte)ErrorFlagsMode.On;
E2 = (sbyte)ErrorFlagsMode.On;
E3 = (sbyte)ErrorFlagsMode.On;
E4 = (sbyte)ErrorFlagsMode.On;
E5 = (sbyte)ErrorFlagsMode.On;
E6 = (sbyte)ErrorFlagsMode.On;
E7 = (sbyte)ErrorFlagsMode.On;
E8 = (sbyte)ErrorFlagsMode.On;
E9 = (sbyte)ErrorFlagsMode.On;
E10 = (sbyte)ErrorFlagsMode.On;
E11 = (sbyte)ErrorFlagsMode.On;
E12 = (sbyte)ErrorFlagsMode.On;
E13 = (sbyte)ErrorFlagsMode.On;
E14 = (sbyte)ErrorFlagsMode.On;
E15 = (sbyte)ErrorFlagsMode.On;
E16 = (sbyte)ErrorFlagsMode.Off;
E21 = (sbyte)ErrorFlagsMode.Off;
Delta_Q_pct = 5.0; /// [%]
Delta_T = 10.0; /// [°C]
Delta_Tup_Tdn = 10.0; /// [°C]
TestTime_min = 0; /// [s]
TestTime_max = 99999; /// [s]
AmbTemp_min = 5.0; /// [°C]
AmbTemp_max = 95.0; /// [°C]
Coef_E9 = 0.025;
Coef_E10 = 0.04;
Coef_E11 = 0.1;
Coef_E12 = 1.0;
Offset_E9 = 0; /// [s]
Offset_E12 = 0; /// [s]
}
public PTest(string name, int itemNr, Profile profile)
: this()
{
Name = name;
ItemNr = itemNr;
Profile = profile;
}
// Makes a new copy of this object (not just a reference)
public virtual PTest Clone()
{
PTest result = new PTest(Name, ItemNr, Profile);
result.Part = Part;
result.CoefQfrom = CoefQfrom;
result.CoefQto = CoefQto;
result.ErrLimLo = ErrLimLo;
result.ErrLimHi = ErrLimHi;
result.TempLimLo = TempLimLo;
result.TempLimHi = TempLimHi;
result.PressLimLo = PressLimLo;
result.PressLimHi = PressLimHi;
result.Publish = Publish;
result.Evaluate = Evaluate;
result.E1 = E1;
result.E2 = E2;
result.E3 = E3;
result.E4 = E4;
result.E5 = E5;
result.E6 = E6;
result.E7 = E7;
result.E8 = E8;
result.E9 = E9;
result.E10 = E10;
result.E11 = E11;
result.E12 = E12;
result.E13 = E13;
result.E14 = E14;
result.E15 = E15;
result.E16 = E16;
result.E21 = E21;
result.Delta_Q_pct = Delta_Q_pct;
result.Delta_T = Delta_T;
result.Delta_Tup_Tdn = Delta_Tup_Tdn;
result.TestTime_min = TestTime_min;
result.TestTime_max = TestTime_max;
result.AmbTemp_min = AmbTemp_min;
result.AmbTemp_max = AmbTemp_max;
result.Coef_E9 = Coef_E9;
result.Coef_E10 = Coef_E10;
result.Coef_E11 = Coef_E11;
result.Coef_E12 = Coef_E12;
result.Offset_E9 = Offset_E9;
result.Offset_E12 = Offset_E12;
return result;
}
public virtual void Export(StreamWriter output)
{
CultureInfo ci = CultureInfo.InvariantCulture;
output.WriteLine(Name);
output.WriteLine(Part);
output.WriteLine(CoefQfrom.ToString(ci));
output.WriteLine(CoefQto.ToString(ci));
output.WriteLine(ErrLimLo.ToString(ci));
output.WriteLine(ErrLimHi.ToString(ci));
output.WriteLine(TempLimLo.ToString(ci));
output.WriteLine(TempLimHi.ToString(ci));
output.WriteLine(PressLimLo.ToString(ci));
output.WriteLine(PressLimHi.ToString(ci));
output.WriteLine(Publish.ToString());
output.WriteLine(Evaluate.ToString());
output.WriteLine(E1.ToString());
output.WriteLine(E2.ToString());
output.WriteLine(E3.ToString());
output.WriteLine(E4.ToString());
output.WriteLine(E5.ToString());
output.WriteLine(E6.ToString());
output.WriteLine(E7.ToString());
output.WriteLine(E8.ToString());
output.WriteLine(E9.ToString());
output.WriteLine(E10.ToString());
output.WriteLine(E11.ToString());
output.WriteLine(E12.ToString());
output.WriteLine(E13.ToString());
output.WriteLine(E14.ToString());
output.WriteLine(E15.ToString());
output.WriteLine(E16.ToString());
output.WriteLine(E21.ToString());
output.WriteLine(Delta_Q_pct.ToString(ci));
output.WriteLine(Delta_T.ToString(ci));
output.WriteLine(Delta_Tup_Tdn.ToString(ci));
output.WriteLine(TestTime_min.ToString(ci));
output.WriteLine(TestTime_max.ToString(ci));
output.WriteLine(AmbTemp_min.ToString(ci));
output.WriteLine(AmbTemp_max.ToString(ci));
output.WriteLine(Coef_E9.ToString(ci));
output.WriteLine(Coef_E10.ToString(ci));
output.WriteLine(Coef_E11.ToString(ci));
output.WriteLine(Coef_E12.ToString(ci));
output.WriteLine(Offset_E9.ToString(ci));
output.WriteLine(Offset_E12.ToString(ci));
}
public static PTest Import(StreamReader input, Profile newProfile)
{
string firstLine = input.ReadLine();
if (string.IsNullOrEmpty(firstLine))
{
return null;
}
CultureInfo ci = CultureInfo.InvariantCulture;
PTest tst = new PTest();
tst.Name = firstLine;
tst.Part = int.Parse(input.ReadLine());
tst.CoefQfrom = double.Parse(input.ReadLine(), ci);
tst.CoefQto = double.Parse(input.ReadLine(), ci);
tst.ErrLimLo = double.Parse(input.ReadLine(), ci);
tst.ErrLimHi = double.Parse(input.ReadLine(), ci);
tst.TempLimLo = double.Parse(input.ReadLine(), ci);
tst.TempLimHi = double.Parse(input.ReadLine(), ci);
tst.Publish = sbyte.Parse(input.ReadLine());
tst.Evaluate = bool.Parse(input.ReadLine());
/// TODO (E1 .. E21)
tst.Delta_Q_pct = double.Parse(input.ReadLine(), ci);
tst.Delta_T = double.Parse(input.ReadLine(), ci);
tst.Delta_Tup_Tdn = double.Parse(input.ReadLine(), ci);
tst.TestTime_min = double.Parse(input.ReadLine(), ci);
tst.TestTime_max = double.Parse(input.ReadLine(), ci);
tst.AmbTemp_min = double.Parse(input.ReadLine(), ci);
tst.AmbTemp_max = double.Parse(input.ReadLine(), ci);
tst.Coef_E9 = double.Parse(input.ReadLine(), ci);
tst.Coef_E10 = double.Parse(input.ReadLine(), ci);
tst.Coef_E11 = double.Parse(input.ReadLine(), ci);
tst.Coef_E12 = double.Parse(input.ReadLine(), ci);
tst.Offset_E9 = double.Parse(input.ReadLine(), ci);
tst.Offset_E12 = double.Parse(input.ReadLine(), ci);
tst.Profile = newProfile;
return tst;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
string fmt = string.Format("Test {0} : ", Name) + "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
CultureInfo ci = CultureInfo.InvariantCulture;
string firstLine = inp.ReadLine();
if (string.IsNullOrEmpty(firstLine)) return string.Format("Test {0} is missing in the file\r\n", Name);
if (Name != firstLine) { diff.AppendFormat(fmt, "Name", Name, firstLine); };
ln = inp.ReadLine(); if (ln != Part.ToString()) { diff.AppendFormat(fmt, "Part", Part.ToString(), ln); };
ln = inp.ReadLine(); if (ln != CoefQfrom.ToString(ci)) { diff.AppendFormat(fmt, "CoefQfrom", CoefQfrom.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != CoefQto.ToString(ci)) { diff.AppendFormat(fmt, "CoefQto", CoefQto.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != ErrLimLo.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimLo", ErrLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != ErrLimHi.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimHi", ErrLimHi.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != PressLimLo.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_min", PressLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != PressLimHi.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_max", PressLimHi.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Publish.ToString()) { diff.AppendFormat(fmt, "Publish", Publish.ToString(), ln); };
ln = inp.ReadLine(); if (ln != Evaluate.ToString()) { diff.AppendFormat(fmt, "Evaluate", Evaluate.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E1.ToString()) { diff.AppendFormat(fmt, "E1", E1.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E2.ToString()) { diff.AppendFormat(fmt, "E2", E2.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E3.ToString()) { diff.AppendFormat(fmt, "E3", E3.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E4.ToString()) { diff.AppendFormat(fmt, "E4", E4.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E5.ToString()) { diff.AppendFormat(fmt, "E5", E5.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E6.ToString()) { diff.AppendFormat(fmt, "E6", E6.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E7.ToString()) { diff.AppendFormat(fmt, "E7", E7.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E8.ToString()) { diff.AppendFormat(fmt, "E8", E8.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E9.ToString()) { diff.AppendFormat(fmt, "E9", E9.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E10.ToString()) { diff.AppendFormat(fmt, "E10", E10.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E11.ToString()) { diff.AppendFormat(fmt, "E11", E11.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E12.ToString()) { diff.AppendFormat(fmt, "E12", E12.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E13.ToString()) { diff.AppendFormat(fmt, "E13", E13.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E14.ToString()) { diff.AppendFormat(fmt, "E14", E14.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E15.ToString()) { diff.AppendFormat(fmt, "E15", E15.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E16.ToString()) { diff.AppendFormat(fmt, "E16", E16.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E21.ToString()) { diff.AppendFormat(fmt, "E21", E21.ToString(), ln); };
ln = inp.ReadLine(); if (ln != Delta_Q_pct.ToString(ci)) { diff.AppendFormat(fmt, "Delta_Q_pct", Delta_Q_pct.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Delta_T.ToString(ci)) { diff.AppendFormat(fmt, "Delta_T", Delta_T.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Delta_Tup_Tdn.ToString(ci)) { diff.AppendFormat(fmt, "Delta_Tup_Tdn", Delta_Tup_Tdn.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TestTime_min.ToString(ci)) { diff.AppendFormat(fmt, "TestTime_min", TestTime_min.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TestTime_max.ToString(ci)) { diff.AppendFormat(fmt, "TestTime_max", TestTime_max.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != AmbTemp_min.ToString(ci)) { diff.AppendFormat(fmt, "AmbTemp_min", AmbTemp_min.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != AmbTemp_max.ToString(ci)) { diff.AppendFormat(fmt, "AmbTemp_max", AmbTemp_max.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Coef_E9.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E9", Coef_E9.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Coef_E10.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E10", Coef_E10.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Coef_E11.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E11", Coef_E11.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Coef_E12.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E12", Coef_E12.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Offset_E9.ToString(ci)) { diff.AppendFormat(fmt, "Offset_E9", Offset_E9.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Offset_E12.ToString(ci)) { diff.AppendFormat(fmt, "Offset_E12", Offset_E12.ToString(ci), ln); };
return diff.ToString();
}
public override string ToString()
{
return string.Format("{0}", Name);
}
}
}
+2 -53
View File
@@ -44,11 +44,6 @@ namespace Config.Entities
public virtual string AltProcName { get; set; } /// Alternative procedure name (null or string.Empty = no alt. procedure) public virtual string AltProcName { get; set; } /// Alternative procedure name (null or string.Empty = no alt. procedure)
public virtual int AltProcPeriod { get; set; } /// Period of alternative procedures (0 = no alt. procedure) public virtual int AltProcPeriod { get; set; } /// Period of alternative procedures (0 = no alt. procedure)
public virtual float DN { get; set; } /// Not mapped to DB, valid in ProceduresCtrl for procedure filtering only
public virtual float Qn { get; set; } /// - ' ' -
public virtual string MClass { get; set; } /// - ' ' -
public virtual string Producer { get; set; } /// - ' ' -
public virtual IList<ComponentProcedure> MoreParams { get; set; } public virtual IList<ComponentProcedure> MoreParams { get; set; }
public virtual IList<Test> Tests { get; set; } public virtual IList<Test> Tests { get; set; }
@@ -70,11 +65,6 @@ namespace Config.Entities
Watermeters = string.Empty; Watermeters = string.Empty;
Description = string.Empty; Description = string.Empty;
LongDescription = string.Empty; LongDescription = string.Empty;
DN = 0;
Qn = 0;
MClass = string.Empty;
Producer = string.Empty;
} }
public Procedure(string name, int itemNr) public Procedure(string name, int itemNr)
@@ -96,10 +86,12 @@ namespace Config.Entities
result.LastChgUser = LastChgUser; result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime; result.LastChgTime = LastChgTime;
result.LongDescription = LongDescription; result.LongDescription = LongDescription;
result.ProcedureState = ProcedureState; result.ProcedureState = ProcedureState;
result.Revision = Revision; result.Revision = Revision;
result.PredecessorId = Id; result.PredecessorId = Id;
result.ObtainedByCopy = ObtainedByCopy; result.ObtainedByCopy = ObtainedByCopy;
result.MetersKind = MetersKind; result.MetersKind = MetersKind;
result.Watermeters = Watermeters; result.Watermeters = Watermeters;
result.Protected = Protected; result.Protected = Protected;
@@ -110,13 +102,6 @@ namespace Config.Entities
result.ResultsWriter = ResultsWriter; result.ResultsWriter = ResultsWriter;
result.TransitionStart = TransitionStart; result.TransitionStart = TransitionStart;
result.TransitionEnd = TransitionEnd; result.TransitionEnd = TransitionEnd;
result.AltProcName = AltProcName;
result.AltProcPeriod = AltProcPeriod;
result.DN = DN;
result.Qn = Qn;
result.MClass = MClass;
result.Producer = Producer;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone(result)); } foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone(result)); }
foreach (var test in Tests) { result.Tests.Add(test.Clone()); } foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
@@ -249,42 +234,6 @@ namespace Config.Entities
return null; return null;
} }
/// <summary>
/// Processes the selection done by the bench control panel in the main sequence.
/// </summary>
/// <param name="selection">Selection.Q1, .Q2, .Q3 or .Test</param>
/// <returns>The selected test or null</returns>
public virtual Test GetTest(string expandedTestName, out int testIx, out int repetNr)
{
for (int ix = 0; ix < Tests.Count; ix++)
{
Test test = Tests[ix];
if (test.Name.Equals(expandedTestName))
{
/// Name is not expanded => Repeats==1
testIx = ix;
repetNr = 1;
return test;
}
for (int r = 1; r <= test.Repeats; r++)
{
if (test.GetExpandedTestName(r).Equals(expandedTestName))
{
testIx = ix;
repetNr = r;
return test;
}
}
}
testIx = 0;
repetNr = 1;
return null;
}
public override string ToString() public override string ToString()
{ {
return string.Format("{0}, rev.{1}", Name, Revision); return string.Format("{0}, rev.{1}", Name, Revision);
+31
View File
@@ -0,0 +1,31 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
namespace Config.Entities
{
public class ProcedureHistory
{
public virtual int Id { get; protected set; }
public virtual Procedure Current { get; set; }
public virtual IList<Procedure> OldProcedures { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public ProcedureHistory()
{
Current = new Procedure();
OldProcedures = new List<Procedure>();
}
public virtual ProcedureHistory Clone()
{
ProcedureHistory result = new ProcedureHistory();
result.Current = Current.Clone();
foreach (Procedure p in OldProcedures) result.OldProcedures.Add(p.Clone());
return result;
}
}
}
-143
View File
@@ -1,143 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
/// <summary>
/// Stores one test procedure, supports revisions and history log
/// </summary>
public class Profile : IHasName, IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; } /// Short description
public virtual string CreationUser { get; set; } /// Name of the user who has created or changed this procedure
public virtual DateTime CreationTime { get; set; } /// Date and time of the creation or change
public virtual string LastChgUser { get; set; } /// Name of the user who has created or changed this procedure
public virtual DateTime LastChgTime { get; set; } /// Date and time of the creation or change
public virtual ProfileType ProfileType { get; set; }
public virtual ErrorLimitType ErrorLimitType { get; set; }
public virtual IList<PTest> Tests { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public Profile()
{
Tests = new List<PTest>();
///
/// Default values
///
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
CreationTime = DateTime.Now;
LastChgUser = CreationUser;
LastChgTime = CreationTime;
Description = string.Empty;
}
public Profile(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public virtual Profile Clone()
{
Profile result = new Profile();
result.ItemNr = ItemNr;
result.Name = Name;
result.Description = Description;
result.CreationUser = CreationUser;
result.CreationTime = CreationTime;
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.ProfileType = ProfileType;
result.ErrorLimitType = ErrorLimitType;
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
return result;
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Name);
output.WriteLine(Description);
output.WriteLine(CreationUser);
output.WriteLine(CreationTime.ToString(CultureInfo.InvariantCulture));
output.WriteLine(LastChgUser);
output.WriteLine(LastChgTime.ToString(CultureInfo.InvariantCulture));
foreach (var test in Tests) { test.Export(output); }
output.WriteLine();
output.Close();
}
public static Profile Import(StreamReader input)
{
Profile result = new Profile();
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.Name = input.ReadLine();
result.Description = input.ReadLine();
result.CreationUser = input.ReadLine();
result.CreationTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.LastChgUser = input.ReadLine();
result.LastChgTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
string line = input.ReadLine();
while (true)
{
PTest tst = PTest.Import(input, result);
if (tst == null)
break;
else
result.Tests.Add(tst);
}
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
const string fmt = "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
ln = inp.ReadLine(); /// skip ItemNr
ln = inp.ReadLine(); if (ln != Name) { diff.AppendFormat(fmt, "Name", Name, ln); };
ln = inp.ReadLine(); if (ln != Description) { diff.AppendFormat(fmt, "Description", Description, ln); };
ln = inp.ReadLine(); /// skip CreationUser
ln = inp.ReadLine(); /// skip CreationTime
ln = inp.ReadLine(); /// skip LastChgUser
ln = inp.ReadLine(); /// skip LastChgTime
//foreach (var test in Tests)
//{
// string testDiff = test.Compare(inp);
// if (testDiff.Contains(
//}
//bool extraTestsInFile = true;
//while (Test.Import(inp, null) != null) { extraTestsInFile = true; }
return diff.ToString();
}
public override string ToString()
{
return string.Format("{0}", Name);
}
}
}
+36 -75
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s. /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -18,21 +18,19 @@ namespace Config.Entities
public virtual string Name { get; set; } public virtual string Name { get; set; }
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s public virtual int Part { get; set; } /// Part=0 ... test of all WM-s
/// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath /// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
public virtual TestProfile Profile { get; set; } /// UserDefined, Protected, UserDefinedHeatMeter, ProtectedHeatMeter public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal public virtual bool DoEvaluate { get; set; }
public virtual bool DoEvaluate { get; set; } public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual float Qtg { get; set; } /// Target water flow [m3/h]
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual float Qto { get; set; } /// Water flow high limit in [m3/h] public virtual float Qto { get; set; } /// Water flow high limit in [m3/h]
public virtual float Volume { get; set; } /// Test volume (target) in [l] public virtual float Volume { get; set; } /// Test volume (target) in [l]
public virtual float TstTime { get; set; } /// Test time (estimate) in [s] public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
public virtual string Method { get; set; } public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3 public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0) or 1=class1, 2=class2, 3=class3
public virtual float ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0) or -Qn in m3/h
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx) public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual int Repeats { get; set; } public virtual int Repeats { get; set; }
public virtual bool DoDraining { get; set; } public virtual bool DoDraining { get; set; }
public virtual bool DoDrainingAfter { get; set; } public virtual bool DoZeroing { get; set; }
public virtual bool DoControlWaterTemp { get; set; } public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; } /// Lower limit for the controlled temperature public virtual float TempLimLo { get; set; } /// Lower limit for the controlled temperature
public virtual float TempLimHi { get; set; } /// Upper limit for the controlled temperature public virtual float TempLimHi { get; set; } /// Upper limit for the controlled temperature
@@ -45,7 +43,7 @@ namespace Config.Entities
public virtual int TimePump2StartV { get; set; } /// Delay time from the start of the pump to opening the start valve in [s] public virtual int TimePump2StartV { get; set; } /// Delay time from the start of the pump to opening the start valve in [s]
public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s] public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
public virtual double TolerRed { get; set; } /// = Filter public virtual double TolerRed { get; set; } /// = Filter
public virtual string RedType { get; set; } public virtual TestRedType RedType { get; set; }
public virtual string FeedingPath { get; set; } public virtual string FeedingPath { get; set; }
public virtual string BenchPath { get; set; } public virtual string BenchPath { get; set; }
public virtual string OutputPath { get; set; } public virtual string OutputPath { get; set; }
@@ -55,11 +53,9 @@ namespace Config.Entities
#endif #endif
public virtual string RelTransBefore { get; set; } public virtual string RelTransBefore { get; set; }
public virtual string RelTransBetween { get; set; } public virtual string RelTransBetween { get; set; }
public virtual string RelTransAfter { get; set; }
public virtual string TransitionAfter { get; set; } public virtual string TransitionAfter { get; set; }
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
public virtual IList<ComponentTest> MoreParams { get; set; } public virtual IList<ComponentTest> MoreParams { get; set; }
public virtual Procedure Procedure { get; set; } public virtual Procedure Procedure { get; set; }
@@ -73,13 +69,11 @@ namespace Config.Entities
/// ///
/// Default values /// Default values
/// ///
Part = 0; Publish = (sbyte)Config.Entities.Publish.Always;
Profile = TestProfile.UserDefined;
Publish = (sbyte)Config.Entities.Publish.Always;
DoEvaluate = true; DoEvaluate = true;
Repeats = 1; Repeats = 1;
DoDraining = false; DoDraining = false;
DoDrainingAfter = false; DoZeroing = false;
DoControlWaterTemp = false; DoControlWaterTemp = false;
TempLimLo = 15.0f; TempLimLo = 15.0f;
TempLimHi = 25.0f; TempLimHi = 25.0f;
@@ -97,6 +91,7 @@ namespace Config.Entities
TolerRed = 0; /// = Filter parameter TolerRed = 0; /// = Filter parameter
RelTransBefore = string.Empty; RelTransBefore = string.Empty;
RelTransBetween = string.Empty; RelTransBetween = string.Empty;
RelTransAfter = string.Empty;
TransitionAfter = string.Empty; TransitionAfter = string.Empty;
} }
@@ -114,10 +109,8 @@ namespace Config.Entities
Test result = new Test(Name, ItemNr, Procedure); Test result = new Test(Name, ItemNr, Procedure);
result.Part = Part; result.Part = Part;
result.Profile = Profile; result.Publish = Publish;
result.Publish = Publish;
result.DoEvaluate = DoEvaluate; result.DoEvaluate = DoEvaluate;
result.Qtg = Qtg;
result.Qfrom = Qfrom; result.Qfrom = Qfrom;
result.Qto = Qto; result.Qto = Qto;
result.Volume = Volume; result.Volume = Volume;
@@ -128,7 +121,7 @@ namespace Config.Entities
result.Uncertainty = Uncertainty; result.Uncertainty = Uncertainty;
result.Repeats = Repeats; result.Repeats = Repeats;
result.DoDraining = DoDraining; result.DoDraining = DoDraining;
result.DoDrainingAfter = DoDrainingAfter; result.DoZeroing = DoZeroing;
result.DoControlWaterTemp = DoControlWaterTemp; result.DoControlWaterTemp = DoControlWaterTemp;
result.TempLimLo = TempLimLo; result.TempLimLo = TempLimLo;
result.TempLimHi = TempLimHi; result.TempLimHi = TempLimHi;
@@ -151,6 +144,7 @@ namespace Config.Entities
#endif #endif
result.RelTransBefore = RelTransBefore; result.RelTransBefore = RelTransBefore;
result.RelTransBetween = RelTransBetween; result.RelTransBetween = RelTransBetween;
result.RelTransAfter = RelTransAfter;
result.TransitionAfter = TransitionAfter; result.TransitionAfter = TransitionAfter;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); } foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
@@ -165,7 +159,6 @@ namespace Config.Entities
output.WriteLine(Part.ToString(ci)); output.WriteLine(Part.ToString(ci));
output.WriteLine(Publish.ToString(ci)); output.WriteLine(Publish.ToString(ci));
output.WriteLine(DoEvaluate.ToString()); output.WriteLine(DoEvaluate.ToString());
output.WriteLine(Qtg.ToString(ci));
output.WriteLine(Qfrom.ToString(ci)); output.WriteLine(Qfrom.ToString(ci));
output.WriteLine(Qto.ToString(ci)); output.WriteLine(Qto.ToString(ci));
output.WriteLine(Volume.ToString(ci)); output.WriteLine(Volume.ToString(ci));
@@ -176,7 +169,7 @@ namespace Config.Entities
output.WriteLine(Uncertainty.ToString(ci)); output.WriteLine(Uncertainty.ToString(ci));
output.WriteLine(Repeats.ToString(ci)); output.WriteLine(Repeats.ToString(ci));
output.WriteLine(DoDraining.ToString()); output.WriteLine(DoDraining.ToString());
output.WriteLine(DoDrainingAfter.ToString()); output.WriteLine(DoZeroing.ToString());
output.WriteLine(DoControlWaterTemp.ToString()); output.WriteLine(DoControlWaterTemp.ToString());
output.WriteLine(TempLimLo.ToString(ci)); output.WriteLine(TempLimLo.ToString(ci));
output.WriteLine(TempLimHi.ToString(ci)); output.WriteLine(TempLimHi.ToString(ci));
@@ -194,7 +187,7 @@ namespace Config.Entities
output.WriteLine(MetersPath); output.WriteLine(MetersPath);
output.WriteLine(RelTransBefore); output.WriteLine(RelTransBefore);
output.WriteLine(RelTransBetween); output.WriteLine(RelTransBetween);
output.WriteLine(Profile); output.WriteLine(RelTransAfter);
output.WriteLine(TransitionAfter); output.WriteLine(TransitionAfter);
foreach (var prms in MoreParams) { prms.Export(output); } foreach (var prms in MoreParams) { prms.Export(output); }
@@ -216,8 +209,7 @@ namespace Config.Entities
tst.Part = int.Parse(input.ReadLine(), ci); tst.Part = int.Parse(input.ReadLine(), ci);
tst.Publish = sbyte.Parse(input.ReadLine(), ci); tst.Publish = sbyte.Parse(input.ReadLine(), ci);
tst.DoEvaluate = bool.Parse(input.ReadLine()); tst.DoEvaluate = bool.Parse(input.ReadLine());
tst.Qtg = float.Parse(input.ReadLine(), ci); tst.Qfrom = float.Parse(input.ReadLine(), ci);
tst.Qfrom = float.Parse(input.ReadLine(), ci);
tst.Qto = float.Parse(input.ReadLine(), ci); tst.Qto = float.Parse(input.ReadLine(), ci);
tst.Volume = float.Parse(input.ReadLine(), ci); tst.Volume = float.Parse(input.ReadLine(), ci);
tst.TstTime = float.Parse(input.ReadLine(), ci); tst.TstTime = float.Parse(input.ReadLine(), ci);
@@ -227,7 +219,7 @@ namespace Config.Entities
tst.Uncertainty = float.Parse(input.ReadLine(), ci); tst.Uncertainty = float.Parse(input.ReadLine(), ci);
tst.Repeats = int.Parse(input.ReadLine(), ci); tst.Repeats = int.Parse(input.ReadLine(), ci);
tst.DoDraining = bool.Parse(input.ReadLine()); tst.DoDraining = bool.Parse(input.ReadLine());
tst.DoDrainingAfter = bool.Parse(input.ReadLine()); tst.DoZeroing = bool.Parse(input.ReadLine());
tst.DoControlWaterTemp = bool.Parse(input.ReadLine()); tst.DoControlWaterTemp = bool.Parse(input.ReadLine());
tst.TempLimLo = float.Parse(input.ReadLine(), ci); tst.TempLimLo = float.Parse(input.ReadLine(), ci);
tst.TempLimHi = float.Parse(input.ReadLine(), ci); tst.TempLimHi = float.Parse(input.ReadLine(), ci);
@@ -245,10 +237,7 @@ namespace Config.Entities
tst.MetersPath = input.ReadLine(); tst.MetersPath = input.ReadLine();
tst.RelTransBefore = input.ReadLine(); tst.RelTransBefore = input.ReadLine();
tst.RelTransBetween = input.ReadLine(); tst.RelTransBetween = input.ReadLine();
string line = input.ReadLine(); tst.RelTransAfter = input.ReadLine();
tst.Profile = line.Equals(TestProfile.ProtectedHeatMeter.ToString()) ? TestProfile.ProtectedHeatMeter
: line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter
: line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default
tst.TransitionAfter = input.ReadLine(); tst.TransitionAfter = input.ReadLine();
while (true) while (true)
@@ -278,7 +267,6 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Part.ToString(ci)) { diff.AppendFormat(fmt, "Part", Part.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Part.ToString(ci)) { diff.AppendFormat(fmt, "Part", Part.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Publish.ToString(ci)) { diff.AppendFormat(fmt, "Publish", Publish.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Publish.ToString(ci)) { diff.AppendFormat(fmt, "Publish", Publish.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoEvaluate.ToString(ci)) { diff.AppendFormat(fmt, "Evaluate", DoEvaluate.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != DoEvaluate.ToString(ci)) { diff.AppendFormat(fmt, "Evaluate", DoEvaluate.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qtg.ToString(ci)) { diff.AppendFormat(fmt, "Qtg", Qtg.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qfrom.ToString(ci)) { diff.AppendFormat(fmt, "Qfrom", Qfrom.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Qfrom.ToString(ci)) { diff.AppendFormat(fmt, "Qfrom", Qfrom.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qto.ToString(ci)) { diff.AppendFormat(fmt, "Qto", Qto.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Qto.ToString(ci)) { diff.AppendFormat(fmt, "Qto", Qto.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Volume.ToString(ci)) { diff.AppendFormat(fmt, "Volume", Volume.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Volume.ToString(ci)) { diff.AppendFormat(fmt, "Volume", Volume.ToString(ci), ln); };
@@ -289,7 +277,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Uncertainty.ToString(ci)) { diff.AppendFormat(fmt, "Uncertainty", Uncertainty.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Uncertainty.ToString(ci)) { diff.AppendFormat(fmt, "Uncertainty", Uncertainty.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "Draining", DoDraining.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "Draining", DoDraining.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != DoZeroing.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoZeroing.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoControlWaterTemp.ToString()) { diff.AppendFormat(fmt, "DoControlWaterTemp", DoControlWaterTemp.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != DoControlWaterTemp.ToString()) { diff.AppendFormat(fmt, "DoControlWaterTemp", DoControlWaterTemp.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
@@ -307,7 +295,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != MetersPath) { diff.AppendFormat(fmt, "MetersPath", MetersPath, ln); }; ln = inp.ReadLine(); if (ln != MetersPath) { diff.AppendFormat(fmt, "MetersPath", MetersPath, ln); };
ln = inp.ReadLine(); if (ln != RelTransBefore) { diff.AppendFormat(fmt, "RelTransBefore", RelTransBefore, ln); }; ln = inp.ReadLine(); if (ln != RelTransBefore) { diff.AppendFormat(fmt, "RelTransBefore", RelTransBefore, ln); };
ln = inp.ReadLine(); if (ln != RelTransBetween) { diff.AppendFormat(fmt, "RelTransBetween", RelTransBetween, ln); }; ln = inp.ReadLine(); if (ln != RelTransBetween) { diff.AppendFormat(fmt, "RelTransBetween", RelTransBetween, ln); };
ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); }; ln = inp.ReadLine(); if (ln != RelTransAfter) { diff.AppendFormat(fmt, "RelTransAfter", RelTransAfter, ln); };
ln = inp.ReadLine(); if (ln != TransitionAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransitionAfter, ln); }; ln = inp.ReadLine(); if (ln != TransitionAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransitionAfter, ln); };
return diff.ToString(); return diff.ToString();
@@ -322,77 +310,50 @@ namespace Config.Entities
return null; return null;
} }
/// <summary> public virtual float GetErrLimLo(float flow)
/// Return test title for a this test and a given repetition number
/// </summary>
/// <param name="repetitonNr">1 .. Nr. repetitions</param>
/// <returns>Test title (string)</returns>
public virtual string GetExpandedTestName(int repetitionNr)
{
if (Repeats == 1)
{
if (Part == 0)
{
/// Single test
return Name;
}
else
{
/// A part of a single test
return string.Format("{0} ({1})", Name, Part);
}
}
else
{
/// More test repetitions
return string.Format("{0} ({1}/{2})", Name, repetitionNr, Repeats);
}
}
public virtual double GetErrLimLo(double volumeCTV, double testTime)
{ {
if (ErrLimLo <= ErrLimHi) if (ErrLimLo <= ErrLimHi)
{ {
return ErrLimLo; /// Error limit of a water meter return ErrLimLo; /// Error limit of a water meter
} }
else else
{ {
/// Metrological class and nominal flow of a heat meter /// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo); int metrClass = (int)Math.Round(ErrLimLo);
double Qp = Math.Abs(ErrLimHi); float Qp = Math.Abs(ErrLimHi);
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter /// Calculate the error limit of a heat meter
switch (metrClass) switch (metrClass)
{ {
default: default:
case 1: return -Math.Min(3.5, 1.0 + 0.01 * Qp / Q); case 1: return -Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return -Math.Min(5.0, 2.0 + 0.02 * Qp / Q); case 2: return -Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return -Math.Min(5.0, 3.0 + 0.05 * Qp / Q); case 3: return -Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
} }
} }
} }
public virtual double GetErrLimHi(double volumeCTV, double testTime) public virtual float GetErrLimHi(float flow)
{ {
if (ErrLimLo <= ErrLimHi) if (ErrLimLo <= ErrLimHi)
{ {
return ErrLimHi; /// Error limit of a water meter return ErrLimHi; /// Error limit of a water meter
} }
else else
{ {
/// Metrological class and nominal flow of a heat meter /// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo); int metrClass = (int)Math.Round(ErrLimLo);
double Qp = Math.Abs(ErrLimHi); float Qp = Math.Abs(ErrLimHi);
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter /// Calculate the error limit of a heat meter
switch (metrClass) switch (metrClass)
{ {
default: default:
case 1: return +Math.Min(3.5, 1.0 + 0.01 * Qp / Q); case 1: return +Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return +Math.Min(5.0, 2.0 + 0.02 * Qp / Q); case 2: return +Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return +Math.Min(5.0, 3.0 + 0.05 * Qp / Q); case 3: return +Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
} }
} }
} }
+2 -56
View File
@@ -1,10 +1,7 @@
/// ///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// Copyright (c) 2013-2015 Sensus Metering Systems
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities namespace Config.Entities
{ {
@@ -40,56 +37,5 @@ namespace Config.Entities
foreach (var step in TransitionSteps) { result.TransitionSteps.Add(step.Clone()); } foreach (var step in TransitionSteps) { result.TransitionSteps.Add(step.Clone()); }
return result; return result;
} }
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Name);
output.WriteLine(Description);
foreach (var step in TransitionSteps) { step.Export(output); }
output.WriteLine();
output.Close();
}
public static TransitionSequence Import(StreamReader input)
{
TransitionSequence result = new TransitionSequence();
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.Name = input.ReadLine();
result.Description = input.ReadLine();
while (true)
{
TransitionStep step = TransitionStep.Import(input, result);
if (step == null)
break;
else
result.TransitionSteps.Add(step);
}
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
const string fmt = "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
ln = inp.ReadLine(); /// skip ItemNr
ln = inp.ReadLine(); if (ln != Name) { diff.AppendFormat(fmt, "Name", Name, ln); };
ln = inp.ReadLine(); if (ln != Description) { diff.AppendFormat(fmt, "Description", Description, ln); };
//foreach (var step in TransitionSteps)
//{
// string testDiff = step.Compare(inp);
// if (testDiff.Contains(
//}
return diff.ToString();
}
}
} }
+1 -62
View File
@@ -1,10 +1,8 @@
/// ///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// Copyright (c) 2013-2015, 2017 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities namespace Config.Entities
{ {
@@ -63,64 +61,5 @@ namespace Config.Entities
result += indent + "PumpsWithFMPct = " + PumpWithFMPcts + Environment.NewLine; result += indent + "PumpsWithFMPct = " + PumpWithFMPcts + Environment.NewLine;
return result; return result;
} }
public virtual void Export(StreamWriter output)
{
CultureInfo ci = CultureInfo.InvariantCulture;
output.WriteLine(ItemNr.ToString(ci));
output.WriteLine(Duration.ToString(ci));
output.WriteLine(Message);
output.WriteLine(EndCondition);
output.WriteLine(ValvesOpen);
output.WriteLine(ValvesClose);
output.WriteLine(RegulValvesPct);
output.WriteLine(PumpWithFMPcts);
}
public static TransitionStep Import(StreamReader input, TransitionSequence newSequence)
{
string firstLine = input.ReadLine();
if (string.IsNullOrEmpty(firstLine))
{
return null;
}
CultureInfo ci = CultureInfo.InvariantCulture;
int itemNr = int.Parse(firstLine, ci);
TransitionStep tst = new TransitionStep(itemNr, newSequence);
tst.Duration = int.Parse(input.ReadLine(), ci);
tst.Message = input.ReadLine();
tst.EndCondition = input.ReadLine();
tst.ValvesOpen = input.ReadLine();
tst.ValvesClose = input.ReadLine();
tst.RegulValvesPct = input.ReadLine();
tst.PumpWithFMPcts = input.ReadLine();
return tst;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
string fmt = string.Format("Step {0} : ", ItemNr) + "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
CultureInfo ci = CultureInfo.InvariantCulture;
string firstLine = inp.ReadLine();
if (string.IsNullOrEmpty(firstLine)) return string.Format("TransitionStep {0} is missing in the compared file\r\n", ItemNr);
if (ItemNr.ToString() != firstLine) { diff.AppendFormat(fmt, "ItemNr", ItemNr, firstLine); };
ln = inp.ReadLine(); if (ln != Duration.ToString(ci)) { diff.AppendFormat(fmt, "Duration", Duration.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Message) { diff.AppendFormat(fmt, "Message", Message, ln); };
ln = inp.ReadLine(); if (ln != EndCondition) { diff.AppendFormat(fmt, "EndCondition", EndCondition, ln); };
ln = inp.ReadLine(); if (ln != ValvesOpen) { diff.AppendFormat(fmt, "ValvesOpen", ValvesOpen, ln); };
ln = inp.ReadLine(); if (ln != ValvesClose) { diff.AppendFormat(fmt, "ValvesClose", ValvesClose, ln); };
ln = inp.ReadLine(); if (ln != RegulValvesPct) { diff.AppendFormat(fmt, "RegulValvesPct", RegulValvesPct, ln); };
ln = inp.ReadLine(); if (ln != PumpWithFMPcts) { diff.AppendFormat(fmt, "PumpWithFMPcts", PumpWithFMPcts, ln); };
return diff.ToString();
}
} }
} }
-20
View File
@@ -1,20 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace Config.Entities
{
public class Uncertainty
{
public virtual int Id { get; protected set; }
public virtual float Measurement { get; set; }
public virtual float MainUncertainty { get; set; }
public virtual float Resolution { get; set; }
public virtual float DriftPerYr { get; set; }
public virtual float Conditions { get; set; }
public virtual float UncertaintyOfCorrection { get; set; }
public Uncertainty() { }
}
}
+2 -6
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s. /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -11,12 +11,8 @@ namespace Config.Entities
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual string UserName { get; set; } /// = name, alias, abbreviation public virtual string UserName { get; set; } /// = name, alias, abbreviation
public virtual string FullName { get; set; } /// = description public virtual string FullName { get; set; } /// = description
public virtual string Tag { get; set; } public virtual int Number { get; set; }
public virtual int Number { get; set; }
public virtual string Password { get; set; } public virtual string Password { get; set; }
public virtual string Password2 { get; set; }
public virtual string Password3 { get; set; }
public virtual string Password4 { get; set; }
public virtual DateTime LastPwChange { get; set; } public virtual DateTime LastPwChange { get; set; }
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
+1 -21
View File
@@ -1,9 +1,8 @@
/// ///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// Copyright (c) 2013-2015 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
namespace Config.Entities namespace Config.Entities
{ {
@@ -36,24 +35,5 @@ namespace Config.Entities
foreach (var step in VirtualBenchSteps) { result.VirtualBenchSteps.Add(step.Clone()); } foreach (var step in VirtualBenchSteps) { result.VirtualBenchSteps.Add(step.Clone()); }
return result; return result;
} }
public virtual void Export(StreamWriter output)
{
/// TODO
}
public static VirtualBenchSequence Import(StreamReader input)
{
VirtualBenchSequence result = new VirtualBenchSequence();
/// TODO
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
/// TODO
return diff.ToString();
}
} }
} }
+78
View File
@@ -0,0 +1,78 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/// This class holds the watermeter type specific data
/// that have all watermaters of the same type in common
namespace Config.Entities
{
public class WMType
{
// mapped
public virtual int Id { get; protected set; } /// primary key
public virtual DateTime CreateTime { get; set; } /// Date and time of the creation or change
public virtual string CreateUserName { get; set; } /// Name of the user who has created or changed this procedure
public virtual string CreateDescription { get; set; } /// Description\
public virtual string Name { get; set; } /// type name
public virtual float PulseRate { get; set; } /// Pulses per Liter
// not yet mapped
public virtual int IdentNr { get; protected set; } /// identification number of watermeter tzpe
public virtual int Diameter { get; set; } /// nominal diameter
public virtual int Pressure { get; set; } /// nominal pressure
public virtual int Length { get; set; } /// construction length
public virtual int Temperatur { get; set; } /// nominal temperature in C
public virtual float NominalFlow { get; set; } /// nominal flow Qn
/// ------------- Additional stuff not mapped into the database -------------
public WMType()
{
}
public static WMType DefaultWMType()
{
WMType procedure = new WMType()
{
CreateTime = DateTime.Now,
CreateUserName = Users.GlobalData.CurrentUser.UserName,
CreateDescription = "A default water meter created.",
Name = "Watermeter",
PulseRate = 1000,
};
return procedure;
}
public virtual WMType Clone()
{
WMType result = new WMType();
result.CreateTime = CreateTime;
result.CreateUserName = CreateUserName;
result.CreateDescription = CreateDescription;
result.Name = Name;
result.PulseRate = PulseRate;
return result;
}
public override string ToString()
{
string result = "";
result += "WMTpe: " + Environment.NewLine;
result += " Name = " + Name + Environment.NewLine;
result += " Created by = " + CreateUserName + Environment.NewLine;
result += " Created on = " + CreateTime.ToString() + Environment.NewLine;
result += " Description = " + CreateDescription + Environment.NewLine;
result += " Pulse rate = " + PulseRate.ToString() + Environment.NewLine;
return result;
}
}
}
+40
View File
@@ -0,0 +1,40 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using FluentNHibernate;
namespace Config.Entities
{
public class Watermeter
{
public virtual int Id { get; protected set; } /// primary key
public virtual DateTime CreateTime { get; set; } /// Date and time of the creation or change
public virtual string CreateUserName { get; set; } /// Name of the user who has created or changed this procedure
public virtual string CreateDescription { get; set; } /// Description
/// mapped
public virtual string Serial { get; set; } /// serial number
public virtual WMType WMType { get; set; } /// type of watermeter
///
/// <summary>
/// Load a watermeter from the database
/// </summary>
public static Watermeter LoadBySerialnr(string SerialNr)
{
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(Users.Entities.DBKind.Results)
.CreateQuery("FROM Watermeter WHERE Serial = :SerialNrParameter")
.SetParameter("SerialNrParameter", SerialNr)
.List<Watermeter>();
if (ListOfWatermeters.Count > 0) return ListOfWatermeters.ElementAt(0);
return null;
}
}
}
+22 -28
View File
@@ -145,8 +145,17 @@ namespace Config
using (var transaction = session.BeginTransaction()) using (var transaction = session.BeginTransaction())
{ {
/// ///
/// Create user 'admin' /// Prepare all groups
/// ///
var testers = new Config.Entities.Group((int)Users.Grp.GID.Testers, Strings.Tester);
var testingSpecialists = new Config.Entities.Group((int)Users.Grp.GID.TestingSpecialists, Strings.Testing_Specialist);
var headOfLab = new Config.Entities.Group((int)Users.Grp.GID.HeadOfLab, Strings.Head_of_Lab);
var maintenanceSpecialists = new Config.Entities.Group((int)Users.Grp.GID.MaintenanceSpecialists, Strings.Maintenance_Specialist);
var metrologists = new Config.Entities.Group((int)Users.Grp.GID.Metrologists, Strings.Metrologist);
var calibrationSpecialists = new Config.Entities.Group((int)Users.Grp.GID.CalibrationSpecialists, Strings.Calibration_Specialist);
var administrators = new Config.Entities.Group((int)Users.Grp.GID.Administrators, Strings.Administrator);
/// Create the user 'admin' add his groups
var admin = new Config.Entities.User var admin = new Config.Entities.User
{ {
UserName = Data.AdminUsername, UserName = Data.AdminUsername,
@@ -154,35 +163,20 @@ namespace Config
LastPwChange = DateTime.Now LastPwChange = DateTime.Now
}; };
admin.SetPassword(Data.AdminPassword); admin.SetPassword(Data.AdminPassword);
admin.AddGroup(testers);
admin.AddGroup(testingSpecialists);
admin.AddGroup(headOfLab);
admin.AddGroup(maintenanceSpecialists);
admin.AddGroup(metrologists);
admin.AddGroup(calibrationSpecialists);
admin.AddGroup(administrators);
/// session.SaveOrUpdate(admin);
/// Prepare all groups, add some of them to admin
/// ///// Create the control board component
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++) //var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
{ //session.SaveOrUpdate(cmpnt);
Config.Entities.Group group = new Config.Entities.Group(gid);
switch (gid)
{
case Users.Entities.GID.Testers:
case Users.Entities.GID.TestingSpecialists:
case Users.Entities.GID.HeadOfLab:
case Users.Entities.GID.MaintenanceSpecialists:
case Users.Entities.GID.Metrologists:
case Users.Entities.GID.CalibrationSpecialists:
case Users.Entities.GID.Administrators:
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
case Users.Entities.GID.TraceabilityManagement:
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_END
case Users.Entities.GID.MetrologicalAuthority:
case Users.Entities.GID.WaterMeterAuthority:
#endif
admin.AddGroup(group);
session.SaveOrUpdate(group); /// Save this group
break;
}
}
session.SaveOrUpdate(admin); /// Save user 'admin'
transaction.Commit(); transaction.Commit();
} }
} }
+50 -68
View File
@@ -11,23 +11,14 @@ namespace Config
{ {
private static readonly ILog log = LogManager.GetLogger(typeof(Formulas)); private static readonly ILog log = LogManager.GetLogger(typeof(Formulas));
/// ///
/// Wrappers /// Tables to calculate specific enthalpy
/// ///
public static double RealDensity() { return Data.RealDensity; } private static readonly int[] Ii;
public static double AtTemperature() { return Data.AtTemperature; } private static readonly int[] Ji;
public static double Buoyancy() { return Data.Buoyancy; } private static readonly double[] ni;
/// Private tables with coeficients to calculate specific enthalpy
static readonly int[] Ii;
static readonly int[] Ji;
static readonly double[] ni;
/// Private table with coeficients to calculate temperature of a platinum thermometer
static readonly double[] Di;
private static readonly double[] Di;
/// <summary> /// <summary>
/// Constructor /// Constructor
@@ -162,9 +153,9 @@ namespace Config
/// </summary> /// </summary>
/// <param name="t">Temperature in [°C]</param> /// <param name="t">Temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns> /// <returns>Density in [kg/m3]</returns>
public static double WaterDensityFromTemp(double t) public static double WaterDensityFromTemp(double t, double realDensity, double atTemperature)
{ {
return DistilledWaterDensityFromTemp(t) + DensityCorrection(RealDensity(), AtTemperature()); return DistilledWaterDensityFromTemp(t) + DensityCorrection(realDensity, atTemperature);
} }
/// <summary> /// <summary>
@@ -172,7 +163,7 @@ namespace Config
/// </summary> /// </summary>
/// <param name="t">Temperature in [°C]</param> /// <param name="t">Temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns> /// <returns>Density in [kg/m3]</returns>
public static double WaterDensityFromTempPress(double temp, double pressure) public static double WaterDensityFromTempPress(double temp, double pressure, double realDensity, double atTemperature)
{ {
double x0 = 5.08821E-10; double x0 = 5.08821E-10;
double x1 = 1.2639418; double x1 = 1.2639418;
@@ -182,7 +173,7 @@ namespace Config
double theta = temp / 100.0; double theta = temp / 100.0;
double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta); double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta);
return WaterDensityFromTemp(temp) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure)); return WaterDensityFromTemp(temp, realDensity, atTemperature) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure));
} }
@@ -230,60 +221,45 @@ namespace Config
return error; return error;
} }
/// <summary>
/// Calculates corrected value form a list of corrections by interpolation.
/// It is assumed that values in the list 'corrections' are sorted.
/// </summary>
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
{
if (corrections == null || corrections.Count == 0) return rawValue;
/// <summary> if (rawValue < corrections[0].Measurement)
/// Calculates corrected value from a list of corrections by interpolation. {
/// It is assumed that values in the list 'corrections' are sorted. return rawValue + corrections[0].Correction;
/// </summary> }
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
{
return rawValue + GetCorrection(rawValue, corrections);
}
/// <summary> int count = corrections.Count;
/// Get a correction from a list of corrections by interpolation. for (int i = 1; i < count; i++)
/// It is assumed that values in the list 'corrections' are sorted. {
/// </summary> if (rawValue < corrections[i].Measurement)
/// <param name="rawMeasurement">Raw uncorrected value</param> {
/// <param name="corrections">Sorted (value, correction) pairs</param> double d1 = rawValue - corrections[i-1].Measurement;
/// <returns>Corrected value</returns> double d2 = corrections[i].Measurement - rawValue;
public static double GetCorrection(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
{
if ((corrections == null) || (corrections.Count == 0)) return 0; /// No correction
if (rawValue < corrections[0].Measurement) double corr;
{ if (d1 + d2 <= float.Epsilon)
/// rawValue is below the lowest value in the correction table {
return corrections[0].Correction; corr = (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
} }
else
{
corr = (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
}
return rawValue + corr;
}
}
int count = corrections.Count; return rawValue + corrections[count - 1].Correction;
for (int i = 1; i < count; i++) }
{
if (rawValue < corrections[i].Measurement)
{
double d1 = rawValue - corrections[i - 1].Measurement;
double d2 = corrections[i].Measurement - rawValue;
if (d1 + d2 <= float.Epsilon)
{
/// Neigboring values in the corection table are close to each other -> calculate the average
return (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
}
else
{
/// Interpolate the correction from neigboring values in the corection table
return (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
}
}
}
/// rawValue is above the highest value in the correction table
return corrections[count - 1].Correction;
}
/// <summary> /// <summary>
@@ -403,5 +379,11 @@ namespace Config
return (-(R0 * A) + Math.Sqrt(R0 * R0 * A * A - 4 * R0 * B * (R0 - R))) / (2 * R0 * B); return (-(R0 * A) + Math.Sqrt(R0 * R0 * A * A - 4 * R0 * B * (R0 - R))) / (2 * R0 * B);
} }
public static double Buoyancy()
{
return 1.00103;
}
} }
} }
+2 -5
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s. /// Copyright (c) 2013-2015 Sensus Metering Systems
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
using Config.Entities; using Config.Entities;
@@ -23,9 +23,6 @@ namespace Config.Mappings
HasMany(x => x.Corrections) HasMany(x => x.Corrections)
.OrderBy("Measurement") .OrderBy("Measurement")
.Cascade.All(); .Cascade.All();
HasMany(x => x.Uncertainties) }
.OrderBy("Measurement")
.Cascade.All();
}
} }
} }
+3 -10
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// Copyright (c) 2013-2015 Sensus Metering Systems
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
@@ -7,18 +7,11 @@ namespace Config.Mappings
{ {
class GroupMap : ClassMap<Entities.Group> class GroupMap : ClassMap<Entities.Group>
{ {
/// <seealso>
/// https://stackoverflow.com/questions/9108083/fluent-nhibernate-many-to-many-mapping-way/9125059
/// </seealso>
public GroupMap() public GroupMap()
{ {
Id(x => x.Id); Id(x => x.Id);
Map(x => x.GID).Column("Name"); Map(x => x.Gid);
Map(x => x.AccessFlags); Map(x => x.Name);
HasManyToMany(x => x.Users)
.Cascade.SaveUpdate()
.Inverse()
.Table("UsersGroups");
} }
} }
} }
-60
View File
@@ -1,60 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class PTestMap : ClassMap<PTest>
{
public PTestMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Part);
Map(x => x.CoefQfrom);
Map(x => x.CoefQto);
Map(x => x.ErrLimLo);
Map(x => x.ErrLimHi);
Map(x => x.TempLimLo);
Map(x => x.TempLimHi);
Map(x => x.PressLimLo);
Map(x => x.PressLimHi);
Map(x => x.Publish);
Map(x => x.Evaluate);
Map(x => x.E1);
Map(x => x.E2);
Map(x => x.E3);
Map(x => x.E4);
Map(x => x.E5);
Map(x => x.E6);
Map(x => x.E7);
Map(x => x.E8);
Map(x => x.E9);
Map(x => x.E10);
Map(x => x.E11);
Map(x => x.E12);
Map(x => x.E13);
Map(x => x.E14);
Map(x => x.E15);
Map(x => x.E16);
Map(x => x.E21);
Map(x => x.Delta_Q_pct);
Map(x => x.Delta_T);
Map(x => x.Delta_Tup_Tdn);
Map(x => x.TestTime_min);
Map(x => x.TestTime_max);
Map(x => x.AmbTemp_min);
Map(x => x.AmbTemp_max);
Map(x => x.Coef_E9);
Map(x => x.Coef_E10);
Map(x => x.Coef_E11);
Map(x => x.Coef_E12);
Map(x => x.Offset_E9);
Map(x => x.Offset_E12);
References(x => x.Profile);
}
}
}
-28
View File
@@ -1,28 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class ProfileMap : ClassMap<Profile>
{
public ProfileMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Description);
Map(x => x.CreationUser);
Map(x => x.CreationTime);
Map(x => x.LastChgUser);
Map(x => x.LastChgTime);
Map(x => x.ProfileType);
Map(x => x.ErrorLimitType);
HasMany(x => x.Tests)
.OrderBy("ItemNr")
.Cascade.All();
}
}
}
+9 -14
View File
@@ -14,19 +14,17 @@ namespace Config.Mappings
Map(x => x.ItemNr); Map(x => x.ItemNr);
Map(x => x.Name); Map(x => x.Name);
Map(x => x.Part); Map(x => x.Part);
Map(x => x.Profile); Map(x => x.Publish);
Map(x => x.Publish);
Map(x => x.DoEvaluate) Map(x => x.DoEvaluate)
.Column("Evaluate"); .Column("Evaluate");
Map(x => x.Qtg); Map(x => x.Qfrom);
Map(x => x.Qfrom);
Map(x => x.Qto); Map(x => x.Qto);
Map(x => x.Volume); Map(x => x.Volume);
Map(x => x.TstTime); Map(x => x.TstTime);
Map(x => x.Repeats); Map(x => x.Repeats);
Map(x => x.DoDraining) Map(x => x.DoDraining)
.Column("Emptying"); .Column("Emptying");
Map(x => x.DoDrainingAfter) Map(x => x.DoZeroing)
.Column("Zeroing"); .Column("Zeroing");
Map(x => x.DoControlWaterTemp); Map(x => x.DoControlWaterTemp);
Map(x => x.TempLimLo); Map(x => x.TempLimLo);
@@ -47,7 +45,7 @@ namespace Config.Mappings
Map(x => x.Uncertainty); Map(x => x.Uncertainty);
Map(x => x.TolerRed) Map(x => x.TolerRed)
.Column("TolerRed"); /// ??? .Column("TolerRed"); /// ???
Map(x => x.RedType); Map(x => x.RedType); /// ???
Map(x => x.FeedingPath); Map(x => x.FeedingPath);
Map(x => x.BenchPath); Map(x => x.BenchPath);
Map(x => x.OutputPath); Map(x => x.OutputPath);
@@ -55,14 +53,11 @@ namespace Config.Mappings
#if HEAT_METERS #if HEAT_METERS
Map(x => x.HeatMetersPath); Map(x => x.HeatMetersPath);
#endif #endif
Map(x => x.RelTransBefore) Map(x => x.RelTransBefore);
.Column("RelTransBefore"); Map(x => x.RelTransBetween);
Map(x => x.RelTransBetween) Map(x => x.RelTransAfter);
.Column("RelTransBetween"); Map(x => x.TransitionAfter);
Map(x => x.TransitionAfter) HasMany(x => x.MoreParams)
.Column("TransitionAfter");
HasMany(x => x.MoreParams)
.Cascade.All(); .Cascade.All();
References(x => x.Procedure); References(x => x.Procedure);
} }
-22
View File
@@ -1,22 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class UncertaintyMap : ClassMap<Uncertainty>
{
public UncertaintyMap()
{
Id(x => x.Id);
Map(x => x.Measurement);
Map(x => x.MainUncertainty);
Map(x => x.Resolution);
Map(x => x.DriftPerYr);
Map(x => x.Conditions);
Map(x => x.UncertaintyOfCorrection);
}
}
}
+3 -8
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2016-2020 Sensus Slovensko a.s. /// Copyright (c) 2013-2015 Sensus Metering Systems
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
@@ -12,16 +12,11 @@ namespace Config.Mappings
Id(x => x.Id); Id(x => x.Id);
Map(x => x.UserName).Column("Name"); Map(x => x.UserName).Column("Name");
Map(x => x.Number); Map(x => x.Number);
Map(x => x.Tag);
Map(x => x.Password); Map(x => x.Password);
Map(x => x.Password2);
Map(x => x.Password3);
Map(x => x.Password4);
Map(x => x.FullName).Column("Description"); Map(x => x.FullName).Column("Description");
Map(x => x.LastPwChange); Map(x => x.LastPwChange);
HasManyToMany(x => x.Groups) HasMany(x => x.Groups)
.Cascade.SaveUpdate() .Cascade.All();
.Table("UsersGroups");
} }
} }
} }
@@ -0,0 +1,22 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class VirtualBenchSequenceMap : ClassMap<VirtualBenchSequence>
{
public VirtualBenchSequenceMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Description);
HasMany(x => x.VirtualBenchSteps)
.OrderBy("ItemNr")
.Cascade.All();
}
}
}
+20
View File
@@ -0,0 +1,20 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class VirtualBenchStepMap : ClassMap<VirtualBenchStep>
{
public VirtualBenchStepMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Duration);
References(x => x.VirtualBenchSequence);
}
}
}
+20
View File
@@ -0,0 +1,20 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
namespace Config.Mappings
{
class WMTypeMap : ClassMap<Entities.WMType>
{
public WMTypeMap()
{
Id(x => x.Id);
Map(x => x.CreateTime);
Map(x => x.CreateUserName);
Map(x => x.CreateDescription);
Map(x => x.Name);
Map(x => x.PulseRate);
}
}
}
+19
View File
@@ -0,0 +1,19 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
namespace Config.Mappings
{
class WatermeterMap : ClassMap<Entities.Watermeter>
{
public WatermeterMap()
{
Id(x => x.Id);
Map(x => x.Serial);
// HasOne(x => x.WMType)
// .Cascade.All();
References(x => x.WMType);
}
}
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.25.1400.0")] [assembly: AssemblyVersion("2.18.1110.0")]
[assembly: AssemblyFileVersion("2.25.1400.0")] [assembly: AssemblyFileVersion("2.18.1110.0")]
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="Administrator" xml:space="preserve">
<value>Administrator</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Kalibriertechniker</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Laborleiter</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Wartungstechniker</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Messtechniker</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Prüfer</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Prüftechniker</value>
</data>
<data name="Failed" xml:space="preserve"> <data name="Failed" xml:space="preserve">
<value>NiO</value> <value>NiO</value>
</data> </data>
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="Administrator" xml:space="preserve">
<value>Amministratore</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>esperto in calibrazione</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>capo di laboratorio</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>esperto di manutenzione</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>metrologo</value>
</data>
<data name="Tester" xml:space="preserve">
<value>tester</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>esperto di prove </value>
</data>
<data name="Failed" xml:space="preserve"> <data name="Failed" xml:space="preserve">
<value>NOK</value> <value>NOK</value>
</data> </data>
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="Administrator" xml:space="preserve">
<value>Administrator</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Specjalista ds. kalibracji</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Kierownik Laboratorium</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Konserwator</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Metrolog</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Pracownik przeprowadzający testy</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Specjalista ds. testów</value>
</data>
<data name="Failed" xml:space="preserve"> <data name="Failed" xml:space="preserve">
<value>Niepowodzenie</value> <value>Niepowodzenie</value>
</data> </data>
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="Administrator" xml:space="preserve">
<value>Administrator</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Calibration Specialist</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Head of Lab</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Maintenance Specialist</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Metrologist</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Tester</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Testing Specialist</value>
</data>
<data name="Failed" xml:space="preserve"> <data name="Failed" xml:space="preserve">
<value>NOK</value> <value>NOK</value>
</data> </data>
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="Administrator" xml:space="preserve">
<value>Администратор</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Специалист по калибровке</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Руководитель лаборатории</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Специалист по техобслуживанию</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Метролог</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Контролер</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Специалист по тестированию</value>
</data>
<data name="Failed" xml:space="preserve"> <data name="Failed" xml:space="preserve">
<value>NOK</value> <value>NOK</value>
</data> </data>
+124 -125
View File
@@ -1,129 +1,128 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 Version 1.3
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter The primary goals of this format is to allow a simple XML format
: and then encoded with base64 encoding. that is mostly human readable. The generation and parsing of the
--> various data types are done through the TypeConverter classes
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> associated with the data types.
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> Example:
<xsd:complexType>
<xsd:choice maxOccurs="unbounded"> ... ado.net/XML headers & schema ...
<xsd:element name="metadata"> <resheader name="resmimetype">text/microsoft-resx</resheader>
<xsd:complexType> <resheader name="version">1.3</resheader>
<xsd:sequence> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
</xsd:sequence> <data name="Name1">this is my long string</data>
<xsd:attribute name="name" use="required" type="xsd:string" /> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<xsd:attribute name="type" type="xsd:string" /> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<xsd:attribute name="mimetype" type="xsd:string" /> [base64 mime encoded serialized .NET Framework object]
<xsd:attribute ref="xml:space" /> </data>
</xsd:complexType> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
</xsd:element> [base64 mime encoded string representing a byte array form of the .NET Framework object]
<xsd:element name="assembly"> </data>
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" /> There are any number of "resheader" rows that contain simple
<xsd:attribute name="name" type="xsd:string" /> name/value pairs.
</xsd:complexType>
</xsd:element> Each data row contains a name, and value. The row also contains a
<xsd:element name="data"> type or mimetype. Type corresponds to a .NET class that support
<xsd:complexType> text/value conversion through the TypeConverter architecture.
<xsd:sequence> Classes that don't support this are serialized and stored with the
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> mimetype set.
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> The mimetype is used for serialized objects, and tells the
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> ResXResourceReader how to depersist the object. This is currently not
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> extensible. For a given mimetype the value must be set accordingly:
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" /> Note - application/x-microsoft.net.object.binary.base64 is the format
</xsd:complexType> that the ResXResourceWriter will generate, however the reader can
</xsd:element> read any of the formats listed below.
<xsd:element name="resheader">
<xsd:complexType> mimetype: application/x-microsoft.net.object.binary.base64
<xsd:sequence> value : The object must be serialized with
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> : System.Serialization.Formatters.Binary.BinaryFormatter
</xsd:sequence> : and then encoded with base64 encoding.
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> mimetype: application/x-microsoft.net.object.soap.base64
</xsd:element> value : The object must be serialized with
</xsd:choice> : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
</xsd:complexType> : and then encoded with base64 encoding.
</xsd:element>
</xsd:schema> mimetype: application/x-microsoft.net.object.bytearray.base64
<resheader name="resmimetype"> value : The object must be serialized into a byte array
<value>text/microsoft-resx</value> : using a System.ComponentModel.TypeConverter
</resheader> : and then encoded with base64 encoding.
<resheader name="version"> -->
<value>2.0</value>
</resheader> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<resheader name="reader"> <xsd:element name="root" msdata:IsDataSet="true">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <xsd:complexType>
</resheader> <xsd:choice maxOccurs="unbounded">
<resheader name="writer"> <xsd:element name="data">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <xsd:complexType>
</resheader> <xsd:sequence>
<data name="Error" xml:space="preserve"> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<value>错误 Error</value> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</data> </xsd:sequence>
<data name="Failed" xml:space="preserve"> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<value>NOK</value> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
</data> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<data name="Passed" xml:space="preserve"> </xsd:complexType>
<value>好</value> </xsd:element>
</data> <xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Administrator" xml:space="preserve">
<value>管理员</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>校准专员</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>实验室负责人</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>维护专员</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>计量者</value>
</data>
<data name="Passed" xml:space="preserve">
<value>好</value>
</data>
<data name="Tester" xml:space="preserve">
<value>测试仪</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>测试专员</value>
</data>
</root> </root>
-170
View File
@@ -82,175 +82,5 @@ namespace Config
else return "F5"; else return "F5";
} }
} }
/// <summary>
/// Extract and return a DB server from a MySQL connection string.
/// </summary>
public static string GetDBServer(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "SERVER=" });
}
/// <summary>
/// Extract and return a DB name from a MySQL connection string.
/// </summary>
public static string GetDBName(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "DATABASE=" });
}
/// <summary>
/// Extract and return a username from a MySQL connection string
/// </summary>
public static string GetDBUser(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "USER=", "UID=" });
}
/// <summary>
/// Extract and return a password from a MySQL connection string
/// </summary>
public static string GetDBPassword(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "PASSWORD=", "PWD=" });
}
/// <summary>
/// Extract and return an element of a MySQL connection string
/// (a host, a database, a user name or a password).
/// Return an empty string on any error.
/// </summary>
public static string GetFromConnectionString(string connectionString, string[] patterns)
{
foreach (var pattern in patterns)
{
int startIx = connectionString.IndexOf(pattern);
if (startIx >= 0)
{
/// pattern found, extract the subsequent element
startIx += pattern.Length;
int endIx = connectionString.IndexOf(';', startIx);
return (endIx > 0) ? connectionString.Substring(startIx, endIx - startIx) : string.Empty;
}
}
/// pattern NOT found
return string.Empty;
}
/// <summary>
/// Get either Q1 or Qmin flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q1 or Qmin flow in m3/h</returns>
public static double GetQ1Qmin(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
int metroClassRatio;
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
{
return Qn / (double)metroClassRatio;
}
else
{
if (medium == Entities.Medium.HotWater)
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.04 * Qn);
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.02 * Qn);
case "D": return (Qn < 15) ? (0.01 * Qn) : Qdflt;
default: break;
}
}
else
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.03 * Qn);
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.006 * Qn);
default: break;
}
}
}
return Qdflt;
}
/// <summary>
/// Get either Q2 or Qt flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q2 or Qt flow in m3/h</returns>
public static double GetQ2Qt(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
int metroClassRatio;
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
{
return 1.6 * Qn / (double)metroClassRatio;
}
if (medium == Entities.Medium.HotWater)
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.2 * Qn);
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.15 * Qn);
case "C": return (Qn < 15) ? (0.06 * Qn) : (0.1 * Qn);
case "D": return (Qn < 15) ? (0.015 * Qn) : Qdflt;
default: break;
}
}
else
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.3 * Qn);
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.2 * Qn);
case "C": return (Qn < 15) ? (0.015 * Qn) : (0.015 * Qn);
default: break;
}
}
return Qdflt;
}
/// <summary>
/// Get either Q4 or Qmax flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q4 or Qmax flow in m3/h</returns>
public static double GetQ4Qmax(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
switch (metroClass[0])
{
case 'A':
case 'B':
case 'C':
case 'D':
return 2 * Qn;
case 'R':
return 1.25 * Qn;
default:
return Qdflt;
}
}
} }
} }
-66
View File
@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D476ABBE-A455-4476-8A8D-3F6151217B51}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Decrypt</RootNamespace>
<AssemblyName>Decrypt</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Decrypt.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<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>
<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>
-9
View File
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<StartArguments>config.xml</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<StartArguments>config.xml</StartArguments>
</PropertyGroup>
</Project>
-96
View File
@@ -1,96 +0,0 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Decrypt
{
/// <summary>
/// See also:
/// https://www.fluxbytes.com/csharp/encrypt-and-decrypt-files-in-c/
/// </summary>
class Program
{
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
static void Main(string[] args)
{
if ((args.Length < 1) || !File.Exists(args[0]))
{
Console.WriteLine("Usage: Decode <file>");
Console.ReadKey();
return;
}
string fileName = args[0];
string intermediateFile = fileName + ".plain"; /// Intermediate file, output of cryptography decoding
string backupFile = fileName + ".bak";
try
{
using (StreamReader reader = new StreamReader(fileName))
{
if (reader.ReadLine().StartsWith("<?xml version="))
{
Console.WriteLine(string.Format("File {0} is not encrypted.", fileName));
Console.ReadKey();
return;
}
}
bool successful = false;
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(fileName, FileMode.Open))
{
using (FileStream fsOut = new FileStream(intermediateFile, FileMode.Create))
{
using (ICryptoTransform decryptor = aes.CreateDecryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, decryptor, CryptoStreamMode.Read))
{
int data;
while ((data = cs.ReadByte()) != -1)
{
if (data != 0) fsOut.WriteByte((byte)data);
}
successful = true;
}
}
}
}
}
if (successful)
{
/// File decryption successfuly completed => rotate files
if (File.Exists(backupFile)) File.Delete(backupFile);
File.Move(fileName, backupFile);
File.Move(intermediateFile, fileName);
return;
}
else
{
Failed(fileName, intermediateFile, "");
return;
}
}
catch (Exception e)
{
Failed(fileName, intermediateFile, e.Message);
return;
}
}
static void Failed(string fileName, string toBeDeleted, string message)
{
if (File.Exists(toBeDeleted))
{
File.Delete(toBeDeleted);
}
Console.WriteLine(string.Format("Decryption of file {0} failed: {1}", fileName, message));
Console.ReadKey();
}
}
}
-36
View File
@@ -1,36 +0,0 @@
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("Decrypt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Decrypt")]
[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("c17ec788-0e12-4f9c-aadf-ea4e83a9f373")]
// 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.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
-3
View File
@@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
+1 -3
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DeviceTest</RootNamespace> <RootNamespace>DeviceTest</RootNamespace>
<AssemblyName>DeviceTest</AssemblyName> <AssemblyName>DeviceTest</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile> </TargetFrameworkProfile>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
@@ -24,7 +24,6 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
@@ -34,7 +33,6 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject>DeviceTest.Program</StartupObject> <StartupObject>DeviceTest.Program</StartupObject>
+13 -54
View File
@@ -7,6 +7,7 @@ using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using TBF.BenchControl; using TBF.BenchControl;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using System.Xml.Serialization; using System.Xml.Serialization;
@@ -26,11 +27,11 @@ namespace DeviceTest
IComponentCfg component2Cfg; IComponentCfg component2Cfg;
IComponentCfg component3Cfg; IComponentCfg component3Cfg;
static IList<IDevice> tbfDevices; static IList<TBF.BenchControl.Generic.IDevice> tbfDevices;
static IList<IComponent> tbfComponents; static IList<TBF.BenchControl.Generic.IComponent> tbfComponents;
static IComponent tbfComponent1forOp; static TBF.BenchControl.Generic.IComponent tbfComponent1forOp;
static IComponent tbfComponent2forOp; static TBF.BenchControl.Generic.IComponent tbfComponent2forOp;
static IComponent tbfComponent3forOp; static TBF.BenchControl.Generic.IComponent tbfComponent3forOp;
static Thread workerThread; static Thread workerThread;
static bool workerThreadRunning; static bool workerThreadRunning;
@@ -275,14 +276,7 @@ namespace DeviceTest
radioButton3.Text = "SelectTank 3"; radioButton3.Text = "SelectTank 3";
radioButton4.Text = "SelectTank -"; radioButton4.Text = "SelectTank -";
} }
else if (className == "Modbus.QuidoRS") else radioButton1.Text = "spare";
{
radioButton1.Text = "Close relay 1";
radioButton2.Text = "Close relay 2";
radioButton3.Text = "Close relay 3";
radioButton4.Text = "Open all relays";
}
else radioButton1.Text = "spare";
} }
/// ///
void UpdateOperations2(string className) void UpdateOperations2(string className)
@@ -302,14 +296,7 @@ namespace DeviceTest
radioButton23.Text = "SelectTank 3"; radioButton23.Text = "SelectTank 3";
radioButton24.Text = "SelectTank -"; radioButton24.Text = "SelectTank -";
} }
else if (className == "Modbus.QuidoRS") else radioButton21.Text = "spare";
{
radioButton21.Text = "Close relay 1";
radioButton22.Text = "Close relay 2";
radioButton23.Text = "Close relay 3";
radioButton24.Text = "Open all relays";
}
else radioButton21.Text = "spare";
} }
/// ///
void UpdateOperations3(string className) void UpdateOperations3(string className)
@@ -329,14 +316,7 @@ namespace DeviceTest
radioButton33.Text = "SelectTank 3"; radioButton33.Text = "SelectTank 3";
radioButton34.Text = "SelectTank -"; radioButton34.Text = "SelectTank -";
} }
else if (className == "Modbus.QuidoRS") else radioButton31.Text = "spare";
{
radioButton31.Text = "Close relay 1";
radioButton32.Text = "Close relay 2";
radioButton33.Text = "Close relay 3";
radioButton34.Text = "Open all relays";
}
else radioButton31.Text = "spare";
} }
@@ -425,7 +405,7 @@ namespace DeviceTest
cfgControl.Config = parentCfg; cfgControl.Config = parentCfg;
cfgControl.Config.ItemNr = 0; cfgControl.Config.ItemNr = 0;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(); TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
cfgForm.TbfComponents = new List<Config.Entities.Component>(); cfgForm.TbfComponents = new List<Config.Entities.Component>();
cfgForm.ComponentCfgCtrl = cfgControl; cfgForm.ComponentCfgCtrl = cfgControl;
@@ -454,7 +434,7 @@ namespace DeviceTest
cfgControl.Config = component1Cfg; cfgControl.Config = component1Cfg;
cfgControl.Config.ItemNr = 1; cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(); TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
/// ///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>(); IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity()); if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -488,7 +468,7 @@ namespace DeviceTest
cfgControl.Config = component2Cfg; cfgControl.Config = component2Cfg;
cfgControl.Config.ItemNr = 1; cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(); TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
/// ///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>(); IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity()); if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -523,7 +503,7 @@ namespace DeviceTest
cfgControl.Config = component3Cfg; cfgControl.Config = component3Cfg;
cfgControl.Config.ItemNr = 1; cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(); TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
/// ///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>(); IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity()); if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -692,13 +672,6 @@ namespace DeviceTest
//operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3); //operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0); //operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
} }
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation1 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation2 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation3 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation4 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent2forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter) if (tbfComponent2forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
@@ -731,13 +704,6 @@ namespace DeviceTest
//operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3); //operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0); //operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
} }
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation21 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation22 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation23 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation24 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent3forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter) if (tbfComponent3forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
@@ -770,13 +736,6 @@ namespace DeviceTest
//operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3); //operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0); //operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
} }
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
int time = 0; int time = 0;
+1 -1
View File
@@ -12,7 +12,7 @@ namespace DeviceTest.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+1 -1
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
+4 -7
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,10 +10,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Dirichlet.Numerics</RootNamespace> <RootNamespace>Dirichlet.Numerics</RootNamespace>
<AssemblyName>Dirichlet.Numerics</AssemblyName> <AssemblyName>Dirichlet.Numerics</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile> <TargetFrameworkProfile>Client</TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -23,7 +22,6 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -32,7 +30,6 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@@ -51,4 +48,4 @@
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
</Project> </Project>
-66
View File
@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DA9B09F3-A99D-4883-A954-537560453674}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Encrypt</RootNamespace>
<AssemblyName>Encrypt</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Encrypt.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<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>
<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>
-93
View File
@@ -1,93 +0,0 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Encrypt
{
/// <summary>
/// See also:
/// https://www.fluxbytes.com/csharp/encrypt-and-decrypt-files-in-c/
/// </summary>
class Program
{
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
static void Main(string[] args)
{
if ((args.Length < 1) || !File.Exists(args[0]))
{
Console.WriteLine("Usage: Encode <file>");
Console.ReadKey();
return;
}
string fileName = args[0];
string intermediateFile = fileName + ".encrypted"; /// Intermediate file, output of cryptography encoding
string backupFile = fileName + ".bak";
try
{
using (StreamReader reader = new StreamReader(fileName))
{
if (!reader.ReadLine().StartsWith("<?xml version="))
{
Console.WriteLine(string.Format("File {0} is already encrypted.", fileName));
Console.ReadKey();
return;
}
}
bool successful = false;
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(intermediateFile, FileMode.Create))
{
using (ICryptoTransform encryptor = aes.CreateEncryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, encryptor, CryptoStreamMode.Write))
{
using (FileStream fsIn = new FileStream(fileName, FileMode.Open))
{
int data;
while ((data = fsIn.ReadByte()) != -1) cs.WriteByte((byte)data);
successful = true;
}
}
}
}
}
if (successful)
{
/// File encryption successfuly completed => rotate files
if (File.Exists(backupFile)) File.Delete(backupFile);
File.Move(fileName, backupFile);
File.Move(intermediateFile, fileName);
return;
}
else
{
Failed(fileName, intermediateFile);
return;
}
}
catch (Exception)
{
Failed(fileName, intermediateFile);
return;
}
}
static void Failed(string fileName, string toBeDeleted)
{
if (File.Exists(toBeDeleted))
{
File.Delete(toBeDeleted);
}
Console.WriteLine(string.Format("Encryption of file {0} failed.", fileName));
Console.ReadKey();
}
}
}
-36
View File
@@ -1,36 +0,0 @@
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("Encrypt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Encrypt")]
[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("0f602531-6f1f-416e-af4d-9242855715a8")]
// 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")]
-3
View File
@@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
+1 -5
View File
@@ -28,7 +28,7 @@
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
@@ -66,7 +66,6 @@
<RemoveIntegerChecks>false</RemoveIntegerChecks> <RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
@@ -88,7 +87,6 @@
<RemoveIntegerChecks>false</RemoveIntegerChecks> <RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -101,7 +99,6 @@
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets> <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules> <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules> <CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath> <OutputPath>bin\x86\Release\</OutputPath>
@@ -113,7 +110,6 @@
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets> <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System"> <Reference Include="System">
+1 -4
View File
@@ -10,13 +10,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ClassLibrary1</RootNamespace> <RootNamespace>ClassLibrary1</RootNamespace>
<AssemblyName>GraphLib</AssemblyName> <AssemblyName>GraphLib</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion> <OldToolsVersion>2.0</OldToolsVersion>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -26,7 +25,6 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -35,7 +33,6 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
+12 -12
View File
@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // Dieser Code wurde von einem Tool generiert.
// Runtime Version:4.0.30319.42000 // Laufzeitversion:4.0.30319.18408
// //
// Changes to this file may cause incorrect behavior and will be lost if // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// the code is regenerated. // der Code erneut generiert wird.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -13,12 +13,12 @@ namespace ClassLibrary1.Properties {
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary> /// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// class via a tool like ResGen or Visual Studio. // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// To add or remove a member, edit your .ResX file then rerun ResGen // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// with the /str option, or rebuild your VS project. // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
@@ -33,7 +33,7 @@ namespace ClassLibrary1.Properties {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
@@ -47,8 +47,8 @@ namespace ClassLibrary1.Properties {
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// resource lookups using this strongly typed resource class. /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {
-198
View File
@@ -1,198 +0,0 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace RestClient
{
public class BaseClient
{
private string _token;
private string _baseUrl;
public string ErrorMessage { get; set; }
private readonly HttpClient client;
private AuthenticationHeaderValue _authValue;
public BaseClient(string baseUrl)
{
this._baseUrl = baseUrl;
}
public void SetToken(string token)
{
_authValue = new AuthenticationHeaderValue("Bearer", token);
}
protected Uri GetUrl(string relativeUrl)
{
try
{
return new Uri(_baseUrl + relativeUrl);
}
catch (Exception)
{
Trace.TraceError("Invalid url " + relativeUrl);
return null;
}
}
protected async Task<TResult> GetResultAsync<TResult>(string relativeUrl)
{
ErrorMessage = String.Empty;
Uri url = null;
try
{
url = new Uri(_baseUrl + relativeUrl);
}
catch (Exception)
{
Trace.TraceError("Invalid url " + relativeUrl);
return default(TResult);
}
using (var client = GetClient())
{
try
{
var result = await client.GetAsync(url).ConfigureAwait(false);
var parsedResult = await result.Content.ReadAsStringAsync().ConfigureAwait(false);
if (result.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<TResult>(parsedResult);
}
if (result.StatusCode == System.Net.HttpStatusCode.NotFound)
{
//Create not an error message, because communication is okay, only the meter is not available in database.
return default(TResult);
}
try
{
string Messages = await result.Content.ReadAsStringAsync();
var errors = JsonConvert.DeserializeObject<Dictionary<string, object>>(Messages);
string ServiceError = String.Empty;
if (errors != null)
{
ServiceError = errors["Message"].ToString();
}
ErrorMessage = string.Format("Error message: {0}", ServiceError);
}
catch
{
result.EnsureSuccessStatusCode();
}
return default(TResult);
}
catch (Exception ex)
{
string Message = ex.Message;
if (ex.InnerException != null)
{
Message += ". " + ex.InnerException.Message;
}
Trace.TraceError(Message);
ErrorMessage = Message;
return default(TResult);
}
}
}
/// <summary>
/// Post method.
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <param name="relativeUrl"></param>
/// <param name="Position"></param>
/// /// <param name="withBaseUrl"></param>
/// <returns>The new resource</returns>
protected async Task<string> PostWithReturnDataAsync<TResult>(string relativeUrl, bool withBaseUrl, TResult Position)
{
string data = string.Empty;
ErrorMessage = String.Empty;
Uri url = null;
try
{
if (withBaseUrl)
{
url = new Uri(_baseUrl + relativeUrl);
}
else
{
url = new Uri(relativeUrl);
}
}
catch (Exception ex)
{
Trace.TraceError("Invalid url " + url);
ErrorMessage = ex.Message;
return data;
}
using (var client = GetClient())
{
try
{
string json = JsonConvert.SerializeObject(Position);
HttpContent content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url.ToString(), content).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
data = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
return data;
}
else
{
if (response.StatusCode == HttpStatusCode.NotFound)
{
ErrorMessage = String.Format("Status code: {0}. Url: {1}", response.StatusCode, url);
}
else
{
string errorMessageService = string.Empty;
string message = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
if (string.IsNullOrEmpty(message))
{
errorMessageService = response.ReasonPhrase;
}
else
{
try
{
var errors = JsonConvert.DeserializeObject<Dictionary<string, object>>(message);
errorMessageService = errors["Message"].ToString();
}
catch (Exception)
{
errorMessageService = message;
}
}
ErrorMessage = String.Format("Status code: {0}. Error message: {1}", response.StatusCode, errorMessageService);
}
return data;
}
}
catch (Exception ex)
{
Trace.TraceError(ex.Message);
ErrorMessage = ex.Message;
return data;
}
}
}
protected HttpClient GetClient()
{
HttpClientHandler handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
HttpClient client = new HttpClient(handler);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Authorization = _authValue;
return client;
}
}
}
-82
View File
@@ -1,82 +0,0 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RestClient.Models;
namespace RestClient
{
public class GetQ2PreCorrectionClient : BaseClient
{
public GetQ2PreCorrectionClient(string baseUrl)
: base(baseUrl)
{ }
public async Task GetToken(string name, string password, string urlLogin)
{
LoginUser user = new LoginUser { Name = name, Password = password };
var response = await PostWithReturnDataAsync(urlLogin, false, user).ConfigureAwait(false);
var tmp = JsonConvert.DeserializeObject<CustomJwt>(response);
if (tmp != null)
{
SetToken(tmp.access_token);
}
else
{
throw new Exception(string.Format("No token loaded: {0}", ErrorMessage));
}
}
public async Task<Q2PreCorrection> GetQ2Correction(string relativeUrl)
{
ErrorMessage = String.Empty;
Uri url = GetUrl(relativeUrl);
if (url == null) return new Q2PreCorrection { AreDataCalculated = false, CorrLR = 0, CorrRL = 0, };
using (var client = GetClient())
{
try
{
var result = await client.GetAsync(url).ConfigureAwait(false);
string jsonResult = await result.Content.ReadAsStringAsync().ConfigureAwait(false);
if (result.IsSuccessStatusCode)
{
Q2PreCorrection retVal = new Q2PreCorrection();
string pattern = "\"areDataCalculated\":";
int position = jsonResult.IndexOf(pattern) + pattern.Length;
int length = jsonResult.Substring(position).IndexOfAny(new char[] { ',', '}', '\r', '\n' });
retVal.AreDataCalculated = bool.Parse(jsonResult.Substring(position, length));
pattern = "\"right\":";
position = jsonResult.IndexOf(pattern) + pattern.Length;
length = jsonResult.Substring(position).IndexOfAny(new char[] { ',', '}', '\r', '\n' });
retVal.CorrLR = int.Parse(jsonResult.Substring(position, length));
pattern = "\"left\":";
position = jsonResult.IndexOf(pattern) + pattern.Length;
length = jsonResult.Substring(position).IndexOfAny(new char[] { ',', '}', '\r', '\n' });
retVal.CorrRL = int.Parse(jsonResult.Substring(position, length));
return retVal;
}
else
{
return new Q2PreCorrection { AreDataCalculated = false, CorrLR = 0, CorrRL = 0, };
}
}
catch (Exception ex)
{
string Message = ex.Message;
if (ex.InnerException != null)
{
Message += ". " + ex.InnerException.Message;
}
Trace.TraceError(Message);
ErrorMessage = Message;
return new Q2PreCorrection { AreDataCalculated = false, CorrLR = 0, CorrRL = 0, };
}
}
}
}
}
-13
View File
@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace RestClient.Models
{
public class CustomJwt
{
public string access_token { get; set; }
public string token_type { get; set; }
public int expires_in { get; set; }
}
}
-12
View File
@@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace RestClient.Models
{
public class LoginUser
{
public string Name { get; set; }
public string Password { get; set; }
}
}
-36
View File
@@ -1,36 +0,0 @@
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("RestClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RestClient")]
[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("46e3b0e1-209f-4550-b0dd-d7e2c039b3ce")]
// 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")]
-11
View File
@@ -1,11 +0,0 @@
using System;
namespace RestClient
{
public class Q2PreCorrection
{
public bool AreDataCalculated;
public int CorrLR;
public int CorrRL;
}
}
-59
View File
@@ -1,59 +0,0 @@
<?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>{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RestClient</RootNamespace>
<AssemblyName>RestClient</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseClient.cs" />
<Compile Include="GetQ2PreCorrectionClient.cs" />
<Compile Include="Models\CustomJwt.cs" />
<Compile Include="Models\LoginUser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Q2PreCorrection.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
</packages>
+108 -107
View File
@@ -1,43 +1,32 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Results.Entities; using Results.Entities;
namespace Results namespace Results
{ {
public class BatchResults public class BatchResults
{ {
public Batch Batch; public readonly int WMPositionsCount;
public int WMPositionsCount;
public IList<Entities.TestData> TestDataList; public IList<Entities.TestData> TestDataList;
public IList<Entities.Components> ComponentsList; public IList<Entities.Components> ComponentsList;
public IList<Entities.WaterMeterData> WaterMeterDataList; public IList<Entities.WaterMeterData> WaterMeterDataList;
/// <summary>
/// Parameterless constructor required for serialization
/// </summary>
public BatchResults()
{
TestDataList = new List<Entities.TestData>();
ComponentsList = new List<Entities.Components>();
WaterMeterDataList = new List<Entities.WaterMeterData>();
}
/// <summary>
/// Constructor invoked by static BatchResults NewFromProcedure(...)
/// </summary>
/// <param name="wmPositionsCount">Watermeters count</param>
private BatchResults(int wmPositionsCount) private BatchResults(int wmPositionsCount)
: this()
{ {
WMPositionsCount = wmPositionsCount; WMPositionsCount = wmPositionsCount;
TestDataList = new List<Entities.TestData>();
ComponentsList = new List<Entities.Components>();
WaterMeterDataList = new List<Entities.WaterMeterData>();
} }
public Batch Batch;
public WaterMeter[] WaterMeters;
public static BatchResults NewFromProcedure(int batchNr, int benchId, string benchName, string a1, string a2, string a3, string a4, string a5, public static BatchResults NewFromProcedure(int batchNr, int benchId, string benchName, string a1, string a2, string a3, string a4, string a5,
string user, int userNr, string programVer, Config.Entities.Procedure procedure, string user, int userNr, string programVer, Config.Entities.Procedure procedure,
WaterMeterData[] waterMeterDatas, int[] waterMeterParts, double densityCorr) WaterMeterData[] waterMeterDatas, int[] waterMeterParts, double densityCorr)
@@ -49,7 +38,6 @@ namespace Results
d.Batch = new Batch() d.Batch = new Batch()
{ {
BatchNr = batchNr, BatchNr = batchNr,
ProgramVersion = programVer,
TestBenchId = benchId, TestBenchId = benchId,
TestBenchName = benchName, TestBenchName = benchName,
Address1 = a1, Address1 = a1,
@@ -57,6 +45,7 @@ namespace Results
Address3 = a3, Address3 = a3,
Address4 = a4, Address4 = a4,
Address5 = a5, Address5 = a5,
ProgramVersion = programVer,
UserName = user, UserName = user,
UserNumber = userNr, UserNumber = userNr,
ProcedureName = procedure.Name, ProcedureName = procedure.Name,
@@ -76,64 +65,62 @@ namespace Results
/// Add watermeter to an array, array index is WM position. /// Add watermeter to an array, array index is WM position.
/// AddWaterMetersToBatch() has to be used before saving results. /// AddWaterMetersToBatch() has to be used before saving results.
/// ///
for (int wmPos0 = 0; wmPos0 < d.WMPositionsCount; wmPos0++) d.WaterMeters = new WaterMeter[d.WMPositionsCount];
for (int i = 0; i < d.WMPositionsCount; i++)
{ {
if (waterMeterDatas[wmPos0] == null) if (waterMeterDatas[i] == null) continue;
{ WaterMeterData wmd = WaterMeterData.UpdateList(d.WaterMeterDataList, waterMeterDatas[i]);
d.Batch.WaterMeters.Add(new WaterMeter() { Batch = d.Batch, d.WaterMeters[i] = new WaterMeter()
WaterMeterData = null, {
WMPosition = wmPos0 + 1, Batch = d.Batch,
YearOfProduction = year, WaterMeterData = wmd,
Disabled = true, }); WMPosition = i + 1,
} YearOfProduction = year,
else };
{
WaterMeterData wmd = WaterMeterData.UpdateList(d.WaterMeterDataList, waterMeterDatas[wmPos0]);
d.Batch.WaterMeters.Add(new WaterMeter() { Batch = d.Batch,
WaterMeterData = wmd,
WMPosition = wmPos0 + 1,
YearOfProduction = year, });
}
} }
foreach (var t in procedure.Tests) foreach (var t in procedure.Tests)
{ {
TestData td = TestData.UpdateList(d.TestDataList, new TestData(t)); if (t.Publish != (byte)Config.Entities.Publish.Never)
for (int rnr = 1; rnr <= t.Repeats; rnr++)
{ {
/// Create an empty test result and add it to the list TestData td = TestData.UpdateList(d.TestDataList, new TestData(t));
TestRslt tr = new TestRslt(d.Batch, td, t.Part, rnr);
d.Batch.TestRslts.Add(tr);
for (int i = 0; i < d.WMPositionsCount; i++) for (int rnr = 1; rnr <= t.Repeats; rnr++)
{ {
if (!d.Batch.WaterMeters[i].Disabled && t.IsPartCompatible(waterMeterParts[i])) /// Create an empty test result and add it to the list
{ TestRslt tr = new TestRslt(d.Batch, td, t.Part, rnr);
/// d.Batch.TestRslts.Add(tr);
/// Create empty watermeter test results and add them to the list and to dictionaries
/// for (int i = 0; i < d.WMPositionsCount; i++)
IList<MeterTestRslt> wmtrs = d.Batch.WaterMeters[i].MeterTestRslts; {
if (d.Batch.Compound) if (d.WaterMeters[i] == null) continue;
{
/// Compound water meter if (!t.IsPartCompatible(waterMeterParts[i])) continue;
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundMain));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundAux)); ///
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Compound)); /// Create empty watermeter test results and add them to the list and to dictionaries
} ///
else if (d.Batch.HeatMeter) IList<MeterTestRslt> wmtrs = d.WaterMeters[i].MeterTestRslts;
{ if (d.Batch.Compound)
/// Heat meter {
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterVolume)); /// Compound water meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterEnergy)); wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundMain));
} wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundAux));
else wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Compound));
{ }
/// Water meter else if (d.Batch.HeatMeter)
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Single)); {
} /// Heat meter
} wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterVolume));
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterEnergy));
}
else
{
/// Water meter
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Single));
}
}
} }
} }
} }
@@ -143,25 +130,13 @@ namespace Results
public static BatchResults FromBatch(Batch batch) public static BatchResults FromBatch(Batch batch)
{ {
if (batch.WaterMeters == null || batch.WaterMeters.Count == 0) return null; int wmCount = batch.WaterMeters.Count;
if (wmCount == 0) return null;
int wmPosMax = 0; BatchResults batchResults = new BatchResults(wmCount);
foreach (var wm in batch.WaterMeters) if (wm.WMPosition > wmPosMax) wmPosMax = wm.WMPosition;
BatchResults batchResults = new BatchResults(wmPosMax);
batchResults.Batch = batch; batchResults.Batch = batch;
/// Insert missing disabled water meters batchResults.WaterMeters = new WaterMeter[wmCount];
for (int wmNr0 = 0; wmNr0 < wmPosMax; wmNr0++) for (int i = 0; i < wmCount; i++) batchResults.WaterMeters[i] = batch.WaterMeters[i];
{
if (batch.WaterMeters[wmNr0].WMPosition > wmNr0 + 1)
{
batch.WaterMeters.Insert(wmNr0, new WaterMeter() { Batch = batch,
WaterMeterData = null,
WMPosition = wmNr0 + 1,
YearOfProduction = 0,
Disabled = true, });
}
}
return batchResults; return batchResults;
} }
@@ -171,11 +146,11 @@ namespace Results
return Batch.GetTestRslt(name, part); return Batch.GetTestRslt(name, part);
} }
public MeterTestRslt GetMeterTestRslt(string name, int wmNr0, Config.Entities.CompoundMeterId meterId) public MeterTestRslt GetMeterTestRslt(string name, int wmnr0, Config.Entities.CompoundMeterId meterId)
{ {
if (Batch.WaterMeters != null && Batch.WaterMeters.Count > wmNr0 && !Batch.WaterMeters[wmNr0].Disabled) if (WaterMeters[wmnr0] != null)
{ {
return Batch.WaterMeters[wmNr0].GetMeterTestRslt(name, meterId); return WaterMeters[wmnr0].GetMeterTestRslt(name, meterId);
} }
return null; return null;
} }
@@ -187,13 +162,13 @@ namespace Results
/// <returns>true = all tests done</returns> /// <returns>true = all tests done</returns>
public bool AllTestsDone() public bool AllTestsDone()
{ {
for (int wmNr0 = 0; wmNr0 < WMPositionsCount; wmNr0++) for (int i = 0; i < WMPositionsCount; i++)
{ {
if (Batch.WaterMeters != null && Batch.WaterMeters.Count > wmNr0 && !Batch.WaterMeters[wmNr0].Disabled) if (WaterMeters[i] != null)
{ {
foreach (var mtr in Batch.WaterMeters[wmNr0].MeterTestRslts) foreach (var mtr in WaterMeters[i].MeterTestRslts)
{ {
if (mtr.Evaluate() && !mtr.TestDone) return false; if (!mtr.TestDone) return false;
} }
} }
} }
@@ -201,17 +176,43 @@ namespace Results
} }
public virtual void WriteBinary(BinaryWriter writer) /// <summary>
{ /// Adds non-null water meters from an array to a Batch water meters list.
Batch.WriteBinary(writer); /// This method should be used when results are prepared and
writer.Write(WMPositionsCount); /// all disabled water meters are deleted.
} /// </summary>
public void AddWaterMetersToBatch()
{
for (int i = 0; i < WMPositionsCount; i++)
{
if (WaterMeters[i] != null)
{
WaterMeters[i].Passed = WaterMeters[i].PassedFromTests();
if (!WaterMeters[i].Disabled)
{
Batch.WaterMeters.Add(WaterMeters[i]);
}
}
}
}
public virtual void ReadBinary(BinaryReader reader)
public bool IsProduction()
{ {
Batch = new Batch(); for (int i = 0; i < WMPositionsCount; i++)
Batch.ReadBinary(reader); {
WMPositionsCount = reader.ReadInt32(); if (WaterMeters[i] != null)
{
foreach (var mtr in WaterMeters[i].MeterTestRslts)
{
if (mtr.TestData().Name.ToLower().Contains("adj") || mtr.TestData().Name.ToLower().Contains("just"))
{
return true;
}
}
}
}
return false;
} }
} }
} }
+12 -162
View File
@@ -1,28 +1,26 @@
/// ///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s. /// Copyright (c) 2015-2016 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
namespace Results.Entities namespace Results.Entities
{ {
public class Batch public class Batch
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual int BatchNr { get; set; } public virtual int BatchNr { get; set; }
public virtual string ProgramVersion { get; set; } public virtual int TestBenchId { get; set; }
public virtual int TestBenchId { get; set; }
public virtual string TestBenchName { get; set; } /// CEVAK, not mapped to DB public virtual string TestBenchName { get; set; } /// CEVAK, not mapped to DB
public virtual string Address1 { get; set; } /// CEVAK, not mapped to DB public virtual string Address1 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address2 { get; set; } /// CEVAK, not mapped to DB public virtual string Address2 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address3 { get; set; } /// CEVAK, not mapped to DB public virtual string Address3 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address4 { get; set; } /// CEVAK, not mapped to DB public virtual string Address4 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address5 { get; set; } /// CEVAK, not mapped to DB public virtual string Address5 { get; set; } /// CEVAK, not mapped to DB
public virtual string ProgramVersion { get; set; }
public virtual string UserName { get; set; } public virtual string UserName { get; set; }
public virtual int UserNumber { get; set; } public virtual int UserNumber { get; set; }
public virtual string ProcedureName { get; set; } public virtual string ProcedureName { get; set; }
public virtual bool IsRemoteProcedure { get; set; } /// Stara Tura, not mapped to DB
public virtual string ProcedureDescription { get; set; } /// CEVAK, not mapped to DB public virtual string ProcedureDescription { get; set; } /// CEVAK, not mapped to DB
public virtual int ProcedureRevision { get; set; } public virtual int ProcedureRevision { get; set; }
public virtual string WatermetersStr { get; set; } /// CEVAK, not mapped to DB public virtual string WatermetersStr { get; set; } /// CEVAK, not mapped to DB
@@ -31,12 +29,7 @@ namespace Results.Entities
public virtual float DensityCorr { get; set; } /// Density correction in [kg/m3] public virtual float DensityCorr { get; set; } /// Density correction in [kg/m3]
public virtual float Custom2 { get; set; } public virtual float Custom2 { get; set; }
public virtual float Custom3 { get; set; } public virtual float Custom3 { get; set; }
public virtual int Counter6 { get; set; } public virtual DateTime StartTime { get; set; }
public virtual int Counter7 { get; set; }
public virtual int Counter8 { get; set; }
public virtual int Counter9 { get; set; }
public virtual int Counter10 { get; set; }
public virtual DateTime StartTime { get; set; }
public virtual DateTime EndTime { get; set; } public virtual DateTime EndTime { get; set; }
public virtual bool Dirty { get; set; } public virtual bool Dirty { get; set; }
public virtual bool RsltsSent { get; set; } public virtual bool RsltsSent { get; set; }
@@ -45,29 +38,13 @@ namespace Results.Entities
public virtual IList<WaterMeter> WaterMeters { get; set; } public virtual IList<WaterMeter> WaterMeters { get; set; }
public virtual IList<TestRslt> TestRslts { get; set; } public virtual IList<TestRslt> TestRslts { get; set; }
public virtual bool Compound { get; set; } /// Not mapped to DB now public virtual bool Compound { get; set; } /// Not mapped to DB now
public virtual bool HeatMeter { get; set; } /// Not mapped to DB now /// public virtual bool HeatMeter { get; set; } /// Not mapped to DB now
public Batch() public Batch()
{ {
Tests = new List<TestData>(); Tests = new List<TestData>();
WaterMeters = new List<WaterMeter>(); WaterMeters = new List<WaterMeter>();
TestRslts = new List<TestRslt>(); TestRslts = new List<TestRslt>();
ProgramVersion = string.Empty;
TestBenchName = string.Empty;
Address1 = string.Empty;
Address2 = string.Empty;
Address3 = string.Empty;
Address4 = string.Empty;
Address5 = string.Empty;
UserName = string.Empty;
ProcedureName = string.Empty;
IsRemoteProcedure = false;
ProcedureDescription = string.Empty;
WatermetersStr = string.Empty;
ProtocolTitle = string.Empty;
ProtocolTitle = string.Empty;
Remark = string.Empty;
} }
public virtual int PassedMetersCount() public virtual int PassedMetersCount()
@@ -226,138 +203,11 @@ namespace Results.Entities
public virtual string ToString(int i) public virtual string ToString(int i)
{ {
return string.Format("Batch: BatchNr={0} ProgramVersion={1} TestBenchId={2} UserName={3} UserNumber={4} ProcedureName={5}{6} ProcRev={7} ProtocolTitle={8} Remark={9} DensityCorr={10} Custom2={11} Custom3={12} StartTime={13} EndTime={14} Dirty={15} RsltsSent={16} RsltsPrinted={17}", return string.Format("Batch: BatchNr={0} TestBenchId={1} ProgramVersion={2} UserName={3} UserNumber={4} ProcedureName={5} ProcedureRevision={6} ProtocolTitle={7} Remark={8} DensityCorr={9} Custom2={10} Custom3={11} StartTime={12} EndTime={13} Dirty={14} RsltsSent={15} RsltsPrinted={16}",
BatchNr, ProgramVersion, TestBenchId, UserName, UserNumber, BatchNr, TestBenchId, ProgramVersion, UserName, UserNumber,
ProcedureName, (IsRemoteProcedure ? "(R)" : ""), ProcedureRevision, ProcedureName, ProcedureRevision, ProtocolTitle, Remark, DensityCorr,
ProtocolTitle, Remark, DensityCorr, Custom2, Custom3, Custom2, Custom3, StartTime, EndTime, Dirty,
StartTime, EndTime, Dirty, RsltsSent, RsltsPrinted); RsltsSent, RsltsPrinted);
} }
}
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(BatchNr);
writer.Write((ProgramVersion != null) ? ProgramVersion : string.Empty);
writer.Write((ProcedureName != null) ? ProcedureName : string.Empty);
writer.Write(IsRemoteProcedure);
writer.Write(Id);
writer.Write(TestBenchId);
writer.Write((TestBenchName != null) ? TestBenchName : string.Empty);
writer.Write((Address1 != null) ? Address1 : string.Empty);
writer.Write((Address2 != null) ? Address2 : string.Empty);
writer.Write((Address3 != null) ? Address3 : string.Empty);
writer.Write((Address4 != null) ? Address4 : string.Empty);
writer.Write((Address5 != null) ? Address5 : string.Empty);
writer.Write((UserName != null) ? UserName : string.Empty);
writer.Write(UserNumber);
writer.Write((ProcedureDescription != null) ? ProcedureDescription : string.Empty);
writer.Write(ProcedureRevision);
writer.Write((WatermetersStr != null) ? WatermetersStr : string.Empty);
writer.Write((ProtocolTitle != null) ? ProtocolTitle : string.Empty);
writer.Write((Remark != null) ? Remark : string.Empty);
writer.Write(DensityCorr);
writer.Write(Custom2);
writer.Write(Custom3);
writer.Write(Counter6);
writer.Write(Counter7);
writer.Write(Counter8);
writer.Write(Counter9);
writer.Write(Counter10);
writer.Write(StartTime.ToString());
writer.Write(EndTime.ToString());
writer.Write(Dirty);
writer.Write(RsltsSent);
writer.Write(RsltsPrinted);
writer.Write(Compound);
writer.Write(HeatMeter);
IList<TestData> savedTestDatas = new List<TestData>(); /// Initially empty
writer.Write(TestRslts.Count);
for (int i = 0; i < TestRslts.Count; i++)
{
TestRslts[i].WriteBinary(writer, savedTestDatas);
}
IList<WaterMeterData> savedWMDatas = new List<WaterMeterData>(); /// Initially empty
writer.Write(WaterMeters.Count);
for (int i = 0; i < WaterMeters.Count; i++)
{
WaterMeters[i].WriteBinary(writer, savedWMDatas);
}
}
public static void ReadStart(BinaryReader reader, out int batchNr, out string programVersion, out string procedureName, out bool isRemoteProcedure)
{
batchNr = reader.ReadInt32();
programVersion = reader.ReadString();
procedureName = reader.ReadString();
isRemoteProcedure = reader.ReadBoolean();
}
public virtual void ReadBinary(BinaryReader reader)
{
/// ReadStart() is used to avoid code repetition
int batchNr;
string programVersion;
string procedureName;
bool isRemoteProcedure;
ReadStart(reader, out batchNr, out programVersion, out procedureName, out isRemoteProcedure);
BatchNr = batchNr;
ProgramVersion = programVersion;
ProcedureName = procedureName;
IsRemoteProcedure = isRemoteProcedure;
Id = reader.ReadInt32();
TestBenchId = reader.ReadInt32();
TestBenchName = reader.ReadString();
Address1 = reader.ReadString();
Address2 = reader.ReadString();
Address3 = reader.ReadString();
Address4 = reader.ReadString();
Address5 = reader.ReadString();
UserName = reader.ReadString();
UserNumber = reader.ReadInt32();
ProcedureDescription = reader.ReadString();
ProcedureRevision = reader.ReadInt32();
WatermetersStr = reader.ReadString();
ProtocolTitle = reader.ReadString();
Remark = reader.ReadString();
DensityCorr = reader.ReadInt32();
Custom2 = reader.ReadInt32();
Custom3 = reader.ReadInt32();
Counter6 = reader.ReadInt32();
Counter7 = reader.ReadInt32();
Counter8 = reader.ReadInt32();
Counter9 = reader.ReadInt32();
Counter10 = reader.ReadInt32();
StartTime = DateTime.Parse(reader.ReadString());
EndTime = DateTime.Parse(reader.ReadString());
Dirty = reader.ReadBoolean();
RsltsSent = reader.ReadBoolean();
RsltsPrinted = reader.ReadBoolean();
Compound = reader.ReadBoolean();
HeatMeter = reader.ReadBoolean();
Tests = new List<TestData>(); /// Initially empty
int testRsltsCount = reader.ReadInt32();
TestRslts = new List<TestRslt>();
for (int i = 0; i < testRsltsCount; i++)
{
TestRslts.Add(new TestRslt());
TestRslts[i].ReadBinary(reader, Tests);
TestRslts[i].Batch = this;
}
IList<WaterMeterData> wmDatasRetirevedSoFar = new List<WaterMeterData>(); /// Initially empty
int waterMetersCount = reader.ReadInt32();
WaterMeters = new List<WaterMeter>();
for (int i = 0; i < waterMetersCount; i++)
{
WaterMeters.Add(new WaterMeter());
WaterMeters[i].ReadBinary(reader, wmDatasRetirevedSoFar, TestRslts);
WaterMeters[i].Batch = this;
}
}
}
} }
+6 -37
View File
@@ -1,17 +1,16 @@
/// ///
/// Copyright (c) 2016-2020 Sensus Slovensko a.s. /// Copyright (c) 2016 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.IO;
namespace Results.Entities namespace Results.Entities
{ {
public class Components public class Components
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual int TestBenchId { get; set; } public virtual int TestBenchId { get; set; }
public virtual string TestBenchName { get; set; } public virtual string TestBenchName { get; set; }
public virtual string Pump { get; set; } public virtual string Pump { get; set; }
public virtual string RegValve { get; set; } public virtual string RegValve { get; set; }
@@ -22,7 +21,7 @@ namespace Results.Entities
public virtual string Custom2 { get; set; } public virtual string Custom2 { get; set; }
public virtual string Custom3 { get; set; } public virtual string Custom3 { get; set; }
public Components() protected Components()
{ {
TestBenchId = 0; TestBenchId = 0;
TestBenchName = string.Empty; TestBenchName = string.Empty;
@@ -91,35 +90,5 @@ namespace Results.Entities
list.Add(item); /// Item not fund in the list, it is added to the list list.Add(item); /// Item not fund in the list, it is added to the list
return item; return item;
} }
}
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(Id);
writer.Write(TestBenchId);
writer.Write((TestBenchName != null) ? TestBenchName : string.Empty);
writer.Write((Pump != null) ? Pump : string.Empty);
writer.Write((RegValve != null) ? RegValve : string.Empty);
writer.Write((Flowmeter != null) ? Flowmeter : string.Empty);
writer.Write((Diverter != null) ? Diverter : string.Empty);
writer.Write((Scale != null) ? Scale : string.Empty);
writer.Write((Custom1 != null) ? Custom1 : string.Empty);
writer.Write((Custom2 != null) ? Custom2 : string.Empty);
writer.Write((Custom3 != null) ? Custom3 : string.Empty);
}
public virtual void ReadBinary(BinaryReader reader)
{
Id = reader.ReadInt32();
TestBenchId = reader.ReadInt32();
TestBenchName = reader.ReadString();
Pump = reader.ReadString();
RegValve = reader.ReadString();
Flowmeter = reader.ReadString();
Diverter = reader.ReadString();
Scale = reader.ReadString();
Custom1 = reader.ReadString();
Custom2 = reader.ReadString();
Custom3 = reader.ReadString();
}
}
} }
+6 -82
View File
@@ -1,17 +1,16 @@
/// ///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic;
using System.IO;
namespace Results.Entities namespace Results.Entities
{ {
public class MeterTestRslt public class MeterTestRslt
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual byte CompoundMeterId { get; set; } /// 0=single, 1=compound/main, 2=compound/aux., 3=compound/overal, 4=heat meter volume, 5=heat meter energy public virtual byte CompoundMeterId { get; set; } /// 0=single, 1=compound/main, 2=compound/aux., 3=compound/overal, 4=heat meter volume, 5=heat meter energy
public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depend on localization and customer public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
public virtual double PulsesMeter { get; set; } /// # of water meter or heat meter pulses public virtual double PulsesMeter { get; set; } /// # of water meter or heat meter pulses
public virtual double PulsesMaster { get; set; } /// # of reference flowmeter pulses (gated by this water meter pulses) public virtual double PulsesMaster { get; set; } /// # of reference flowmeter pulses (gated by this water meter pulses)
@@ -26,8 +25,6 @@ namespace Results.Entities
/// Main result /// Main result
public virtual double Error { get; set; } /// [%] public virtual double Error { get; set; } /// [%]
public virtual long ErrorIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28 (error flags)
public virtual long InfoIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28 (info flags)
public virtual double KorrErrQ { get; set; } /// [%] not mapped to results DB, saved to Oracle DB public virtual double KorrErrQ { get; set; } /// [%] not mapped to results DB, saved to Oracle DB
public virtual bool TestDone { get; set; } /// true = test was completed public virtual bool TestDone { get; set; } /// true = test was completed
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
@@ -52,15 +49,14 @@ namespace Results.Entities
public virtual TestData TestData() { return TestRslt.TestData; } public virtual TestData TestData() { return TestRslt.TestData; }
/// ///
public virtual int Repeats() { return TestData().Repeats; } public virtual int Repeats() { return TestData().Repeats; }
public virtual double Qtg() { return TestData().Qtg; } /// [m3/h] public virtual double Qfrom() { return TestData().Qfrom; } /// [m3/h]
public virtual double Qfrom() { return TestData().Qfrom; } /// [m3/h]
public virtual double Qto() { return TestData().Qto; } /// [m3/h] public virtual double Qto() { return TestData().Qto; } /// [m3/h]
public virtual double TargetVolume() { return TestData().TargetVolume; } /// [l] public virtual double TargetVolume() { return TestData().TargetVolume; } /// [l]
public virtual double TargetTime() { return TestData().TargetTime; } /// [s] public virtual double TargetTime() { return TestData().TargetTime; } /// [s]
public virtual string Method() { return TestData().Method; } public virtual string Method() { return TestData().Method; }
public virtual double ErrLimLo() { return TestData().ErrLimLo; } /// [%] public virtual double ErrLimLo() { return TestData().ErrLimLo; } /// [%]
public virtual double ErrLimHi() { return TestData().ErrLimHi; } /// [%] public virtual double ErrLimHi() { return TestData().ErrLimHi; } /// [%]
public virtual double Uncertainty() { return TestData().ErrLimMargin; } /// [%] public virtual double Uncertainty() { return TestData().Uncertainty; } /// [%]
public virtual string ProcedureName() { return WaterMeter.Batch.ProcedureName; } public virtual string ProcedureName() { return WaterMeter.Batch.ProcedureName; }
public virtual int BatchNr() { return WaterMeter.Batch.BatchNr; } public virtual int BatchNr() { return WaterMeter.Batch.BatchNr; }
@@ -131,86 +127,14 @@ namespace Results.Entities
TimestampEnd = src.TimestampEnd; TimestampEnd = src.TimestampEnd;
TestTime = src.TestTime; TestTime = src.TestTime;
Error = src.Error; Error = src.Error;
ErrorIndicators = src.ErrorIndicators;
KorrErrQ = src.KorrErrQ; KorrErrQ = src.KorrErrQ;
TestDone = src.TestDone; TestDone = src.TestDone;
Passed = src.Passed; Passed = src.Passed;
#if ORACLE_DB
LastError = src.LastError;
#endif
} }
public override string ToString() public override string ToString()
{ {
return (TestRslt != null) ? Name() : base.ToString(); return (TestRslt != null) ? Name() : base.ToString();
} }
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(Id);
writer.Write(CompoundMeterId);
writer.Write(RegReaderType);
writer.Write(PulsesMeter);
writer.Write(PulsesMaster);
writer.Write(PulsesPerLiter);
writer.Write(VolumeStart);
writer.Write(VolumeEnd);
writer.Write(VolumeMeter);
writer.Write(VolumeRef);
writer.Write(TimestampStart);
writer.Write(TimestampEnd);
writer.Write(TestTime);
writer.Write(Error);
writer.Write(ErrorIndicators);
writer.Write(InfoIndicators);
writer.Write(KorrErrQ);
writer.Write(TestDone);
writer.Write(Passed);
#if ORACLE_DB
writer.Write(LastError);
#endif
writer.Write((TestRslt != null && TestRslt.Name() != null) ? TestRslt.Name() : string.Empty);
writer.Write(TestRslt.Part);
}
public virtual void ReadBinary(BinaryReader reader, IList<TestRslt> testResults)
{
Id = reader.ReadInt32();
CompoundMeterId = reader.ReadByte();
RegReaderType = reader.ReadInt32();
PulsesMeter = reader.ReadDouble();
PulsesMaster = reader.ReadDouble();
PulsesPerLiter = reader.ReadDouble();
VolumeStart = reader.ReadDouble();
VolumeEnd = reader.ReadDouble();
VolumeMeter = reader.ReadDouble();
VolumeRef = reader.ReadDouble();
TimestampStart = reader.ReadDouble();
TimestampEnd = reader.ReadDouble();
TestTime = reader.ReadDouble();
Error = reader.ReadDouble();
ErrorIndicators = reader.ReadInt64();
InfoIndicators = reader.ReadInt64();
KorrErrQ = reader.ReadDouble();
TestDone = reader.ReadBoolean();
Passed = reader.ReadBoolean();
#if ORACLE_DB
LastError = reader.ReadDouble();
#endif
TestRslt = null;
string trName = reader.ReadString();
int trPart = reader.ReadInt32();
if (testResults != null && !string.IsNullOrEmpty(trName))
{
foreach (var tr in testResults)
{
if ((tr.Name() == trName) && (tr.Part == trPart))
{
TestRslt = tr;
break;
}
}
}
}
} }
} }
+12 -58
View File
@@ -1,30 +1,28 @@
/// ///
/// Copyright (c) 2016-2020 Sensus Slovensko a.s. /// Copyright (c) 2016 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.IO;
namespace Results.Entities namespace Results.Entities
{ {
/// <summary> /// <summary>
/// Test, consisting of one or more repetitions of the test 'SingleTest'. /// Test, consisting of one or more repetitions of the test 'SingleTest'.
/// </summary> /// </summary>
public class TestData public class TestData
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual string Name { get; set; } public virtual string Name { get; set; }
public virtual int Repeats { get; set; } public virtual int Repeats { get; set; }
public virtual double Qtg { get; set; } /// [m3/h] flow range low limit public virtual double Qfrom { get; set; } /// [m3/h] flow range low limit
public virtual double Qfrom { get; set; } /// [m3/h] flow range low limit
public virtual double Qto { get; set; } /// [m3/h] flow range high limit public virtual double Qto { get; set; } /// [m3/h] flow range high limit
public virtual double TargetVolume { get; set; } /// [l] target test volume public virtual double TargetVolume { get; set; } /// [l] target test volume
public virtual double TargetTime { get; set; } /// [s] target test time public virtual double TargetTime { get; set; } /// [s] target test time
public virtual string Method { get; set; } public virtual string Method { get; set; }
public virtual double ErrLimLo { get; set; } /// [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3 public virtual double ErrLimLo { get; set; } /// [%] (usually < 0)
public virtual double ErrLimHi { get; set; } /// [%] usually > 0, in case of heat meters: -Qn in m3/h public virtual double ErrLimHi { get; set; } /// [%] (usually > 0)
public virtual double ErrLimMargin { get; set; } /// [%] makes error limits tighter: 0 <= ErrLimMargin <= abs(ErrLimXx) public virtual double Uncertainty { get; set; } /// [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual bool DoControlWaterTemp { get; set; } public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; } public virtual float TempLimLo { get; set; }
public virtual float TempLimHi { get; set; } public virtual float TempLimHi { get; set; }
@@ -32,7 +30,7 @@ namespace Results.Entities
public virtual bool Evaluate { get; set; } public virtual bool Evaluate { get; set; }
public TestData() protected TestData()
{ {
Name = string.Empty; Name = string.Empty;
Method = string.Empty; Method = string.Empty;
@@ -43,15 +41,14 @@ namespace Results.Entities
{ {
Name = test.Name; Name = test.Name;
Repeats = test.Repeats; Repeats = test.Repeats;
Qtg = (double)test.Qtg; Qfrom = (double)test.Qfrom;
Qfrom = (double)test.Qfrom;
Qto = (double)test.Qto; Qto = (double)test.Qto;
TargetVolume = (double)test.Volume; TargetVolume = (double)test.Volume;
TargetTime = (double)test.TstTime; TargetTime = (double)test.TstTime;
Method = test.Method; Method = test.Method;
ErrLimLo = (double)test.ErrLimLo; ErrLimLo = (double)test.ErrLimLo;
ErrLimHi = (double)test.ErrLimHi; ErrLimHi = (double)test.ErrLimHi;
ErrLimMargin = (double)test.Uncertainty; Uncertainty = (double)test.Uncertainty;
DoControlWaterTemp = test.DoControlWaterTemp; DoControlWaterTemp = test.DoControlWaterTemp;
TempLimLo = test.TempLimLo; TempLimLo = test.TempLimLo;
TempLimHi = test.TempLimHi; TempLimHi = test.TempLimHi;
@@ -69,15 +66,14 @@ namespace Results.Entities
{ {
if (!Name.Equals(td.Name)) return false; if (!Name.Equals(td.Name)) return false;
if (Repeats != td.Repeats) return false; if (Repeats != td.Repeats) return false;
if (Qtg != td.Qtg) return false; if (Qfrom != td.Qfrom) return false;
if (Qfrom != td.Qfrom) return false;
if (Qto != td.Qto) return false; if (Qto != td.Qto) return false;
if (TargetVolume != td.TargetVolume) return false; if (TargetVolume != td.TargetVolume) return false;
if (TargetTime != td.TargetTime) return false; if (TargetTime != td.TargetTime) return false;
if (!Method.Equals(td.Method)) return false; if (!Method.Equals(td.Method)) return false;
if (ErrLimLo != td.ErrLimLo) return false; if (ErrLimLo != td.ErrLimLo) return false;
if (ErrLimHi != td.ErrLimHi) return false; if (ErrLimHi != td.ErrLimHi) return false;
if (ErrLimMargin != td.ErrLimMargin) return false; if (Uncertainty != td.Uncertainty) return false;
if (DoControlWaterTemp != td.DoControlWaterTemp) return false; if (DoControlWaterTemp != td.DoControlWaterTemp) return false;
if (DoControlWaterTemp) if (DoControlWaterTemp)
{ {
@@ -108,47 +104,5 @@ namespace Results.Entities
list.Add(item); /// Item not fund in the list, it is added to the list list.Add(item); /// Item not fund in the list, it is added to the list
return item; return item;
} }
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(Id);
writer.Write((Name != null) ? Name : string.Empty);
writer.Write(Repeats);
writer.Write(Qtg);
writer.Write(Qfrom);
writer.Write(Qto);
writer.Write(TargetVolume);
writer.Write(TargetTime);
writer.Write((Method != null) ? Method : string.Empty);
writer.Write(ErrLimLo);
writer.Write(ErrLimHi);
writer.Write(ErrLimMargin);
writer.Write(DoControlWaterTemp);
writer.Write(TempLimLo);
writer.Write(TempLimHi);
writer.Write(Publish);
writer.Write(Evaluate);
}
public virtual void ReadBinary(BinaryReader reader)
{
Id = reader.ReadInt32();
Name = reader.ReadString();
Repeats = reader.ReadInt32();
Qtg = reader.ReadDouble();
Qfrom = reader.ReadDouble();
Qto = reader.ReadDouble();
TargetVolume = reader.ReadDouble();
TargetTime = reader.ReadDouble();
Method = reader.ReadString();
ErrLimLo = reader.ReadDouble();
ErrLimHi = reader.ReadDouble();
ErrLimMargin = reader.ReadDouble();
DoControlWaterTemp = reader.ReadBoolean();
TempLimLo = reader.ReadSingle();
TempLimHi = reader.ReadSingle();
Publish = reader.ReadSByte();
Evaluate = reader.ReadBoolean();
}
} }
} }
+36 -360
View File
@@ -1,39 +1,36 @@
/// ///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s. /// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO;
namespace Results.Entities namespace Results.Entities
{ {
public class TestRslt public class TestRslt
{ {
/// Identity /// Identity
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual Batch Batch { get; set; } public virtual Batch Batch { get; set; }
public virtual TestData TestData { get; set; } public virtual TestData TestData { get; set; }
public virtual Components Components { get; set; } public virtual Components Components { get; set; }
public virtual int Part { get; set; } public virtual int Part { get; set; }
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...) public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
public virtual string MethodClass { get; set; } /// Not mapped to DB, does not depend on localization and customer public virtual string MethodClass { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
/// Main results /// Main results
public virtual bool TestDone { get; set; } public virtual bool TestDone { get; set; }
public virtual string Remark { get; set; } public virtual string Remark { get; set; }
public virtual DateTime StartTime { get; set; } /// Date and time of the test start public virtual DateTime StartTime { get; set; } /// Date and time of the test start
public virtual DateTime EndTime { get; set; } /// Date and time of the test end public virtual DateTime EndTime { get; set; } /// Date and time of the test end
public virtual int FlowSetTime { get; set; } /// [s] Flow set time in seconds public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
public virtual int TimeBtwnMassMsrmnts { get; set; } /// [s] Time between two mass measurements in seconds (if applicable) public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
public virtual double TestTime { get; set; } /// [s] Test time in seconds public virtual double PulsesMaster { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the water to the tank
public virtual double TestTimeCorrection { get; set; } /// [s] Correction of the test time due to diverter (0 for methods w/o diverter or when there is no correction table) public virtual double TotalPulsesMstr { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the complete test (not mapped to DB)
public virtual double PulsesMaster { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the water to the tank public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected.
public virtual double TotalPulsesMstr { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the complete test (not mapped to DB) public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table.
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected. public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement.
public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table. /// When mass measurement is not available, corrected by a correction table.
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement.
/// When mass measurement is not available, corrected by a correction table.
public virtual double MassStartRaw { get; set; } /// [kg] public virtual double MassStartRaw { get; set; } /// [kg]
public virtual double MassStart { get; set; } /// [kg] public virtual double MassStart { get; set; } /// [kg]
public virtual double MassEndRaw { get; set; } /// [kg] public virtual double MassEndRaw { get; set; } /// [kg]
@@ -57,9 +54,9 @@ namespace Results.Entities
public virtual float DivEnd90 { get; set; } /// [s] Diverter switch time when test starts at level 90 (e.g. 90%) (not mapped to DB) public virtual float DivEnd90 { get; set; } /// [s] Diverter switch time when test starts at level 90 (e.g. 90%) (not mapped to DB)
public virtual float DivEnd50 { get; set; } /// [s] Diverter switch time when test starts at level 50 (e.g. 50%) (not mapped to DB) public virtual float DivEnd50 { get; set; } /// [s] Diverter switch time when test starts at level 50 (e.g. 50%) (not mapped to DB)
public virtual float DivEnd10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB) public virtual float DivEnd10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB)
public virtual long ErrorFlags { get; set; } /// bitfield : bit0=E1, bit1=E2, bit2=E3, etc. public virtual int ErrorFlags { get; set; } /// bitfield : bit0=E1, bit1=E2, bit2=E3, etc.
public virtual long InfoFlags { get; set; } /// bitfield : bit0=E1, bit1=E2, bit2=E3, etc. public virtual sbyte ErrorFlagsMd { get; set; } /// 0=off, 1=info, 2=on (evaluated in MeterTestRslt.Passed)
/// Main results of heat meters /// Main results of heat meters
public virtual double RefEnergy { get; set; } /// [J] Joul public virtual double RefEnergy { get; set; } /// [J] Joul
@@ -116,12 +113,6 @@ namespace Results.Entities
public virtual float FlowMin { get; set; } /// [m3/h] public virtual float FlowMin { get; set; } /// [m3/h]
public virtual float FlowMax { get; set; } /// [m3/h] public virtual float FlowMax { get; set; } /// [m3/h]
public virtual float Uncertnt { get; set; } /// [%] Relative error uncertainty
public virtual float UncertntScale { get; set; } /// [%] Contribution to uncertainty from scale
public virtual float UncertntDensity { get; set; } /// [%] Contribution to uncertainty from density
public virtual float UncertntTemp { get; set; } /// [%] Contribution to uncertainty from temperature
public virtual float UncertntPressure { get; set; } /// [%] Contribution to uncertainty from pressure
public virtual float Custom1 { get; set; } /// [°C] T ref hi mean public virtual float Custom1 { get; set; } /// [°C] T ref hi mean
public virtual float Custom2 { get; set; } /// [°C] T ref hi start public virtual float Custom2 { get; set; } /// [°C] T ref hi start
public virtual float Custom3 { get; set; } /// [°C] T ref hi end public virtual float Custom3 { get; set; } /// [°C] T ref hi end
@@ -133,12 +124,6 @@ namespace Results.Entities
public virtual float Custom9 { get; set; } /// [°C] T ref lo min public virtual float Custom9 { get; set; } /// [°C] T ref lo min
public virtual float Custom10 { get; set; } /// [°C] T ref lo max public virtual float Custom10 { get; set; } /// [°C] T ref lo max
public virtual int Counter1 { get; set; }
public virtual int Counter2 { get; set; }
public virtual int Counter3 { get; set; }
public virtual int Counter4 { get; set; }
public virtual int Counter5 { get; set; }
/// Wrappers /// Wrappers
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); } public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
public virtual int Repeats() { return TestData.Repeats; } public virtual int Repeats() { return TestData.Repeats; }
@@ -147,25 +132,10 @@ namespace Results.Entities
public virtual double TargetVolume() { return TestData.TargetVolume; } public virtual double TargetVolume() { return TestData.TargetVolume; }
public virtual double TargetTime() { return TestData.TargetTime; } public virtual double TargetTime() { return TestData.TargetTime; }
public virtual string Method() { return TestData.Method; } public virtual string Method() { return TestData.Method; }
public virtual string RefFlowmeter() { return (Components != null) ? Components.Flowmeter : string.Empty; } public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection")) : true; }
public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection") || MethodClass.Contains("DiverterTest") || MethodClass.Contains("ManualEntry")) : true; } public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest")) : true; }
public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest") || TestData.Method.ToLower().Contains("pmax")) : true; }
public virtual bool IsStartStop() { return (MethodClass != null) ? MethodClass.Contains("FixedStart") : true; } public virtual bool IsStartStop() { return (MethodClass != null) ? MethodClass.Contains("FixedStart") : true; }
public virtual bool IsDiverter() { return (MethodClass != null) ? ((MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) || MethodClass.Contains("DiverterTest")) : true; } public virtual bool IsDiverter() { return (MethodClass != null) ? (MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) : true; }
public virtual bool IsVolumeMethod() { return (MethodClass != null) ? (MethodClass.Contains("TestMethods.FixedStart.") || MethodClass.Contains("TestMethods.FlyingStart.")) : false; }
public virtual string MethodElde()
{
if (MethodClass == null) return string.Empty;
else if (MethodClass.Contains("TestMethods.FlyingStartMassCollection.")) return "MS";
else if (MethodClass.Contains("TestMethods.FlyingStartMassCollectionProlonged.")) return "MS";
else if (MethodClass.Contains("TestMethods.FlyingStartMassCollectionComparative.")) return "MS";
else if (MethodClass.Contains("TestMethods.FlyingStart.")) return "VS";
else if (MethodClass.Contains("TestMethods.FixedStartMassCollection.")) return "MP";
else if (MethodClass.Contains("TestMethods.FixedStartTankCollection.")) return "VP";
else if (MethodClass.Contains("TestMethods.FixedStart.")) return "VP";
else return string.Empty;
}
public virtual double ErrLimLo() public virtual double ErrLimLo()
{ {
@@ -178,7 +148,7 @@ namespace Results.Entities
/// Metrological class and nominal flow of a heat meter /// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(TestData.ErrLimLo); int metrClass = (int)Math.Round(TestData.ErrLimLo);
double Qp = Math.Abs(TestData.ErrLimHi); double Qp = Math.Abs(TestData.ErrLimHi);
double Q = (TestTime == 0) ? 1 : Math.Max(3.6 * VolumeCTV / TestTime, 0.00001); /// Div. by zero avoided double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
/// Calculate the error limit of a heat meter /// Calculate the error limit of a heat meter
switch (metrClass) switch (metrClass)
@@ -202,7 +172,7 @@ namespace Results.Entities
/// Metrological class and nominal flow of a heat meter /// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(TestData.ErrLimLo); int metrClass = (int)Math.Round(TestData.ErrLimLo);
double Qp = Math.Abs(TestData.ErrLimHi); double Qp = Math.Abs(TestData.ErrLimHi);
double Q = (TestTime == 0) ? 1 : Math.Max(3.6 * VolumeCTV / TestTime, 0.00001); /// Div. by zero avoided double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
/// Calculate the error limit of a heat meter /// Calculate the error limit of a heat meter
switch (metrClass) switch (metrClass)
@@ -215,17 +185,15 @@ namespace Results.Entities
} }
} }
public virtual double ErrLimMargin() { return TestData.ErrLimMargin; } public virtual double Uncertainty() { return TestData.Uncertainty; }
public virtual float TempLimLo() { return TestData.TempLimLo; } public virtual float TempLimLo() { return TestData.TempLimLo; }
public virtual float TempLimHi() { return TestData.TempLimHi; } public virtual float TempLimHi() { return TestData.TempLimHi; }
public virtual bool Evaluate() { return TestData.Evaluate; } public virtual bool Evaluate() { return TestData.Evaluate; }
public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData.Publish; } public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData.Publish; }
public TestRslt() protected TestRslt()
{ {
MethodClass = string.Empty;
Remark = string.Empty;
} }
public TestRslt(Batch batch, TestData testData, int part, int repetitionNr) public TestRslt(Batch batch, TestData testData, int part, int repetitionNr)
@@ -250,13 +218,10 @@ namespace Results.Entities
StartTime = src.StartTime; StartTime = src.StartTime;
EndTime = src.EndTime; EndTime = src.EndTime;
FlowSetTime = src.FlowSetTime; FlowSetTime = src.FlowSetTime;
TimeBtwnMassMsrmnts = src.TimeBtwnMassMsrmnts;
TestTime = src.TestTime; TestTime = src.TestTime;
PulsesMaster = src.PulsesMaster; PulsesMaster = src.PulsesMaster;
TotalPulsesMstr = src.TotalPulsesMstr;
ConstMasterRaw = src.ConstMasterRaw; ConstMasterRaw = src.ConstMasterRaw;
ConstMasterCorr = src.ConstMasterCorr; ConstMaster = src.ConstMaster;
ConstMaster = src.ConstMaster;
MassStartRaw = src.MassStartRaw; MassStartRaw = src.MassStartRaw;
MassStart = src.MassStart; MassStart = src.MassStart;
MassEndRaw = src.MassEndRaw; MassEndRaw = src.MassEndRaw;
@@ -271,15 +236,9 @@ namespace Results.Entities
VolumeMaster = src.VolumeMaster; VolumeMaster = src.VolumeMaster;
ErrorMaster = src.ErrorMaster; ErrorMaster = src.ErrorMaster;
DiverterStart = src.DiverterStart; DiverterStart = src.DiverterStart;
DivStart10 = src.DivStart10;
DivStart50 = src.DivStart50;
DivStart90 = src.DivStart90;
DiverterEnd = src.DiverterEnd; DiverterEnd = src.DiverterEnd;
DivEnd10 = src.DivEnd10;
DivEnd50 = src.DivEnd50;
DivEnd90 = src.DivEnd90;
ErrorFlags = src.ErrorFlags; ErrorFlags = src.ErrorFlags;
InfoFlags = src.InfoFlags; ErrorFlagsMd = src.ErrorFlagsMd;
RefEnergy = src.RefEnergy; RefEnergy = src.RefEnergy;
AmbTempMean = src.AmbTempMean; AmbTempMean = src.AmbTempMean;
AmbTempStart = src.AmbTempStart; AmbTempStart = src.AmbTempStart;
@@ -331,7 +290,6 @@ namespace Results.Entities
FlowEnd = src.FlowEnd; FlowEnd = src.FlowEnd;
FlowMin = src.FlowMin; FlowMin = src.FlowMin;
FlowMax = src.FlowMax; FlowMax = src.FlowMax;
Custom1 = src.Custom1; Custom1 = src.Custom1;
Custom2 = src.Custom2; Custom2 = src.Custom2;
Custom3 = src.Custom3; Custom3 = src.Custom3;
@@ -342,14 +300,14 @@ namespace Results.Entities
Custom8 = src.Custom8; Custom8 = src.Custom8;
Custom9 = src.Custom9; Custom9 = src.Custom9;
Custom10 = src.Custom10; Custom10 = src.Custom10;
Counter1 = src.Counter1;
Counter2 = src.Counter2;
Counter3 = src.Counter3;
Counter4 = src.Counter4;
Counter5 = src.Counter5;
} }
/// <summary> Wrapper </summary>
public virtual Config.Entities.ErrorFlagsMode ErrorFlagsMode()
{
return (Config.Entities.ErrorFlagsMode)ErrorFlagsMd;
}
/// <summary> Wrapper </summary> /// <summary> Wrapper </summary>
public virtual string ErrorFlagsStr() public virtual string ErrorFlagsStr()
{ {
@@ -375,16 +333,16 @@ namespace Results.Entities
public override string ToString() public override string ToString()
{ {
return string.Format("batch={0}, procedure={1}, test={2}, part={3} start={4} {5}", Batch.BatchNr, Batch.ProcedureName, Name(), Part, StartTime.ToShortDateString(), StartTime.ToShortTimeString()); return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", Batch.BatchNr, Batch.ProcedureName, Name(), StartTime.ToShortDateString(), StartTime.ToShortTimeString());
} }
public virtual string ToString(int i) public virtual string ToString(int i)
{ {
return string.Format("TestRslt: Part={0} RepetitionNr={1} TestDone={2} Remark={3} StartTime={4} EndTime={5} FlowSetTime={6} TestTime={7} PulsesMaster={8} ConstMaster={9} MassStartRaw={10} MassStart={11} MassEndRaw={12} MassEnd={13} DensityIn={14} DensityOut={15} DensityDiv={16} Buoyancy={17} FlowMass={18} FlowVolume={19} VolumeCTV={20} VolumeMaster={21} ErrorMaster={22} DiverterStart={85} DiverterEnd={86} ErrorFlags={23} InfoFlags={24} AmbTempMean={25} AmbTempStart={26} AmbTempEnd={27} AmbTempMin={28} AmbTempMax={29} AmbPressMean={30} AmbPressStart={31} AmbPressEnd={32} AmbPressMin={33} AmbPressMax={34} AmbHumiMean={35} AmbHumiStart={36} AmbHumiEnd={37} AmbHumiMin={38} AmbHumiMax={39} PressUpMean={40} PressUpStart={41} PressUpEnd={42} PressUpMin={43} PressUpMax={44} PressDownMean={45} PressDownStart={46} PressDownEnd={47} PressDownMin={48} PressDownMax={49} PressDeltaMean={50} PressDeltaStart={51} PressDeltaEnd={52} PressDeltaMin={53} PressDeltaMax={54} TempUpMean={55} TempUpStart={56} TempUpEnd={57} TempUpMin={58} TempUpMax={59} TempDownMean={60} TempDownStart={61} TempDownEnd={62} TempDownMin={63} TempDownMax={64} TempDivMean={65} TempDivStart={66} TempDivEnd={67} TempDivMin={68} TempDivMax={69} FlowMean={70} FlowStart={71} FlowEnd={72} FlowMin={73} FlowMax={74} Custom1={75} Custom2={76} Custom3={77} Custom4={78} Custom5={79} Custom6={80} Custom7={81} Custom8={82} Custom9={83} Custom10={84}", return string.Format("TestRslt: Part={0} RepetitionNr={1} TestDone={2} Remark={3} StartTime={4} EndTime={5} FlowSetTime={6} TestTime={7} PulsesMaster={8} ConstMaster={9} MassStartRaw={10} MassStart={11} MassEndRaw={12} MassEnd={13} DensityIn={14} DensityOut={15} DensityDiv={16} Buoyancy={17} FlowMass={18} FlowVolume={19} VolumeCTV={20} VolumeMaster={21} ErrorMaster={22} DiverterStart={85} DiverterEnd={86} ErrorFlags={23} ErrorFlagsMd={24} AmbTempMean={25} AmbTempStart={26} AmbTempEnd={27} AmbTempMin={28} AmbTempMax={29} AmbPressMean={30} AmbPressStart={31} AmbPressEnd={32} AmbPressMin={33} AmbPressMax={34} AmbHumiMean={35} AmbHumiStart={36} AmbHumiEnd={37} AmbHumiMin={38} AmbHumiMax={39} PressUpMean={40} PressUpStart={41} PressUpEnd={42} PressUpMin={43} PressUpMax={44} PressDownMean={45} PressDownStart={46} PressDownEnd={47} PressDownMin={48} PressDownMax={49} PressDeltaMean={50} PressDeltaStart={51} PressDeltaEnd={52} PressDeltaMin={53} PressDeltaMax={54} TempUpMean={55} TempUpStart={56} TempUpEnd={57} TempUpMin={58} TempUpMax={59} TempDownMean={60} TempDownStart={61} TempDownEnd={62} TempDownMin={63} TempDownMax={64} TempDivMean={65} TempDivStart={66} TempDivEnd={67} TempDivMin={68} TempDivMax={69} FlowMean={70} FlowStart={71} FlowEnd={72} FlowMin={73} FlowMax={74} Custom1={75} Custom2={76} Custom3={77} Custom4={78} Custom5={79} Custom6={80} Custom7={81} Custom8={82} Custom9={83} Custom10={84}",
Part, RepetitionNr, TestDone, Remark, StartTime, EndTime, FlowSetTime, TestTime, Part, RepetitionNr, TestDone, Remark, StartTime, EndTime, FlowSetTime, TestTime,
PulsesMaster, ConstMaster, MassStartRaw, MassStart, MassEndRaw, MassEnd, PulsesMaster, ConstMaster, MassStartRaw, MassStart, MassEndRaw, MassEnd,
DensityIn, DensityLine, DensityDiv, Buoyancy, FlowMass, FlowVolume, DensityIn, DensityLine, DensityDiv, Buoyancy, FlowMass, FlowVolume,
VolumeCTV, VolumeMaster, ErrorMaster, ErrorFlags, InfoFlags, VolumeCTV, VolumeMaster, ErrorMaster, ErrorFlags, ErrorFlagsMd,
AmbTempMean, AmbTempStart, AmbTempEnd, AmbTempMin, AmbTempMax, AmbTempMean, AmbTempStart, AmbTempEnd, AmbTempMin, AmbTempMax,
AmbPressMean, AmbPressStart, AmbPressEnd, AmbPressMin, AmbPressMax, AmbPressMean, AmbPressStart, AmbPressEnd, AmbPressMin, AmbPressMax,
AmbHumiMean, AmbHumiStart, AmbHumiEnd, AmbHumiMin, AmbHumiMax, AmbHumiMean, AmbHumiStart, AmbHumiEnd, AmbHumiMin, AmbHumiMax,
@@ -398,287 +356,5 @@ namespace Results.Entities
Custom1, Custom2, Custom3, Custom4, Custom5, Custom6, Custom7, Custom8, Custom9, Custom10, Custom1, Custom2, Custom3, Custom4, Custom5, Custom6, Custom7, Custom8, Custom9, Custom10,
DiverterStart, DiverterEnd); DiverterStart, DiverterEnd);
} }
}
public virtual void WriteBinary(BinaryWriter writer, IList<TestData> savedTestDatas)
{
writer.Write(Id);
/// Save TestData or TestData.Name
if (savedTestDatas != null && !savedTestDatas.Contains(TestData))
{
writer.Write(true);
TestData.WriteBinary(writer);
savedTestDatas.Add(TestData);
}
else
{
writer.Write(false);
writer.Write(TestData.Name);
}
/// Save Components if not null
if (Components != null)
{
writer.Write(true);
Components.WriteBinary(writer); /// Write Components
}
else
{
writer.Write(false);
}
writer.Write(Part);
writer.Write(RepetitionNr);
writer.Write((MethodClass != null) ? MethodClass : string.Empty);
writer.Write(TestDone);
writer.Write((Remark != null) ? Remark : string.Empty);
writer.Write(StartTime.ToString());
writer.Write(EndTime.ToString());
writer.Write(FlowSetTime);
writer.Write(TimeBtwnMassMsrmnts);
writer.Write(TestTime);
writer.Write(TestTimeCorrection);
writer.Write(PulsesMaster);
writer.Write(TotalPulsesMstr);
writer.Write(ConstMasterRaw);
writer.Write(ConstMasterCorr);
writer.Write(ConstMaster);
writer.Write(MassStartRaw);
writer.Write(MassStart);
writer.Write(MassEndRaw);
writer.Write(MassEnd);
writer.Write(DensityIn);
writer.Write(DensityLine);
writer.Write(DensityDiv);
writer.Write(Buoyancy);
writer.Write(FlowMass);
writer.Write(FlowVolume);
writer.Write(VolumeCTV);
writer.Write(VolumeMaster);
writer.Write(ErrorMaster);
writer.Write(DiverterStart);
writer.Write(DivStart10);
writer.Write(DivStart50);
writer.Write(DivStart90);
writer.Write(DiverterEnd);
writer.Write(DivEnd90);
writer.Write(DivEnd50);
writer.Write(DivEnd10);
writer.Write(ErrorFlags);
writer.Write(InfoFlags);
writer.Write(RefEnergy);
writer.Write(AmbTempMean);
writer.Write(AmbTempStart);
writer.Write(AmbTempEnd);
writer.Write(AmbTempMin);
writer.Write(AmbTempMax);
writer.Write(AmbPressMean);
writer.Write(AmbPressStart);
writer.Write(AmbPressEnd);
writer.Write(AmbPressMin);
writer.Write(AmbPressMax);
writer.Write(AmbHumiMean);
writer.Write(AmbHumiStart);
writer.Write(AmbHumiEnd);
writer.Write(AmbHumiMin);
writer.Write(AmbHumiMax);
writer.Write(PressUpMean);
writer.Write(PressUpStart);
writer.Write(PressUpEnd);
writer.Write(PressUpMin);
writer.Write(PressUpMax);
writer.Write(PressDownMean);
writer.Write(PressDownStart);
writer.Write(PressDownEnd);
writer.Write(PressDownMin);
writer.Write(PressDownMax);
writer.Write(PressDeltaMean);
writer.Write(PressDeltaStart);
writer.Write(PressDeltaEnd);
writer.Write(PressDeltaMin);
writer.Write(PressDeltaMax);
writer.Write(TempUpMean);
writer.Write(TempUpStart);
writer.Write(TempUpEnd);
writer.Write(TempUpMin);
writer.Write(TempUpMax);
writer.Write(TempDownMean);
writer.Write(TempDownStart);
writer.Write(TempDownEnd);
writer.Write(TempDownMin);
writer.Write(TempDownMax);
writer.Write(TempDivMean);
writer.Write(TempDivStart);
writer.Write(TempDivEnd);
writer.Write(TempDivMin);
writer.Write(TempDivMax);
writer.Write(FlowMean);
writer.Write(FlowStart);
writer.Write(FlowEnd);
writer.Write(FlowMin);
writer.Write(FlowMax);
writer.Write(Uncertnt);
writer.Write(UncertntScale);
writer.Write(UncertntDensity);
writer.Write(UncertntTemp);
writer.Write(UncertntPressure);
writer.Write(Custom1);
writer.Write(Custom2);
writer.Write(Custom3);
writer.Write(Custom4);
writer.Write(Custom5);
writer.Write(Custom6);
writer.Write(Custom7);
writer.Write(Custom8);
writer.Write(Custom9);
writer.Write(Custom10);
writer.Write(Counter1);
writer.Write(Counter2);
writer.Write(Counter3);
writer.Write(Counter4);
writer.Write(Counter5);
}
public virtual void ReadBinary(BinaryReader reader, IList<TestData> testDatas)
{
Id = reader.ReadInt32();
/// Retrieve TestData
if (reader.ReadBoolean())
{
(TestData = new TestData()).ReadBinary(reader);
if (testDatas != null) testDatas.Add(TestData);
}
else
{
TestData = null;
string testDataName = reader.ReadString();
foreach (var td in testDatas)
{
if (td.Name == testDataName)
{
TestData = td;
break;
}
}
}
if (reader.ReadBoolean())
{
(Components = new Components()).ReadBinary(reader); /// Read Components
}
Part = reader.ReadInt32();
RepetitionNr = reader.ReadInt32();
MethodClass = reader.ReadString();
TestDone = reader.ReadBoolean();
Remark = reader.ReadString();
StartTime = DateTime.Parse(reader.ReadString());
EndTime = DateTime.Parse(reader.ReadString());
FlowSetTime = reader.ReadInt32();
TimeBtwnMassMsrmnts = reader.ReadInt32();
TestTime = reader.ReadDouble();
TestTimeCorrection = reader.ReadDouble();
PulsesMaster = reader.ReadDouble();
TotalPulsesMstr = reader.ReadDouble();
ConstMasterRaw = reader.ReadDouble();
ConstMasterCorr = reader.ReadDouble();
ConstMaster = reader.ReadDouble();
MassStartRaw = reader.ReadDouble();
MassStart = reader.ReadDouble();
MassEndRaw = reader.ReadDouble();
MassEnd = reader.ReadDouble();
DensityIn = reader.ReadDouble();
DensityLine = reader.ReadDouble();
DensityDiv = reader.ReadDouble();
Buoyancy = reader.ReadDouble();
FlowMass = reader.ReadDouble();
FlowVolume = reader.ReadDouble();
VolumeCTV = reader.ReadDouble();
VolumeMaster = reader.ReadDouble();
ErrorMaster = reader.ReadDouble();
DiverterStart = reader.ReadSingle();
DivStart10 = reader.ReadSingle();
DivStart50 = reader.ReadSingle();
DivStart90 = reader.ReadSingle();
DiverterEnd = reader.ReadSingle();
DivEnd90 = reader.ReadSingle();
DivEnd50 = reader.ReadSingle();
DivEnd10 = reader.ReadSingle();
ErrorFlags = reader.ReadInt64();
InfoFlags = reader.ReadInt64();
RefEnergy = reader.ReadDouble();
AmbTempMean = reader.ReadSingle();
AmbTempStart = reader.ReadSingle();
AmbTempEnd = reader.ReadSingle();
AmbTempMin = reader.ReadSingle();
AmbTempMax = reader.ReadSingle();
AmbPressMean = reader.ReadSingle();
AmbPressStart = reader.ReadSingle();
AmbPressEnd = reader.ReadSingle();
AmbPressMin = reader.ReadSingle();
AmbPressMax = reader.ReadSingle();
AmbHumiMean = reader.ReadSingle();
AmbHumiStart = reader.ReadSingle();
AmbHumiEnd = reader.ReadSingle();
AmbHumiMin = reader.ReadSingle();
AmbHumiMax = reader.ReadSingle();
PressUpMean = reader.ReadSingle();
PressUpStart = reader.ReadSingle();
PressUpEnd = reader.ReadSingle();
PressUpMin = reader.ReadSingle();
PressUpMax = reader.ReadSingle();
PressDownMean = reader.ReadSingle();
PressDownStart = reader.ReadSingle();
PressDownEnd = reader.ReadSingle();
PressDownMin = reader.ReadSingle();
PressDownMax = reader.ReadSingle();
PressDeltaMean = reader.ReadSingle();
PressDeltaStart = reader.ReadSingle();
PressDeltaEnd = reader.ReadSingle();
PressDeltaMin = reader.ReadSingle();
PressDeltaMax = reader.ReadSingle();
TempUpMean = reader.ReadSingle();
TempUpStart = reader.ReadSingle();
TempUpEnd = reader.ReadSingle();
TempUpMin = reader.ReadSingle();
TempUpMax = reader.ReadSingle();
TempDownMean = reader.ReadSingle();
TempDownStart = reader.ReadSingle();
TempDownEnd = reader.ReadSingle();
TempDownMin = reader.ReadSingle();
TempDownMax = reader.ReadSingle();
TempDivMean = reader.ReadSingle();
TempDivStart = reader.ReadSingle();
TempDivEnd = reader.ReadSingle();
TempDivMin = reader.ReadSingle();
TempDivMax = reader.ReadSingle();
FlowMean = reader.ReadSingle();
FlowStart = reader.ReadSingle();
FlowEnd = reader.ReadSingle();
FlowMin = reader.ReadSingle();
FlowMax = reader.ReadSingle();
Uncertnt = reader.ReadSingle();
UncertntScale = reader.ReadSingle();
UncertntDensity = reader.ReadSingle();
UncertntTemp = reader.ReadSingle();
UncertntPressure = reader.ReadSingle();
Custom1 = reader.ReadSingle();
Custom2 = reader.ReadSingle();
Custom3 = reader.ReadSingle();
Custom4 = reader.ReadSingle();
Custom5 = reader.ReadSingle();
Custom6 = reader.ReadSingle();
Custom7 = reader.ReadSingle();
Custom8 = reader.ReadSingle();
Custom9 = reader.ReadSingle();
Custom10 = reader.ReadSingle();
Counter1 = reader.ReadInt32();
Counter2 = reader.ReadInt32();
Counter3 = reader.ReadInt32();
Counter4 = reader.ReadInt32();
Counter5 = reader.ReadInt32();
}
}
} }
+42 -402
View File
@@ -1,15 +1,14 @@
/// ///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s. /// Copyright (c) 2015-2017 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO;
using Config.Entities; using Config.Entities;
using Results.Resources;
namespace Results.Entities namespace Results.Entities
{ {
public enum ResultCode public enum ResultCode
{ {
None = 0, None = 0,
@@ -41,29 +40,31 @@ namespace Results.Entities
public class WaterMeter public class WaterMeter
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual string SerialNr { get; set; } /// S/N _or_ S/N of the main meter of a compound meter _or_ PCB Number of an iPerl water meter public virtual string SerialNr { get; set; } /// Main s/n for compound meters, PCB Number for iPerl water meter
public virtual string SerialNrAux { get; set; } /// S/N of the aux. meter of a compound meter _or_ a complete assigned S/N of an iPerl water meter public virtual string SerialNrAux { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
public virtual string PurchaseOrder { get; set; } public virtual string PurchaseOrder { get; set; }
public virtual int YearOfProduction { get; set; } public virtual int YearOfProduction { get; set; }
public virtual int WMPosition { get; set; } /// 1-based water meter position public virtual int WMPosition { get; set; }
public virtual string EndState { get; set; } /// End state (of the main water meter) public virtual string EndState { get; set; } /// End state (of the main water meter)
public virtual string EndStateAux { get; set; } /// End state of the auxiliary water meter public virtual string EndStateAux { get; set; } /// End state of the auxiliary water meter
public virtual double QRise { get; set; } /// [m3/h] detected Q_rise of a composed meter or 'sensitivity' of a single meter public virtual double QRise { get; set; } /// [m3/h] detected Q_rise of a composed meter or 'sensitivity' of a single meter
public virtual double QFall { get; set; } /// [m3/h] detected Q_fall of a composed meter public virtual double QFall { get; set; } /// [m3/h] detected Q_fall of a composed meter
public virtual long ErrorFlags { get; set; } /// bitfield : bit14=E15, bit15=E16 public virtual int ErrorFlags { get; set; } /// bitfield : bit14=E15, bit15=E16
public virtual long InfoFlags { get; set; } /// bitfield : bit14=E15, bit15=E16
public virtual bool Passed { get; set; } public virtual bool Passed { get; set; }
public virtual int ResultCode { get; set; } public virtual int ResultCode { get; set; }
public virtual string ArchivePath { get; set; } public virtual string ArchivePath { get; set; }
public virtual string Remark { get; set; } public virtual string Remark { get; set; }
#if IPERL #if IPERL
public virtual int SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
public virtual double OrigCalibFactor { get; set; } /// Original iPerl calibration factor used during the test public virtual double OrigCalibFactor { get; set; } /// Original iPerl calibration factor used during the test
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
public virtual double OrigCalibFactorLNA{ get; set; } /// Original iPerl LNA calibration factor used during the test public virtual double OrigCalibFactorLNA{ get; set; } /// Original iPerl LNA calibration factor used during the test
public virtual double CalibFactorLNA { get; set; } /// iPerl LNA calibration factor used during the test public virtual double CalibFactorLNA { get; set; } /// iPerl LNA calibration factor used during the test
public virtual double Q2ErrWOCorrection { get; set; } public virtual double Q2ErrWOCorrection { get; set; }
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
public virtual double Q2Correction { get; set; } /// !!! obsolete
public virtual int Q2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl public virtual int Q2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
public virtual int Q2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl public virtual int Q2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
@@ -72,36 +73,11 @@ namespace Results.Entities
public virtual int Hz2Correction { get; set; } /// iPerl Q2 correction used during the test public virtual int Hz2Correction { get; set; } /// iPerl Q2 correction used during the test
public virtual string FWVersion { get; set; } public virtual string FWVersion { get; set; }
#endif #endif
#if TURA_SPECIAL
/// <summary>
/// Data from a production test bench (in case of tests on iPerl special)
/// </summary>
public virtual int AssignedSerialNr { get; set; }
public virtual string CompleteSerialNr { get; set; }
public virtual string RadioAddress { get; set; }
public virtual int PaletteNr { get; set; }
public virtual int UmkartonNr { get; set; }
public virtual string ProdTestBench { get; set; }
public virtual int ProdWMPosition { get; set; }
public virtual string ProdUserName { get; set; }
public virtual string ProdPurchaseOrder { get; set; }
public virtual bool ProdPassed { get; set; }
public virtual int ProdResultCode { get; set; }
public virtual int ProdQ2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
public virtual int ProdQ2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
#endif
#if ORACLE_DB #if ORACLE_DB
public virtual int Pruefindex { get; set; } /// >= 1 ... pruefindex public virtual int Pruefindex { get; set; } /// Not mapped to DB !!! 0=unknown (saving to Oracle failed), >=1 ... pruefindex
public virtual int HydrPruefung { get; set; } public virtual int HydrPruefung { get; set; } /// Not mapped to DB !!!
public virtual int WMTypeRevision { get; set; } /// Not mapped to DB !!!
public virtual object RawTestInfos { get; set; } /// IList<SensusTestInfo> fetched from Oracle at the beginning of the cycle, not mapped to DB !!!
public virtual object CompleteTestInfos { get; set; } /// SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!!
#endif #endif
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID public virtual WaterMeterData WaterMeterData { get; set; }
public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session)
public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result
public virtual WaterMeterData WaterMeterData { get; set; }
public virtual Batch Batch { get; set; } public virtual Batch Batch { get; set; }
public virtual IList<MeterTestRslt> MeterTestRslts { get; set; } public virtual IList<MeterTestRslt> MeterTestRslts { get; set; }
@@ -133,20 +109,27 @@ namespace Results.Entities
public virtual DateTime StartTime() { return Batch.StartTime; } public virtual DateTime StartTime() { return Batch.StartTime; }
public virtual DateTime EndTime() { return Batch.EndTime; } public virtual DateTime EndTime() { return Batch.EndTime; }
protected MeterTestRslt lastMeterTestRslts;
public virtual MeterTestRslt LastMeterTestRslts() { return lastMeterTestRslts; }
public virtual long ErrorFlagsFromTests()
public virtual int ErrorFlagsFromTests(out ErrorFlagsMode errorFlagsMode)
{ {
long errorFlags = 0; int errorFlags = 0;
ErrorFlagsMode eFlagsMode = 0; /// = ErrorFlagsMode.Off;
foreach (var mtr in MeterTestRslts) foreach (var mtr in MeterTestRslts)
{ {
if (mtr.Evaluate() && mtr.TestDone) errorFlags |= mtr.TestRslt.ErrorFlags; if (mtr.Evaluate() && mtr.TestDone) errorFlags |= mtr.TestRslt.ErrorFlags;
if ((int)mtr.TestRslt.ErrorFlagsMode() > (int)eFlagsMode) eFlagsMode = mtr.TestRslt.ErrorFlagsMode();
} }
errorFlagsMode = eFlagsMode; /// Maximum from all tests (=ErrorFlagsMode.On if at least one test is ErrorFlagsMode.On)
return errorFlags; return errorFlags;
} }
public virtual long ErrorFlagsFromTestsAndWM() public virtual int ErrorFlagsFromTestsAndWM(out ErrorFlagsMode errorFlagsMode)
{ {
return ErrorFlagsFromTests() | ErrorFlags; int eFlagsFromTests = ErrorFlagsFromTests(out errorFlagsMode) | ErrorFlags;
return (errorFlagsMode != ErrorFlagsMode.Off) ? (eFlagsFromTests | ErrorFlags) : 0;
} }
/// <summary> /// <summary>
@@ -155,7 +138,8 @@ namespace Results.Entities
/// <returns>ErrorFlags string</returns> /// <returns>ErrorFlags string</returns>
public virtual string ErrorFlagsStr() public virtual string ErrorFlagsStr()
{ {
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM()); ErrorFlagsMode errorFlagsMode;
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
#if LANG_PL #if LANG_PL
return string.IsNullOrEmpty(eFlags) ? "brak" : eFlags; return string.IsNullOrEmpty(eFlags) ? "brak" : eFlags;
#else #else
@@ -165,7 +149,8 @@ namespace Results.Entities
public virtual string PassedOrErrorFlagsStr() public virtual string PassedOrErrorFlagsStr()
{ {
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM()); ErrorFlagsMode errorFlagsMode;
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr(null)) : eFlags; return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr(null)) : eFlags;
} }
@@ -185,14 +170,19 @@ namespace Results.Entities
} }
} }
errFlgsStr.Append(Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM())); ErrorFlagsMode errorFlagsMode;
errFlgsStr.Append(Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode)));
return errFlgsStr.ToString(); return errFlgsStr.ToString();
} }
public virtual bool PassedFromTests() public virtual bool PassedFromTests()
{ {
bool passed = (ErrorFlagsFromTestsAndWM() == 0); ErrorFlagsMode eFlagsMode;
int eFlags = ErrorFlagsFromTestsAndWM(out eFlagsMode);
bool passed = true;
if (eFlagsMode == ErrorFlagsMode.On && eFlags != 0) passed = false;
foreach (var mtr in MeterTestRslts) foreach (var mtr in MeterTestRslts)
{ {
@@ -272,12 +262,7 @@ namespace Results.Entities
{ {
return mtr; return mtr;
} }
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound && }
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy)
{
return mtr;
}
}
} }
return null; return null;
} }
@@ -339,36 +324,7 @@ namespace Results.Entities
public WaterMeter() public WaterMeter()
{ {
MeterTestRslts = new List<MeterTestRslt>(); MeterTestRslts = new List<MeterTestRslt>();
#if ORACLE_DB }
Pruefindex = 1;
HydrPruefung = 0;
WMTypeRevision = 0;
RawTestInfos = null;
CompleteTestInfos = null;
#endif
ProcessId = 0;
SessionId = 0;
ErrorFlags = 0;
LastRecordIsNok = false;
/// Initialize strings
SerialNr = string.Empty;
SerialNrAux = string.Empty;
PurchaseOrder = string.Empty;
EndState = string.Empty;
EndStateAux = string.Empty;
ArchivePath = string.Empty;
Remark = string.Empty;
#if TURA_SPECIAL
CompleteSerialNr = string.Empty;
RadioAddress = string.Empty;
ProdUserName = string.Empty;
ProdPurchaseOrder = string.Empty;
#endif
#if IPERL
FWVersion = string.Empty;
#endif
}
public virtual void CopyContentFrom(WaterMeter src) public virtual void CopyContentFrom(WaterMeter src)
@@ -390,11 +346,12 @@ namespace Results.Entities
ArchivePath = src.ArchivePath; ArchivePath = src.ArchivePath;
Remark = src.Remark; Remark = src.Remark;
#if IPERL #if IPERL
SerialNrEx = src.SerialNrEx;
OrigCalibFactor = src.OrigCalibFactor; OrigCalibFactor = src.OrigCalibFactor;
CalibFactor = src.CalibFactor; CalibFactor = src.CalibFactor;
OrigCalibFactorLNA = src.OrigCalibFactorLNA;
CalibFactorLNA = src.CalibFactorLNA;
Q2ErrWOCorrection = src.Q2ErrWOCorrection; Q2ErrWOCorrection = src.Q2ErrWOCorrection;
Q2CorrectionDone = src.Q2CorrectionDone;
Q2Correction = src.Q2Correction;
Q2CorrRL = src.Q2CorrRL; Q2CorrRL = src.Q2CorrRL;
Q2CorrLR = src.Q2CorrLR; Q2CorrLR = src.Q2CorrLR;
Q2CorrFlowRight = src.Q2CorrFlowRight; Q2CorrFlowRight = src.Q2CorrFlowRight;
@@ -403,32 +360,10 @@ namespace Results.Entities
Hz2Correction = src.Hz2Correction; Hz2Correction = src.Hz2Correction;
FWVersion = src.FWVersion; FWVersion = src.FWVersion;
#endif #endif
#if TURA_SPECIAL
AssignedSerialNr = src.AssignedSerialNr;
CompleteSerialNr = src.CompleteSerialNr;
RadioAddress = src.RadioAddress;
PaletteNr = src.PaletteNr;
UmkartonNr = src.UmkartonNr;
ProdTestBench = src.ProdTestBench;
ProdWMPosition = src.ProdWMPosition;
ProdUserName = src.ProdUserName;
ProdPurchaseOrder = src.ProdPurchaseOrder;
ProdPassed = src.ProdPassed;
ProdResultCode = src.ProdResultCode;
ProdQ2CorrRL = src.ProdQ2CorrRL;
ProdQ2CorrLR = src.ProdQ2CorrLR;
#endif
#if ORACLE_DB #if ORACLE_DB
Pruefindex = src.Pruefindex; Pruefindex = src.Pruefindex;
HydrPruefung = src.HydrPruefung; HydrPruefung = src.HydrPruefung;
WMTypeRevision = src.WMTypeRevision;
RawTestInfos = src.RawTestInfos;
CompleteTestInfos = src.CompleteTestInfos;
#endif #endif
ProcessId = src.ProcessId;
SessionId = src.SessionId;
LastRecordIsNok = src.LastRecordIsNok;
foreach (var mtr in MeterTestRslts) foreach (var mtr in MeterTestRslts)
{ {
MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (Config.Entities.CompoundMeterId)mtr.CompoundMeterId); MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (Config.Entities.CompoundMeterId)mtr.CompoundMeterId);
@@ -444,7 +379,7 @@ namespace Results.Entities
{ {
StringBuilder sb = new StringBuilder(80); StringBuilder sb = new StringBuilder(80);
#if IPERL #if IPERL
sb.AppendFormat("PCB:{0} S/N:{1} ", SerialNr, SerialNrAux); sb.AppendFormat("PCB:{0} S/N:{1} ", SerialNr, SerialNrEx);
#else #else
sb.AppendFormat("S/N:{0} ", SerialNr); sb.AppendFormat("S/N:{0} ", SerialNr);
#endif #endif
@@ -453,300 +388,5 @@ namespace Results.Entities
sb.AppendFormat(" test start: {0} {1} batch={2}", StartTime().ToShortDateString(), StartTime().ToShortTimeString(), BatchNr()); sb.AppendFormat(" test start: {0} {1} batch={2}", StartTime().ToShortDateString(), StartTime().ToShortTimeString(), BatchNr());
return sb.ToString(); return sb.ToString();
} }
/// <summary>
/// Get decorated test names for a specified watermeter
/// </summary>
/// <param name="wMtr">Watermeter results entity</param>
/// <returns>A list of strings</returns>
public virtual IList<string> GetAllDecoratedTestNames()
{
IList<string> testNames = new List<string>();
if (MeterTestRslts != null)
{
foreach (var mtr in MeterTestRslts)
{
if ((mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound || mtr.CompoundMeterId == (byte)CompoundMeterId.HeatMeterEnergy)
&& mtr.TestDone
&& (mtr.Publish() != Config.Entities.Publish.Never)
&& (mtr.Publish() != Config.Entities.Publish.Internal))
{
testNames.Add(mtr.Name());
}
}
}
return testNames;
}
static readonly System.Drawing.Color NotCompletedColor = System.Drawing.Color.White;
static readonly System.Drawing.Color OkColor = System.Drawing.Color.LightGreen;
static readonly System.Drawing.Color NokColor = System.Drawing.Color.LightPink;
static readonly System.Drawing.Color RejectColor = System.Drawing.Color.Magenta;
static readonly System.Drawing.Color ProductionErrorColor = System.Drawing.Color.RoyalBlue;
static readonly System.Drawing.Color WrongDirectionColor = System.Drawing.Color.Gold;
static readonly System.Drawing.Color WrongQ2FactorsColor = System.Drawing.Color.Red;
/// <summary>
/// Get color for highlighting results and an apporpriate text message.
/// </summary>
/// <param name="wMtr">Water meter results entity</param>
/// <param name="message">Appropriate message</param>
/// <returns>Color for results</returns>
public virtual System.Drawing.Color GetColorOfResults(bool maxRepeatsExceeded, out string message)
{
bool wmtrCompleted = CompletedFromTests();
bool wmtrPassed = PassedFromTests();
if ((ErrorFlags & (int)ErrorFlagMask.E28) != 0)
{
message = Strings.Previous_step_is_missing_or_NOK;
return ProductionErrorColor;
}
else if ((ErrorFlags & (int)ErrorFlagMask.E27) != 0)
{
message = Strings.Wrong_iPerl_counting_direction;
return WrongDirectionColor;
}
else if ((ErrorFlags & (int)ErrorFlagMask.E26) != 0)
{
message = Strings.Invalid_Q2_correction_factors;
return WrongQ2FactorsColor;
}
else if (wmtrPassed)
{
/// Water meter passed (therefore is was also completed)
message = Strings.Passed;
return OkColor;
}
else if (wmtrCompleted)
{
/// Water meter was completed but did not pass => Failed
if (maxRepeatsExceeded)
{
message = Strings.Test_repetition_count_exceeded_upper_limit;
return RejectColor;
}
else
{
message = Strings.Failed;
return NokColor;
}
}
else if (Disabled)
{
/// Water meter was not completed yet => did not pass, did not fail
message = Strings.This_position_is_disabled;
return NotCompletedColor;
}
else
{
/// Water meter was not completed yet => did not pass, did not fail
message = Strings.Test_in_progress;
return NotCompletedColor;
}
}
public virtual void WriteBinary(BinaryWriter writer, IList<WaterMeterData> savedWMDatas)
{
writer.Write(Id);
writer.Write((SerialNr != null) ? SerialNr : string.Empty);
writer.Write((SerialNrAux != null) ? SerialNrAux : string.Empty);
writer.Write((PurchaseOrder != null) ? PurchaseOrder : string.Empty);
writer.Write(YearOfProduction);
writer.Write(WMPosition);
writer.Write((EndState != null) ? EndState : string.Empty);
writer.Write((EndStateAux != null) ? EndStateAux : string.Empty);
writer.Write(QRise);
writer.Write(QFall);
writer.Write(ErrorFlags);
writer.Write(InfoFlags);
writer.Write(Passed);
writer.Write(ResultCode);
writer.Write((ArchivePath != null) ? ArchivePath : string.Empty);
writer.Write((Remark != null) ? Remark : string.Empty);
#if IPERL
writer.Write(OrigCalibFactor);
writer.Write(CalibFactor);
writer.Write(OrigCalibFactorLNA);
writer.Write(CalibFactorLNA);
writer.Write(Q2ErrWOCorrection);
writer.Write(Q2CorrRL);
writer.Write(Q2CorrLR);
writer.Write(Q2CorrFlowRight);
writer.Write(Diff2Hz8Hz);
writer.Write(Hz2CorrectionDone);
writer.Write(Hz2Correction);
writer.Write((FWVersion != null) ? FWVersion : string.Empty);
#endif
#if TURA_SPECIAL
writer.Write(AssignedSerialNr);
writer.Write((CompleteSerialNr != null) ? CompleteSerialNr : string.Empty);
writer.Write((RadioAddress != null) ? RadioAddress : string.Empty);
writer.Write(PaletteNr);
writer.Write(UmkartonNr);
writer.Write((ProdTestBench != null) ? ProdTestBench : string.Empty);
writer.Write(ProdWMPosition);
writer.Write((ProdUserName != null) ? ProdUserName : string.Empty);
writer.Write((ProdPurchaseOrder != null) ? ProdPurchaseOrder : string.Empty);
writer.Write(ProdPassed);
writer.Write(ProdResultCode);
writer.Write(ProdQ2CorrRL);
writer.Write(ProdQ2CorrLR);
#endif
#if ORACLE_DB
writer.Write(Pruefindex);
writer.Write(HydrPruefung);
writer.Write(WMTypeRevision);
/// Write RawTestInfos
IList<Results.Output.SensusTestInfo> rawTestInfos = RawTestInfos as IList<Results.Output.SensusTestInfo>;
writer.Write((rawTestInfos != null) ? rawTestInfos.Count : 0);
if (rawTestInfos != null)
{
for (int i = 0; i < rawTestInfos.Count; i++) rawTestInfos[i].WriteBinary(writer);
}
/// Write CompleteTestInfos
Results.Output.SensusTestInfo[] completeTestInfos = CompleteTestInfos as Results.Output.SensusTestInfo[];
writer.Write((completeTestInfos != null) ? completeTestInfos.Length : 0);
if (completeTestInfos != null)
{
for (int i = 0; i < completeTestInfos.Length; i++) completeTestInfos[i].WriteBinary(writer);
}
#endif
writer.Write(ProcessId);
writer.Write(SessionId);
writer.Write(LastRecordIsNok);
/// Save WaterMeterData or WaterMeterData.Id
if (WaterMeterData != null && savedWMDatas != null && !savedWMDatas.Contains(WaterMeterData))
{
writer.Write(true);
WaterMeterData.WriteBinary(writer);
savedWMDatas.Add(WaterMeterData);
}
else
{
writer.Write(false);
}
/// Write MeterTestRslts
int meterTestRsltsCount = MeterTestRslts != null ? MeterTestRslts.Count : 0;
writer.Write(meterTestRsltsCount);
for (int i = 0; i < meterTestRsltsCount; i++)
{
MeterTestRslts[i].WriteBinary(writer);
}
}
public virtual void ReadBinary(BinaryReader reader, IList<WaterMeterData> wmDatasRetrievedSoFar, IList<TestRslt> testRslts)
{
Id = reader.ReadInt32();
SerialNr = reader.ReadString();
SerialNrAux = reader.ReadString();
PurchaseOrder = reader.ReadString();
YearOfProduction = reader.ReadInt32();
WMPosition = reader.ReadInt32();
EndState = reader.ReadString();
EndStateAux = reader.ReadString();
QRise = reader.ReadDouble();
QFall = reader.ReadDouble();
ErrorFlags = reader.ReadInt64();
InfoFlags = reader.ReadInt64();
Passed = reader.ReadBoolean();
ResultCode = reader.ReadInt32();
ArchivePath = reader.ReadString();
Remark = reader.ReadString();
#if IPERL
OrigCalibFactor = reader.ReadDouble();
CalibFactor = reader.ReadDouble();
OrigCalibFactorLNA = reader.ReadDouble();
CalibFactorLNA = reader.ReadDouble();
Q2ErrWOCorrection = reader.ReadDouble();
Q2CorrRL = reader.ReadInt32();
Q2CorrLR = reader.ReadInt32();
Q2CorrFlowRight = reader.ReadInt32();
Diff2Hz8Hz = reader.ReadDouble();
Hz2CorrectionDone = reader.ReadBoolean();
Hz2Correction = reader.ReadInt32();
FWVersion = reader.ReadString();
#endif
#if TURA_SPECIAL
AssignedSerialNr = reader.ReadInt32();
CompleteSerialNr = reader.ReadString();
RadioAddress = reader.ReadString();
PaletteNr = reader.ReadInt32();
UmkartonNr = reader.ReadInt32();
ProdTestBench = reader.ReadString();
ProdWMPosition = reader.ReadInt32();
ProdUserName = reader.ReadString();
ProdPurchaseOrder = reader.ReadString();
ProdPassed = reader.ReadBoolean();
ProdResultCode = reader.ReadInt32();
ProdQ2CorrRL = reader.ReadInt32();
ProdQ2CorrLR = reader.ReadInt32();
#endif
#if ORACLE_DB
Pruefindex = reader.ReadInt32();
HydrPruefung = reader.ReadInt32();
WMTypeRevision = reader.ReadInt32();
/// Read RawTestInfos
int rawTestInfosCount = reader.ReadInt32();
IList<Results.Output.SensusTestInfo> rawTestInfos = new List<Results.Output.SensusTestInfo>();
for (int i = 0; i < rawTestInfosCount; i++)
{
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
ti.ReadBinary(reader);
rawTestInfos.Add(ti);
}
RawTestInfos = rawTestInfos;
/// Read CompleteTestInfos
int completeTestInfosLen = reader.ReadInt32();
Results.Output.SensusTestInfo[] completeTestInfos = new Results.Output.SensusTestInfo[completeTestInfosLen];
for (int i = 0; i < completeTestInfosLen; i++)
{
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
ti.ReadBinary(reader);
completeTestInfos[i] = ti;
}
CompleteTestInfos = completeTestInfos;
#endif
ProcessId = reader.ReadInt32();
SessionId = reader.ReadInt32();
LastRecordIsNok = reader.ReadBoolean();
/// Retrieve TestData
if (reader.ReadBoolean())
{
(WaterMeterData = new WaterMeterData()).ReadBinary(reader);
if (wmDatasRetrievedSoFar != null) wmDatasRetrievedSoFar.Add(WaterMeterData);
}
else
{
WaterMeterData = null;
foreach (var wmd in wmDatasRetrievedSoFar)
{
WaterMeterData = wmd;
break;
}
}
/// Read MeterTestRslts
int meterTestRsltsCount = reader.ReadInt32();
MeterTestRslts = new List<MeterTestRslt>();
for (int i = 0; i < meterTestRsltsCount; i++)
{
MeterTestRslt mtr = new MeterTestRslt();
mtr.WaterMeter = this;
mtr.ReadBinary(reader, testRslts);
MeterTestRslts.Add(mtr);
}
}
} }
} }
+7 -81
View File
@@ -1,16 +1,16 @@
/// ///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s. /// Copyright (c) 2015-2017 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.IO;
namespace Results.Entities namespace Results.Entities
{ {
public class WaterMeterData public class WaterMeterData
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual string ProductName { get; set; } public virtual string ProductName { get; set; }
public virtual string Producer { get; set; } public virtual string Producer { get; set; }
@@ -54,6 +54,7 @@ namespace Results.Entities
#if ORACLE_DB #if ORACLE_DB
public virtual int WMTypeId { get; set; } public virtual int WMTypeId { get; set; }
public virtual int WMTypeRev { get; set; }
#endif #endif
public WaterMeterData() public WaterMeterData()
@@ -110,6 +111,7 @@ namespace Results.Entities
#if ORACLE_DB #if ORACLE_DB
if (WMTypeId != wmd.WMTypeId) return false; if (WMTypeId != wmd.WMTypeId) return false;
if (WMTypeRev != wmd.WMTypeRev) return false;
#endif #endif
return true; return true;
} }
@@ -132,81 +134,5 @@ namespace Results.Entities
list.Add(item); /// Item not fund in the list, it is added to the list list.Add(item); /// Item not fund in the list, it is added to the list
return item; return item;
} }
}
public virtual void WriteBinary(BinaryWriter writer)
{
writer.Write(Id);
writer.Write((ProductName != null) ? ProductName : string.Empty);
writer.Write((Producer != null) ? Producer : string.Empty);
writer.Write(DN);
writer.Write(L);
writer.Write((int)Mounting);
writer.Write(NewQnames);
writer.Write(Q4_Qmax);
writer.Write(Q3_Qn);
writer.Write(Q2_Qt);
writer.Write(Q1_Qmin);
writer.Write((MetrologicalClass != null) ? MetrologicalClass : string.Empty);
writer.Write((int)TemperatureClass);
writer.Write((int)PressureLossClass);
writer.Write((int)MaxAdmissiblePressure);
writer.Write((int)FlowProfileSensitivityClass);
writer.Write((ApprovalInfo != null) ? ApprovalInfo : string.Empty);
writer.Write((Certificate != null) ? Certificate : string.Empty);
writer.Write(PulsesPerLtr);
writer.Write((ProducerAux != null) ? ProducerAux : string.Empty);
writer.Write(Q3_Qn_Aux);
writer.Write((MetrologicalClassAux != null) ? MetrologicalClassAux : string.Empty);
writer.Write((ApprovalInfoAux != null) ? ApprovalInfoAux : string.Empty);
writer.Write((int)Medium);
writer.Write((Text1 != null) ? Text1 : string.Empty);
writer.Write((Text2 != null) ? Text2 : string.Empty);
writer.Write((Text3 != null) ? Text3 : string.Empty);
writer.Write((Text4 != null) ? Text4 : string.Empty);
writer.Write((Text5 != null) ? Text5 : string.Empty);
writer.Write(Compound);
writer.Write(HeatMeter);
#if ORACLE_DB
writer.Write(WMTypeId);
#endif
}
public virtual void ReadBinary(BinaryReader reader)
{
Id = reader.ReadInt32();
ProductName = reader.ReadString();
Producer = reader.ReadString();
DN = reader.ReadDouble();
L = reader.ReadDouble();
Mounting = (Config.Entities.Mounting)reader.ReadInt32();
NewQnames = reader.ReadBoolean();
Q4_Qmax = reader.ReadDouble();
Q3_Qn = reader.ReadDouble();
Q2_Qt = reader.ReadDouble();
Q1_Qmin = reader.ReadDouble();
MetrologicalClass = reader.ReadString();
TemperatureClass = (Config.Entities.TemperatureClass)reader.ReadInt32();
PressureLossClass = (Config.Entities.PressureLossClass)reader.ReadInt32();
MaxAdmissiblePressure = (Config.Entities.MaxAdmissiblePressure)reader.ReadInt32();
FlowProfileSensitivityClass = (Config.Entities.FlowProfileSensitivityClass)reader.ReadInt32();
ApprovalInfo = reader.ReadString();
Certificate = reader.ReadString();
PulsesPerLtr = reader.ReadDouble();
ProducerAux = reader.ReadString();
Q3_Qn_Aux = reader.ReadDouble();
MetrologicalClassAux = reader.ReadString();
ApprovalInfoAux = reader.ReadString();
Medium = (Config.Entities.Medium)reader.ReadInt32();
Text1 = reader.ReadString();
Text2 = reader.ReadString();
Text3 = reader.ReadString();
Text4 = reader.ReadString();
Text5 = reader.ReadString();
Compound = reader.ReadBoolean();
HeatMeter = reader.ReadBoolean();
#if ORACLE_DB
WMTypeId = reader.ReadInt32();
#endif
}
}
} }
+268 -222
View File
@@ -1,11 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using log4net; using log4net;
using Config.Entities; using Config.Entities;
using Results.Resources; using Results.Resources;
using NHibernate;
using TracingDB.Entities;
namespace Results.Forms namespace Results.Forms
{ {
@@ -13,33 +16,42 @@ namespace Results.Forms
{ {
static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsDlg)); static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsDlg));
DateTime lastRedraw;
DateTime lastSizeChange;
bool loaded;
/// ///
/// Public members /// Public members
/// ///
public Results.BatchResults Results;
public IList<Results.WMeterRsltItemSpec> Items;
public MetersArrangement MetersArrangement; public MetersArrangement MetersArrangement;
public TestsArrangement TestsArrangement; public TestsArrangement TestsArrangement;
public int NrMetersInOneGroup; public int NrMetersInOneGroup;
public bool ShowDisabledPositions;
public int MinWidth; public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_SingleWM;
public int MinHeight; public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_CombinedWM;
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_HeatM;
public int[] RsltsClmnWidths { set { rsltsClmnWidths = value; } }
public int PopupResultsLeft; public int PopupResultsLeft;
public int PopupResultsTop; public int PopupResultsTop;
public int PopupResultsWidth; public int PopupResultsWidth;
public int PopupResultsHeight; public int PopupResultsHeight;
public int[] RsltsClmnWidths;
public Results.BatchResults Results { set { Display(value); } }
/// ///
/// Private members /// Private members
/// ///
IOneWMResultsCtrl[] wmRsltsCtrl; /// An array of controls with water meter results. Results.BatchResults results;
IOneWMResultsCtrl firstEnabledControl; MetersKind metersKind;
DateTime lastRedraw;
DateTime lastSizeChange; ListView firstListView;
int metersInOneGroup; public int[] rsltsClmnWidths;
int nrGroups; int rsltsClmnCount { get { return (rsltsClmnWidths != null) ? rsltsClmnWidths.Length : 0; } }
int lvWidth;
int lvHeight;
Timer timer; Timer timer;
@@ -47,226 +59,291 @@ namespace Results.Forms
public BatchResultsDlg() public BatchResultsDlg()
{ {
InitializeComponent(); InitializeComponent();
Text = Strings.Results;
firstEnabledControl = null;
lastSizeChange = DateTime.Now; lastSizeChange = DateTime.Now;
nrGroups = 1;
metersInOneGroup = 1;
/// Create a timer with one second interval. // Create a timer with a ten second interval.
timer = new Timer(); timer = new Timer();
timer.Interval = 1000; /// ms timer.Interval = 500; /// ms
timer.Tick += new EventHandler(OnTimer); timer.Tick += new EventHandler(OnTimer);
timer.Start(); timer.Start();
} }
private void BatchResultsDlg_Load(object sender, EventArgs e) private void BatchResultsDlg_Load(object sender, EventArgs e)
{ {
if (PopupResultsLeft != 0) Left = PopupResultsLeft; if (PopupResultsLeft != 0) Left = PopupResultsLeft;
if (PopupResultsTop != 0) Top = PopupResultsTop; if (PopupResultsTop != 0) Top = PopupResultsTop;
if (PopupResultsWidth != 0) Width = PopupResultsWidth; if (PopupResultsWidth != 0) Width = PopupResultsWidth;
if (PopupResultsHeight != 0) Height = PopupResultsHeight; if (PopupResultsHeight != 0) Height = PopupResultsHeight;
CreateControlsAndFillPanel(Results); loaded = true;
UpdateColumnWidths(RsltsClmnWidths); if (results != null) Redraw();
UpdateResults(Results); }
public void Display(Results.BatchResults results)
{
this.results = results;
if (loaded) Redraw();
} }
/// IList<Results.WMeterRsltItemSpec> GetRsltItems(MetersKind metersKind)
/// Handle double-click inside a water meter results control
///
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
{ {
if (args.WMPosition > 0) IList<Results.WMeterRsltItemSpec> srcItems;
switch (metersKind)
{ {
foreach (var wm in Results.Batch.WaterMeters) default:
{ case MetersKind.Single: srcItems = RsltItems_Screen_SingleWM; break;
if (!wm.Disabled && (wm.WMPosition == args.WMPosition)) case MetersKind.Combined: srcItems = RsltItems_Screen_CombinedWM; break;
{ case MetersKind.HeatMeter: srcItems = RsltItems_Screen_HeatM; break;
ShowMoreWMResults(wm);
return;
}
}
} }
MessageBox.Show(Strings.No_water_meter); IList<Results.WMeterRsltItemSpec> copiedItems = new List<Results.WMeterRsltItemSpec>();
return; foreach (var it in srcItems) copiedItems.Add(it.Clone());
} return copiedItems;
void UpdateColumnWidths(int[] columnWidths)
{
foreach (var ctrl in wmRsltsCtrl) ctrl.Update(columnWidths);
}
void UpdateScrollpositions(int scrollStart)
{
/// TODO
} }
/// <summary> /// <summary>
/// Re-draw the results. Apply new settings if they changed. /// Re-draw the results. Apply new settings if they changed.
/// </summary> /// </summary>
void CreateControlsAndFillPanel(Results.BatchResults results) public void Redraw()
{ {
if ((results == null) || (results.WMPositionsCount == 0))
{
/// There are no water meters at all
flowLayoutPanel.Controls.Clear();
wmRsltsCtrl = new OneWMResultsRowsCtrl[0];
firstEnabledControl = null;
return;
}
///
/// Determine water meter positions count
///
int displayedControlsCount = 0;
for (int i = 0; i < results.Batch.WaterMeters.Count; i++)
{
if ((!results.Batch.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
displayedControlsCount++;
}
}
///
/// Calculate geometry
///
metersInOneGroup = Math.Max(1, Math.Min(displayedControlsCount, NrMetersInOneGroup));
nrGroups = Math.Max(1, (displayedControlsCount + metersInOneGroup - 1) / metersInOneGroup);
int oneWidth;
int oneHeight;
///
if (MetersArrangement == MetersArrangement.Horizontally)
{
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
}
else
{
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
}
///
/// Create controls and fill the FlowLayoutPanel
///
flowLayoutPanel.SuspendLayout();
flowLayoutPanel.Controls.Clear();
flowLayoutPanel.WrapContents = true;
flowLayoutPanel.AutoScroll = true;
wmRsltsCtrl = new IOneWMResultsCtrl[displayedControlsCount];
int ix = 0;
firstEnabledControl = null;
for (int i = 0; i < results.Batch.WaterMeters.Count; i++)
{
if (!results.Batch.WaterMeters[i].Disabled || ShowDisabledPositions)
{
/// Create one water meter position / control
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
? new OneWMResultsRowsCtrl() as IOneWMResultsCtrl
: new OneWMResultsColumnsCtrl() as IOneWMResultsCtrl;
wmRsltsCtrl[ix].Width = oneWidth;
wmRsltsCtrl[ix].Height = oneHeight;
if (!results.Batch.WaterMeters[i].Disabled)
{
if ((firstEnabledControl == null) && !results.Batch.WaterMeters[i].Disabled)
{
firstEnabledControl = wmRsltsCtrl[ix];
}
//wmRsltsCtrl[ix].Update(results.WaterMeters[i].WMPosition);
wmRsltsCtrl[ix].Update(Items);
wmRsltsCtrl[ix].WMResultsClickedHandler += delegate(object s, Results.Forms.WaterMeterEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), s, args);
}
else
{
OnDoubleClick(s, args);
}
};
}
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
ix++;
}
}
flowLayoutPanel.ResumeLayout();
lastRedraw = DateTime.Now; lastRedraw = DateTime.Now;
}
this.SuspendLayout();
try
void UpdateResults(Results.BatchResults results)
{
if (results != null && results.Batch != null && results.Batch.WaterMeters != null)
{ {
int ctrlIx = 0; /// Determine how many water meters were enabled for result evaluation and printing
for (int wmNr0 = 0; wmNr0 < results.Batch.WaterMeters.Count; wmNr0++) int enabledWMsCount = 0;
for (int i = 0; i < results.WMPositionsCount; i++)
{ {
if (!results.Batch.WaterMeters[wmNr0].Disabled || ShowDisabledPositions) if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
{ {
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(results.Batch.WaterMeters[wmNr0]); enabledWMsCount++;
} }
} }
}
}
int metersInOneGroup = Math.Max(1, Math.Min(enabledWMsCount, NrMetersInOneGroup));
int nrGroups = Math.Max(1, (enabledWMsCount + metersInOneGroup - 1) / metersInOneGroup);
void ShowMoreWMResults(Results.Entities.WaterMeter wm) if (MetersArrangement == MetersArrangement.Horizontally)
{
if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(wm.SerialNr))
{
new Results.Forms.MoreWMResultsDlg(wm, null).ShowDialog();
}
else
{
using (ISession session = TracingDB.DB.SessionFactory.OpenSession())
{ {
IList<ReferenceRecord> refRecords = session.QueryOver<ReferenceRecord>() flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
.Where(x => (x.Code == wm.SerialNr)) lvWidth = flowLayoutPanel.Width / metersInOneGroup - 6;
.OrderBy(x => x.TimeStamp).Desc lvHeight = flowLayoutPanel.Height / nrGroups - 6;
.List(); }
for (int i = 0; i < refRecords.Count; i++) else
{
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
lvWidth = flowLayoutPanel.Width / nrGroups - 6;
lvHeight = flowLayoutPanel.Height / metersInOneGroup - 6;
}
flowLayoutPanel.Controls.Clear();
flowLayoutPanel.WrapContents = true;
flowLayoutPanel.AutoScroll = true;
bool first = true;
for (int i = 0; i < results.WMPositionsCount; i++)
{
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
{ {
ReferenceRecord refR = refRecords[i]; ListView lview = (TestsArrangement == TestsArrangement.Rows)
if ((refR.Records != null) && (refR.Records.Count > 0)) ? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
if (lview != null)
{ {
/// Reference record has additional records/parts (i.e. it is PCB assembly workflow step) flowLayoutPanel.Controls.Add(lview);
/// if (first)
foreach (var rec in refR.Records)
{ {
if (rec.Part.OraDBType.ToLower().Contains("flowtube")) firstListView = lview;
{ first = false;
/// rec.Part is a flowtube
///
IList<ReferenceRecord> flowtubeRRs = session.QueryOver<ReferenceRecord>()
.Where(x => (x.Code == rec.Code))
.OrderBy(x => x.TimeStamp).Desc
.List();
foreach (var rr in flowtubeRRs) refRecords.Add(rr);
}
} }
} }
} }
new Results.Forms.MoreWMResultsDlg(wm, refRecords).ShowDialog();
} }
} }
catch (Exception e)
{
log.FatalFormat("Redrawing results failed : {0}", e.Message);
if (e.InnerException != null)
{
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
}
log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
}
this.ResumeLayout(false);
} }
/// <summary>
/// Get an empty ListView control with appropriate parameters.
/// </summary>
/// <returns>ListView control</returns>
ListView GetListView()
{
ListView lview = new ListView();
lview.AllowColumnReorder = false;
lview.Dock = System.Windows.Forms.DockStyle.None;
lview.FullRowSelect = true;
lview.GridLines = true;
lview.Location = new System.Drawing.Point(0, 0);
lview.Size = new System.Drawing.Size(lvWidth, lvHeight);
lview.TabIndex = 0;
lview.UseCompatibleStateImageBehavior = false;
lview.View = System.Windows.Forms.View.Details;
return lview;
}
/// <summary>
/// Get decorated test names for a specified watermeter
/// </summary>
/// <param name="wMtr">Watermeter results entity</param>
/// <returns>A list of strings</returns>
IList<string> GetAllDecoratedTestNames(Results.Entities.WaterMeter wMtr)
{
IList<string> testNames = new List<string>();
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr.IsPilotRslt() && mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never)
&& (mtr.Publish() != Config.Entities.Publish.Internal))
{
testNames.Add(mtr.Name());
}
}
return testNames;
}
/// <summary>
/// Get a ListView control filled with results of the meter 'mtr'
/// </summary>
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
/// <returns>ListView object</returns>
ListView GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
ListView lview = GetListView();
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
if (items == null || items.Count == 0) return lview;
// Header
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
int col = 1;
foreach (var item in items)
{
lview.Columns.Add(item.Caption, (rsltsClmnCount > col) ? rsltsClmnWidths[col] : 70);
col++;
}
IList<string> testNames = GetAllDecoratedTestNames(wMtr);
int ix = 0;
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
&& mtr.Publish() != Config.Entities.Publish.Internal)
{
ListViewItem lvi = new ListViewItem(testNames[ix++]);
for (int i = 0; i < items.Count; i++)
{
string str = items[i].Print(wMtr, mtr.Name());
/// Extract and use color information
string[] texts = str.Split(new char[] { '|' });
if (texts.Length == 1)
{
lvi.SubItems.Add(str);
}
else if (texts.Length == 2)
{
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(texts[0]);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
}
else
{
lvi.SubItems.Add(string.Empty);
}
}
lview.Items.Add(lvi);
}
}
return lview;
}
/// <summary>
/// Get a ListView control filled with results of the meter 'mtr'
/// </summary>
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
/// <returns>ListView object</returns>
ListView GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
ListView lview = GetListView();
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
if (items == null || items.Count == 0) return lview;
// Header
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
int i = 1;
foreach (var str in GetAllDecoratedTestNames(wMtr))
{
lview.Columns.Add(str, (rsltsClmnCount > i) ? rsltsClmnWidths[i] : 70);
i++;
}
foreach (var item in items)
{
ListViewItem lvi = new ListViewItem(item.Caption);
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
mtr.Publish() != Config.Entities.Publish.Internal)
{
string str = item.Print(wMtr, mtr.Name());
string[] texts = str.Split(new char[] { '|' });
if (texts.Length == 1)
{
lvi.SubItems.Add(str);
}
else if (texts.Length == 2)
{
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(texts[0]);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
}
else
{
lvi.SubItems.Add(string.Empty);
}
}
}
lview.Items.Add(lvi);
}
return lview;
}
private void BatchResultsDlg_FormClosing(object sender, FormClosingEventArgs e) private void BatchResultsDlg_FormClosing(object sender, FormClosingEventArgs e)
{ {
@@ -276,7 +353,6 @@ namespace Results.Forms
PopupResultsHeight = Height; PopupResultsHeight = Height;
} }
private void flowLayoutPanel_SizeChanged(object sender, EventArgs e) private void flowLayoutPanel_SizeChanged(object sender, EventArgs e)
{ {
lastSizeChange = DateTime.Now; lastSizeChange = DateTime.Now;
@@ -286,43 +362,13 @@ namespace Results.Forms
{ {
if (DateTime.Compare(lastSizeChange, lastRedraw) > 0) if (DateTime.Compare(lastSizeChange, lastRedraw) > 0)
{ {
/// The last size change was more recent then the last redraw /// The last size change was later then the last redraw
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
if (DateTime.Compare(lastSizeChange + new TimeSpan(0, 0, 1), now) < 0) if (DateTime.Compare(lastSizeChange + new TimeSpan(0, 0, 1), now) < 0)
{ {
/// More then 1 second since the last panel size change /// More then 1s since the last size change
Redraw();
/// Calculate geometry
int oneWidth;
int oneHeight;
///
if (MetersArrangement == MetersArrangement.Horizontally)
{
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
}
else
{
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
}
if (wmRsltsCtrl != null)
{
/// Update size of controls
flowLayoutPanel.SuspendLayout();
///
foreach (var oneCtrl in wmRsltsCtrl)
{
oneCtrl.Width = oneWidth;
oneCtrl.Height = oneHeight;
}
///
flowLayoutPanel.ResumeLayout();
}
} }
} }
} }
-25
View File
@@ -1,25 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Results.Forms
{
public interface IOneWMResultsCtrl
{
event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
bool Disabled { get; } /// true when water meter position is disabled
int WMPosition { get; } /// 1-based WM position
int Width { get; set; } /// Control width
int Height { get; set; } /// Control height
ListView.ColumnHeaderCollection Columns { get; } /// Embedded ListView control columns
void Update(int[] columnWidths);
void Update(IList<Results.WMeterRsltItemSpec> items);
void Update(Results.Entities.WaterMeter wMtr);
}
}
-258
View File
@@ -1,258 +0,0 @@
namespace Results.Forms
{
partial class ManualEntryConfigCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.availableTabControl = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.availableByQuantityTreeView = new System.Windows.Forms.TreeView();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.availableByCategoryTreeView = new System.Windows.Forms.TreeView();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.availableAlphabeticTreeView = new System.Windows.Forms.TreeView();
this.downButton = new System.Windows.Forms.Button();
this.upButton = new System.Windows.Forms.Button();
this.selectedResultsListViewEx = new Results.Forms.ListViewEx();
this.removeAllButton = new System.Windows.Forms.Button();
this.removeButton = new System.Windows.Forms.Button();
this.addButton = new System.Windows.Forms.Button();
this.selectedItemsLabel = new System.Windows.Forms.Label();
this.availableItemsLabel = new System.Windows.Forms.Label();
this.availableTabControl.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.SuspendLayout();
//
// availableTabControl
//
this.availableTabControl.Controls.Add(this.tabPage1);
this.availableTabControl.Controls.Add(this.tabPage2);
this.availableTabControl.Controls.Add(this.tabPage3);
this.availableTabControl.Enabled = false;
this.availableTabControl.Location = new System.Drawing.Point(9, 33);
this.availableTabControl.Name = "availableTabControl";
this.availableTabControl.SelectedIndex = 0;
this.availableTabControl.Size = new System.Drawing.Size(206, 453);
this.availableTabControl.TabIndex = 59;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.availableByQuantityTreeView);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(198, 427);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "A...Z";
this.tabPage1.UseVisualStyleBackColor = true;
//
// availableByQuantityTreeView
//
this.availableByQuantityTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.availableByQuantityTreeView.Location = new System.Drawing.Point(3, 3);
this.availableByQuantityTreeView.Name = "availableByQuantityTreeView";
this.availableByQuantityTreeView.Size = new System.Drawing.Size(192, 421);
this.availableByQuantityTreeView.TabIndex = 0;
this.availableByQuantityTreeView.DoubleClick += new System.EventHandler(this.availableByQuantityTreeView_DoubleClick);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.availableByCategoryTreeView);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(198, 427);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "by quantity";
this.tabPage2.UseVisualStyleBackColor = true;
//
// availableByCategoryTreeView
//
this.availableByCategoryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.availableByCategoryTreeView.Location = new System.Drawing.Point(3, 3);
this.availableByCategoryTreeView.Name = "availableByCategoryTreeView";
this.availableByCategoryTreeView.Size = new System.Drawing.Size(192, 421);
this.availableByCategoryTreeView.TabIndex = 0;
this.availableByCategoryTreeView.DoubleClick += new System.EventHandler(this.availableByCategoryTreeView_DoubleClick);
//
// tabPage3
//
this.tabPage3.Controls.Add(this.availableAlphabeticTreeView);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(198, 427);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "by category";
this.tabPage3.UseVisualStyleBackColor = true;
//
// availableAlphabeticTreeView
//
this.availableAlphabeticTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.availableAlphabeticTreeView.Location = new System.Drawing.Point(0, 0);
this.availableAlphabeticTreeView.Name = "availableAlphabeticTreeView";
this.availableAlphabeticTreeView.Size = new System.Drawing.Size(198, 427);
this.availableAlphabeticTreeView.TabIndex = 0;
this.availableAlphabeticTreeView.DoubleClick += new System.EventHandler(this.availableAlphabeticTreeView_DoubleClick);
//
// downButton
//
this.downButton.Enabled = false;
this.downButton.Location = new System.Drawing.Point(221, 351);
this.downButton.Name = "downButton";
this.downButton.Size = new System.Drawing.Size(93, 30);
this.downButton.TabIndex = 58;
this.downButton.Text = "Down";
this.downButton.UseVisualStyleBackColor = true;
this.downButton.Click += new System.EventHandler(this.downButton_Click);
//
// upButton
//
this.upButton.Enabled = false;
this.upButton.Location = new System.Drawing.Point(221, 315);
this.upButton.Name = "upButton";
this.upButton.Size = new System.Drawing.Size(93, 30);
this.upButton.TabIndex = 57;
this.upButton.Text = "Up";
this.upButton.UseVisualStyleBackColor = true;
this.upButton.Click += new System.EventHandler(this.upButton_Click);
//
// selectedResultsListViewEx
//
this.selectedResultsListViewEx.AllowColumnReorder = true;
this.selectedResultsListViewEx.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.selectedResultsListViewEx.DoubleClickActivation = false;
this.selectedResultsListViewEx.Enabled = false;
this.selectedResultsListViewEx.FullRowSelect = true;
this.selectedResultsListViewEx.GridLines = true;
this.selectedResultsListViewEx.Location = new System.Drawing.Point(322, 33);
this.selectedResultsListViewEx.Name = "selectedResultsListViewEx";
this.selectedResultsListViewEx.Size = new System.Drawing.Size(594, 453);
this.selectedResultsListViewEx.TabIndex = 56;
this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false;
this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details;
this.selectedResultsListViewEx.DoubleClick += new System.EventHandler(this.selectedResultsListViewEx_DoubleClick);
//
// removeAllButton
//
this.removeAllButton.Enabled = false;
this.removeAllButton.Location = new System.Drawing.Point(221, 223);
this.removeAllButton.Name = "removeAllButton";
this.removeAllButton.Size = new System.Drawing.Size(94, 30);
this.removeAllButton.TabIndex = 55;
this.removeAllButton.Text = "<< R&emove all";
this.removeAllButton.UseVisualStyleBackColor = true;
this.removeAllButton.Visible = false;
this.removeAllButton.Click += new System.EventHandler(this.removeAllButton_Click);
//
// removeButton
//
this.removeButton.Enabled = false;
this.removeButton.Location = new System.Drawing.Point(221, 188);
this.removeButton.Name = "removeButton";
this.removeButton.Size = new System.Drawing.Size(93, 30);
this.removeButton.TabIndex = 54;
this.removeButton.Text = "< &Remove";
this.removeButton.UseVisualStyleBackColor = true;
this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
//
// addButton
//
this.addButton.Enabled = false;
this.addButton.Location = new System.Drawing.Point(221, 153);
this.addButton.Name = "addButton";
this.addButton.Size = new System.Drawing.Size(93, 30);
this.addButton.TabIndex = 53;
this.addButton.Text = "&Add >";
this.addButton.UseVisualStyleBackColor = true;
this.addButton.Click += new System.EventHandler(this.addButton_Click);
//
// selectedItemsLabel
//
this.selectedItemsLabel.AutoSize = true;
this.selectedItemsLabel.Location = new System.Drawing.Point(321, 11);
this.selectedItemsLabel.Name = "selectedItemsLabel";
this.selectedItemsLabel.Size = new System.Drawing.Size(79, 13);
this.selectedItemsLabel.TabIndex = 52;
this.selectedItemsLabel.Text = "Selected items:";
//
// availableItemsLabel
//
this.availableItemsLabel.AutoSize = true;
this.availableItemsLabel.Location = new System.Drawing.Point(11, 11);
this.availableItemsLabel.Name = "availableItemsLabel";
this.availableItemsLabel.Size = new System.Drawing.Size(80, 13);
this.availableItemsLabel.TabIndex = 51;
this.availableItemsLabel.Text = "Available items:";
//
// ManualEntryConfigCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.availableTabControl);
this.Controls.Add(this.downButton);
this.Controls.Add(this.upButton);
this.Controls.Add(this.selectedResultsListViewEx);
this.Controls.Add(this.removeAllButton);
this.Controls.Add(this.removeButton);
this.Controls.Add(this.addButton);
this.Controls.Add(this.selectedItemsLabel);
this.Controls.Add(this.availableItemsLabel);
this.Name = "ManualEntryConfigCtrl";
this.Size = new System.Drawing.Size(925, 496);
this.Load += new System.EventHandler(this.ManualEntryConfigCtrl_Load);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ManualEntryConfigCtrl_KeyPress);
this.availableTabControl.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TabControl availableTabControl;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TreeView availableByQuantityTreeView;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TreeView availableByCategoryTreeView;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TreeView availableAlphabeticTreeView;
private System.Windows.Forms.Button downButton;
private System.Windows.Forms.Button upButton;
private ListViewEx selectedResultsListViewEx;
private System.Windows.Forms.Button removeAllButton;
private System.Windows.Forms.Button removeButton;
private System.Windows.Forms.Button addButton;
private System.Windows.Forms.Label selectedItemsLabel;
private System.Windows.Forms.Label availableItemsLabel;
}
}
-450
View File
@@ -1,450 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Config.Entities;
using Results.Resources;
namespace Results.Forms
{
public partial class ManualEntryConfigCtrl : UserControl
{
/// <summary>
/// ListViewEx columns
/// </summary>
enum Column
{
Item,
Caption,
Units,
Count,
}
Control[] editors; /// all editors except of units
ComboBox unitsCB; /// units combo box
public IList<ManualEntryItemSpec> SelectedItems;
public bool Unlocked
{
set
{
availableTabControl.Enabled = value;
selectedResultsListViewEx.Enabled = value;
addButton.Enabled = value;
removeButton.Enabled = value;
removeAllButton.Enabled = value;
upButton.Enabled = value;
downButton.Enabled = value;
unlocked = value;
}
get { return unlocked; }
}
bool unlocked;
public ManualEntryConfigCtrl()
{
InitializeComponent();
}
void Localize()
{
Text = Strings.Configuration;
availableItemsLabel.Text = Strings.Available_items;
availableTabControl.TabPages[0].Text = Strings.Quantity;
availableTabControl.TabPages[1].Text = Strings.Category;
availableTabControl.TabPages[2].Text = "A...Z";
selectedItemsLabel.Text = Strings.Selected_items;
addButton.Text = Strings.Add;
removeButton.Text = Strings.Remove;
removeAllButton.Text = Strings.Remove_all;
upButton.Text = Strings.UpBtnText;
downButton.Text = Strings.DownBtnText;
}
private void ManualEntryConfigCtrl_Load(object sender, EventArgs e)
{
Localize();
/// Add columns to ListViewEx
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Item, Width = 120 });
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Caption });
selectedResultsListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Units });
/// Create controls used by ListViewEx to edit items
unitsCB = new ComboBox();
ComboBox alignmentCB = new ComboBox();
for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++)
{
alignmentCB.Items.Add(a.ToDescription());
}
editors = new Control[]
{
null,
new TextBox(), /// caption
unitsCB,
};
foreach (var edi in editors)
{
if (edi != null)
{
edi.Visible = false;
Controls.Add(edi);
}
}
selectedResultsListViewEx.SubItemClicked += new SubItemEventHandler(selectedResultsListViewEx_SubItemClicked);
selectedResultsListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(selectedResultsListViewEx_SubItemEndEditing);
availableByQuantityTreeView.ShowNodeToolTips = true;
availableByCategoryTreeView.ShowNodeToolTips = true;
availableAlphabeticTreeView.ShowNodeToolTips = true;
RedrawAvailable();
RedrawSelected();
}
void selectedResultsListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (e.SubItem == (int)Column.Units)
{
Config.Quantity quantity = (e.Item.Tag as ManualEntryItemSpec).Quantity;
unitsCB.Items.Clear();
unitsCB.Items.Add(Config.Unit.None.ToDescription()); /// "---"
for (Config.Unit u = (Config.Unit)1; u < Config.Unit.Count; u++)
{
if (Config.Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription());
}
selectedResultsListViewEx.StartEditing(unitsCB, e.Item, e.SubItem);
}
else if ((e.SubItem > 0) && (e.SubItem < (int)Column.Count))
{
selectedResultsListViewEx.StartEditing(editors[e.SubItem], e.Item, e.SubItem);
}
}
void selectedResultsListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
{
ListViewItem lvi = e.Item;
ManualEntryItemSpec item = lvi.Tag as ManualEntryItemSpec;
switch ((Column)e.SubItem)
{
case Column.Caption: item.Caption = e.DisplayText; return;
case Column.Units:
for (Config.Unit u = 0; u < Config.Unit.Count; u++)
{
if (u.ToDescription().Equals(unitsCB.Text))
{
item.Units = u;
return; /// OK
}
}
break; /// Error
default:
return; /// OK
}
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
/// <summary>
/// Redraw available items (right hand side)
/// </summary>
void RedrawAvailable()
{
RedrawByQuantity(availableByQuantityTreeView);
RedrawByCategory(availableByCategoryTreeView);
RedrawInAlphabeticOrder(availableAlphabeticTreeView);
}
void RedrawInAlphabeticOrder(TreeView treeView)
{
treeView.Nodes.Clear();
IList<ManualEntryItemSpec> alphabeticlList = ManualEntryItemSpec.AllItems.OrderBy(x => x.Name).ToList();
///
foreach (var item in alphabeticlList)
{
TreeNode node = new TreeNode(item.Name);
node.Tag = item;
node.ToolTipText = item.ToolTipText;
treeView.Nodes.Add(node);
}
}
void RedrawByQuantity(TreeView treeView)
{
treeView.Nodes.Clear();
IList<Config.Quantity> quantities = new List<Config.Quantity>();
for (Config.Quantity q = 0; q < Config.Quantity.Count; q++) quantities.Add(q);
IList<Config.Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList();
foreach (var q in sortedQuantities)
{
int n = 0;
foreach (var ri in ManualEntryItemSpec.AllItems)
{
if (ri.Quantity == q) n++;
}
if (n > 0)
{
TreeNode[] array = new TreeNode[n];
int i = 0;
foreach (var ri in ManualEntryItemSpec.AllItems)
{
if (ri.Quantity == q)
{
TreeNode node = new TreeNode(ri.Name);
node.Tag = ri;
node.ToolTipText = ri.ToolTipText;
array[i++] = node;
}
}
treeView.Nodes.Add(new TreeNode(q.ToDescription(), array));
}
}
}
void RedrawByCategory(TreeView treeView)
{
treeView.Nodes.Clear();
IList<ItemCategory> categories = new List<ItemCategory>();
for (ItemCategory c = 0; c < ItemCategory.Count; c++) categories.Add(c);
IList<ItemCategory> sortedCategories = categories.OrderBy(x => x.ToDescription()).ToList();
foreach (var c in sortedCategories)
{
int n = 0;
foreach (var ri in ManualEntryItemSpec.AllItems)
{
if (ri.Category == c) n++;
}
if (n > 0)
{
TreeNode[] array = new TreeNode[n];
int i = 0;
foreach (var ri in ManualEntryItemSpec.AllItems)
{
if (ri.Category == c)
{
TreeNode node = new TreeNode(ri.Name);
node.Tag = ri;
node.ToolTipText = ri.ToolTipText;
array[i++] = node;
}
}
treeView.Nodes.Add(new TreeNode(c.ToDescription(), array));
}
}
}
/// <summary>
/// Redraw selected items (right hand side)
/// </summary>
void RedrawSelected()
{
selectedResultsListViewEx.Items.Clear();
if (SelectedItems == null) return;
foreach (var item in SelectedItems)
{
ListViewItem lvi = new ListViewItem(item.Name); /// Item
lvi.Tag = item;
lvi.SubItems.Add(item.Caption); /// Header
lvi.SubItems.Add(item.Units.ToDescription()); /// Units
selectedResultsListViewEx.Items.Add(lvi);
}
}
void UpdateSelectedFromView()
{
}
void addButton_Click(object sender, EventArgs e)
{
switch (availableTabControl.SelectedIndex)
{
case 0:
availableByQuantityTreeView_DoubleClick(this, null);
break;
case 1:
availableByCategoryTreeView_DoubleClick(this, null);
break;
case 2:
availableAlphabeticTreeView_DoubleClick(this, null);
break;
default:
break;
}
}
private void availableByQuantityTreeView_DoubleClick(object sender, EventArgs e)
{
if (availableByQuantityTreeView.SelectedNode != null &&
availableByQuantityTreeView.SelectedNode.Tag is ManualEntryItemSpec)
{
AddItem(availableByQuantityTreeView.SelectedNode.Tag as ManualEntryItemSpec);
}
}
private void availableByCategoryTreeView_DoubleClick(object sender, EventArgs e)
{
if (availableByCategoryTreeView.SelectedNode != null &&
availableByCategoryTreeView.SelectedNode.Tag is ManualEntryItemSpec)
{
AddItem(availableByCategoryTreeView.SelectedNode.Tag as ManualEntryItemSpec);
}
}
private void availableAlphabeticTreeView_DoubleClick(object sender, EventArgs e)
{
if (availableAlphabeticTreeView.SelectedNode != null &&
availableAlphabeticTreeView.SelectedNode.Tag is ManualEntryItemSpec)
{
AddItem(availableAlphabeticTreeView.SelectedNode.Tag as ManualEntryItemSpec);
}
}
void AddItem(ManualEntryItemSpec item)
{
ManualEntryItemSpec newItem = item.Clone();
newItem.Caption = newItem.Name;
SelectedItems.Add(newItem);
RedrawSelected();
/// Select the last item
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[SelectedItems.Count - 1].Selected = true;
selectedResultsListViewEx.Items[SelectedItems.Count - 1].EnsureVisible();
}
private void selectedResultsListViewEx_DoubleClick(object sender, EventArgs e)
{
/// Double click works when just one item is selected
if (selectedResultsListViewEx.SelectedIndices.Count == 1)
{
SelectedItems.RemoveAt(selectedResultsListViewEx.SelectedIndices[0]);
RedrawAvailable();
RedrawSelected();
}
}
void removeButton_Click(object sender, EventArgs e)
{
/// Remove from the list (the last selected item first so that the indexes are not affected)
for (int i = selectedResultsListViewEx.SelectedIndices.Count - 1; i >= 0; i--)
{
SelectedItems.RemoveAt(selectedResultsListViewEx.SelectedIndices[i]);
}
RedrawAvailable();
RedrawSelected();
}
void removeAllButton_Click(object sender, EventArgs e)
{
/// Remove all items from 'Selected' list
SelectedItems.Clear();
RedrawAvailable();
RedrawSelected();
}
//void okButton_Click(object sender, EventArgs e)
//{
// DialogResult = DialogResult.OK;
// Close();
//}
private void ManualEntryConfigCtrl_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
private void upButton_Click(object sender, EventArgs e)
{
if (selectedResultsListViewEx.SelectedIndices.Count != 1) return;
int selIdx = selectedResultsListViewEx.SelectedIndices[0];
if (selIdx == 0)
{
/// Cannot move up
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[0].Selected = true;
return;
}
ManualEntryItemSpec tmp = SelectedItems[selIdx - 1];
SelectedItems[selIdx - 1] = SelectedItems[selIdx];
SelectedItems[selIdx] = tmp;
RedrawSelected();
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[selIdx - 1].Selected = true;
selectedResultsListViewEx.Items[selIdx - 1].EnsureVisible();
}
private void downButton_Click(object sender, EventArgs e)
{
if (selectedResultsListViewEx.SelectedIndices.Count != 1) return;
int selIdx = selectedResultsListViewEx.SelectedIndices[0];
if (selIdx == SelectedItems.Count - 1)
{
/// Cannot move down
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[SelectedItems.Count - 1].Selected = true;
return;
}
ManualEntryItemSpec tmp = SelectedItems[selIdx + 1];
SelectedItems[selIdx + 1] = SelectedItems[selIdx];
SelectedItems[selIdx] = tmp;
RedrawSelected();
selectedResultsListViewEx.Focus();
selectedResultsListViewEx.Items[selIdx + 1].Selected = true;
selectedResultsListViewEx.Items[selIdx + 1].EnsureVisible();
}
//private void cancelButton_Click(object sender, EventArgs e)
//{
// DialogResult = DialogResult.Cancel;
// Close();
//}
private void availableByCategoryTreeView_NodeMouseHover2(object sender, TreeNodeMouseHoverEventArgs e)
{
ToolTip toolTip = new ToolTip();
toolTip.SetToolTip(this, e.Node.ToolTipText);
}
}
}
-60
View File
@@ -1,60 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results;
using Results.Resources;
namespace Results.Forms
{
public partial class ManualEntryConfigDlg : Form
{
public IList<ManualEntryItemSpec> SelectedItems
{
set { manualEntryConfigCtrl.SelectedItems = value; }
get { return manualEntryConfigCtrl.SelectedItems; }
}
public ManualEntryConfigDlg()
{
InitializeComponent();
manualEntryConfigCtrl.Unlocked = true;
}
void Localize()
{
Text = Strings.Configuration;
okButton.Text = Strings.OkBtnText;
cancelButton.Text = Strings.CancelBtnText;
}
void ManualEntryConfig_Load(object sender, EventArgs e)
{
Localize();
}
void okButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void ManualEntryConfigDlg_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
}
}
-95
View File
@@ -1,95 +0,0 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
///
namespace Results.Forms
{
partial class ManualEntryConfigDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.manualEntryConfigCtrl = new Results.Forms.ManualEntryConfigCtrl();
this.SuspendLayout();
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(939, 29);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(105, 42);
this.okButton.TabIndex = 4;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(939, 82);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(105, 42);
this.cancelButton.TabIndex = 5;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// manualEntryConfigCtrl
//
this.manualEntryConfigCtrl.Location = new System.Drawing.Point(-1, 1);
this.manualEntryConfigCtrl.Name = "manualEntryConfigCtrl";
this.manualEntryConfigCtrl.Size = new System.Drawing.Size(925, 496);
this.manualEntryConfigCtrl.TabIndex = 6;
this.manualEntryConfigCtrl.Unlocked = false;
//
// ManualEntryConfigDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1066, 498);
this.Controls.Add(this.manualEntryConfigCtrl);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "ManualEntryConfigDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "ManualEntryConfig";
this.Load += new System.EventHandler(this.ManualEntryConfig_Load);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ManualEntryConfigDlg_KeyPress);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private ManualEntryConfigCtrl manualEntryConfigCtrl;
}
}
-164
View File
@@ -1,164 +0,0 @@
namespace Results.Forms
{
partial class MoreWMResultsDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.graphsTabPage = new System.Windows.Forms.TabPage();
this.productionTracingTabPage = new System.Windows.Forms.TabPage();
this.productionTracingSplitContainer = new System.Windows.Forms.SplitContainer();
this.messageLabel = new System.Windows.Forms.Label();
this.tracingResultsListView = new System.Windows.Forms.ListView();
this.allResultsTabPage = new System.Windows.Forms.TabPage();
this.tabControl1.SuspendLayout();
this.productionTracingTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).BeginInit();
this.productionTracingSplitContainer.Panel1.SuspendLayout();
this.productionTracingSplitContainer.Panel2.SuspendLayout();
this.productionTracingSplitContainer.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.allResultsTabPage);
this.tabControl1.Controls.Add(this.graphsTabPage);
this.tabControl1.Controls.Add(this.productionTracingTabPage);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1195, 448);
this.tabControl1.TabIndex = 0;
//
// graphsTabPage
//
this.graphsTabPage.Location = new System.Drawing.Point(4, 22);
this.graphsTabPage.Name = "graphsTabPage";
this.graphsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.graphsTabPage.Size = new System.Drawing.Size(1187, 422);
this.graphsTabPage.TabIndex = 1;
this.graphsTabPage.Text = "Graphs";
this.graphsTabPage.UseVisualStyleBackColor = true;
//
// productionTracingTabPage
//
this.productionTracingTabPage.Controls.Add(this.productionTracingSplitContainer);
this.productionTracingTabPage.Location = new System.Drawing.Point(4, 22);
this.productionTracingTabPage.Name = "productionTracingTabPage";
this.productionTracingTabPage.Size = new System.Drawing.Size(1187, 422);
this.productionTracingTabPage.TabIndex = 2;
this.productionTracingTabPage.Text = "Production tracing";
this.productionTracingTabPage.UseVisualStyleBackColor = true;
//
// productionTracingSplitContainer
//
this.productionTracingSplitContainer.BackColor = System.Drawing.SystemColors.Control;
this.productionTracingSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.productionTracingSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.productionTracingSplitContainer.IsSplitterFixed = true;
this.productionTracingSplitContainer.Location = new System.Drawing.Point(0, 0);
this.productionTracingSplitContainer.Name = "productionTracingSplitContainer";
this.productionTracingSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// productionTracingSplitContainer.Panel1
//
this.productionTracingSplitContainer.Panel1.Controls.Add(this.messageLabel);
this.productionTracingSplitContainer.Panel1MinSize = 55;
//
// productionTracingSplitContainer.Panel2
//
this.productionTracingSplitContainer.Panel2.Controls.Add(this.tracingResultsListView);
this.productionTracingSplitContainer.Panel2MinSize = 60;
this.productionTracingSplitContainer.Size = new System.Drawing.Size(1187, 422);
this.productionTracingSplitContainer.SplitterDistance = 55;
this.productionTracingSplitContainer.SplitterWidth = 1;
this.productionTracingSplitContainer.TabIndex = 0;
//
// messageLabel
//
this.messageLabel.AutoSize = true;
this.messageLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.messageLabel.Location = new System.Drawing.Point(12, 9);
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size(152, 37);
this.messageLabel.TabIndex = 1;
this.messageLabel.Text = "Message";
//
// tracingResultsListView
//
this.tracingResultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.tracingResultsListView.GridLines = true;
this.tracingResultsListView.Location = new System.Drawing.Point(0, 0);
this.tracingResultsListView.Name = "tracingResultsListView";
this.tracingResultsListView.Size = new System.Drawing.Size(1187, 366);
this.tracingResultsListView.TabIndex = 0;
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
//
// allResultsTabPage
//
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
this.allResultsTabPage.Name = "allResultsTabPage";
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
this.allResultsTabPage.TabIndex = 0;
this.allResultsTabPage.Text = "All results";
this.allResultsTabPage.UseVisualStyleBackColor = true;
//
// MoreWMResultsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1195, 448);
this.Controls.Add(this.tabControl1);
this.Name = "MoreWMResultsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Water meter results";
this.tabControl1.ResumeLayout(false);
this.productionTracingTabPage.ResumeLayout(false);
this.productionTracingSplitContainer.Panel1.ResumeLayout(false);
this.productionTracingSplitContainer.Panel1.PerformLayout();
this.productionTracingSplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).EndInit();
this.productionTracingSplitContainer.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private OneWMResultsRowsCtrl oneWMResultsCtrl;
private System.Windows.Forms.TabPage graphsTabPage;
private System.Windows.Forms.TabPage productionTracingTabPage;
private System.Windows.Forms.SplitContainer productionTracingSplitContainer;
private System.Windows.Forms.Label messageLabel;
private System.Windows.Forms.ListView tracingResultsListView;
private System.Windows.Forms.TabPage allResultsTabPage;
}
}
-188
View File
@@ -1,188 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using TracingDB.Entities;
using Results.Resources;
using Config.Entities;
using System.Drawing;
using System.Windows.Forms.DataVisualization.Charting;
namespace Results.Forms
{
public partial class MoreWMResultsDlg : Form
{
public MoreWMResultsDlg(Results.Entities.WaterMeter wm, IList<ReferenceRecord> refRecords)
{
InitializeComponent();
Localize();
ShowAllResults(wm);
ShowChart(wm);
if (refRecords == null)
{
tabControl1.SelectTab(1);
tabControl1.TabPages.RemoveAt(2);
}
else
{
tabControl1.SelectTab(2);
ShowTracingResults(wm, refRecords);
}
}
void Localize()
{
Text = Strings.Water_meter_results;
tabControl1.TabPages[0].Text = Strings.All_results;
tabControl1.TabPages[1].Text = Strings.Graphs;
tabControl1.TabPages[2].Text = Strings.Production_tracing_results;
}
/// <summary>
/// Display all results for this water meter in the 1st tab page
/// </summary>
/// <param name="wMtr">Water meter entity</param>
void ShowAllResults(Results.Entities.WaterMeter wMtr)
{
// string message;
// Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
//#if ORACLE_DB
// oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
//#else
// oneWMResultsCtrl.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
//#endif
// IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
// // Header
// oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
// int i = 1;
// foreach (var str in wMtr.GetAllDecoratedTestNames())
// {
// oneWMResultsCtrl.Columns.Add(str, 100);
// i++;
// }
// foreach (var item in items)
// {
// ListViewItem lvi = new ListViewItem(item.Name);
// foreach (var mtr in wMtr.MeterTestRslts)
// {
// if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
// mtr.Publish() != Config.Entities.Publish.Internal)
// {
// string str = item.Print(wMtr, mtr.Name());
// string[] texts = str.Split(new char[] { '|' });
// if (texts.Length == 1)
// {
// lvi.SubItems.Add(str);
// }
// else if (texts.Length == 2)
// {
// Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
// lvi.UseItemStyleForSubItems = false;
// lvi.SubItems.Add(texts[0]);
// lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
// }
// else
// {
// lvi.SubItems.Add(string.Empty);
// }
// }
// }
// oneWMResultsCtrl.Items.Add(lvi);
// }
}
void ShowChart(Results.Entities.WaterMeter wm)
{
//chart.ChartAreas[0].AxisX.LabelStyle.Format = "dd.MM.yy";
//chart.ChartAreas[0].AxisX.Interval = 1;
//chart.ChartAreas[0].AxisX.IntervalType = ;
tabControl1.TabPages[1].Controls.Add(Results.Output.WMChart.GetChart(wm, false));
}
/// <summary>
/// Display tracing results in the 3rd tab page
/// </summary>
/// <param name="wm">Water meter entity</param>
/// <param name="refRecords">ReferenceRecord-s from tracing DB</param>
void ShowTracingResults(Results.Entities.WaterMeter wm, IList<ReferenceRecord> refRecords)
{
tracingResultsListView.Columns.Add(Strings.Date_and_time, 110);
tracingResultsListView.Columns.Add(Strings.Step, 100);
tracingResultsListView.Columns.Add(Strings.Workplace, 100);
tracingResultsListView.Columns.Add(Strings.Name, 100);
tracingResultsListView.Columns.Add(Strings.Result, 70);
tracingResultsListView.Columns.Add(Strings.Part, 90);
tracingResultsListView.Columns.Add(Strings.Code, 150);
tracingResultsListView.Columns.Add(Strings.Workflow, 450);
if (refRecords == null || refRecords.Count == 0)
{
messageLabel.Text = "V sledovaní výroby nie sú žiadne záznamy";
}
else
{
Process proc = refRecords[0].Process;
bool[] isMissing = new bool[proc.Worksteps.Count];
for (int i = 0; i < isMissing.Length; i++) isMissing[i] = true;
foreach (var rr in refRecords)
{
tracingResultsListView.Items.Add(new ListViewItem(new string[]
{
rr.TimeStamp.ToString("dd.MM.yyyy HH:mm"),
(rr.Workstep != null) ? rr.Workstep.Name : string.Empty,
rr.Workplace,
rr.UserName,
rr.Result == 0 ? "OK" : "NOK",
(rr.Workstep != null && rr.Workstep.ReferencePart != null) ? rr.Workstep.ReferencePart.Name : string.Empty,
rr.Code,
(rr.Process != null) ? rr.Process.Name : string.Empty,
}));
for (int i = 0; i < isMissing.Length; i++)
{
if (proc.Worksteps[i] == rr.Workstep) isMissing[i] = false;
}
}
string missingWorkplace = null;
for (int i = 0; i < isMissing.Length; i++)
{
if (isMissing[i])
{
if (missingWorkplace == null)
{
missingWorkplace = proc.Worksteps[i].Name;
messageLabel.Text = string.Format("Chýba záznam z pracoviska {0}", missingWorkplace);
}
else
{
messageLabel.Text = string.Format("Chýba záznam z pracoviska {0} aj z nasledujúcich pracovísk", missingWorkplace);
}
}
}
if (missingWorkplace == null)
{
messageLabel.Text = "Všetko je OK";
}
}
}
}
}
-103
View File
@@ -1,103 +0,0 @@
namespace Results.Forms
{
partial class OneWMResultsColumnsCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tBox = new System.Windows.Forms.TextBox();
this.lView = new System.Windows.Forms.ListView();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tBox);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.lView);
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.SplitterDistance = 25;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
// tBox
//
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.tBox.Location = new System.Drawing.Point(0, 0);
this.tBox.Name = "tBox";
this.tBox.Size = new System.Drawing.Size(352, 20);
this.tBox.TabIndex = 0;
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
//
// lView
//
this.lView.Dock = System.Windows.Forms.DockStyle.Fill;
this.lView.FullRowSelect = true;
this.lView.GridLines = true;
this.lView.Location = new System.Drawing.Point(0, 0);
this.lView.Name = "lView";
this.lView.Size = new System.Drawing.Size(352, 292);
this.lView.TabIndex = 0;
this.lView.UseCompatibleStateImageBehavior = false;
this.lView.View = System.Windows.Forms.View.Details;
//
// OneWMResultsCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "OneWMResultsCtrl";
this.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox tBox;
private System.Windows.Forms.ListView lView;
}
}
-159
View File
@@ -1,159 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
namespace Results.Forms
{
public partial class OneWMResultsColumnsCtrl : UserControl, IOneWMResultsCtrl
{
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
///
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
try
{
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
}
catch (Exception)
{
}
}
bool disabled;
int wmPosition; /// 1-based water meter position
string caption;
Color bkColor;
int[] columnWidths;
IList<Results.WMeterRsltItemSpec> items;
public bool Disabled { get { return disabled; } } /// Read only
public int WMPosition { get { return wmPosition; } } /// Read only
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
public OneWMResultsColumnsCtrl()
{
InitializeComponent();
disabled = false;
wmPosition = 0;
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
items = new List<Results.WMeterRsltItemSpec>();
columnWidths = new int[0];
}
public void Update(int[] columnWidths)
{
this.columnWidths = columnWidths;
/// Always update ListView column widths
int col = 0;
foreach (ColumnHeader column in lView.Columns)
{
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
col++;
}
}
public void Update(IList<Results.WMeterRsltItemSpec> items)
{
this.items = items;
}
public void Update(Results.Entities.WaterMeter wMtr)
{
if (wMtr == null || wMtr.Disabled)
{
/// Water meter position is disabled
this.disabled = true;
lView.Items.Clear();
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
return;
}
/// Update background color
string message = string.Empty;
Update(wMtr.GetColorOfResults(false, out message));
/// Update caption
#if ORACLE_DB
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
/// Header
lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
int col = 1;
foreach (var str in wMtr.GetAllDecoratedTestNames())
{
lView.Columns.Add(str, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
col++;
}
lView.Items.Clear();
if (items == null || items.Count == 0) return;
foreach (var item in items)
{
ListViewItem lvi = new ListViewItem(item.Caption);
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
mtr.Publish() != Config.Entities.Publish.Internal)
{
string str = item.Print(wMtr, mtr.Name());
string[] texts = str.Split(new char[] { '|' });
if (texts.Length == 1)
{
lvi.SubItems.Add(str);
}
else if (texts.Length == 2)
{
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(texts[0]);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
}
else
{
lvi.SubItems.Add(string.Empty);
}
}
}
lView.Items.Add(lvi);
}
}
///
/// Private
///
void Update(int wmPosition)
{
this.wmPosition = wmPosition;
if (lView.Columns.Count > 0)
{
lView.Columns[0].Text = wmPosition.ToString();
}
}
void Update(Color backColor)
{
if (this.bkColor != backColor)
{
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
}
}
}
}
-103
View File
@@ -1,103 +0,0 @@
namespace Results.Forms
{
partial class OneWMResultsRowsCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tBox = new System.Windows.Forms.TextBox();
this.lView = new System.Windows.Forms.ListView();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tBox);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.lView);
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.SplitterDistance = 25;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
// tBox
//
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.tBox.Location = new System.Drawing.Point(0, 0);
this.tBox.Name = "tBox";
this.tBox.Size = new System.Drawing.Size(352, 20);
this.tBox.TabIndex = 0;
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
//
// lView
//
this.lView.Dock = System.Windows.Forms.DockStyle.Fill;
this.lView.FullRowSelect = true;
this.lView.GridLines = true;
this.lView.Location = new System.Drawing.Point(0, 0);
this.lView.Name = "lView";
this.lView.Size = new System.Drawing.Size(352, 292);
this.lView.TabIndex = 0;
this.lView.UseCompatibleStateImageBehavior = false;
this.lView.View = System.Windows.Forms.View.Details;
//
// OneWMResultsCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "OneWMResultsCtrl";
this.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox tBox;
private System.Windows.Forms.ListView lView;
}
}
-169
View File
@@ -1,169 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
namespace Results.Forms
{
public partial class OneWMResultsRowsCtrl : UserControl, IOneWMResultsCtrl
{
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
///
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
try
{
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
}
catch (Exception)
{
}
}
bool disabled;
int wmPosition; /// 1-based water meter position
string caption;
Color bkColor;
int[] columnWidths;
IList<Results.WMeterRsltItemSpec> items;
public bool Disabled { get { return disabled; } } /// Read only
public int WMPosition { get { return wmPosition; } } /// Read only
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
public OneWMResultsRowsCtrl()
{
InitializeComponent();
disabled = false;
wmPosition = 0;
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
items = new List<Results.WMeterRsltItemSpec>();
columnWidths = new int[0];
}
public void Update(int[] columnWidths)
{
this.columnWidths = columnWidths;
/// Always update ListView column widths
int col = 0;
foreach (ColumnHeader column in lView.Columns)
{
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
col++;
}
}
public void Update(IList<Results.WMeterRsltItemSpec> items)
{
this.items = items;
/// Always draw ListView header
lView.Columns.Clear();
lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
if (items == null || items.Count == 0) return;
int col = 1;
foreach (var item in items)
{
lView.Columns.Add(item.Caption, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
col++;
}
}
public void Update(Results.Entities.WaterMeter wMtr)
{
if (wMtr == null || wMtr.Disabled)
{
/// Water meter position is disabled
this.disabled = true;
lView.Items.Clear();
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
return;
}
/// Update background color
string message = string.Empty;
Update(wMtr.GetColorOfResults(false, out message));
/// Update caption
#if ORACLE_DB
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
Update(wMtr.WMPosition);
/// Update test results
IList<string> testNames = wMtr.GetAllDecoratedTestNames();
int ix = 0;
lView.Items.Clear();
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
&& mtr.Publish() != Config.Entities.Publish.Internal)
{
ListViewItem lvi = new ListViewItem(testNames[ix++]);
if (items != null)
{
for (int i = 0; i < items.Count; i++)
{
string str = items[i].Print(wMtr, mtr.Name());
/// Extract and use color information
string[] texts = str.Split(new char[] { '|' });
if (texts.Length == 1)
{
lvi.SubItems.Add(str);
}
else if (texts.Length == 2)
{
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(texts[0]);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
}
else
{
lvi.SubItems.Add(string.Empty);
}
}
}
lView.Items.Add(lvi);
}
}
}
///
/// Private
///
void Update(int wmPosition)
{
this.wmPosition = wmPosition;
if (lView.Columns.Count > 0)
{
lView.Columns[0].Text = wmPosition.ToString();
}
}
void Update(Color backColor)
{
if (this.bkColor != backColor)
{
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
}
}
}
}
-65
View File
@@ -1,65 +0,0 @@
namespace Results.Forms
{
partial class TracingResultsDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tracingResultsListView = new System.Windows.Forms.ListView();
this.SuspendLayout();
//
// tracingResultsListView
//
this.tracingResultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.tracingResultsListView.GridLines = true;
this.tracingResultsListView.Location = new System.Drawing.Point(0, 0);
this.tracingResultsListView.Name = "tracingResultsListView";
this.tracingResultsListView.Size = new System.Drawing.Size(1228, 178);
this.tracingResultsListView.TabIndex = 0;
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
//
// TracingResultsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1228, 178);
this.Controls.Add(this.tracingResultsListView);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TracingResultsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "TracingResultsDlg";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView tracingResultsListView;
}
}
-44
View File
@@ -1,44 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using TracingDB.Entities;
using Results.Resources;
namespace Results.Forms
{
public partial class TracingResultsDlg : Form
{
public TracingResultsDlg(IList<ReferenceRecord> rRecords)
{
InitializeComponent();
Text = Strings.Production_tracing_results;
tracingResultsListView.Columns.Add(Strings.Date_and_time, 110);
tracingResultsListView.Columns.Add(Strings.Step, 100);
tracingResultsListView.Columns.Add(Strings.Workplace, 100);
tracingResultsListView.Columns.Add(Strings.Name, 100);
tracingResultsListView.Columns.Add(Strings.Result, 70);
tracingResultsListView.Columns.Add(Strings.Part, 90);
tracingResultsListView.Columns.Add(Strings.Code, 150);
tracingResultsListView.Columns.Add(Strings.Workflow, 450);
foreach (var rr in rRecords)
{
tracingResultsListView.Items.Add(new ListViewItem(new string[] {
rr.TimeStamp.ToString("dd.MM.yyyy HH:mm"),
rr.Workstep.Name,
rr.Workplace,
rr.UserName,
rr.Result == 0 ? "OK" : "NOK",
rr.Workstep.ReferencePart.Name,
rr.Code,
rr.Process.Name,
}));
}
}
}
}
-14
View File
@@ -1,14 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace Results.Forms
{
public class WaterMeterEventArgs : EventArgs
{
public int WMPosition;
public WaterMeterEventArgs(int wmPosition) { WMPosition = wmPosition; }
}
}
+71 -118
View File
@@ -91,85 +91,85 @@ namespace Results
T_Lo_start, /// 81 T_Lo_start, /// 81
T_Lo_end, /// 82 T_Lo_end, /// 82
T_Lo_avg, /// 83 T_Lo_avg, /// 83
P_delta_mean, /// 84 P_delta_mean, /// 84
P_delta_start, /// 85 P_delta_start, /// 85
P_delta_end, /// 86 P_delta_end, /// 86
Meter_type, /// 87 Single, Compound or HeatMeter Meter_type, /// 87 Single, Compound or HeatMeter
Volume_main, /// 88 Volume_main, /// 88
Volume_aux, /// 89 Volume_aux, /// 89
Start_volume, /// 90 Start_volume, /// 90
Start_volume_main, /// 91 Start_volume_main, /// 91
Start_volume_aux, /// 92 Start_volume_aux, /// 92
End_volume, /// 93 End_volume, /// 93
End_volume_main, /// 94 End_volume_main, /// 94
End_volume_aux, /// 95 End_volume_aux, /// 95
Error_main, /// 96 Error_main, /// 96
Error_aux, /// 97 Error_aux, /// 97
Serial_Nr_main, /// 98 Serial_Nr_main, /// 98
Serial_Nr_aux, /// 99 Serial_Nr_aux, /// 99
End_state_main, /// 100 End_state_main, /// 100
End_state_aux, /// 101 End_state_aux, /// 101
Q_rise, /// 102 Q_rise, /// 102
Q_fall, /// 103 Q_fall, /// 103
/// iPerl /// iPerl
OrigCalibFactor, /// 104 OrigCalibFactor, /// 104
CalibFactor, /// 105 CalibFactor, /// 105
Q2ErrWOCorrection, /// 106 Q2ErrWOCorrection, /// 106
Q2CorrectionDone, /// 107 Q2CorrectionDone, /// 107
Q2CorrRFlow, /// 108 Q2CorrRFlow, /// 108
Q2CorrLFlow, /// 109 Q2CorrLFlow, /// 109
Q2CorrFlowRight, /// 110 Q2CorrFlowRight, /// 110
Q_ref_mean, /// 111 Q_ref_mean, /// 111
T_up_start, /// 112 T_up_start, /// 112
T_up_end, /// 113 T_up_end, /// 113
T_up_avg, /// 114 T_up_avg, /// 114
T_down_start, /// 115 T_down_start, /// 115
T_down_end, /// 116 T_down_end, /// 116
T_down_avg, /// 117 T_down_avg, /// 117
T_div_start, /// 118 T_div_start, /// 118
T_div_end, /// 119 T_div_end, /// 119
T_div_avg, /// 120 T_div_avg, /// 120
P_up_avg, /// 121 P_up_avg, /// 121
P_down_avg, /// 122 P_down_avg, /// 122
P_delta_avg, /// 123 P_delta_avg, /// 123
TestDone, /// 124 TestDone, /// 124
TestPassed, /// 125 TestPassed, /// 125
/// iPerl /// iPerl
FW_Version, /// 126 FW_Version, /// 126
Mass_start_raw, /// 127 Mass_start_raw, /// 127
Mass_start, /// 128 Mass_start, /// 128
Mass_end_raw, /// 129 Mass_end_raw, /// 129
Mass_end, /// 130 Mass_end, /// 130
Mass, /// 131 Mass, /// 131
Buoyancy, /// 132 Buoyancy, /// 132
Density_correction, /// 133 Density_correction, /// 133
ErrorFlags, /// 134 ErrorFlags, /// 134
E1, /// 135 E1, /// 135
E2, /// 136 E2, /// 136
E3, /// 137 E3, /// 137
E4, /// 138 E4, /// 138
E5, /// 139 E5, /// 139
E6, /// 140 E6, /// 140
E7, /// 141 E7, /// 141
E8, /// 142 E8, /// 142
E9, /// 143 E9, /// 143
E10, /// 144 E10, /// 144
E11, /// 145 E11, /// 145
E12, /// 146 E12, /// 146
E13, /// 147 E13, /// 147
E14, /// 148 E14, /// 148
E15, /// 149 E15, /// 149
E16, /// 150 E16, /// 150
Table_row_nr, /// 151 Table_row_nr, /// 151
Table_column_nr, /// 152 Table_column_nr, /// 152
WMRemark, /// 153 WMRemark, /// 153
User_description, /// 154 User_description, /// 154
Legalizator, /// 155 Legalizator, /// 155
@@ -181,7 +181,7 @@ namespace Results
Diverter_start_time, /// 159 Diverter_start_time, /// 159
Diverter_end_time, /// 160 Diverter_end_time, /// 160
Q_sensitivity, /// 161 Q_sensitivity, /// 161
Q_ref_min, /// 162 Q_ref_min, /// 162
Q_ref_max, /// 163 Q_ref_max, /// 163
Q_ref_start, /// 164 Q_ref_start, /// 164
@@ -210,7 +210,7 @@ namespace Results
Rho_Wa_calc, /// 183 Rho_Wa_calc, /// 183
Formatted_WM_ID, /// 184, Formated WM ID string: Formatted_WM_ID, /// 184, Formated WM ID string:
/// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string /// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string
E21, /// 185 E21, /// 185
T_line_mean, /// 186 T_line_mean, /// 186
@@ -262,7 +262,7 @@ namespace Results
Bench_address5, /// 227 'Address 5' from IBenchInfo Bench_address5, /// 227 'Address 5' from IBenchInfo
Max_test_index, /// 228 MaxPruefindex % 100 Max_test_index, /// 228 MaxPruefindex % 100
VolumeCTV, /// 229 VolumeCTV, /// 229
/// iPerl /// iPerl
LastError, /// 230 For iPerl previous test result (test with Proefindex-1) LastError, /// 230 For iPerl previous test result (test with Proefindex-1)
@@ -270,54 +270,7 @@ namespace Results
CalibFactorLNA, /// 232 CalibFactorLNA, /// 232
WM_remark, /// 233 WM_remark, /// 233
/// iPerl special
Prod_AssignedSerialNr, /// 234
Prod_CompleteSerialNr, /// 235
Prod_RadioAddress, /// 236
Prod_PaletteNr, /// 237
Prod_UmkartonNr, /// 238
Prod_TestBench, /// 239
Prod_WMPosition, /// 240
Prod_UserName, /// 241
Prod_PurchaseOrder, /// 242
Prod_Passed, /// 243
Prod_ResultCode, /// 244
Prod_Q2CorrRL, /// 245
Prod_Q2CorrLR, /// 246
TestPartStr, /// 247
Error_heat_mtr_vol, /// 248
Energy_start, /// 249
Energy_end, /// 250
OraWMTypeID, /// 251
OraWMTypeRev, /// 252
E25, /// 253
E26, /// 254
E27, /// 255
E28, /// 256
RefFlowmeter, /// 257
Test_Method_Elde, /// 258
Counter1, /// 259 counterIdx0 = 0
Counter2, /// 260 counterIdx0 = 1
Counter3, /// 261 counterIdx0 = 2
Counter4, /// 262 counterIdx0 = 3
Counter5, /// 263 counterIdx0 = 4
Counter6, /// 264 counterIdx0 = 5
Counter7, /// 265 counterIdx0 = 6
Counter8, /// 266 counterIdx0 = 7
Counter9, /// 267 counterIdx0 = 8
Counter10, /// 268 counterIdx0 = 9
ConstMasterCorr, /// 269
TimeBtwnMassMsrmnts, /// 270
TestTimeCorrection, /// 271
Count, Count,
} }
} }
-252
View File
@@ -1,252 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using Config;
using Config.Entities;
using Results.Entities;
using Results.Resources;
using System.Globalization;
namespace Results
{
public class ManualEntryItemSpec
{
///
/// Public fields
///
public readonly int Uid;
public readonly string Name; /// Name-s of all items must be unique
public readonly string ToolTipText; /// Tool-Tip Text
public readonly Quantity Quantity; /// Quantity
public readonly ItemCategory Category; ///
public string Caption; /// Specifies item description to be printed as a caption (in the header, etc.)
public Config.Unit Units; /// Specifies units for the output
public ManualEntryItemSpec Clone()
{
ManualEntryItemSpec item = new ManualEntryItemSpec((ItemID)Uid, Name, ToolTipText, Quantity, Category, updateDlgt);
item.Caption = Caption;
item.Units = Units;
return item;
}
///
/// Function to pick a MeterTestResult field and convert it into a string
///
public delegate bool UpdateDlgt(string str, MeterTestRslt meterTestRslt);
private readonly UpdateDlgt updateDlgt;
public bool Update(string str, MeterTestRslt meterTestRslt)
{
return (updateDlgt != null) ? updateDlgt(str, meterTestRslt) : true;
}
public static bool ParseBool(string str, out bool success)
{
bool b;
success = bool.TryParse(str, out b);
return b;
}
public static int ParseInt(string str, out bool success)
{
int i;
success = int.TryParse(str, out i);
return i;
}
public static float ParseFloat(string str, out bool success)
{
float f;
success = float.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out f) ||
float.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out f);
return f;
}
public static double ParseDouble(string str, out bool success)
{
double d;
success = double.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out d) ||
double.TryParse(str, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d);
return d;
}
///
/// Public constructor
///
public ManualEntryItemSpec(ItemID itemId, string name, string toolTipText, Quantity quantity, ItemCategory category, UpdateDlgt updateDlgt)
{
Uid = (int)itemId;
Name = name;
ToolTipText = toolTipText;
Quantity = quantity;
Category = category;
this.updateDlgt = updateDlgt;
}
/// Static list of all available items
public static readonly IList<ManualEntryItemSpec> AllItems;
/// <summary>
/// Initializes the <see cref="ManualEntryItemSpec"/> class.
/// </summary>
/// Static constructor that initializes the list of all items
static ManualEntryItemSpec()
{
AllItems = new List<ManualEntryItemSpec>();
AllItems.Add(new ManualEntryItemSpec(ItemID.P_PMax_test_mean,
string.Format("{0} PMax mean", Strings.VName_Press),
"PMax test pressure",
Quantity.Pressure,
ItemCategory.TestResult,
(str, mtr) => { bool r;
mtr.TestRslt.PressUpMean = mtr.TestRslt.PressDownMean = ParseFloat(str, out r);
return r; }));
AllItems.Add(new ManualEntryItemSpec(ItemID.T_line_mean,
string.Format("{0} LN ME", Strings.VName_Temp),
Strings.Tooltip_T_ln_me,
Quantity.Temperature,
ItemCategory.TestResult,
(str, mtr) => { bool r;
mtr.TestRslt.TempUpMean = mtr.TestRslt.TempDownMean = ParseFloat(str, out r);
return r; }));
AllItems.Add(new ManualEntryItemSpec(ItemID.Test_time,
Strings.T_s,
"Test time",
Quantity.Time,
ItemCategory.MeterResult,
(str, mtr) => { bool r;
mtr.TestTime = ParseDouble(str, out r);
return r; }));
AllItems.Add(new ManualEntryItemSpec(ItemID.PMax_test_time,
"Pressure test time",
"Pressure test time",
Quantity.Time,
ItemCategory.MeterResult,
(str, mtr) => { bool r;
mtr.TestTime = ParseDouble(str, out r);
return r; }));
AllItems.Add(new ManualEntryItemSpec(ItemID.TestPassed,
Strings.Test_passed,
"Passed",
Quantity.Boolean,
ItemCategory.MeterResult,
(str, mtr) => { bool r;
mtr.Passed = ParseBool(str, out r);
return r; }));
}
/// <summary>
/// Converts a list of 'Output item specifications' to a string array
/// </summary>
/// <param name="items"></param>
/// <returns></returns>
public static string[] ToStrArray(IList<ManualEntryItemSpec> items)
{
int count = (items != null) ? items.Count : 0;
string[] result = new string[count];
for (int i = 0; i < count; i++)
{
if (items[i].Caption == null) items[i].Caption = string.Empty;
result[i] = string.Format("{0}~{1}~{2}",
items[i].Uid,
items[i].Caption.Replace("~", "\n"),
items[i].Units);
}
return result;
}
/// <summary>
/// Converts a string array to a list of 'Output item specifications'
/// </summary>
/// <param name="strArray"></param>
/// <returns></returns>
public static IList<ManualEntryItemSpec> FromStrArray(string[] strArray)
{
IList<ManualEntryItemSpec> result = new List<ManualEntryItemSpec>();
if (strArray != null)
{
for (int i = 0; i < strArray.Length; i++)
{
try
{
ManualEntryItemSpec item;
string[] field = strArray[i].Split(new char[] { '~' });
if (!strArray[i].Contains("~"))
{
item = GetItem(0);
item.Caption = "Prs.Err.";
result.Add(item);
}
else if ((item = GetItem(int.Parse(field[0]))) != null)
{
///
/// Load the new style results item specification
///
item.Caption = field[1].Replace("\n", "~");
item.Units = 0;
for (Config.Unit u = 0; u < Config.Unit.Count; u++)
{
if (u.ToString().Equals(field[2])) { item.Units = u; break; }
}
result.Add(item);
}
else
{
///
/// Create an item with parse error information
///
ManualEntryItemSpec item2 = GetItem(0);
item2.Caption = "Prs.Err.";
result.Add(item2);
}
}
catch
{
ManualEntryItemSpec item = GetItem(0);
item.Caption = "Prs.Err.";
result.Add(item);
}
}
}
return result;
}
public static ManualEntryItemSpec GetItem(int uid)
{
foreach (var item in AllItems)
{
if (item.Uid == uid) return item.Clone();
}
return null;
}
public static ManualEntryItemSpec GetItem(ItemID itemId)
{
return GetItem((int)itemId);
}
public override string ToString()
{
if (!string.IsNullOrEmpty(Caption))
return Caption;
else
return ((ItemID)Uid).ToString();
}
}
}
+1 -8
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2019 Sensus Slovensko a.s. /// Copyright (c) 2015 Sensus Metering Systems
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
using Results.Entities; using Results.Entities;
@@ -26,13 +26,6 @@ namespace Results.Mappings
.Column("Custom1"); ; .Column("Custom1"); ;
Map(x => x.Custom2); Map(x => x.Custom2);
Map(x => x.Custom3); Map(x => x.Custom3);
Map(x => x.Counter6);
Map(x => x.Counter7);
Map(x => x.Counter8);
Map(x => x.Counter9);
Map(x => x.Counter10);
Map(x => x.StartTime); Map(x => x.StartTime);
Map(x => x.EndTime); Map(x => x.EndTime);
Map(x => x.Dirty); Map(x => x.Dirty);
+1 -2
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s. /// Copyright (c) 2015 Sensus Metering Systems
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
using Results.Entities; using Results.Entities;
@@ -12,7 +12,6 @@ namespace Results.Mappings
{ {
Id(x => x.Id); Id(x => x.Id);
Map(x => x.CompoundMeterId); Map(x => x.CompoundMeterId);
Map(x => x.RegReaderType);
Map(x => x.PulsesMeter); Map(x => x.PulsesMeter);
Map(x => x.PulsesMaster); Map(x => x.PulsesMaster);
Map(x => x.PulsesPerLiter); Map(x => x.PulsesPerLiter);
+3 -4
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015-2019 Sensus Slovensko a.s. /// Copyright (c) 2015 Sensus Metering Systems
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
using Results.Entities; using Results.Entities;
@@ -12,8 +12,7 @@ namespace Results.Mappings
{ {
Id(x => x.Id); Id(x => x.Id);
Map(x => x.Name); Map(x => x.Name);
Map(x => x.Qtg); Map(x => x.Qfrom);
Map(x => x.Qfrom);
Map(x => x.Qto); Map(x => x.Qto);
Map(x => x.TargetVolume); Map(x => x.TargetVolume);
Map(x => x.TargetTime); Map(x => x.TargetTime);
@@ -21,7 +20,7 @@ namespace Results.Mappings
Map(x => x.Method); Map(x => x.Method);
Map(x => x.ErrLimLo); Map(x => x.ErrLimLo);
Map(x => x.ErrLimHi); Map(x => x.ErrLimHi);
Map(x => x.ErrLimMargin).Column("Uncertainty"); Map(x => x.Uncertainty);
Map(x => x.Publish); Map(x => x.Publish);
Map(x => x.Evaluate); Map(x => x.Evaluate);
} }
+4 -21
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015-2019 Sensus Slovensko a.s. /// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
using Results.Entities; using Results.Entities;
@@ -16,7 +16,6 @@ namespace Results.Mappings
References<Components>(x => x.Components); References<Components>(x => x.Components);
Map(x => x.Part); Map(x => x.Part);
Map(x => x.RepetitionNr); Map(x => x.RepetitionNr);
Map(x => x.MethodClass);
Map(x => x.TestDone); Map(x => x.TestDone);
Map(x => x.Remark) Map(x => x.Remark)
@@ -25,13 +24,9 @@ namespace Results.Mappings
Map(x => x.StartTime); Map(x => x.StartTime);
Map(x => x.EndTime); Map(x => x.EndTime);
Map(x => x.FlowSetTime); Map(x => x.FlowSetTime);
Map(x => x.TimeBtwnMassMsrmnts);
Map(x => x.TestTime); Map(x => x.TestTime);
Map(x => x.TestTimeCorrection);
Map(x => x.PulsesMaster); Map(x => x.PulsesMaster);
Map(x => x.ConstMasterRaw); Map(x => x.ConstMaster);
Map(x => x.ConstMasterCorr);
Map(x => x.ConstMaster);
Map(x => x.MassStartRaw); Map(x => x.MassStartRaw);
Map(x => x.MassStart); Map(x => x.MassStart);
Map(x => x.MassEndRaw); Map(x => x.MassEndRaw);
@@ -48,7 +43,7 @@ namespace Results.Mappings
Map(x => x.DiverterStart); Map(x => x.DiverterStart);
Map(x => x.DiverterEnd); Map(x => x.DiverterEnd);
Map(x => x.ErrorFlags); Map(x => x.ErrorFlags);
Map(x => x.InfoFlags); Map(x => x.ErrorFlagsMd);
#if HEAT_METERS #if HEAT_METERS
Map(x => x.RefEnergy); Map(x => x.RefEnergy);
#endif #endif
@@ -103,12 +98,6 @@ namespace Results.Mappings
Map(x => x.FlowMin); Map(x => x.FlowMin);
Map(x => x.FlowMax); Map(x => x.FlowMax);
Map(x => x.Uncertnt);
Map(x => x.UncertntScale);
Map(x => x.UncertntDensity);
Map(x => x.UncertntTemp);
Map(x => x.UncertntPressure);
Map(x => x.Custom1); Map(x => x.Custom1);
Map(x => x.Custom2); Map(x => x.Custom2);
Map(x => x.Custom3); Map(x => x.Custom3);
@@ -117,12 +106,6 @@ namespace Results.Mappings
Map(x => x.Custom6); Map(x => x.Custom6);
Map(x => x.Custom7); Map(x => x.Custom7);
Map(x => x.Custom8); Map(x => x.Custom8);
}
Map(x => x.Counter1);
Map(x => x.Counter2);
Map(x => x.Counter3);
Map(x => x.Counter4);
Map(x => x.Counter5);
}
} }
} }
+1 -2
View File
@@ -42,8 +42,6 @@ namespace Results.Mappings
Map(x => x.MetrologicalClassAux); Map(x => x.MetrologicalClassAux);
Map(x => x.ApprovalInfoAux); Map(x => x.ApprovalInfoAux);
Map(x => x.Medium);
Map(x => x.Text1); Map(x => x.Text1);
Map(x => x.Text2); Map(x => x.Text2);
Map(x => x.Text3); Map(x => x.Text3);
@@ -56,6 +54,7 @@ namespace Results.Mappings
#endif #endif
#if ORACLE_DB #if ORACLE_DB
Map(x => x.WMTypeId); Map(x => x.WMTypeId);
Map(x => x.WMTypeRev);
#endif #endif
} }
} }
+6 -19
View File
@@ -21,42 +21,29 @@ namespace Results.Mappings
Map(x => x.QRise); Map(x => x.QRise);
Map(x => x.QFall); Map(x => x.QFall);
Map(x => x.ErrorFlags); Map(x => x.ErrorFlags);
Map(x => x.InfoFlags); Map(x => x.Passed);
Map(x => x.Passed);
Map(x => x.ResultCode); Map(x => x.ResultCode);
Map(x => x.ArchivePath); Map(x => x.ArchivePath);
Map(x => x.Remark) Map(x => x.Remark)
.CustomType("StringClob") .CustomType("StringClob")
.CustomSqlType("varchar(2000)"); .CustomSqlType("varchar(2000)");
#if IPERL #if IPERL
Map(x => x.SerialNrEx);
Map(x => x.OrigCalibFactor); Map(x => x.OrigCalibFactor);
Map(x => x.CalibFactor); Map(x => x.CalibFactor);
Map(x => x.OrigCalibFactorLNA); Map(x => x.OrigCalibFactorLNA);
Map(x => x.CalibFactorLNA); Map(x => x.CalibFactorLNA);
Map(x => x.Q2ErrWOCorrection); Map(x => x.Q2ErrWOCorrection);
Map(x => x.Q2CorrRL); Map(x => x.Q2CorrectionDone);
Map(x => x.Q2CorrLR); Map(x => x.Q2Correction);
Map(x => x.Q2CorrRL).Column("Q2CorrRFlow");
Map(x => x.Q2CorrLR).Column("Q2CorrLFlow");
Map(x => x.Q2CorrFlowRight); Map(x => x.Q2CorrFlowRight);
Map(x => x.Diff2Hz8Hz); Map(x => x.Diff2Hz8Hz);
Map(x => x.Hz2CorrectionDone); Map(x => x.Hz2CorrectionDone);
Map(x => x.Hz2Correction); Map(x => x.Hz2Correction);
Map(x => x.FWVersion); Map(x => x.FWVersion);
#endif #endif
#if TURA_SPECIAL
Map(x => x.AssignedSerialNr);
Map(x => x.CompleteSerialNr);
Map(x => x.RadioAddress);
Map(x => x.PaletteNr);
Map(x => x.UmkartonNr);
Map(x => x.ProdTestBench);
Map(x => x.ProdWMPosition);
Map(x => x.ProdUserName);
Map(x => x.ProdPurchaseOrder);
Map(x => x.ProdPassed);
Map(x => x.ProdResultCode);
Map(x => x.ProdQ2CorrRL);
Map(x => x.ProdQ2CorrLR);
#endif
#if ORACLE_DB #if ORACLE_DB
Map(x => x.Pruefindex); Map(x => x.Pruefindex);
Map(x => x.HydrPruefung); Map(x => x.HydrPruefung);
@@ -4,10 +4,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing; using System.Drawing.Printing;
using System.IO; using System.IO;
using Gma.QrCodeNet.Encoding;
using Config.Entities; using Config.Entities;
using Results.Resources; using Results.Resources;
@@ -15,9 +13,7 @@ namespace Results.Output.Printers.Label
{ {
public class LabelPrintDocument : PrintersCommon public class LabelPrintDocument : PrintersCommon
{ {
static QrEncoder encoder = new QrEncoder(); /// Size of the printed area without margins, after taking into account 'pageOrientation'
/// Size of the printed area without margins, after taking into account 'pageOrientation'
readonly int printHeight; readonly int printHeight;
readonly int printWidth; readonly int printWidth;
@@ -97,44 +93,6 @@ namespace Results.Output.Printers.Label
e.Graphics.DrawString(item.Print(wm), this.font, Brushes.Black, printArea); e.Graphics.DrawString(item.Print(wm), this.font, Brushes.Black, printArea);
} }
} }
if (cfg.DrawSNasBarcode)
{
if (cfg.IsQR)
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
else
{
/// TODO
}
}
} }
public static void DrawQR(Graphics g, QrCode qrCode, float left, float top, float width, float height)
{
/// Assuming 100 dpi (printer)
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
float qrPixWidth = width / qrCode.Matrix.Width;
float qrPixHeight = height / qrCode.Matrix.Height;
for (int i = 0; i < qrCode.Matrix.Height; i++)
{
for (int j = 0; j < qrCode.Matrix.Width; j++)
{
if (qrCode.Matrix[j, i])
{
g.FillRectangle(Brushes.Black, new RectangleF(left + j * qrPixWidth,
top + i * qrPixHeight,
qrPixWidth,
qrPixHeight));
}
}
}
}
} }
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2018-2020 Sensus Slovensko a.s. /// Copyright (c) 2018 Sensus Slovensko a.s.
/// ///
namespace Results.Output.Printers.Label namespace Results.Output.Printers.Label
@@ -17,11 +17,5 @@ namespace Results.Output.Printers.Label
public System.Globalization.CultureInfo CultureInfo; public System.Globalization.CultureInfo CultureInfo;
public bool GoodOnly; public bool GoodOnly;
public bool SupressPrinting; /// true = Bypass printing public bool SupressPrinting; /// true = Bypass printing
public bool DrawSNasBarcode; }
public bool IsQR;
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
public int BarcodeHeight;
}
} }
@@ -152,12 +152,6 @@ namespace Results.Output.Printers.OnePerMeter
} }
} }
if ((cfg.GraphHgh != 0) && (cfg.GraphWid != 0))
{
Rectangle pos = new Rectangle(cfg.GraphLeft, cfg.GraphTop, cfg.GraphWid, cfg.GraphHgh);
WMChart.GetChart(wm, true).Printing.PrintPaint(e.Graphics, pos);
}
float tableTop = cfg.TopMargin; float tableTop = cfg.TopMargin;
if (pageNr == 1) if (pageNr == 1)

Some files were not shown because too many files have changed in this diff Show More