File "quality.php"
Full path: /www/ansys/qgis/004_iwakuni/input/quality.php
File size: 10.61 KiB (10869 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
//-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*
// 自動でクラスを参照する
// 関数名 : __autoload()
// 備考 : 参照先は./class/XXX.phpとする
// 更新 : 2012/10/19 KMK-Teraoka
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
function __autoload($className)
{
$fPath = "./class/" . str_replace("_", "/", $className) . ".php";
require_once $fPath;
}
//===============================================
// DEBUG_MODE
// 備考 :
// 更新 : 2012/10/19 KMK-Teraoka
//===============================================
define("DEBUG_MODE", "0");
Debug::setMode(DEBUG_MODE);
if (DEBUG_MODE == 1)
{
Stopwatch::start();
}
//===============================================
// CommonUtilities
// 備考 :
// 更新 : 2012/11/27 KMK-Teraoka
//===============================================
$HOST = "192.168.100.153";
$DB = "ansys";
$USER = "postgres";
$PASS = "am#71ZJ*";
$CONSTRUCTION_ID= "7";
print "<!DOCTYPE html>";
print "<html>";
print "<head>";
print "<meta charset=\"utf-8\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"/ansys/common/css/style.css\">";
print "<link rel=\"shortcut icon\" href=\"/ansys/common/favicon/favicon.ico\">";
print "<title>";
print "品質項目入力";
print "</title>";
print "</head>";
print "<body>";
try
{
//================================================
// データベース接続
// 備考 :
// 更新 : 2012/11/27 KMK-Teraoka
//================================================
$conn = pg_connect("
host = ". $HOST. "
dbname = ". $DB. "
user = ". $USER. "
password= ". $PASS. "
");
if (!$conn)
{
throw new Exception("データベースへの接続に失敗しました");
}
//===============================================
// POST、GETパラメータの受け取り
// 備考 :
// 更新 : 2012/11/27 KMK-Teraoka
//===============================================
if (DEBUG_MODE == 1)
{
extract($_POST);
extract($_GET);
Debug::writes($_POST);
}
$btnRegist = isset($_POST["btnRegist"]) ? htmlspecialchars($_POST["btnRegist"]) : "";
if (strcmp($btnRegist, "登録") == 0)
{
$registCheck = 1;
$txtYmd = isset($_POST["txtYmd"]) ? htmlspecialchars($_POST["txtYmd"]) : "";
if (mb_strlen($txtYmd) == 8)
{
$dateY = substr($txtYmd, 0, 4);
$dateM = substr($txtYmd, 4, 2);
$dateD = substr($txtYmd, 6, 2);
}
else
{
//throw new Exception("年月日はYYYYmmddの型式で入力して下さい");
print "<font color=\"red\">年月日はYYYYmmddの型式で入力して下さい<br /></font>";
$registCheck = 0;
}
$txtHi = isset($_POST["txtHi"]) ? htmlspecialchars($_POST["txtHi"]) : "";
if (mb_strlen($txtHi) == 4)
{
$dateH = substr($txtHi, 0, 2);
$dateI = substr($txtHi, 2, 2);
}
else
{
//throw new Exception("時分はHHiiの型式で入力して下さい");
print "<font color=\"red\">時分はHHiiの型式で入力して下さい<br /></font>";
$registCheck = 0;
}
$txtCarNumber = isset($_POST["txtCarNumber"]) ? htmlspecialchars($_POST["txtCarNumber"]) : "";
if (strcmp($txtCarNumber, "") == 0)
{
//throw new Exception("車番が指定されていません");
print "<font color=\"red\">車番が指定されていません<br /></font>";
$registCheck = 0;
}
$txtSlump = isset($_POST["txtSlump"]) ? htmlspecialchars($_POST["txtSlump"]) : "";
if (strcmp($txtSlump, "") != 0)
{
if (!is_numeric($txtSlump))
{
//throw new Exception("スランプの値が数値ではありません");
print "<font color=\"red\">スランプの値が数値ではありません<br /></font>";
$registCheck = 0;
}
}
$txtAmountAir = isset($_POST["txtAmountAir"]) ? htmlspecialchars($_POST["txtAmountAir"]) : "";
if (strcmp($txtAmountAir, "") != 0)
{
if (!is_numeric($txtAmountAir))
{
//throw new Exception("空気量の値が数値ではありません");
print "<font color=\"red\">空気量の値が数値ではありません<br /></font>";
$registCheck = 0;
}
}
$txtUnitWater = isset($_POST["txtUnitWater"]) ? htmlspecialchars($_POST["txtUnitWater"]) : "";
if (strcmp($txtUnitWater, "") != 0)
{
if (!is_numeric($txtUnitWater))
{
//throw new Exception("単位水量の値が数値ではありません");
print "<font color=\"red\">単位水量の値が数値ではありません<br /></font>";
$registCheck = 0;
}
}
$txtConcreteTemp = isset($_POST["txtConcreteTemp"]) ? htmlspecialchars($_POST["txtConcreteTemp"]) : "";
if (strcmp($txtConcreteTemp, "") != 0)
{
if (!is_numeric($txtConcreteTemp))
{
//throw new Exception("コンクリート温度の値が数値ではありません");
print "<font color=\"red\">コンクリート温度の値が数値ではありません<br /></font>";
$registCheck = 0;
}
}
$txtTemperature = isset($_POST["txtTemperature"]) ? htmlspecialchars($_POST["txtTemperature"]) : "";
if (strcmp($txtTemperature, "") != 0)
{
if (!is_numeric($txtTemperature))
{
//throw new Exception("外気温の値が数値ではありません");
print "<font color=\"red\">外気温の値が数値ではありません<br /></font>";
$registCheck = 0;
}
}
$txtChlorideIon = isset($_POST["txtChlorideIon"]) ? htmlspecialchars($_POST["txtChlorideIon"]) : "";
if (strcmp($txtChlorideIon, "") != 0)
{
if (!is_numeric($txtChlorideIon))
{
//throw new Exception("塩化物イオン量の値が数値ではありません");
print "<font color=\"red\">塩化物イオン量の値が数値ではありません<br /></font>";
$registCheck = 0;
}
}
if ($registCheck == 1)
{
// データベース登録
$insConcData = "INSERT INTO qgis.quality_of_concrete";
$insConcData .= "(const_id, upddatetime, regdatetime, iptdatetime, car_number, slump, amount_air, unit_water, concrete_temp, temperature, chloride_ion)";
$insConcData .= " VALUES (";
$insConcData .= "'". $CONSTRUCTION_ID. "'";
$insConcData .= ", current_timestamp";
$insConcData .= ", current_timestamp";
$insConcData .= ", '". $dateY. "-". $dateM. "-". $dateD. " ". $dateH. ":". $dateI. ":00". "'";
$insConcData .= ", '". $txtCarNumber. "'";
$insConcData .= ", '". $txtSlump. "'";
$insConcData .= ", '". $txtAmountAir. "'";
$insConcData .= ", '". $txtUnitWater. "'";
$insConcData .= ", '". $txtConcreteTemp. "'";
$insConcData .= ", '". $txtTemperature. "'";
$insConcData .= ", '". $txtChlorideIon. "'";
$insConcData .= ");";
//print $insConcData;
$resConcData = pg_query($conn, $insConcData);
print "<font color=\"red\">登録しました</font>";
}
}
if (strcmp($txtYmd, "") == 0)
$txtYmd = date("Ymd");
if (strcmp($txtHi, "") == 0)
$txtHi = date("Hi");
if (strcmp($txtSlump, "") == 0)
$txtSlump = "";
if (strcmp($txtAmountAir, "") == 0)
$txtAmountAir = "";
if (strcmp($txtUnitWater, "") == 0)
$txtUnitWater = "";
if (strcmp($txtConcreteTemp, "") == 0)
$txtConcreteTemp = "";
if (strcmp($txtTemperature, "") == 0)
$txtTemperature = "";
if (strcmp($txtChlorideIon, "") == 0)
$txtChlorideIon = "";
//===============================================
// 表示部分
// 備考 :
// 更新 : 2013/08/01 KMK-Teraoka
//===============================================
print "<center><b>品質管理項目</b></center>";
print "<hr />";
print "<form action=\"". $_SERVER["PHP_SELF"]. "\" method=\"post\" style=\"display:inline\">";
print "<table border=\"0\">";
print "<tr>";
print "<td>日付</td>";
print "<td>時刻</td>";
print "</tr>";
print "<tr>";
print "<td><input type=\"text\" name=\"txtYmd\" value=\"". $txtYmd. "\" maxlength=\"8\" style=\"ime-mode:disabled;width:60px;\"></td>";
print "<td><input type=\"text\" name=\"txtHi\" value=\"". $txtHi. "\" maxlength=\"4\" style=\"ime-mode:disabled;width:30px;\"></td>";
print "</tr>";
print "<tr style=\"height:2px;\"></tr>";
print "<tr>";
print "<td colspan=\"2\">車番</td>";
print "</tr>";
print "<tr>";
print "<td colspan=\"2\"><input type=\"text\" name=\"txtCarNumber\" value=\"". $txtCarNumber. "\" maxlength=\"4\" style=\"ime-mode:disabled;width:60px\"></td>";
print "</tr>";
print "<tr style=\"height:4px;\"></tr>";
print "<tr>";
print "<td colspan=\"2\">・スランプ</td>";
print "</tr>";
print "<tr>";
print "<td colspan=\"2\"><input type=\"text\" name=\"txtSlump\" value=\"". $txtSlump. "\" style=\"ime-mode:disabled;width:90px\"> cm</td>";
print "</tr>";
print "<tr style=\"height:2px;\"></tr>";
print "<tr>";
print "<td colspan=\"2\">・空気量</td>";
print "</tr>";
print "<tr>";
print "<td colspan=\"2\"><input type=\"text\" name=\"txtAmountAir\" value=\"". $txtAmountAir. "\" style=\"ime-mode:disabled;width:90px\"> %</td>";
print "</tr>";
print "<tr style=\"height:2px;\"></tr>";
print "<tr>";
print "<td colspan=\"2\">・単位水量</td>";
print "</tr>";
print "<tr>";
print "<td colspan=\"2\"><input type=\"text\" name=\"txtUnitWater\" value=\"". $txtUnitWater. "\" style=\"ime-mode:disabled;width:90px\"> kg/㎥</td>";
print "</tr>";
print "<tr style=\"height:2px;\"></tr>";
//temperature
print "<tr>";
print "<td colspan=\"2\">・コンクリート温度</td>";
print "</tr>";
print "<tr>";
print "<td colspan=\"2\"><input type=\"text\" name=\"txtConcreteTemp\" value=\"". $txtConcreteTemp. "\" style=\"ime-mode:disabled;width:90px\"> ℃</td>";
print "</tr>";
print "<tr style=\"height:2px;\"></tr>";
print "<tr>";
print "<td colspan=\"2\">・外気温</td>";
print "</tr>";
print "<tr>";
print "<td colspan=\"2\"><input type=\"text\" name=\"txtTemperature\" value=\"". $txtTemperature. "\" style=\"ime-mode:disabled;width:90px\"> ℃</td>";
print "</tr>";
print "<tr style=\"height:2px;\"></tr>";
print "<tr>";
print "<td colspan=\"2\">・塩化物イオン量</td>";
print "</tr>";
print "<tr>";
print "<td colspan=\"2\"><input type=\"text\" name=\"txtChlorideIon\" value=\"". $txtChlorideIon. "\" style=\"ime-mode:disabled;width:90px\"> kg/㎥</td>";
print "</tr>";
print "<tr style=\"height:2px;\"></tr>";
print "</table>";
print "<input type=\"submit\" name=\"btnRegist\" value=\"登録\" id=\"submit_button\">";
print "</form>";
print "</body>";
}
catch(Exception $exc)
{
print "<font color=\"#FF0000\">";
print "【スクリプトエラー】<br />";
print $exc->getMessage(). "<br />";
print "</font>";
print "<br />";
print "<a href=\"". $_SERVER["PHP_SELF"]. "\">戻る</a>";
}
//===============================================
// Postgresql終了処理
// 備考 :
// 更新 : 2012/10/19 KMK-Teraoka
//===============================================
pg_close($conn);
print "</body>";
print "</html>";
?>