411 lines
17 KiB
JavaScript
411 lines
17 KiB
JavaScript
|
|
let DBSACHEN = "php/DBSachen.php";
|
|
var DB = new Object();
|
|
|
|
// region externe funktionen/methoden
|
|
|
|
// nur schauen, ob das bauteil schon in der Tabelle um zu entscheiden
|
|
// on ein INSERT oder ein UPDATE gefahren werden muss
|
|
DB.getBauteilStatusNew = function(txlcode) {
|
|
|
|
myJSON = { func: "getBauteilStatusNew", TXLCode: txlcode };
|
|
bauteilSchonInDBJSON = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return bauteilSchonInDBJSON.responseText;
|
|
|
|
}
|
|
|
|
/** GETBAUTEILSTATUS
|
|
* erwartet TXLCode
|
|
* gibt -1, 0, 1 oder 2 zurueck
|
|
*
|
|
* -1 - undefinierter Fehler
|
|
* 0 - Bauteil in DB und ohne Messwerte
|
|
* 1 - Bauteil in DB und schon gemessen
|
|
* 2 - Bauteil nicht in DB vorhanden
|
|
*
|
|
**/
|
|
DB.getBauteilStatus = function(txlcode) {
|
|
data = getMesswertStatusJSON(txlcode);
|
|
try{
|
|
arr = JSON.parse(data.responseText);
|
|
if ( arr[0] === "n" && arr[1] === "u" && arr[2] === "l" && arr[3] === "l" ) {
|
|
if ( DEBUGmany ) { console.log("dbsachen.js: Bauteilstatus von " + txlcode + ": 2 (n. in DB)"); }
|
|
return 2;
|
|
} else if ( arr[0] === "0" && arr[1] === "0" && arr[2] === "0" && arr[3] === "0" ) {
|
|
if ( DEBUGmany ) { console.log("dbsachen.js: Bauteilstatus von " + txlcode + ": 0 (in DB ohne Messwerte)"); }
|
|
return 0;
|
|
} else {
|
|
if ( DEBUGmany ) { console.log("dbsachen.js: Bauteilstatus von " + txlcode + ": 1 (schon gemessen)"); }
|
|
return 1;
|
|
}
|
|
} catch(e) {
|
|
console.log("dbsachen.js: Fehler in Funktion getBauteilStatus:\n" + e.name + "\n" + e.message);
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
/** Aktualisiere die Bauteile mit der zugeordneten Nummer der Lieferbox
|
|
*
|
|
*
|
|
*
|
|
*/
|
|
DB.updateBauteilLieferbox = function(dataArr) {
|
|
myJSON = {
|
|
func: "updateBauteilLieferbox",
|
|
newBoxNr: dataArr[0],
|
|
part1: dataArr[1],
|
|
part2: dataArr[2],
|
|
part3: dataArr[3],
|
|
part4: dataArr[4],
|
|
part5: dataArr[5],
|
|
part6: dataArr[6],
|
|
part7: dataArr[7],
|
|
part8: dataArr[8],
|
|
part9: dataArr[9]
|
|
};
|
|
responseJSON = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return responseJSON.responseText;
|
|
}
|
|
|
|
/** LADE LETZTE BELADUNG
|
|
* holt die TXLCodes und SchottOrderNummern aus der DB,
|
|
* erhoeht die TXLCodes um 1 und traegt die neuen TXLCodes
|
|
* und SONs in die einzelnen felder ein
|
|
*
|
|
*/
|
|
DB.loadLetzteBeladung = function(ofenname) {
|
|
myJSON = { func: "letzteBeladung", ofenname: ofenname };
|
|
letzteBeladungJSON = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return letzteBeladungJSON.responseText;
|
|
}
|
|
|
|
DB.getBauteile = function(bauteiltyp) {
|
|
myJSON = { func: "getBauteile", bauteiltyp: bauteiltyp };
|
|
bauteileJSON = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return bauteileJSON.responseText;
|
|
}
|
|
|
|
DB.getLastBoxNr = function(flavor) {
|
|
myJSON = { func: "getLastBoxNr", flavor: flavor };
|
|
JSONres = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return JSONres.responseText;
|
|
}
|
|
|
|
DB.getBauteilLieferbox = function(txlcode) {
|
|
myJSON = { func: "getBauteilLieferbox", TXLCode: txlcode };
|
|
JSONres = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return JSONres.responseText;
|
|
}
|
|
|
|
DB.getBoxinhalte = function(flavor) {
|
|
myJSON = { func: "getBoxinhalte", flavor: flavor };
|
|
JSONres = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return JSONres.responseText;
|
|
}
|
|
DB.getAllBoxNr = function(flavor) {
|
|
myJSON = { func: "getAllBoxNr", flavor: flavor };
|
|
JSONres = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return JSONres.responseText;
|
|
}
|
|
|
|
DB.getBoxMesswerte = function(flavor, boxNr) {
|
|
myJSON = {
|
|
func: "getBoxMesswerte",
|
|
flavor: flavor,
|
|
boxNr: boxNr
|
|
};
|
|
JSONres = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return JSONres.responseText;
|
|
}
|
|
|
|
DB.getSingleBoxinhalt = function(flavor, boxNr) {
|
|
myJSON = {
|
|
func: "getSingleBoxinhalt",
|
|
flavor: flavor,
|
|
boxNr: boxNr
|
|
};
|
|
JSONres = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return JSONres.responseText;
|
|
}
|
|
|
|
DB.getOldBauteile = function(flavor, limit, startFrom) {
|
|
myJSON = {
|
|
func: "getAllOldBauteile",
|
|
flavor: flavor,
|
|
limit: limit,
|
|
startFrom: startFrom
|
|
};
|
|
JSONres = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return JSONres.responseText;
|
|
}
|
|
|
|
|
|
DB.insertBox = function(myJSON) {
|
|
insertBoxJSON = $.ajax({
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON) },
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
console.log("DB.insertbox:insertBoxJSON: " + insertBoxJSON);
|
|
return insertBoxJSON.responseText;
|
|
|
|
}
|
|
|
|
/** BELADUNG EINTRAGEN
|
|
* erwartet ein assoz. Array/Object, welches dann in ein JSON gewandelt
|
|
* und an DBSachen.php weiter gereicht wird, welches dann die eintraege
|
|
* validiert und in die DB eintraegt
|
|
**/
|
|
DB.insertBeladung = function(myJSON) {
|
|
$.post(DBSACHEN, {
|
|
json: JSON.stringify(myJSON)
|
|
},
|
|
function(data, status) {
|
|
if (status == "success") {
|
|
console.log("returned data: " + data);
|
|
if ( data.substring(0, 15) === "Execute failed:") {
|
|
swal("Fehler", "Der MySQL-Server meldete einen Fehler:\n" + data, "error");
|
|
} else if ( $.isNumeric(data) ) {
|
|
swal("Fertig", "Beladung mit " + data + " Teilen wurde eingetragen.", "success");
|
|
}
|
|
} else {
|
|
swal("Fehler", "Fehler beim eintragen der Beladung. Status: " + status + "\nFunc dbsachen.js->insertBeladung", "error");
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
DB.updateMesswerteGeneric = function(messwertJSON){
|
|
response = $.ajax(
|
|
{
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(messwertJSON)},
|
|
async: false,
|
|
method: "POST"
|
|
}
|
|
);
|
|
return response;
|
|
}
|
|
|
|
DB.sendJSONGeneric = function(myJSON){
|
|
response = $.ajax(
|
|
{
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON)},
|
|
async: false,
|
|
method: "POST"
|
|
}
|
|
);
|
|
return response;
|
|
}
|
|
|
|
|
|
/** BELADUNG EINTRAGEN
|
|
* sammelt alle eintraege des belade-formumars und gibt sie
|
|
* an DBSachen.php weiter, welches dann die eintraege validiert und
|
|
* in die DB eintraegt
|
|
**/
|
|
DB.insertBeladungKF480 = function () {
|
|
/* TODO:
|
|
* debug-ausgaben zu showErrorMSG()
|
|
*/
|
|
var fehlendeSON = 0;
|
|
var fehlerhafteCodes = 0;
|
|
var eingetrageneTeile = 0;
|
|
myJSON = new Object();
|
|
myJSON = $('form').serializeObject();
|
|
if (myJSON.tbE01KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE01KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON01KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE02KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE02KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON02KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE03KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE03KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON03KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE04KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE04KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON04KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE05KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE05KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON05KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE06KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE06KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON06KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE07KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE07KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON07KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE08KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE08KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON08KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE09KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE09KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON09KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE10KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE10KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON10KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE11KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE11KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON11KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE12KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE12KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON12KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE13KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE13KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON13KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE14KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE14KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON14KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE15KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE15KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON15KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE16KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE16KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON16KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE17KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE17KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON17KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE18KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE18KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON18KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE19KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE19KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON19KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE20KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE20KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON20KF480 === "") { fehlendeSON += 1; } }
|
|
if (eingetrageneTeile === 0) { alert("Eine Leerfahrt?"); }
|
|
if (fehlendeSON > 0) { alert("Fehlende Schott-Order-Nummern - bitte bereinigen"); }
|
|
if (fehlerhafteCodes > 0) { alert("Falscher Code - bitte bereinigen"); }
|
|
if ( DEBUG ) { console.log(
|
|
"teile:" + eingetrageneTeile + "\n" +
|
|
"fehlSON:" + fehlendeSON + "\n" +
|
|
"fehlCodes:" + fehlerhafteCodes
|
|
);
|
|
}
|
|
|
|
if (fehlendeSON === 0 && fehlerhafteCodes === 0 && eingetrageneTeile > 0) {
|
|
$.post(DBSACHEN, {
|
|
json: JSON.stringify(myJSON)
|
|
},
|
|
function(data, status) {
|
|
if (status == "success") {
|
|
if ( DEBUGmany ) { console.log("returned data: " + data.substring(0, 15)); }
|
|
if ( data.substring(0, 15) === "Execute failed:") {
|
|
showErrorModal("MySQL-Fehler", "Es trat ein Fehler beim SQL-Query auf:\n" + data, "");
|
|
} else if ( $.isNumeric(data) ) {
|
|
showErrorModal("Eingetragen", "Beladung mit " + data + " Teilen wurde eingetragen.", "");
|
|
}
|
|
} else {
|
|
showErrorModal("Fehler", "Fehler beim Eintragen der Beladung. Status:" + status, "");
|
|
}
|
|
});
|
|
if ( DEBUG ) { console.log(JSON.stringify(myJSON)); }
|
|
}
|
|
|
|
}
|
|
|
|
|
|
DB.insertBeladungKF80 = function () {
|
|
/* TODO:
|
|
* debug-ausgaben zu showErrorMSG()
|
|
*/
|
|
var fehlendeSON = 0;
|
|
var fehlerhafteCodes = 0;
|
|
var eingetrageneTeile = 0;
|
|
myJSON = new Object();
|
|
myJSON = $('form').serializeObject();
|
|
if (myJSON.tbE01KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE01KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON01KF80 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE02KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE02KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON02KF80 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE03KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE03KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON03KF80 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE04KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE04KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON04KF80 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE05KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE05KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON05KF80 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE06KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE06KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON06KF80 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE07KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE07KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON07KF80 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE08KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE08KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON08KF80 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE09KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE09KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON09KF80 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE10KF80 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE10KF80) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON10KF80 === "") { fehlendeSON += 1; } }
|
|
/*
|
|
if (myJSON.tbE11KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE11KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON11KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE12KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE12KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON12KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE13KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE13KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON13KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE14KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE14KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON14KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE15KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE15KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON15KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE16KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE16KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON16KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE17KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE17KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON17KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE18KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE18KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON18KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE19KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE19KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON19KF480 === "") { fehlendeSON += 1; } }
|
|
if (myJSON.tbE20KF480 !== "") { eingetrageneTeile += 1; if (helper.looksLikeTXLCode(myJSON.tbE20KF480) > 0) { fehlerhafteCodes += 1; } if (myJSON.SON20KF480 === "") { fehlendeSON += 1; } }
|
|
*/
|
|
if (eingetrageneTeile === 0) { showErrorModal("Netter Versuch", "Eine Leerfahrt?", "eine Beladung ohne Bauteile kann nicht eingetragen werden"); }
|
|
if (fehlendeSON > 0) { showErrorModal("Da wurde was vergessen", "Fehlende Schott-Order-Nummern - bitte bereinigen", "Wir müssen doch die Teile zurückverfolgen können ... auch wenn's nervt."); }
|
|
if (fehlerhafteCodes > 0) { showErrorModal("Tippfehler?", "Falscher Code - bitte bereinigen", "Da hat sich wohl ein falscher Trixell-Code eingschlichen. Schau nochmal drüber."); }
|
|
console.log(
|
|
"teile:" + eingetrageneTeile + "\n" +
|
|
"fehlSON:" + fehlendeSON + "\n" +
|
|
"fehlCodes:" + fehlerhafteCodes
|
|
);
|
|
if (fehlendeSON === 0 && fehlerhafteCodes === 0 && eingetrageneTeile > 0) {
|
|
$.post(DBSACHEN, {
|
|
json: JSON.stringify(myJSON)
|
|
},
|
|
function(data, status) {
|
|
if (status == "success") {
|
|
console.log("returned data: " + data.substring(0, 15));
|
|
if ( data.substring(0, 15) === "Execute failed:") {
|
|
showErrorModal("MySQL-Fehler", "<b>Es trat ein Fehler beim SQL-Query auf:</b>\n" + data, "Mögliche Fehler wären: \n(1062) Duplicate entry: Doppeltes Bauteil");
|
|
} else if ( $.isNumeric(data) ) {
|
|
showErrorModal("Eingetragen", "Beladung mit " + data + " Teilen wurde eingetragen.", "");
|
|
}
|
|
} else {
|
|
showErrorModal("Fehler", "Fehler beim Eintragen der Beladung. Status:" + status, "");
|
|
}
|
|
});
|
|
if ( DEBUG ) { console.log(JSON.stringify(myJSON)); }
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// end region externe funktionen/methoden
|
|
|
|
|
|
// region interne Funktionen
|
|
|
|
|
|
|
|
function getMesswertStatusJSON(txlcode) {
|
|
var myJSON = {
|
|
"func" : "getMesswertStatus",
|
|
"TXLCode" : txlcode
|
|
};
|
|
response = $.ajax(
|
|
{
|
|
url: DBSACHEN,
|
|
data: { json: JSON.stringify(myJSON)},
|
|
async: false,
|
|
method: "POST"
|
|
});
|
|
return response;
|
|
}
|
|
|
|
|
|
// end region
|