Compare commits
51
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e80a8301d8 | ||
|
|
9f1960b679 | ||
|
|
e1ca118671 | ||
|
|
482269209e | ||
|
|
7f56fa0aa3 | ||
|
|
bd15d3bd83 | ||
|
|
329ffeca8f | ||
|
|
ee69631d38 | ||
|
|
fa38af65e6 | ||
|
|
54a28aa8bf | ||
|
|
f10be22c0b | ||
|
|
630f7d1e54 | ||
|
|
85c0003a45 | ||
|
|
fe758348ba | ||
|
|
860e369e35 | ||
|
|
658f5d2e27 | ||
|
|
3b1ab9fdca | ||
|
|
98aa74a0d4 | ||
|
|
e28b94c367 | ||
|
|
09ccc282a5 | ||
|
|
3d3cac81b9 | ||
|
|
a7965a7ffc | ||
|
|
7dcb5ba6ce | ||
|
|
14a96ea3e8 | ||
|
|
a138e1117c | ||
|
|
c73f6a857a | ||
|
|
12c9e72d0c | ||
|
|
61747166ae | ||
|
|
dc31e833ee | ||
|
|
51523ea577 | ||
|
|
ef75c30af9 | ||
|
|
cf236d94b8 | ||
|
|
65ede62c1f | ||
|
|
08c94aacce | ||
|
|
9b11602ab8 | ||
|
|
6ec2852581 | ||
|
|
51c24f8c4c | ||
|
|
8b1e0af207 | ||
|
|
c448c18a42 | ||
|
|
d8927a9052 | ||
|
|
073ee3bf30 | ||
|
|
445a16dc6f | ||
|
|
2155790ffb | ||
|
|
2ad50a9708 | ||
|
|
670de424c2 | ||
|
|
7c070fc635 | ||
|
|
4090bd1618 | ||
|
|
ab43cabc57 | ||
|
|
91461eb2cc | ||
|
|
aa18b75ef8 | ||
|
|
f029fdbd2e |
+8
-2
@@ -10,10 +10,14 @@ Encrypt/bin/
|
||||
Encrypt/obj/
|
||||
GemCard/bin
|
||||
GemCard/obj
|
||||
GenCode128/bin
|
||||
GenCode128/obj
|
||||
GraphLib/bin
|
||||
GraphLib/obj
|
||||
TracingDB/bin
|
||||
TracingDB/obj
|
||||
RestClient/bin
|
||||
RestClient/obj
|
||||
Results/bin/
|
||||
Results/obj/
|
||||
ResultsBrowser/bin/
|
||||
@@ -22,8 +26,10 @@ Statistics/bin/
|
||||
Statistics/obj/
|
||||
TBF/bin/
|
||||
TBF/obj/
|
||||
TBFSetup/Debug/
|
||||
TBFSetup/Release/
|
||||
ToFirstMonitor/bin/
|
||||
ToFirstMonitor/obj/
|
||||
ToSecondMonitor/bin/
|
||||
ToSecondMonitor/obj/
|
||||
Users/bin/
|
||||
Users/obj/
|
||||
UserManagement/bin/
|
||||
|
||||
+6
-10
@@ -10,27 +10,30 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Config</RootNamespace>
|
||||
<AssemblyName>Config</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;GELSENWASSER;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;GELSENWASSER;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
@@ -83,7 +86,6 @@
|
||||
<Compile Include="Entities\MetersPath.cs" />
|
||||
<Compile Include="Entities\OutputPath.cs" />
|
||||
<Compile Include="Entities\Procedure.cs" />
|
||||
<Compile Include="Entities\ProcedureHistory.cs" />
|
||||
<Compile Include="Entities\Profile.cs" />
|
||||
<Compile Include="Entities\PTest.cs" />
|
||||
<Compile Include="Entities\Test.cs" />
|
||||
@@ -93,8 +95,6 @@
|
||||
<Compile Include="Entities\User.cs" />
|
||||
<Compile Include="Entities\VirtualBenchSequence.cs" />
|
||||
<Compile Include="Entities\VirtualBenchStep.cs" />
|
||||
<Compile Include="Entities\Watermeter.cs" />
|
||||
<Compile Include="Entities\WMType.cs" />
|
||||
<Compile Include="FluentCommon.cs" />
|
||||
<Compile Include="Formulas.cs" />
|
||||
<Compile Include="Mappings\BenchPathMap.cs" />
|
||||
@@ -115,10 +115,6 @@
|
||||
<Compile Include="Mappings\TransitionStepMap.cs" />
|
||||
<Compile Include="Mappings\UncertaintyMap.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="Resources\Strings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN
|
||||
#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN || GELSENWASSER
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
|
||||
@@ -67,12 +67,12 @@ namespace Config.Entities
|
||||
public class ProcedureInfo
|
||||
{
|
||||
public readonly string Name;
|
||||
public readonly Users.Entities.DBKind DBKind;
|
||||
public readonly bool IsRemote;
|
||||
|
||||
public ProcedureInfo(string name, Users.Entities.DBKind dbKind)
|
||||
public ProcedureInfo(string name, bool isRemote)
|
||||
{
|
||||
Name = name;
|
||||
DBKind = dbKind;
|
||||
IsRemote = isRemote;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@@ -9,14 +10,18 @@ namespace Config.Entities
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual Users.Entities.GID GID { get; set; }
|
||||
public virtual long AccessFlags { get; set; } /// Bitfield of access flags: bit0 .. bit62
|
||||
public virtual IList<User> Users { get; set; } /// Group can be a member of a list of users
|
||||
|
||||
public Group()
|
||||
{
|
||||
Users = new List<User>();
|
||||
}
|
||||
|
||||
public Group(Users.Entities.GID gid)
|
||||
{
|
||||
: this()
|
||||
{
|
||||
GID = gid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+31
-19
@@ -24,6 +24,8 @@ namespace Config.Entities
|
||||
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; } ///
|
||||
@@ -76,24 +78,26 @@ namespace Config.Entities
|
||||
TempLimHi = 25.0; /// [°C]
|
||||
PressLimLo = 0; /// [bar]
|
||||
PressLimHi = 16.0; /// [bar]
|
||||
Publish = (sbyte)Config.Entities.Publish.Always;
|
||||
Evaluate = true;
|
||||
|
||||
E1 = 1;
|
||||
E2 = 1;
|
||||
E3 = 1;
|
||||
E4 = 1;
|
||||
E5 = 1;
|
||||
E6 = 1;
|
||||
E7 = 1;
|
||||
E8 = 1;
|
||||
E9 = 1;
|
||||
E10 = 1;
|
||||
E11 = 1;
|
||||
E12 = 1;
|
||||
E13 = 1;
|
||||
E14 = 1;
|
||||
E15 = 1;
|
||||
E16 = 1;
|
||||
E21 = 1;
|
||||
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]
|
||||
@@ -133,6 +137,8 @@ namespace Config.Entities
|
||||
result.TempLimHi = TempLimHi;
|
||||
result.PressLimLo = PressLimLo;
|
||||
result.PressLimHi = PressLimHi;
|
||||
result.Publish = Publish;
|
||||
result.Evaluate = Evaluate;
|
||||
|
||||
result.E1 = E1;
|
||||
result.E2 = E2;
|
||||
@@ -184,6 +190,8 @@ namespace Config.Entities
|
||||
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());
|
||||
@@ -238,6 +246,8 @@ namespace Config.Entities
|
||||
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)
|
||||
|
||||
@@ -278,8 +288,10 @@ namespace Config.Entities
|
||||
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", TempLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != PressLimHi.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_max", 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); };
|
||||
|
||||
@@ -44,6 +44,11 @@ namespace Config.Entities
|
||||
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 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<Test> Tests { get; set; }
|
||||
|
||||
@@ -65,6 +70,11 @@ namespace Config.Entities
|
||||
Watermeters = string.Empty;
|
||||
Description = string.Empty;
|
||||
LongDescription = string.Empty;
|
||||
|
||||
DN = 0;
|
||||
Qn = 0;
|
||||
MClass = string.Empty;
|
||||
Producer = string.Empty;
|
||||
}
|
||||
|
||||
public Procedure(string name, int itemNr)
|
||||
@@ -103,6 +113,11 @@ namespace Config.Entities
|
||||
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 test in Tests) { result.Tests.Add(test.Clone()); }
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
///
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
///
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
///
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
-22
@@ -145,17 +145,8 @@ namespace Config
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
///
|
||||
/// Prepare all groups
|
||||
/// Create user 'admin'
|
||||
///
|
||||
var testers = new Config.Entities.Group(Users.Entities.GID.Testers);
|
||||
var testingSpecialists = new Config.Entities.Group(Users.Entities.GID.TestingSpecialists);
|
||||
var headOfLab = new Config.Entities.Group(Users.Entities.GID.HeadOfLab);
|
||||
var maintenanceSpecialists = new Config.Entities.Group(Users.Entities.GID.MaintenanceSpecialists);
|
||||
var metrologists = new Config.Entities.Group(Users.Entities.GID.Metrologists);
|
||||
var calibrationSpecialists = new Config.Entities.Group(Users.Entities.GID.CalibrationSpecialists);
|
||||
var administrators = new Config.Entities.Group(Users.Entities.GID.Administrators);
|
||||
|
||||
/// Create the user 'admin' add his groups
|
||||
var admin = new Config.Entities.User
|
||||
{
|
||||
UserName = Data.AdminUsername,
|
||||
@@ -163,20 +154,35 @@ namespace Config
|
||||
LastPwChange = DateTime.Now
|
||||
};
|
||||
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);
|
||||
|
||||
///// Create the control board component
|
||||
//var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
|
||||
//session.SaveOrUpdate(cmpnt);
|
||||
///
|
||||
/// Prepare all groups, add some of them to admin
|
||||
///
|
||||
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
@@ -7,10 +7,18 @@ namespace Config.Mappings
|
||||
{
|
||||
class GroupMap : ClassMap<Entities.Group>
|
||||
{
|
||||
/// <seealso>
|
||||
/// https://stackoverflow.com/questions/9108083/fluent-nhibernate-many-to-many-mapping-way/9125059
|
||||
/// </seealso>
|
||||
public GroupMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.GID).Column("Name"); ;
|
||||
Map(x => x.GID).Column("Name");
|
||||
Map(x => x.AccessFlags);
|
||||
HasManyToMany(x => x.Users)
|
||||
.Cascade.SaveUpdate()
|
||||
.Inverse()
|
||||
.Table("UsersGroups");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Config.Mappings
|
||||
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);
|
||||
|
||||
@@ -18,9 +18,7 @@ namespace Config.Mappings
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.DoEvaluate)
|
||||
.Column("Evaluate");
|
||||
#if TEST_PROFILES
|
||||
Map(x => x.Qtg);
|
||||
#endif
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qto);
|
||||
Map(x => x.Volume);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
@@ -19,8 +19,9 @@ namespace Config.Mappings
|
||||
Map(x => x.Password4);
|
||||
Map(x => x.FullName).Column("Description");
|
||||
Map(x => x.LastPwChange);
|
||||
HasMany(x => x.Groups)
|
||||
.Cascade.All();
|
||||
HasManyToMany(x => x.Groups)
|
||||
.Cascade.SaveUpdate()
|
||||
.Table("UsersGroups");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
///
|
||||
/// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
///
|
||||
/// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
///
|
||||
/// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
///
|
||||
/// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 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("2.24.1382.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1382.0")]
|
||||
[assembly: AssemblyVersion("2.25.1427.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1427.0")]
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Decrypt</RootNamespace>
|
||||
<AssemblyName>Decrypt</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -24,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -33,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Decrypt.Program</StartupObject>
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DeviceTest</RootNamespace>
|
||||
<AssemblyName>DeviceTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -24,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -33,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>DeviceTest.Program</StartupObject>
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ namespace DeviceTest.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -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">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -10,9 +10,10 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Dirichlet.Numerics</RootNamespace>
|
||||
<AssemblyName>Dirichlet.Numerics</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -22,6 +23,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -30,6 +32,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@@ -48,4 +51,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Encrypt</RootNamespace>
|
||||
<AssemblyName>Encrypt</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -24,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -33,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Encrypt.Program</StartupObject>
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
@@ -66,6 +66,7 @@
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
@@ -87,6 +88,7 @@
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -99,6 +101,7 @@
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
@@ -110,6 +113,7 @@
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using System.Reflection;
|
||||
|
||||
// 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("GenCode128")]
|
||||
[assembly: AssemblyDescription("GenCode128")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Chris Wuestefeld")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("2006 Chris Wuestefeld")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 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 Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
@@ -0,0 +1,139 @@
|
||||
namespace GenCode128
|
||||
{
|
||||
/// <summary>
|
||||
/// Static tools for determining codes for individual characters in the content
|
||||
/// </summary>
|
||||
public static class Code128Code
|
||||
{
|
||||
private const int CShift = 98;
|
||||
private const int CCodeA = 101;
|
||||
private const int CCodeB = 100;
|
||||
private const int CStartA = 103;
|
||||
private const int CStartB = 104;
|
||||
private const int CStop = 106;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates which code sets can represent a character -- CodeA, CodeB, or either
|
||||
/// </summary>
|
||||
public enum CodeSetAllowed
|
||||
{
|
||||
CodeA,
|
||||
CodeB,
|
||||
CodeAorB
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the Code128 code value(s) to represent an ASCII character, with
|
||||
/// optional look-ahead for length optimization
|
||||
/// </summary>
|
||||
/// <param name="charAscii">The ASCII value of the character to translate</param>
|
||||
/// <param name="lookAheadAscii">The next character in sequence (or -1 if none)</param>
|
||||
/// <param name="currentCodeSet">The current codeset, that the returned codes need to follow;
|
||||
/// if the returned codes change that, then this value will be changed to reflect it</param>
|
||||
/// <returns>An array of integers representing the codes that need to be output to produce the
|
||||
/// given character</returns>
|
||||
public static int[] CodesForChar(int charAscii, int lookAheadAscii, ref CodeSet currentCodeSet)
|
||||
{
|
||||
int[] result;
|
||||
var shifter = -1;
|
||||
|
||||
if (!CharCompatibleWithCodeset(charAscii, currentCodeSet))
|
||||
{
|
||||
// if we have a lookahead character AND if the next character is ALSO not compatible
|
||||
if ((lookAheadAscii != -1) && !CharCompatibleWithCodeset(lookAheadAscii, currentCodeSet))
|
||||
{
|
||||
// we need to switch code sets
|
||||
switch (currentCodeSet)
|
||||
{
|
||||
case CodeSet.CodeA:
|
||||
shifter = CCodeB;
|
||||
currentCodeSet = CodeSet.CodeB;
|
||||
break;
|
||||
case CodeSet.CodeB:
|
||||
shifter = CCodeA;
|
||||
currentCodeSet = CodeSet.CodeA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no need to switch code sets, a temporary SHIFT will suffice
|
||||
shifter = CShift;
|
||||
}
|
||||
}
|
||||
|
||||
if (shifter != -1)
|
||||
{
|
||||
result = new int[2];
|
||||
result[0] = shifter;
|
||||
result[1] = CodeValueForChar(charAscii);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new int[1];
|
||||
result[0] = CodeValueForChar(charAscii);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tells us which codesets a given character value is allowed in
|
||||
/// </summary>
|
||||
/// <param name="charAscii">ASCII value of character to look at</param>
|
||||
/// <returns>Which codeset(s) can be used to represent this character</returns>
|
||||
public static CodeSetAllowed CodesetAllowedForChar(int charAscii)
|
||||
{
|
||||
if (charAscii >= 32 && charAscii <= 95)
|
||||
{
|
||||
return CodeSetAllowed.CodeAorB;
|
||||
}
|
||||
else
|
||||
{
|
||||
return charAscii < 32 ? CodeSetAllowed.CodeA : CodeSetAllowed.CodeB;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine if a character can be represented in a given codeset
|
||||
/// </summary>
|
||||
/// <param name="charAscii">character to check for</param>
|
||||
/// <param name="currentCodeSet">codeset context to test</param>
|
||||
/// <returns>true if the codeset contains a representation for the ASCII character</returns>
|
||||
public static bool CharCompatibleWithCodeset(int charAscii, CodeSet currentCodeSet)
|
||||
{
|
||||
var csa = CodesetAllowedForChar(charAscii);
|
||||
return csa == CodeSetAllowed.CodeAorB || (csa == CodeSetAllowed.CodeA && currentCodeSet == CodeSet.CodeA)
|
||||
|| (csa == CodeSetAllowed.CodeB && currentCodeSet == CodeSet.CodeB);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the integer code128 code value for a character (assuming the appropriate code set)
|
||||
/// </summary>
|
||||
/// <param name="charAscii">character to convert</param>
|
||||
/// <returns>code128 symbol value for the character</returns>
|
||||
public static int CodeValueForChar(int charAscii)
|
||||
{
|
||||
return charAscii >= 32 ? charAscii - 32 : charAscii + 64;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the appropriate START code depending on the codeset we want to be in
|
||||
/// </summary>
|
||||
/// <param name="cs">The codeset you want to start in</param>
|
||||
/// <returns>The code128 code to start a barcode in that codeset</returns>
|
||||
public static int StartCodeForCodeSet(CodeSet cs)
|
||||
{
|
||||
return cs == CodeSet.CodeA ? CStartA : CStartB;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the Code128 stop code
|
||||
/// </summary>
|
||||
/// <returns>the stop code</returns>
|
||||
public static int StopCode()
|
||||
{
|
||||
return CStop;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
namespace GenCode128
|
||||
{
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
|
||||
/// <summary>
|
||||
/// Represent the set of code values to be output into barcode form
|
||||
/// </summary>
|
||||
public class Code128Content
|
||||
{
|
||||
/// <summary>
|
||||
/// Create content based on a string of ASCII data
|
||||
/// </summary>
|
||||
/// <param name="asciiData">the string that should be represented</param>
|
||||
public Code128Content(string asciiData)
|
||||
{
|
||||
this.Codes = this.StringToCode128(asciiData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides the Code128 code values representing the object's string
|
||||
/// </summary>
|
||||
public int[] Codes
|
||||
{
|
||||
get { return codes; }
|
||||
set { codes = value; }
|
||||
}
|
||||
int[] codes;
|
||||
|
||||
/// <summary>
|
||||
/// Transform the string into integers representing the Code128 codes
|
||||
/// necessary to represent it
|
||||
/// </summary>
|
||||
/// <param name="asciiData">String to be encoded</param>
|
||||
/// <returns>Code128 representation</returns>
|
||||
private int[] StringToCode128(string asciiData)
|
||||
{
|
||||
// turn the string into ascii byte data
|
||||
var asciiBytes = Encoding.ASCII.GetBytes(asciiData);
|
||||
|
||||
// decide which codeset to start with
|
||||
var csa1 = asciiBytes.Length > 0
|
||||
? Code128Code.CodesetAllowedForChar(asciiBytes[0])
|
||||
: Code128Code.CodeSetAllowed.CodeAorB;
|
||||
var csa2 = asciiBytes.Length > 1
|
||||
? Code128Code.CodesetAllowedForChar(asciiBytes[1])
|
||||
: Code128Code.CodeSetAllowed.CodeAorB;
|
||||
var currentCodeSet = this.GetBestStartSet(csa1, csa2);
|
||||
|
||||
// set up the beginning of the barcode
|
||||
// assume no codeset changes, account for start, checksum, and stop
|
||||
var codes = new ArrayList(asciiBytes.Length + 3) { Code128Code.StartCodeForCodeSet(currentCodeSet) };
|
||||
|
||||
// add the codes for each character in the string
|
||||
for (var i = 0; i < asciiBytes.Length; i++)
|
||||
{
|
||||
int thischar = asciiBytes[i];
|
||||
var nextchar = asciiBytes.Length > i + 1 ? asciiBytes[i + 1] : -1;
|
||||
|
||||
codes.AddRange(Code128Code.CodesForChar(thischar, nextchar, ref currentCodeSet));
|
||||
}
|
||||
|
||||
// calculate the check digit
|
||||
var checksum = (int)codes[0];
|
||||
for (var i = 1; i < codes.Count; i++)
|
||||
{
|
||||
checksum += i * (int)codes[i];
|
||||
}
|
||||
|
||||
codes.Add(checksum % 103);
|
||||
|
||||
codes.Add(Code128Code.StopCode());
|
||||
|
||||
var result = codes.ToArray(typeof(int)) as int[];
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the best starting code set based on the the first two
|
||||
/// characters of the string to be encoded
|
||||
/// </summary>
|
||||
/// <param name="csa1">First character of input string</param>
|
||||
/// <param name="csa2">Second character of input string</param>
|
||||
/// <returns>The codeset determined to be best to start with</returns>
|
||||
private CodeSet GetBestStartSet(Code128Code.CodeSetAllowed csa1, Code128Code.CodeSetAllowed csa2)
|
||||
{
|
||||
var vote = 0;
|
||||
|
||||
vote += csa1 == Code128Code.CodeSetAllowed.CodeA ? 1 : 0;
|
||||
vote += csa1 == Code128Code.CodeSetAllowed.CodeB ? -1 : 0;
|
||||
vote += csa2 == Code128Code.CodeSetAllowed.CodeA ? 1 : 0;
|
||||
vote += csa2 == Code128Code.CodeSetAllowed.CodeB ? -1 : 0;
|
||||
|
||||
return vote > 0 ? CodeSet.CodeA : CodeSet.CodeB; // ties go to codeB due to my own prejudices
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
namespace GenCode128
|
||||
{
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for Code128Rendering.
|
||||
/// </summary>
|
||||
public static class Code128Rendering
|
||||
{
|
||||
private const int CQuietWidth = 10;
|
||||
|
||||
// Code patterns:
|
||||
// in principle these rows should each have 6 elements
|
||||
// however, the last one -- STOP -- has 7. The cost of the
|
||||
// extra integers is trivial, and this lets the code flow
|
||||
// much more elegantly
|
||||
private static readonly int[,] CPatterns =
|
||||
{
|
||||
{ 2, 1, 2, 2, 2, 2, 0, 0 }, // 0
|
||||
{ 2, 2, 2, 1, 2, 2, 0, 0 }, // 1
|
||||
{ 2, 2, 2, 2, 2, 1, 0, 0 }, // 2
|
||||
{ 1, 2, 1, 2, 2, 3, 0, 0 }, // 3
|
||||
{ 1, 2, 1, 3, 2, 2, 0, 0 }, // 4
|
||||
{ 1, 3, 1, 2, 2, 2, 0, 0 }, // 5
|
||||
{ 1, 2, 2, 2, 1, 3, 0, 0 }, // 6
|
||||
{ 1, 2, 2, 3, 1, 2, 0, 0 }, // 7
|
||||
{ 1, 3, 2, 2, 1, 2, 0, 0 }, // 8
|
||||
{ 2, 2, 1, 2, 1, 3, 0, 0 }, // 9
|
||||
{ 2, 2, 1, 3, 1, 2, 0, 0 }, // 10
|
||||
{ 2, 3, 1, 2, 1, 2, 0, 0 }, // 11
|
||||
{ 1, 1, 2, 2, 3, 2, 0, 0 }, // 12
|
||||
{ 1, 2, 2, 1, 3, 2, 0, 0 }, // 13
|
||||
{ 1, 2, 2, 2, 3, 1, 0, 0 }, // 14
|
||||
{ 1, 1, 3, 2, 2, 2, 0, 0 }, // 15
|
||||
{ 1, 2, 3, 1, 2, 2, 0, 0 }, // 16
|
||||
{ 1, 2, 3, 2, 2, 1, 0, 0 }, // 17
|
||||
{ 2, 2, 3, 2, 1, 1, 0, 0 }, // 18
|
||||
{ 2, 2, 1, 1, 3, 2, 0, 0 }, // 19
|
||||
{ 2, 2, 1, 2, 3, 1, 0, 0 }, // 20
|
||||
{ 2, 1, 3, 2, 1, 2, 0, 0 }, // 21
|
||||
{ 2, 2, 3, 1, 1, 2, 0, 0 }, // 22
|
||||
{ 3, 1, 2, 1, 3, 1, 0, 0 }, // 23
|
||||
{ 3, 1, 1, 2, 2, 2, 0, 0 }, // 24
|
||||
{ 3, 2, 1, 1, 2, 2, 0, 0 }, // 25
|
||||
{ 3, 2, 1, 2, 2, 1, 0, 0 }, // 26
|
||||
{ 3, 1, 2, 2, 1, 2, 0, 0 }, // 27
|
||||
{ 3, 2, 2, 1, 1, 2, 0, 0 }, // 28
|
||||
{ 3, 2, 2, 2, 1, 1, 0, 0 }, // 29
|
||||
{ 2, 1, 2, 1, 2, 3, 0, 0 }, // 30
|
||||
{ 2, 1, 2, 3, 2, 1, 0, 0 }, // 31
|
||||
{ 2, 3, 2, 1, 2, 1, 0, 0 }, // 32
|
||||
{ 1, 1, 1, 3, 2, 3, 0, 0 }, // 33
|
||||
{ 1, 3, 1, 1, 2, 3, 0, 0 }, // 34
|
||||
{ 1, 3, 1, 3, 2, 1, 0, 0 }, // 35
|
||||
{ 1, 1, 2, 3, 1, 3, 0, 0 }, // 36
|
||||
{ 1, 3, 2, 1, 1, 3, 0, 0 }, // 37
|
||||
{ 1, 3, 2, 3, 1, 1, 0, 0 }, // 38
|
||||
{ 2, 1, 1, 3, 1, 3, 0, 0 }, // 39
|
||||
{ 2, 3, 1, 1, 1, 3, 0, 0 }, // 40
|
||||
{ 2, 3, 1, 3, 1, 1, 0, 0 }, // 41
|
||||
{ 1, 1, 2, 1, 3, 3, 0, 0 }, // 42
|
||||
{ 1, 1, 2, 3, 3, 1, 0, 0 }, // 43
|
||||
{ 1, 3, 2, 1, 3, 1, 0, 0 }, // 44
|
||||
{ 1, 1, 3, 1, 2, 3, 0, 0 }, // 45
|
||||
{ 1, 1, 3, 3, 2, 1, 0, 0 }, // 46
|
||||
{ 1, 3, 3, 1, 2, 1, 0, 0 }, // 47
|
||||
{ 3, 1, 3, 1, 2, 1, 0, 0 }, // 48
|
||||
{ 2, 1, 1, 3, 3, 1, 0, 0 }, // 49
|
||||
{ 2, 3, 1, 1, 3, 1, 0, 0 }, // 50
|
||||
{ 2, 1, 3, 1, 1, 3, 0, 0 }, // 51
|
||||
{ 2, 1, 3, 3, 1, 1, 0, 0 }, // 52
|
||||
{ 2, 1, 3, 1, 3, 1, 0, 0 }, // 53
|
||||
{ 3, 1, 1, 1, 2, 3, 0, 0 }, // 54
|
||||
{ 3, 1, 1, 3, 2, 1, 0, 0 }, // 55
|
||||
{ 3, 3, 1, 1, 2, 1, 0, 0 }, // 56
|
||||
{ 3, 1, 2, 1, 1, 3, 0, 0 }, // 57
|
||||
{ 3, 1, 2, 3, 1, 1, 0, 0 }, // 58
|
||||
{ 3, 3, 2, 1, 1, 1, 0, 0 }, // 59
|
||||
{ 3, 1, 4, 1, 1, 1, 0, 0 }, // 60
|
||||
{ 2, 2, 1, 4, 1, 1, 0, 0 }, // 61
|
||||
{ 4, 3, 1, 1, 1, 1, 0, 0 }, // 62
|
||||
{ 1, 1, 1, 2, 2, 4, 0, 0 }, // 63
|
||||
{ 1, 1, 1, 4, 2, 2, 0, 0 }, // 64
|
||||
{ 1, 2, 1, 1, 2, 4, 0, 0 }, // 65
|
||||
{ 1, 2, 1, 4, 2, 1, 0, 0 }, // 66
|
||||
{ 1, 4, 1, 1, 2, 2, 0, 0 }, // 67
|
||||
{ 1, 4, 1, 2, 2, 1, 0, 0 }, // 68
|
||||
{ 1, 1, 2, 2, 1, 4, 0, 0 }, // 69
|
||||
{ 1, 1, 2, 4, 1, 2, 0, 0 }, // 70
|
||||
{ 1, 2, 2, 1, 1, 4, 0, 0 }, // 71
|
||||
{ 1, 2, 2, 4, 1, 1, 0, 0 }, // 72
|
||||
{ 1, 4, 2, 1, 1, 2, 0, 0 }, // 73
|
||||
{ 1, 4, 2, 2, 1, 1, 0, 0 }, // 74
|
||||
{ 2, 4, 1, 2, 1, 1, 0, 0 }, // 75
|
||||
{ 2, 2, 1, 1, 1, 4, 0, 0 }, // 76
|
||||
{ 4, 1, 3, 1, 1, 1, 0, 0 }, // 77
|
||||
{ 2, 4, 1, 1, 1, 2, 0, 0 }, // 78
|
||||
{ 1, 3, 4, 1, 1, 1, 0, 0 }, // 79
|
||||
{ 1, 1, 1, 2, 4, 2, 0, 0 }, // 80
|
||||
{ 1, 2, 1, 1, 4, 2, 0, 0 }, // 81
|
||||
{ 1, 2, 1, 2, 4, 1, 0, 0 }, // 82
|
||||
{ 1, 1, 4, 2, 1, 2, 0, 0 }, // 83
|
||||
{ 1, 2, 4, 1, 1, 2, 0, 0 }, // 84
|
||||
{ 1, 2, 4, 2, 1, 1, 0, 0 }, // 85
|
||||
{ 4, 1, 1, 2, 1, 2, 0, 0 }, // 86
|
||||
{ 4, 2, 1, 1, 1, 2, 0, 0 }, // 87
|
||||
{ 4, 2, 1, 2, 1, 1, 0, 0 }, // 88
|
||||
{ 2, 1, 2, 1, 4, 1, 0, 0 }, // 89
|
||||
{ 2, 1, 4, 1, 2, 1, 0, 0 }, // 90
|
||||
{ 4, 1, 2, 1, 2, 1, 0, 0 }, // 91
|
||||
{ 1, 1, 1, 1, 4, 3, 0, 0 }, // 92
|
||||
{ 1, 1, 1, 3, 4, 1, 0, 0 }, // 93
|
||||
{ 1, 3, 1, 1, 4, 1, 0, 0 }, // 94
|
||||
{ 1, 1, 4, 1, 1, 3, 0, 0 }, // 95
|
||||
{ 1, 1, 4, 3, 1, 1, 0, 0 }, // 96
|
||||
{ 4, 1, 1, 1, 1, 3, 0, 0 }, // 97
|
||||
{ 4, 1, 1, 3, 1, 1, 0, 0 }, // 98
|
||||
{ 1, 1, 3, 1, 4, 1, 0, 0 }, // 99
|
||||
{ 1, 1, 4, 1, 3, 1, 0, 0 }, // 100
|
||||
{ 3, 1, 1, 1, 4, 1, 0, 0 }, // 101
|
||||
{ 4, 1, 1, 1, 3, 1, 0, 0 }, // 102
|
||||
{ 2, 1, 1, 4, 1, 2, 0, 0 }, // 103
|
||||
{ 2, 1, 1, 2, 1, 4, 0, 0 }, // 104
|
||||
{ 2, 1, 1, 2, 3, 2, 0, 0 }, // 105
|
||||
{ 2, 3, 3, 1, 1, 1, 2, 0 } // 106
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Make an image of a Code128 barcode for a given string
|
||||
/// </summary>
|
||||
/// <param name="inputData">Message to be encoded</param>
|
||||
/// <param name="barWeight">Base thickness for bar width (1 or 2 works well)</param>
|
||||
/// <param name="addQuietZone">Add required horizontal margins (use if output is tight)</param>
|
||||
/// <returns>An Image of the Code128 barcode representing the message</returns>
|
||||
public static Image MakeBarcodeImage(string inputData, int barWeight, bool addQuietZone)
|
||||
{
|
||||
// get the Code128 codes to represent the message
|
||||
var content = new Code128Content(inputData);
|
||||
var codes = content.Codes;
|
||||
|
||||
var width = (((codes.Length - 3) * 11) + 35) * barWeight;
|
||||
var height = Convert.ToInt32(Math.Ceiling(Convert.ToSingle(width) * .15F));
|
||||
|
||||
if (addQuietZone)
|
||||
{
|
||||
width += 2 * CQuietWidth * barWeight; // on both sides
|
||||
}
|
||||
|
||||
// get surface to draw on
|
||||
Image myImage = new Bitmap(width, height);
|
||||
using (var gr = Graphics.FromImage(myImage))
|
||||
{
|
||||
// set to white so we don't have to fill the spaces with white
|
||||
gr.FillRectangle(Brushes.White, 0, 0, width, height);
|
||||
|
||||
// skip quiet zone
|
||||
var cursor = addQuietZone ? CQuietWidth * barWeight : 0;
|
||||
|
||||
for (var codeIdx = 0; codeIdx < codes.Length; codeIdx++)
|
||||
{
|
||||
var code = codes[codeIdx];
|
||||
|
||||
// take the bars two at a time: a black and a white
|
||||
for (var bar = 0; bar < 8; bar += 2)
|
||||
{
|
||||
var barWidth = CPatterns[code, bar] * barWeight;
|
||||
var spcWidth = CPatterns[code, bar + 1] * barWeight;
|
||||
|
||||
// if width is zero, don't try to draw it
|
||||
if (barWidth > 0)
|
||||
{
|
||||
gr.FillRectangle(Brushes.Black, cursor, 0, barWidth, height);
|
||||
}
|
||||
|
||||
// note that we never need to draw the space, since we
|
||||
// initialized the graphics to all white
|
||||
|
||||
// advance cursor beyond this pair
|
||||
cursor += barWidth + spcWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return myImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace GenCode128
|
||||
{
|
||||
public enum CodeSet
|
||||
{
|
||||
CodeA,
|
||||
CodeB
|
||||
//// CodeC // not supported
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{32817BF9-E380-4467-9C7F-936F4B122BC7}</ProjectGuid>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>GenCode128</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>GenCode128</RootNamespace>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>none</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing">
|
||||
<Name>System.Drawing</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms">
|
||||
<Name>System.Windows.Forms</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Code128Code.cs" />
|
||||
<Compile Include="CodeSet.cs" />
|
||||
<Compile Include="AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Code128Content.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Code128Rendering.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -10,12 +10,13 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ClassLibrary1</RootNamespace>
|
||||
<AssemblyName>GraphLib</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -25,6 +26,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -33,6 +35,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
||||
+12
-12
@@ -1,10 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18408
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace ClassLibrary1.Properties {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
@@ -33,7 +33,7 @@ namespace ClassLibrary1.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
@@ -47,8 +47,8 @@ namespace ClassLibrary1.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
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, };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("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")]
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace RestClient
|
||||
{
|
||||
public class Q2PreCorrection
|
||||
{
|
||||
public bool AreDataCalculated;
|
||||
public int CorrLR;
|
||||
public int CorrRL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
|
||||
</packages>
|
||||
+101
-108
@@ -1,32 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Results.Entities;
|
||||
|
||||
namespace Results
|
||||
{
|
||||
public class BatchResults
|
||||
public class BatchResults
|
||||
{
|
||||
public readonly int WMPositionsCount;
|
||||
public Batch Batch;
|
||||
public int WMPositionsCount;
|
||||
|
||||
public IList<Entities.TestData> TestDataList;
|
||||
public IList<Entities.Components> ComponentsList;
|
||||
public IList<Entities.WaterMeterData> WaterMeterDataList;
|
||||
public IList<Entities.TestData> TestDataList;
|
||||
public IList<Entities.Components> ComponentsList;
|
||||
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)
|
||||
: this()
|
||||
{
|
||||
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,
|
||||
string user, int userNr, string programVer, Config.Entities.Procedure procedure,
|
||||
WaterMeterData[] waterMeterDatas, int[] waterMeterParts, double densityCorr)
|
||||
@@ -38,6 +49,7 @@ namespace Results
|
||||
d.Batch = new Batch()
|
||||
{
|
||||
BatchNr = batchNr,
|
||||
ProgramVersion = programVer,
|
||||
TestBenchId = benchId,
|
||||
TestBenchName = benchName,
|
||||
Address1 = a1,
|
||||
@@ -45,7 +57,6 @@ namespace Results
|
||||
Address3 = a3,
|
||||
Address4 = a4,
|
||||
Address5 = a5,
|
||||
ProgramVersion = programVer,
|
||||
UserName = user,
|
||||
UserNumber = userNr,
|
||||
ProcedureName = procedure.Name,
|
||||
@@ -65,62 +76,64 @@ namespace Results
|
||||
/// Add watermeter to an array, array index is WM position.
|
||||
/// AddWaterMetersToBatch() has to be used before saving results.
|
||||
///
|
||||
d.WaterMeters = new WaterMeter[d.WMPositionsCount];
|
||||
for (int i = 0; i < d.WMPositionsCount; i++)
|
||||
for (int wmPos0 = 0; wmPos0 < d.WMPositionsCount; wmPos0++)
|
||||
{
|
||||
if (waterMeterDatas[i] == null) continue;
|
||||
WaterMeterData wmd = WaterMeterData.UpdateList(d.WaterMeterDataList, waterMeterDatas[i]);
|
||||
d.WaterMeters[i] = new WaterMeter()
|
||||
{
|
||||
Batch = d.Batch,
|
||||
WaterMeterData = wmd,
|
||||
WMPosition = i + 1,
|
||||
YearOfProduction = year,
|
||||
};
|
||||
if (waterMeterDatas[wmPos0] == null)
|
||||
{
|
||||
d.Batch.WaterMeters.Add(new WaterMeter() { Batch = d.Batch,
|
||||
WaterMeterData = null,
|
||||
WMPosition = wmPos0 + 1,
|
||||
YearOfProduction = year,
|
||||
Disabled = true, });
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (t.Publish != (byte)Config.Entities.Publish.Never)
|
||||
TestData td = TestData.UpdateList(d.TestDataList, new TestData(t));
|
||||
|
||||
for (int rnr = 1; rnr <= t.Repeats; rnr++)
|
||||
{
|
||||
TestData td = TestData.UpdateList(d.TestDataList, new TestData(t));
|
||||
/// 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);
|
||||
|
||||
for (int rnr = 1; rnr <= t.Repeats; rnr++)
|
||||
for (int i = 0; i < d.WMPositionsCount; 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);
|
||||
|
||||
for (int i = 0; i < d.WMPositionsCount; i++)
|
||||
{
|
||||
if (d.WaterMeters[i] == null) continue;
|
||||
|
||||
if (!t.IsPartCompatible(waterMeterParts[i])) continue;
|
||||
|
||||
///
|
||||
/// Create empty watermeter test results and add them to the list and to dictionaries
|
||||
///
|
||||
IList<MeterTestRslt> wmtrs = d.WaterMeters[i].MeterTestRslts;
|
||||
if (d.Batch.Compound)
|
||||
{
|
||||
/// Compound water meter
|
||||
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundMain));
|
||||
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundAux));
|
||||
wmtrs.Add(new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Compound));
|
||||
}
|
||||
else if (d.Batch.HeatMeter)
|
||||
{
|
||||
/// 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));
|
||||
}
|
||||
}
|
||||
if (!d.Batch.WaterMeters[i].Disabled && t.IsPartCompatible(waterMeterParts[i]))
|
||||
{
|
||||
///
|
||||
/// Create empty watermeter test results and add them to the list and to dictionaries
|
||||
///
|
||||
IList<MeterTestRslt> wmtrs = d.Batch.WaterMeters[i].MeterTestRslts;
|
||||
if (d.Batch.Compound)
|
||||
{
|
||||
/// Compound water meter
|
||||
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));
|
||||
}
|
||||
else if (d.Batch.HeatMeter)
|
||||
{
|
||||
/// Heat meter
|
||||
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterVolume));
|
||||
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterEnergy));
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Water meter
|
||||
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Single));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,11 +150,17 @@ namespace Results
|
||||
|
||||
BatchResults batchResults = new BatchResults(wmPosMax);
|
||||
batchResults.Batch = batch;
|
||||
batchResults.WaterMeters = new WaterMeter[wmPosMax];
|
||||
for (int i = 0; i < batch.WaterMeters.Count; i++)
|
||||
/// Insert missing disabled water meters
|
||||
for (int wmNr0 = 0; wmNr0 < wmPosMax; wmNr0++)
|
||||
{
|
||||
WaterMeter wm = batch.WaterMeters[i];
|
||||
batchResults.WaterMeters[wm.WMPosition - 1] = wm;
|
||||
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;
|
||||
@@ -152,11 +171,11 @@ namespace Results
|
||||
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 (WaterMeters[wmnr0] != null)
|
||||
if (Batch.WaterMeters != null && Batch.WaterMeters.Count > wmNr0 && !Batch.WaterMeters[wmNr0].Disabled)
|
||||
{
|
||||
return WaterMeters[wmnr0].GetMeterTestRslt(name, meterId);
|
||||
return Batch.WaterMeters[wmNr0].GetMeterTestRslt(name, meterId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -168,13 +187,13 @@ namespace Results
|
||||
/// <returns>true = all tests done</returns>
|
||||
public bool AllTestsDone()
|
||||
{
|
||||
for (int i = 0; i < WMPositionsCount; i++)
|
||||
for (int wmNr0 = 0; wmNr0 < WMPositionsCount; wmNr0++)
|
||||
{
|
||||
if ((WaterMeters[i] != null) && !WaterMeters[i].Disabled)
|
||||
if (Batch.WaterMeters != null && Batch.WaterMeters.Count > wmNr0 && !Batch.WaterMeters[wmNr0].Disabled)
|
||||
{
|
||||
foreach (var mtr in WaterMeters[i].MeterTestRslts)
|
||||
foreach (var mtr in Batch.WaterMeters[wmNr0].MeterTestRslts)
|
||||
{
|
||||
if (!mtr.TestDone) return false;
|
||||
if (mtr.Evaluate() && !mtr.TestDone) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,43 +201,17 @@ namespace Results
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds non-null water meters from an array to a Batch water meters list.
|
||||
/// This method should be used when results are prepared and
|
||||
/// 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 bool IsProduction()
|
||||
public virtual void WriteBinary(BinaryWriter writer)
|
||||
{
|
||||
for (int i = 0; i < WMPositionsCount; i++)
|
||||
{
|
||||
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;
|
||||
Batch.WriteBinary(writer);
|
||||
writer.Write(WMPositionsCount);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ReadBinary(BinaryReader reader)
|
||||
{
|
||||
Batch = new Batch();
|
||||
Batch.ReadBinary(reader);
|
||||
WMPositionsCount = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+155
-15
@@ -1,26 +1,28 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
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 TestBenchId { get; set; }
|
||||
public virtual string ProgramVersion { get; set; }
|
||||
public virtual int TestBenchId { get; set; }
|
||||
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 Address2 { 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 Address5 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string ProgramVersion { get; set; }
|
||||
public virtual string UserName { get; set; }
|
||||
public virtual int UserNumber { 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 int ProcedureRevision { get; set; }
|
||||
public virtual string WatermetersStr { get; set; } /// CEVAK, not mapped to DB
|
||||
@@ -29,11 +31,6 @@ namespace Results.Entities
|
||||
public virtual float DensityCorr { get; set; } /// Density correction in [kg/m3]
|
||||
public virtual float Custom2 { get; set; }
|
||||
public virtual float Custom3 { get; set; }
|
||||
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; }
|
||||
public virtual int Counter6 { get; set; }
|
||||
public virtual int Counter7 { get; set; }
|
||||
public virtual int Counter8 { get; set; }
|
||||
@@ -55,6 +52,22 @@ namespace Results.Entities
|
||||
Tests = new List<TestData>();
|
||||
WaterMeters = new List<WaterMeter>();
|
||||
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()
|
||||
@@ -213,11 +226,138 @@ namespace Results.Entities
|
||||
|
||||
public virtual string ToString(int i)
|
||||
{
|
||||
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, TestBenchId, ProgramVersion, UserName, UserNumber,
|
||||
ProcedureName, ProcedureRevision, ProtocolTitle, Remark, DensityCorr,
|
||||
Custom2, Custom3, StartTime, EndTime, Dirty,
|
||||
RsltsSent, RsltsPrinted);
|
||||
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}",
|
||||
BatchNr, ProgramVersion, TestBenchId, UserName, UserNumber,
|
||||
ProcedureName, (IsRemoteProcedure ? "(R)" : ""), ProcedureRevision,
|
||||
ProtocolTitle, Remark, DensityCorr, Custom2, Custom3,
|
||||
StartTime, EndTime, Dirty, 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
public class Components
|
||||
public class Components
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int TestBenchId { get; set; }
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int TestBenchId { get; set; }
|
||||
public virtual string TestBenchName { get; set; }
|
||||
public virtual string Pump { get; set; }
|
||||
public virtual string RegValve { get; set; }
|
||||
@@ -21,7 +22,7 @@ namespace Results.Entities
|
||||
public virtual string Custom2 { get; set; }
|
||||
public virtual string Custom3 { get; set; }
|
||||
|
||||
protected Components()
|
||||
public Components()
|
||||
{
|
||||
TestBenchId = 0;
|
||||
TestBenchName = string.Empty;
|
||||
@@ -59,15 +60,15 @@ namespace Results.Entities
|
||||
public virtual bool Equals(Components bc)
|
||||
{
|
||||
if (TestBenchId != bc.TestBenchId) return false;
|
||||
if (!TestBenchName.Equals(bc.TestBenchName)) return false;
|
||||
if (!Pump.Equals(bc.Pump)) return false;
|
||||
if (!RegValve.Equals(bc.RegValve)) return false;
|
||||
if (!Flowmeter.Equals(bc.Flowmeter)) return false;
|
||||
if (!Diverter.Equals(bc.Diverter)) return false;
|
||||
if (!Scale.Equals(bc.Scale)) return false;
|
||||
if (!Custom1.Equals(bc.Custom1)) return false;
|
||||
if (!Custom2.Equals(bc.Custom2)) return false;
|
||||
if (!Custom3.Equals(bc.Custom3)) return false;
|
||||
if (TestBenchName != bc.TestBenchName) return false;
|
||||
if (Pump != bc.Pump) return false;
|
||||
if (RegValve != bc.RegValve) return false;
|
||||
if (Flowmeter != bc.Flowmeter) return false;
|
||||
if (Diverter != bc.Diverter) return false;
|
||||
if (Scale != bc.Scale) return false;
|
||||
if (Custom1 != bc.Custom1) return false;
|
||||
if (Custom2 != bc.Custom2) return false;
|
||||
if (Custom3 != bc.Custom3) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -90,5 +91,35 @@ namespace Results.Entities
|
||||
list.Add(item); /// Item not fund in the list, it is added to the list
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
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 int RegReaderType { get; set; } /// Not mapped to the DB, does not depend on localization and customer
|
||||
|
||||
@@ -143,5 +144,73 @@ namespace Results.Entities
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
|
||||
/// </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 int Repeats { get; set; }
|
||||
public virtual double Qtg { get; set; } /// [m3/h] flow range low limit
|
||||
@@ -31,7 +32,7 @@ namespace Results.Entities
|
||||
public virtual bool Evaluate { get; set; }
|
||||
|
||||
|
||||
protected TestData()
|
||||
public TestData()
|
||||
{
|
||||
Name = string.Empty;
|
||||
Method = string.Empty;
|
||||
@@ -66,14 +67,14 @@ namespace Results.Entities
|
||||
/// <returns>first = two entities are equal (except of Id)</returns>
|
||||
public virtual bool Equals(TestData td)
|
||||
{
|
||||
if (!Name.Equals(td.Name)) return false;
|
||||
if (Name != td.Name) return false;
|
||||
if (Repeats != td.Repeats) return false;
|
||||
if (Qtg != td.Qtg) return false;
|
||||
if (Qfrom != td.Qfrom) return false;
|
||||
if (Qto != td.Qto) return false;
|
||||
if (TargetVolume != td.TargetVolume) return false;
|
||||
if (TargetTime != td.TargetTime) return false;
|
||||
if (!Method.Equals(td.Method)) return false;
|
||||
if (Method != td.Method) return false;
|
||||
if (ErrLimLo != td.ErrLimLo) return false;
|
||||
if (ErrLimHi != td.ErrLimHi) return false;
|
||||
if (ErrLimMargin != td.ErrLimMargin) return false;
|
||||
@@ -107,5 +108,47 @@ namespace Results.Entities
|
||||
list.Add(item); /// Item not fund in the list, it is added to the list
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
public class TestRslt
|
||||
{
|
||||
/// Identity
|
||||
/// Identity
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual Batch Batch { get; set; }
|
||||
public virtual TestData TestData { get; set; }
|
||||
@@ -131,7 +132,13 @@ namespace Results.Entities
|
||||
public virtual float Custom8 { get; set; } /// [°C] T ref lo end
|
||||
public virtual float Custom9 { get; set; } /// [°C] T ref lo min
|
||||
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
|
||||
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
|
||||
public virtual int Repeats() { return TestData.Repeats; }
|
||||
@@ -215,8 +222,10 @@ namespace Results.Entities
|
||||
public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData.Publish; }
|
||||
|
||||
|
||||
protected TestRslt()
|
||||
public TestRslt()
|
||||
{
|
||||
MethodClass = string.Empty;
|
||||
Remark = string.Empty;
|
||||
}
|
||||
|
||||
public TestRslt(Batch batch, TestData testData, int part, int repetitionNr)
|
||||
@@ -322,6 +331,7 @@ namespace Results.Entities
|
||||
FlowEnd = src.FlowEnd;
|
||||
FlowMin = src.FlowMin;
|
||||
FlowMax = src.FlowMax;
|
||||
|
||||
Custom1 = src.Custom1;
|
||||
Custom2 = src.Custom2;
|
||||
Custom3 = src.Custom3;
|
||||
@@ -332,6 +342,12 @@ namespace Results.Entities
|
||||
Custom8 = src.Custom8;
|
||||
Custom9 = src.Custom9;
|
||||
Custom10 = src.Custom10;
|
||||
|
||||
Counter1 = src.Counter1;
|
||||
Counter2 = src.Counter2;
|
||||
Counter3 = src.Counter3;
|
||||
Counter4 = src.Counter4;
|
||||
Counter5 = src.Counter5;
|
||||
}
|
||||
|
||||
/// <summary> Wrapper </summary>
|
||||
@@ -359,7 +375,7 @@ namespace Results.Entities
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", Batch.BatchNr, Batch.ProcedureName, Name(), StartTime.ToShortDateString(), StartTime.ToShortTimeString());
|
||||
return string.Format("batch={0}, procedure={1}, test={2}, part={3} start={4} {5}", Batch.BatchNr, Batch.ProcedureName, Name(), Part, StartTime.ToShortDateString(), StartTime.ToShortTimeString());
|
||||
}
|
||||
|
||||
public virtual string ToString(int i)
|
||||
@@ -382,5 +398,287 @@ namespace Results.Entities
|
||||
Custom1, Custom2, Custom3, Custom4, Custom5, Custom6, Custom7, Custom8, Custom9, Custom10,
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
|
||||
public enum ResultCode
|
||||
{
|
||||
None = 0,
|
||||
@@ -41,12 +41,12 @@ namespace Results.Entities
|
||||
|
||||
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 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 PurchaseOrder { get; set; }
|
||||
public virtual int YearOfProduction { get; set; }
|
||||
public virtual int WMPosition { get; set; }
|
||||
public virtual int WMPosition { get; set; } /// 1-based water meter position
|
||||
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 double QRise { get; set; } /// [m3/h] detected Q_rise of a composed meter or 'sensitivity' of a single meter
|
||||
@@ -133,9 +133,6 @@ namespace Results.Entities
|
||||
public virtual DateTime StartTime() { return Batch.StartTime; }
|
||||
public virtual DateTime EndTime() { return Batch.EndTime; }
|
||||
|
||||
protected MeterTestRslt lastMeterTestRslts;
|
||||
public virtual MeterTestRslt LastMeterTestRslts() { return lastMeterTestRslts; }
|
||||
|
||||
|
||||
public virtual long ErrorFlagsFromTests()
|
||||
{
|
||||
@@ -353,7 +350,25 @@ namespace Results.Entities
|
||||
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)
|
||||
@@ -534,5 +549,204 @@ namespace Results.Entities
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2017 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
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 Producer { get; set; }
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace Results.Entities
|
||||
/// <returns>first = two entities are equal (except of Id)</returns>
|
||||
public virtual bool Equals(WaterMeterData wmd)
|
||||
{
|
||||
if (!ProductName.Equals(wmd.ProductName)) return false;
|
||||
if (!Producer.Equals(wmd.Producer)) return false;
|
||||
if (ProductName != wmd.ProductName) return false;
|
||||
if (Producer != wmd.Producer) return false;
|
||||
|
||||
if (DN != wmd.DN) return false;
|
||||
if (L != wmd.L) return false;
|
||||
@@ -81,13 +81,13 @@ namespace Results.Entities
|
||||
if (Q2_Qt != wmd.Q2_Qt) return false;
|
||||
if (Q1_Qmin != wmd.Q1_Qmin) return false;
|
||||
|
||||
if (!MetrologicalClass.Equals(wmd.MetrologicalClass)) return false;
|
||||
if (!TemperatureClass.Equals(wmd.TemperatureClass)) return false;
|
||||
if (!PressureLossClass.Equals(wmd.PressureLossClass)) return false;
|
||||
if (!MaxAdmissiblePressure.Equals(wmd.MaxAdmissiblePressure)) return false;
|
||||
if (!FlowProfileSensitivityClass.Equals(wmd.FlowProfileSensitivityClass)) return false;
|
||||
if (MetrologicalClass != wmd.MetrologicalClass) return false;
|
||||
if (TemperatureClass != wmd.TemperatureClass) return false;
|
||||
if (PressureLossClass != wmd.PressureLossClass) return false;
|
||||
if (MaxAdmissiblePressure != wmd.MaxAdmissiblePressure) return false;
|
||||
if (FlowProfileSensitivityClass != wmd.FlowProfileSensitivityClass) return false;
|
||||
|
||||
if (!ApprovalInfo.Equals(wmd.ApprovalInfo)) return false;
|
||||
if (ApprovalInfo != wmd.ApprovalInfo) return false;
|
||||
if (Certificate != wmd.Certificate) return false;
|
||||
|
||||
if (PulsesPerLtr != wmd.PulsesPerLtr) return false;
|
||||
@@ -132,5 +132,81 @@ namespace Results.Entities
|
||||
list.Add(item); /// Item not fund in the list, it is added to the list
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,11 +78,11 @@ namespace Results.Forms
|
||||
///
|
||||
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if (Results.WaterMeters != null && args.WMPosition > 0)
|
||||
if (args.WMPosition > 0)
|
||||
{
|
||||
foreach (var wm in Results.WaterMeters)
|
||||
foreach (var wm in Results.Batch.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && (wm.WMPosition == args.WMPosition))
|
||||
if (!wm.Disabled && (wm.WMPosition == args.WMPosition))
|
||||
{
|
||||
ShowMoreWMResults(wm);
|
||||
return;
|
||||
@@ -124,9 +124,9 @@ namespace Results.Forms
|
||||
/// Determine water meter positions count
|
||||
///
|
||||
int displayedControlsCount = 0;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
for (int i = 0; i < results.Batch.WaterMeters.Count; i++)
|
||||
{
|
||||
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
|
||||
if ((!results.Batch.WaterMeters[i].Disabled) || ShowDisabledPositions)
|
||||
{
|
||||
displayedControlsCount++;
|
||||
}
|
||||
@@ -165,9 +165,9 @@ namespace Results.Forms
|
||||
wmRsltsCtrl = new IOneWMResultsCtrl[displayedControlsCount];
|
||||
int ix = 0;
|
||||
firstEnabledControl = null;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
for (int i = 0; i < results.Batch.WaterMeters.Count; i++)
|
||||
{
|
||||
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
|
||||
if (!results.Batch.WaterMeters[i].Disabled || ShowDisabledPositions)
|
||||
{
|
||||
/// Create one water meter position / control
|
||||
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
|
||||
@@ -176,9 +176,9 @@ namespace Results.Forms
|
||||
wmRsltsCtrl[ix].Width = oneWidth;
|
||||
wmRsltsCtrl[ix].Height = oneHeight;
|
||||
|
||||
if ((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
|
||||
if (!results.Batch.WaterMeters[i].Disabled)
|
||||
{
|
||||
if ((firstEnabledControl == null) && (results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
|
||||
if ((firstEnabledControl == null) && !results.Batch.WaterMeters[i].Disabled)
|
||||
{
|
||||
firstEnabledControl = wmRsltsCtrl[ix];
|
||||
}
|
||||
@@ -211,14 +211,14 @@ namespace Results.Forms
|
||||
|
||||
void UpdateResults(Results.BatchResults results)
|
||||
{
|
||||
if ((results != null) && (results.WaterMeters != null))
|
||||
if (results != null && results.Batch != null && results.Batch.WaterMeters != null)
|
||||
{
|
||||
int ctrlIx = 0;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
for (int wmNr0 = 0; wmNr0 < results.Batch.WaterMeters.Count; wmNr0++)
|
||||
{
|
||||
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
|
||||
if (!results.Batch.WaterMeters[wmNr0].Disabled || ShowDisabledPositions)
|
||||
{
|
||||
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(results.WaterMeters[i]);
|
||||
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(results.Batch.WaterMeters[wmNr0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,16 +310,19 @@ namespace Results.Forms
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
|
||||
/// Update size of controls
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
///
|
||||
foreach (var oneCtrl in wmRsltsCtrl)
|
||||
if (wmRsltsCtrl != null)
|
||||
{
|
||||
oneCtrl.Width = oneWidth;
|
||||
oneCtrl.Height = oneHeight;
|
||||
/// Update size of controls
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
///
|
||||
foreach (var oneCtrl in wmRsltsCtrl)
|
||||
{
|
||||
oneCtrl.Width = oneWidth;
|
||||
oneCtrl.Height = oneHeight;
|
||||
}
|
||||
///
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
}
|
||||
///
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,13 +146,13 @@ namespace Results.Forms
|
||||
tracingResultsListView.Items.Add(new ListViewItem(new string[]
|
||||
{
|
||||
rr.TimeStamp.ToString("dd.MM.yyyy HH:mm"),
|
||||
rr.Workstep.Name,
|
||||
(rr.Workstep != null) ? rr.Workstep.Name : string.Empty,
|
||||
rr.Workplace,
|
||||
rr.UserName,
|
||||
rr.Result == 0 ? "OK" : "NOK",
|
||||
rr.Workstep.ReferencePart.Name,
|
||||
(rr.Workstep != null && rr.Workstep.ReferencePart != null) ? rr.Workstep.ReferencePart.Name : string.Empty,
|
||||
rr.Code,
|
||||
rr.Process.Name,
|
||||
(rr.Process != null) ? rr.Process.Name : string.Empty,
|
||||
}));
|
||||
|
||||
for (int i = 0; i < isMissing.Length; i++)
|
||||
|
||||
@@ -26,16 +26,13 @@ namespace Results.Mappings
|
||||
.Column("Custom1"); ;
|
||||
Map(x => x.Custom2);
|
||||
Map(x => x.Custom3);
|
||||
Map(x => x.Counter1);
|
||||
Map(x => x.Counter2);
|
||||
Map(x => x.Counter3);
|
||||
Map(x => x.Counter4);
|
||||
Map(x => x.Counter5);
|
||||
|
||||
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.EndTime);
|
||||
Map(x => x.Dirty);
|
||||
|
||||
@@ -12,9 +12,7 @@ namespace Results.Mappings
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.Name);
|
||||
#if TEST_PROFILES
|
||||
Map(x => x.Qtg);
|
||||
#endif
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qto);
|
||||
Map(x => x.TargetVolume);
|
||||
|
||||
@@ -117,6 +117,12 @@ namespace Results.Mappings
|
||||
Map(x => x.Custom6);
|
||||
Map(x => x.Custom7);
|
||||
Map(x => x.Custom8);
|
||||
}
|
||||
|
||||
Map(x => x.Counter1);
|
||||
Map(x => x.Counter2);
|
||||
Map(x => x.Counter3);
|
||||
Map(x => x.Counter4);
|
||||
Map(x => x.Counter5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace Results.Output.Printers
|
||||
{
|
||||
public enum BarcodeType
|
||||
{
|
||||
None,
|
||||
Code_128_Horizontally,
|
||||
Code_128_Vertically,
|
||||
QR_Code,
|
||||
Count
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Gma.QrCodeNet.Encoding;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
using GenCode128;
|
||||
|
||||
namespace Results.Output.Printers.Label
|
||||
{
|
||||
public class LabelPrintDocument : PrintersCommon
|
||||
{
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
static QrEncoder encoder = new QrEncoder();
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
readonly int printHeight;
|
||||
readonly int printWidth;
|
||||
|
||||
@@ -93,6 +98,55 @@ namespace Results.Output.Printers.Label
|
||||
e.Graphics.DrawString(item.Print(wm), this.font, Brushes.Black, printArea);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.BarcodeType != BarcodeType.None && cfg.BarcodeType < BarcodeType.Count)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (cfg.BarcodeType == BarcodeType.QR_Code)
|
||||
{
|
||||
QrCode qrCode = encoder.Encode(wm.SerialNr);
|
||||
DrawQR(e.Graphics, qrCode, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
|
||||
}
|
||||
else if (cfg.BarcodeType == BarcodeType.Code_128_Horizontally || cfg.BarcodeType == BarcodeType.Code_128_Vertically)
|
||||
{
|
||||
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
|
||||
if (cfg.BarcodeType == BarcodeType.Code_128_Vertically)
|
||||
{
|
||||
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
}
|
||||
e.Graphics.DrawImage(img, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
|
||||
namespace Results.Output.Printers.Label
|
||||
@@ -16,6 +16,10 @@ namespace Results.Output.Printers.Label
|
||||
public int FontStyle;
|
||||
public System.Globalization.CultureInfo CultureInfo;
|
||||
public bool GoodOnly;
|
||||
public bool SupressPrinting; /// true = Bypass printing
|
||||
}
|
||||
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
|
||||
public int BarcodeLeft;
|
||||
public int BarcodeTop;
|
||||
public int BarcodeWidth;
|
||||
public int BarcodeHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Gma.QrCodeNet.Encoding;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
using GenCode128;
|
||||
|
||||
namespace Results.Output.Printers.MultiLabel
|
||||
{
|
||||
public class MultiLabelPrintDocument : PrintersCommon
|
||||
{
|
||||
static QrEncoder encoder = new QrEncoder();
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
readonly int labelHeight;
|
||||
readonly int labelWidth;
|
||||
|
||||
/// Selected font
|
||||
readonly Font font;
|
||||
|
||||
/// Data to print
|
||||
Results.Entities.Batch batch;
|
||||
MultiLabelPrinterCfg cfg;
|
||||
IList<Results.Entities.WaterMeter> waterMeters;
|
||||
|
||||
/// Items to print
|
||||
IList<WMeterRsltItemSpec> itemsToPrint;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public MultiLabelPrintDocument(Results.Entities.Batch batch, MultiLabelPrinterCfg cfg, string documentName)
|
||||
{
|
||||
DocumentName = documentName;
|
||||
|
||||
this.batch = batch;
|
||||
this.waterMeters = batch.WaterMeters;
|
||||
this.cfg = cfg;
|
||||
this.itemsToPrint = Results.WMeterRsltItemSpec.FromStrArray(cfg.ItemsToPrint);
|
||||
|
||||
/// Initialize fonts
|
||||
font = new Font((cfg.FontFamily != null ? cfg.FontFamily : "Arial"),
|
||||
(cfg.FontSize > 0 ? cfg.FontSize : 10),
|
||||
(FontStyle)cfg.FontStyle);
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
|
||||
///
|
||||
labelHeight = cfg.LabelHeight;
|
||||
labelWidth = cfg.LabelWidth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default onbeginPrint method of the PrintDocument Object
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks></remarks>
|
||||
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
|
||||
{
|
||||
base.OnBeginPrint(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default OnPrintPage method of the PrintDocument.
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks>This provides the print logic for our document</remarks>
|
||||
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
/// Run base code
|
||||
base.OnPrintPage(e);
|
||||
|
||||
int labelColumn = 0;
|
||||
int labelLeft = cfg.LeftTopLabelLeft;
|
||||
int labelTop = cfg.LeftTopLabelTop;
|
||||
foreach (var wm in waterMeters)
|
||||
{
|
||||
if (!wm.Disabled && (!cfg.GoodOnly || wm.Passed))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(cfg.Template))
|
||||
{
|
||||
string templatePath = Path.Combine("C:\\TBF\\Templates\\", cfg.Template);
|
||||
if (File.Exists(templatePath))
|
||||
{
|
||||
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), labelWidth, labelHeight), new Rectangle(labelLeft, labelTop, labelWidth, labelHeight));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in itemsToPrint)
|
||||
{
|
||||
string[] coords = item.Caption.Split(new char[] { ';' });
|
||||
int x, y;
|
||||
if (coords.Length >= 2 && int.TryParse(coords[0].Trim(new char[] { ' ' }), out x)
|
||||
&& int.TryParse(coords[1].Trim(new char[] { ' ' }), out y))
|
||||
{
|
||||
RectangleF printArea = new RectangleF(labelLeft + x, labelTop + y, labelWidth - x, labelHeight - y);
|
||||
e.Graphics.DrawString(item.Print(wm), this.font, Brushes.Black, printArea);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.BarcodeType != BarcodeType.None && cfg.BarcodeType < BarcodeType.Count)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (cfg.BarcodeType == BarcodeType.QR_Code)
|
||||
{
|
||||
QrCode qrCode = encoder.Encode(wm.SerialNr);
|
||||
DrawQR(e.Graphics, qrCode, labelLeft + cfg.BarcodeLeft, labelTop + cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
|
||||
}
|
||||
else if (cfg.BarcodeType == BarcodeType.Code_128_Horizontally || cfg.BarcodeType == BarcodeType.Code_128_Vertically)
|
||||
{
|
||||
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
|
||||
if (cfg.BarcodeType == BarcodeType.Code_128_Vertically)
|
||||
{
|
||||
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
}
|
||||
e.Graphics.DrawImage(img, labelLeft + cfg.BarcodeLeft, labelTop + cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Move (labelLeft, labelTop) coordinates to the next label
|
||||
///
|
||||
if (++labelColumn == cfg.LabelColumnsCount)
|
||||
{
|
||||
labelColumn = 0;
|
||||
labelLeft = cfg.LeftTopLabelLeft;
|
||||
labelTop += cfg.LabelHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
labelLeft += cfg.LabelWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
|
||||
namespace Results.Output.Printers.MultiLabel
|
||||
{
|
||||
public class MultiLabelPrinterCfg
|
||||
{
|
||||
public Config.Entities.PageOrientation PageOrientation;
|
||||
public int LabelColumnsCount;
|
||||
public int LeftTopLabelLeft;
|
||||
public int LeftTopLabelTop;
|
||||
public bool GoodOnly;
|
||||
|
||||
public string[] ItemsToPrint;
|
||||
public int LabelWidth; /// In 0,254 mm = 1/100 in = 100dpi pixels count
|
||||
public int LabelHeight; /// In 0,254 mm = 1/100 in = 100dpi pixels count
|
||||
public string Template; /// Full path to a 'png' file
|
||||
public string FontFamily;
|
||||
public int FontSize;
|
||||
public int FontStyle;
|
||||
public System.Globalization.CultureInfo CultureInfo;
|
||||
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
|
||||
public int BarcodeLeft;
|
||||
public int BarcodeTop;
|
||||
public int BarcodeWidth;
|
||||
public int BarcodeHeight;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2018-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace TBF.BenchControl.Output
|
||||
namespace Results.Output
|
||||
{
|
||||
public enum LogType
|
||||
{
|
||||
@@ -56,6 +57,8 @@ namespace TBF.BenchControl.Output
|
||||
public double Uncertainty;
|
||||
public string TestMethod;
|
||||
|
||||
public SensusTestInfo() { }
|
||||
|
||||
public SensusTestInfo(string tstName, int pnDB, string qbDB, int pnOpto, string qbOpto, int pnLog, string qbLog, Range range)
|
||||
{
|
||||
TestName = tstName;
|
||||
@@ -414,9 +417,132 @@ namespace TBF.BenchControl.Output
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a array of SensusTestInfo objects representing the procedure.
|
||||
/// Multiple parts of the same test (with the same name) generate only one SensusTestInfo object.
|
||||
/// </summary>
|
||||
/// <param name="procedure">Procedure entity</param>
|
||||
/// <returns>Array of SensusTestInfo objects</returns>
|
||||
public static SensusTestInfo[] CreateFromProcedure(Config.Entities.Procedure procedure)
|
||||
{
|
||||
///
|
||||
/// Count the number of different tests.
|
||||
/// Multiple parts of the same test (same name) are counted only once.
|
||||
///
|
||||
IList<string> listOfHydroTests = new List<string>();
|
||||
foreach (var test in procedure.Tests)
|
||||
{
|
||||
if (!test.Method.ToLower().Contains("iperlcommunication"))
|
||||
{
|
||||
for (int repNr = 1; repNr <= test.Repeats; repNr++)
|
||||
{
|
||||
string fullTestNameWoPart = (test.Repeats == 1) ? test.Name : string.Format("{0} ({1}/{2})", test.Name, repNr, test.Repeats);
|
||||
if (!listOfHydroTests.Contains(fullTestNameWoPart))
|
||||
{
|
||||
listOfHydroTests.Add(fullTestNameWoPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SensusTestInfo[] stiArray = new SensusTestInfo[listOfHydroTests.Count];
|
||||
int ix = 0;
|
||||
int luID = listOfHydroTests.Count;
|
||||
listOfHydroTests.Clear();
|
||||
|
||||
foreach (var test in procedure.Tests)
|
||||
{
|
||||
if (!test.Method.ToLower().Contains("iperlcommunication"))
|
||||
{
|
||||
for (int repNr = 1; repNr <= test.Repeats; repNr++)
|
||||
{
|
||||
string fullTestNameWoPart = (test.Repeats == 1) ? test.Name : string.Format("{0} ({1}/{2})", test.Name, repNr, test.Repeats);
|
||||
if (!listOfHydroTests.Contains(fullTestNameWoPart))
|
||||
{
|
||||
listOfHydroTests.Add(fullTestNameWoPart);
|
||||
stiArray[ix++] = CreateFromTest(test, repNr, luID--, fullTestNameWoPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stiArray;
|
||||
}
|
||||
|
||||
public static SensusTestInfo CreateFromTest(Config.Entities.Test test, int repetitionNr, int luID, string fullTestNameWoPart)
|
||||
{
|
||||
bool isQ4Q3 = test.Name.ToLower().Contains("q4") ||
|
||||
test.Name.ToLower().Contains("q3") ||
|
||||
test.Name.ToLower().Contains("qmax") ||
|
||||
test.Name.ToLower().Contains("qn");
|
||||
|
||||
bool isQ2Q1 = test.Name.ToLower().Contains("q2") ||
|
||||
test.Name.ToLower().Contains("q1") ||
|
||||
test.Name.ToLower().Contains("qt") ||
|
||||
test.Name.ToLower().Contains("qmin");
|
||||
|
||||
/// Range.R90_100 or Range.R100_110 (flow range in % of a target flow)
|
||||
Range range = isQ4Q3 ? Range.R90_100 : (isQ2Q1 ? Range.R100_110 : Range.R95_105);
|
||||
|
||||
return new SensusTestInfo()
|
||||
{
|
||||
TestName = fullTestNameWoPart, /// Test name in TBF procedures
|
||||
PruefungsNrDB = luID, /// Identification of a flow
|
||||
QBezeichnungDB = fullTestNameWoPart, /// Flow name in Oracle database
|
||||
PruefungsNrOpto = luID, /// Identification of a flow - string form for log files
|
||||
QBezeichnungOpto = luID.ToString("D02"), /// Flow name in Oracle database
|
||||
PruefungsNrLog = luID, /// Identification of a flow
|
||||
QBezeichnungLog = fullTestNameWoPart, /// Flow name in Oracle database
|
||||
Range = range,
|
||||
Flow = (range == Range.R100_110) ? test.Qfrom : (range == Range.R90_100) ? test.Qto : (test.Qfrom + test.Qto) / 2,
|
||||
TestTime = (int)Math.Round(test.TstTime),
|
||||
ErrLimLoFromDB = test.ErrLimLo,
|
||||
ErrLimHiFromDB = test.ErrLimHi,
|
||||
Uncertainty = test.Uncertainty,
|
||||
TestMethod = test.Method,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} DB={1}/'{2}' Opto={3}/'{4}' Log={5}/'{6}'/{7}", TestName, PruefungsNrDB, QBezeichnungDB, PruefungsNrOpto, QBezeichnungOpto, PruefungsNrLog, QBezeichnungLog, Range);
|
||||
}
|
||||
|
||||
public void WriteBinary(BinaryWriter writer)
|
||||
{
|
||||
writer.Write((TestName != null) ? TestName : string.Empty);
|
||||
writer.Write(PruefungsNrDB);
|
||||
writer.Write((QBezeichnungDB != null) ? QBezeichnungDB : string.Empty);
|
||||
writer.Write(PruefungsNrOpto);
|
||||
writer.Write((QBezeichnungOpto != null) ? QBezeichnungOpto : string.Empty);
|
||||
writer.Write(PruefungsNrLog);
|
||||
writer.Write((QBezeichnungLog != null) ? QBezeichnungLog : string.Empty);
|
||||
writer.Write((int)Range);
|
||||
writer.Write(Flow);
|
||||
writer.Write(TestTime);
|
||||
writer.Write(ErrLimLoFromDB);
|
||||
writer.Write(ErrLimHiFromDB);
|
||||
writer.Write(Uncertainty);
|
||||
writer.Write((TestMethod != null) ? TestMethod : string.Empty);
|
||||
}
|
||||
|
||||
public void ReadBinary(BinaryReader reader)
|
||||
{
|
||||
TestName = reader.ReadString();
|
||||
PruefungsNrDB = reader.ReadInt32();
|
||||
QBezeichnungDB = reader.ReadString();
|
||||
PruefungsNrOpto = reader.ReadInt32();
|
||||
QBezeichnungOpto = reader.ReadString();
|
||||
PruefungsNrLog = reader.ReadInt32();
|
||||
QBezeichnungLog = reader.ReadString();
|
||||
Range = (Range)reader.ReadInt32();
|
||||
Flow = reader.ReadDouble();
|
||||
TestTime = reader.ReadInt32();
|
||||
ErrLimLoFromDB = reader.ReadDouble();
|
||||
ErrLimHiFromDB = reader.ReadDouble();
|
||||
Uncertainty = reader.ReadDouble();
|
||||
TestMethod = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 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("2.24.1390.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1390.0")]
|
||||
[assembly: AssemblyVersion("2.25.1429.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1429.0")]
|
||||
|
||||
+19
-3
@@ -10,31 +10,37 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Results</RootNamespace>
|
||||
<AssemblyName>Results</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;GELSENWASSER;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;GELSENWASSER;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Gma.QrCodeNet.Encoding">
|
||||
<HintPath>..\packages\QrCode.Net.0.4.0.0\net40\Gma.QrCodeNet.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Iesi.Collections">
|
||||
<HintPath>..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -144,10 +150,15 @@
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Enhanced\EnhancedPrinterCfg.cs" />
|
||||
<Compile Include="Output\Printers\Enums.cs" />
|
||||
<Compile Include="Output\Printers\Label\LabelPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Label\LabelPrinterCfg.cs" />
|
||||
<Compile Include="Output\Printers\MultiLabel\MultiLabelPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\MultiLabel\MultiLabelPrinterCfg.cs" />
|
||||
<Compile Include="Output\Printers\PrintersCommon.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -162,6 +173,7 @@
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Zapiska\ZapiskaPrinterCfg.cs" />
|
||||
<Compile Include="Output\SensusTestInfo.cs" />
|
||||
<Compile Include="Output\Table.cs" />
|
||||
<Compile Include="Output\WMChart.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -183,6 +195,10 @@
|
||||
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\GenCode128\GenCode128.csproj">
|
||||
<Project>{32817bf9-e380-4467-9c7f-936f4b122bc7}</Project>
|
||||
<Name>GenCode128</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TracingDB\TracingDB.csproj">
|
||||
<Project>{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}</Project>
|
||||
<Name>TracingDB</Name>
|
||||
|
||||
+11
-5
@@ -91,16 +91,22 @@ namespace Results
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void GetCounterStates(Results.Entities.TestRslt tstRslt, int[] counters)
|
||||
{
|
||||
if (tstRslt != null)
|
||||
{
|
||||
tstRslt.Counter1 = ((counters != null) && (counters.Length >= 1)) ? counters[0] : 0;
|
||||
tstRslt.Counter2 = ((counters != null) && (counters.Length >= 2)) ? counters[1] : 0;
|
||||
tstRslt.Counter3 = ((counters != null) && (counters.Length >= 3)) ? counters[2] : 0;
|
||||
tstRslt.Counter4 = ((counters != null) && (counters.Length >= 4)) ? counters[3] : 0;
|
||||
tstRslt.Counter5 = ((counters != null) && (counters.Length >= 5)) ? counters[4] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetCounterStates(Results.Entities.Batch batch, int[] counters)
|
||||
{
|
||||
if (batch != null)
|
||||
{
|
||||
batch.Counter1 = ((counters != null) && (counters.Length >= 1)) ? counters[0] : 0;
|
||||
batch.Counter2 = ((counters != null) && (counters.Length >= 2)) ? counters[1] : 0;
|
||||
batch.Counter3 = ((counters != null) && (counters.Length >= 3)) ? counters[2] : 0;
|
||||
batch.Counter4 = ((counters != null) && (counters.Length >= 4)) ? counters[3] : 0;
|
||||
batch.Counter5 = ((counters != null) && (counters.Length >= 5)) ? counters[4] : 0;
|
||||
batch.Counter6 = ((counters != null) && (counters.Length >= 6)) ? counters[5] : 0;
|
||||
batch.Counter7 = ((counters != null) && (counters.Length >= 7)) ? counters[6] : 0;
|
||||
batch.Counter8 = ((counters != null) && (counters.Length >= 8)) ? counters[7] : 0;
|
||||
|
||||
@@ -485,17 +485,96 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_row_nr, "Table row #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableRowNr.ToString() : string.Format(f, TableRowNr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_column_nr, "Table column #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableColumnNr.ToString() : string.Format(f, TableColumnNr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.WMRemark, string.Format("{0} {1}", Strings.Water_Meter, Strings.Remark), Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.Remark)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter1, string.Format(Strings.Counter_0, 1), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter1)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter2, string.Format(Strings.Counter_0, 2), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter3, string.Format(Strings.Counter_0, 3), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter3)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter4, string.Format(Strings.Counter_0, 4), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter4)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter5, string.Format(Strings.Counter_0, 5), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter5)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter6, string.Format(Strings.Counter_0, 6), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter6)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter7, string.Format(Strings.Counter_0, 7), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter7)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter8, string.Format(Strings.Counter_0, 8), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter8)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter9, string.Format(Strings.Counter_0, 9), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter9)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter10, string.Format(Strings.Counter_0, 10), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter10)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter1,
|
||||
string.Format(Strings.Counter_0, 1),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter1) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter2,
|
||||
string.Format(Strings.Counter_0, 2),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter2) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter3,
|
||||
string.Format(Strings.Counter_0, 3),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter3) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter4,
|
||||
string.Format(Strings.Counter_0, 4),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter4) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter5,
|
||||
string.Format(Strings.Counter_0, 5),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter5) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter6,
|
||||
string.Format(Strings.Counter_0, 6),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter6);
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter7,
|
||||
string.Format(Strings.Counter_0, 7),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter7);
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter8,
|
||||
string.Format(Strings.Counter_0, 8),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter8);
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter9,
|
||||
string.Format(Strings.Counter_0, 9),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter9);
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter10,
|
||||
string.Format(Strings.Counter_0, 10),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter10);
|
||||
}));
|
||||
}
|
||||
|
||||
/// To be updated by Output.FileWriter or Output.Printer
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -116,11 +116,11 @@ namespace ResultsBrowser
|
||||
Bench4 = "WR14";
|
||||
Bench5 = "WR15";
|
||||
Bench6 = "PT7";
|
||||
ConnectionString1 = "SERVER=10.42.128.93; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString2 = "SERVER=10.42.128.102; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString3 = "SERVER=10.42.128.89; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString4 = "SERVER=10.42.128.213; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString5 = "SERVER=10.42.128.214; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString1 = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString2 = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString3 = "SERVER=10.42.128.61; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString4 = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString5 = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
ConnectionString6 = "SERVER=10.42.129.26; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
|
||||
Language = "SK";
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
public class OraData
|
||||
{
|
||||
public string PO; /// VT_ZAEHLER_PD AUFTRAGSNUMMER
|
||||
public string Prefix; /// VT_ZAEHLER_PD PREFIX
|
||||
public int SN; /// VT_ZAEHLER_PD ZAEHLERNUMMER
|
||||
public string Suffix; /// VT_ZAEHLER_PD SUFFIX
|
||||
public string PcbNr; /// VT_ZAEHLER_PD VT_FERNUM
|
||||
public int TestBenchId;
|
||||
public string ProgramVer;
|
||||
public int MaxPruefIx;
|
||||
public int BatchNr;
|
||||
public int WMPosition;
|
||||
public int WMTypeId;
|
||||
public int WMTypeRev;
|
||||
public DateTime Start;
|
||||
public DateTime End;
|
||||
public int HydrPruefung;
|
||||
public double AdjErr;
|
||||
public double AdjErrA4;
|
||||
public double Q3RlErr;
|
||||
public double Q3LrErr;
|
||||
public double Q2RlErr;
|
||||
public double Q2LrErr;
|
||||
public double Q1RlErr;
|
||||
public double Q1LrErr;
|
||||
public int CalibFactor;
|
||||
public int CalibFactorLNA;
|
||||
public double Q2ErrBeforeCorrection; /// VT_IP_ZAEHLER_PINDEX_PD
|
||||
public bool Q2CorrectionDone; /// VT_IP_ZAEHLER_PINDEX_PD WithQ2Correction
|
||||
public int Q2CorrectionRl; /// VT_IP_ZAEHLER_PINDEX_PD Q2CORRECTIONLEFT
|
||||
public int Q2CorrectionLr; /// VT_IP_ZAEHLER_PINDEX_PD Q2CORRECTIONRIGHT
|
||||
|
||||
public OraData() { }
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 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("2.24.1368.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1368.0")]
|
||||
[assembly: AssemblyVersion("2.25.1428.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1428.0")]
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -12,7 +12,7 @@ namespace ResultsBrowser.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ResultsBrowser</RootNamespace>
|
||||
<AssemblyName>ResultsBrowser</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -21,19 +21,21 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;GELSENWASSER;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<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;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;GELSENWASSER;LANG_DE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>ResultsBrowser.Program</StartupObject>
|
||||
@@ -177,6 +179,7 @@
|
||||
<DependentUpon>StatisticsOptionsDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LocalSettings.cs" />
|
||||
<Compile Include="OraData.cs" />
|
||||
<Compile Include="Output\Printers\Statistics\StatisticsPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
+13
@@ -34,6 +34,7 @@
|
||||
this.filtersFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.resultsGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.resultsListView = new System.Windows.Forms.ListView();
|
||||
this.customQueryButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.histogramBtn = new System.Windows.Forms.Button();
|
||||
this.statisticsBtn = new System.Windows.Forms.Button();
|
||||
@@ -84,6 +85,7 @@
|
||||
//
|
||||
// vSplitContainer.Panel2
|
||||
//
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.customQueryButton);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.groupBox1);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.outputGroupBox);
|
||||
this.vSplitContainer.Panel2.Controls.Add(this.printerConfigBtn);
|
||||
@@ -158,6 +160,16 @@
|
||||
this.resultsListView.UseCompatibleStateImageBehavior = false;
|
||||
this.resultsListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// customQueryButton
|
||||
//
|
||||
this.customQueryButton.Location = new System.Drawing.Point(31, 437);
|
||||
this.customQueryButton.Name = "customQueryButton";
|
||||
this.customQueryButton.Size = new System.Drawing.Size(85, 23);
|
||||
this.customQueryButton.TabIndex = 14;
|
||||
this.customQueryButton.Text = "Custom query";
|
||||
this.customQueryButton.UseVisualStyleBackColor = true;
|
||||
this.customQueryButton.Click += new System.EventHandler(this.customQueryButton_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.histogramBtn);
|
||||
@@ -443,5 +455,6 @@
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.GroupBox outputGroupBox;
|
||||
private System.Windows.Forms.Button histogramBtn;
|
||||
private System.Windows.Forms.Button customQueryButton;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,6 +12,8 @@ using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using ResultsBrowser.Filters;
|
||||
using ResultsBrowser.Resources;
|
||||
using Oracle;
|
||||
using Oracle.DataAccess.Client;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
@@ -32,6 +34,8 @@ namespace ResultsBrowser
|
||||
static IList<IComponent> tbfComponents;
|
||||
static IList<IDevice> tbfDevices;
|
||||
|
||||
OracleConnection oracleConnection; /// Oracle database connection
|
||||
|
||||
public ResultsBrowserWnd(string[] args)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -543,5 +547,290 @@ namespace ResultsBrowser
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void customQueryButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
#if IPERL
|
||||
try
|
||||
{
|
||||
bool queryOrders = true; /// true = query orders, false = query PCB numbers
|
||||
//string[] queryStrings = new string[] { "3137300", "3137301", "3137302", "3137303" }; /// 14.2.2020 queryOrders=true 2500 meters
|
||||
//string[] queryStrings = new string[] { "505494150362", "505494151325", "505494150008", "505494150955", "505494152128" }; /// 18.2.2020 queryOrders=false
|
||||
string[] queryStrings = new string[] { "3129109", "3129111", "3129113", "3129108", "3129110", "3129112", "3129114", "3129115", "3129107" }; /// 24.2.2020 queryOrders=true
|
||||
//string[] queryStrings = new string[] { "332491531667", "332491751060", "332491640866" };
|
||||
|
||||
IList<OraData> oraDatas = new List<OraData>(); /// List of water meters
|
||||
IList<int> testBenches = new List<int>(); /// List of test benches used to produce water meters
|
||||
|
||||
///
|
||||
/// Get list of water meters satisfying (custom) criteria
|
||||
///
|
||||
Console.WriteLine("Collecting water meters");
|
||||
foreach (var orderOrPcbNr in queryStrings)
|
||||
{
|
||||
oracleConnection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
oracleConnection.Open();
|
||||
|
||||
OracleCommand cmd;
|
||||
if (queryOrders)
|
||||
{
|
||||
cmd = new OracleCommand("select VT_FERNUM, MAX_PRUEFINDEX, PREFIX, ZAEHLERNUMMER, SUFFIX from VT_ZAEHLER_PD where AUFTRAGSNUMMER = :1 AND ANBID = 4 order by ZAEHLERNUMMER", oracleConnection);
|
||||
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = orderOrPcbNr });
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = new OracleCommand("select AUFTRAGSNUMMER, MAX_PRUEFINDEX, PREFIX, ZAEHLERNUMMER, SUFFIX from VT_ZAEHLER_PD where VT_FERNUM = :1 AND ANBID = 4 order by ZAEHLERNUMMER", oracleConnection);
|
||||
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = orderOrPcbNr });
|
||||
}
|
||||
|
||||
OracleDataReader dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
int i = 0;
|
||||
string pcbNrOrOrder = dr.GetString(i++);
|
||||
int maxPruefIx = dr.GetInt32(i++);
|
||||
int testBenchId = maxPruefIx / 100;
|
||||
maxPruefIx = maxPruefIx % 100;
|
||||
string prefix = dr.GetString(i++);
|
||||
int sn = dr.GetInt32(i++);
|
||||
string suffix = dr.GetString(i++);
|
||||
|
||||
if (sn == -1) continue;
|
||||
|
||||
/// Create 'OraData' object and add it to 'oraDatas' list
|
||||
if (queryOrders)
|
||||
{ /// query param. query result
|
||||
oraDatas.Add(new OraData() { PO = orderOrPcbNr, PcbNr = pcbNrOrOrder, TestBenchId = testBenchId, MaxPruefIx = maxPruefIx, Prefix = prefix, SN = sn, Suffix = suffix });
|
||||
}
|
||||
else
|
||||
{ /// query result query param.
|
||||
oraDatas.Add(new OraData() { PO = pcbNrOrOrder, PcbNr = orderOrPcbNr, TestBenchId = testBenchId, MaxPruefIx = maxPruefIx, Prefix = prefix, SN = sn, Suffix = suffix });
|
||||
}
|
||||
|
||||
/// Add this test bench to the list of test benches if it was still missing
|
||||
if (!testBenches.Contains(testBenchId)) testBenches.Add(testBenchId);
|
||||
}
|
||||
dr.Close();
|
||||
}
|
||||
Console.WriteLine("Collecting water meters completed");
|
||||
Console.WriteLine();
|
||||
|
||||
///
|
||||
/// Get required information about each water meter
|
||||
///
|
||||
Console.WriteLine("Reading additional data from Oracle");
|
||||
int counter = 0;
|
||||
foreach (var oraD in oraDatas)
|
||||
{
|
||||
Console.Write("{0} ", ++counter);
|
||||
if (counter % 40 == 0) Console.WriteLine();
|
||||
|
||||
///
|
||||
/// Read from VT_ZAEHLER_PINDEX_PD: TestId(ID_WZPRUEFREIHE))
|
||||
///
|
||||
OracleCommand cmd = new OracleCommand("select ID_WZPRUEFREIHE, WT_PLATZ_NR, HYDR_PRUEFUNG from VT_ZAEHLER_PINDEX_PD where VT_FERNUM = :1 AND PRUEFINDEX = :2 AND ANBID = 4 AND WZGUT = 1", oracleConnection);
|
||||
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = oraD.PcbNr });
|
||||
cmd.Parameters.Add(new OracleParameter { ParameterName = "2", OracleDbType = OracleDbType.Int32, Value = oraD.MaxPruefIx + 100 * oraD.TestBenchId });
|
||||
OracleDataReader dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
int i = 0;
|
||||
oraD.BatchNr = dr.GetInt32(i++);
|
||||
oraD.WMPosition = dr.GetInt32(i++);
|
||||
oraD.HydrPruefung = dr.GetInt32(i++);
|
||||
}
|
||||
dr.Close();
|
||||
|
||||
///
|
||||
/// Read from VT_IP_ZAEHLER_PINDEX_PD: Q2CorrectionRl, Q2CorrectionLr
|
||||
///
|
||||
cmd = new OracleCommand("select PRUEFINDEX, WITHQ2CORRECTION, ERRQ2, Q2CORRECTIONLEFT, Q2CORRECTIONRIGHT from VT_IP_ZAEHLER_PINDEX_PD where VT_FERNUM = :1 AND ANBID = 4", oracleConnection);
|
||||
/// pruefindex, Q2_correction_RL, Q2_correction_LR, Q2_error_before_correction
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = oraD.PcbNr });
|
||||
dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
int i = 0;
|
||||
int pruefindex = (dr.GetInt32(i++) % 100);
|
||||
if (pruefindex == oraD.MaxPruefIx)
|
||||
{
|
||||
oraD.Q2CorrectionDone = (dr.GetInt32(i++) != 0);
|
||||
oraD.Q2ErrBeforeCorrection = dr.GetDouble(i++);
|
||||
oraD.Q2CorrectionRl = dr.GetInt32(i++);
|
||||
oraD.Q2CorrectionLr = dr.GetInt32(i++);
|
||||
}
|
||||
}
|
||||
dr.Close();
|
||||
|
||||
///
|
||||
/// Read data from VT_PRUEFREIHE_PD
|
||||
///
|
||||
cmd = new OracleCommand("select ID_WZTYP, REV_WZTYP, STARTDATUMZEIT, ENDDATUMZEIT, PROGRAMMVERSION from VT_PRUEFREIHE_PD where ID_PRUEFSTAND = :1 AND ID_WzPruefreihe = :2 AND ANBID = 4", oracleConnection);
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 18000 + oraD.TestBenchId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = oraD.BatchNr });
|
||||
|
||||
dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
int i = 0;
|
||||
oraD.WMTypeId = dr.GetInt32(i++);
|
||||
oraD.WMTypeRev = dr.GetInt32(i++);
|
||||
oraD.Start = dr.GetDateTime(i++);
|
||||
oraD.End = dr.GetDateTime(i++);
|
||||
oraD.ProgramVer = dr.GetString(i++);
|
||||
}
|
||||
dr.Close();
|
||||
|
||||
|
||||
///
|
||||
/// Read data from VT_PRUEFREIHE_IST_PD
|
||||
///
|
||||
/// testID, flow, rel.err., passed
|
||||
cmd = new OracleCommand("select PRUEFUNGSNR, Q_WZ, Q_FEHLER, Q_BEST from VT_PRUEFREIHE_IST_PD where VT_FERNUM = :1 AND PRUEFINDEX = :2 AND ANBID = 4", oracleConnection);
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = oraD.PcbNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 100 * oraD.TestBenchId + oraD.MaxPruefIx });
|
||||
|
||||
dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
int i = 0;
|
||||
int testId = dr.GetInt32(i++); /// PRUEFUNGSNR
|
||||
double flow = dr.GetDouble(i++); /// Q_WZ
|
||||
double error = dr.GetDouble(i++); /// Q_FEHLER
|
||||
bool testPassed = (dr.GetInt32(i++) != 0);
|
||||
|
||||
/// SUEZ specific
|
||||
switch (testId)
|
||||
{
|
||||
case -2:
|
||||
oraD.AdjErrA4 = error;
|
||||
break;
|
||||
case -1:
|
||||
oraD.AdjErr = error;
|
||||
break;
|
||||
case 5:
|
||||
oraD.Q3LrErr = error;
|
||||
break;
|
||||
case 10:
|
||||
oraD.Q3RlErr = error;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
dr.Close();
|
||||
} /// end of foreach (var oraD in OraDatas)
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Reading additional data from Oracle completed");
|
||||
Console.WriteLine();
|
||||
|
||||
oracleConnection.Close();
|
||||
|
||||
Console.WriteLine("Reading additional data from MySQL");
|
||||
counter = 0;
|
||||
foreach (var testBenchId in testBenches)
|
||||
{
|
||||
Console.WriteLine((testBenchId == 8) ? "WR13" : (testBenchId == 9) ? "WR15" : (testBenchId == 10) ? "WR14" : "other");
|
||||
|
||||
switch (testBenchId)
|
||||
{
|
||||
case 8:
|
||||
Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr13-r; UID=root; PASSWORD=kraken; CharSet=utf8;";
|
||||
break;
|
||||
case 9:
|
||||
Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr15-r; UID=root; PASSWORD=kraken; CharSet=utf8;";
|
||||
break;
|
||||
case 10:
|
||||
Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr14-r; UID=root; PASSWORD=kraken; CharSet=utf8;";
|
||||
break;
|
||||
default:
|
||||
Results.DB.ConnectionString = string.Empty;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Results.DB.ConnectionString))
|
||||
{
|
||||
ISession session = Results.DB.CreateSession();
|
||||
|
||||
foreach (var oraD in oraDatas)
|
||||
{
|
||||
|
||||
if (oraD.TestBenchId == testBenchId)
|
||||
{
|
||||
Console.Write("{0} ", ++counter);
|
||||
if (counter % 40 == 0) Console.WriteLine();
|
||||
|
||||
IList<WaterMeter> wms = session.QueryOver<WaterMeter>()
|
||||
.Where(x => x.SerialNr == oraD.PcbNr)
|
||||
.And(x => x.Passed)
|
||||
.List();
|
||||
|
||||
if (wms.Count == 1)
|
||||
{
|
||||
oraD.CalibFactor = (int)Math.Round(wms[0].CalibFactor);
|
||||
oraD.CalibFactorLNA = (int)Math.Round(wms[0].CalibFactorLNA);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var wm in wms)
|
||||
{
|
||||
if (wm.Batch.BatchNr == oraD.BatchNr)
|
||||
{
|
||||
oraD.CalibFactor = (int)Math.Round(wm.CalibFactor);
|
||||
oraD.CalibFactorLNA = (int)Math.Round(wm.CalibFactorLNA);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
session.Close();
|
||||
}
|
||||
}
|
||||
Console.WriteLine("Reading additional data from MySQL");
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine("CSV data begin");
|
||||
Console.WriteLine(string.Format("PO; prefix; S/N; PcbNr; Bench; Batch; Start; Start; End; End; Pos; AdjA0; AdjA4; Q3RL; Q3LR; CalF; CAlF_LNA; HP; Q2cRL; Q2cLR"));
|
||||
//Console.WriteLine(string.Format("s/n;PCB nr.;bench;batch;position;Err. at 640 l/h;Err. LNA at 640 l/h;Err. Q3 RL;Err. Q3 LR;Cal.f.;Cal.f.LNA;Q2 corr.f. RL;Q2 corr.f. LR"));
|
||||
foreach (var oraD in oraDatas)
|
||||
{
|
||||
Console.WriteLine(string.Format("{0}; {1}; {2}; =(\"{3}\"); {4}; {5}; {7}; {8}; {9}; {10};{11};{12};{13};{14};{15};{16};{17};{18};{19};{20}",
|
||||
//Console.WriteLine(string.Format("{2};=(\"{3}\"); {4};{5};{11};{12};{13};{14};{15};{16};{17};{19};{20}",
|
||||
/* 0 */ oraD.PO,
|
||||
/* 1 */ oraD.Prefix,
|
||||
/* 2 */ oraD.SN,
|
||||
/* 3 */ oraD.PcbNr,
|
||||
/* 4 */ (oraD.TestBenchId == 8) ? "WR13" : (oraD.TestBenchId == 9) ? "WR15" : (oraD.TestBenchId == 10) ? "WR14" : "other",
|
||||
/* 5 */ oraD.BatchNr,
|
||||
/* 6 */ oraD.ProgramVer,
|
||||
/* 7 */ oraD.Start.ToShortDateString(),
|
||||
/* 8 */ oraD.Start.ToShortTimeString(),
|
||||
/* 9 */ oraD.End.ToShortDateString(),
|
||||
/* 10 */ oraD.End.ToShortTimeString(),
|
||||
/* 11 */ oraD.WMPosition,
|
||||
/* 12 */ oraD.AdjErr.ToString("F2"),
|
||||
/* 13 */ oraD.AdjErrA4.ToString("F2"),
|
||||
/* 14 */ oraD.Q3RlErr.ToString("F2"),
|
||||
/* 15 */ oraD.Q3LrErr.ToString("F2"),
|
||||
/* 16 */ oraD.CalibFactor,
|
||||
/* 17 */ oraD.CalibFactorLNA,
|
||||
/* 18 */ oraD.HydrPruefung,
|
||||
/* 19 */ oraD.Q2CorrectionRl,
|
||||
/* 20 */ oraD.Q2CorrectionLr,
|
||||
/* 21 */ oraD.WMTypeId,
|
||||
/* 22 */ oraD.WMTypeRev));
|
||||
}
|
||||
Console.WriteLine("CSV data end");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(exc.Message);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -244,16 +244,20 @@ namespace Statistics
|
||||
#else
|
||||
Language = "SK";
|
||||
|
||||
BenchNames = new string[] { "WR10", "WR11", "WR13", "WR14", "WR15", "PT7" };
|
||||
BenchNames = new string[] { "WR10", "WR11", "WR13", "WR14", "WR15", "WR18", "WR19", "WR20", "WR21", "PT7" };
|
||||
|
||||
ConnectionStrings = new string[]
|
||||
{
|
||||
"SERVER=10.42.128.93; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.102; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.89; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.213; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.214; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.129.26; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.61; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.201; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.131; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
};
|
||||
|
||||
MidNames = new string[] { string.Empty, "I1", "I2", "I3", "I4" }; /// Index is MID-id
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 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("2.18.1154.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1154.0")]
|
||||
[assembly: AssemblyVersion("2.25.1427.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1427.0")]
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ namespace Statistics.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Statistics</RootNamespace>
|
||||
<AssemblyName>Statistics</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -24,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -33,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -5,6 +5,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TBF", "TBF\TBF.csproj", "{8
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF} = {EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}
|
||||
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA} = {0C0A1F4D-1363-4544-A7C5-196C76D26CCA}
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE} = {46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Results", "Results\Results.csproj", "{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}"
|
||||
@@ -50,6 +51,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Decrypt", "Decrypt\Decrypt.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Encrypt", "Encrypt\Encrypt.csproj", "{DA9B09F3-A99D-4883-A954-537560453674}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RestClient", "RestClient\RestClient.csproj", "{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToFirstMonitor", "ToFirstMonitor\ToFirstMonitor.csproj", "{13515B7B-43E6-44BC-87B8-2E345A98B741}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToSecondMonitor", "ToSecondMonitor\ToSecondMonitor.csproj", "{6F18660F-0EFB-4253-B92C-205E18D34442}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenCode128", "GenCode128\GenCode128.csproj", "{32817BF9-E380-4467-9C7F-936F4B122BC7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -202,6 +211,48 @@ Global
|
||||
{DA9B09F3-A99D-4883-A954-537560453674}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{DA9B09F3-A99D-4883-A954-537560453674}.Release|x86.ActiveCfg = Release|x86
|
||||
{DA9B09F3-A99D-4883-A954-537560453674}.Release|x86.Build.0 = Release|x86
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|x86.Build.0 = Release|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{13515B7B-43E6-44BC-87B8-2E345A98B741}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{6F18660F-0EFB-4253-B92C-205E18D34442}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -23,9 +23,6 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
/// <summary>
|
||||
/// Properties set by the Begin and the End form
|
||||
/// </summary>
|
||||
string purchaseOrder;
|
||||
public string PurchaseOrder { get { return purchaseOrder; } }
|
||||
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
string[] wmCycleEndState;
|
||||
@@ -49,7 +46,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
@@ -87,7 +84,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -96,7 +93,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -196,19 +193,15 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
|
||||
if (dlg != null)
|
||||
{
|
||||
purchaseOrder = dlg.PurchaseOrder;
|
||||
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].SerialNr = dlg.MainSNText[i];
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.MainSNText[i];
|
||||
waterMeters[i].SerialNrAux = dlg.AuxSNText[i];
|
||||
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
|
||||
if (dlg.RemarksEnabled)
|
||||
{
|
||||
waterMeters[i].Remark = dlg.Remark[i];
|
||||
}
|
||||
if (dlg.RemarksEnabled) waterMeters[i].Remark = dlg.Remark[i];
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,20 +262,5 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
/// </summary>
|
||||
/// <param name="batchResults">Test results to be updated with the information</param>
|
||||
public void UpdateTestResults(Results.BatchResults batchResults)
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
/// </summary>
|
||||
string purchaseOrder;
|
||||
public string PurchaseOrder { get { return purchaseOrder; } }
|
||||
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
string[] wmCycleEndState;
|
||||
@@ -49,7 +46,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
@@ -87,7 +84,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -96,7 +93,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -195,23 +192,22 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
purchaseOrder = dlg.PurchaseOrder;
|
||||
|
||||
for (int i = 0; i < Math.Min(dlg.WMsCount, waterMeters.Length); i++)
|
||||
for (int i = 0; i < Math.Min(dlg.WMsCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
waterMeters[i].SerialNrAux = dlg.SN2Text[i];
|
||||
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
|
||||
}
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
{
|
||||
CycleEndForm dlg = (modelessDlg as CycleEndForm);
|
||||
int count = waterMeters.Length;
|
||||
int count = waterMeters.Count;
|
||||
if ((dlg != null) && (count > dlg.WMsCount)) count = dlg.WMsCount;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -271,20 +267,5 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
/// </summary>
|
||||
/// <param name="batchResults">Test results to be updated with the information</param>
|
||||
public void UpdateTestResults(Results.BatchResults batchResults)
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
|
||||
|
||||
readonly Results.Entities.WaterMeter[] WaterMeters;
|
||||
readonly IList<Results.Entities.WaterMeter> waterMeters;
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
@@ -77,11 +77,11 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(Results.Entities.WaterMeter[] waterMeters, bool atTheEnd, bool sensusExtensions)
|
||||
public CycleBeginningForm(IList<Results.Entities.WaterMeter> waterMeters, bool atTheEnd, bool sensusExtensions)
|
||||
: this()
|
||||
{
|
||||
this.WaterMeters = waterMeters;
|
||||
this.WaterMetersCount = waterMeters.Length;
|
||||
this.waterMeters = waterMeters;
|
||||
this.WaterMetersCount = waterMeters.Count;
|
||||
this.AtTheEnd = atTheEnd;
|
||||
this.SensusExtensions = sensusExtensions;
|
||||
SNText = new string[WaterMetersCount];
|
||||
@@ -89,7 +89,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
|
||||
ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize);
|
||||
|
||||
foreach (var wm in WaterMeters) if (wm != null) wm.Passed = wm.PassedFromTests();
|
||||
foreach (var wm in waterMeters) if (wm != null) wm.Passed = wm.PassedFromTests();
|
||||
|
||||
Height = 147 + WaterMetersCount * 45; /// Adjust the window size
|
||||
|
||||
@@ -216,8 +216,8 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
Results.Entities.WaterMeter wm = WaterMeters[i];
|
||||
if (wm == null)
|
||||
Results.Entities.WaterMeter wm = waterMeters[i];
|
||||
if (wm == null && !wm.Disabled)
|
||||
{
|
||||
checkBoxes[i].Checked = true;
|
||||
}
|
||||
@@ -272,9 +272,9 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
Results.Entities.WaterMeter wm = WaterMeters[i];
|
||||
Results.Entities.WaterMeter wm = waterMeters[i];
|
||||
{
|
||||
if (wm != null)
|
||||
if (wm != null && !wm.Disabled)
|
||||
{
|
||||
bool pressureTestPassed = false;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
@@ -501,7 +501,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
if (!AtTheEnd || WaterMeters[i].Passed)
|
||||
if (!AtTheEnd || waterMeters[i].Passed)
|
||||
{
|
||||
if (!snFound)
|
||||
{
|
||||
|
||||
@@ -26,9 +26,6 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
/// </summary>
|
||||
string purchaseOrder;
|
||||
public string PurchaseOrder { get { return purchaseOrder; } }
|
||||
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
string[] wmCycleEndState;
|
||||
@@ -64,7 +61,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
@@ -105,7 +102,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -114,7 +111,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -168,19 +165,19 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
///
|
||||
void OpenEndDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Length);
|
||||
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Count);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(entryFormCfg, myRef.waterMeters.Length, myRef.regReaders, myRef.disabled);
|
||||
myRef.modelessDlg = new TestStartEndForm(entryFormCfg, myRef.waterMeters.Count, myRef.regReaders, myRef.disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(entryFormCfg, myRef.waterMeters.Length, myRef.regReaders, wmStartStateStr, energyStartStateStr,
|
||||
myRef.modelessDlg = new TestStartEndForm(entryFormCfg, myRef.waterMeters.Count, myRef.regReaders, wmStartStateStr, energyStartStateStr,
|
||||
disabled, refVolume, errLimLo, errLimHi, refEnergy, energyErrLimLo, energyErrLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
@@ -233,22 +230,21 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
purchaseOrder = dlg.PurchaseOrder;
|
||||
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
|
||||
}
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
{
|
||||
CycleEndForm dlg = (modelessDlg as CycleEndForm);
|
||||
int count = Math.Min(waterMeters.Length, Config.Data.HeatMetersCount);
|
||||
int count = Math.Min(waterMeters.Count, Config.Data.HeatMetersCount);
|
||||
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -266,7 +262,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(waterMeters.Length, Config.Data.HeatMetersCount); i++)
|
||||
for (int i = 0; i < Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); i++)
|
||||
{
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||
@@ -281,7 +277,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(waterMeters.Length, Config.Data.HeatMetersCount); i++)
|
||||
for (int i = 0; i < Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); i++)
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
energyEndState[i] = dlg.EnergyEndState[i];
|
||||
@@ -305,20 +301,5 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
/// </summary>
|
||||
/// <param name="batchResults">Test results to be updated with the information</param>
|
||||
public void UpdateTestResults(Results.BatchResults batchResults)
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
|
||||
|
||||
readonly Results.Entities.WaterMeter[] WaterMeters;
|
||||
readonly IList<Results.Entities.WaterMeter> waterMeters;
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
@@ -70,11 +70,11 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(Results.Entities.WaterMeter[] waterMeters, bool atTheEnd, bool sensusExtensions)
|
||||
public CycleBeginningForm(IList<Results.Entities.WaterMeter> waterMeters, bool atTheEnd, bool sensusExtensions)
|
||||
: this()
|
||||
{
|
||||
this.WaterMeters = waterMeters;
|
||||
this.WaterMetersCount = waterMeters.Length;
|
||||
this.waterMeters = waterMeters;
|
||||
this.WaterMetersCount = waterMeters.Count;
|
||||
this.AtTheEnd = atTheEnd;
|
||||
this.SensusExtensions = sensusExtensions;
|
||||
SNText = new string[WaterMetersCount];
|
||||
@@ -82,7 +82,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
|
||||
ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize);
|
||||
|
||||
foreach (var wm in WaterMeters) if (wm != null) wm.Passed = wm.PassedFromTests();
|
||||
foreach (var wm in waterMeters) if (wm != null) wm.Passed = wm.PassedFromTests();
|
||||
|
||||
Height = 147 + WaterMetersCount * 45; /// Adjust the window size
|
||||
|
||||
@@ -209,8 +209,8 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
Results.Entities.WaterMeter wm = WaterMeters[i];
|
||||
if (wm == null)
|
||||
Results.Entities.WaterMeter wm = waterMeters[i];
|
||||
if (wm == null && !wm.Disabled)
|
||||
{
|
||||
checkBoxes[i].Checked = true;
|
||||
}
|
||||
@@ -265,9 +265,9 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
Results.Entities.WaterMeter wm = WaterMeters[i];
|
||||
Results.Entities.WaterMeter wm = waterMeters[i];
|
||||
{
|
||||
if (wm != null)
|
||||
if (wm != null && !wm.Disabled)
|
||||
{
|
||||
bool pressureTestPassed = false;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
@@ -434,7 +434,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
if (!AtTheEnd || WaterMeters[i].Passed)
|
||||
if (!AtTheEnd || waterMeters[i].Passed)
|
||||
{
|
||||
if (!snFound)
|
||||
{
|
||||
|
||||
@@ -26,9 +26,6 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
/// </summary>
|
||||
string purchaseOrder;
|
||||
public string PurchaseOrder { get { return purchaseOrder; } }
|
||||
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
string[] wmCycleEndState;
|
||||
@@ -64,7 +61,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
@@ -105,7 +102,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -114,7 +111,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -168,19 +165,19 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
///
|
||||
void OpenEndDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Length);
|
||||
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Count);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(entryFormCfg, myRef.waterMeters.Length, myRef.regReaders, disabled);
|
||||
myRef.modelessDlg = new TestStartEndForm(entryFormCfg, myRef.waterMeters.Count, myRef.regReaders, disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(entryFormCfg, myRef.waterMeters.Length, myRef.regReaders, wmStartStateStr, energyStartStateStr,
|
||||
myRef.modelessDlg = new TestStartEndForm(entryFormCfg, myRef.waterMeters.Count, myRef.regReaders, wmStartStateStr, energyStartStateStr,
|
||||
disabled, refVolume, errLimLo, errLimHi, refEnergy, energyErrLimLo, energyErrLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
@@ -233,14 +230,13 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
purchaseOrder = dlg.PurchaseOrder;
|
||||
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -248,7 +244,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
{
|
||||
CycleEndForm dlg = (modelessDlg as CycleEndForm);
|
||||
int count = Math.Min(waterMeters.Length, Config.Data.HeatMetersCount);
|
||||
int count = Math.Min(waterMeters.Count, Config.Data.HeatMetersCount);
|
||||
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -266,7 +262,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(waterMeters.Length, Config.Data.HeatMetersCount); i++)
|
||||
for (int i = 0; i < Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); i++)
|
||||
{
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||
@@ -281,7 +277,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(waterMeters.Length, Config.Data.HeatMetersCount); i++)
|
||||
for (int i = 0; i < Math.Min(waterMeters.Count, Config.Data.HeatMetersCount); i++)
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
energyEndState[i] = dlg.EnergyEndState[i];
|
||||
@@ -305,20 +301,5 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
/// </summary>
|
||||
/// <param name="batchResults">Test results to be updated with the information</param>
|
||||
public void UpdateTestResults(Results.BatchResults batchResults)
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,19 +83,19 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
radioButton3.Text = ProtocolName3;
|
||||
radioButton4.Text = ProtocolName4;
|
||||
|
||||
if (Sequences.ProcessData.BatchRslts.WaterMeters.Length >= 1)
|
||||
if (Sequences.ProcessData.BatchRslts.Batch.WaterMeters.Count >= 1 && !Sequences.ProcessData.BatchRslts.Batch.WaterMeters[0].Disabled)
|
||||
{
|
||||
qRise1TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.WaterMeters[0].QRise, 3);
|
||||
qFall1TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.WaterMeters[0].QFall, 3);
|
||||
YearOfProduction[0] = Sequences.ProcessData.BatchRslts.WaterMeters[0].YearOfProduction;
|
||||
qRise1TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.Batch.WaterMeters[0].QRise, 3);
|
||||
qFall1TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.Batch.WaterMeters[0].QFall, 3);
|
||||
YearOfProduction[0] = Sequences.ProcessData.BatchRslts.Batch.WaterMeters[0].YearOfProduction;
|
||||
yearOfProduction1TextBox.Text = YearOfProduction[0].ToString();
|
||||
}
|
||||
|
||||
if (Sequences.ProcessData.BatchRslts.WaterMeters.Length >= 2)
|
||||
if (Sequences.ProcessData.BatchRslts.Batch.WaterMeters.Count >= 2 && !Sequences.ProcessData.BatchRslts.Batch.WaterMeters[1].Disabled)
|
||||
{
|
||||
qRise2TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.WaterMeters[1].QRise, 3);
|
||||
qFall2TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.WaterMeters[1].QFall, 3);
|
||||
YearOfProduction[1] = Sequences.ProcessData.BatchRslts.WaterMeters[1].YearOfProduction;
|
||||
qRise2TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.Batch.WaterMeters[1].QRise, 3);
|
||||
qFall2TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.Batch.WaterMeters[1].QFall, 3);
|
||||
YearOfProduction[1] = Sequences.ProcessData.BatchRslts.Batch.WaterMeters[1].YearOfProduction;
|
||||
yearOfProduction2TextBox.Text = YearOfProduction[1].ToString();
|
||||
}
|
||||
else
|
||||
@@ -104,11 +104,11 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
Height = 305;
|
||||
}
|
||||
|
||||
if (Sequences.ProcessData.BatchRslts.WaterMeters.Length >= 3)
|
||||
if (Sequences.ProcessData.BatchRslts.Batch.WaterMeters.Count >= 3 && !Sequences.ProcessData.BatchRslts.Batch.WaterMeters[2].Disabled)
|
||||
{
|
||||
qRise3TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.WaterMeters[2].QRise, 3);
|
||||
qFall3TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.WaterMeters[2].QFall, 3);
|
||||
YearOfProduction[2] = Sequences.ProcessData.BatchRslts.WaterMeters[2].YearOfProduction;
|
||||
qRise3TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.Batch.WaterMeters[2].QRise, 3);
|
||||
qFall3TextBox.Text = Utils.DoubleToStr(Sequences.ProcessData.BatchRslts.Batch.WaterMeters[2].QFall, 3);
|
||||
YearOfProduction[2] = Sequences.ProcessData.BatchRslts.Batch.WaterMeters[2].YearOfProduction;
|
||||
yearOfProduction3TextBox.Text = YearOfProduction[2].ToString();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -22,8 +22,6 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
/// <summary>
|
||||
/// Properties set by the Begin and the End form
|
||||
/// </summary>
|
||||
public string PurchaseOrder { get { return string.Empty; } } /// Not supported in Munich
|
||||
|
||||
string[] serialNr;
|
||||
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
|
||||
|
||||
@@ -43,9 +41,9 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
Results.Entities.WaterMeter[] wMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
IList<Results.Entities.WaterMeter> wMeters; /// Reference to ...ProcessData.BatchRslts.Batch.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
@@ -78,7 +76,7 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.wMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.wMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -87,7 +85,7 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.wMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.wMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -142,7 +140,7 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
|
||||
if (!resultSaved) /// This is to save the result only once
|
||||
{
|
||||
int count = Math.Min(3, Math.Min(wMeters.Length, Config.Data.CompoundWMsCount));
|
||||
int count = Math.Min(3, Math.Min(wMeters.Count, Config.Data.CompoundWMsCount));
|
||||
if (modelessDlg is CycleBeginningForm)
|
||||
{
|
||||
if (count >= 1 && wMeters[0] != null) wMeters[0].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[0];
|
||||
@@ -198,15 +196,5 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
|
||||
/// <param name="results">Test results to be updated with the information</param>
|
||||
public void UpdateTestResults(Results.BatchResults results)
|
||||
{
|
||||
/// Nothing to be done
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,34 +68,34 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
if (WaterMetersCount < 5) groupBox5.Visible = false;
|
||||
if (WaterMetersCount < 6) groupBox6.Visible = false;
|
||||
|
||||
if (Sequences.ProcessData.BatchRslts.WaterMeters.Length >= 1)
|
||||
if (Sequences.ProcessData.BatchRslts.Batch.WaterMeters.Count >= 1)
|
||||
{
|
||||
YearOfProduction[0] = Sequences.ProcessData.BatchRslts.WaterMeters[0].YearOfProduction;
|
||||
YearOfProduction[0] = Sequences.ProcessData.BatchRslts.Batch.WaterMeters[0].YearOfProduction;
|
||||
yearOfProduction1TextBox.Text = YearOfProduction[0].ToString();
|
||||
}
|
||||
if (Sequences.ProcessData.BatchRslts.WaterMeters.Length >= 2)
|
||||
if (Sequences.ProcessData.BatchRslts.Batch.WaterMeters.Count >= 2)
|
||||
{
|
||||
YearOfProduction[1] = Sequences.ProcessData.BatchRslts.WaterMeters[1].YearOfProduction;
|
||||
YearOfProduction[1] = Sequences.ProcessData.BatchRslts.Batch.WaterMeters[1].YearOfProduction;
|
||||
yearOfProduction2TextBox.Text = YearOfProduction[1].ToString();
|
||||
}
|
||||
if (Sequences.ProcessData.BatchRslts.WaterMeters.Length >= 3)
|
||||
if (Sequences.ProcessData.BatchRslts.Batch.WaterMeters.Count >= 3)
|
||||
{
|
||||
YearOfProduction[2] = Sequences.ProcessData.BatchRslts.WaterMeters[2].YearOfProduction;
|
||||
YearOfProduction[2] = Sequences.ProcessData.BatchRslts.Batch.WaterMeters[2].YearOfProduction;
|
||||
yearOfProduction3TextBox.Text = YearOfProduction[2].ToString();
|
||||
}
|
||||
if (Sequences.ProcessData.BatchRslts.WaterMeters.Length >= 4)
|
||||
if (Sequences.ProcessData.BatchRslts.Batch.WaterMeters.Count >= 4)
|
||||
{
|
||||
YearOfProduction[3] = Sequences.ProcessData.BatchRslts.WaterMeters[3].YearOfProduction;
|
||||
YearOfProduction[3] = Sequences.ProcessData.BatchRslts.Batch.WaterMeters[3].YearOfProduction;
|
||||
yearOfProduction4TextBox.Text = YearOfProduction[3].ToString();
|
||||
}
|
||||
if (Sequences.ProcessData.BatchRslts.WaterMeters.Length >= 5)
|
||||
if (Sequences.ProcessData.BatchRslts.Batch.WaterMeters.Count >= 5)
|
||||
{
|
||||
YearOfProduction[4] = Sequences.ProcessData.BatchRslts.WaterMeters[4].YearOfProduction;
|
||||
YearOfProduction[4] = Sequences.ProcessData.BatchRslts.Batch.WaterMeters[4].YearOfProduction;
|
||||
yearOfProduction5TextBox.Text = YearOfProduction[4].ToString();
|
||||
}
|
||||
if (Sequences.ProcessData.BatchRslts.WaterMeters.Length >= 6)
|
||||
if (Sequences.ProcessData.BatchRslts.Batch.WaterMeters.Count >= 6)
|
||||
{
|
||||
YearOfProduction[5] = Sequences.ProcessData.BatchRslts.WaterMeters[5].YearOfProduction;
|
||||
YearOfProduction[5] = Sequences.ProcessData.BatchRslts.Batch.WaterMeters[5].YearOfProduction;
|
||||
yearOfProduction6TextBox.Text = YearOfProduction[5].ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
/// <summary>
|
||||
/// Properties set by the Begin and the End form
|
||||
/// </summary>
|
||||
public string PurchaseOrder { get { return string.Empty; } } /// Not supported in Munich
|
||||
|
||||
string[] serialNr;
|
||||
public string SerialNr(int wmNr) { return (wmNr >= 0 && wmNr < serialNr.Length) ? serialNr[wmNr] : string.Empty; }
|
||||
|
||||
@@ -52,7 +50,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
|
||||
bool resultSaved;
|
||||
|
||||
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
@@ -91,7 +89,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -100,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -146,7 +144,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(myRef.waterMeters.Length, myRef.regReaders, disabled);
|
||||
myRef.modelessDlg = new TestStartEndForm(myRef.waterMeters.Count, myRef.regReaders, disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
@@ -192,12 +190,12 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
{
|
||||
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
|
||||
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
serialNr[i] = waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = serialNr[i] = dlg.SNText[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,11 +205,11 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
|
||||
Sequences.ProcessData.BatchRslts.Batch.ProtocolTitle = dlg.ProtocolTitle;
|
||||
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
wmCycleEndState[i] = waterMeters[i].EndState = dlg.EndStateText[i];
|
||||
waterMeters[i].EndState = wmCycleEndState[i] = dlg.EndStateText[i];
|
||||
waterMeters[i].YearOfProduction = dlg.YearOfProduction[i];
|
||||
}
|
||||
}
|
||||
@@ -258,15 +256,5 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
|
||||
/// <param name="results">Test results to be updated with the information</param>
|
||||
public void UpdateTestResults(Results.BatchResults results)
|
||||
{
|
||||
/// Nothing to be done
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
/// </summary>
|
||||
string purchaseOrder;
|
||||
public string PurchaseOrder { get { return purchaseOrder; } }
|
||||
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
string[] wmCycleEndState;
|
||||
@@ -49,7 +46,7 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
@@ -87,7 +84,7 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -96,7 +93,7 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -195,22 +192,21 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
purchaseOrder = dlg.PurchaseOrder;
|
||||
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
|
||||
}
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
{
|
||||
CycleEndForm dlg = (modelessDlg as CycleEndForm);
|
||||
int count = waterMeters.Length;
|
||||
int count = waterMeters.Count;
|
||||
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -270,20 +266,5 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
/// </summary>
|
||||
/// <param name="batchResults">Test results to be updated with the information</param>
|
||||
public void UpdateTestResults(Results.BatchResults batchResults)
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+620
-620
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
|
||||
|
||||
readonly Results.Entities.WaterMeter[] WaterMeters;
|
||||
readonly IList<Results.Entities.WaterMeter> waterMeters;
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
@@ -78,11 +78,11 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(Results.Entities.WaterMeter[] waterMeters, bool atTheEnd, bool sensusExtensions, bool plusKeyIsOK)
|
||||
public CycleBeginningForm(IList<Results.Entities.WaterMeter> waterMeters, bool atTheEnd, bool sensusExtensions, bool plusKeyIsOK)
|
||||
: this()
|
||||
{
|
||||
this.WaterMeters = waterMeters;
|
||||
this.WaterMetersCount = waterMeters.Length;
|
||||
this.waterMeters = waterMeters;
|
||||
this.WaterMetersCount = waterMeters.Count;
|
||||
this.AtTheEnd = atTheEnd;
|
||||
this.SensusExtensions = sensusExtensions;
|
||||
this.PlusKeyIsOK = plusKeyIsOK;
|
||||
@@ -91,7 +91,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
|
||||
ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize);
|
||||
|
||||
foreach (var wm in WaterMeters) if (wm != null) wm.Passed = wm.PassedFromTests();
|
||||
foreach (var wm in waterMeters) if (wm != null) wm.Passed = wm.PassedFromTests();
|
||||
|
||||
Height = 147 + WaterMetersCount * 45; /// Adjust the window size
|
||||
|
||||
@@ -218,8 +218,8 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
Results.Entities.WaterMeter wm = WaterMeters[i];
|
||||
if (wm == null)
|
||||
Results.Entities.WaterMeter wm = waterMeters[i];
|
||||
if (wm == null && !wm.Disabled)
|
||||
{
|
||||
checkBoxes[i].Checked = true;
|
||||
}
|
||||
@@ -274,9 +274,9 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
Results.Entities.WaterMeter wm = WaterMeters[i];
|
||||
Results.Entities.WaterMeter wm = waterMeters[i];
|
||||
{
|
||||
if (wm != null)
|
||||
if (wm != null && !wm.Disabled)
|
||||
{
|
||||
bool pressureTestPassed = false;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
@@ -503,7 +503,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
if (!AtTheEnd || WaterMeters[i].Passed)
|
||||
if (!AtTheEnd || waterMeters[i].Passed)
|
||||
{
|
||||
if (!snFound)
|
||||
{
|
||||
|
||||
@@ -2127,6 +2127,9 @@
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1067, 651</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterParent</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Batch data</value>
|
||||
</data>
|
||||
|
||||
@@ -324,6 +324,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
|
||||
this.Name = "CycleEndForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Daten";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleEndForm_Load);
|
||||
|
||||
@@ -23,9 +23,6 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
/// </summary>
|
||||
string purchaseOrder;
|
||||
public string PurchaseOrder { get { return purchaseOrder; } }
|
||||
|
||||
bool[] disabled; /// This array is shared between forms
|
||||
|
||||
string[] wmCycleEndState;
|
||||
@@ -49,7 +46,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
|
||||
bool resultSaved; /// Set in Run() when results are saved
|
||||
|
||||
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
@@ -87,7 +84,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -96,7 +93,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -195,22 +192,21 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
purchaseOrder = dlg.PurchaseOrder;
|
||||
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
|
||||
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
|
||||
}
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
{
|
||||
CycleEndForm dlg = (modelessDlg as CycleEndForm);
|
||||
int count = waterMeters.Length;
|
||||
int count = waterMeters.Count;
|
||||
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -270,20 +266,5 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
/// </summary>
|
||||
/// <param name="batchResults">Test results to be updated with the information</param>
|
||||
public void UpdateTestResults(Results.BatchResults batchResults)
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+703
-702
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user