diff --git a/Results/Entities/MeterTestRslt.cs b/Results/Entities/MeterTestRslt.cs index a974dd3f1..50765dd24 100644 --- a/Results/Entities/MeterTestRslt.cs +++ b/Results/Entities/MeterTestRslt.cs @@ -10,7 +10,7 @@ namespace Results.Entities 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 depent on localisation and customer + public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depend on localization and customer public virtual double PulsesMeter { get; set; } /// # of water meter or heat meter pulses public virtual double PulsesMaster { get; set; } /// # of reference flowmeter pulses (gated by this water meter pulses) diff --git a/Results/Entities/TestRslt.cs b/Results/Entities/TestRslt.cs index ab4b161e9..3b33186ba 100644 --- a/Results/Entities/TestRslt.cs +++ b/Results/Entities/TestRslt.cs @@ -132,11 +132,25 @@ namespace Results.Entities public virtual double TargetVolume() { return TestData.TargetVolume; } public virtual double TargetTime() { return TestData.TargetTime; } public virtual string Method() { return TestData.Method; } + public virtual string RefFlowmeter() { return (Components != null) ? Components.Flowmeter : string.Empty; } public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection")) : true; } public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest")) : true; } public virtual bool IsStartStop() { return (MethodClass != null) ? MethodClass.Contains("FixedStart") : true; } public virtual bool IsDiverter() { return (MethodClass != null) ? (MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) : true; } + public virtual string MethodElde() + { + if (MethodClass == null) return string.Empty; + else if (MethodClass.Contains("TestMethods.FlyingStartMassCollection.")) return "MS"; + else if (MethodClass.Contains("TestMethods.FlyingStartMassCollectionProlonged.")) return "MS"; + else if (MethodClass.Contains("TestMethods.FlyingStartMassCollectionComparative.")) return "MS"; + else if (MethodClass.Contains("TestMethods.FlyingStart.")) return "VS"; + else if (MethodClass.Contains("TestMethods.FixedStartMassCollection.")) return "MP"; + else if (MethodClass.Contains("TestMethods.FixedStartTankCollection.")) return "VP"; + else if (MethodClass.Contains("TestMethods.FixedStart.")) return "VP"; + else return string.Empty; + } + public virtual double ErrLimLo() { if (TestData.ErrLimLo <= TestData.ErrLimHi) diff --git a/Results/ItemID.cs b/Results/ItemID.cs index 90c3c6e72..61b76c265 100644 --- a/Results/ItemID.cs +++ b/Results/ItemID.cs @@ -300,6 +300,9 @@ namespace Results E27, /// 255 E28, /// 256 + RefFlowmeter, /// 257 + Test_Method_Elde, /// 258 + Count, } } diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index 2830f45a2..30a3a0285 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.18.1208.0")] -[assembly: AssemblyFileVersion("2.18.1208.0")] +[assembly: AssemblyVersion("2.18.1209.0")] +[assembly: AssemblyFileVersion("2.18.1209.0")] diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index ef09ff241..43c83d6cd 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.cs @@ -149,6 +149,7 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Proc_description, Strings.Procedure_description, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProcedureDescription))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.BatchNr()))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method()))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_Method_Elde, Strings.Test_method + " Elde ()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).MethodElde()))); /// /// Volume @@ -320,7 +321,8 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f) : ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f)))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result + AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty)); + AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result /// /// Water meter info diff --git a/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs b/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs index 764801cc9..e40d5472d 100644 --- a/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs +++ b/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs @@ -56,11 +56,26 @@ namespace TBF.BenchControl.Output.FileWriters.Elde header = string.IsNullOrEmpty(writerCfg.Header) ? string.Empty : writerCfg.Header.Replace("~", Environment.NewLine); commonItems = Results.WMeterRsltItemSpec.FromStrArray(new string[] { - "72~Date / Time~~None~: {0:yyyy/MM/dd} / {0:HH:mm}~~0~Left", - "221~Watermeter Type~~None~: {0}~~0~Left", - "0~Device No~~None~: 1~~0~Left", - "66~Personal~~None~: {0}~~0~Left" } ); - testItems = Results.WMeterRsltItemSpec.FromStrArray(writerCfg.SelectedItems); /// TestID info will be overwritten later on + "72~Date / Time~~None~: {0:yyyy/MM/dd} / {0:HH:mm} Page : 1/1~~0~Left", + "50~Watermeter Type~~None~: {0}~~0~Left", + "64~Device No~~None~: {0}~~0~Left", + "66~Personal~~None~: {0}~~0~Left", + } ); + testItems = Results.WMeterRsltItemSpec.FromStrArray(new string[] { + "1~Test~~None~~~0~Left", + "258~Met. t.~~None~~~0~Left", + "257~Fl.~~None~~~0~Left", + "25~Dev. [%]~~Pct~~~0~Left", + "202~Flow [m3/h]~~m3ph~~F6~0~Left", + "14~Test time [s]~~s~~F1~0~Left", + "16~T1 [°C]~~C~~F1~0~Left", + "17~T2 [°C]~~C~~F1~0~Left", + "5~Density [kg/m3]~~kgpm3~~F3~0~Left", + "131~Mass [kg]~~kg~~F3~0~Left", + "19~Pressure [MPa]~~MPa~~F2~0~Left", + "229~Volume [L]~~l~~F4~0~Left", + } ); + footer = string.IsNullOrEmpty(writerCfg.Footer) ? string.Empty : writerCfg.Footer.Replace("~", Environment.NewLine); } @@ -269,6 +284,22 @@ namespace TBF.BenchControl.Output.FileWriters.Elde void WriteRsltsEx(Results.Entities.Batch batch, StreamWriter wrtr) { + string toPrint; + + /// + /// Get a sample water meter (to save common and test items) + /// + Results.Entities.WaterMeter sampleWM = null; + foreach (var wm in batch.WaterMeters) + { + if (wm != null) + { + sampleWM = wm; + break; + } + } + if (sampleWM == null) return; /// No water meters + ///---------- /// Header ///---------- @@ -282,10 +313,10 @@ namespace TBF.BenchControl.Output.FileWriters.Elde string[] rightColumn = new string[commonItems.Count]; int cnt = 0; - foreach (var v in commonItems) + foreach (var item in commonItems) { - leftColumn[cnt] = v.Caption; - rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty; + leftColumn[cnt] = item.Caption; + rightColumn[cnt] = item.Print(sampleWM); cnt++; } @@ -309,164 +340,131 @@ namespace TBF.BenchControl.Output.FileWriters.Elde wrtr.WriteLine(rightColumn[i]); } - ///-------- - /// Body - ///-------- - foreach (var wm in batch.WaterMeters) + ///--------- + /// Tests + ///--------- + wrtr.WriteLine(); + wrtr.WriteLine("Test Met. Fl. Dev. Flow Test time T1 T2 Density Mass Pressure Volume"); + wrtr.WriteLine(" t. [%] [m3/h] [s] [°C] [°C] [kg/m3] [kg] [MPa] [L]"); + wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------"); + + int emptyTestsLeft = 5; + + int[] widths = new int[] { 11, 5, 6, 9, 12, 12, 8, 11, 10, 15, 8, 1 }; /// Widths of columns + foreach (var testRslt in batch.TestRslts) { - if (!writerCfg.SaveGoodOnly || wm.Passed) + if (testRslt.Publish() == Config.Entities.Publish.Always) { - if (abort) return; - WriteWM(wrtr, wm); + for (int i = 0; i < Math.Min(testItems.Count, widths.Length); i++) + { + wrtr.Write(toPrint = testItems[i].Print(sampleWM, testRslt.Name())); + for (int j = 0; j < Math.Max(1, widths[i] - toPrint.Length); j++) wrtr.Write(' '); + } + wrtr.WriteLine(); + wrtr.WriteLine(); + if (emptyTestsLeft > 0) emptyTestsLeft--; } } + ///---------------- + /// Water meters + ///---------------- + wrtr.WriteLine(); + wrtr.WriteLine(); + wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------"); + wrtr.WriteLine("No | Prod. No | Initial Volume [L] | End Volume [L] | Deviation [%] |Sen| Result."); + wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------"); + wrtr.Write(" "); + for (int i = 0; i < 3; i++) + { + foreach (var testRslt in batch.TestRslts) + { + if (testRslt.Publish() == Config.Entities.Publish.Always) + { + wrtr.Write(toPrint = testRslt.Name()); + for (int j = 0; j < Math.Max(1, (i<2 ? 8 : 7) - toPrint.Length); j++) wrtr.Write(' '); + } + } + + for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write("- "); + } + wrtr.WriteLine(); + wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------"); + + foreach (var wm in batch.WaterMeters) + { + if (wm != null) + { + wrtr.Write(' '); + + wrtr.Write(toPrint = wm.WMPosition.ToString()); + for (int j = 0; j < Math.Max(1, 3 - toPrint.Length); j++) wrtr.Write(' '); + + wrtr.Write(toPrint = wm.SerialNr); + for (int j = 0; j < Math.Max(1, 14 - toPrint.Length); j++) wrtr.Write(' '); + + /// Volume start + foreach (var mtr in wm.MeterTestRslts) + { + if (mtr.Publish() == Config.Entities.Publish.Always) + { + wrtr.Write(toPrint = mtr.VolumeStart.ToString("F2")); + for (int j = 0; j < Math.Max(1, 8 - toPrint.Length); j++) wrtr.Write(' '); + } + } + for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write(" "); + + /// Volume end + foreach (var mtr in wm.MeterTestRslts) + { + if (mtr.Publish() == Config.Entities.Publish.Always) + { + wrtr.Write(toPrint = mtr.VolumeEnd.ToString("F2")); + for (int j = 0; j < Math.Max(1, 8 - toPrint.Length); j++) wrtr.Write(' '); + } + } + for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write(" "); + + /// Error + foreach (var mtr in wm.MeterTestRslts) + { + if (mtr.Publish() == Config.Entities.Publish.Always) + { + wrtr.Write(toPrint = mtr.Error.ToString("F2")); + for (int j = 0; j < Math.Max(1, 7 - toPrint.Length); j++) wrtr.Write(' '); + } + } + for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write(" "); + + wrtr.Write(" "); + wrtr.Write(wm.Passed ? "OK" : "Not suitable"); + wrtr.WriteLine(); + } + } + + wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------"); + wrtr.WriteLine(); + + wrtr.Write("Producer: "); + wrtr.Write(toPrint = sampleWM.WaterMeterData.Producer); + for (int j = 0; j < Math.Max(1, 30 - toPrint.Length); j++) wrtr.Write(' '); + wrtr.WriteLine("Explanation :"); + + wrtr.WriteLine(" M - Mass Method"); + wrtr.WriteLine(" V - Volumetric Method"); + wrtr.WriteLine(" P - Start / Stop"); + wrtr.WriteLine(" F - Flow start"); + wrtr.WriteLine(" S - Synchro"); + wrtr.WriteLine(" C - Count imp."); + wrtr.WriteLine(); + wrtr.WriteLine("-------------------------------------------------------------------------"); + ///---------- /// Footer ///---------- if (!string.IsNullOrEmpty(writerCfg.Footer)) wrtr.Write(footer); - } - /// - /// Write one water meter results - /// - /// Water meter number (0-based) - void WriteWM(StreamWriter wr, Results.Entities.WaterMeter wm) - { - wr.WriteLine(); - - /// Write water meter number and s/n -#if BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT - wr.Write(string.Format("Water meter {0} s/n: {1}", wm.WMPosition, wm.SerialNr)); -#else - wr.Write(string.Format("{0} {1}", Strings.Water_Meter, wm.WMPosition)); - if (!wm.Compound()) - { - if (!string.IsNullOrEmpty(wm.SerialNr)) - { - wr.Write(string.Format(", {0} {1}", Strings.SerialNr, wm.SerialNr)); - } - } - else - { - if (!string.IsNullOrEmpty(wm.SerialNr)) - { - wr.Write(string.Format(", {0} {1}", Strings.Main_WM_SerialNr, wm.SerialNr)); - } - if (!string.IsNullOrEmpty(wm.SerialNrAux)) - { - wr.Write(string.Format(", {0} {1}", Strings.Aux_WM_SerialNr, wm.SerialNrAux)); - } - } -#endif - wr.WriteLine(); - - /// Determine column widths - int[] columnWidths = new int[testItems.Count]; - int totalWidth = 0; - for (int i = 0; i < testItems.Count; i++) - { - if (abort) return; - - columnWidths[i] = ElSpaces(testItems[i].Caption).Length; - foreach (var mtr in wm.MeterTestRslts) - { - if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always)) - { - string itemText = testItems[i].Print(wm, mtr.Name()); - - /// Strip color information - string[] texts = itemText.Split(new char[] { '|' }); - if (texts.Length == 2) { itemText = texts[0]; } - - int len = ElSpaces(itemText).Length; - if (len > columnWidths[i]) columnWidths[i] = len; - } - } - totalWidth += columnWidths[i]; - } - totalWidth += 3 * (testItems.Count - 1); - if (totalWidth < 0) totalWidth = 0; - - string horizontalLine = new String('-', totalWidth); - - if (!writerCfg.EliminateSpaces) - { - wr.WriteLine(horizontalLine); /// Horizontal line above the header - } - - /// Write column headers - for (int i = 0; i < testItems.Count; i++) - { - if (abort) return; - - string caption = ElSpaces(testItems[i].Caption); - wr.Write(caption); - - if (i < testItems.Count - 1) - { - if (!writerCfg.EliminateSpaces) - { - wr.Write(new string(' ', columnWidths[i] - testItems[i].Caption.Length + 3)); - } - wr.Write(separatorStr); - } - else - { - wr.WriteLine(); - } - } - - if (!writerCfg.EliminateSpaces) - { - wr.WriteLine(horizontalLine); /// Horizontal line between the header and the body - } - - /// Write table data - int rowsCount = 0; - foreach (var mtr in wm.MeterTestRslts) - { - if (abort) return; - - if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) - { - Results.WMeterRsltItemSpec.TableRowNr = ++rowsCount; - - for (int i = 0; i < testItems.Count; i++) - { - Results.WMeterRsltItemSpec.TableColumnNr = i + 1; - - /// Fetch the item - string itemText = testItems[i].Print(wm, mtr.Name()); - - /// Strip color information - string[] texts = itemText.Split(new char[] { '|' }); - if (texts.Length == 2) { itemText = texts[0]; } - - /// Print the item - string itemText2 = ElSpaces(itemText); - wr.Write(itemText2); - - if (i < testItems.Count - 1) - { - if (!writerCfg.EliminateSpaces) - { - wr.Write(new string(' ', columnWidths[i] - itemText.Length + 3)); - } - wr.Write(separatorStr); - } - else - { - wr.WriteLine(); - } - } - } - } - - if (!writerCfg.EliminateSpaces) - { - wr.WriteLine(horizontalLine); /// Horizontal line below the body - } + wrtr.Write('\f'); /// Form feed } } } diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index ebe573970..f73c3a6f0 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.18.1208.0")] -[assembly: AssemblyFileVersion("2.18.1208.0")] +[assembly: AssemblyVersion("2.18.1209.0")] +[assembly: AssemblyFileVersion("2.18.1209.0")] diff --git a/packages/ControlBoard/DEWA_300/ControlComponent3U.dll b/packages/ControlBoard/DEWA_300/ControlComponent3U.dll index b86a574eb..7f7fe4214 100644 Binary files a/packages/ControlBoard/DEWA_300/ControlComponent3U.dll and b/packages/ControlBoard/DEWA_300/ControlComponent3U.dll differ