diff --git a/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.Designer.cs b/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.Designer.cs index c96b3b709..857ff0666 100644 --- a/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.Designer.cs +++ b/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.Designer.cs @@ -108,6 +108,8 @@ namespace TBF.BenchControl.DataEntry.Standard24 this.checkBox24 = new System.Windows.Forms.CheckBox(); this.comboBox24 = new System.Windows.Forms.ComboBox(); this.label24 = new System.Windows.Forms.Label(); + this.autoSnButton = new System.Windows.Forms.Button(); + this.allCheckBox = new System.Windows.Forms.CheckBox(); this.orderGroupBox.SuspendLayout(); this.SuspendLayout(); // @@ -621,11 +623,28 @@ namespace TBF.BenchControl.DataEntry.Standard24 resources.ApplyResources(this.label24, "label24"); this.label24.Name = "label24"; // + // autoSnButton + // + 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); + // + // allCheckBox + // + resources.ApplyResources(this.allCheckBox, "allCheckBox"); + this.allCheckBox.Name = "allCheckBox"; + this.allCheckBox.UseVisualStyleBackColor = true; + this.allCheckBox.CheckedChanged += new System.EventHandler(this.allCheckBox_CheckedChanged); + // // CycleBeginningForm // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.DarkGoldenrod; + this.Controls.Add(this.allCheckBox); + this.Controls.Add(this.autoSnButton); this.Controls.Add(this.checkBox24); this.Controls.Add(this.comboBox24); this.Controls.Add(this.label24); @@ -790,5 +809,7 @@ namespace TBF.BenchControl.DataEntry.Standard24 private System.Windows.Forms.CheckBox checkBox24; private System.Windows.Forms.ComboBox comboBox24; private System.Windows.Forms.Label label24; + private System.Windows.Forms.Button autoSnButton; + private System.Windows.Forms.CheckBox allCheckBox; } } \ No newline at end of file diff --git a/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.cs b/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.cs index ee475299e..5bacd9fed 100644 --- a/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.cs +++ b/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.cs @@ -490,5 +490,65 @@ namespace TBF.BenchControl.DataEntry.Standard24 private void comboBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox22); } private void comboBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox23); } private void comboBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox24); } - } + + private void allCheckBox_CheckedChanged(object sender, EventArgs e) + { + foreach (var cb in checkBoxes) + { + cb.Checked = allCheckBox.Checked; + } + } + + private void autoSnButton_Click(object sender, EventArgs e) + { + char[] digits = new char[] {'0','1','2','3','4','5','6','7','8','9'}; + /// + /// Find the 1st enabled water meter + /// + int firstIx; + string firstSN = string.Empty; + for (firstIx = 0; firstIx < textBoxesCount; firstIx++) + { + if (checkBoxes[firstIx].Checked) + { + firstSN = comboBoxes[firstIx].Text; + break; + } + } + + int firstSnNr; + int startIx = firstSN.IndexOfAny(digits); + if (startIx >= 0) + { + int lastDigitPosPlus1 = startIx + 1; + var listOfDigits = new List(digits); + while (lastDigitPosPlus1 < firstSN.Length && listOfDigits.Contains(firstSN[lastDigitPosPlus1])) + { + lastDigitPosPlus1++; + } + int digitsCount = lastDigitPosPlus1 - startIx; + + if (int.TryParse(firstSN.Substring(startIx, digitsCount), out firstSnNr) && firstSnNr >= 0) + { + for (int ix = firstIx + 1; ix < textBoxesCount; ix++) + { + if (checkBoxes[ix].Checked) + { + firstSnNr++; + string newSN = firstSnNr.ToString(); + int len = newSN.Length; + if (len <= digitsCount) + { + comboBoxes[ix].Text = firstSN.Substring(0, startIx + digitsCount - len) + newSN + firstSN.Substring(startIx + digitsCount); + } + else + { + comboBoxes[ix].Text = firstSN.Substring(0, startIx) + newSN + firstSN.Substring(startIx + digitsCount); ; + } + } + } + } + } + } + } } diff --git a/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.resx b/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.resx index 6fef5a03b..268bd9303 100644 --- a/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.resx +++ b/TBF/BenchControl/DataEntry/Standard24/CycleBeginningForm.resx @@ -122,7 +122,7 @@ Verdana, 14.25pt - 729, 26 + 772, 26 112, 63 @@ -144,16 +144,7 @@ $this - 74 - - - 90, 31 - - - 260, 31 - - - 0 + 76 orderComboBox @@ -192,7 +183,28 @@ $this - 73 + 75 + + + 90, 31 + + + 260, 31 + + + 0 + + + orderComboBox + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + orderGroupBox + + + 0 Verdana, 14.25pt @@ -202,7 +214,7 @@ NoControl - 582, 26 + 625, 26 112, 63 @@ -223,7 +235,7 @@ $this - 72 + 74 True @@ -232,7 +244,7 @@ Verdana, 14.25pt - 24, 127 + 24, 148 166, 23 @@ -256,13 +268,13 @@ $this - 71 + 73 Verdana, 14.25pt - 225, 124 + 225, 145 163, 31 @@ -283,13 +295,13 @@ $this - 70 + 72 True - 410, 135 + 410, 156 15, 14 @@ -310,7 +322,7 @@ $this - 69 + 71 True @@ -319,7 +331,7 @@ NoControl - 410, 179 + 410, 200 15, 14 @@ -340,13 +352,13 @@ $this - 66 + 68 Verdana, 14.25pt - 225, 168 + 225, 189 163, 31 @@ -367,7 +379,7 @@ $this - 67 + 69 True @@ -379,7 +391,7 @@ NoControl - 24, 171 + 24, 192 166, 23 @@ -403,7 +415,7 @@ $this - 68 + 70 True @@ -412,7 +424,7 @@ NoControl - 410, 223 + 410, 244 15, 14 @@ -433,13 +445,13 @@ $this - 63 + 65 Verdana, 14.25pt - 225, 212 + 225, 233 163, 31 @@ -460,7 +472,7 @@ $this - 64 + 66 True @@ -472,7 +484,7 @@ NoControl - 24, 215 + 24, 236 166, 23 @@ -496,7 +508,7 @@ $this - 65 + 67 True @@ -505,7 +517,7 @@ NoControl - 410, 267 + 410, 288 15, 14 @@ -526,13 +538,13 @@ $this - 60 + 62 Verdana, 14.25pt - 225, 256 + 225, 277 163, 31 @@ -553,7 +565,7 @@ $this - 61 + 63 True @@ -565,7 +577,7 @@ NoControl - 24, 259 + 24, 280 166, 23 @@ -589,7 +601,7 @@ $this - 62 + 64 True @@ -598,7 +610,7 @@ NoControl - 410, 311 + 410, 332 15, 14 @@ -619,13 +631,13 @@ $this - 57 + 59 Verdana, 14.25pt - 225, 300 + 225, 321 163, 31 @@ -646,7 +658,7 @@ $this - 58 + 60 True @@ -658,7 +670,7 @@ NoControl - 24, 303 + 24, 324 166, 23 @@ -682,7 +694,7 @@ $this - 59 + 61 True @@ -691,7 +703,7 @@ NoControl - 410, 355 + 410, 376 15, 14 @@ -712,13 +724,13 @@ $this - 54 + 56 Verdana, 14.25pt - 225, 344 + 225, 365 163, 31 @@ -739,7 +751,7 @@ $this - 55 + 57 True @@ -751,7 +763,7 @@ NoControl - 24, 347 + 24, 368 166, 23 @@ -775,7 +787,7 @@ $this - 56 + 58 True @@ -784,7 +796,7 @@ NoControl - 410, 399 + 410, 420 15, 14 @@ -805,13 +817,13 @@ $this - 51 + 53 Verdana, 14.25pt - 225, 388 + 225, 409 163, 31 @@ -832,7 +844,7 @@ $this - 52 + 54 True @@ -844,7 +856,7 @@ NoControl - 24, 391 + 24, 412 166, 23 @@ -868,7 +880,7 @@ $this - 53 + 55 True @@ -877,7 +889,7 @@ NoControl - 410, 443 + 410, 464 15, 14 @@ -898,13 +910,13 @@ $this - 48 + 50 Verdana, 14.25pt - 225, 432 + 225, 453 163, 31 @@ -925,7 +937,7 @@ $this - 49 + 51 True @@ -937,7 +949,7 @@ NoControl - 24, 435 + 24, 456 166, 23 @@ -961,7 +973,7 @@ $this - 50 + 52 True @@ -970,7 +982,7 @@ NoControl - 410, 487 + 410, 508 15, 14 @@ -991,13 +1003,13 @@ $this - 45 + 47 Verdana, 14.25pt - 225, 476 + 225, 497 163, 31 @@ -1018,7 +1030,7 @@ $this - 46 + 48 True @@ -1030,7 +1042,7 @@ NoControl - 24, 479 + 24, 500 166, 23 @@ -1054,7 +1066,7 @@ $this - 47 + 49 True @@ -1063,7 +1075,7 @@ NoControl - 410, 531 + 410, 552 15, 14 @@ -1084,13 +1096,13 @@ $this - 42 + 44 Verdana, 14.25pt - 225, 520 + 225, 541 163, 31 @@ -1111,7 +1123,7 @@ $this - 43 + 45 True @@ -1123,7 +1135,7 @@ NoControl - 24, 523 + 24, 544 178, 23 @@ -1147,7 +1159,7 @@ $this - 44 + 46 True @@ -1156,7 +1168,7 @@ NoControl - 410, 575 + 410, 596 15, 14 @@ -1177,13 +1189,13 @@ $this - 39 + 41 Verdana, 14.25pt - 225, 564 + 225, 585 163, 31 @@ -1204,7 +1216,7 @@ $this - 40 + 42 True @@ -1216,7 +1228,7 @@ NoControl - 24, 567 + 24, 588 178, 23 @@ -1240,7 +1252,7 @@ $this - 41 + 43 True @@ -1249,7 +1261,7 @@ NoControl - 410, 619 + 410, 640 15, 14 @@ -1270,13 +1282,13 @@ $this - 36 + 38 Verdana, 14.25pt - 225, 608 + 225, 629 163, 31 @@ -1297,7 +1309,7 @@ $this - 37 + 39 True @@ -1309,7 +1321,7 @@ NoControl - 24, 611 + 24, 632 178, 23 @@ -1333,7 +1345,7 @@ $this - 38 + 40 True @@ -1342,7 +1354,7 @@ NoControl - 871, 135 + 871, 156 15, 14 @@ -1363,13 +1375,13 @@ $this - 33 + 35 Verdana, 14.25pt - 686, 124 + 686, 145 163, 31 @@ -1390,7 +1402,7 @@ $this - 34 + 36 True @@ -1402,7 +1414,7 @@ NoControl - 481, 127 + 481, 148 178, 23 @@ -1426,7 +1438,7 @@ $this - 35 + 37 True @@ -1435,7 +1447,7 @@ NoControl - 871, 179 + 871, 200 15, 14 @@ -1456,13 +1468,13 @@ $this - 30 + 32 Verdana, 14.25pt - 686, 168 + 686, 189 163, 31 @@ -1483,7 +1495,7 @@ $this - 31 + 33 True @@ -1495,7 +1507,7 @@ NoControl - 481, 171 + 481, 192 178, 23 @@ -1519,7 +1531,7 @@ $this - 32 + 34 True @@ -1528,7 +1540,7 @@ NoControl - 871, 223 + 871, 244 15, 14 @@ -1549,13 +1561,13 @@ $this - 27 + 29 Verdana, 14.25pt - 686, 212 + 686, 233 163, 31 @@ -1576,7 +1588,7 @@ $this - 28 + 30 True @@ -1588,7 +1600,7 @@ NoControl - 481, 215 + 481, 236 178, 23 @@ -1612,7 +1624,7 @@ $this - 29 + 31 True @@ -1621,7 +1633,7 @@ NoControl - 871, 267 + 871, 288 15, 14 @@ -1642,13 +1654,13 @@ $this - 24 + 26 Verdana, 14.25pt - 686, 256 + 686, 277 163, 31 @@ -1669,7 +1681,7 @@ $this - 25 + 27 True @@ -1681,7 +1693,7 @@ NoControl - 481, 259 + 481, 280 178, 23 @@ -1705,7 +1717,7 @@ $this - 26 + 28 True @@ -1714,7 +1726,7 @@ NoControl - 871, 311 + 871, 332 15, 14 @@ -1735,13 +1747,13 @@ $this - 21 + 23 Verdana, 14.25pt - 686, 300 + 686, 321 163, 31 @@ -1762,7 +1774,7 @@ $this - 22 + 24 True @@ -1774,7 +1786,7 @@ NoControl - 481, 303 + 481, 324 178, 23 @@ -1798,7 +1810,7 @@ $this - 23 + 25 True @@ -1807,7 +1819,7 @@ NoControl - 871, 355 + 871, 376 15, 14 @@ -1828,13 +1840,13 @@ $this - 18 + 20 Verdana, 14.25pt - 686, 344 + 686, 365 163, 31 @@ -1855,7 +1867,7 @@ $this - 19 + 21 True @@ -1867,7 +1879,7 @@ NoControl - 481, 347 + 481, 368 178, 23 @@ -1891,7 +1903,7 @@ $this - 20 + 22 True @@ -1900,7 +1912,7 @@ NoControl - 871, 399 + 871, 420 15, 14 @@ -1921,13 +1933,13 @@ $this - 15 + 17 Verdana, 14.25pt - 686, 388 + 686, 409 163, 31 @@ -1948,7 +1960,7 @@ $this - 16 + 18 True @@ -1960,7 +1972,7 @@ NoControl - 481, 391 + 481, 412 178, 23 @@ -1984,7 +1996,7 @@ $this - 17 + 19 True @@ -1993,7 +2005,7 @@ NoControl - 871, 443 + 871, 464 15, 14 @@ -2014,13 +2026,13 @@ $this - 12 + 14 Verdana, 14.25pt - 686, 432 + 686, 453 163, 31 @@ -2041,7 +2053,7 @@ $this - 13 + 15 True @@ -2053,7 +2065,7 @@ NoControl - 481, 435 + 481, 456 178, 23 @@ -2077,7 +2089,7 @@ $this - 14 + 16 True @@ -2086,7 +2098,7 @@ NoControl - 871, 487 + 871, 508 15, 14 @@ -2107,13 +2119,13 @@ $this - 9 + 11 Verdana, 14.25pt - 686, 476 + 686, 497 163, 31 @@ -2134,7 +2146,7 @@ $this - 10 + 12 True @@ -2146,7 +2158,7 @@ NoControl - 481, 479 + 481, 500 178, 23 @@ -2170,7 +2182,7 @@ $this - 11 + 13 True @@ -2179,7 +2191,7 @@ NoControl - 871, 531 + 871, 552 15, 14 @@ -2200,13 +2212,13 @@ $this - 6 + 8 Verdana, 14.25pt - 686, 520 + 686, 541 163, 31 @@ -2227,7 +2239,7 @@ $this - 7 + 9 True @@ -2239,7 +2251,7 @@ NoControl - 481, 523 + 481, 544 178, 23 @@ -2263,7 +2275,7 @@ $this - 8 + 10 True @@ -2272,7 +2284,7 @@ NoControl - 871, 575 + 871, 596 15, 14 @@ -2293,13 +2305,13 @@ $this - 3 + 5 Verdana, 14.25pt - 686, 564 + 686, 585 163, 31 @@ -2320,7 +2332,7 @@ $this - 4 + 6 True @@ -2332,7 +2344,7 @@ NoControl - 481, 567 + 481, 588 178, 23 @@ -2356,7 +2368,7 @@ $this - 5 + 7 True @@ -2365,7 +2377,7 @@ NoControl - 871, 619 + 871, 640 15, 14 @@ -2386,13 +2398,13 @@ $this - 0 + 2 Verdana, 14.25pt - 686, 608 + 686, 629 163, 31 @@ -2413,7 +2425,7 @@ $this - 1 + 3 True @@ -2425,7 +2437,7 @@ NoControl - 481, 611 + 481, 632 178, 23 @@ -2449,7 +2461,67 @@ $this - 2 + 4 + + + Verdana, 14.25pt + + + NoControl + + + 478, 26 + + + 112, 63 + + + 81 + + + Auto s/n + + + autoSnButton + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + True + + + Verdana, 14.25pt + + + 410, 109 + + + 54, 27 + + + 82 + + + All + + + allCheckBox + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 True @@ -2461,7 +2533,10 @@ True - 919, 656 + 919, 682 + + + NoControl CenterParent