Selaa lähdekoodia

Added 30s timer to repeatedly poll for unfinished batches
Tweaked Order Report print layout
Fixed Max value on numeric spinners on View PIN form to integer maximum
Added ability to search any batch ID from View PIN form

Brett Credo 8 vuotta sitten
vanhempi
commit
55679fd46e

+ 10 - 3
BulkPrinting/BulkPrinting/BatchForm.Designer.cs

@@ -29,7 +29,7 @@
29 29
         private void InitializeComponent()
30 30
         {
31 31
             this.components = new System.ComponentModel.Container();
32
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
32
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
33 33
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BatchForm));
34 34
             this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
35 35
             this.pnlSplitGrids = new System.Windows.Forms.Panel();
@@ -53,6 +53,7 @@
53 53
             this.dgvBatches = new System.Windows.Forms.DataGridView();
54 54
             this.LogoutTimer = new System.Windows.Forms.Timer(this.components);
55 55
             this.lblLoading = new System.Windows.Forms.Label();
56
+            this.ReSyncTimer = new System.Windows.Forms.Timer(this.components);
56 57
             this.pnlSplitGrids.SuspendLayout();
57 58
             this.grpFilter.SuspendLayout();
58 59
             ((System.ComponentModel.ISupportInitialize)(this.dgvBatches)).BeginInit();
@@ -303,8 +304,8 @@
303 304
             this.dgvBatches.AllowUserToAddRows = false;
304 305
             this.dgvBatches.AllowUserToDeleteRows = false;
305 306
             this.dgvBatches.AllowUserToResizeRows = false;
306
-            dataGridViewCellStyle1.BackColor = System.Drawing.Color.Azure;
307
-            this.dgvBatches.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
307
+            dataGridViewCellStyle2.BackColor = System.Drawing.Color.Azure;
308
+            this.dgvBatches.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle2;
308 309
             this.dgvBatches.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
309 310
             | System.Windows.Forms.AnchorStyles.Left) 
310 311
             | System.Windows.Forms.AnchorStyles.Right)));
@@ -336,6 +337,11 @@
336 337
             this.lblLoading.TabIndex = 6;
337 338
             this.lblLoading.Text = "Loading...";
338 339
             // 
340
+            // ReSyncTimer
341
+            // 
342
+            this.ReSyncTimer.Interval = 30000;
343
+            this.ReSyncTimer.Tick += new System.EventHandler(this.ReSyncTimer_Tick);
344
+            // 
339 345
             // BatchForm
340 346
             // 
341 347
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -384,6 +390,7 @@
384 390
         private System.Windows.Forms.RadioButton rdoFilterReprinted;
385 391
         private System.Windows.Forms.RadioButton rdoFilterUnprinted;
386 392
         private System.Windows.Forms.RadioButton rdoFilterPrinted;
393
+        private System.Windows.Forms.Timer ReSyncTimer;
387 394
     }
388 395
 }
389 396
 

+ 17 - 1
BulkPrinting/BulkPrinting/BatchForm.cs

@@ -289,7 +289,7 @@ namespace BulkPrinting
289 289
             }
290 290
             if (Utility.CheckUserAccess(Utility.UserPermissions.BulkOrder)) { //Only check for undownloaded vouchers if the user is able to see them
291 291
                 if ((string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["ReadyForDownload"].Index].Value == "No") {
292
-                    MessageBox.Show("This batch is not ready to downloaded and cannot be printed.", "Cannot print batch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
292
+                    MessageBox.Show("This batch is not fully downloaded and cannot be printed.\nPlease wait until \"Batch Ready For Download\" says Yes.\nThis may take several minutes depending on the size of\nthe order and available stock.", "Cannot print batch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
293 293
                     return;
294 294
                 }
295 295
             }
@@ -580,5 +580,21 @@ namespace BulkPrinting
580 580
                 e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
581 581
             }
582 582
         }
