62 lines
1.9 KiB
PHP
62 lines
1.9 KiB
PHP
<?php
|
|
ini_set('display_errors', 1);
|
|
ini_set('display_startup_errors', 1);
|
|
error_reporting(E_ALL);
|
|
|
|
class Portserver extends MY_Controller
|
|
{
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->db_one = $this->load->database("onedev", true);
|
|
}
|
|
function raw() {
|
|
$param = $this->sys_input;
|
|
try {
|
|
$instrumentID = $param["instrumentID"];
|
|
$data = $param["data"];
|
|
$sql = "insert into itf_raw(itf_RawNat_InstrumentID,itf_RawData)
|
|
values(?,?)";
|
|
$this->db_one->query($sql, array($instrumentID, base64_decode($data)));
|
|
echo json_encode(
|
|
array("status" => "OK" , "id" => $this->db_one->insert_id() , "message" => "")
|
|
);
|
|
} catch(exception $e) {
|
|
echo json_encode(
|
|
array("status" => "ERR" , "id" => 0, "message" => $e.message() )
|
|
);
|
|
}
|
|
}
|
|
function result() {
|
|
$param = $this->sys_input;
|
|
try {
|
|
$instrumentID = $param["instrumentID"];
|
|
$rawID = $param["rawID"];
|
|
$result= $param["result"];
|
|
$noreg = $result["nolab"];
|
|
$sql = "insert into itf_result(itf_ResultNat_InstrumentID, itf_ResultItf_RawID,
|
|
Itf_ResultNoreg, Itf_ResultInstrumentDate, itf_ResultKode, itf_ResultResult, itf_ResultFlag)
|
|
values(?,?,?,?,?,?,?)";
|
|
foreach($result["result"] as $r) {
|
|
$tgl = $r["date"];
|
|
$px = $r["px"];
|
|
$result = $r["result"];
|
|
$this->db_one->query($sql,
|
|
array($instrumentID, $rawID, $noreg, $tgl , $px,
|
|
$result,$r["flag"]));
|
|
echo $this->db_one->last_query();
|
|
}
|
|
echo json_encode(
|
|
array("status" => "OK" , "message" => "")
|
|
);
|
|
} catch(exception $e) {
|
|
echo json_encode(
|
|
array("status" => "ERR" , "message" => $e.message() )
|
|
);
|
|
}
|
|
}
|
|
function order() {
|
|
$param = $this->sys_input;
|
|
}
|
|
}
|
|
?>
|