diff --git a/Config/Config.csproj b/Config/Config.csproj
index db4401d1d..5a01252b0 100644
--- a/Config/Config.csproj
+++ b/Config/Config.csproj
@@ -78,12 +78,10 @@
-
-
@@ -101,11 +99,9 @@
-
-
diff --git a/Config/Entities/MeterTestResult.cs b/Config/Entities/MeterTestResult.cs
deleted file mode 100644
index bc12855db..000000000
--- a/Config/Entities/MeterTestResult.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-///
-/// Copyright (c) 2013-2015 Sensus Metering Systems
-///
-using System;
-
-namespace Config.Entities
-{
- public class MeterTestResult
- {
- public virtual int Id { get; protected set; }
- public virtual TestResult TestResult { get; set; } /// reference to the TestResult entity
-
- public virtual bool Disabled { get; set; } /// true = this meter was disabled and the results should be disregarded
- public virtual string SerialNr { get; set; }
- public virtual string EndState { get; set; }
- public virtual float VolumeStart { get; set; } /// liter
- public virtual float VolumeEnd { get; set; } /// liter
- public virtual float VolumeMeter { get; set; } /// liter
- public virtual float VolumeRef { get; set; } /// liter
- public virtual float VolumeErrorPct { get; set; } /// %
- public virtual float PulsesMeter { get; set; } /// # of pulses
- public virtual float PulsesPerLiter { get; set; } /// Pulses per liter
- public virtual float PulsesMaster { get; set; }
- public virtual float Time { get; set; } /// sec.
- public virtual float TimeStart { get; set; } /// sec. - Not mapped to DB !!!
- public virtual float TimeEnd { get; set; } /// sec. - Not mapped to DB !!!
- public virtual int CalibFactor { get; set; } /// iPerl calibration factor used during the test - Not mapped to DB !!!
- public virtual double Q2Correction { get; set; } /// iPerl Q2 correction used during the test - Not mapped to DB !!!
- public virtual bool Passed { get; set; } /// true=test passed - Not mapped to DB !!!
-
- public MeterTestResult()
- {
- PulsesPerLiter = 1.0f;
- }
-
- public MeterTestResult(TestResult testResult)
- : this()
- {
- TestResult = testResult;
- }
-
- public virtual MeterTestResult Clone(TestResult testResult)
- {
- MeterTestResult result = new MeterTestResult(testResult);
-
- result.Disabled = Disabled;
- result.SerialNr = SerialNr;
- result.EndState = EndState;
- result.VolumeStart = VolumeStart;
- result.VolumeEnd = VolumeEnd;
- result.VolumeMeter = VolumeMeter;
- result.VolumeRef = VolumeRef;
- result.VolumeErrorPct = VolumeErrorPct;
- result.PulsesMeter = PulsesMeter;
- result.PulsesPerLiter = PulsesPerLiter;
- result.PulsesMaster = PulsesMaster;
- result.Time = Time;
- result.TimeStart = TimeStart;
- result.TimeEnd = TimeEnd;
- result.CalibFactor = CalibFactor;
- result.Q2Correction = Q2Correction;
- result.Passed = Passed;
-
- return result;
- }
- }
-}
diff --git a/Config/Entities/TestResult.cs b/Config/Entities/TestResult.cs
deleted file mode 100644
index 895cad2f6..000000000
--- a/Config/Entities/TestResult.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-///
-/// Copyright (c) 2013-2015 Sensus Metering Systems
-///
-using System;
-using System.Collections.Generic;
-
-namespace Config.Entities
-{
- public class TestResult
- {
- public virtual int Id { get; protected set; }
- public virtual string Name { get; set; }
- public virtual int BatchNr { get; set; }
- public virtual string PurchaseOrder { get; set; }
- public virtual MetersKind MetersKind { get; set; }
- public virtual IList Meters { get; set; }
- public virtual IList CombinedMeters { get; set; }
-
- /// Value copied from the procedure (Entities.Procedure)
- public virtual string ProcedureName { get; set; }
- public virtual string ProtocolTitle { get; set; }
-
- /// Values copied from the test (Entities.Test)
- public virtual int TestId { get; set; } /// Test entity ID to distinguish between tests with the same name
- public virtual string TestName { get; set; }
- public virtual int Part { get; set; }
- public virtual bool DoNotEvaluate { get; set; } /// Not mapped to the database
- public virtual bool DoNotPublish { get; set; } /// Not mapped to the database
- public virtual float Qfrom { get; set; } /// [m3/h] Water flow low limit
- public virtual float Qto { get; set; } /// [m3/h] Water flow high limit
- public virtual float Volume { get; set; } /// [l] Target test volume
- public virtual float TstTime { get; set; } /// [s] Test time estimate
- public virtual int Repeats { get; set; }
- public virtual bool Emptying { get; set; }
- public virtual bool Zeroing { get; set; }
- public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
- public virtual int Time2MassMsrmt { get; set; }
- public virtual string Method { get; set; }
- public virtual float ErrLimLo { get; set; } /// [%] Lower error limit (usually < 0)
- public virtual float ErrLimHi { get; set; } /// [%] Upper error limit (usually > 0)
- public virtual float Uncertainty { get; set; } /// [%] Makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
-
- /// To be replaced by the virtual bench component parameters
- public virtual string FeedingPath { get; set; }
- public virtual string BenchPath { get; set; }
- public virtual string OutputPath { get; set; }
- public virtual string MetersPath { get; set; }
-
- /// Results
- public virtual DateTime TimeStart { get; set; } /// Date and time of the test start
- public virtual DateTime TimeEnd { get; set; } /// Date and time of the test end
- public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
- public virtual float AmbientTempAve { get; set; } /// [deg.C] Average ambient air temperature
- public virtual float AmbientPressAve { get; set; } /// Average ambient air pressure
- public virtual float AmbientHumiAve { get; set; } /// [%] Average ambient air relative humidity
- public virtual float PressInAvrg { get; set; } /// [Bar] Input water pressure (average)
- public virtual float PressInStart { get; set; } /// [Bar]
- public virtual float PressInEnd { get; set; } /// [Bar]
- public virtual float PressOutAvrg { get; set; } /// [Bar]
- public virtual float PressOutStart { get; set; } /// [Bar]
- public virtual float PressOutEnd { get; set; } /// [Bar]
- public virtual float TempInAvrg { get; set; } /// [deg.C]
- public virtual float TempInStart { get; set; } /// [deg.C]
- public virtual float TempInEnd { get; set; } /// [deg.C]
- public virtual float TempOutAvrg { get; set; } /// [deg.C]
- public virtual float TempOutStart { get; set; } /// [deg.C]
- public virtual float TempOutEnd { get; set; } /// [deg.C]
- public virtual float TempDivAvrg { get; set; } /// [deg.C]
- public virtual float TempDivStart { get; set; } /// [deg.C]
- public virtual float TempDivEnd { get; set; } /// [deg.C]
- public virtual float MassStartRaw { get; set; } /// [kg]
- public virtual float MassStart { get; set; } /// [kg]
- public virtual float MassEndRaw { get; set; } /// [kg]
- public virtual float MassEnd { get; set; } /// [kg]
- public virtual float MassDiff { get; set; } /// [kg]
- public virtual float DensityIn { get; set; } /// [kg/m3]
- public virtual float DensityOut { get; set; } /// [kg/m3]
- public virtual float DensityDiv { get; set; } /// [kg/m3]
- public virtual float Buoyancy { get; set; } ///TODO -> map
- public virtual float FlowMass { get; set; } /// [kg/h] calculated from conventional true value
- public virtual float FlowVolume { get; set; } /// [l/h] calculated from conventional true value
- public virtual float VolumeCTV { get; set; } /// [l] Volume conventional true value
- public virtual float VolumeMaster { get; set; } /// [l] Volume from the master flow meter
- public virtual float Time { get; set; } /// [s] Measurement time in seconds
- public virtual float ErrorMaster { get; set; } /// [%]
- public virtual float PulsesMaster { get; set; }
- public virtual float ConstMaster { get; set; } /// [pls/l] Pulses per liter master flow meter
- public virtual float QRise { get; set; } /// Detected Q_rise of a composed meter
- public virtual float QFall { get; set; } /// Detected Q_fall of a composed meter
- public virtual float TimeDivStart0 { get; set; }
- public virtual float TimeDivStart1 { get; set; }
- public virtual float TimeDivStart2 { get; set; }
- public virtual float TimeDivStart3 { get; set; }
- public virtual float TimeDivStart4 { get; set; }
- public virtual float TimeDivStart5 { get; set; }
- public virtual float TimeDivEnd0 { get; set; }
- public virtual float TimeDivEnd1 { get; set; }
- public virtual float TimeDivEnd2 { get; set; }
- public virtual float TimeDivEnd3 { get; set; }
- public virtual float TimeDivEnd4 { get; set; }
- public virtual float TimeDivEnd5 { get; set; }
-
- public TestResult()
- {
- Meters = new List();
- CombinedMeters = new List();
- }
-
- public TestResult(MetersKind kind)
- : this()
- {
- MetersKind = kind;
-
- if (kind == MetersKind.Single)
- {
- for (int i = 0; i < Config.Data.WMsCount; i++) Meters.Add(new MeterTestResult(this));
- }
- else if (kind == MetersKind.Combined)
- {
- for (int i = 0; i < 2 * Config.Data.CompoundWMsCount; i++) Meters.Add(new MeterTestResult(this));
- for (int i = 0; i < Config.Data.CompoundWMsCount; i++) CombinedMeters.Add(new MeterTestResult(this));
- }
- else if (kind == MetersKind.HeatMeter)
- {
- /// TODO: Verify if this is OK
- for (int i = 0; i < Config.Data.WMsCount; i++) Meters.Add(new MeterTestResult(this));
- }
- }
-
- public TestResult(Test test, int repetitionNr, MetersKind kind)
- : this(kind)
- {
- if (test.Repeats == 1)
- {
- Name = test.Name;
- }
- else
- {
- Name = string.Format("{0} ({1}/{2})", test.Name, repetitionNr, test.Repeats);
- }
- RepetitionNr = repetitionNr;
-
- /// Copy test parameters from Entities.Procedure object
- ProcedureName = test.Procedure.Name;
- ProtocolTitle = test.Procedure.ProtocolTitle;
-
- /// Copy test parameters from Entities.Test object
- TestId = test.Id;
- TestName = test.Name;
- Part = test.Part;
- Qfrom = test.Qfrom;
- Qto = test.Qto;
- Volume = test.Volume;
- TstTime = test.TstTime;
- Repeats = test.Repeats;
- Emptying = test.Draining;
- Zeroing = test.Zeroing;
- PumpPower = PumpPower;
- Time2MassMsrmt = test.TimeStop2Mass;
- Method = test.Method;
- ErrLimLo = test.ErrLimLo;
- ErrLimHi = test.ErrLimHi;
- Uncertainty = test.Uncertainty;
-
- FeedingPath = test.FeedingPath;
- BenchPath = test.BenchPath;
- OutputPath = test.OutputPath;
- MetersPath = test.MetersPath;
- }
-
- public override string ToString()
- {
- return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", BatchNr, ProcedureName, TestName, TimeStart.ToShortDateString(), TimeStart.ToShortTimeString());
- }
- }
-}
diff --git a/Config/Mappings/MeterTestResultMap.cs b/Config/Mappings/MeterTestResultMap.cs
deleted file mode 100644
index 645976eb7..000000000
--- a/Config/Mappings/MeterTestResultMap.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-///
-/// Copyright (c) 2013-2015 Sensus Metering Systems
-///
-using FluentNHibernate.Mapping;
-using Config.Entities;
-
-namespace Config.Mappings
-{
- class MeterTestResultMap : ClassMap
- {
- public MeterTestResultMap()
- {
- Id(x => x.Id);
- References(x => x.TestResult);
- Map(x => x.Disabled);
- Map(x => x.SerialNr);
- Map(x => x.EndState);
- Map(x => x.VolumeStart);
- Map(x => x.VolumeEnd);
- Map(x => x.VolumeMeter);
- Map(x => x.VolumeRef);
- Map(x => x.VolumeErrorPct);
- Map(x => x.PulsesMeter);
- Map(x => x.PulsesPerLiter);
- Map(x => x.PulsesMaster);
- Map(x => x.Time);
- }
- }
-}
diff --git a/Config/Mappings/TestResultMap.cs b/Config/Mappings/TestResultMap.cs
deleted file mode 100644
index f249c651b..000000000
--- a/Config/Mappings/TestResultMap.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-///
-/// Copyright (c) 2013-2015 Sensus Metering Systems
-///
-using FluentNHibernate.Mapping;
-using Config.Entities;
-
-namespace Config.Mappings
-{
- class TestResultMap : ClassMap
- {
- public TestResultMap()
- {
- Id(x => x.Id);
- Map(x => x.Name);
- Map(x => x.BatchNr);
- Map(x => x.PurchaseOrder);
- Map(x => x.MetersKind);
- HasMany(x => x.Meters)
- .Cascade.All();
- HasMany(x => x.CombinedMeters)
- .Cascade.All();
-
- Map(x => x.ProcedureName);
- Map(x => x.ProtocolTitle);
-
- Map(x => x.TestId);
- Map(x => x.TestName);
- Map(x => x.Part);
- Map(x => x.Qfrom);
- Map(x => x.Qto);
- Map(x => x.Volume);
- Map(x => x.TstTime);
- Map(x => x.Repeats);
- Map(x => x.Emptying);
- Map(x => x.Zeroing);
- Map(x => x.PumpPower);
- Map(x => x.Time2MassMsrmt);
- Map(x => x.Method);
- Map(x => x.ErrLimLo);
- Map(x => x.ErrLimHi);
- Map(x => x.Uncertainty);
-
- Map(x => x.FeedingPath)
- .CustomType("StringClob")
- .CustomSqlType("varchar(4000)");
- Map(x => x.BenchPath)
- .CustomType("StringClob")
- .CustomSqlType("varchar(4000)");
- Map(x => x.OutputPath)
- .CustomType("StringClob")
- .CustomSqlType("varchar(4000)");
- Map(x => x.MetersPath)
- .CustomType("StringClob")
- .CustomSqlType("varchar(4000)");
-
- Map(x => x.TimeStart);
- Map(x => x.TimeEnd);
- Map(x => x.RepetitionNr);
- Map(x => x.AmbientTempAve);
- Map(x => x.AmbientPressAve);
- Map(x => x.AmbientHumiAve);
- Map(x => x.PressInAvrg);
- Map(x => x.PressInStart);
- Map(x => x.PressInEnd);
- Map(x => x.PressOutAvrg);
- Map(x => x.PressOutStart);
- Map(x => x.PressOutEnd);
- Map(x => x.TempInAvrg);
- Map(x => x.TempInStart);
- Map(x => x.TempInEnd);
- Map(x => x.TempOutAvrg);
- Map(x => x.TempOutStart);
- Map(x => x.TempOutEnd);
- Map(x => x.TempDivAvrg);
- Map(x => x.TempDivStart);
- Map(x => x.TempDivEnd);
- Map(x => x.MassStartRaw);
- Map(x => x.MassStart);
- Map(x => x.MassEndRaw);
- Map(x => x.MassEnd);
- Map(x => x.MassDiff);
- Map(x => x.DensityIn);
- Map(x => x.DensityOut);
- Map(x => x.DensityDiv);
- Map(x => x.FlowMass); /// from conventional true value
- Map(x => x.FlowVolume); /// from conventional true value
- Map(x => x.VolumeCTV); /// volume conventional true value
- Map(x => x.VolumeMaster); /// volume from the master flow meter
- Map(x => x.Time); /// measurement time in seconds
- Map(x => x.ErrorMaster);
- Map(x => x.PulsesMaster);
- Map(x => x.ConstMaster); /// Pulses per liter master flow meter
- Map(x => x.QRise);
- Map(x => x.QFall);
- Map(x => x.TimeDivStart0);
- Map(x => x.TimeDivStart1);
- Map(x => x.TimeDivStart2);
- Map(x => x.TimeDivStart3);
- Map(x => x.TimeDivStart4);
- Map(x => x.TimeDivStart5);
- Map(x => x.TimeDivEnd0);
- Map(x => x.TimeDivEnd1);
- Map(x => x.TimeDivEnd2);
- Map(x => x.TimeDivEnd3);
- Map(x => x.TimeDivEnd4);
- Map(x => x.TimeDivEnd5);
- }
- }
-}
diff --git a/TestBenchFramework/BenchControl/Current.cs b/TestBenchFramework/BenchControl/Current.cs
deleted file mode 100644
index bbdf19f28..000000000
--- a/TestBenchFramework/BenchControl/Current.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-///
-/// Copyright (c) 2013-2015 Sensus Metering Systems
-///
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Config.Entities;
-
-namespace TBF.BenchControl
-{
- ///
- /// This class keeps the current values used or measured by the test bench.
- ///
- public class Current
- {
- ///
- /// Procedure, Tests and TestResults data
- ///
- public static Procedure Procedure;
-
- public static Test Test;
- public static int TestId = 0;
-
- public static TestResult TestResult;
- public static int TestResultId = 0;
-
- ///
- /// Measured data
- ///
- public static double StartMass;
- public static double StopMass;
-
- static Current()
- {
- }
-
- /// Constructor
- public Current()
- {
- /// There should always be some raw data
- }
-
- ///
- /// Processes current 'tick' data during measurement.
- ///
- public static void ProcessTickData()
- {
- }
- }
-}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/MyPrintDocument.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/MyPrintDocument.cs
deleted file mode 100644
index 399a87474..000000000
--- a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/MyPrintDocument.cs
+++ /dev/null
@@ -1,444 +0,0 @@
-///
-/// Copyright (c) 2015 Sensus Metering Systems
-///
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Printing;
-using System.IO;
-using Config.Entities;
-using TBF.Resources;
-
-namespace TBF.BenchControl.ResultsPrinters.Zapiska
-{
- public class MyPrintDocument : PrintDocument
- {
- const string FontFamilyName = "Arial"; //"Times New Roman";
-
- const int SpacingOne = 18;
- const int Padding = 10;
- const int TitleX = 100;
- const int TitleY = 160;
- int HdrTop = 220; /// Depends on the size of the title
- int TableTopFirstPage = 390; /// Depends on the size of the header
- int TableTopNextPage = TitleY;
-
- const int SpacingOneAndHalf = (3 * SpacingOne) / 2;
-
- ///
- /// Property variable for the Font the user wishes to use
- ///
- Font font;
- Font boldFont;
- Font titleFont;
-
- ///
- /// Data to print
- ///
- readonly Procedure procedure;
- readonly IList allResults;
- readonly string tester;
- readonly DateTime dateTime;
- readonly int batchMin;
- readonly int batchMax;
-
- ///
- /// Items to print
- ///
- readonly IList testNames;
- readonly int testsPerMeter;
- readonly IList resultItems;
-
- ///
- /// Data to print
- ///
- readonly int maxNrRows;
- readonly int nrRows;
- readonly int nrColumns;
- string[,] dataToPrint;
-
- ///
- /// Layout and status
- ///
- int nrTabLinesOnFirstPage;
- int nrTabLinesOnNextPage;
- int nextTableRow; /// nr. of table row to be printed as the first one on the next page
- int nrPages;
- int pageNr; /// Page number to be printed at the bottom of the page
-
-
- ///
- /// Constructor.
- /// Precalculates some values and dimensions and stores strings for the table
- /// to be printed into a 2-dimensional array of strings 'dataToprint'.
- ///
- /// Procedure belonging to the results
- /// Results to be printed (multiple batches)
- public MyPrintDocument(Results.Entities.Batch batch)
- {
- //this.procedure = procedure;
- //this.allResults = allResults;
- //this.tester = tester;
-
- dateTime = DateTime.Now;
-
- batchMin = int.MaxValue;
- batchMax = int.MinValue;
- foreach (var tr in allResults)
- {
- if (tr.BatchNr < batchMin) batchMin = tr.BatchNr;
- if (tr.BatchNr > batchMax) batchMax = tr.BatchNr;
- }
-
- resultItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
-
- testNames = Utils.GetDecoratedTestNames(procedure, 1);
- testsPerMeter = testNames.Count;
-
- maxNrRows = (batchMax - batchMin + 1) * Config.Data.WMsCount;
- nrColumns = testsPerMeter * resultItems.Count + 2;
-
- ///
- /// Prepare raw data to print
- ///
- dataToPrint = new string[maxNrRows, nrColumns];
- nrRows = 0;
- for (int i = batchMin; i <= batchMax; i++)
- {
- /// Collect all results belonging to one batch
- IList unsortedResults = new List();
- foreach (var tr in allResults) if (tr.BatchNr == i) unsortedResults.Add(tr);
-
- if (unsortedResults.Count == 0) continue;
-
- for (int wmNr = 0; wmNr < Config.Data.WMsCount; wmNr++) /// wmNr is 0-based
- {
- if (!unsortedResults[0].Meters[wmNr].Disabled)
- {
- dataToPrint[nrRows, 0] = (nrRows + 1).ToString();
- dataToPrint[nrRows, 1] = unsortedResults[0].Meters[wmNr].SerialNr;
-
- IList results =
- Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr + 1, false));
-
- for (int j = 0; j < testsPerMeter; j++)
- {
- if (results[j] != null)
- {
- int k = 2 + j * resultItems.Count;
- foreach (var item in resultItems)
- {
- ///TODO
- //string str = item.Print(results[j].Meters[wmNr]);
- //int pos = str.IndexOf('|');
- //dataToPrint[nrRows, k++] = (pos < 0) ? str : str.Substring(0, pos);
- }
- }
- }
-
- nrRows++;
- }
- }
- }
-
- pageNr = 1;
- nextTableRow = 0;
- }
-
- ///
- /// Override the default onbeginPrint method of the PrintDocument Object
- ///
- ///
- ///
- protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
- {
- base.OnBeginPrint(e);
-
- if (font == null) { font = new Font(FontFamilyName, 10, FontStyle.Regular); }
- if (boldFont == null) { boldFont = new Font(FontFamilyName, 10, FontStyle.Bold); }
- if (titleFont == null) { titleFont = new Font(FontFamilyName, 18, FontStyle.Bold); }
- }
-
- ///
- /// Override the default OnPrintPage method of the PrintDocument.
- ///
- ///
- /// This provides the print logic for our document
- protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
- {
- /// Run base code
- base.OnPrintPage(e);
-
- /// Set print area size and margins (in dots using 80 dpi)
- int printHeight = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
- int printWidth = base.DefaultPageSettings.PaperSize.Width - base.DefaultPageSettings.Margins.Left - base.DefaultPageSettings.Margins.Right;
- int leftMargin = base.DefaultPageSettings.Margins.Left; /// X
- int topMargin = base.DefaultPageSettings.Margins.Top; /// Y
-
- if (base.DefaultPageSettings.Landscape)
- {
- /// Landscape mode: we need to swap height/width parameters
- int tmp = printHeight;
- printHeight = printWidth;
- printWidth = tmp;
-
- if (File.Exists("C:\\TBF\\header-landscape.png"))
- {
- Image img = Image.FromFile("C:\\TBF\\header-landscape.png");
- e.Graphics.DrawImage(new Bitmap(img), new Rectangle(0, 0, 1169, 827));
- }
- }
- else
- {
- if (File.Exists("C:\\TBF\\header-portrait.png"))
- {
- Image img = Image.FromFile("C:\\TBF\\header-portrait.png");
- e.Graphics.DrawImage(new Bitmap(img), new Rectangle(0, 0, 827, 1169));
- }
- }
-
- ///---------------
- /// Common info
- ///---------------
- if (pageNr == 1)
- {
- if (!string.IsNullOrEmpty(allResults[0].ProtocolTitle))
- {
- RectangleF printArea = new RectangleF(TitleX, TitleY, 667, 40);
- e.Graphics.DrawString(allResults[0].ProtocolTitle, titleFont, Brushes.Black, printArea);
- }
- else
- {
- TableTopFirstPage -= (HdrTop - TitleY);
- HdrTop = TitleY;
- }
-
- string[] leftColumn = new string[]
- {
- Strings.Purchase_order + ": ",
- Strings.Date_and_time + ": ",
- Strings.Procedure + ": ",
- Strings.Tester + ": ",
- Strings.Approval + ": ",
- Strings.Ambient_temperature + ": ",
- Strings.Ambient_pressure + ": ",
- Strings.Ambient_humidity + ": ",
- };
-
- string[] rightColumn = new string[]
- {
- allResults[0].PurchaseOrder,
- string.Format("{0:dd.MM.yyyy HH:mm}", dateTime),
- procedure.Name,
- tester,
- string.Empty,
- allResults[0].AmbientTempAve.ToString("F1") + " °C",
- Config.Units.ConvertTo(Config.Unit.mbar, allResults[0].AmbientPressAve).ToString("F0") + " mbar",
- allResults[0].AmbientHumiAve.ToString("F0") + " %",
- };
-
- /// Determine max. left column width in characters
- float maxWdth = 0;
- foreach (var s in leftColumn)
- {
- float wdth = e.Graphics.MeasureString(s, font).Width;
- if (wdth > maxWdth) maxWdth = wdth;
- }
-
- /// Write aligned columns
- for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
- {
- PrintAt(e, 100, HdrTop + SpacingOne * i, leftColumn[i]);
- PrintAt(e, 100 + (int)maxWdth + 20, HdrTop + SpacingOne * i, rightColumn[i]);
- }
- }
-
- ///----------------
- /// More pages ?
- ///----------------
- if (pageNr == 1)
- {
- /// Determine the number of pages once
- nrTabLinesOnFirstPage = (topMargin + printHeight - TableTopFirstPage - 70) / SpacingOne;
- nrTabLinesOnNextPage = (topMargin + printHeight - TableTopNextPage - 70) / SpacingOne;
- nrTabLinesOnNextPage = Math.Max(1, nrTabLinesOnNextPage); /// Prevent division by zero
-
- if (nrRows <= nrTabLinesOnFirstPage)
- {
- nrPages = 1;
- }
- else
- {
- nrPages = 1 + ((nrRows - nrTabLinesOnFirstPage) + nrTabLinesOnNextPage - 1) / nrTabLinesOnNextPage;
- }
- }
- int nrTabLinesOnThisPage = (pageNr == 1) ? nrTabLinesOnFirstPage : nrTabLinesOnNextPage;
- int rowFrom = nextTableRow;
- int rowTo;
- if (nrRows <= nextTableRow + nrTabLinesOnThisPage)
- {
- rowTo = nrRows - 1;
- e.HasMorePages = false;
- }
- else
- {
- rowTo = rowFrom + nrTabLinesOnThisPage - 1;
- nextTableRow = rowFrom + nrTabLinesOnThisPage;
- e.HasMorePages = true;
- }
-
- ///--------
- /// Body
- ///--------
- int[] columnPos = GetColumnPositions(e, dataToPrint, rowFrom, rowTo, leftMargin + Padding, 2 * Padding);
- int tableLeft = leftMargin;
- int tableRight = columnPos[nrColumns] - Padding;
-
- int currentTableTop = (pageNr == 1) ? TableTopFirstPage : TableTopNextPage;
- int yyy = currentTableTop;
-
- /// Horizontal line
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeft, yyy), new Point(tableRight, yyy));
- yyy += 2;
-
- /// Line with test names (larger columns, names centered)
- for (int bigcol = 0; bigcol < testsPerMeter; bigcol++)
- {
- float width = e.Graphics.MeasureString(testNames[bigcol], font).Width;
- int bc = 2 + bigcol * resultItems.Count;
- int xxx = (columnPos[bc] + columnPos[bc + resultItems.Count]) / 2 - Padding - (int)(width / 2 + 0.5f);
- PrintAt(e, xxx, yyy, testNames[bigcol]);
- }
- yyy += SpacingOne;
-
- int tableTop2 = yyy;
-
- /// Indented horizontal line
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(columnPos[2] - Padding, yyy), new Point(tableRight, yyy));
- yyy += 2;
-
- /// Line with header texts
- PrintAt(e, columnPos[0], yyy - SpacingOne / 2, GetHeaderItem(0));
- PrintAt(e, columnPos[1], yyy - SpacingOne / 2, GetHeaderItem(1));
- for (int col = 2; col < nrColumns; col++)
- {
- PrintAt(e, columnPos[col], yyy, GetHeaderItem(col));
- }
- yyy += SpacingOne;
-
- /// Horizontal line
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeft, yyy), new Point(tableRight, yyy));
- yyy += 2;
-
- /// Table with results
- for (int row = rowFrom; row <= rowTo; row++)
- {
- for (int col = 0; col < nrColumns; col++)
- {
- PrintAt(e, columnPos[col], yyy, dataToPrint[row, col]);
- }
- yyy += SpacingOne;
- }
-
- /// Horizontal line
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeft, yyy), new Point(tableRight, yyy));
- int tableBottom = yyy;
-
- /// Vertical lines
- for (int col = 0; col <= nrColumns; col++)
- {
- if (col < 2 || ((col-2) % resultItems.Count) == 0)
- {
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(columnPos[col] - Padding, currentTableTop),
- new Point(columnPos[col] - Padding, tableBottom));
- }
- else
- {
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(columnPos[col] - Padding, tableTop2),
- new Point(columnPos[col] - Padding, tableBottom));
- }
- }
-
- ///----------
- /// Footer
- ///----------
- PrintAt(e, leftMargin, topMargin + printHeight - SpacingOne, string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages));
- }
-
- ///
- /// Returns header text for each column of the table.
- ///
- /// COlumn nymber (0-based)
- /// Header text
- string GetHeaderItem(int column)
- {
- switch (column)
- {
- case 0: return "Nr.";
- case 1: return "S/N";
- default: return resultItems[(column - 2) % resultItems.Count].ClmnHeaderText;
- }
- }
-
- ///
- /// Determine column widths and return column left positions for a subset of table rows
- ///
- /// string[nrRows, nrColumns]
- /// First row to consider
- /// Last row to consider
- /// Left column positions and right side float[nrColumns + 1]
- int[] GetColumnPositions(System.Drawing.Printing.PrintPageEventArgs e,
- string[,] dataToPrint, int rowFrom, int rowTo,
- int leftMargin, int padding)
- {
- int nrColumns = dataToPrint.GetLength(1);
- int[] columnPos = new int[nrColumns + 1];
- columnPos[0] = leftMargin;
-
- for (int column = 0; column < nrColumns; column++)
- {
- float columnWidth = e.Graphics.MeasureString(GetHeaderItem(column), font).Width;
-
- for (int row = rowFrom; row <= rowTo; row++)
- {
- float itemWidth = e.Graphics
- .MeasureString(dataToPrint[row, column] == null ? string.Empty : dataToPrint[row, column], font)
- .Width;
- if (itemWidth > columnWidth) columnWidth = itemWidth;
- }
-
- columnPos[column + 1] = columnPos[column] + (int)(columnWidth + 0.5f) + padding;
- }
-
- return columnPos;
- }
-
-
- void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
- {
- PrintAt(e, p.X, p.Y, text);
- }
-
- void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
- {
- RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
- e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
- }
-
- void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
- {
- PrintBoldAt(e, p.X, p.Y, text);
- }
-
- void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
- {
- RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
- e.Graphics.DrawString(text, this.boldFont, Brushes.Black, printArea);
- }
-
- private void InitializeComponent()
- {
-
- }
- }
-}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/Printer.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/Printer.cs
deleted file mode 100644
index 8c8b7b8d3..000000000
--- a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/Printer.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-///
-/// Copyright (c) 2015-2016 Sensus Metering Systems
-///
-using log4net;
-
-namespace TBF.BenchControl.ResultsPrinters.Zapiska
-{
- public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
- {
- private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
- public override string ToString() { return string.Format("ResultsPrinters.Basic({0})", Cfg.ToString(1)); }
-
- readonly PrinterCfg printerCfg;
-
- public bool SupressPrinting { get { return printerCfg.SupressPrinting; } }
-
-
- /// Data to print
- Results.Entities.Batch batch;
-
-
- public Printer() { }
-
-
- public Printer(Generic.IComponentCfg cfg)
- : base(cfg)
- {
- printerCfg = cfg as PrinterCfg;
- log.Debug(this.ToString());
- }
-
- ///
- /// Prints the test cycle results, Events: Event.ResultsPrinted
- ///
- /// Batch results to print
- /// Reference to the operation
- public IOperation PrintResultsOp(Results.Entities.Batch batch)
- {
- this.batch = batch;
- return this;
- }
-
- /// Start this operation
- public void Start()
- {
- if (batch.WaterMeters.Count > 0)
- {
- new MyPrintDocument(batch).Print();
- }
- }
-
- /// Run this operation
- /// Event.ResultsPrinted
- public Event Run()
- {
- return Event.ResultsPrinted;
- }
-
- /// Stop this operation
- public void Stop()
- {
- }
- }
-}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfg.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfg.cs
deleted file mode 100644
index ed93ab578..000000000
--- a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfg.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-///
-/// Copyright (c) 2015-2016 Sensus Metering Systems
-///
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Xml.Serialization;
-using TBF.BenchControl.Generic;
-
-namespace TBF.BenchControl.ResultsPrinters.Zapiska
-{
- public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
- {
- public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); }
-
- ///
- /// Serialized parameters
- ///
- public bool SupressPrinting; /// Bypass printing when true
-
- /// Private parameterless constructor invoked by all other (public) constructors
- PrinterCfg()
- {
- Name = "Zapiska";
- ParentName = string.Empty;
- SupressPrinting = false;
- }
-
- public PrinterCfg(IComponentFactory factory)
- : this()
- {
- this.Factory = factory;
- }
-
- public string ToString(int i)
- {
- return string.Format("Name={0}, SupressPrinting={1}",
- Name,
- SupressPrinting ? "yes" : "no"
- );
- }
- }
-}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfgCtrl.Designer.cs
deleted file mode 100644
index dad0dd475..000000000
--- a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfgCtrl.Designer.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-///
-/// Copyright (c) 2015 Sensus Metering Systems
-///
-namespace TBF.BenchControl.ResultsPrinters.Zapiska
-{
- partial class PrinterCfgCtrl
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.nameTextBox = new System.Windows.Forms.TextBox();
- this.nameLabel = new System.Windows.Forms.Label();
- this.classNameLabel = new System.Windows.Forms.Label();
- this.supressPrintingCheckBox = new System.Windows.Forms.CheckBox();
- this.SuspendLayout();
- //
- // nameTextBox
- //
- this.nameTextBox.Enabled = false;
- this.nameTextBox.Location = new System.Drawing.Point(106, 57);
- this.nameTextBox.Name = "nameTextBox";
- this.nameTextBox.Size = new System.Drawing.Size(130, 20);
- this.nameTextBox.TabIndex = 5;
- //
- // nameLabel
- //
- this.nameLabel.AutoSize = true;
- this.nameLabel.Location = new System.Drawing.Point(34, 60);
- this.nameLabel.Name = "nameLabel";
- this.nameLabel.Size = new System.Drawing.Size(35, 13);
- this.nameLabel.TabIndex = 4;
- this.nameLabel.Text = "Name";
- //
- // classNameLabel
- //
- this.classNameLabel.AutoSize = true;
- this.classNameLabel.Location = new System.Drawing.Point(103, 33);
- this.classNameLabel.Name = "classNameLabel";
- this.classNameLabel.Size = new System.Drawing.Size(83, 13);
- this.classNameLabel.TabIndex = 3;
- this.classNameLabel.Text = "ComonentName";
- //
- // supressPrintingCheckBox
- //
- this.supressPrintingCheckBox.AutoSize = true;
- this.supressPrintingCheckBox.Enabled = false;
- this.supressPrintingCheckBox.Location = new System.Drawing.Point(106, 87);
- this.supressPrintingCheckBox.Name = "supressPrintingCheckBox";
- this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17);
- this.supressPrintingCheckBox.TabIndex = 12;
- this.supressPrintingCheckBox.Text = "Supress printing";
- this.supressPrintingCheckBox.UseVisualStyleBackColor = true;
- //
- // PrinterCfgCtrl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.supressPrintingCheckBox);
- this.Controls.Add(this.nameTextBox);
- this.Controls.Add(this.nameLabel);
- this.Controls.Add(this.classNameLabel);
- this.Name = "PrinterCfgCtrl";
- this.Size = new System.Drawing.Size(300, 200);
- this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.TextBox nameTextBox;
- private System.Windows.Forms.Label nameLabel;
- private System.Windows.Forms.Label classNameLabel;
- private System.Windows.Forms.CheckBox supressPrintingCheckBox;
- }
-}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfgCtrl.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfgCtrl.cs
deleted file mode 100644
index 2c417a87a..000000000
--- a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfgCtrl.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-///
-/// Copyright (c) 2015 Sensus Metering Systems
-///
-using System;
-using System.Windows.Forms;
-using log4net;
-using TBF.BenchControl.Generic;
-
-namespace TBF.BenchControl.ResultsPrinters.Zapiska
-{
- public partial class PrinterCfgCtrl : UserControl, IComponentCfgCtrl
- {
- static readonly ILog log = LogManager.GetLogger(typeof(PrinterCfgCtrl));
-
- public bool ShowMore { get { return false; } }
-
- PrinterCfg config;
- public IComponentCfg Config
- {
- get { return config as IComponentCfg; }
- set
- {
- config = value as PrinterCfg;
- Redraw();
- }
- }
-
- public PrinterCfgCtrl()
- {
- InitializeComponent();
- }
-
- private void PrinterCfgCtrl_Load(object sender, EventArgs e)
- {
- Redraw();
- }
-
- public void Closing()
- {
- }
-
- void Redraw()
- {
- if (config == null) return; /// Control was not loaded, settings were not changed
- classNameLabel.Text = config.Factory.ClassName;
- nameTextBox.Text = config.Name;
- supressPrintingCheckBox.Checked = config.SupressPrinting;
- }
-
- public void Unlock()
- {
- nameTextBox.Enabled = true;
- supressPrintingCheckBox.Enabled = true;
- }
-
- public CfgUpdateFlags VerifyCfg(ref string message)
- {
- CfgUpdateFlags flags = CfgUpdateFlags.None;
- return flags;
- }
-
- public CfgUpdateFlags UpdateCfg()
- {
- CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
-
- if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
-
- config.Name = nameTextBox.Text;
- config.SupressPrinting = supressPrintingCheckBox.Checked;
-
- return flags;
- }
- }
-}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfgCtrl.resx b/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfgCtrl.resx
deleted file mode 100644
index 1af7de150..000000000
--- a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterCfgCtrl.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterFactory.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterFactory.cs
deleted file mode 100644
index 7a48c4a92..000000000
--- a/TestBenchFramework/BenchControl/ResultsPrinters/Zapiska/PrinterFactory.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-///
-/// Copyright (c) 2015-2016 Sensus Metering Systems
-///
-using System.Collections.Generic;
-using TBF.BenchControl.Generic;
-
-namespace TBF.BenchControl.ResultsPrinters.Zapiska
-{
- public class PrinterFactory : IComponentFactory
- {
- public string ClassName { get { return "Zapiska"; } }
-
- public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
-
- public IComponent DummyComponent() { return new Printer(); }
-
- public IComponent GetComponent(IComponentCfg cfg, IList components) { return new Printer(cfg); }
-
- public IComponentCfg DefaultConfig() { return new PrinterCfg(this); }
-
- public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
- {
- return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this);
- }
- }
-}
diff --git a/TestBenchFramework/BenchControl/TbfComponents.cs b/TestBenchFramework/BenchControl/TbfComponents.cs
index 4b568cb7f..eb67d3bb3 100644
--- a/TestBenchFramework/BenchControl/TbfComponents.cs
+++ b/TestBenchFramework/BenchControl/TbfComponents.cs
@@ -113,7 +113,6 @@ namespace TBF.BenchControl
Factories.Add(new Elde.ValveEx.ValveFactory());
Factories.Add(new WaterMeters.Munich.WaterMeterFactory()); /// WaterMeter
Factories.Add(new WaterMeters.WaterMeter.WaterMeterFactory()); /// WaterMeter
- Factories.Add(new ResultsPrinters.Zapiska.PrinterFactory()); /// Zapiska
}
///
diff --git a/TestBenchFramework/MainWnd.cs b/TestBenchFramework/MainWnd.cs
index 0b9795bfb..9368e44f7 100644
--- a/TestBenchFramework/MainWnd.cs
+++ b/TestBenchFramework/MainWnd.cs
@@ -528,95 +528,95 @@ namespace TBF
private void printToolStripMenuItem_Click(object sender, EventArgs e)
{
- TBF.Forms.PrintOrderForm dlg = new TBF.Forms.PrintOrderForm();
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- string purchaseOrder = dlg.PurchaseOrder;
- string tester = dlg.Tester;
+ //TBF.Forms.PrintOrderForm dlg = new TBF.Forms.PrintOrderForm();
+ //if (dlg.ShowDialog() == DialogResult.OK)
+ //{
+ // string purchaseOrder = dlg.PurchaseOrder;
+ // string tester = dlg.Tester;
- NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
+ // NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
- IList testResults = session.QueryOver()
- .Where(x => (x.PurchaseOrder == purchaseOrder))
- .List();
+ // IList testResults = session.QueryOver()
+ // .Where(x => (x.PurchaseOrder == purchaseOrder))
+ // .List();
- if (testResults.Count == 0)
- {
- MessageBox.Show(Strings.No_results_to_print, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
+ // if (testResults.Count == 0)
+ // {
+ // MessageBox.Show(Strings.No_results_to_print, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ // return;
+ // }
- if (dlg.OnlyGoodResults)
- {
- /// Proceed from the end of the list so that items can be removed by index
- for (int i = testResults.Count - 1; i >= 0; i--)
- {
- // TODO: Complete
- }
- }
+ // if (dlg.OnlyGoodResults)
+ // {
+ // /// Proceed from the end of the list so that items can be removed by index
+ // for (int i = testResults.Count - 1; i >= 0; i--)
+ // {
+ // // TODO: Complete
+ // }
+ // }
- if (dlg.OnlyLastResult)
- {
- /// Remove test results if there exist a later test results for the same sn
- /// Proceed from the end of the list so that items can be removed by index
- for (int i = testResults.Count - 1; i >= 0; i--)
- {
- string name = testResults[i].Name;
- int batchNr = testResults[i].BatchNr;
- foreach (var tr in testResults)
- {
- if (tr.Name == name && tr.BatchNr > batchNr)
- {
- bool allWMsAreTheSame = true;
+ // if (dlg.OnlyLastResult)
+ // {
+ // /// Remove test results if there exist a later test results for the same sn
+ // /// Proceed from the end of the list so that items can be removed by index
+ // for (int i = testResults.Count - 1; i >= 0; i--)
+ // {
+ // string name = testResults[i].Name;
+ // int batchNr = testResults[i].BatchNr;
+ // foreach (var tr in testResults)
+ // {
+ // if (tr.Name == name && tr.BatchNr > batchNr)
+ // {
+ // bool allWMsAreTheSame = true;
- int cnt = Math.Min(testResults[i].Meters.Count, tr.Meters.Count);
- for (int j = 0; j < cnt; j++)
- {
- if (testResults[i].Meters[j].SerialNr != tr.Meters[j].SerialNr)
- {
- allWMsAreTheSame = false;
- break;
- }
- }
+ // int cnt = Math.Min(testResults[i].Meters.Count, tr.Meters.Count);
+ // for (int j = 0; j < cnt; j++)
+ // {
+ // if (testResults[i].Meters[j].SerialNr != tr.Meters[j].SerialNr)
+ // {
+ // allWMsAreTheSame = false;
+ // break;
+ // }
+ // }
- if (allWMsAreTheSame)
- {
- /// Remove as there exists a more recent measurement with the same meters
- testResults.RemoveAt(i);
- break;
- }
- }
- }
- }
- }
+ // if (allWMsAreTheSame)
+ // {
+ // /// Remove as there exists a more recent measurement with the same meters
+ // testResults.RemoveAt(i);
+ // break;
+ // }
+ // }
+ // }
+ // }
+ // }
- IList procedure = session.QueryOver()
- .Where(x => (x.ProcedureState == ProcedureState.Active))
- .And(x => (x.Name == testResults[0].ProcedureName))
- .List();
+ // IList procedure = session.QueryOver()
+ // .Where(x => (x.ProcedureState == ProcedureState.Active))
+ // .And(x => (x.Name == testResults[0].ProcedureName))
+ // .List();
- if (procedure.Count != 1)
- {
- MessageBox.Show(Strings.No_results_to_print, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
+ // if (procedure.Count != 1)
+ // {
+ // MessageBox.Show(Strings.No_results_to_print, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ // return;
+ // }
- if ((testResults != null) && (testResults.Count != 0) && (testResults[0].MetersKind == MetersKind.Single))
- {
- PrintOrderDocument doc = new PrintOrderDocument(procedure[0], testResults, tester);
- doc.DefaultPageSettings.Landscape = true;
- doc.Print();
- }
- else if((testResults != null) && (testResults.Count != 0) && (testResults[0].MetersKind == MetersKind.Combined))
- {
- /// Do nothing right now
- }
- else
- {
- MessageBox.Show(Strings.No_results_to_print, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- }
+ // if ((testResults != null) && (testResults.Count != 0) && (testResults[0].MetersKind == MetersKind.Single))
+ // {
+ // PrintOrderDocument doc = new PrintOrderDocument(procedure[0], testResults, tester);
+ // doc.DefaultPageSettings.Landscape = true;
+ // doc.Print();
+ // }
+ // else if((testResults != null) && (testResults.Count != 0) && (testResults[0].MetersKind == MetersKind.Combined))
+ // {
+ // /// Do nothing right now
+ // }
+ // else
+ // {
+ // MessageBox.Show(Strings.No_results_to_print, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ // return;
+ // }
+ //}
}
private void upgradeTSMenuItem_Click(object sender, EventArgs e)
diff --git a/TestBenchFramework/PrintOrderDocument.cs b/TestBenchFramework/PrintOrderDocument.cs
deleted file mode 100644
index 0b8ab3a79..000000000
--- a/TestBenchFramework/PrintOrderDocument.cs
+++ /dev/null
@@ -1,443 +0,0 @@
-///
-/// Copyright (c) 2013-2015 Sensus Metering Systems
-///
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Printing;
-using System.IO;
-using Config.Entities;
-using TBF.Resources;
-
-namespace TBF
-{
- public class PrintOrderDocument : PrintDocument
- {
- const string FontFamilyName = "Arial"; //"Times New Roman";
-
- const int SpacingOne = 18;
- const int Padding = 10;
- const int TitleX = 100;
- const int TitleY = 160;
- int HdrTop = 220; /// Depends on the size of the title
- int TableTopFirstPage = 390; /// Depends on the size of the header
- int TableTopNextPage = TitleY;
-
- const int SpacingOneAndHalf = (3 * SpacingOne) / 2;
-
- ///
- /// Property variable for the Font the user wishes to use
- ///
- Font font;
- Font boldFont;
- Font titleFont;
-
- ///
- /// Data to print
- ///
- readonly Procedure procedure;
- readonly IList allResults;
- readonly string tester;
- readonly DateTime dateTime;
- readonly int batchMin;
- readonly int batchMax;
-
- ///
- /// Items to print
- ///
- readonly IList testNames;
- readonly int testsPerMeter;
- readonly IList resultItems;
-
- ///
- /// Data to print
- ///
- readonly int maxNrRows;
- readonly int nrRows;
- readonly int nrColumns;
- string[,] dataToPrint;
-
- ///
- /// Layout and status
- ///
- int nrTabLinesOnFirstPage;
- int nrTabLinesOnNextPage;
- int nextTableRow; /// nr. of table row to be printed as the first one on the next page
- int nrPages;
- int pageNr; /// Page number to be printed at the bottom of the page
-
-
- ///
- /// Constructor.
- /// Precalculates some values and dimensions and stores strings for the table
- /// to be printed into a 2-dimensional array of strings 'dataToprint'.
- ///
- /// Procedure belonging to the results
- /// Results to be printed (multiple batches)
- public PrintOrderDocument(Procedure procedure, IList allResults, string tester)
- {
- this.procedure = procedure;
- this.allResults = allResults;
- this.tester = tester;
-
- dateTime = DateTime.Now;
-
- batchMin = int.MaxValue;
- batchMax = int.MinValue;
- foreach (var tr in allResults)
- {
- if (tr.BatchNr < batchMin) batchMin = tr.BatchNr;
- if (tr.BatchNr > batchMax) batchMax = tr.BatchNr;
- }
-
- resultItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
-
- testNames = Utils.GetDecoratedTestNames(procedure, 1);
- testsPerMeter = testNames.Count;
-
- maxNrRows = (batchMax - batchMin + 1) * Config.Data.WMsCount;
- nrColumns = testsPerMeter * resultItems.Count + 2;
-
- ///
- /// Prepare raw data to print
- ///
- dataToPrint = new string[maxNrRows, nrColumns];
- nrRows = 0;
- for (int i = batchMin; i <= batchMax; i++)
- {
- /// Collect all results belonging to one batch
- IList unsortedResults = new List();
- foreach (var tr in allResults) if (tr.BatchNr == i) unsortedResults.Add(tr);
-
- if (unsortedResults.Count == 0) continue;
-
- for (int wmNr = 0; wmNr < Config.Data.WMsCount; wmNr++) /// wmNr is 0-based
- {
- if (!unsortedResults[0].Meters[wmNr].Disabled)
- {
- dataToPrint[nrRows, 0] = (nrRows + 1).ToString();
- dataToPrint[nrRows, 1] = unsortedResults[0].Meters[wmNr].SerialNr;
-
- IList results =
- Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr + 1, false));
-
- for (int j = 0; j < testsPerMeter; j++)
- {
- if (results[j] != null)
- {
- int k = 2 + j * resultItems.Count;
- foreach (var item in resultItems)
- {
- ///TODO
- //string str = item.Print(results[j].Meters[wmNr]);
- //int pos = str.IndexOf('|');
- //dataToPrint[nrRows, k++] = (pos < 0) ? str : str.Substring(0, pos);
- }
- }
- }
-
- nrRows++;
- }
- }
- }
-
- pageNr = 1;
- nextTableRow = 0;
- }
-
- ///
- /// Override the default onbeginPrint method of the PrintDocument Object
- ///
- ///
- ///
- protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
- {
- base.OnBeginPrint(e);
-
- if (font == null) { font = new Font(FontFamilyName, 10, FontStyle.Regular); }
- if (boldFont == null) { boldFont = new Font(FontFamilyName, 10, FontStyle.Bold); }
- if (titleFont == null) { titleFont = new Font(FontFamilyName, 18, FontStyle.Bold); }
- }
-
- ///
- /// Override the default OnPrintPage method of the PrintDocument.
- ///
- ///
- /// This provides the print logic for our document
- protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
- {
- /// Run base code
- base.OnPrintPage(e);
-
- /// Set print area size and margins (in dots using 80 dpi)
- int printHeight = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
- int printWidth = base.DefaultPageSettings.PaperSize.Width - base.DefaultPageSettings.Margins.Left - base.DefaultPageSettings.Margins.Right;
- int leftMargin = base.DefaultPageSettings.Margins.Left; /// X
- int topMargin = base.DefaultPageSettings.Margins.Top; /// Y
-
- if (base.DefaultPageSettings.Landscape)
- {
- /// Landscape mode: we need to swap height/width parameters
- int tmp = printHeight;
- printHeight = printWidth;
- printWidth = tmp;
-
- if (File.Exists("C:\\TBF\\header-landscape.png"))
- {
- Image img = Image.FromFile("C:\\TBF\\header-landscape.png");
- e.Graphics.DrawImage(new Bitmap(img), new Rectangle(0, 0, 1169, 827));
- }
- }
- else
- {
- if (File.Exists("C:\\TBF\\header-portrait.png"))
- {
- Image img = Image.FromFile("C:\\TBF\\header-portrait.png");
- e.Graphics.DrawImage(new Bitmap(img), new Rectangle(0, 0, 827, 1169));
- }
- }
-
- ///---------------
- /// Common info
- ///---------------
- if (pageNr == 1)
- {
- if (!string.IsNullOrEmpty(allResults[0].ProtocolTitle))
- {
- RectangleF printArea = new RectangleF(TitleX, TitleY, 667, 40);
- e.Graphics.DrawString(allResults[0].ProtocolTitle, titleFont, Brushes.Black, printArea);
- }
- else
- {
- TableTopFirstPage -= (HdrTop - TitleY);
- HdrTop = TitleY;
- }
-
- string[] leftColumn = new string[]
- {
- Strings.Purchase_order + ": ",
- Strings.Date_and_time + ": ",
- Strings.Procedure + ": ",
- Strings.Tester + ": ",
- Strings.Approval + ": ",
- Strings.Ambient_temperature + ": ",
- Strings.Ambient_pressure + ": ",
- Strings.Ambient_humidity + ": ",
- };
-
- string[] rightColumn = new string[]
- {
- allResults[0].PurchaseOrder,
- string.Format("{0:yyyy.MM.dd HH:mm}", dateTime),
- procedure.Name,
- tester,
- string.Empty,
- allResults[0].AmbientTempAve.ToString("F1") + " °C",
- allResults[0].AmbientPressAve.ToString("F0") + " mbar",
- allResults[0].AmbientHumiAve.ToString("F0") + " %",
- };
-
- /// Determine max. left column width in characters
- float maxWdth = 0;
- foreach (var s in leftColumn)
- {
- float wdth = e.Graphics.MeasureString(s, font).Width;
- if (wdth > maxWdth) maxWdth = wdth;
- }
-
- /// Write aligned columns
- for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
- {
- PrintAt(e, 100, HdrTop + SpacingOne * i, leftColumn[i]);
- PrintAt(e, 100 + (int)maxWdth + 20, HdrTop + SpacingOne * i, rightColumn[i]);
- }
- }
-
- ///----------------
- /// More pages ?
- ///----------------
- if (pageNr == 1)
- {
- /// Determine the number of pages once
- nrTabLinesOnNextPage = (topMargin + printHeight - TableTopNextPage - 70) / SpacingOne;
- nrTabLinesOnFirstPage = (topMargin + printHeight - TableTopFirstPage - 70) / SpacingOne;
-
- if (nrRows <= nrTabLinesOnFirstPage)
- {
- nrPages = 1;
- }
- else
- {
- nrPages = 1 + ((nrRows - nrTabLinesOnFirstPage) + nrTabLinesOnNextPage - 1) / nrTabLinesOnNextPage;
- }
- }
- int nrTabLinesOnThisPage = (pageNr == 1) ? nrTabLinesOnFirstPage : nrTabLinesOnNextPage;
- int rowFrom = nextTableRow;
- int rowTo;
- if (nrRows <= nextTableRow + nrTabLinesOnThisPage)
- {
- rowTo = nrRows - 1;
- e.HasMorePages = false;
- }
- else
- {
- rowTo = rowFrom + nrTabLinesOnThisPage - 1;
- nextTableRow = rowFrom + nrTabLinesOnThisPage;
- e.HasMorePages = true;
- }
-
- ///--------
- /// Body
- ///--------
- int[] columnPos = GetColumnPositions(e, dataToPrint, rowFrom, rowTo, leftMargin + Padding, 2 * Padding);
- int tableLeft = leftMargin;
- int tableRight = columnPos[nrColumns] - Padding;
-
- int currentTableTop = (pageNr == 1) ? TableTopFirstPage : TableTopNextPage;
- int yyy = currentTableTop;
-
- /// Horizontal line
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeft, yyy), new Point(tableRight, yyy));
- yyy += 2;
-
- /// Line with test names (larger columns, names centered)
- for (int bigcol = 0; bigcol < testsPerMeter; bigcol++)
- {
- float width = e.Graphics.MeasureString(testNames[bigcol], font).Width;
- int bc = 2 + bigcol * resultItems.Count;
- int xxx = (columnPos[bc] + columnPos[bc + resultItems.Count]) / 2 - Padding - (int)(width / 2 + 0.5f);
- PrintAt(e, xxx, yyy, testNames[bigcol]);
- }
- yyy += SpacingOne;
-
- int tableTop2 = yyy;
-
- /// Indented horizontal line
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(columnPos[2] - Padding, yyy), new Point(tableRight, yyy));
- yyy += 2;
-
- /// Line with header texts
- PrintAt(e, columnPos[0], yyy - SpacingOne / 2, GetHeaderItem(0));
- PrintAt(e, columnPos[1], yyy - SpacingOne / 2, GetHeaderItem(1));
- for (int col = 2; col < nrColumns; col++)
- {
- PrintAt(e, columnPos[col], yyy, GetHeaderItem(col));
- }
- yyy += SpacingOne;
-
- /// Horizontal line
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeft, yyy), new Point(tableRight, yyy));
- yyy += 2;
-
- /// Table with results
- for (int row = rowFrom; row <= rowTo; row++)
- {
- for (int col = 0; col < nrColumns; col++)
- {
- PrintAt(e, columnPos[col], yyy, dataToPrint[row, col]);
- }
- yyy += SpacingOne;
- }
-
- /// Horizontal line
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeft, yyy), new Point(tableRight, yyy));
- int tableBottom = yyy;
-
- /// Vertical lines
- for (int col = 0; col <= nrColumns; col++)
- {
- if (col < 2 || ((col-2) % resultItems.Count) == 0)
- {
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(columnPos[col] - Padding, currentTableTop),
- new Point(columnPos[col] - Padding, tableBottom));
- }
- else
- {
- e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(columnPos[col] - Padding, tableTop2),
- new Point(columnPos[col] - Padding, tableBottom));
- }
- }
-
- ///----------
- /// Footer
- ///----------
- PrintAt(e, leftMargin, topMargin + printHeight - SpacingOne, string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages));
- }
-
- ///
- /// Returns header text for each column of the table.
- ///
- /// COlumn nymber (0-based)
- /// Header text
- string GetHeaderItem(int column)
- {
- switch (column)
- {
- case 0: return "Nr.";
- case 1: return "S/N";
- default: return resultItems[(column - 2) % resultItems.Count].ClmnHeaderText;
- }
- }
-
- ///
- /// Determine column widths and return column left positions for a subset of table rows
- ///
- /// string[nrRows, nrColumns]
- /// First row to consider
- /// Last row to consider
- /// Left column positions and right side float[nrColumns + 1]
- int[] GetColumnPositions(System.Drawing.Printing.PrintPageEventArgs e,
- string[,] dataToPrint, int rowFrom, int rowTo,
- int leftMargin, int padding)
- {
- int nrColumns = dataToPrint.GetLength(1);
- int[] columnPos = new int[nrColumns + 1];
- columnPos[0] = leftMargin;
-
- for (int column = 0; column < nrColumns; column++)
- {
- float columnWidth = e.Graphics.MeasureString(GetHeaderItem(column), font).Width;
-
- for (int row = rowFrom; row <= rowTo; row++)
- {
- float itemWidth = e.Graphics
- .MeasureString(dataToPrint[row, column] == null ? string.Empty : dataToPrint[row, column], font)
- .Width;
- if (itemWidth > columnWidth) columnWidth = itemWidth;
- }
-
- columnPos[column + 1] = columnPos[column] + (int)(columnWidth + 0.5f) + padding;
- }
-
- return columnPos;
- }
-
-
- void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
- {
- PrintAt(e, p.X, p.Y, text);
- }
-
- void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
- {
- RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
- e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
- }
-
- void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
- {
- PrintBoldAt(e, p.X, p.Y, text);
- }
-
- void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
- {
- RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
- e.Graphics.DrawString(text, this.boldFont, Brushes.Black, printArea);
- }
-
- private void InitializeComponent()
- {
-
- }
- }
-}
diff --git a/TestBenchFramework/PrintOrderDocument.resx b/TestBenchFramework/PrintOrderDocument.resx
deleted file mode 100644
index a825336ee..000000000
--- a/TestBenchFramework/PrintOrderDocument.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- zh-CN
-
-
- True
-
-
- False
-
-
\ No newline at end of file
diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj
index 121e1b9fa..299c008ac 100644
--- a/TestBenchFramework/TBF.csproj
+++ b/TestBenchFramework/TBF.csproj
@@ -707,18 +707,6 @@
PrinterCfgCtrl.cs
-
- Component
-
-
-
-
- UserControl
-
-
- PrinterCfgCtrl.cs
-
-
@@ -923,9 +911,6 @@
UpgradeSelectionDlg.cs
-
- Component
-
@@ -1375,7 +1360,6 @@
-
@@ -2021,9 +2005,6 @@
PrinterCfgCtrl.cs
-
- PrinterCfgCtrl.cs
-
WriterCfgCtrl.cs
@@ -2165,9 +2146,6 @@
PreferencesDlg.cs
-
- PrintOrderDocument.cs
-
ProcedureDlg.cs
diff --git a/TestBenchFramework/Utils.cs b/TestBenchFramework/Utils.cs
index 27391b3d7..21a9b4a89 100644
--- a/TestBenchFramework/Utils.cs
+++ b/TestBenchFramework/Utils.cs
@@ -247,50 +247,6 @@ namespace TBF
return result;
}
-
- ///
- /// Pre-fetch the test results from the currently available results.
- /// The order of the returned results is the same as the order of tests in the procedure specification.
- ///
- /// Current procedure, it is used to determine the order of resulting test results
- /// Currently available unsorted test results (can also be null)
- /// Water meter number (1-based) or 0=all (also compared with nonzero 'Part' number)
- /// Ordered list of test results containing null-s for missing results
- public static IList GetSortedTestResults(Procedure procedure, IList testResults, int meterPartNr)
- {
- IList rslts = new List();
-
- if (procedure == null) return rslts; /// Return an empty list if no procedure specified
-
- foreach (var test in procedure.Tests)
- {
- BenchControl.GenericDevices.ITestMethod method =
- BenchControl.TbfComponents.FindComponent(test.Method) as BenchControl.GenericDevices.ITestMethod;
-
- if ((method != null) && method.Publish(test) && ((test.Part == 0) || (meterPartNr == 0) || (test.Part == meterPartNr)))
- {
- for (int rpt = 1; rpt <= test.Repeats; rpt++)
- {
- bool added = false;
- if (testResults != null)
- {
- foreach (var testRslt in testResults)
- {
- if ((testRslt.TestId == test.Id) && (testRslt.RepetitionNr == rpt))
- {
- rslts.Add(testRslt);
- added = true;
- break;
- }
- }
- }
- if (!added) rslts.Add(null);
- }
- }
- }
- return rslts;
- }
-
///
/// Pre-fetch the test names given the procedure and the meter number.
/// The order or test names is the same as in the procedure specification.