583
+
584
+        private void ReSyncTimer_Tick(object sender, EventArgs e)
585
+        {
586
+            LoadingThread = new Thread(() =>
587
+            {
588
+                if (Globals.SessionMode == SessionModes.Online)
589
+                {
590
+                    Utility.SyncAllBatches();
591
+                    Invoke(new Action(() =>
592
+                    {
593
+                        PopulateGrid();
594
+                    }));
595
+                }
596
+            });
597
+            LoadingThread.Start();
598
+        }
583 599
     }
584 600
 }

+ 3 - 0
BulkPrinting/BulkPrinting/BatchForm.resx

@@ -123,6 +123,9 @@
123 123
   <metadata name="LogoutTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124 124
     <value>277, 17</value>
125 125
   </metadata>
126
+  <metadata name="ReSyncTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127
+    <value>398, 3</value>
128
+  </metadata>
126 129
   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
127 130
     <value>25</value>
128 131
   </metadata>

+ 1 - 1
BulkPrinting/BulkPrinting/Printer.cs

@@ -247,7 +247,7 @@ namespace BulkPrinting
247 247
             public static int OrderDate = 0;
248 248
             public static int OrderReference = 90;
249 249
             public static int User = 170;
250
-            public static int OrderItems = 270;
250
+            public static int OrderItems = 290;
251 251
             public static int QtyOrdered = 430;
252 252
             public static int QtyDelivered = 500;
253 253
             public static int Cost = 580;

+ 35 - 10
BulkPrinting/BulkPrinting/VoucherForm.Designer.cs

@@ -45,9 +45,12 @@
45 45
             this.numStartSeqNo = new System.Windows.Forms.NumericUpDown();
46 46
             this.numEndSeqNo = new System.Windows.Forms.NumericUpDown();
47 47
             this.btnSearch = new System.Windows.Forms.Button();
48
+            this.numBatchId = new System.Windows.Forms.NumericUpDown();
49
+            this.label2 = new System.Windows.Forms.Label();
48 50
             ((System.ComponentModel.ISupportInitialize)(this.dgvVouchers)).BeginInit();
49 51
             ((System.ComponentModel.ISupportInitialize)(this.numStartSeqNo)).BeginInit();
50 52
             ((System.ComponentModel.ISupportInitialize)(this.numEndSeqNo)).BeginInit();
53
+            ((System.ComponentModel.ISupportInitialize)(this.numBatchId)).BeginInit();
51 54
             this.SuspendLayout();
52 55
             // 
53 56
             // dgvVouchers
@@ -131,7 +134,7 @@
131 134
             // dtpStartDate
132 135
             // 
133 136
             this.dtpStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
134
-            this.dtpStartDate.Location = new System.Drawing.Point(231, 40);
137
+            this.dtpStartDate.Location = new System.Drawing.Point(353, 39);
135 138
             this.dtpStartDate.Name = "dtpStartDate";
136 139
             this.dtpStartDate.Size = new System.Drawing.Size(100, 20);
137 140
             this.dtpStartDate.TabIndex = 10;
@@ -140,7 +143,7 @@
140 143
             // dtpEndDate
141 144
             // 
142 145
             this.dtpEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
143
-            this.dtpEndDate.Location = new System.Drawing.Point(388, 40);
146
+            this.dtpEndDate.Location = new System.Drawing.Point(510, 39);
144 147
             this.dtpEndDate.Name = "dtpEndDate";
145 148
             this.dtpEndDate.Size = new System.Drawing.Size(100, 20);
146 149
             this.dtpEndDate.TabIndex = 10;
@@ -148,7 +151,7 @@
148 151
             // 
149 152
             // txtSerial
150 153
             // 
151
-            this.txtSerial.Location = new System.Drawing.Point(198, 86);
154
+            this.txtSerial.Location = new System.Drawing.Point(320, 85);
152 155
             this.txtSerial.Name = "txtSerial";
153 156
             this.txtSerial.Size = new System.Drawing.Size(290, 20);
154 157
             this.txtSerial.TabIndex = 11;
@@ -157,7 +160,7 @@
157 160
             // 
