From 7dcb5ba6ce56767665f1b7e4989a88012a4da074 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Thu, 6 Feb 2020 13:35:56 +0100 Subject: [PATCH] (1) Store/restore RawTestInfos & CompleteTestInfos as well, (2) TestRslt.TestDone = true after RFID, ver. 2.25.1409 --- Results/Entities/WaterMeter.cs | 53 ++++++++++++++----- .../Output/SensusTestInfo.cs | 43 ++++++++++++++- Results/Properties/AssemblyInfo.cs | 4 +- Results/Results.csproj | 1 + .../Output/DB/SensusOracle/Database.cs | 1 + .../Output/FileWriters/IperlLogger/Writer.cs | 1 + TBF/BenchControl/Sequences/ProcessData.cs | 4 +- .../iPerlCommunicationForm.cs | 13 ++--- .../iPerlCommunication/iPerlHead/IperlHead.cs | 2 +- TBF/Properties/AssemblyInfo.cs | 4 +- TBF/TBF.csproj | 1 - TBF/UI/Procedures/ProcedureDlg.cs | 6 +-- .../TestWizard/OracleWZTypSelection.cs | 1 + 13 files changed, 102 insertions(+), 32 deletions(-) rename {TBF/BenchControl => Results}/Output/SensusTestInfo.cs (93%) diff --git a/Results/Entities/WaterMeter.cs b/Results/Entities/WaterMeter.cs index 232751292..452af75d7 100644 --- a/Results/Entities/WaterMeter.cs +++ b/Results/Entities/WaterMeter.cs @@ -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() { @@ -605,7 +602,21 @@ namespace Results.Entities writer.Write(HydrPruefung); writer.Write(WMTypeRevision); - /// TODO: Write RawTestInfos, CompleteTestInfos + /// Write RawTestInfos + IList rawTestInfos = RawTestInfos as IList; + 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); @@ -624,14 +635,12 @@ namespace Results.Entities } /// Write MeterTestRslts - int mtrCount = MeterTestRslts != null ? MeterTestRslts.Count : 0; - writer.Write(mtrCount); - for (int i = 0; i < mtrCount; i++) + int meterTestRsltsCount = MeterTestRslts != null ? MeterTestRslts.Count : 0; + writer.Write(meterTestRsltsCount); + for (int i = 0; i < meterTestRsltsCount; i++) { MeterTestRslts[i].WriteBinary(writer); } - - /// TODO: lastMeterTestRslts ??? } public virtual void ReadBinary(BinaryReader reader, IList wmDatasRetrievedSoFar, IList testRslts) @@ -685,8 +694,28 @@ namespace Results.Entities Pruefindex = reader.ReadInt32(); HydrPruefung = reader.ReadInt32(); WMTypeRevision = reader.ReadInt32(); - RawTestInfos = null; /// TODO - CompleteTestInfos = null; /// TODO + + /// Read RawTestInfos + int rawTestInfosCount = reader.ReadInt32(); + IList rawTestInfos = new List(); + 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(); @@ -718,8 +747,6 @@ namespace Results.Entities mtr.ReadBinary(reader, testRslts); MeterTestRslts.Add(mtr); } - - /// TODO: lastMeterTestRslts ??? } } } diff --git a/TBF/BenchControl/Output/SensusTestInfo.cs b/Results/Output/SensusTestInfo.cs similarity index 93% rename from TBF/BenchControl/Output/SensusTestInfo.cs rename to Results/Output/SensusTestInfo.cs index bf5cabdcd..23acfa346 100644 --- a/TBF/BenchControl/Output/SensusTestInfo.cs +++ b/Results/Output/SensusTestInfo.cs @@ -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; @@ -418,5 +421,41 @@ namespace TBF.BenchControl.Output { 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(); + } } } diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index 499f9ef32..8affc5731 100644 --- a/Results/Properties/AssemblyInfo.cs +++ b/Results/Properties/AssemblyInfo.cs @@ -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.25.1408.0")] -[assembly: AssemblyFileVersion("2.25.1408.0")] +[assembly: AssemblyVersion("2.25.1409.0")] +[assembly: AssemblyFileVersion("2.25.1409.0")] diff --git a/Results/Results.csproj b/Results/Results.csproj index 4745fb083..c0ed96111 100644 --- a/Results/Results.csproj +++ b/Results/Results.csproj @@ -165,6 +165,7 @@ Component + diff --git a/TBF/BenchControl/Output/DB/SensusOracle/Database.cs b/TBF/BenchControl/Output/DB/SensusOracle/Database.cs index ceb4ad0e4..4f4f83c68 100644 --- a/TBF/BenchControl/Output/DB/SensusOracle/Database.cs +++ b/TBF/BenchControl/Output/DB/SensusOracle/Database.cs @@ -9,6 +9,7 @@ using log4net; using Oracle.DataAccess.Client; // ODP.NET Oracle managed provider using Config; using Config.Entities; +using Results.Output; using System.Text; namespace TBF.BenchControl.Output.DB.SensusOracle diff --git a/TBF/BenchControl/Output/FileWriters/IperlLogger/Writer.cs b/TBF/BenchControl/Output/FileWriters/IperlLogger/Writer.cs index 2cb07ed2c..60da9a77c 100644 --- a/TBF/BenchControl/Output/FileWriters/IperlLogger/Writer.cs +++ b/TBF/BenchControl/Output/FileWriters/IperlLogger/Writer.cs @@ -7,6 +7,7 @@ using System.IO; using log4net; using Config; using Config.Entities; +using Results.Output; namespace TBF.BenchControl.Output.FileWriters.IperlLogger { diff --git a/TBF/BenchControl/Sequences/ProcessData.cs b/TBF/BenchControl/Sequences/ProcessData.cs index d868ad9dc..d67def2eb 100644 --- a/TBF/BenchControl/Sequences/ProcessData.cs +++ b/TBF/BenchControl/Sequences/ProcessData.cs @@ -29,8 +29,8 @@ namespace TBF.BenchControl.Sequences public static bool IsQ2PreCorrectionCalculated; public static int CalculatedQ2PreCorrectionLR; public static int CalculatedQ2PreCorrectionRL; - public static IList RawTestInfos; /// Incomplete raw test infos from Oracle DB - public static Output.SensusTestInfo[] CompleteTestInfos; /// Complete TBF test infos obtained as a best mathch + public static IList RawTestInfos; /// Incomplete raw test infos from Oracle DB + public static Results.Output.SensusTestInfo[] CompleteTestInfos; /// Complete TBF test infos obtained as a best mathch static ProcessData() diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs index b9102ad64..a99c4b1d5 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs @@ -2604,12 +2604,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication /// Auxiliary results ... not required /// Main results - tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName; - tstRslt.StartTime = tstRslt.Batch.StartTime; - tstRslt.EndTime = endTime; - tstRslt.FlowSetTime = 0; - tstRslt.Buoyancy = Formulas.Buoyancy(); - tstRslt.TestTime += testTime; /// [s] total communication time of all tests + tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName; + tstRslt.TestDone = true; + tstRslt.StartTime = tstRslt.Batch.StartTime; + tstRslt.EndTime = endTime; + tstRslt.FlowSetTime = 0; + tstRslt.Buoyancy = Formulas.Buoyancy(); + tstRslt.TestTime += testTime; /// [s] total communication time of all tests for (int i = 0; i < iperlHeads.Count; i++) { diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs index 0697bbb03..79c075b03 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs @@ -556,7 +556,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead string wmPosition = Name.Substring(5); /// WMPosition is extracted from a component name in form 'iPerl#' if (wmPosition.Length == 1) wmPosition = "0" + wmPosition; - SensusTestInfo[] testInfos = Sequences.ProcessData.CompleteTestInfos; + Results.Output.SensusTestInfo[] testInfos = Sequences.ProcessData.CompleteTestInfos; optoDataLogFileName = null; /// if (testInfos != null) diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 6abadbff6..5ea1a6d39 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.25.1408.0")] -[assembly: AssemblyFileVersion("2.25.1408.0")] +[assembly: AssemblyVersion("2.25.1409.0")] +[assembly: AssemblyFileVersion("2.25.1409.0")] diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index b72ca6cb4..833672ebe 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -1032,7 +1032,6 @@ WriterCfgCtrl.cs - Form diff --git a/TBF/UI/Procedures/ProcedureDlg.cs b/TBF/UI/Procedures/ProcedureDlg.cs index b8138c985..4e979b317 100644 --- a/TBF/UI/Procedures/ProcedureDlg.cs +++ b/TBF/UI/Procedures/ProcedureDlg.cs @@ -2614,17 +2614,17 @@ namespace TBF.UI.Procedures double qfrom, qto; switch (ti.Range) { - case Range.R90_100: + case Results.Output.Range.R90_100: qfrom = 0.9 * ti.Flow; qto = ti.Flow; break; - case Range.R95_105: + case Results.Output.Range.R95_105: qfrom = 0.95 * ti.Flow; qto = 1.05 * ti.Flow; break; - case Range.R100_110: + case Results.Output.Range.R100_110: qfrom = ti.Flow; qto = 1.1 * ti.Flow; break; diff --git a/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs index 076aeecb6..b833c149c 100644 --- a/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs +++ b/TBF/UI/Procedures/TestWizard/OracleWZTypSelection.cs @@ -8,6 +8,7 @@ using System.Windows.Forms; using log4net; using Oracle.DataAccess.Client; using Config.Entities; +using Results.Output; using TBF.BenchControl.GenericDevices; using TBF.BenchControl.Output; using TBF.BenchControl.Output.DB.SensusOracle;