Munich: Possibility to print the protocol again, ver.2.7.299

This commit is contained in:
Milan Hanajik
2016-06-02 12:56:18 +02:00
parent f65fefe1ff
commit cd671f9e77
9 changed files with 59 additions and 22 deletions
@@ -27,12 +27,10 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
const int MarginTop = 7; /// Margins of the text from table lines const int MarginTop = 7; /// Margins of the text from table lines
const int MarginLeft = 4; /// Margins of the text from table lines const int MarginLeft = 4; /// Margins of the text from table lines
/// Initialized in the constructor
readonly Printer prn;
/// ///
/// Data to print /// Data to print
/// ///
readonly string docVersion;
readonly Results.Entities.WaterMeter wm; readonly Results.Entities.WaterMeter wm;
string zaehlertyp; string zaehlertyp;
string pruefvorlage; string pruefvorlage;
@@ -57,11 +55,11 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
/// Constructor /// Constructor
/// </summary> /// </summary>
/// <param name="textToPrint">Text to be printed</param> /// <param name="textToPrint">Text to be printed</param>
public MunichPrintDocument(Printer printer, public MunichPrintDocument(string docVersion,
Results.Entities.WaterMeter wm, Results.Entities.WaterMeter wm,
PageOrientation pageOrientation) PageOrientation pageOrientation)
{ {
prn = printer; this.docVersion = docVersion;
this.wm = wm; this.wm = wm;
compound = wm.Compound(); compound = wm.Compound();
@@ -141,10 +139,10 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
StringFormat format = new StringFormat(StringFormatFlags.LineLimit); StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
RectangleF printArea = new RectangleF(TitleX, TitleY, 667, 50); RectangleF printArea = new RectangleF(TitleX, TitleY, 667, 50);
e.Graphics.DrawString(prn.Title, this.fontTitle, Brushes.Black, printArea); e.Graphics.DrawString(wm.Batch.ProtocolTitle, this.fontTitle, Brushes.Black, printArea);
int lineNr = FirstLineNr; int lineNr = FirstLineNr;
PrintAt(e, Tab1, lineNr * SpacingOne, prn.Version); PrintAt(e, Tab1, lineNr * SpacingOne, docVersion);
lineNr++; lineNr++;
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :"); PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :");
PrintBoldAt(e, Tab2, lineNr * SpacingOne, wm.BenchId().ToString()); PrintBoldAt(e, Tab2, lineNr * SpacingOne, wm.BenchId().ToString());
@@ -24,7 +24,6 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
/// <summary> Data to print </summary> /// <summary> Data to print </summary>
Results.Entities.Batch batch; Results.Entities.Batch batch;
public string Title;
public string Version { get { return printerCfg.Version; } } public string Version { get { return printerCfg.Version; } }
@@ -47,7 +46,6 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
public IOperation PrintResultsOp(Results.Entities.Batch batch) public IOperation PrintResultsOp(Results.Entities.Batch batch)
{ {
this.batch = batch; this.batch = batch;
this.Title = batch.ProtocolTitle;
return this; return this;
} }
@@ -56,7 +54,7 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
{ {
foreach (var wm in batch.WaterMeters) foreach (var wm in batch.WaterMeters)
{ {
new MunichPrintDocument(this, wm, printerCfg.PageOrientation).Print(); new MunichPrintDocument(printerCfg.Version, wm, printerCfg.PageOrientation).Print();
} }
} }
+15 -3
View File
@@ -45,21 +45,33 @@ namespace TBF.Forms
startTimeLabel.Text = string.Format("{0} {1}", StarTime.ToShortDateString(), StarTime.ToShortTimeString()); startTimeLabel.Text = string.Format("{0} {1}", StarTime.ToShortDateString(), StarTime.ToShortTimeString());
endTimeLabel.Text = string.Format("{0} {1}", EndTime.ToShortDateString(), EndTime.ToShortTimeString()); endTimeLabel.Text = string.Format("{0} {1}", EndTime.ToShortDateString(), EndTime.ToShortTimeString());
procedureLabel.Text = ProcedureName; procedureLabel.Text = ProcedureName;
purchaseOrderLabel.Text = string.Format("Obj.: {0}", PurchaseOrder); purchaseOrderLabel.Text = string.Format("{0}: {1}", Strings.Purchase_order, PurchaseOrder);
passedCountLabel.Text = string.Format("Dobrých: {0}", PassedCount); passedCountLabel.Text = string.Format("{0}: {1}", Strings.Passed, PassedCount);
failedCountLabel.Text = string.Format("Zlých: {0}", FailedCount); failedCountLabel.Text = string.Format("{0}: {1}", Strings.Failed, FailedCount);
#if MUNICH
sentCheckBox.Text = Strings.Printed;
sentCheckBox.Checked = Sent;
sendButton.Enabled = true;
sendButton.Text = Strings.Again;
#else
sentCheckBox.Text = Strings.Sent; sentCheckBox.Text = Strings.Sent;
sentCheckBox.Checked = Sent; sentCheckBox.Checked = Sent;
sendButton.Enabled = !Sent; sendButton.Enabled = !Sent;
sendButton.Text = Strings.Again; sendButton.Text = Strings.Again;
#endif
} }
public void UpdateSentState(bool sent) public void UpdateSentState(bool sent)
{ {
this.Sent = sent; this.Sent = sent;
#if MUNICH
sentCheckBox.Checked = sent;
sendButton.Enabled = true;
#else
sentCheckBox.Checked = sent; sentCheckBox.Checked = sent;
sendButton.Enabled = !sent; sendButton.Enabled = !sent;
#endif
} }
private void sendButton_Click(object sender, EventArgs e) private void sendButton_Click(object sender, EventArgs e)
@@ -109,6 +109,20 @@ namespace TBF.Forms
MessageBoxButtons.OK, MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBoxIcon.Error);
} }
#elif MUNICH
string docVersion = string.Empty;
foreach (var cmp in TBF.BenchControl.StateMachine.Components)
{
if (cmp.ClassName == "ResultsPrinter4Munich")
{
docVersion = (cmp as TBF.BenchControl.ResultsPrinters.Munich.Printer).Version;
break;
}
}
foreach (var wm in b.WaterMeters)
{
new TBF.BenchControl.ResultsPrinters.Munich.MunichPrintDocument(docVersion, wm, Config.Entities.PageOrientation.Portrait).Print();
}
#endif #endif
} }
} }
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.7.298.1")] [assembly: AssemblyVersion("2.7.299.1")]
[assembly: AssemblyFileVersion("2.7.298.1")] [assembly: AssemblyFileVersion("2.7.299.1")]
+9
View File
@@ -2301,6 +2301,15 @@ namespace TBF.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Printed.
/// </summary>
internal static string Printed {
get {
return ResourceManager.GetString("Printed", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Printer. /// Looks up a localized string similar to Printer.
/// </summary> /// </summary>
+4 -1
View File
@@ -1189,7 +1189,7 @@
<value>Wasserzählerergebnisse drucken</value> <value>Wasserzählerergebnisse drucken</value>
</data> </data>
<data name="Again" xml:space="preserve"> <data name="Again" xml:space="preserve">
<value>wieder</value> <value>Wieder</value>
</data> </data>
<data name="Previous_results" xml:space="preserve"> <data name="Previous_results" xml:space="preserve">
<value>Vorherige Ergebnisse</value> <value>Vorherige Ergebnisse</value>
@@ -1236,4 +1236,7 @@
<data name="End_Condition" xml:space="preserve"> <data name="End_Condition" xml:space="preserve">
<value>Bedingung für das Ende</value> <value>Bedingung für das Ende</value>
</data> </data>
<data name="Printed" xml:space="preserve">
<value>Gedruckt</value>
</data>
</root> </root>
@@ -1411,4 +1411,7 @@
<data name="Saving_and_printing_results" xml:space="preserve"> <data name="Saving_and_printing_results" xml:space="preserve">
<value>Saving and printing results</value> <value>Saving and printing results</value>
</data> </data>
<data name="Printed" xml:space="preserve">
<value>Printed</value>
</data>
</root> </root>
@@ -45,7 +45,7 @@ namespace TBF.Screens
{ {
InitializeComponent(); InitializeComponent();
#if MUNICH #if !(IPERLST || IPERLST_SPECIAL || MUNICH)
previousResultsButton.Visible = false; previousResultsButton.Visible = false;
#endif #endif