Neal Wilson 9 yıl önce
ebeveyn
işleme
886a2aadb8
1 değiştirilmiş dosya ile 34 ekleme ve 4 silme
  1. 34
    4
      config/Windows/newsamplebatch.xml

+ 34
- 4
config/Windows/newsamplebatch.xml Dosyayı Görüntüle

@@ -179,7 +179,26 @@
179 179
 			stop.clicked.connect(function() {
180 180
 				submit.setEnabled(true);
181 181
 			});
182
-			roastButton.clicked.connect(function() {
182
+                        var validateCapacity = function() {
183
+                            if(checkCapacity == "true") {
184
+                                if(convertToPounds(parseFloat(green.text), GunitBox.currentText) > poundsCapacity) {
185
+                                    return false;
186
+                                }
187
+                            }
188
+                            return true;
189
+                        }
190
+                        roastButton.clicked.connect(function() {
191
+                            var proceed = false;
192
+                            if(validateCapacity()) {
193
+                                proceed = true;
194
+                            } else {
195
+                                proceed = displayWarning("Suspicious Input", "Entered green coffee weight exceeds maximum batch size. Continue?");
196
+                            }
197
+                            if(proceed) {
198
+                                doRoast();
199
+                            }
200
+                        });
201
+                        var doRoast = function() {
183 202
 				var lc = 1;
184 203
 				currentBatchInfo = batch;
185 204
 				query = new QSqlQuery();
@@ -242,7 +261,7 @@
242 261
 					t = t + ", " + profileName.currentText;
243 262
 				}
244 263
 				navigationwindow.loggingWindow.windowTitle = t;
245
-			});
264
+			};
246 265
 			var notes = findChildObject(this, 'annotation');
247 266
 			var machine = findChildObject(this, 'machine');
248 267
 			var duration = findChildObject(this, 'duration');
@@ -250,7 +269,18 @@
250 269
 			var vendor = findChildObject(this, 'vendor');
251 270
 			var attributes = findChildObject(this, 'attributes');
252 271
 			var target = findChildObject(this, 'target');
253
-			submit.clicked.connect(function() {
272
+                        submit.clicked.connect(function() {
273
+                            var proceed = false;
274
+                            if(validateCapacity()) {
275
+                                proceed = true;
276
+                            } else {
277
+                                proceed = displayWarning("Suspicious Input", "Entered green coffee weight exceeds maximum batch size. Continue?");
278
+                            }
279
+                            if(proceed) {
280
+                                doLoadProfile();
281
+                            }
282
+                        });
283
+                        var doSubmit = function() {
254 284
 				query = new QSqlQuery();
255 285
 				query.prepare("INSERT INTO files (id, name, type, note, file) VALUES(DEFAULT, :name, 'profile', NULL, :data) RETURNING id");
256 286
 				query.bind(":name", timefield.text + " " + name.text + " " + profileName.currentText);
@@ -328,7 +358,7 @@
328 358
 				query.exec();
329 359
 				query = query.invalidate();
330 360
 				batch.close();
331
-			});
361
+			}
332 362
 		]]>
333 363
 	</program>
334 364
 </window>

Loading…
İptal
Kaydet