diff --git a/Config/Entities/Enums.cs b/Config/Entities/Enums.cs index b0639d764..f36c1737e 100644 --- a/Config/Entities/Enums.cs +++ b/Config/Entities/Enums.cs @@ -64,7 +64,7 @@ namespace Config.Entities public enum Publish : sbyte { - None = 0, + Never = 0, Always = 1, OnScreen = 2, Internal = 3, diff --git a/Config/Mappings/TestMap.cs b/Config/Mappings/TestMap.cs index b73d2e2c7..439fb8f92 100644 --- a/Config/Mappings/TestMap.cs +++ b/Config/Mappings/TestMap.cs @@ -16,7 +16,6 @@ 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/Results/BatchResults.cs b/Results/BatchResults.cs index 13930b8c6..649ddeab0 100644 --- a/Results/BatchResults.cs +++ b/Results/BatchResults.cs @@ -64,7 +64,7 @@ namespace Results foreach (var t in procedure.Tests) { - if (t.Publish != (byte)Config.Entities.Publish.None) + if (t.Publish != (byte)Config.Entities.Publish.Never) { TestData td = TestData.UpdateList(d.TestDataList, new TestData(t)); @@ -151,10 +151,13 @@ namespace Results { for (int i = 0; i < WMPositionsCount; i++) { - if (WaterMeters[i] != null) + if (WaterMeters[i] != null) { WaterMeters[i].Passed = WaterMeters[i].PassedFromTests(); - Batch.WaterMeters.Add(WaterMeters[i]); + if (!WaterMeters[i].Disabled) + { + Batch.WaterMeters.Add(WaterMeters[i]); + } } } } diff --git a/Results/Entities/MeterTestRslt.cs b/Results/Entities/MeterTestRslt.cs index 523b4c1b1..44bbbe736 100644 --- a/Results/Entities/MeterTestRslt.cs +++ b/Results/Entities/MeterTestRslt.cs @@ -58,6 +58,7 @@ namespace Results.Entities public virtual double QFall() { return WaterMeter.QFall; } /// [m3/h] public virtual bool Evaluate() { return TestData().Evaluate; } + public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData().Publish; } public virtual string PassedColorStr() { diff --git a/Results/Entities/TestRslt.cs b/Results/Entities/TestRslt.cs index 9b3606d62..ee5a5ed53 100644 --- a/Results/Entities/TestRslt.cs +++ b/Results/Entities/TestRslt.cs @@ -89,6 +89,8 @@ namespace Results.Entities public virtual double ErrLimLo() { return TestData.ErrLimLo; } public virtual double ErrLimHi() { return TestData.ErrLimHi; } public virtual double Uncertainty() { return TestData.Uncertainty; } + public virtual bool Evaluate() { return TestData.Evaluate; } + public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData.Publish; } protected TestRslt() diff --git a/Results/Mappings/TestDataMap.cs b/Results/Mappings/TestDataMap.cs index 07beacab5..c7eb542cc 100644 --- a/Results/Mappings/TestDataMap.cs +++ b/Results/Mappings/TestDataMap.cs @@ -22,7 +22,6 @@ namespace Results.Mappings Map(x => x.ErrLimHi); Map(x => x.Uncertainty); Map(x => x.Publish); -// .CustomType("tinyint"); Map(x => x.Evaluate); } } diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/BasicPrintDocument.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/BasicPrintDocument.cs index cc9d2ed8c..42393edf3 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/BasicPrintDocument.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/BasicPrintDocument.cs @@ -99,7 +99,12 @@ namespace TBF.BenchControl.ResultsPrinters.Basic printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin; } - int testsCount = batch.WaterMeters[0].MeterTestRslts.Count; + int testsCount = 0; + foreach (var mtr in batch.WaterMeters[0].MeterTestRslts) + { + if (mtr.Publish() == Config.Entities.Publish.Always) testsCount++; + } + if (batch.WaterMeters[0].Compound()) testsCount /= 3; int wmSectionHeight = (testsCount + 4) * SpacingOne; @@ -205,7 +210,8 @@ namespace TBF.BenchControl.ResultsPrinters.Basic for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based { - nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmNr + 1, nextWmTop); + int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1); + nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop); } nextWMNr += nrWMsOnPage; @@ -293,37 +299,40 @@ namespace TBF.BenchControl.ResultsPrinters.Basic int testsCount = 0; foreach (var mtr in wm.MeterTestRslts) { - testsCount++; - for (int i = 0; i < rsltItems.Count; i++) + if (mtr.Publish() == Config.Entities.Publish.Always) { - string itemText; + testsCount++; + for (int i = 0; i < rsltItems.Count; i++) + { + string itemText; - if (!wm.Compound()) - { - /// Single water meter - itemText = rsltItems[i].Print(mtr); - } - else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound) - { - Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); - Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); - itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr); - } - else - { - continue; - } + if (!wm.Compound()) + { + /// Single water meter + itemText = rsltItems[i].Print(mtr); + } + else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound) + { + Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); + Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); + itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr); + } + else + { + continue; + } - /// Strip color information - string[] texts = itemText.Split(new char[] { '|' }); - if (texts.Length == 2) - { - itemText = texts[0]; - Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White); - /// TODO: How to print colors? - } + /// Strip color information + string[] texts = itemText.Split(new char[] { '|' }); + if (texts.Length == 2) + { + itemText = texts[0]; + Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White); + /// TODO: How to print colors? + } - PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText); + PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText); + } } } diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrintDocumentCevak.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrintDocumentCevak.cs index 3121e06ae..606b9bc3a 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrintDocumentCevak.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Cevak/PrintDocumentCevak.cs @@ -112,7 +112,13 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin; } - int testsCount = batch.WaterMeters[0].MeterTestRslts.Count; + + int testsCount = 0; + foreach (var mtr in batch.WaterMeters[0].MeterTestRslts) + { + if (mtr.Publish() == Config.Entities.Publish.Always) testsCount++; + } + if (batch.WaterMeters[0].Compound()) testsCount /= 3; int wmSectionHeight = (testsCount + 4) * SpacingOne; @@ -235,7 +241,8 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based { - nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmNr + 1, nextWmTop); + int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1); + nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop); } nextWMNr += nrWMsOnPage; @@ -358,37 +365,40 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak int testsCount = 0; foreach (var mtr in wm.MeterTestRslts) { - testsCount++; - for (int i = 0; i < rsltItems.Count; i++) + if (mtr.Publish() == Config.Entities.Publish.Always) { - string itemText; + testsCount++; + for (int i = 0; i < rsltItems.Count; i++) + { + string itemText; - if (!wm.Compound()) - { - /// Single water meter - itemText = rsltItems[i].Print(mtr); - } - else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound) - { - Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); - Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); - itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr); - } - else - { - continue; - } + if (!wm.Compound()) + { + /// Single water meter + itemText = rsltItems[i].Print(mtr); + } + else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound) + { + Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); + Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); + itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr); + } + else + { + continue; + } - /// Strip color information - string[] texts = itemText.Split(new char[] { '|' }); - if (texts.Length == 2) - { - itemText = texts[0]; - Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White); - /// TODO: How to print colors? - } + /// Strip color information + string[] texts = itemText.Split(new char[] { '|' }); + if (texts.Length == 2) + { + itemText = texts[0]; + Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White); + /// TODO: How to print colors? + } - PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText); + PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText); + } } } diff --git a/TestBenchFramework/BenchControl/ResultsWriters/Basic/Writer.cs b/TestBenchFramework/BenchControl/ResultsWriters/Basic/Writer.cs index fe39f3f82..1bcdd27a6 100644 --- a/TestBenchFramework/BenchControl/ResultsWriters/Basic/Writer.cs +++ b/TestBenchFramework/BenchControl/ResultsWriters/Basic/Writer.cs @@ -127,7 +127,13 @@ namespace TBF.BenchControl.ResultsWriters.Basic { this.batch = batchResults; - if (batch.WaterMeters.Count > 0 && !batch.WaterMeters[0].Compound()) + if (batch.WaterMeters.Count <= 0) + { + writer = null; + return this; + } + + if (batch.Compound == false) { rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM); } @@ -220,30 +226,33 @@ namespace TBF.BenchControl.ResultsWriters.Basic columnWidths[i] = ElSpaces(rsltItems[i].ClmnHeaderText).Length; foreach (var mtr in wm.MeterTestRslts) { - string itemText; - - if (!wm.Compound()) + if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always)) { - /// Single water meter - itemText = rsltItems[i].Print(mtr); - } - else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound) - { - Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); - Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux); - itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr); - } - else - { - continue; - } + string itemText; - /// Strip color information - string[] texts = itemText.Split(new char[] { '|' }); - if (texts.Length == 2) { itemText = texts[0]; } + if (!wm.Compound()) + { + /// Single water meter + itemText = rsltItems[i].Print(mtr); + } + else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound) + { + Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain); + Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux); + itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr); + } + else + { + continue; + } - int len = ElSpaces(itemText).Length; - if (len > columnWidths[i]) columnWidths[i] = len; + /// 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]; } @@ -286,7 +295,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic /// Write table data foreach (var mtr in wm.MeterTestRslts) { - if (mtr != null) + if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always)) { for (int i = 0; i < rsltItems.Count; i++) { diff --git a/TestBenchFramework/Screens/ResultsTabPageCtrl.cs b/TestBenchFramework/Screens/ResultsTabPageCtrl.cs index 10c6eb6a3..5578d2086 100644 --- a/TestBenchFramework/Screens/ResultsTabPageCtrl.cs +++ b/TestBenchFramework/Screens/ResultsTabPageCtrl.cs @@ -251,7 +251,11 @@ namespace TBF.Screens foreach (var mtr in wMtr.MeterTestRslts) { - if (mtr.TestDone) testNames.Add(mtr.Name()); + if (mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never) + && (mtr.Publish() != Config.Entities.Publish.Internal)) + { + testNames.Add(mtr.Name()); + } } return testNames; @@ -286,7 +290,8 @@ namespace TBF.Screens int ix = 0; foreach (var mtr in wMtr.MeterTestRslts) { - if (mtr.TestDone) + if (mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never) + && (mtr.Publish() != Config.Entities.Publish.Internal)) { ListViewItem lvi = new ListViewItem(testNames[ix++]); @@ -389,7 +394,8 @@ namespace TBF.Screens { foreach (var mtr in wMtr.MeterTestRslts) { - if (mtr.TestDone) + if (mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never) + && (mtr.Publish() != Config.Entities.Publish.Internal)) { string str = !item.CanPrintSingle ? string.Empty : item.Print(mtr);