746 lines
34 KiB
PHP
746 lines
34 KiB
PHP
<?php
|
|
|
|
if(isset($_POST["json"])) {
|
|
$JSON = $_POST["json"];
|
|
$arr = json_decode($JSON, true);
|
|
|
|
if ($arr["func"] == "createBauteil") { createBauteil($arr["TXLCode"], $arr["Abformdatum"], $arr["Ofen"], $arr["Ofenposition"], $arr["AbformComm"], $arr["SchottOrderNr"]); }
|
|
if ($arr["func"] == "letzteBeladung") { letzteBeladung($arr["ofenname"]); }
|
|
if ($arr["func"] == "newVersandBox") { insertNewVersandBox($arr); }
|
|
if ($arr["func"] == "updateBauteilLieferbox") { updateBauteilLieferbox($arr); }
|
|
if ($arr["func"] == "updateBauteilRauheiten") { updateBauteilRauheiten($arr); }
|
|
if ($arr["func"] == "update2121to2121C"){ update2121to2121C($arr); }
|
|
if ($arr["func"] == "updateBauteilMesswerte") { updateBauteilMesswerte($arr); }
|
|
if ($arr["func"] == "getBoxinhalte") { getBoxinhalte($arr["flavor"]); }
|
|
if ($arr["func"] == "getSingleBoxinhalt") { getSingleBoxinhalt($arr["flavor"], $arr["boxNr"]); }
|
|
if ($arr["func"] == "getBauteile") { getBauteile($arr["bauteiltyp"]); }
|
|
if ($arr["func"] == "getBauteilArchiv") { getBauteilArchiv($arr["bauteiltyp"]); }
|
|
if ($arr["func"] == "getBauteilStatusNew") { getBauteilStatusNew($arr["TXLCode"]); }
|
|
if ($arr["func"] == "getBauteilLieferbox") { getBauteilLieferbox($arr["TXLCode"]); }
|
|
if ($arr["func"] == "getMesswertStatus" ) { getMesswertStatus($arr["TXLCode"]); }
|
|
if ($arr["func"] == "getMesswerte" ) { getMesswerte($arr["TXLCode"]); }
|
|
if ($arr["func"] == "getBoxMesswerte" ) { getBoxMesswerte($arr["flavor"], $arr["boxNr"]); }
|
|
if ($arr["func"] == "getLastBoxNr") { getLastBoxNr($arr["flavor"]); }
|
|
if ($arr["func"] == "getAllBoxNr") { getAllBoxNr($arr["flavor"]); }
|
|
if ($arr["func"] == "getAllOldBauteile") { getAllOldBauteile($arr); }
|
|
if ($arr["func"] == "insertBauteil") { echo "einfuegen"; }
|
|
if ($arr["func"] == "insertBeladung") {
|
|
if($arr["Ofen"] == "KF480") { insertBeladungKF480($arr); }
|
|
else if ($arr["Ofen"] == "KF80") { insertBeladungKF80($arr); }
|
|
else if ($arr["Ofen"] == "KF80S") { insertBeladungKF80S($arr); }
|
|
else { echo "Kein Ofen"; }
|
|
}
|
|
} else {
|
|
die('Erwarte $_POST["json"];'. "\nBekam:\n". var_dump($_POST));
|
|
}
|
|
|
|
function getBauteile($btTyp) {
|
|
// select * from Bauteile where TXLCode LIKE 'GW1%'
|
|
$db = get_dbc();
|
|
//$sql = "SELECT * FROM Bauteile WHERE TXLCode LIKE \"$btTyp%\";";
|
|
$sql = "SELECT id, TXLCode, status, Abformdatum, Messdatum, Rauheitsdatum, Lieferbox, Lieferdatum, geliefert, Ofen, SchottOrderNr FROM Bauteile WHERE TXLCode LIKE \"$btTyp%\";";
|
|
$result = $db->query($sql);
|
|
|
|
$rows=array();
|
|
|
|
while ($r = mysqli_fetch_assoc($result)) {
|
|
//$results[$row[0]]=$row;
|
|
$rows[] = $r;
|
|
}
|
|
//$result=$results;
|
|
echo json_encode($rows);
|
|
$db->close();
|
|
}
|
|
|
|
function getBauteilArchiv($btTyp) {
|
|
switch ( $btTyp) {
|
|
case '3040': $btTyp = "GW1"; break;
|
|
case '3030': $btTyp = "GX1"; break;
|
|
case '2121': $btTyp = "GA1"; break;
|
|
case '2121C': $btTyp = "GC1"; break;
|
|
}
|
|
|
|
$db = get_dbc();
|
|
$sql = "SELECT TXLCode, OL1, OL2, OW1, OW2, R11, R12, R13, R21, R22, R23, R31, R32, R33, R41, R42, R43, Messdatum, Rauheitsdatum FROM Bauteile WHERE TXLCode LIKE \"$btTyp%\" AND Messdatum > '0000-00-00 00:00:00';";
|
|
$result = $db->query($sql);
|
|
|
|
$rows=array();
|
|
|
|
while ($r = mysqli_fetch_assoc($result)) {
|
|
//$results[$row[0]]=$row;
|
|
$rows[] = $r;
|
|
}
|
|
//$result=$results;
|
|
echo json_encode($rows);
|
|
$db->close();
|
|
}
|
|
|
|
|
|
|
|
function getBauteilStatusNew($TXLCode){
|
|
$db = get_dbc();
|
|
$sql = "SELECT ID FROM Bauteile WHERE `TXLCode` = \"". $TXLCode ."\";";
|
|
$result = $db->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
$arrRowID = $result->fetch_assoc();
|
|
echo $arrRowID["ID"];
|
|
} else {
|
|
echo -1;
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
function getBauteilLieferbox($TXLCode){
|
|
$db = get_dbc();
|
|
$sql = "SELECT Lieferbox FROM Bauteile WHERE `TXLCode` = \"". $TXLCode ."\";";
|
|
$result = $db->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
$arrRowID = $result->fetch_assoc();
|
|
echo $arrRowID["Lieferbox"];
|
|
} else {
|
|
echo -1;
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
function update2121to2121C($arr){
|
|
$rowid = getRowID($arr["txlcode2121"], false);
|
|
if ($rowid != "NULL") {
|
|
$db = get_dbc();
|
|
$stmt = $db->prepare("UPDATE Bauteile SET TXLCode=? WHERE ID= ?;");
|
|
if (!$stmt) { die("\n\n $db->error \n\n"); }
|
|
$stmt->bind_param("si", $arr["txlcode2121C"], $rowid);
|
|
if (!$stmt->execute()) { echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error . "\n"; } else { echo "1"; }
|
|
$db->close();
|
|
} else {
|
|
echo "Keine RowID für ". $arr["txlcode2121"] ." gefunden.\n";
|
|
}
|
|
}
|
|
|
|
// "func":"newVersandBox",
|
|
// "tmpType":"3040",
|
|
// "newBoxNr":"409","revBox":0,"part1":"GW101010001","part2":"GW101010002","part3":"GW101010003","part4":"GW101010004","part5":"GW101010005","part6":"GW101010006","part7":"GW101010007","part8":"GW101010008","part9":"GW101010009","partCom1":"","partCom2":"","partCom3":"","partCom4":"","partCom5":"","partCom6":"","partCom7":"","partCom8":"","partCom9":""
|
|
|
|
function insertNewVersandBox($arr) {
|
|
$iRet = "true";
|
|
$comments = $arr["dateTime"] ." / ". $arr["partCom1"] .";". $arr["partCom2"] .";". $arr["partCom3"] .";". $arr["partCom4"] .";". $arr["partCom5"] .";". $arr["partCom6"] .";". $arr["partCom7"] .";". $arr["partCom8"] .";". $arr["partCom9"];
|
|
$db = get_dbc();
|
|
$stmt = $db->prepare("INSERT INTO InterneBoxen (BoxNrIntern, p1, p2, p3, p4, p5, p6, p7, p8, p9, Typ, RevBox, IntBoxComment) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
|
if (!$stmt) { die("\n\n $db->error \n\n"); }
|
|
$stmt->bind_param("issssssssssss", $arr["newBoxNr"], $arr["part1"], $arr["part2"], $arr["part3"], $arr["part4"], $arr["part5"], $arr["part6"], $arr["part7"], $arr["part8"], $arr["part9"], $arr["tmpType"], $arr["revBox"], $comments );
|
|
if (!$stmt->execute()) {
|
|
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error . "\n";
|
|
$iRet = "false";
|
|
} else {
|
|
$iRet = "true";
|
|
}
|
|
$db->close();
|
|
echo $iRet;
|
|
}
|
|
|
|
//
|
|
// aktualisiert den Bauteileintrag mit der Nummer der Lieferbox
|
|
//
|
|
function updateBauteilLieferbox($arr){
|
|
$retArr = array();
|
|
$db = get_dbc();
|
|
$bauteile = array($arr["part1"], $arr["part2"],$arr["part3"],$arr["part4"],$arr["part5"],$arr["part6"],$arr["part7"],$arr["part8"],$arr["part9"]);
|
|
#$db = get_dbc();
|
|
foreach ($bauteile as $bauteil) {
|
|
$updateStmt = $db->prepare("UPDATE Bauteile SET lieferbox=? WHERE `TXLCode` = ?;");
|
|
$updateStmt->bind_param("ss", $arr["newBoxNr"], $bauteil);
|
|
if (!$updateStmt->execute()) {
|
|
$retArr[$bauteil] = 0;
|
|
} else {
|
|
if ( $updateStmt->affected_rows == 1) {
|
|
$retArr[$bauteil] = 1;
|
|
} else {
|
|
$retArr[$bauteil] = 0;
|
|
}
|
|
}
|
|
}
|
|
echo json_encode($retArr);
|
|
}
|
|
|
|
|
|
//
|
|
// aktualisiert den Bauteileintrag mit den Messdaten
|
|
//
|
|
function updateBauteilMesswerte($arr) {
|
|
$db = get_dbc();
|
|
$bauteiltyp = substr($arr["TXLCode"],0,3);
|
|
switch ($bauteiltyp){
|
|
case "GW1":
|
|
$stmt = $db->prepare("UPDATE Bauteile SET OL1=?, OL2=?, OW1=?, OW2=?, R11=?, R12=?, R13=?, R21=?, R22=?, R23=?, R31=?, R32=?, R33=?, R41=?, R42=?, R43=?, Messdatum=?, MessComm=? WHERE `TXLCode`= ?;");
|
|
if (!$stmt) { die("\n\n $db->error \n\n"); }
|
|
$stmt->bind_param("sssssssssssssssssss", $arr["OL1"], $arr["OL2"], $arr["OW1"], $arr["OW2"], $arr["R11"], $arr["R12"], $arr["R13"], $arr["R21"], $arr["R22"], $arr["R23"], $arr["R31"], $arr["R32"], $arr["R33"], $arr["R41"], $arr["R42"], $arr["R43"], $arr["zeitstempel"], $arr["messcomm"], $arr["TXLCode"]);
|
|
break;
|
|
case "GA1":
|
|
$stmt = $db->prepare("UPDATE Bauteile SET OL1=?, OW1=?, R11=?, R12=?, R21=?, R22=?, R31=?, R32=?, R41=?, R42=?, Messdatum=?, MessComm=? WHERE `TXLCode`= ?;");
|
|
if (!$stmt) { die("\n\n $db->error \n\n"); }
|
|
$stmt->bind_param("sssssssssssss", $arr["OL1"], $arr["OW1"], $arr["R11"], $arr["R12"], $arr["R21"], $arr["R22"], $arr["R31"], $arr["R32"], $arr["R41"], $arr["R42"], $arr["zeitstempel"], $arr["messcomm"], $arr["TXLCode"]);
|
|
break;
|
|
case "GC1":
|
|
$stmt = $db->prepare("UPDATE Bauteile SET OL1=?, OW1=?, R11=?, R12=?, R21=?, R22=?, R31=?, R32=?, R41=?, R42=?, Messdatum=?, MessComm=? WHERE `TXLCode`= ?;");
|
|
if (!$stmt) { die("\n\n $db->error \n\n"); }
|
|
$stmt->bind_param("sssssssssssss", $arr["OL1"], $arr["OW1"], $arr["R11"], $arr["R12"], $arr["R21"], $arr["R22"], $arr["R31"], $arr["R32"], $arr["R41"], $arr["R42"], $arr["zeitstempel"], $arr["messcomm"], $arr["TXLCode"]);
|
|
break;
|
|
case "GX1":
|
|
$stmt = $db->prepare("UPDATE Bauteile SET OL1=?, OL2=?, OW1=?, OW2=?, R11=?, R12=?, R13=?, R21=?, R22=?, R23=?, R31=?, R32=?, R33=?, R41=?, R42=?, R43=?, Messdatum=?, MessComm=? WHERE `TXLCode`= ?;");
|
|
if (!$stmt) { die("\n\n $db->error \n\n"); }
|
|
$stmt->bind_param("sssssssssssssssssss", $arr["OL1"], $arr["OL2"], $arr["OW1"], $arr["OW2"], $arr["R11"], $arr["R12"], $arr["R13"], $arr["R21"], $arr["R22"], $arr["R23"], $arr["R31"], $arr["R32"], $arr["R33"], $arr["R41"], $arr["R42"], $arr["R43"], $arr["zeitstempel"], $arr["messcomm"], $arr["TXLCode"]);
|
|
break;
|
|
}
|
|
if (!$stmt->execute()) {
|
|
echo 'updateBauteilMesswerte$stmt->execute() schlug fehl:\n(' . $stmt->errno . ") " . $stmt->error . "\n";
|
|
} else {
|
|
echo "1";
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
//
|
|
// aktualisiert den Bauteileintrag mit den Rauheitswerten
|
|
//
|
|
function updateBauteilRauheiten($arr) {
|
|
$db = get_dbc();
|
|
$stmt = $db->prepare("UPDATE Bauteile SET LW=?, CW=?, Rauheitsdatum=?, RauComm=? WHERE `TXLCode`= ?;");
|
|
if (!$stmt) { die("\n\n $db->error \n\n"); }
|
|
$stmt->bind_param("sssss", $arr["LW"], $arr["CW"], $arr["raudate"], $arr["raucomm"], $arr["TXLCode"]);
|
|
|
|
if (!$stmt->execute()) {
|
|
echo 'updateBauteilRauheiten$stmt->execute() schlug fehl:\n(' . $stmt->errno . ") " . $stmt->error . "\n";
|
|
} else {
|
|
echo "1";
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
//
|
|
// erstellt ein neues Bauteil
|
|
//
|
|
function createBauteil($TXLCode, $Abformdatum, $Ofen, $Ofenposition, $AbformComm, $SchottOrderNr){
|
|
$iRet = "true";
|
|
$db = get_dbc();
|
|
$stmt = $db->prepare("INSERT INTO Bauteile (TXLCode, Abformdatum, Ofen, Ofenposition, AbformComm, SchottOrderNr) VALUES (?, ?, ?, ?, ?, ?)");
|
|
$stmt->bind_param("ssssss", $TXLCode, $Abformdatum, $Ofen, $Ofenposition, $AbformComm, $SchottOrderNr);
|
|
if (!$stmt->execute()) {
|
|
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error . "\n";
|
|
$iRet = "false";
|
|
}
|
|
$db->close();
|
|
return $iRet;
|
|
}
|
|
|
|
function insertBeladungKF80($arr){
|
|
$cntEingetrageneTeile = 0;
|
|
|
|
$txlcodes = array("foobar",$arr["tbE01KF80"],$arr["tbE02KF80"],$arr["tbE03KF80"],$arr["tbE04KF80"],$arr["tbE05KF80"],$arr["tbE06KF80"],$arr["tbE07KF80"],$arr["tbE08KF80"],$arr["tbE09KF80"],$arr["tbE10KF80"]);
|
|
$kommentare = array("foobar",$arr["KommE01KF80"],$arr["KommE02KF80"],$arr["KommE03KF80"],$arr["KommE04KF80"],$arr["KommE05KF80"],$arr["KommE06KF80"],$arr["KommE07KF80"],$arr["KommE08KF80"],$arr["KommE09KF80"],$arr["KommE10KF80"]);
|
|
$SONs = array("foobar",$arr["SON01KF80"],$arr["SON02KF80"],$arr["SON03KF80"],$arr["SON04KF80"],$arr["SON05KF80"],$arr["SON06KF80"],$arr["SON07KF80"],$arr["SON08KF80"],$arr["SON09KF80"],$arr["SON10KF80"]);
|
|
|
|
$zeitstempel = $arr["beladedatum"] ." ". $arr["beladezeit"];
|
|
|
|
if ($arr["auto"] == "1") {
|
|
$kommentar = "Autobeladung";
|
|
if ($arr["tbKommKF80"] != "") {
|
|
$kommentar = "Autobeladung / ". $arr["tbKommKF80"];
|
|
}
|
|
} else {
|
|
$kommentar = "Manueller Eintrag";
|
|
}
|
|
|
|
$db = get_dbc();
|
|
$stmt = $db->prepare("INSERT INTO KF80 (pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9, pos10, zeitstempel, bemerkung) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
|
$stmt->bind_param("ssssssssssss", $txlcodes[1], $txlcodes[2], $txlcodes[3], $txlcodes[4], $txlcodes[5], $txlcodes[6], $txlcodes[7], $txlcodes[8], $txlcodes[9], $txlcodes[10], $zeitstempel, $kommentar);
|
|
if (!$stmt->execute()) {
|
|
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error . "\n";
|
|
}
|
|
$db->close();
|
|
|
|
for ( $i = 1; $i <= 10; $i++) {
|
|
if ($txlcodes[$i] != ""){
|
|
if(createBauteil($txlcodes[$i], $zeitstempel, "KF80", $i, $kommentare[$i], $SONs[$i]) == "true") {
|
|
$cntEingetrageneTeile++;
|
|
}
|
|
}
|
|
}
|
|
echo $cntEingetrageneTeile;
|
|
}
|
|
|
|
function insertBeladungKF80S($arr){
|
|
$cntEingetrageneTeile = 0;
|
|
|
|
$txlcodes = array("foobar",$arr["tbE01KF80S"],$arr["tbE02KF80S"],$arr["tbE03KF80S"],$arr["tbE04KF80S"],$arr["tbE05KF80S"],$arr["tbE06KF80S"],$arr["tbE07KF80S"],$arr["tbE08KF80S"],$arr["tbE09KF80S"],$arr["tbE10KF80S"]);
|
|
$kommentare = array("foobar",$arr["KommE01KF80S"],$arr["KommE02KF80S"],$arr["KommE03KF80S"],$arr["KommE04KF80S"],$arr["KommE05KF80S"],$arr["KommE06KF80S"],$arr["KommE07KF80S"],$arr["KommE08KF80S"],$arr["KommE09KF80S"],$arr["KommE10KF80S"]);
|
|
$SONs = array("foobar",$arr["SON01KF80S"],$arr["SON02KF80S"],$arr["SON03KF80S"],$arr["SON04KF80S"],$arr["SON05KF80S"],$arr["SON06KF80S"],$arr["SON07KF80S"],$arr["SON08KF80S"],$arr["SON09KF80S"],$arr["SON10KF80S"]);
|
|
|
|
$zeitstempel = $arr["beladedatum"] ." ". $arr["beladezeit"];
|
|
|
|
if ($arr["auto"] == "1") {
|
|
$kommentar = "Autobeladung";
|
|
if ($arr["tbKommKF80S"] != "") {
|
|
$kommentar = "Autobeladung / ". $arr["tbKommKF80S"];
|
|
}
|
|
} else {
|
|
$kommentar = "Manueller Eintrag";
|
|
}
|
|
|
|
$db = get_dbc();
|
|
$stmt = $db->prepare("INSERT INTO KF80S (pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9, pos10, zeitstempel, bemerkung) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
|
$stmt->bind_param("ssssssssssss", $txlcodes[1], $txlcodes[2], $txlcodes[3], $txlcodes[4], $txlcodes[5], $txlcodes[6], $txlcodes[7], $txlcodes[8], $txlcodes[9], $txlcodes[10], $zeitstempel, $kommentar);
|
|
if (!$stmt->execute()) {
|
|
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error . "\n";
|
|
}
|
|
$db->close();
|
|
|
|
for ( $i = 1; $i <= 10; $i++) {
|
|
if ($txlcodes[$i] != ""){
|
|
if(createBauteil($txlcodes[$i], $zeitstempel, "KF80S", $i, $kommentare[$i], $SONs[$i]) == "true") {
|
|
$cntEingetrageneTeile++;
|
|
}
|
|
}
|
|
}
|
|
echo $cntEingetrageneTeile;
|
|
}
|
|
function insertBeladungKF480($arr){
|
|
$cntEingetrageneTeile = 0;
|
|
/*
|
|
* Arrays aufspalten, um sie spaeter loopen zu koennen
|
|
*/
|
|
$txlcodes = array("foobar",$arr["tbE01KF480"], $arr["tbE02KF480"], $arr["tbE03KF480"], $arr["tbE04KF480"], $arr["tbE05KF480"], $arr["tbE06KF480"], $arr["tbE07KF480"], $arr["tbE08KF480"], $arr["tbE09KF480"], $arr["tbE10KF480"], $arr["tbE11KF480"], $arr["tbE12KF480"], $arr["tbE13KF480"], $arr["tbE14KF480"], $arr["tbE15KF480"], $arr["tbE16KF480"], $arr["tbE17KF480"], $arr["tbE18KF480"], $arr["tbE19KF480"], $arr["tbE20KF480"]);
|
|
$kommentare = array("foobar",$arr["KommE01KF480"],$arr["KommE02KF480"],$arr["KommE03KF480"],$arr["KommE04KF480"],$arr["KommE05KF480"],$arr["KommE06KF480"],$arr["KommE07KF480"],$arr["KommE08KF480"],$arr["KommE09KF480"],$arr["KommE10KF480"],$arr["KommE11KF480"],$arr["KommE12KF480"],$arr["KommE13KF480"],$arr["KommE14KF480"],$arr["KommE15KF480"],$arr["KommE16KF480"],$arr["KommE17KF480"],$arr["KommE18KF480"],$arr["KommE19KF480"],$arr["KommE20KF480"]);
|
|
$SONs = array("foobar",$arr["SON01KF480"],$arr["SON02KF480"],$arr["SON03KF480"],$arr["SON04KF480"],$arr["SON05KF480"],$arr["SON06KF480"],$arr["SON07KF480"],$arr["SON08KF480"],$arr["SON09KF480"],$arr["SON10KF480"],$arr["SON11KF480"],$arr["SON12KF480"],$arr["SON13KF480"],$arr["SON14KF480"],$arr["SON15KF480"],$arr["SON16KF480"],$arr["SON17KF480"],$arr["SON18KF480"],$arr["SON19KF480"],$arr["SON20KF480"]);
|
|
|
|
$zeitstempel = $arr["beladedatum"] ." ". $arr["beladezeit"];
|
|
|
|
if ($arr["auto"] == "1") {
|
|
$kommentar = "Autobeladung";
|
|
if ($arr["tbKommKF480"] != "") {
|
|
$kommentar = "Autobeladung / ". $arr["tbKommKF480"];
|
|
}
|
|
} else {
|
|
$kommentar = "Manueller Eintrag";
|
|
}
|
|
|
|
$db = get_dbc();
|
|
$stmt = $db->prepare("INSERT INTO KF480 (pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9, pos10, pos11, pos12, pos13, pos14, pos15, pos16, pos17, pos18, pos19, pos20, zeitstempel, bemerkung) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
|
$stmt->bind_param("ssssssssssssssssssssss", $txlcodes[1], $txlcodes[2], $txlcodes[3], $txlcodes[4], $txlcodes[5], $txlcodes[6], $txlcodes[7], $txlcodes[8], $txlcodes[9], $txlcodes[10], $txlcodes[11], $txlcodes[12], $txlcodes[13], $txlcodes[14], $txlcodes[15], $txlcodes[16], $txlcodes[17], $txlcodes[18], $txlcodes[19], $txlcodes[20], $zeitstempel, $kommentar);
|
|
if (!$stmt->execute()) {
|
|
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error . "\n";
|
|
}
|
|
$db->close();
|
|
|
|
for ( $i = 1; $i <= 20; $i++) {
|
|
if ($txlcodes[$i] != ""){
|
|
if(createBauteil($txlcodes[$i], $zeitstempel, "KF480", $i, $kommentare[$i], $SONs[$i]) == "true") {
|
|
$cntEingetrageneTeile++;
|
|
}
|
|
}
|
|
}
|
|
echo $cntEingetrageneTeile;
|
|
}
|
|
|
|
function insertTool(){
|
|
$db = get_dbc();
|
|
|
|
if ($db->connect_error) { die("Connection failed: " . $db->connect_error); }
|
|
|
|
$stmt = $db->prepare("INSERT INTO `txl`.`Toolverwaltung` (`Typ`, `ToolNr`, `Revision`, `Lieferant`, `Materialtyp`, `Status`, `Kommentar`) VALUES (?, ?, ?, ?, ?, ?, ?);");
|
|
$stmt->bind_param("siissis",$typ, $toolnr, $rev, $lieferant, $material, $status, $kommentar);
|
|
|
|
$typ = $_post["typ"];
|
|
$toolnr = $_POST["toolnr"];
|
|
$rev = $_POST["rev"];
|
|
$lieferant = $_POST["lieferant"];
|
|
$material = $_POST["material"];
|
|
$status = $_POST["status"];
|
|
$kommentar = $_POST["kommentar"];
|
|
|
|
$stmt->execute();
|
|
echo "created";
|
|
$stmt->close();
|
|
$db->close();
|
|
}
|
|
|
|
function letzteBeladung($ofen) {
|
|
|
|
$arrBeladung = array();
|
|
$arrSON = array();
|
|
$arrAusgabe = array("FooBar");
|
|
$tmpArr = array();
|
|
|
|
$db = get_dbc();
|
|
$sql = "SELECT * FROM `". $ofen ."` ORDER BY id DESC LIMIT 1;";
|
|
// hole die Daten der letzten Beladung
|
|
$result = $db->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
$arrBeladung = $result->fetch_assoc();
|
|
// Wenn die Abfrage nicht leer ist, sind nun alle TXLCodes im
|
|
// Assoziativem Array $arrBeladung
|
|
|
|
// Wenn die Position nicht leer ist, dann wird mit dem eingetragenen
|
|
// TXLCode eine weitere Abfrage auf die Tabelle "Bauteile" gestartet
|
|
// um die zugeordnente OrderNumber von Schott abzufragen.
|
|
// Diese wird dann an das Array $arrAusgabe angehangen.
|
|
// Wenn sie leer ist, wird nur ein Bindestrich (als Trenner) angehangen.
|
|
if ($arrBeladung["pos1"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos1"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if ($arrBeladung["pos2"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos2"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if ($arrBeladung["pos3"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos3"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if ($arrBeladung["pos4"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos4"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if ($arrBeladung["pos5"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos5"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if ($arrBeladung["pos6"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos6"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if ($arrBeladung["pos7"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos7"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if ($arrBeladung["pos8"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos8"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if ($arrBeladung["pos9"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos9"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if ($arrBeladung["pos10"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos10"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos11"]) && $arrBeladung["pos11"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos11"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos12"]) && $arrBeladung["pos12"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos12"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos13"]) && $arrBeladung["pos13"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos13"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos14"]) && $arrBeladung["pos14"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos14"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos15"]) && $arrBeladung["pos15"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos15"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos16"]) && $arrBeladung["pos16"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos16"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos17"]) && $arrBeladung["pos17"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos17"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos18"]) && $arrBeladung["pos18"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos18"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos19"]) && $arrBeladung["pos19"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos19"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
if (isset($arrBeladung["pos20"]) && $arrBeladung["pos20"] != "") { $sql = "SELECT TXLCode, SchottOrderNr, AbformComm FROM Bauteile WHERE TXLCode = \"" . $arrBeladung["pos20"] . "\";"; $result = $db->query($sql); $tmpArr = $result->fetch_assoc(); array_push($arrAusgabe, $tmpArr["TXLCode"] ."-" . $tmpArr["SchottOrderNr"] ."-" . $tmpArr["AbformComm"]); } else { array_push($arrAusgabe, "-"); }
|
|
} else {
|
|
echo $sql ."\n";
|
|
echo "NULL";
|
|
}
|
|
|
|
echo json_encode($arrAusgabe);
|
|
|
|
$db->close();
|
|
}
|
|
|
|
function getRevision(){
|
|
$typ = $_POST["typ"];
|
|
$toolnr = $_POST["toolnr"];
|
|
|
|
$db = get_dbc();
|
|
$sql = "SELECT `Revision` FROM `txl`.`Toolverwaltung` WHERE `Typ` = '$typ' AND `ToolNr` = '$toolnr'";
|
|
//echo $sql ."\n\n";
|
|
|
|
$result = $db->query($sql);
|
|
|
|
if ($result->num_rows > 0) {
|
|
//output data of each row
|
|
while($row = $result->fetch_assoc()) {
|
|
echo $row["Revision"];
|
|
}
|
|
} else {
|
|
echo "0";
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
//
|
|
// holt alle daten aller Boxen eines Typs
|
|
//
|
|
function getBoxinhalte($flavor){
|
|
|
|
$db = get_dbc();
|
|
$sql = "SELECT `BoxNrIntern`, `p1`, `p2`, `p3`, `p4`, `p5`, `p6`, `p7`, `p8`, `p9` FROM `InterneBoxen` WHERE `Typ` = '$flavor'";
|
|
$result = $db->query($sql);
|
|
|
|
$results=array();
|
|
while ($row=$result->fetch_row()) {
|
|
$results[$row[0]]=$row;
|
|
}
|
|
$result=$results;
|
|
echo json_encode($result);
|
|
$db->close();
|
|
}
|
|
|
|
//
|
|
// holt alle daten einer definierten Box
|
|
// hat zwei ausgabeformate, da ich es einmal fuer die webseite und einmal im programm selbst [getBoxMesswerte()] nutze
|
|
//
|
|
function getSingleBoxinhalt($flavor, $boxNr, $intern = false){
|
|
$db = get_dbc();
|
|
$sql = "SELECT `p1`, `p2`, `p3`, `p4`, `p5`, `p6`, `p7`, `p8`, `p9` FROM `InterneBoxen` WHERE `Typ` = '$flavor' AND `BoxNrIntern` = '$boxNr';";
|
|
$result = $db->query($sql);
|
|
|
|
$results=array();
|
|
$row=$result->fetch_row();
|
|
if ( $intern ) {
|
|
return $row;
|
|
} else {
|
|
echo json_encode($row);
|
|
}
|
|
|
|
// $result=$results;
|
|
// echo json_encode($result);
|
|
$db->close();
|
|
}
|
|
|
|
//
|
|
// gibt die letze nummer einer Lieferbox des Typs '$flavor' zurück
|
|
//
|
|
function getLastBoxNr($flavor){
|
|
$db = get_dbc();
|
|
$sql = "SELECT `BoxNrIntern` FROM `InterneBoxen` WHERE `Typ` = '$flavor' ORDER BY `BoxNrIntern` DESC LIMIT 1";
|
|
// echo $sql ."\n\n";
|
|
|
|
$result = $db->query($sql);
|
|
|
|
if ($result->num_rows > 0) {
|
|
//output data of each row
|
|
while($row = $result->fetch_assoc()) {
|
|
echo $row["BoxNrIntern"];
|
|
}
|
|
} else {
|
|
echo "0";
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
//
|
|
// gibt alle nummern der Lieferboxen des Typs '$flavor' zurück
|
|
//
|
|
function getAllBoxNr($flavor){
|
|
$db = get_dbc();
|
|
$sql = "SELECT `BoxNrIntern` FROM `InterneBoxen` WHERE `Typ` = '$flavor' ORDER BY `BoxNrIntern`";
|
|
|
|
$result = $db->query($sql);
|
|
|
|
if ($result->num_rows > 0) {
|
|
//output data of each row
|
|
while($row = $result->fetch_assoc()) {
|
|
echo $row["BoxNrIntern"] ."; ";
|
|
}
|
|
|
|
// $results=array();
|
|
// while ($row=$result->fetch_row()) {
|
|
// $results[$row[0]]=$row;
|
|
// }
|
|
// $result=$results;
|
|
// echo json_encode($result);
|
|
|
|
} else {
|
|
echo "0";
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
|
|
function getSchottOrderNummern(){
|
|
$db = get_dbc();
|
|
$sql = "SELECT SON FROM SchottOrderNummern;";
|
|
$result = $db->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
$array = $result->fetch_array();
|
|
//echo json_encode($array);
|
|
foreach($array as $val) { echo $val .";"; }
|
|
} else {
|
|
echo "NULL";
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
function getSingleBauteil(){
|
|
$db = get_dbc();
|
|
$sql = "SELECT * FROM Bauteile WHERE `TXLCode` = \"". $_POST["txlcode"] ."\";";
|
|
$result = $db->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
$array = $result->fetch_array();
|
|
echo json_encode($array);
|
|
} else {
|
|
echo "NULL";
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
function getRowID($txlcode, $jsonified) {
|
|
$db = get_dbc();
|
|
$sql = "SELECT ID FROM Bauteile WHERE `TXLCode` = \"". $txlcode ."\";";
|
|
$result = $db->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
$array = $result->fetch_array();
|
|
if ($jsonified) {
|
|
echo json_encode($array);
|
|
} else {
|
|
return $array[0];
|
|
}
|
|
} else {
|
|
if ($jsonified) {
|
|
$array[0] = "NULL";
|
|
echo json_encode($array);
|
|
} else {
|
|
return "NULL";
|
|
}
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
function getMesswertStatus($txlcode) {
|
|
$tmptypeRaw = substr($txlcode,0,3);
|
|
$tmptype = "UNDEF";
|
|
if ($tmptypeRaw == "GW1"){ $tmptype = "3040"; }
|
|
if ($tmptypeRaw == "GX1"){ $tmptype = "3030"; }
|
|
if ($tmptypeRaw == "GA1"){ $tmptype = "2121"; }
|
|
if ($tmptypeRaw == "GC1"){ $tmptype = "2121C"; }
|
|
|
|
$db = get_dbc();
|
|
$sql = 'SELECT OL1, OW1, R13, R42 FROM Bauteile WHERE `TXLCode` = "'. $txlcode .'";';
|
|
|
|
$result = $db->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
$array = $result->fetch_array();
|
|
echo json_encode($array);
|
|
} else {
|
|
echo json_encode("null");
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
function getMesswerte($txlcode, $intern = false) {
|
|
$db = get_dbc();
|
|
$sql = 'SELECT OL1, OL2, OW1, OW2, R11, R12, R13, R21, R22, R23, R31, R32, R33, R41, R42, R43, LW, CW FROM Bauteile WHERE `TXLCode` = "'. $txlcode .'";';
|
|
$result = $db->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
$array = $result->fetch_array();
|
|
if ( $intern ) {
|
|
return $array;
|
|
} else {
|
|
echo json_encode($array);
|
|
}
|
|
} else {
|
|
if( $intern ) {
|
|
$array = [ "n", "u", "l", "l" ];
|
|
} else {
|
|
echo json_encode("null");
|
|
}
|
|
}
|
|
$db->close();
|
|
}
|
|
|
|
//
|
|
// hole messwerte aller bauteile in der lieferbox
|
|
function getBoxMesswerte($flavor, $boxNr){
|
|
$bauteile = getSingleBoxinhalt($flavor, $boxNr, true);
|
|
|
|
$results=array();
|
|
foreach ( $bauteile as $bauteil) {
|
|
$messwerte = getMesswerte($bauteil, true);
|
|
$results[$bauteil]=$messwerte;
|
|
}
|
|
$result=$results;
|
|
echo json_encode($result);
|
|
|
|
}
|
|
|
|
function getAllOldBauteile($arr) {
|
|
$db = mysqli_connect("localhost", "root", "kunstschmiede", "newtxl");
|
|
if(!$db) die("Unable to connect to MySQL: " . mysqli_error($db));
|
|
|
|
$flavor = $arr["flavor"];
|
|
$startFrom = $arr["startFrom"];
|
|
$limit = $arr["limit"];
|
|
|
|
if ($flavor == "3040") {
|
|
$sql = "
|
|
SELECT
|
|
3040_messdaten.ID,
|
|
3040_messdaten.TXLCode,
|
|
3040_messdaten.ol1 as OL1,
|
|
3040_messdaten.ol2 as OL2,
|
|
3040_messdaten.ow1 as OW1,
|
|
3040_messdaten.ow2 as OW2,
|
|
3040_messdaten.r11 as R11,
|
|
3040_messdaten.r12 as R12,
|
|
3040_messdaten.r13 as R13,
|
|
3040_messdaten.r21 as R21,
|
|
3040_messdaten.r22 as R22,
|
|
3040_messdaten.r23 as R23,
|
|
3040_messdaten.r31 as R31,
|
|
3040_messdaten.r32 as R32,
|
|
3040_messdaten.r33 as R33,
|
|
3040_messdaten.r41 as R41,
|
|
3040_messdaten.r42 as R42,
|
|
3040_messdaten.r43 as R43,
|
|
3040_rauheiten.lw as LW,
|
|
3040_rauheiten.cw as CW,
|
|
3040_messdaten.comment as 'messcomm',
|
|
3040_rauheiten.comment as 'raucomm'
|
|
FROM
|
|
3040_messdaten, 3040_rauheiten
|
|
WHERE
|
|
3040_rauheiten.TXLCode = 3040_messdaten.TXLCode
|
|
LIMIT ". $limit ." OFFSET ". $startFrom .";";
|
|
}
|
|
|
|
|
|
if ($flavor == "2121") {
|
|
|
|
$sql = "
|
|
SELECT
|
|
2121_messdaten.TXLCode,
|
|
2121_messdaten.ol as OL1,
|
|
2121_messdaten.ow as OW1,
|
|
2121_messdaten.r11 as R11,
|
|
2121_messdaten.r12 as R12,
|
|
2121_messdaten.r21 as R21,
|
|
2121_messdaten.r22 as R22,
|
|
2121_messdaten.r31 as R31,
|
|
2121_messdaten.r32 as R32,
|
|
2121_messdaten.r41 as R41,
|
|
2121_messdaten.r42 as R42,
|
|
2121_rauheiten.lw as LW,
|
|
2121_rauheiten.cw as CW,
|
|
2121_messdaten.comment as 'messcomm',
|
|
2121_rauheiten.comment as 'raucomm'
|
|
FROM
|
|
2121_messdaten, 2121_rauheiten
|
|
WHERE
|
|
2121_rauheiten.TXLCode = 2121_messdaten.TXLCode
|
|
;";
|
|
}
|
|
|
|
$result = $db->query($sql);
|
|
|
|
$results = array();
|
|
//$self_json = "{";
|
|
$rowCnt = 1;
|
|
|
|
if ($result->num_rows > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
if ( $flavor == "3040" || $flavor == "3030" ) { $self_json = $self_json .'"'. $row["ID"] .'_'. $row["TXLCode"] .'": {"TXLCode": "'. $row["TXLCode"] .'","OL1": "'. $row["OL1"] .'","OL2": "'. $row["OL2"] .'","OW1": "'. $row["OW1"] .'","OW2": "'. $row["OW2"] .'","R11": "'. $row["R11"] .'","R12": "'. $row["R12"] .'","R13": "'. $row["R13"] .'","R21": "'. $row["R21"] .'","R22": "'. $row["R22"] .'","R34": "'. $row["R23"] .'","R31": "'. $row["R31"] .'","R32": "'. $row["R32"] .'","R33": "'. $row["R33"] .'","R41": "'. $row["R41"] .'","R42": "'. $row["R42"] .'","R43": "'. $row["R43"] .'","LW": "'. $row["LW"] .'","CW": "'. $row["CW"] .'","messcomm": "'. $row["messcomm"] .'","raucomm": "'. $row["raucomm"] .'"'; }
|
|
if ( $flavor == "2121" || $flavor == "2121C" ) { $self_json = $self_json .'"'. $row["TXLCode"] .'": {"TXLCode": "'. $row["TXLCode"] .'","OL1": "'. $row["OL1"] .'","OW1": "'. $row["OW1"] .'","R11": "'. $row["R11"] .'","R12": "'. $row["R12"] .'","R21": "'. $row["R21"] .'","R22": "'. $row["R22"] .'","R31": "'. $row["R31"] .'","R32": "'. $row["R32"] .'","R41": "'. $row["R41"] .'","R42": "'. $row["R42"] .'","LW": "'. $row["LW"] .'","CW": "'. $row["CW"] .'","messcomm": "'. $row["messcomm"] .'","raucomm": "'. $row["raucomm"] .'"'; }
|
|
// if ( $rowCnt == $result->num_rows ) {
|
|
// $self_json = $self_json .'}}';
|
|
// } else {
|
|
$self_json = $self_json .'},';
|
|
//}
|
|
$rowCnt++;
|
|
}
|
|
} else {
|
|
echo mysqli_error($db);
|
|
//echo '{ "nu":"ll" }';
|
|
return;
|
|
}
|
|
|
|
$db->close();
|
|
echo $self_json;
|
|
|
|
}
|
|
|
|
function get_dbc() {
|
|
$dbc = mysqli_connect("localhost", "txl", "trixell", "txl_test");
|
|
if(!$dbc) die("Unable to connect to MySQL: " . mysqli_error($dbc));
|
|
return $dbc;
|
|
}
|
|
|
|
function startsWith($haystack, $needle) {
|
|
// search backwards starting from haystack length characters from the end
|
|
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
|
|
}
|
|
|
|
function endsWith($haystack, $needle) {
|
|
// search forward starting from end minus needle length characters
|
|
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
|
|
}
|
|
|
|
?>
|