Label printer modification for Israel PT200.

This commit is contained in:
Milan Hanajik
2016-08-01 15:41:46 +02:00
parent 69f7e62e4e
commit dcadd29791
@@ -165,46 +165,32 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
/// Serial number
if (!string.IsNullOrEmpty(wm.SerialNr)) PrintAt(e, 20, 62, wm.SerialNr);
if (!string.IsNullOrEmpty(wm.SerialNr)) PrintAt(e, 20, 62, string.Format("S/N: {0}", wm.SerialNr));
/// Watermeter type
PrintAt(e, 20, 74, batch.ProtocolTitle);
/// Date
PrintAt(e, 135, 74, DateTimeStr(batch.EndTime));
PrintAt(e, 135, 74, string.Format("{0:dd/MM/yy", batch.EndTime));
if (rsltItems.Count > 0)
{
int printPosition = 1;
Results.WMeterRsltItemSpec item1 = Results.WMeterRsltItemSpec.GetItem(Results.ItemID.Test_name);
Results.WMeterRsltItemSpec item2 = Results.WMeterRsltItemSpec.GetItem(Results.ItemID.Error);
item2.Units = Config.Unit.Pct;
item2.Precision = "F2";
item2.Format = "{0}%";
int printPosition = 1;
foreach (var mtr in wm.MeterTestRslts)
{
string itemText;
item1.TestID = mtr.Name();
item2.TestID = mtr.Name();
if (!wm.Compound())
{
itemText = rsltItems[0].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[0].PrintCombined(mainMtr, auxMtr, mtr);
}
else
{
continue;
}
PrintAt(e, 20, 6 + 14 * printPosition, item1.Print(wm));
PrintAt(e, 78, 6 + 14 * printPosition, item2.Print(wm));
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++;
}
}
@@ -222,11 +208,5 @@ namespace TBF.BenchControl.ResultsPrinters.LabelPrinter
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"));
}
}
}