diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 401a780e5..debbc5b84 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.33.2134.0")] -[assembly: AssemblyFileVersion("2.33.2134.0")] +[assembly: AssemblyVersion("2.33.2138.0")] +[assembly: AssemblyFileVersion("2.33.2138.0")] diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx index ff02d4b41..454bb61b3 100644 --- a/TBF/Resources/Strings.cs.resx +++ b/TBF/Resources/Strings.cs.resx @@ -1213,7 +1213,7 @@ Objem - Vytisknout + Tisknout Chcete uložit změny? @@ -1675,7 +1675,7 @@ Konfigurace testu {0} : chybí {1} - Vytisknout + Tisknout Výběr tiskárny diff --git a/TBF/Rig/DataEntry/DEItem.cs b/TBF/Rig/DataEntry/DEItem.cs index 0e8933ab3..a338c9130 100644 --- a/TBF/Rig/DataEntry/DEItem.cs +++ b/TBF/Rig/DataEntry/DEItem.cs @@ -6,9 +6,9 @@ using Common; namespace TBF.Rig.DataEntry { - /// - /// Ac = Action - /// + /// + /// Action of a DataEntry field + /// public enum Ac { [Description("Clear")] Clear, /// Clear when the form is open, save on OK @@ -19,9 +19,9 @@ namespace TBF.Rig.DataEntry Count, } - /// - /// Ct = Content - /// + /// + /// Content of a DataEntry field + /// public enum Ct { [Description("None")] None, @@ -48,6 +48,16 @@ namespace TBF.Rig.DataEntry Count } + /// + /// Function of the multi purpose button + /// + public enum MultiPurposeBtnFunction + { + None, + AutoSN, + PrintLabelsOnOff, + } + /// /// Identifies image instance /// diff --git a/TBF/Rig/DataEntry/Uni/CycleBgEnForm.cs b/TBF/Rig/DataEntry/Uni/CycleBgEnForm.cs index 71e3a5ab0..075323cff 100644 --- a/TBF/Rig/DataEntry/Uni/CycleBgEnForm.cs +++ b/TBF/Rig/DataEntry/Uni/CycleBgEnForm.cs @@ -50,6 +50,9 @@ namespace TBF.Rig.DataEntry.Uni readonly ComboBox[,] comboBoxes; /// Combo boxes for values in columns readonly CheckBox[] checkBoxes; /// Check boxes for water meter enable/disable + readonly MultiPurposeBtnFunction multiPurposeButtonFn; + bool multiPurposeButtonFlag; + readonly LocalSettings ls; bool isHandlersEnabled; /// Initially false, set to true after ComboBoxes are filled with data @@ -124,13 +127,29 @@ namespace TBF.Rig.DataEntry.Uni comboBoxes = new ComboBox[colItems.Count, wmsCount]; checkBoxes = new CheckBox[wmsCount]; - /// Make Auto s/n button visible if there is either Ct.SerialNr or Ct.SerialNrAux column + /// + /// Determine the multi purpose button function + /// + multiPurposeButton.Visible = false; + multiPurposeButtonFn = MultiPurposeBtnFunction.None; int buttonsWidth = 350; for (int k = 0; k < colItems.Count; k++) { if ((colItems[k].Content == Ct.SerialNr || colItems[k].Content == Ct.SerialNrAux) && colItems[k].Action != Ac.LoadReadOnly) { - autoSNButton.Visible = true; + multiPurposeButton.Visible = true; + multiPurposeButton.Text = "Auto s/n"; + multiPurposeButtonFn = MultiPurposeBtnFunction.AutoSN; + buttonsWidth += 147; + break; + } + + if (colItems[k].Content == Ct.PrintLabel) + { + multiPurposeButton.Visible = true; + multiPurposeButton.Text = string.Format("{0} ({1}/{2})", Strings.Print, Strings.yes, Strings.no); + multiPurposeButtonFn = MultiPurposeBtnFunction.PrintLabelsOnOff; + multiPurposeButtonFlag = false; buttonsWidth += 147; break; } @@ -518,7 +537,7 @@ namespace TBF.Rig.DataEntry.Uni case Ac.Set: for (int i = 0; i < wmsCount; i++) { - comboBoxes[k, i].Text = Strings.yes; + comboBoxes[k, i].Text = (WaterMeters[i] != null && !WaterMeters[i].Disabled) ? Strings.yes : Strings.no; } break; } @@ -648,63 +667,68 @@ namespace TBF.Rig.DataEntry.Uni InitializeBoxes(); } - private void autoSNButton_Click(object sender, EventArgs e) + private void multiPurposeButton_Click(object sender, EventArgs e) { - /// - /// Find the 1st enabled water meter - /// - int firstIx; - for (firstIx = 0; firstIx < wmsCount; firstIx++) - { - if (checkBoxes[firstIx].Checked) break; - } - if (firstIx == wmsCount) - { - return; /// There is not any enabled water meter - } + if (multiPurposeButtonFn == MultiPurposeBtnFunction.None) return; - char[] digits = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; - - /// - /// Find a column with serial numbers - /// - for (int k = 0; k < colItems.Count; k++) + if (multiPurposeButtonFn == MultiPurposeBtnFunction.AutoSN) { - if ((colItems[k].Content == Ct.SerialNr || colItems[k].Content == Ct.SerialNrAux) && colItems[k].Action != Ac.LoadReadOnly) + /// + /// Find the 1st enabled water meter + /// + int firstIx; + for (firstIx = 0; firstIx < wmsCount; firstIx++) { - /// - /// Column with serial numbers found => perform an auto s/n assignment - /// - string firstSN = comboBoxes[k, firstIx].Text; + if (checkBoxes[firstIx].Checked) break; + } + if (firstIx == wmsCount) + { + return; /// There is not any enabled water meter + } - int firstSnNr; - int startIx = firstSN.IndexOfAny(digits); - if (startIx >= 0) + char[] digits = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; + + /// + /// Find a column with serial numbers + /// + for (int k = 0; k < colItems.Count; k++) + { + if ((colItems[k].Content == Ct.SerialNr || colItems[k].Content == Ct.SerialNrAux) && colItems[k].Action != Ac.LoadReadOnly) { - int lastDigitPosPlus1 = startIx + 1; - var listOfDigits = new List(digits); - while (lastDigitPosPlus1 < firstSN.Length && listOfDigits.Contains(firstSN[lastDigitPosPlus1])) - { - lastDigitPosPlus1++; - } - int digitsCount = lastDigitPosPlus1 - startIx; + /// + /// Column with serial numbers found => perform an auto s/n assignment + /// + string firstSN = comboBoxes[k, firstIx].Text; - if (int.TryParse(firstSN.Substring(startIx, digitsCount), out firstSnNr) && firstSnNr >= 0) + int firstSnNr; + int startIx = firstSN.IndexOfAny(digits); + if (startIx >= 0) { - for (int ix = firstIx + 1; ix < wmsCount; ix++) + int lastDigitPosPlus1 = startIx + 1; + var listOfDigits = new List(digits); + while (lastDigitPosPlus1 < firstSN.Length && listOfDigits.Contains(firstSN[lastDigitPosPlus1])) { - if (checkBoxes[ix].Checked) + lastDigitPosPlus1++; + } + int digitsCount = lastDigitPosPlus1 - startIx; + + if (int.TryParse(firstSN.Substring(startIx, digitsCount), out firstSnNr) && firstSnNr >= 0) + { + for (int ix = firstIx + 1; ix < wmsCount; ix++) { - firstSnNr++; - string newSN = firstSnNr.ToString(); - int len = newSN.Length; - if (len <= digitsCount) + if (checkBoxes[ix].Checked) { - comboBoxes[k, ix].Text = firstSN.Substring(0, startIx + digitsCount - len) + newSN + firstSN.Substring(startIx + digitsCount); - } - else - { - comboBoxes[k, ix].Text = firstSN.Substring(0, startIx) + newSN + firstSN.Substring(startIx + digitsCount); ; + firstSnNr++; + string newSN = firstSnNr.ToString(); + int len = newSN.Length; + if (len <= digitsCount) + { + comboBoxes[k, ix].Text = firstSN.Substring(0, startIx + digitsCount - len) + newSN + firstSN.Substring(startIx + digitsCount); + } + else + { + comboBoxes[k, ix].Text = firstSN.Substring(0, startIx) + newSN + firstSN.Substring(startIx + digitsCount); ; + } } } } @@ -712,6 +736,27 @@ namespace TBF.Rig.DataEntry.Uni } } } + + if (multiPurposeButtonFn == MultiPurposeBtnFunction.PrintLabelsOnOff) + { + /// + /// Find a column with Ct.PrintLabel + /// + for (int k = 0; k < colItems.Count; k++) + { + if (colItems[k].Content == Ct.PrintLabel) + { + for (int ix = 0; ix < wmsCount; ix++) + { + if (WaterMeters[ix] != null && !WaterMeters[ix].Disabled) + { + comboBoxes[k, ix].Text = multiPurposeButtonFlag ? Strings.yes : Strings.no; + } + } + } + } + multiPurposeButtonFlag = !multiPurposeButtonFlag; + } } private void comboBox_SelectedIndexChanged(object sndr, EventArgs e) diff --git a/TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs b/TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs index 852499f4c..13a4a3599 100644 --- a/TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs +++ b/TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs @@ -34,7 +34,7 @@ namespace TBF.Rig.DataEntry.Uni System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBgEnForm)); this.okButton = new System.Windows.Forms.Button(); this.clearButton = new System.Windows.Forms.Button(); - this.autoSNButton = new System.Windows.Forms.Button(); + this.multiPurposeButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // okButton @@ -53,20 +53,20 @@ namespace TBF.Rig.DataEntry.Uni this.clearButton.UseVisualStyleBackColor = true; this.clearButton.Click += new System.EventHandler(this.clearButton_Click); // - // autoSNButton + // multiPurposeButton // - resources.ApplyResources(this.autoSNButton, "autoSNButton"); - this.autoSNButton.ForeColor = System.Drawing.Color.Black; - this.autoSNButton.Name = "autoSNButton"; - this.autoSNButton.UseVisualStyleBackColor = true; - this.autoSNButton.Click += new System.EventHandler(this.autoSNButton_Click); + resources.ApplyResources(this.multiPurposeButton, "multiPurposeButton"); + this.multiPurposeButton.ForeColor = System.Drawing.Color.Black; + this.multiPurposeButton.Name = "multiPurposeButton"; + this.multiPurposeButton.UseVisualStyleBackColor = true; + this.multiPurposeButton.Click += new System.EventHandler(this.multiPurposeButton_Click); // // CycleBgEnForm // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.DarkGray; - this.Controls.Add(this.autoSNButton); + this.Controls.Add(this.multiPurposeButton); this.Controls.Add(this.clearButton); this.Controls.Add(this.okButton); this.ForeColor = System.Drawing.Color.Black; @@ -81,6 +81,6 @@ namespace TBF.Rig.DataEntry.Uni private System.Windows.Forms.Button okButton; private System.Windows.Forms.Button clearButton; - private System.Windows.Forms.Button autoSNButton; + private System.Windows.Forms.Button multiPurposeButton; } } \ No newline at end of file diff --git a/TBF/Rig/DataEntry/Uni/CycleBgEnForm.resx b/TBF/Rig/DataEntry/Uni/CycleBgEnForm.resx index fdb7af35b..df57d2504 100644 --- a/TBF/Rig/DataEntry/Uni/CycleBgEnForm.resx +++ b/TBF/Rig/DataEntry/Uni/CycleBgEnForm.resx @@ -183,40 +183,40 @@ 1 - + Top, Right - + Verdana, 14.25pt - + NoControl - + 648, 26 - + 112, 63 - + 9 - - Auto s/n + + Multi purpose - + False - - autoSNButton + + multiPurposeButton - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 0 diff --git a/TBF/Rig/DataEntry/Uni/EntryFormCfg.cs b/TBF/Rig/DataEntry/Uni/EntryFormCfg.cs index b81af94cd..67be59eb6 100644 --- a/TBF/Rig/DataEntry/Uni/EntryFormCfg.cs +++ b/TBF/Rig/DataEntry/Uni/EntryFormCfg.cs @@ -347,7 +347,7 @@ namespace TBF.Rig.DataEntry.Uni BgItemContent = new Ct[1] { Ct.BatchAndWmOrder }; BgItemCaption = new string[1] { "Order nr." }; - BgItemAction = new Ac[1] { Ac.Clear }; + BgItemAction = new Ac[1] { Ac.HistoryLast }; BgItemWidth = new int[1] { 200 }; BgColumnContent = new Ct[1] { Ct.SerialNr };