diff --git a/Config/Data.cs b/Config/Data.cs index a38017a7e..4b9d4bc6f 100644 --- a/Config/Data.cs +++ b/Config/Data.cs @@ -33,6 +33,10 @@ namespace Config public const int LineSize = 20; public const int CompoundWMsCount = 1; #endif + public static int MaxPartNr() + { + return Math.Max(WMsCount / LineSize, CompoundWMsCount); + } /// /// Database related: This object reference is set after a successful user login diff --git a/Config/Entities/Enums.cs b/Config/Entities/Enums.cs index f102d2c72..33818deff 100644 --- a/Config/Entities/Enums.cs +++ b/Config/Entities/Enums.cs @@ -62,6 +62,15 @@ namespace Config.Entities Count, } + public enum Publish : byte + { + None = 0, + Always = 1, + OnScreen = 2, + Internal = 3, + Count, + } + public enum TestRedType { Fix, diff --git a/Config/Entities/Test.cs b/Config/Entities/Test.cs index 536fc181c..c9c58cf8d 100644 --- a/Config/Entities/Test.cs +++ b/Config/Entities/Test.cs @@ -17,7 +17,7 @@ namespace Config.Entities public virtual string Name { get; set; } public virtual int Part { get; set; } /// Part=0 ... test of all WM-s /// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath - public virtual bool Publish { get; set; } + public virtual byte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal public virtual bool Evaluate { get; set; } public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h] public virtual float Qto { get; set; } /// Water flow high limit in [m3/h] @@ -59,7 +59,7 @@ namespace Config.Entities /// /// Default values /// - Publish = true; + Publish = (byte)Config.Entities.Publish.Always; Evaluate = true; Repeats = 1; Emptying = false; @@ -130,7 +130,7 @@ namespace Config.Entities { string partStr = (Part > 0) ? string.Format(", part {0}", Part) : string.Empty; - return string.Format("{0}({1}{2}){3}", Name, Publish ? "P" : "-", Evaluate ? "E" : "-", partStr); + return string.Format("{0}(P.{1},{2}){3}", Name, ((Publish)Publish).ToString(), Evaluate ? "E" : "-", partStr); } } } diff --git a/Config/Mappings/TestMap.cs b/Config/Mappings/TestMap.cs index 439fb8f92..b73d2e2c7 100644 --- a/Config/Mappings/TestMap.cs +++ b/Config/Mappings/TestMap.cs @@ -16,6 +16,7 @@ namespace Config.Mappings Map(x => x.Name); Map(x => x.Part); Map(x => x.Publish); +// .CustomType("tinyint"); Map(x => x.Evaluate); Map(x => x.Qfrom); Map(x => x.Qto); diff --git a/Config/Properties/AssemblyInfo.cs b/Config/Properties/AssemblyInfo.cs index b4453d700..0a8291ab6 100644 --- a/Config/Properties/AssemblyInfo.cs +++ b/Config/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.2.217.0")] -[assembly: AssemblyFileVersion("2.2.217.0")] +[assembly: AssemblyVersion("2.3.227.0")] +[assembly: AssemblyFileVersion("2.3.227.0")] diff --git a/Results/BatchResults.cs b/Results/BatchResults.cs index 01cc2e394..13930b8c6 100644 --- a/Results/BatchResults.cs +++ b/Results/BatchResults.cs @@ -64,7 +64,7 @@ namespace Results foreach (var t in procedure.Tests) { - if (t.Publish) + if (t.Publish != (byte)Config.Entities.Publish.None) { TestData td = TestData.UpdateList(d.TestDataList, new TestData(t)); diff --git a/Results/Entities/TestData.cs b/Results/Entities/TestData.cs index fee2104dd..a21532489 100644 --- a/Results/Entities/TestData.cs +++ b/Results/Entities/TestData.cs @@ -23,6 +23,7 @@ namespace Results.Entities public virtual double ErrLimLo { get; set; } /// [%] (usually < 0) public virtual double ErrLimHi { get; set; } /// [%] (usually > 0) public virtual double Uncertainty { get; set; } /// [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx) + public virtual byte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal public virtual bool Evaluate { get; set; } @@ -45,6 +46,7 @@ namespace Results.Entities ErrLimLo = (double)test.ErrLimLo; ErrLimHi = (double)test.ErrLimHi; Uncertainty = (double)test.Uncertainty; + Publish = test.Publish; Evaluate = test.Evaluate; } @@ -66,6 +68,7 @@ namespace Results.Entities if (ErrLimLo != td.ErrLimLo) return false; if (ErrLimHi != td.ErrLimHi) return false; if (Uncertainty != td.Uncertainty) return false; + if (Publish != td.Publish) return false; if (Evaluate != td.Evaluate) return false; return true; diff --git a/Results/Entities/WaterMeter.cs b/Results/Entities/WaterMeter.cs index 7f0d5178e..e879efb2d 100644 --- a/Results/Entities/WaterMeter.cs +++ b/Results/Entities/WaterMeter.cs @@ -58,6 +58,10 @@ 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 bool PassedFromTests() { bool passed = true; diff --git a/Results/Mappings/TestDataMap.cs b/Results/Mappings/TestDataMap.cs index 08cbd1f5e..07beacab5 100644 --- a/Results/Mappings/TestDataMap.cs +++ b/Results/Mappings/TestDataMap.cs @@ -21,6 +21,9 @@ namespace Results.Mappings Map(x => x.ErrLimLo); Map(x => x.ErrLimHi); Map(x => x.Uncertainty); + Map(x => x.Publish); +// .CustomType("tinyint"); + Map(x => x.Evaluate); } } } diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index 6e2356d14..bd63a2d3e 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.2.219.0")] -[assembly: AssemblyFileVersion("2.2.219.0")] +[assembly: AssemblyVersion("2.3.227.0")] +[assembly: AssemblyFileVersion("2.3.227.0")] diff --git a/TestBenchFramework/BenchControl/Elde/ControlComSim.cs b/TestBenchFramework/BenchControl/Elde/ControlComSim.cs index a80e45d2d..856280ace 100644 --- a/TestBenchFramework/BenchControl/Elde/ControlComSim.cs +++ b/TestBenchFramework/BenchControl/Elde/ControlComSim.cs @@ -243,6 +243,7 @@ namespace TBF.BenchControl.Elde public void RunDeviceBefore() { + log.DebugFormat("RunDeviceBefore() ... regV#={0}, flowM#{1}, statusP={2}", regulValveNo, refFlowmtrNr, statusP.ToString("X")); TestBenchSim.RunDevice(regulValveNo, refFlowmtrNr, statusP); log.DebugFormat("refFreq={0}", referenceFreq); diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 6bb8542e1..f8c1eba6e 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -232,12 +232,12 @@ namespace TBF.BenchControl.Sequences foreach (var wm in WaterMeters) wm.ClearData(); /// Clean water meter data bool compound = (StateMachine.Procedure.MetersKind == MetersKind.Combined); - int nrWMs = Math.Min(WaterMeters.Count, compound ? Config.Data.CompoundWMsCount : Config.Data.WMsCount); + int waterMetersCount = Math.Min(WaterMeters.Count, compound ? Config.Data.CompoundWMsCount : Config.Data.WMsCount); /// - Results.Entities.WaterMeterData[] waterMeterData = new Results.Entities.WaterMeterData[nrWMs]; + Results.Entities.WaterMeterData[] waterMeterData = new Results.Entities.WaterMeterData[waterMetersCount]; /// - int[] waterMeterParts = new int[nrWMs]; - for (int i = 0; i < nrWMs; i++) + int[] waterMeterParts = new int[waterMetersCount]; + for (int i = 0; i < waterMetersCount; i++) { waterMeterParts[i] = Utils.PartNr(i + 1, compound); waterMeterData[i] = new Results.Entities.WaterMeterData() diff --git a/TestBenchFramework/ProcedureDlg.cs b/TestBenchFramework/ProcedureDlg.cs index b9bb101ea..9165581ad 100644 --- a/TestBenchFramework/ProcedureDlg.cs +++ b/TestBenchFramework/ProcedureDlg.cs @@ -545,13 +545,16 @@ namespace TBF //metrology2ListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Err_cor_neg_pct_chdr, Width = 90 }); //metrology2ListViewEx.Columns.Add(new ColumnHeader { Text = Strings.Err_cor_pos_pct_chdr, Width = 90 }); - ComboBox yesNo1CBox = new ComboBox(); /// control for Publish - yesNo1CBox.Items.Add(Strings.yes); - yesNo1CBox.Items.Add(Strings.no); + ComboBox publishCBox = new ComboBox(); /// control for Publish + for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++) + { + publishCBox.Items.Add(pb.ToString()); + } - ComboBox yesNo2CBox = new ComboBox(); /// control for Evaluate - yesNo2CBox.Items.Add(Strings.yes); - yesNo2CBox.Items.Add(Strings.no); + + ComboBox yesNoCBox = new ComboBox(); /// control for Evaluate + yesNoCBox.Items.Add(Strings.yes); + yesNoCBox.Items.Add(Strings.no); metrology2Editors = new Control[] { @@ -563,8 +566,8 @@ namespace TBF new TextBox(), /// Err.Lim. + new TextBox(), /// Uncertainty new TextBox(), /// Filter - yesNo1CBox, /// Publish - yesNo2CBox, /// Evaluate + publishCBox, /// Publish + yesNoCBox, /// Evaluate }; foreach (var ctrl in metrology2Editors) @@ -749,7 +752,7 @@ namespace TBF lviMetrlg2.SubItems.Add(test.ErrLimHi.ToString()); lviMetrlg2.SubItems.Add(test.Uncertainty.ToString()); lviMetrlg2.SubItems.Add(test.TolerRed.ToString()); - lviMetrlg2.SubItems.Add(test.Publish ? Strings.yes : Strings.no); + lviMetrlg2.SubItems.Add(((Config.Entities.Publish)test.Publish).ToString()); lviMetrlg2.SubItems.Add(test.Evaluate ? Strings.yes : Strings.no); metrology2ListViewEx.Items.Add(lviMetrlg2); @@ -840,8 +843,14 @@ namespace TBF if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.Uncertainty].Text, out tmp)) entity.Uncertainty = tmp; if (Utils.TryParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.Filter].Text, out tmp)) entity.TolerRed = (double)tmp; - if (lvi.SubItems[(int)Mtrlgy2Clmn.Publish].Text.Equals(Strings.yes)) entity.Publish = true; - else if (lvi.SubItems[(int)Mtrlgy2Clmn.Publish].Text.Equals(Strings.no)) entity.Publish = false; + for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++) + { + if (lvi.SubItems[(int)Mtrlgy2Clmn.Publish].Text.Equals(pb.ToString())) + { + entity.Publish = (byte)pb; + break; + } + } if (lvi.SubItems[(int)Mtrlgy2Clmn.Evaluate].Text.Equals(Strings.yes)) entity.Evaluate = true; else if (lvi.SubItems[(int)Mtrlgy2Clmn.Evaluate].Text.Equals(Strings.no)) entity.Evaluate = false; @@ -1034,13 +1043,23 @@ namespace TBF if (e.SubItem == (int)Mtrlgy2Clmn.Part) { if (e.DisplayText.Equals("-")) return; /// OK - if (!int.TryParse(e.DisplayText, out dummy) || dummy < 1 || dummy > 3) + if (!int.TryParse(e.DisplayText, out dummy) || dummy < 1 || dummy > Config.Data.MaxPartNr()) { e.DisplayText = e.Item.SubItems[e.SubItem].Text; e.Cancel = true; return; /// NOK } } + if (e.SubItem == (int)Mtrlgy2Clmn.Publish) + { + for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++) + { + if (e.DisplayText.Equals(pb.ToString())) return; + } + e.DisplayText = e.Item.SubItems[e.SubItem].Text; + e.Cancel = true; + return; /// NOK + } } private void processListViewEx_SubItemClicked(object sender, SubItemEventArgs e) diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 6714eeba0..8b46dfe38 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.2.227.1")] -[assembly: AssemblyFileVersion("2.2.227.1")] +[assembly: AssemblyVersion("2.3.227.1")] +[assembly: AssemblyFileVersion("2.3.227.1")]