All printers modified for new Results, other fixes and changes.
This commit is contained in:
+5
-13
@@ -43,8 +43,6 @@ namespace Results
|
||||
|
||||
public Batch Batch;
|
||||
public WaterMeter[] WaterMeters;
|
||||
public IList<TestRslt> TestRslts;
|
||||
public IList<TestRslt> MeterTestRslts;
|
||||
|
||||
public static BatchResults NewFromProcedure(int batchNr, int benchId, string user, string programVer,
|
||||
Config.Entities.Procedure procedure,
|
||||
@@ -61,6 +59,7 @@ namespace Results
|
||||
UserName = user,
|
||||
ProcedureName = procedure.Name,
|
||||
ProcedureRevision = procedure.Revision,
|
||||
ProtocolTitle = procedure.ProtocolTitle,
|
||||
StartTime = DateTime.Now,
|
||||
};
|
||||
|
||||
@@ -87,7 +86,7 @@ namespace Results
|
||||
{
|
||||
/// Create an empty test result and add it to the list
|
||||
TestRslt tr = new TestRslt(d.Batch, td, t.Part, rnr);
|
||||
d.TestRslts.Add(tr);
|
||||
d.Batch.TestRslts.Add(tr);
|
||||
d.TestRsltsMap.Add(tr.Name(), tr);
|
||||
|
||||
for (int i = 0; i < d.WMPositionsCount; i++)
|
||||
@@ -128,22 +127,15 @@ namespace Results
|
||||
|
||||
public TestRslt GetTestRslt(string name, int part)
|
||||
{
|
||||
foreach (var tr in TestRslts)
|
||||
{
|
||||
if (part == tr.Part && name.Equals(tr.Name())) return tr;
|
||||
}
|
||||
return null;
|
||||
return Batch.GetTestRslt(name, part);
|
||||
}
|
||||
|
||||
|
||||
public MeterTestRslt GetMeterTestRslt(string name, int wmnr0, Config.Entities.CompoundMeterId meterId)
|
||||
{
|
||||
if (WaterMeters[wmnr0] != null && !WaterMeters[wmnr0].Disabled)
|
||||
if (WaterMeters[wmnr0] != null)
|
||||
{
|
||||
foreach (var mtr in WaterMeters[wmnr0].MeterTestRslts)
|
||||
{
|
||||
if (mtr.CompoundMeterId == (byte)meterId && name.Equals(mtr.Name())) return mtr;
|
||||
}
|
||||
return WaterMeters[wmnr0].GetMeterTestRslt(name, meterId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Results.Entities
|
||||
public virtual string UserName { get; set; }
|
||||
public virtual string ProcedureName { get; set; }
|
||||
public virtual int ProcedureRevision { get; set; }
|
||||
public virtual string ProtocolTitle { get; set; }
|
||||
public virtual float Custom1 { get; set; }
|
||||
public virtual float Custom2 { get; set; }
|
||||
public virtual float Custom3 { get; set; }
|
||||
@@ -32,5 +33,39 @@ namespace Results.Entities
|
||||
WaterMeters = new List<WaterMeter>();
|
||||
TestRslts = new List<TestRslt>();
|
||||
}
|
||||
|
||||
public virtual float AmbientTempAve()
|
||||
{
|
||||
if (TestRslts.Count == 0) return 0;
|
||||
float sum = 0;
|
||||
foreach (var tr in TestRslts) sum += tr.AmbientTempAve;
|
||||
return sum / TestRslts.Count;
|
||||
}
|
||||
|
||||
public virtual float AmbientPressAve()
|
||||
{
|
||||
if (TestRslts.Count == 0) return 0;
|
||||
float sum = 0;
|
||||
foreach (var tr in TestRslts) sum += tr.AmbientPressAve;
|
||||
return sum / TestRslts.Count;
|
||||
}
|
||||
|
||||
public virtual float AmbientHumiAve()
|
||||
{
|
||||
if (TestRslts.Count == 0) return 0;
|
||||
float sum = 0;
|
||||
foreach (var tr in TestRslts) sum += tr.AmbientHumiAve;
|
||||
return sum / TestRslts.Count;
|
||||
}
|
||||
|
||||
public virtual TestRslt GetTestRslt(string name, int part)
|
||||
{
|
||||
foreach (var tr in TestRslts)
|
||||
{
|
||||
if (part == tr.Part && name.Equals(tr.Name())) return tr;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,23 +56,34 @@ namespace Results.Entities
|
||||
public virtual bool Disabled { get; set; } /// true = Disabled water meters (not saved into DB)
|
||||
|
||||
|
||||
public virtual MeterTestRslt MeterTestRslt(string testName)
|
||||
public virtual MeterTestRslt GetMeterTestRslt(string testName)
|
||||
{
|
||||
foreach (var tr in MeterTestRslts)
|
||||
return GetMeterTestRslt(testName, CompoundMeterId.Single);
|
||||
}
|
||||
|
||||
public virtual MeterTestRslt GetMeterTestRslt(string testName, Config.Entities.CompoundMeterId meterId)
|
||||
{
|
||||
if (Disabled) return null;
|
||||
string testNameL = testName.ToLower();
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if (tr.Name().ToLower().Equals(testName.ToLower())) return tr;
|
||||
if ((mtr.CompoundMeterId == (byte)meterId) && mtr.Name().ToLower().Equals(testNameL))
|
||||
{
|
||||
return mtr;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual TestRslt TestRslt(string testName)
|
||||
public virtual TestRslt GetTestRslt(string testName)
|
||||
{
|
||||
MeterTestRslt mtr = MeterTestRslt(testName);
|
||||
MeterTestRslt mtr = GetMeterTestRslt(testName);
|
||||
if (mtr != null) return mtr.TestRslt;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor, initializes a list, used as a base for other constructors
|
||||
/// </summary>
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Results.Mappings
|
||||
Map(x => x.UserName);
|
||||
Map(x => x.ProcedureName);
|
||||
Map(x => x.ProcedureRevision);
|
||||
Map(x => x.ProtocolTitle);
|
||||
Map(x => x.Custom1);
|
||||
Map(x => x.Custom2);
|
||||
Map(x => x.Custom3);
|
||||
|
||||
+11
-11
@@ -390,15 +390,15 @@ namespace ResultsBrowser
|
||||
sb.Append(';'); sb.Append(wm.ApprovalInfo());
|
||||
sb.Append(';'); sb.Append(wm.MetrologicalClass());
|
||||
sb.Append(';'); sb.Append("0");
|
||||
sb.Append(';'); sb.Append((1000 * (wm.TestRslt("q1") != null ? wm.TestRslt("q1").Qfrom() : 0)).ToString("F0")); /// Q1 nominal
|
||||
sb.Append(';'); sb.Append((1000 * (wm.TestRslt("q2") != null ? wm.TestRslt("q2").Qfrom() : 0)).ToString("F0")); /// Q2 nominal
|
||||
sb.Append(';'); sb.Append((1000 * (wm.TestRslt("q3") != null ? wm.TestRslt("q3").Qto() : 0)).ToString("F0")); /// Q3 nominal
|
||||
sb.Append(';'); sb.Append((1000 * (wm.GetTestRslt("q1") != null ? wm.GetTestRslt("q1").Qfrom() : 0)).ToString("F0")); /// Q1 nominal
|
||||
sb.Append(';'); sb.Append((1000 * (wm.GetTestRslt("q2") != null ? wm.GetTestRslt("q2").Qfrom() : 0)).ToString("F0")); /// Q2 nominal
|
||||
sb.Append(';'); sb.Append((1000 * (wm.GetTestRslt("q3") != null ? wm.GetTestRslt("q3").Qto() : 0)).ToString("F0")); /// Q3 nominal
|
||||
sb.Append(';'); sb.Append("0"); /// Q4 nominal
|
||||
sb.Append(';'); sb.Append("6"); /// Worker code
|
||||
sb.Append(';'); sb.Append(ToShortStr(wm.EndTime()));
|
||||
sb.Append(';'); sb.Append((wm.MeterTestRslt("q1") != null ? wm.MeterTestRslt("q1").Error : 99).ToString("F1")); /// Q1 Error [%]
|
||||
sb.Append(';'); sb.Append((wm.MeterTestRslt("q2") != null ? wm.MeterTestRslt("q2").Error : 99).ToString("F1")); /// Q2 Error [%]
|
||||
sb.Append(';'); sb.Append((wm.MeterTestRslt("q3") != null ? wm.MeterTestRslt("q3").Error : 99).ToString("F1")); /// Q3 Error [%]
|
||||
sb.Append(';'); sb.Append((wm.GetMeterTestRslt("q1") != null ? wm.GetMeterTestRslt("q1").Error : 99).ToString("F1")); /// Q1 Error [%]
|
||||
sb.Append(';'); sb.Append((wm.GetMeterTestRslt("q2") != null ? wm.GetMeterTestRslt("q2").Error : 99).ToString("F1")); /// Q2 Error [%]
|
||||
sb.Append(';'); sb.Append((wm.GetMeterTestRslt("q3") != null ? wm.GetMeterTestRslt("q3").Error : 99).ToString("F1")); /// Q3 Error [%]
|
||||
sb.Append(';'); sb.Append("0"); /// Q4 Error [%]
|
||||
sb.Append(';'); sb.Append(wm.BenchId().ToString()); ///
|
||||
sb.Append(';'); sb.Append(wm.PurchaseOrder);
|
||||
@@ -453,11 +453,11 @@ namespace ResultsBrowser
|
||||
#endif
|
||||
sb.Append(";\""); sb.Append(wm.SerialNr); sb.Append('"'); /// PCB number
|
||||
sb.Append(";\""); sb.Append(wm.ProcedureName()); sb.Append('"'); /// Procedure name
|
||||
sb.Append(';'); sb.Append((1000 * (wm.TestRslt("q3") != null ? wm.TestRslt("q3").Qto() : 0)).ToString("F0")); /// Q3 nominal
|
||||
sb.Append(';'); sb.Append((wm.MeterTestRslt("adjustment") != null ? wm.MeterTestRslt("adjustment").Error : 99).ToString("F2"));/// Adjustment Error [%]
|
||||
sb.Append(';'); sb.Append((wm.MeterTestRslt("q3") != null ? wm.MeterTestRslt("q1").Error : 99).ToString("F2")); /// Q1 Error [%]
|
||||
sb.Append(';'); sb.Append((wm.MeterTestRslt("q2") != null ? wm.MeterTestRslt("q2").Error : 99).ToString("F2")); /// Q2 Error [%]
|
||||
sb.Append(';'); sb.Append((wm.MeterTestRslt("q1") != null ? wm.MeterTestRslt("q3").Error : 99).ToString("F2")); /// Q3 Error [%]
|
||||
sb.Append(';'); sb.Append((1000 * (wm.GetTestRslt("q3") != null ? wm.GetTestRslt("q3").Qto() : 0)).ToString("F0")); /// Q3 nominal
|
||||
sb.Append(';'); sb.Append((wm.GetMeterTestRslt("adjustment") != null ? wm.GetMeterTestRslt("adjustment").Error : 99).ToString("F2"));/// Adjustment Error [%]
|
||||
sb.Append(';'); sb.Append((wm.GetMeterTestRslt("q3") != null ? wm.GetMeterTestRslt("q1").Error : 99).ToString("F2")); /// Q1 Error [%]
|
||||
sb.Append(';'); sb.Append((wm.GetMeterTestRslt("q2") != null ? wm.GetMeterTestRslt("q2").Error : 99).ToString("F2")); /// Q2 Error [%]
|
||||
sb.Append(';'); sb.Append((wm.GetMeterTestRslt("q1") != null ? wm.GetMeterTestRslt("q3").Error : 99).ToString("F2")); /// Q3 Error [%]
|
||||
sb.Append(';'); sb.Append(wm.StartTime().ToShortTimeString());
|
||||
sb.Append(';'); sb.Append(wm.EndTime().ToShortTimeString());
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// <param name="batchResults">Results to print</param>
|
||||
/// <param name="title">Title of the printed protocol</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
IOperation PrintResultsOp(Results.BatchResults batchResults, string title);
|
||||
IOperation PrintResultsOp(Results.Entities.Batch batch, string title);
|
||||
|
||||
/// <summary>
|
||||
/// When true printing at the end of cycle is bypassed.
|
||||
|
||||
@@ -13,6 +13,6 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
|
||||
/// </summary>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
IOperation WriteResultsOp(Results.BatchResults batchResults);
|
||||
IOperation WriteResultsOp(Results.Entities.Batch batchResults);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,16 +32,12 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
readonly GenericDevices.IBenchInfo benchId;
|
||||
readonly Procedure procedure;
|
||||
readonly IList<TestResult> unsortedResults;
|
||||
readonly bool combined;
|
||||
readonly DateTime dateTime;
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
readonly IList<Config.ResultItemSpec> resultItems;
|
||||
readonly IList<Results.ItemSpec> rsltItems;
|
||||
|
||||
///
|
||||
/// Layout and status
|
||||
@@ -57,15 +53,11 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public BasicPrintDocument(GenericDevices.IBenchInfo benchId,
|
||||
Procedure procedure,
|
||||
IList<TestResult> unsortedResults,
|
||||
public BasicPrintDocument(Results.Entities.Batch batch,
|
||||
PageOrientation pageOrientation,
|
||||
int topMrgn)
|
||||
{
|
||||
this.benchId = benchId;
|
||||
this.procedure = procedure;
|
||||
this.unsortedResults = unsortedResults;
|
||||
this.batch = batch;
|
||||
|
||||
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
|
||||
|
||||
@@ -73,21 +65,15 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
HdrTop = TitleY + 60;
|
||||
BodyTop = HdrTop + 160;
|
||||
|
||||
dateTime = DateTime.Now;
|
||||
|
||||
|
||||
if ((unsortedResults != null) && (unsortedResults.Count != 0) && (unsortedResults[0].MetersKind == MetersKind.Single))
|
||||
if (batch.WaterMeters[0].Compound())
|
||||
{
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
combined = false;
|
||||
rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
combined = true;
|
||||
rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
}
|
||||
|
||||
|
||||
/// 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;
|
||||
@@ -103,12 +89,15 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
printWidth = tmp;
|
||||
}
|
||||
|
||||
IList<TestResult> rslts = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(0, combined));
|
||||
int wmSectionHeight = (rslts.Count + 4) * SpacingOne;
|
||||
int testsCount = batch.WaterMeters[0].MeterTestRslts.Count;
|
||||
if (batch.WaterMeters[0].Compound()) testsCount /= 3;
|
||||
|
||||
int wmSectionHeight = (testsCount + 4) * SpacingOne;
|
||||
|
||||
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
|
||||
|
||||
nrPages = 1 + ((combined ? Config.Data.CompoundWMsCount : Config.Data.WMsCount) - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
|
||||
nrPages = 1 + batch.WaterMeters.Count / nrWMsOnNextPage;
|
||||
|
||||
pageNr = 1;
|
||||
nextWMNr = 0;
|
||||
@@ -171,7 +160,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
/// Header
|
||||
///----------
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, 667, 40);
|
||||
e.Graphics.DrawString(unsortedResults[0].ProtocolTitle, titleFont, Brushes.Black, printArea);
|
||||
e.Graphics.DrawString(batch.ProtocolTitle, titleFont, Brushes.Black, printArea);
|
||||
|
||||
string[] leftColumn = new string[]
|
||||
{
|
||||
@@ -186,18 +175,18 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
|
||||
string[] rightColumn = new string[]
|
||||
{
|
||||
unsortedResults[0].BatchNr.ToString(),
|
||||
//dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(),
|
||||
string.Format("{0}.{1}.{2} {3}:{4}", dateTime.Year.ToString("D4"),
|
||||
dateTime.Month.ToString("D2"),
|
||||
dateTime.Day.ToString("D2"),
|
||||
dateTime.Hour.ToString("D2"),
|
||||
dateTime.Minute.ToString("D2")),
|
||||
procedure.Name,
|
||||
batch.BatchNr.ToString(),
|
||||
//batch.EndTime.ToShortDateString() + " " + batch.EndTime.ToShortTimeString(),
|
||||
string.Format("{0}.{1}.{2} {3}:{4}", batch.EndTime.Year.ToString("D4"),
|
||||
batch.EndTime.Month.ToString("D2"),
|
||||
batch.EndTime.Day.ToString("D2"),
|
||||
batch.EndTime.Hour.ToString("D2"),
|
||||
batch.EndTime.Minute.ToString("D2")),
|
||||
batch.ProcedureName,
|
||||
User.CurrentUser.Name,
|
||||
unsortedResults[0].AmbientTempAve.ToString("F1") + " °C",
|
||||
unsortedResults[0].AmbientPressAve.ToString("F0") + " mbar",
|
||||
unsortedResults[0].AmbientHumiAve.ToString("F0") + " %",
|
||||
batch.AmbientTempAve().ToString("F1") + " °C",
|
||||
batch.AmbientPressAve().ToString("F0") + " mbar",
|
||||
batch.AmbientHumiAve().ToString("F0") + " %",
|
||||
};
|
||||
|
||||
/// Determine max. left column width in characters
|
||||
@@ -222,27 +211,13 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
|
||||
int nrWMsOnPage = (pageNr == 1) ? nrWMsOnFirstPage : nrWMsOnNextPage;
|
||||
|
||||
if (combined)
|
||||
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, Config.Data.CompoundWMsCount); wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
nextWmTop += PrintCombinedWM(e, wmNr + 1, nextWmTop);
|
||||
}
|
||||
|
||||
nextWMNr += nrWMsOnPage;
|
||||
e.HasMorePages = (nextWMNr < Config.Data.CompoundWMsCount);
|
||||
nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmNr + 1, nextWmTop);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, Config.Data.WMsCount); wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
if (!unsortedResults[0].Meters[wmNr].Disabled)
|
||||
nextWmTop += PrintSingleWM(e, wmNr, wmNr + 1, nextWmTop);
|
||||
}
|
||||
|
||||
nextWMNr += nrWMsOnPage;
|
||||
e.HasMorePages = (nextWMNr < Config.Data.WMsCount);
|
||||
}
|
||||
nextWMNr += nrWMsOnPage;
|
||||
e.HasMorePages = (nextWMNr < batch.WaterMeters.Count);
|
||||
|
||||
///----------
|
||||
/// Footer
|
||||
@@ -254,167 +229,114 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
/// <summary>
|
||||
/// Print one water meter results
|
||||
/// </summary>
|
||||
/// <param name="wmNr">Water meter number (0-based)</param>
|
||||
/// <param name="wm">Water meter</param>
|
||||
/// <param name="printedWMNr">Number of the water meter printed</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
int PrintSingleWM(System.Drawing.Printing.PrintPageEventArgs e, int wmNr, int printedWMNr, int top)
|
||||
int PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
{
|
||||
IList<TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr+1, combined));
|
||||
|
||||
/// Determin column widths
|
||||
float[] columnPos = new float[resultItems.Count + 1];
|
||||
float[] columnPos = new float[rsltItems.Count + 1];
|
||||
columnPos[0] = 100.0f;
|
||||
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
float columnWidth = e.Graphics.MeasureString(resultItems[i].ClmnHeaderText, font).Width;
|
||||
foreach (var tr in results)
|
||||
float columnWidth = e.Graphics.MeasureString(rsltItems[i].ClmnHeaderText, font).Width;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (tr != null)
|
||||
string itemText;
|
||||
|
||||
if (!wm.Compound())
|
||||
{
|
||||
float width = e.Graphics.MeasureString(resultItems[i].Print(tr.Meters[wmNr]), font).Width;
|
||||
if (width > columnWidth) columnWidth = width;
|
||||
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;
|
||||
}
|
||||
|
||||
/// Strip color information
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
|
||||
float width = e.Graphics.MeasureString(itemText, font).Width;
|
||||
if (width > columnWidth) columnWidth = width;
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
|
||||
}
|
||||
int tableLeftX = (int)columnPos[0];
|
||||
int tableRightX = (int)columnPos[resultItems.Count] - 20;
|
||||
int tableRightX = (int)columnPos[rsltItems.Count] - 20;
|
||||
|
||||
string wmText = string.Format("Water meter {0}", printedWMNr);
|
||||
PrintAt(e, 100, top, wmText);
|
||||
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[wmNr].SerialNr))
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
PrintAt(e, 100 + (int)e.Graphics.MeasureString(wmText, font).Width, top,
|
||||
string.Format(" s/n = {0}", unsortedResults[0].Meters[wmNr].SerialNr));
|
||||
string.Format(" s/n = {0}", wm.SerialNr));
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
int horY = top + 25;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
PrintAt(e, (int)columnPos[i], top + 27, resultItems[i].ClmnHeaderText);
|
||||
PrintAt(e, (int)columnPos[i], top + 27, rsltItems[i].ClmnHeaderText);
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 27 + SpacingOne;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
for (int r = 0; r < results.Count; r++)
|
||||
int testsCount = 0;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (results[r] != null)
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
string itemText;
|
||||
|
||||
if (!wm.Compound())
|
||||
{
|
||||
string text = resultItems[i].Print(results[r].Meters[wmNr]);
|
||||
|
||||
string[] texts = text.Split(new char[] { '|' });
|
||||
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
text = texts[0];
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * (r + 1), text);
|
||||
/// 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?
|
||||
}
|
||||
|
||||
testsCount++;
|
||||
PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText);
|
||||
}
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 30 + SpacingOne * (results.Count + 1);
|
||||
horY = top + 30 + SpacingOne * (testsCount + 1);
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
return (results.Count + 4) * SpacingOne;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Print one combined water meter results
|
||||
/// </summary>
|
||||
/// <param name="wmNr1">Water meter number (1-based)</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
int PrintCombinedWM(System.Drawing.Printing.PrintPageEventArgs e, int wmNr1, int top)
|
||||
{
|
||||
IList<TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr1, combined));
|
||||
|
||||
/// Determin column widths
|
||||
float[] columnPos = new float[resultItems.Count + 1];
|
||||
columnPos[0] = 100.0f;
|
||||
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
{
|
||||
float columnWidth = e.Graphics.MeasureString(resultItems[i].ClmnHeaderText, font).Width;
|
||||
foreach (var tr in results)
|
||||
{
|
||||
if (tr != null)
|
||||
{
|
||||
float width = e.Graphics.MeasureString(resultItems[i].PrintCombined(tr.Meters[2 * wmNr1 - 2],
|
||||
tr.Meters[2 * wmNr1 - 1],
|
||||
tr.CombinedMeters[wmNr1 - 1]), font).Width;
|
||||
if (width > columnWidth) columnWidth = width;
|
||||
}
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
|
||||
}
|
||||
int tableLeftX = (int)columnPos[0];
|
||||
int tableRightX = (int)columnPos[resultItems.Count] - 20;
|
||||
|
||||
string wmText = string.Format("Water meter {0}", wmNr1);
|
||||
PrintAt(e, 100, top, wmText);
|
||||
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[2 * wmNr1 - 2].SerialNr))
|
||||
{
|
||||
PrintAt(e, 100 + (int)e.Graphics.MeasureString(wmText, font).Width, top,
|
||||
string.Format(" Main s/n: {0} Aux. s/n:{1}",
|
||||
unsortedResults[0].Meters[2 * wmNr1 - 2].SerialNr,
|
||||
unsortedResults[0].Meters[2 * wmNr1 - 1].SerialNr));
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
int horY = top + 25;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
{
|
||||
PrintAt(e, (int)columnPos[i], top + 27, resultItems[i].ClmnHeaderText);
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 27 + SpacingOne;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
for (int r = 0; r < results.Count; r++)
|
||||
{
|
||||
if (results[r] != null)
|
||||
{
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
{
|
||||
string text = resultItems[i].PrintCombined(results[r].Meters[2 * wmNr1 - 2],
|
||||
results[r].Meters[2 * wmNr1 - 1],
|
||||
results[r].CombinedMeters[wmNr1 - 1]);
|
||||
string[] texts = text.Split(new char[] { '|' });
|
||||
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
text = texts[0];
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * (r + 1), text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 30 + SpacingOne * (results.Count + 1);
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
return (results.Count + 4) * SpacingOne;
|
||||
return (testsCount + 4) * SpacingOne;
|
||||
}
|
||||
|
||||
|
||||
@@ -423,17 +345,20 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
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);
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl;
|
||||
|
||||
namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
{
|
||||
@@ -20,16 +14,13 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
|
||||
public bool SupressPrinting { get { return printerCfg.SupressPrinting; } }
|
||||
|
||||
/// <summary>
|
||||
/// Data to print
|
||||
/// </summary>
|
||||
GenericDevices.IBenchInfo benchId;
|
||||
Procedure procedure;
|
||||
IList<TestResult> unsortedResults;
|
||||
|
||||
public Printer()
|
||||
{
|
||||
}
|
||||
/// <summary> Data to print </summary>
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
|
||||
public Printer() { }
|
||||
|
||||
|
||||
public Printer(PrinterCfg cfg)
|
||||
: base(cfg)
|
||||
@@ -41,34 +32,24 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
/// <summary>
|
||||
/// Prints the test cycle results, Events: Event.ResultsPrinted
|
||||
/// </summary>
|
||||
/// <param name="benchId">Bench ID</param>
|
||||
/// <param name="waterMeters">This parameter is unused</param>
|
||||
/// <param name="procedure">Procedure to print the results of</param>
|
||||
/// <param name="unsortedResults">Results to print</param>
|
||||
/// <param name="batch">Batch results to print</param>
|
||||
/// <param name="title">This parameter is unused</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation PrintResultsOp(GenericDevices.IBenchInfo benchId,
|
||||
IList<GenericDevices.IWaterMeter> waterMeters,
|
||||
Procedure procedure,
|
||||
IList<TestResult> unsortedResults,
|
||||
string title)
|
||||
public IOperation PrintResultsOp(Results.Entities.Batch batch, string title)
|
||||
{
|
||||
if ((procedure == null) || (unsortedResults == null) || (unsortedResults.Count < 1))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
this.benchId = benchId;
|
||||
this.procedure = procedure;
|
||||
this.unsortedResults = unsortedResults;
|
||||
|
||||
this.batch = batch;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
new BasicPrintDocument(benchId, procedure, unsortedResults, printerCfg.PageOrientation, printerCfg.TopMargin).Print();
|
||||
if (batch.WaterMeters.Count > 0)
|
||||
{
|
||||
new BasicPrintDocument(batch,
|
||||
printerCfg.PageOrientation,
|
||||
printerCfg.TopMargin).Print();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
|
||||
+58
-127
@@ -26,16 +26,12 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
readonly GenericDevices.IBenchInfo benchId;
|
||||
readonly Procedure procedure;
|
||||
readonly IList<TestResult> unsortedResults;
|
||||
readonly bool combined;
|
||||
readonly DateTime dateTime;
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
readonly IList<Config.ResultItemSpec> resultItems;
|
||||
IList<Results.ItemSpec> rsltItems;
|
||||
|
||||
///
|
||||
/// Layout and status
|
||||
@@ -49,37 +45,28 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public PrintLabelDocument(GenericDevices.IBenchInfo benchId,
|
||||
Procedure procedure,
|
||||
IList<TestResult> unsortedResults,
|
||||
public PrintLabelDocument(Results.Entities.Batch batch,
|
||||
PageOrientation pageOrientation,
|
||||
int paperWidth,
|
||||
int paperHeight,
|
||||
string templateFile)
|
||||
{
|
||||
this.benchId = benchId;
|
||||
this.procedure = procedure;
|
||||
this.unsortedResults = unsortedResults;
|
||||
this.batch = batch;
|
||||
this.paperWidth = paperWidth;
|
||||
this.paperHeight = paperHeight;
|
||||
this.templateFile = templateFile;
|
||||
|
||||
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
|
||||
|
||||
dateTime = DateTime.Now;
|
||||
|
||||
if ((unsortedResults != null) && (unsortedResults.Count != 0) && (unsortedResults[0].MetersKind == MetersKind.Single))
|
||||
if (batch.WaterMeters[0].Compound())
|
||||
{
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
combined = false;
|
||||
rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
combined = true;
|
||||
rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
}
|
||||
|
||||
|
||||
/// 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;
|
||||
@@ -96,12 +83,13 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
}
|
||||
|
||||
/// One watermeter per label/page
|
||||
nrPages = (combined ? Config.Data.CompoundWMsCount : Config.Data.WMsCount);
|
||||
nrPages = batch.WaterMeters.Count;
|
||||
|
||||
pageNr = 1;
|
||||
nextWMNr = 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Override the default onbeginPrint method of the PrintDocument Object
|
||||
/// </summary>
|
||||
@@ -114,6 +102,7 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
if (font == null) { font = new Font(FontFamilyName, FontSize, FontStyle.Regular); }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Override the default OnPrintPage method of the PrintDocument.
|
||||
/// </summary>
|
||||
@@ -156,35 +145,9 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
/// Body
|
||||
///--------
|
||||
|
||||
if (combined)
|
||||
{
|
||||
PrintCombinedWM(e, nextWMNr + 1);
|
||||
nextWMNr++;
|
||||
e.HasMorePages = (nextWMNr < Config.Data.CompoundWMsCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Skip disabled water meters
|
||||
while ((nextWMNr < Config.Data.WMsCount) && unsortedResults[0].Meters[nextWMNr].Disabled) nextWMNr++;
|
||||
|
||||
if (nextWMNr < Config.Data.WMsCount)
|
||||
{
|
||||
PrintSingleWM(e, nextWMNr);
|
||||
|
||||
bool anyMore = false;
|
||||
for (int i = nextWMNr + 1; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
if (!unsortedResults[0].Meters[i].Disabled)
|
||||
{
|
||||
anyMore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
e.HasMorePages = anyMore;
|
||||
}
|
||||
|
||||
nextWMNr++;
|
||||
}
|
||||
PrintWM(e, nextWMNr);
|
||||
nextWMNr++;
|
||||
e.HasMorePages = (nextWMNr < batch.WaterMeters.Count);
|
||||
}
|
||||
|
||||
|
||||
@@ -192,96 +155,57 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
/// Print one water meter results
|
||||
/// </summary>
|
||||
/// <param name="wmNr">Water meter number (0-based)</param>
|
||||
void PrintSingleWM(System.Drawing.Printing.PrintPageEventArgs e, int wmNr)
|
||||
void PrintWM(System.Drawing.Printing.PrintPageEventArgs e, int wmNr)
|
||||
{
|
||||
if (wmNr >= batch.WaterMeters.Count) return;
|
||||
|
||||
Results.Entities.WaterMeter wm = batch.WaterMeters[wmNr];
|
||||
|
||||
if (wm == null) return;
|
||||
|
||||
|
||||
/// Serial number
|
||||
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[wmNr].SerialNr))
|
||||
{
|
||||
PrintAt(e, 20, 62, unsortedResults[0].Meters[wmNr].SerialNr);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr)) PrintAt(e, 20, 62, wm.SerialNr);
|
||||
|
||||
/// Watermeter type
|
||||
PrintAt(e, 20, 74, unsortedResults[0].ProtocolTitle);
|
||||
PrintAt(e, 20, 74, batch.ProtocolTitle);
|
||||
|
||||
/// Date
|
||||
string dateTimeStr = string.Format("{0}/{1}/{2}", dateTime.Day.ToString("D2"), dateTime.Month.ToString("D2"), (dateTime.Year % 100).ToString("D2"));
|
||||
PrintAt(e, 135, 74, dateTimeStr);
|
||||
PrintAt(e, 135, 74, DateTimeStr(batch.EndTime));
|
||||
|
||||
IList<TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr+1, combined));
|
||||
|
||||
for (int printPosition = 1; printPosition <= 3; printPosition++)
|
||||
if (rsltItems.Count > 0)
|
||||
{
|
||||
for (int r = 0; r < results.Count; r++)
|
||||
int printPosition = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (results[r] != null && (r + 1) == printPosition)
|
||||
string itemText;
|
||||
|
||||
if (!wm.Compound())
|
||||
{
|
||||
if (resultItems.Count > 0)
|
||||
{
|
||||
string text = resultItems[0].Print(results[r].Meters[wmNr]);
|
||||
|
||||
string[] texts = text.Split(new char[] { '|' });
|
||||
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
text = texts[0];
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, 78, 6 + 14 * printPosition, string.Format("{0}%", text));
|
||||
}
|
||||
itemText = rsltItems[0].Print(mtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Print one combined water meter results
|
||||
/// </summary>
|
||||
/// <param name="wmNr1">Water meter number (1-based)</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
void PrintCombinedWM(System.Drawing.Printing.PrintPageEventArgs e, int wmNr1)
|
||||
{
|
||||
/// Serial number
|
||||
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[2 * wmNr1 - 2].SerialNr))
|
||||
{
|
||||
PrintAt(e, 20, 62, unsortedResults[0].Meters[2 * wmNr1 - 2].SerialNr);
|
||||
}
|
||||
|
||||
/// Watermeter type
|
||||
PrintAt(e, 20, 74, unsortedResults[0].ProtocolTitle);
|
||||
|
||||
/// Date
|
||||
string dateTimeStr = string.Format("{0}/{1}/{2}", dateTime.Day.ToString("D2"), dateTime.Month.ToString("D2"), (dateTime.Year % 100).ToString("D2"));
|
||||
PrintAt(e, 135, 74, dateTimeStr);
|
||||
|
||||
IList<TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr1, combined));
|
||||
|
||||
for (int printPosition = 1; printPosition <= 3; printPosition++)
|
||||
{
|
||||
for (int r = 0; r < results.Count; r++)
|
||||
{
|
||||
if (results[r] != null && (r + 1) == printPosition)
|
||||
else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
|
||||
{
|
||||
if (resultItems.Count > 0)
|
||||
{
|
||||
string text = resultItems[0].PrintCombined(results[r].Meters[2 * wmNr1 - 2],
|
||||
results[r].Meters[2 * wmNr1 - 1],
|
||||
results[r].CombinedMeters[wmNr1 - 1]);
|
||||
string[] texts = text.Split(new char[] { '|' });
|
||||
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
text = texts[0];
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, 78, 6 + 14 * printPosition, string.Format("{0}%", text));
|
||||
}
|
||||
Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
|
||||
itemText = rsltItems[0].PrintCombined(mainMtr, auxMtr, mtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
itemText = texts[0];
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, 78, 6 + 14 * printPosition, string.Format("{0}%", itemText));
|
||||
printPosition++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,10 +216,17 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
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, 18);
|
||||
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
|
||||
string DateTimeStr(DateTime dateTime)
|
||||
{
|
||||
return string.Format("{0}/{1}/{2}", dateTime.Day.ToString("D2"), dateTime.Month.ToString("D2"), (dateTime.Year % 100).ToString("D2"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl;
|
||||
|
||||
namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
{
|
||||
@@ -20,19 +14,15 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
|
||||
public bool SupressPrinting { get { return printerCfg.SupressPrinting; } }
|
||||
|
||||
/// <summary>
|
||||
/// Data to print
|
||||
/// </summary>
|
||||
GenericDevices.IBenchInfo benchId;
|
||||
Procedure procedure;
|
||||
IList<TestResult> unsortedResults;
|
||||
/// <summary> Data to print </summary>
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
|
||||
public Printer() { }
|
||||
|
||||
public Printer()
|
||||
{
|
||||
}
|
||||
|
||||
public Printer(PrinterCfg cfg)
|
||||
: base(cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
printerCfg = cfg;
|
||||
log.Debug(this.ToString());
|
||||
@@ -41,38 +31,26 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
|
||||
/// <summary>
|
||||
/// Prints the test cycle results, Events: Event.ResultsPrinted
|
||||
/// </summary>
|
||||
/// <param name="benchId">Bench ID</param>
|
||||
/// <param name="waterMeters">This parameter is unused</param>
|
||||
/// <param name="procedure">Procedure to print the results of</param>
|
||||
/// <param name="unsortedResults">Results to print</param>
|
||||
/// <param name="batch">Batch results to print</param>
|
||||
/// <param name="title">This parameter is unused</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation PrintResultsOp(GenericDevices.IBenchInfo benchId,
|
||||
IList<GenericDevices.IWaterMeter> waterMeters,
|
||||
Procedure procedure,
|
||||
IList<TestResult> unsortedResults,
|
||||
string title)
|
||||
public IOperation PrintResultsOp(Results.Entities.Batch batch, string title)
|
||||
{
|
||||
if ((procedure == null) || (unsortedResults == null) || (unsortedResults.Count < 1))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
this.benchId = benchId;
|
||||
this.procedure = procedure;
|
||||
this.unsortedResults = unsortedResults;
|
||||
|
||||
this.batch = batch;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
new PrintLabelDocument(benchId, procedure, unsortedResults,
|
||||
printerCfg.PageOrientation,
|
||||
printerCfg.PaperWidth,
|
||||
printerCfg.PaperHeight,
|
||||
printerCfg.TemplateFile).Print();
|
||||
if (batch.WaterMeters.Count > 0)
|
||||
{
|
||||
new PrintLabelDocument(batch,
|
||||
printerCfg.PageOrientation,
|
||||
printerCfg.PaperWidth,
|
||||
printerCfg.PaperHeight,
|
||||
printerCfg.TemplateFile).Print();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
|
||||
@@ -33,12 +33,9 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
readonly GenericDevices.IBenchInfo benchId;
|
||||
readonly Procedure procedure;
|
||||
readonly int wmNr;
|
||||
readonly IList<TestResult> unsortedResults;
|
||||
readonly IList<TestResult> results;
|
||||
readonly bool combined; /// true when MetersKind is MetersKind.Combined
|
||||
readonly Results.Entities.WaterMeter wm;
|
||||
readonly IList<Results.Entities.MeterTestRslt> results;
|
||||
readonly bool compound; /// true when MetersKind is MetersKind.Combined
|
||||
|
||||
readonly int secondTableOffset; /// Calculated in the constructor
|
||||
|
||||
@@ -57,17 +54,17 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public MunichPrintDocument(Printer printer,
|
||||
Procedure procedure,
|
||||
IList<TestResult> unsortedResults,
|
||||
int wmNr,
|
||||
Results.Entities.WaterMeter wm,
|
||||
PageOrientation pageOrientation)
|
||||
{
|
||||
prn = printer;
|
||||
this.procedure = procedure;
|
||||
this.unsortedResults = unsortedResults;
|
||||
this.wmNr = wmNr;
|
||||
combined = (procedure.MetersKind == MetersKind.Combined);
|
||||
results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr + 1, combined));
|
||||
this.wm = wm;
|
||||
compound = wm.Compound();
|
||||
|
||||
results = wm.MeterTestRslts;
|
||||
|
||||
int resultsCount = wm.MeterTestRslts.Count;
|
||||
if (compound) resultsCount /= 3;
|
||||
|
||||
secondTableOffset = (results.Count + 2) * SpacingOneAndHalf;
|
||||
|
||||
@@ -128,9 +125,9 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, prn.Version);
|
||||
lineNr++;
|
||||
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :");
|
||||
PrintBoldAt(e, Tab2, lineNr * SpacingOne, (prn.BenchId != null) ? prn.BenchId.TestBenchName : "");
|
||||
PrintBoldAt(e, Tab2, lineNr * SpacingOne, wm.BenchId().ToString());
|
||||
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Datum :");
|
||||
PrintBoldAt(e, Tab4, lineNr * SpacingOne, DateTime.Now.Date.ToString("d"));
|
||||
PrintBoldAt(e, Tab4, lineNr * SpacingOne, wm.Batch.EndTime.Date.ToString("d"));
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Zahlertyp :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, prn.Zaehlertyp);
|
||||
@@ -141,7 +138,7 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, prn.Pruefvorlage);
|
||||
lineNr += 2;
|
||||
|
||||
if (combined)
|
||||
if (compound)
|
||||
{
|
||||
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Hauptzahler");
|
||||
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Nebenzahler");
|
||||
@@ -149,65 +146,65 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
}
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, prn.WaterMeters[wmNr].Producer);
|
||||
if (combined)
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Producer());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, prn.WaterMeters[1].Producer);
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.Producer()); /// TODO
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, prn.WaterMeters[wmNr].SerialNr);
|
||||
if (combined)
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.SerialNr);
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, prn.WaterMeters[1].SerialNr);
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.SerialNrEx);
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qn :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, prn.WaterMeters[wmNr].Qn.ToString());
|
||||
if (combined)
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Qn().ToString());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Qn :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, prn.WaterMeters[1].Qn.ToString());
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.Qn().ToString()); /// TODO !!!!!
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Zulassungszeichen :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, prn.WaterMeters[wmNr].ApprovalInfo);
|
||||
if (combined)
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.ApprovalInfo());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Zulassungszeichen :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, prn.WaterMeters[1].ApprovalInfo);
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.ApprovalInfo()); /// TODO
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Metr. klasse :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, prn.WaterMeters[wmNr].MetrologicalClass);
|
||||
if (combined)
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.MetrologicalClass());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Metr. klasse :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, prn.WaterMeters[1].MetrologicalClass);
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.MetrologicalClass()); /// TODO
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Stand :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, prn.WaterMeters[wmNr].EndState);
|
||||
if (combined)
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.EndState);
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Stand :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, prn.WaterMeters[1].EndState);
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.EndStateAux);
|
||||
|
||||
lineNr += 2;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Umschaltpunkte :");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qsteig");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0f * Sequences.SequenceBase.Qrise).ToString("F1") + " l/h");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0 * wm.QRise).ToString("F1") + " l/h");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qfall");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0f * Sequences.SequenceBase.Qfall).ToString("F1") + " l/h");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0 * wm.QFall).ToString("F1") + " l/h");
|
||||
}
|
||||
|
||||
lineNr += 2;
|
||||
@@ -218,16 +215,16 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
|
||||
lineNr += (secondTableOffset * 2) / SpacingOne;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Temperatur");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, results[0].AmbientTempAve.ToString("F1") + " \x00b0C");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbientTempAve().ToString("F1") + " \x00b0C");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Feuchtigkeit");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, results[0].AmbientHumiAve.ToString("F0") + " %");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbientHumiAve().ToString("F0") + " %");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Luftdruck");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, results[0].AmbientPressAve.ToString("F0") + " mbar");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbientPressAve().ToString("F0") + " mbar");
|
||||
|
||||
lineNr++;
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, DateTime.Now.Date.ToString("d"));
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, wm.Batch.EndTime.Date.ToString("d"));
|
||||
lineNr ++;
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Datum");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, "Unterschrift");
|
||||
@@ -241,8 +238,8 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
PrintAt(e, FromTest(-1, -1), "Prüflauf");
|
||||
PrintAt(e, FromTest(-1, 0), "Q [l/h]");
|
||||
PrintAt(e, FromTest(-1, 1), "Prüf-Vol.[l]");
|
||||
PrintAt(e, FromTest(-1, 2), combined ? "HZ-Vol.[l]" : "Z-Vol.[l]");
|
||||
PrintAt(e, FromTest(-1, 3), combined ? "NZ-Vol.[l]" : "-");
|
||||
PrintAt(e, FromTest(-1, 2), compound ? "HZ-Vol.[l]" : "Z-Vol.[l]");
|
||||
PrintAt(e, FromTest(-1, 3), compound ? "NZ-Vol.[l]" : "-");
|
||||
PrintAt(e, FromTest(-1, 4), "Fehler [%]");
|
||||
PrintAt(e, FromTest(-1, 5), "Ergebnis");
|
||||
|
||||
@@ -253,33 +250,41 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
PrintAt(e, FromTest(-1, 10), "Druck Eing.");
|
||||
PrintAt(e, FromTest(-1, 11), "Druck Ausg.");
|
||||
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
int i = 0;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
Point p = FromTest(i, -1);
|
||||
PrintAt(e, p.X, p.Y, results[i].Name);
|
||||
PrintAt(e, p.X, p.Y + (results.Count + 2) * SpacingOneAndHalf, results[i].Name);
|
||||
if (!compound || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
|
||||
{
|
||||
Point p = FromTest(i, -1);
|
||||
PrintAt(e, p.X, p.Y, mtr.Name());
|
||||
PrintAt(e, p.X, p.Y + (results.Count + 2) * SpacingOneAndHalf, mtr.Name());
|
||||
|
||||
PrintAt(e, FromTest(i, 0), results[i].FlowMass.ToString("F1"));
|
||||
PrintAt(e, FromTest(i, 1), results[i].VolumeCTV.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 2), results[i].Meters[wmNr].VolumeMeter.ToString("F2"));
|
||||
if (combined)
|
||||
{
|
||||
PrintAt(e, FromTest(i, 3), results[i].Meters[1].VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 4), results[i].CombinedMeters[wmNr].VolumeErrorPct.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 5), results[i].CombinedMeters[wmNr].Passed ? "iO" : "NiO");
|
||||
PrintAt(e, FromTest(i, 0), mtr.TestRslt.FlowMass.ToString("F1"));
|
||||
PrintAt(e, FromTest(i, 1), mtr.TestRslt.VolumeCTV.ToString("F2"));
|
||||
if (compound)
|
||||
{
|
||||
Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
|
||||
|
||||
PrintAt(e, FromTest(i, 2), mainMtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 3), auxMtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 4), mtr.Error.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 5), mtr.Passed ? "iO" : "NiO");
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintAt(e, FromTest(i, 2), mtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 3), "-");
|
||||
PrintAt(e, FromTest(i, 4), mtr.Error.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 5), mtr.Passed ? "iO" : "NiO");
|
||||
}
|
||||
PrintAt(e, FromTest(i, 6), mtr.TestRslt.FlowMass.ToString("F1"));
|
||||
PrintAt(e, FromTest(i, 7), mtr.TestRslt.TempOutAvrg.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 8), mtr.TestRslt.DensityDiv.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 9), mtr.TestTime.ToString("F1"));
|
||||
PrintAt(e, FromTest(i, 10), mtr.TestRslt.PressUpAvrg.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 11), mtr.TestRslt.PressDownAvrg.ToString("F2"));
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintAt(e, FromTest(i, 3), "-");
|
||||
PrintAt(e, FromTest(i, 4), results[i].Meters[wmNr].VolumeErrorPct.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 5), results[i].Meters[wmNr].Passed ? "iO" : "NiO");
|
||||
}
|
||||
PrintAt(e, FromTest(i, 6), results[i].FlowMass.ToString("F1"));
|
||||
PrintAt(e, FromTest(i, 7), results[i].TempOutAvrg.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 8), results[i].DensityDiv.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 9), results[i].Time.ToString("F1"));
|
||||
PrintAt(e, FromTest(i, 10), results[i].PressInAvrg.ToString("F2"));
|
||||
PrintAt(e, FromTest(i, 11), results[i].PressOutAvrg.ToString("F2"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,28 +18,21 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
|
||||
readonly PrinterCfg printerCfg;
|
||||
|
||||
/// <summary>
|
||||
/// Data to print
|
||||
/// </summary>
|
||||
public GenericDevices.IBenchInfo BenchId;
|
||||
public IList<GenericDevices.IWaterMeter> WaterMeters;
|
||||
public IList<TestResult> Results;
|
||||
|
||||
Procedure procedure;
|
||||
public IList<TestResult> unsortedResults;
|
||||
|
||||
public string Title;
|
||||
public string Version { get { return printerCfg. ProcParams.Version; } }
|
||||
public string Zaehlertyp { get { return printerCfg. ProcParams.Zaehlertyp; } }
|
||||
public string Pruefvorlage { get { return printerCfg. ProcParams.Pruefvorlage; } }
|
||||
public string Eichjahr { get { return printerCfg. ProcParams.Eichjahr; } }
|
||||
|
||||
public bool SupressPrinting { get { return false; } }
|
||||
|
||||
|
||||
public Printer()
|
||||
{
|
||||
}
|
||||
/// <summary> Data to print </summary>
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
public string Title;
|
||||
public string Version { get { return printerCfg.ProcParams.Version; } }
|
||||
public string Zaehlertyp { get { return printerCfg.ProcParams.Zaehlertyp; } }
|
||||
public string Pruefvorlage { get { return printerCfg.ProcParams.Pruefvorlage; } }
|
||||
public string Eichjahr { get { return printerCfg.ProcParams.Eichjahr; } }
|
||||
|
||||
|
||||
public Printer() { }
|
||||
|
||||
|
||||
public Printer(PrinterCfg cfg)
|
||||
: base(cfg)
|
||||
@@ -48,21 +41,14 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Events: ResultsPrinted</summary>
|
||||
/// <param name="benchId">Procedure to print the results of</param>
|
||||
/// <param name="results">Results to print</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation PrintResultsOp(GenericDevices.IBenchInfo benchId,
|
||||
IList<GenericDevices.IWaterMeter> waterMeters,
|
||||
Procedure procedure,
|
||||
IList<TestResult> unsortedResults,
|
||||
string title)
|
||||
public IOperation PrintResultsOp(Results.Entities.Batch batch, string title)
|
||||
{
|
||||
this.BenchId = benchId;
|
||||
this.WaterMeters = waterMeters;
|
||||
this.procedure = procedure;
|
||||
this.Results = unsortedResults;
|
||||
this.unsortedResults = unsortedResults;
|
||||
this.batch = batch;
|
||||
this.Title = title;
|
||||
return this;
|
||||
}
|
||||
@@ -70,24 +56,9 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (unsortedResults != null && unsortedResults.Count > 0)
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
if (procedure.MetersKind == MetersKind.Single)
|
||||
{
|
||||
/// Single
|
||||
for (int wmNr = 0; wmNr < Config.Data.WMsCount; wmNr++)
|
||||
{
|
||||
new MunichPrintDocument(this, procedure, unsortedResults, wmNr, printerCfg.PageOrientation).Print();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Compound
|
||||
for (int wmNr = 0; wmNr < Config.Data.CompoundWMsCount; wmNr++)
|
||||
{
|
||||
new MunichPrintDocument(this, procedure, unsortedResults, wmNr, printerCfg.PageOrientation).Print();
|
||||
}
|
||||
}
|
||||
new MunichPrintDocument(this, wm, printerCfg.PageOrientation).Print();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,14 +73,12 @@ namespace TBF.BenchControl.ResultsPrinters.Zapiska
|
||||
/// to be printed into a 2-dimensional array of strings 'dataToprint'.
|
||||
/// </summary>
|
||||
/// <param name="procedure">Procedure belonging to the results</param>
|
||||
/// <param name="allResults">Results to be printed (multiple batches)</param>
|
||||
public MyPrintDocument(Procedure procedure,
|
||||
IList<TestResult> allResults,
|
||||
string tester)
|
||||
/// <param name="batch">Results to be printed (multiple batches)</param>
|
||||
public MyPrintDocument(Results.Entities.Batch batch)
|
||||
{
|
||||
this.procedure = procedure;
|
||||
this.allResults = allResults;
|
||||
this.tester = tester;
|
||||
//this.procedure = procedure;
|
||||
//this.allResults = allResults;
|
||||
//this.tester = tester;
|
||||
|
||||
dateTime = DateTime.Now;
|
||||
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl;
|
||||
|
||||
namespace TBF.BenchControl.ResultsPrinters.Zapiska
|
||||
{
|
||||
@@ -20,16 +14,13 @@ namespace TBF.BenchControl.ResultsPrinters.Zapiska
|
||||
|
||||
public bool SupressPrinting { get { return printerCfg.SupressPrinting; } }
|
||||
|
||||
/// <summary>
|
||||
/// Data to print
|
||||
/// </summary>
|
||||
GenericDevices.IBenchInfo benchId;
|
||||
Procedure procedure;
|
||||
IList<TestResult> unsortedResults;
|
||||
|
||||
public Printer()
|
||||
{
|
||||
}
|
||||
/// <summary> Data to print </summary>
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
|
||||
public Printer() { }
|
||||
|
||||
|
||||
public Printer(PrinterCfg cfg)
|
||||
: base(cfg)
|
||||
@@ -41,34 +32,22 @@ namespace TBF.BenchControl.ResultsPrinters.Zapiska
|
||||
/// <summary>
|
||||
/// Prints the test cycle results, Events: Event.ResultsPrinted
|
||||
/// </summary>
|
||||
/// <param name="benchId">Bench ID</param>
|
||||
/// <param name="waterMeters">This parameter is unused</param>
|
||||
/// <param name="procedure">Procedure to print the results of</param>
|
||||
/// <param name="unsortedResults">Results to print</param>
|
||||
/// <param name="batch">Batch results to print</param>
|
||||
/// <param name="title">This parameter is unused</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation PrintResultsOp(GenericDevices.IBenchInfo benchId,
|
||||
IList<GenericDevices.IWaterMeter> waterMeters,
|
||||
Procedure procedure,
|
||||
IList<TestResult> unsortedResults,
|
||||
string title)
|
||||
public IOperation PrintResultsOp(Results.Entities.Batch batch, string title)
|
||||
{
|
||||
if ((procedure == null) || (unsortedResults == null) || (unsortedResults.Count < 1))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
this.benchId = benchId;
|
||||
this.procedure = procedure;
|
||||
this.unsortedResults = unsortedResults;
|
||||
|
||||
this.batch = batch;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
new MyPrintDocument(procedure, unsortedResults, User.CurrentUser.Name).Print();
|
||||
if (batch.WaterMeters.Count > 0)
|
||||
{
|
||||
new MyPrintDocument(batch).Print();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
|
||||
@@ -17,22 +17,21 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
public override string ToString() { return string.Format("ResultsWriters.Basic({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly WriterCfg writerCfg;
|
||||
readonly string separatorStr;
|
||||
|
||||
/// <summary>
|
||||
/// Result items to print
|
||||
/// </summary>
|
||||
IList<Config.ResultItemSpec> resultItems;
|
||||
bool combined;
|
||||
IList<Results.ItemSpec> rsltItems;
|
||||
|
||||
/// <summary>
|
||||
/// Results to print
|
||||
/// </summary>
|
||||
Procedure procedure;
|
||||
IList<TestResult> unsortedResults;
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
DateTime dateTime;
|
||||
StreamWriter writer;
|
||||
|
||||
string separatorStr;
|
||||
|
||||
public Writer()
|
||||
{
|
||||
@@ -137,29 +136,22 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
/// <param name="procedure">Procedure to print the results of</param>
|
||||
/// <param name="unsortedResults">Results to write into the file</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation WriteResultsOp(string testBenchId, Procedure procedure, IList<GenericDevices.IWaterMeter> waterMeters, IList<TestResult> unsortedResults)
|
||||
public IOperation WriteResultsOp(Results.Entities.Batch batchResults)
|
||||
{
|
||||
if ((procedure == null) || (unsortedResults == null) || (unsortedResults.Count < 1))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
this.batch = batchResults;
|
||||
|
||||
this.procedure = procedure;
|
||||
this.unsortedResults = unsortedResults;
|
||||
|
||||
combined = (procedure.MetersKind == MetersKind.Combined);
|
||||
if (combined)
|
||||
if (batch.WaterMeters.Count > 0 && !batch.WaterMeters[0].Compound())
|
||||
{
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_CombinedWM);
|
||||
rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_SingleWM);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultItems = Config.ResultItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_SingleWM);
|
||||
rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Printer_CombinedWM);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
dateTime = DateTime.Now;
|
||||
dateTime = batch.EndTime;
|
||||
writer = new StreamWriter(System.IO.File.Create(GetFilename(dateTime)));
|
||||
}
|
||||
catch
|
||||
@@ -178,7 +170,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
///----------
|
||||
/// Header
|
||||
///----------
|
||||
writer.WriteLine(unsortedResults[0].ProtocolTitle);
|
||||
writer.WriteLine(batch.ProtocolTitle);
|
||||
writer.WriteLine(string.Empty);
|
||||
|
||||
string[] leftColumn = new string[]
|
||||
@@ -194,18 +186,18 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
|
||||
string[] rightColumn = new string[]
|
||||
{
|
||||
unsortedResults[0].BatchNr.ToString(),
|
||||
batch.BatchNr.ToString(),
|
||||
//dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(),
|
||||
string.Format("{0}.{1}.{2} {3}:{4}", dateTime.Year.ToString("D4"),
|
||||
dateTime.Month.ToString("D2"),
|
||||
dateTime.Day.ToString("D2"),
|
||||
dateTime.Hour.ToString("D2"),
|
||||
dateTime.Minute.ToString("D2")),
|
||||
procedure.Name,
|
||||
User.CurrentUser.Name,
|
||||
unsortedResults[0].AmbientTempAve.ToString("F1") + " °C",
|
||||
unsortedResults[0].AmbientPressAve.ToString("F0") + " mbar",
|
||||
unsortedResults[0].AmbientHumiAve.ToString("F0") + " %",
|
||||
batch.ProcedureName,
|
||||
batch.UserName,
|
||||
batch.AmbientTempAve().ToString("F1") + " °C",
|
||||
batch.AmbientPressAve().ToString("F0") + " mbar",
|
||||
batch.AmbientHumiAve().ToString("F0") + " %",
|
||||
};
|
||||
|
||||
/// Determine max. left column width in characters
|
||||
@@ -221,63 +213,61 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
}
|
||||
writer.WriteLine(string.Empty);
|
||||
|
||||
|
||||
///--------
|
||||
/// Body
|
||||
///--------
|
||||
if (combined)
|
||||
{
|
||||
for (int wmNr = 0; wmNr < Config.Data.CompoundWMsCount; wmNr++) WriteCombinedWM(wmNr + 1); /// wmNr is 0-based
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int wmNr = 0; wmNr < Config.Data.WMsCount; wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
if (!unsortedResults[0].Meters[wmNr].Disabled)
|
||||
WriteSingleWM(wmNr, wmNr + 1);
|
||||
}
|
||||
}
|
||||
foreach (var wm in batch.WaterMeters) WriteWM(wm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write one water meter results
|
||||
/// </summary>
|
||||
/// <param name="wmNr">Water meter number (0-based)</param>
|
||||
void WriteSingleWM(int wmNr, int printedWMNr)
|
||||
void WriteWM(Results.Entities.WaterMeter wm)
|
||||
{
|
||||
IList<TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr + 1, combined));
|
||||
|
||||
/// Determine column widths
|
||||
int[] columnWidths = new int[resultItems.Count];
|
||||
int[] columnWidths = new int[rsltItems.Count];
|
||||
int totalWidth = 0;
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
columnWidths[i] = ElSpaces(resultItems[i].ClmnHeaderText).Length;
|
||||
foreach (var tr in results)
|
||||
columnWidths[i] = ElSpaces(rsltItems[i].ClmnHeaderText).Length;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (tr != null)
|
||||
string itemText;
|
||||
|
||||
if (!wm.Compound())
|
||||
{
|
||||
string text = resultItems[i].Print(tr.Meters[wmNr]);
|
||||
|
||||
/// Get rid of the color information
|
||||
string[] texts = text.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { text = texts[0]; }
|
||||
|
||||
int len = ElSpaces(text).Length;
|
||||
if (len > columnWidths[i]) columnWidths[i] = len;
|
||||
/// 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;
|
||||
}
|
||||
|
||||
/// 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 * (resultItems.Count - 1);
|
||||
totalWidth += 3 * (rsltItems.Count - 1);
|
||||
if (totalWidth < 0) totalWidth = 0;
|
||||
|
||||
|
||||
/// Write water meter number and s/n
|
||||
writer.Write(string.Format("Water meter {0}", printedWMNr));
|
||||
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[wmNr].SerialNr))
|
||||
{
|
||||
writer.Write(string.Format(" s/n: {0}", unsortedResults[0].Meters[wmNr].SerialNr));
|
||||
}
|
||||
writer.Write(string.Format("Water meter {0}", wm.WMPosition));
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr)) writer.Write(string.Format(" s/n: {0}", wm.SerialNr));
|
||||
writer.WriteLine(string.Empty);
|
||||
|
||||
|
||||
@@ -285,15 +275,15 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
|
||||
|
||||
/// Write column headers
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
writer.Write(ElSpaces(resultItems[i].ClmnHeaderText));
|
||||
writer.Write(ElSpaces(rsltItems[i].ClmnHeaderText));
|
||||
|
||||
if (i < resultItems.Count - 1)
|
||||
if (i < rsltItems.Count - 1)
|
||||
{
|
||||
if (!writerCfg.EliminateSpaces)
|
||||
{
|
||||
writer.Write(new string(' ', columnWidths[i] - resultItems[i].ClmnHeaderText.Length + 3));
|
||||
writer.Write(new string(' ', columnWidths[i] - rsltItems[i].ClmnHeaderText.Length + 3));
|
||||
}
|
||||
writer.Write(separatorStr);
|
||||
}
|
||||
@@ -308,25 +298,46 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
|
||||
|
||||
/// Write table data
|
||||
foreach (var tr in results)
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (tr != null)
|
||||
if (mtr != null)
|
||||
{
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
string text = resultItems[i].Print(tr.Meters[wmNr]);
|
||||
string itemText;
|
||||
|
||||
/// Get rid of the color information
|
||||
string[] texts = text.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { text = texts[0]; }
|
||||
///
|
||||
/// Fetch an item
|
||||
///
|
||||
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;
|
||||
}
|
||||
|
||||
writer.Write(ElSpaces(text));
|
||||
///
|
||||
/// Print the item
|
||||
///
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; } /// Strip color information
|
||||
|
||||
if (i < resultItems.Count - 1)
|
||||
writer.Write(ElSpaces(itemText));
|
||||
|
||||
if (i < rsltItems.Count - 1)
|
||||
{
|
||||
if (!writerCfg.EliminateSpaces)
|
||||
{
|
||||
writer.Write(new string(' ', columnWidths[i] - text.Length + 3));
|
||||
writer.Write(new string(' ', columnWidths[i] - itemText.Length + 3));
|
||||
}
|
||||
writer.Write(separatorStr);
|
||||
}
|
||||
@@ -344,107 +355,6 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
writer.WriteLine(string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write one combined water meter results
|
||||
/// </summary>
|
||||
/// <param name="wmNr1">Combined water meter number (1-based)</param>
|
||||
void WriteCombinedWM(int wmNr1)
|
||||
{
|
||||
IList<TestResult> results = Utils.GetSortedTestResults(procedure, unsortedResults, Utils.PartNr(wmNr1, combined));
|
||||
|
||||
/// Determin column widths
|
||||
int[] columnWidths = new int[resultItems.Count];
|
||||
int totalWidth = 0;
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
{
|
||||
columnWidths[i] = ElSpaces(resultItems[i].ClmnHeaderText).Length;
|
||||
foreach (var tr in results)
|
||||
{
|
||||
if (tr != null)
|
||||
{
|
||||
string text = resultItems[i].PrintCombined(tr.Meters[2 * wmNr1 - 2], tr.Meters[2 * wmNr1 - 1], tr.CombinedMeters[wmNr1 - 1]);
|
||||
int len = ElSpaces(text).Length;
|
||||
if (len > columnWidths[i]) columnWidths[i] = len;
|
||||
}
|
||||
}
|
||||
totalWidth += columnWidths[i];
|
||||
}
|
||||
totalWidth += 3 * (resultItems.Count - 1);
|
||||
if (totalWidth < 0) totalWidth = 0;
|
||||
|
||||
|
||||
/// Write water meter number and two s/n-s
|
||||
writer.Write(string.Format("Water meter {0}", wmNr1));
|
||||
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[2 * wmNr1 - 2].SerialNr))
|
||||
{
|
||||
writer.Write(string.Format(", Main s/n: {0}", unsortedResults[0].Meters[2 * wmNr1 - 2].SerialNr));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(unsortedResults[0].Meters[2 * wmNr1 - 1].SerialNr))
|
||||
{
|
||||
writer.Write(string.Format(", Aux. s/n:{0}", unsortedResults[0].Meters[2 * wmNr1 - 1].SerialNr));
|
||||
}
|
||||
writer.WriteLine(string.Empty);
|
||||
|
||||
|
||||
writer.WriteLine(new String('-', totalWidth)); /// Horizontal line above the header
|
||||
|
||||
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
{
|
||||
writer.Write(ElSpaces(resultItems[i].ClmnHeaderText));
|
||||
|
||||
if (i < resultItems.Count - 1)
|
||||
{
|
||||
if (!writerCfg.EliminateSpaces)
|
||||
{
|
||||
writer.Write(new string(' ', columnWidths[i] - resultItems[i].ClmnHeaderText.Length + 3));
|
||||
}
|
||||
writer.Write(separatorStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteLine(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
writer.WriteLine(new String('-', totalWidth)); /// Horizontal line between the header and the body
|
||||
|
||||
|
||||
foreach (var tr in results)
|
||||
{
|
||||
if (tr != null)
|
||||
{
|
||||
for (int i = 0; i < resultItems.Count; i++)
|
||||
{
|
||||
string text = resultItems[i].PrintCombined(tr.Meters[2 * wmNr1 - 2], tr.Meters[2 * wmNr1 - 1], tr.CombinedMeters[wmNr1 - 1]);
|
||||
|
||||
/// Get rid of the color information
|
||||
string[] texts = text.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { text = texts[0]; }
|
||||
|
||||
writer.Write(ElSpaces(text));
|
||||
|
||||
if (i < resultItems.Count - 1)
|
||||
{
|
||||
if (!writerCfg.EliminateSpaces)
|
||||
{
|
||||
writer.Write(new string(' ', columnWidths[i] - text.Length + 3));
|
||||
}
|
||||
writer.Write(separatorStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteLine(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writer.WriteLine(new String('-', totalWidth)); /// Horizontal line below the body
|
||||
|
||||
writer.WriteLine(string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsWritten</returns>
|
||||
@@ -453,6 +363,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
return Event.ResultsWritten;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
|
||||
@@ -638,7 +638,9 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
dataEntryCmpnt.UpdateTestResults(BatchRslts);
|
||||
}
|
||||
|
||||
|
||||
ProcessData.BatchRslts.AddWaterMetersToBatch();
|
||||
|
||||
//------------------------------------------------------
|
||||
Bridge.OnActivity(this, "Saving and printing results");
|
||||
IResultsWriter writer = TbfComponents.FindComponent(StateMachine.Procedure.ResultsWriter) as IResultsWriter;
|
||||
@@ -646,11 +648,11 @@ namespace TBF.BenchControl.Sequences
|
||||
State savingAndPrintingRslts = State.Create("MainSeq : Saving and printing results");
|
||||
if (writer != null)
|
||||
{
|
||||
savingAndPrintingRslts.AddOperation(writer.WriteResultsOp(ProcessData.BatchRslts));
|
||||
savingAndPrintingRslts.AddOperation(writer.WriteResultsOp(ProcessData.BatchRslts.Batch));
|
||||
}
|
||||
if (printer != null && !printer.SupressPrinting)
|
||||
{
|
||||
savingAndPrintingRslts.AddOperation(printer.PrintResultsOp(ProcessData.BatchRslts, protocolTitle));
|
||||
savingAndPrintingRslts.AddOperation(printer.PrintResultsOp(ProcessData.BatchRslts.Batch, protocolTitle));
|
||||
}
|
||||
savingAndPrintingRslts.AddOperation(checkUiOp).EnterState();
|
||||
do
|
||||
|
||||
Reference in New Issue
Block a user