158 161
             this.lblBatch1.AutoSize = true;
159 162
             this.lblBatch1.ForeColor = System.Drawing.Color.White;
160
-            this.lblBatch1.Location = new System.Drawing.Point(195, 65);
163
+            this.lblBatch1.Location = new System.Drawing.Point(317, 64);
161 164
             this.lblBatch1.Name = "lblBatch1";
162 165
             this.lblBatch1.Size = new System.Drawing.Size(30, 13);
163 166
             this.lblBatch1.TabIndex = 12;
@@ -168,7 +171,7 @@
168 171
             // 
169 172
             this.label3.AutoSize = true;
170 173
             this.label3.ForeColor = System.Drawing.Color.White;
171
-            this.label3.Location = new System.Drawing.Point(195, 42);
174
+            this.label3.Location = new System.Drawing.Point(317, 41);
172 175
             this.label3.Name = "label3";
173 176
             this.label3.Size = new System.Drawing.Size(30, 13);
174 177
             this.label3.TabIndex = 12;
@@ -179,7 +182,7 @@
179 182
             // 
180 183
             this.label4.AutoSize = true;
181 184
             this.label4.ForeColor = System.Drawing.Color.White;
182
-            this.label4.Location = new System.Drawing.Point(362, 42);
185
+            this.label4.Location = new System.Drawing.Point(484, 41);
183 186
             this.label4.Name = "label4";
184 187
             this.label4.Size = new System.Drawing.Size(20, 13);
185 188
             this.label4.TabIndex = 12;
@@ -190,7 +193,7 @@
190 193
             // 
191 194
             this.lblBatch2.AutoSize = true;
192 195
             this.lblBatch2.ForeColor = System.Drawing.Color.White;
193
-            this.lblBatch2.Location = new System.Drawing.Point(362, 65);
196
+            this.lblBatch2.Location = new System.Drawing.Point(484, 64);
194 197
             this.lblBatch2.Name = "lblBatch2";
195 198
             this.lblBatch2.Size = new System.Drawing.Size(20, 13);
196 199
             this.lblBatch2.TabIndex = 12;
@@ -199,7 +202,7 @@
199 202
             // 
200 203
             // numStartSeqNo
201 204
             // 
202
-            this.numStartSeqNo.Location = new System.Drawing.Point(231, 63);
205
+            this.numStartSeqNo.Location = new System.Drawing.Point(353, 62);
203 206
             this.numStartSeqNo.Name = "numStartSeqNo";
204 207
             this.numStartSeqNo.Size = new System.Drawing.Size(100, 20);
205 208
             this.numStartSeqNo.TabIndex = 14;
@@ -207,7 +210,7 @@
207 210
             // 
208 211
             // numEndSeqNo
209 212
             // 
210
-            this.numEndSeqNo.Location = new System.Drawing.Point(388, 63);
213
+            this.numEndSeqNo.Location = new System.Drawing.Point(510, 62);
211 214
             this.numEndSeqNo.Name = "numEndSeqNo";
212 215
             this.numEndSeqNo.Size = new System.Drawing.Size(100, 20);
213 216
             this.numEndSeqNo.TabIndex = 14;
@@ -218,19 +221,38 @@
218 221
             this.btnSearch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
219 222
             this.btnSearch.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnSearch.BackgroundImage")));
220 223
             this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
221
-            this.btnSearch.Location = new System.Drawing.Point(494, 3);
224
+            this.btnSearch.Location = new System.Drawing.Point(616, 2);
222 225
             this.btnSearch.Name = "btnSearch";
223 226
             this.btnSearch.Size = new System.Drawing.Size(100, 100);
224 227
             this.btnSearch.TabIndex = 13;
225 228
             this.btnSearch.UseVisualStyleBackColor = false;
226 229
             this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
227 230
             // 
