|
@@ -81,6 +81,13 @@
|
81
|
81
|
<label>Max:</label>
|
82
|
82
|
<line id="maxroastweight" writable="false" />
|
83
|
83
|
</layout>
|
|
84
|
+ <label>Degree of Roast</label>
|
|
85
|
+ <label>Whole Bean:</label>
|
|
86
|
+ <roastcoloredit id="wholecolor" />
|
|
87
|
+ <label id="wholespec">-</label>
|
|
88
|
+ <label>Ground:</label>
|
|
89
|
+ <roastcoloredit id="groundcolor" />
|
|
90
|
+ <label id="groundspec">-</label>
|
84
|
91
|
<label>Specification Details</label>
|
85
|
92
|
<textarea id="specnotes" />
|
86
|
93
|
<layout type="horizontal">
|
|
@@ -322,6 +329,8 @@
|
322
|
329
|
});
|
323
|
330
|
var profilebutton = findChildObject(this, 'load');
|
324
|
331
|
profilebutton.setEnabled(false);
|
|
332
|
+ var wholespec = findChildObject(this, 'wholespec');
|
|
333
|
+ var groundspec = findChildObject(this, 'groundspec');
|
325
|
334
|
roasted['currentIndexChanged(int)'].connect(function() {
|
326
|
335
|
table.clear();
|
327
|
336
|
var query = new QSqlQuery();
|
|
@@ -383,7 +392,7 @@
|
383
|
392
|
}
|
384
|
393
|
}
|
385
|
394
|
}
|
386
|
|
- query.prepare("SELECT loss, tolerance, notes FROM roasting_specification WHERE item = :id1 AND time = (SELECT max(time) FROM roasting_specification WHERE item = :id2)");
|
|
395
|
+ query.prepare("SELECT loss, tolerance, notes, spec FROM roasting_specification WHERE item = :id1 AND time = (SELECT max(time) FROM roasting_specification WHERE item = :id2)");
|
387
|
396
|
query.bind(":id1", roasted.currentData());
|
388
|
397
|
query.bind(":id2", roasted.currentData());
|
389
|
398
|
query.exec();
|
|
@@ -405,12 +414,40 @@
|
405
|
414
|
}
|
406
|
415
|
lossspec.text = lossSpecDescription;
|
407
|
416
|
specnotes.plainText = query.value(2);
|
|
417
|
+ if(query.value(3).length > 0) {
|
|
418
|
+ var spec = JSON.parse(query.value(3));
|
|
419
|
+ var wholespectext = "";
|
|
420
|
+ var groundspectext = "";
|
|
421
|
+ if(spec.color.whole.expected != undefined) {
|
|
422
|
+ wholespectext += spec.color.whole.expected;
|
|
423
|
+ if(spec.color.whole.tolerance != undefined) {
|
|
424
|
+ wholespectext += " +/- " + spec.color.whole.tolerance;
|
|
425
|
+ }
|
|
426
|
+ wholespec.text = wholespectext;
|
|
427
|
+ } else {
|
|
428
|
+ wholespec.text = "";
|
|
429
|
+ }
|
|
430
|
+ if(spec.color.ground.expected != undefined) {
|
|
431
|
+ groundspectext += spec.color.ground.expected;
|
|
432
|
+ if(spec.color.ground.tolerance != undefined) {
|
|
433
|
+ groundspectext += " +/- " + spec.color.ground.tolerance;
|
|
434
|
+ }
|
|
435
|
+ groundspec.text = groundspectext;
|
|
436
|
+ } else {
|
|
437
|
+ groundspec.text = "";
|
|
438
|
+ }
|
|
439
|
+ } else {
|
|
440
|
+ wholespec.text = "";
|
|
441
|
+ groundspec.text = "";
|
|
442
|
+ }
|
408
|
443
|
} else {
|
409
|
444
|
lossspec.text = "";
|
410
|
445
|
specnotes.plainText = "";
|
|
446
|
+ wholespec.text = "";
|
|
447
|
+ groundspec.text = "";
|
411
|
448
|
}
|
412
|
449
|
query = query.invalidate();
|
413
|
|
- drawTag();
|
|
450
|
+ drawTag();
|
414
|
451
|
});
|
415
|
452
|
var validateCapacity = function() {
|
416
|
453
|
if(checkCapacity == "true") {
|
|
@@ -588,6 +625,8 @@
|
588
|
625
|
file.remove();
|
589
|
626
|
drawTag();
|
590
|
627
|
}
|
|
628
|
+ var wholecolor = findChildObject(this, 'wholecolor');
|
|
629
|
+ var groundcolor = findChildObject(this, 'groundcolor');
|
591
|
630
|
var doSubmit = function() {
|
592
|
631
|
checkQuery = new QSqlQuery();
|
593
|
632
|
checkQuery.exec("SELECT 1 FROM machine WHERE id = " + selectedRoasterID);
|
|
@@ -601,7 +640,7 @@
|
601
|
640
|
checkQuery = checkQuery.invalidate();
|
602
|
641
|
query = new QSqlQuery();
|
603
|
642
|
var fileno = Number(filenofield.text);
|
604
|
|
- var q2 = "INSERT INTO roasting_log (time, unroasted_id, unroasted_quantity, unroasted_total_quantity, roasted_id, roasted_quantity, transaction_type, annotation, machine, duration, approval, humidity, barometric, indoor_air, outdoor_air, files, person) VALUES(:time, ";
|
|
643
|
+ var q2 = "INSERT INTO roasting_log (time, unroasted_id, unroasted_quantity, unroasted_total_quantity, roasted_id, roasted_quantity, transaction_type, annotation, machine, duration, approval, humidity, barometric, indoor_air, outdoor_air, files, person, additional_data) VALUES(:time, ";
|
605
|
644
|
q2 = q2 + table.columnArray(0, 32);
|
606
|
645
|
q2 = q2 + ", ";
|
607
|
646
|
for(var i = 0; table.data(i, 1, 0).value != ""; i++)
|
|
@@ -619,14 +658,26 @@
|
619
|
658
|
q2 = q2 + selectedRoasterID;
|
620
|
659
|
q2 = q2 + ", :duration, :approval, NULL, NULL, NULL, NULL, '{";
|
621
|
660
|
q2 = q2 + fileno;
|
622
|
|
- q2 = q2 + "}', :user) RETURNING time";
|
|
661
|
+ q2 = q2 + "}', :user, :extradata) RETURNING time";
|
623
|
662
|
query2 = new QSqlQuery();
|
624
|
663
|
query2.prepare(q2);
|
625
|
664
|
query2.bind(":time", timefield.text);
|
626
|
665
|
query2.bind(":annotation", notes.plainText);
|
627
|
666
|
query2.bind(":duration", duration.text);
|
628
|
667
|
query2.bind(":approval", approval.checked);
|
629
|
|
- query2.bind(":user", Application.currentTypicaUser());
|
|
668
|
+ query2.bind(":user", Application.currentTypicaUser());
|
|
669
|
+ var extradata = new Object;
|
|
670
|
+ var colordata = new Object;
|
|
671
|
+ if(wholecolor.text.length > 0) {
|
|
672
|
+ colordata.whole = wholecolor.text;
|
|
673
|
+ }
|
|
674
|
+ if(groundcolor.text.length > 0) {
|
|
675
|
+ colordata.ground = groundcolor.text;
|
|
676
|
+ }
|
|
677
|
+ if(colordata.whole || colordata.ground) {
|
|
678
|
+ extradata.color = colordata;
|
|
679
|
+ }
|
|
680
|
+ query2.bind(":extradata", JSON.stringify(extradata));
|
630
|
681
|
query2.exec();
|
631
|
682
|
if(!query2.next()) {
|
632
|
683
|
displayError(TTR("batchWindow", "Database Insert Failed"), TTR("batchWindow", "Failed to save batch to database. Please check inputs and connection and try again."));
|