231
+            // numBatchId
232
+            // 
233
+            this.numBatchId.Location = new System.Drawing.Point(242, 62);
234
+            this.numBatchId.Name = "numBatchId";
235
+            this.numBatchId.Size = new System.Drawing.Size(69, 20);
236
+            this.numBatchId.TabIndex = 15;
237
+            // 
238
+            // label2
239
+            // 
240
+            this.label2.AutoSize = true;
241
+            this.label2.ForeColor = System.Drawing.Color.White;
242
+            this.label2.Location = new System.Drawing.Point(187, 65);
243
+            this.label2.Name = "label2";
244
+            this.label2.Size = new System.Drawing.Size(49, 13);
245
+            this.label2.TabIndex = 16;
246
+            this.label2.Text = "Batch ID";
247
+            // 
228 248
             // VoucherForm
229 249
             // 
230 250
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
231 251
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
232 252
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
233 253
             this.ClientSize = new System.Drawing.Size(728, 554);
254
+            this.Controls.Add(this.label2);
255
+            this.Controls.Add(this.numBatchId);
234 256
             this.Controls.Add(this.numEndSeqNo);
235 257
             this.Controls.Add(this.numStartSeqNo);
236 258
             this.Controls.Add(this.btnSearch);
@@ -255,6 +277,7 @@
255 277
             ((System.ComponentModel.ISupportInitialize)(this.dgvVouchers)).EndInit();
256 278
             ((System.ComponentModel.ISupportInitialize)(this.numStartSeqNo)).EndInit();
257 279
             ((System.ComponentModel.ISupportInitialize)(this.numEndSeqNo)).EndInit();
280
+            ((System.ComponentModel.ISupportInitialize)(this.numBatchId)).EndInit();
258 281
             this.ResumeLayout(false);
259 282
             this.PerformLayout();
260 283
 
@@ -278,5 +301,7 @@
278 301
         private System.Windows.Forms.Button btnSearch;
279 302
         private System.Windows.Forms.NumericUpDown numStartSeqNo;
280 303
         private System.Windows.Forms.NumericUpDown numEndSeqNo;
304
+        private System.Windows.Forms.NumericUpDown numBatchId;
305
+        private System.Windows.Forms.Label label2;
281 306
     }
282 307
 }

+ 5 - 2
BulkPrinting/BulkPrinting/VoucherForm.cs

@@ -24,6 +24,9 @@ namespace BulkPrinting
24 24
 
25 25
         private void VoucherForm_Load(object sender, EventArgs e)
26 26
         {
27
+            numBatchId.Maximum = int.MaxValue;
28
+            numStartSeqNo.Maximum = int.MaxValue;
29
+            numEndSeqNo.Maximum = int.MaxValue;
27 30
             if (BatchID > 0)
28 31
             {
29 32
                 rdoVoucherRange.Show();
@@ -31,7 +34,7 @@ namespace BulkPrinting
31 34
                 lblBatch2.Show();
32 35
                 numStartSeqNo.Show();
33 36
                 numEndSeqNo.Show();
34
-                rdoVoucherRange.Text = "Vouchers in Selected Batch(" + BatchID.ToString() + "):";
37
+                numBatchId.Value = BatchID;
35 38
             }
36 39
             else {
37 40
                 rdoVoucherRange.Hide();
@@ -62,7 +65,7 @@ namespace BulkPrinting
62 65
             else if (rdoVoucherRange.Checked) {
63 66
                 Sql = "SELECT BatchId, Serial, SequenceNumber, ExpiryDate, EncryptedPIN FROM Voucher WHERE BatchId = @batchid AND SequenceNumber BETWEEN @minseqno AND @maxseqno";
64 67
                 Command = new SQLiteCommand(Sql, Globals.DBConnection);
65
-                Command.Parameters.Add(new SQLiteParameter("@batchid", BatchID));
68
+                Command.Parameters.Add(new SQLiteParameter("@batchid", numBatchId.Value));
66 69
                 Command.Parameters.Add(new SQLiteParameter("@minseqno", numStartSeqNo.Value));
67 70
                 Command.Parameters.Add(new SQLiteParameter("@maxseqno", numEndSeqNo.Value));
68 71
             }