public function getDBdataAction() { $VTs = new clsSystem(); //先初始化 $VTs->initialization(''); //-----------BI開始------------ $type = $_GET['type']; $action = []; $action["status"] = false; switch ($type) { case 'getDateList': $pageType = $_GET['ptype']; $strSQL = "SELECT DISTINCT date(datec) as datef FROM `qc_checklist` WHERE typeid=" . $pageType . " AND imgid is not null order by datec desc"; $data = $VTs->QueryData($strSQL); if (!empty($data)) { $action["status"] = true; } break; case 'qc_checklist': // $strSQL="SELECT * FROM `qc_checklist` where imgid is not null AND typeid=1 order by uid desc"; $datel = $_GET['datel']; $sLimit = @$_GET["sLimit"]; $eLimit = @$_GET["eLimit"]; if ($datel == 0) { $datel = date("Y-m-d"); } $data['date'] = $datel; $limit = ""; if (isset($_GET["sLimit"]) and isset($_GET["eLimit"])) { if ($sLimit >= 0 and $eLimit >= 1) { $limit = " limit " . $sLimit . "," . $eLimit; } } $strSQL = "SELECT t1.uid AS uid, t1.datec AS datec ,t1.remark AS remark,t5.name AS ma_name ,t2.count AS count,t2.place AS place,t6.imgfile AS imgfile\n\t\t\t\t\t\tFROM qc_checklist AS t1\n\t\t\t\t\t\tLEFT JOIN el_petition AS t2 ON t2.uid=t1.dataid\n\t\t\t\t\t\tLEFT JOIN prj_materiel AS t3 ON t2.prj_mid=t3.uid \n\t\t\t\t\t\tLEFT JOIN prj_materiel_items AS t4 ON t3.uid=t4.prj_mid\n\t\t\t\t\t\tLEFT JOIN el_materiel AS t5 ON t4.materielid=t5.uid\n\t\t\t\t\t\tLEFT JOIN img_picture AS t6 ON t1.imgid = t6.uid\n\t\t\t\t\t\twhere t1.imgid is not null AND t1.typeid=1\n\t\t\t\t\t\tAND to_days(t1.datec)=to_days('" . $datel . "')\n\t\t\t\t\t\torder by t1.uid desc " . $limit . ";"; $arr_d = $VTs->QueryData($strSQL); $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\"; if (!file_exists($filePath)) { $tmpFilePath = str_replace("\\", "/", $filePath); if (!file_exists($tmpFilePath)) { $VTs->CreateDirectory($tmpFilePath); } } if (!empty($arr_d)) { //CreateDirectory foreach ($arr_d as $i => $d) { $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\"; $filePath .= $d["imgfile"]; if (file_exists($filePath)) { $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true); $arr_d[$i]["imgs"] = $imgArr; } else { $filePath = str_replace("\\", "/", $filePath); if (file_exists($filePath)) { $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true); $arr_d[$i]["imgs"] = $imgArr; } else { $arr_d[$i]["imgs"] = null; } } } $data["checklist"] = $arr_d; $action["status"] = true; } break; case 'qc_checklist_c': // $strSQL="SELECT * FROM `qc_checklist` where imgid is not null AND typeid=2 order by uid desc"; $datel = $_GET['datel']; if ($datel == 0) { $datel = date("Y-m-d"); } $data['date'] = $datel; $strSQL = "SELECT t1.datec AS datec ,t1.remark AS remark,t1.uid,t7.name as fl,t8.name as typec,t9.name as model,t4.name as area,t6.name as typed,t10.imgfile as imgfile\n\t\t\t\t\t\tFROM qc_checklist t1\n\t\t\t\t\t\tLEFT JOIN eng_worklist_areaitem t2 ON t2.uid = t1.dataid\n\t\t\t\t\t\tLEFT JOIN eng_worklist_workitem t3 ON t3.uid = t2.wl_wiid\n\t\t\t\t\t\tLEFT JOIN eng_set_area t4 ON t4.uid = t2.areaid\n\t\t\t\t\t\tLEFT JOIN eng_pace_modelitems t5 ON t5.uid = t2.p_miid\n\t\t\t\t\t\tLEFT JOIN eng_type_d t6 ON t6.uid = t5.type_d\n\t\t\t\t\t\tLEFT JOIN eng_str_b t7 ON t7.uid = t3.strid_b\n\t\t\t\t\t\tLEFT JOIN eng_type_c t8 ON t8.uid = t3.typeid_c\n\t\t\t\t\t\tLEFT JOIN eng_pace_model t9 ON t9.uid = t3.p_modelid\n\t\t\t\t\t\tLEFT JOIN img_picture t10 ON t1.imgid = t10.uid\n\t\t\t\t\t\twhere t1.imgid is not null AND t1.typeid=2 \n\t\t\t\t\t\tAND to_days(t1.datec)=to_days('" . $datel . "')\n\t\t\t\t\t\torder by uid desc;"; $arr_d = $VTs->QueryData($strSQL); $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\"; if (!file_exists($filePath)) { $VTs->CreateDirectory($filePath); } if (!empty($arr_d)) { //CreateDirectory foreach ($arr_d as $i => $d) { $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\"; $filePath .= $d["imgfile"]; if (file_exists($filePath)) { $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true); $arr_d[$i]["imgs"] = $imgArr; } else { $arr_d[$i]["imgs"] = null; } } $data["checklist"] = $arr_d; $action["status"] = true; } break; case 'title': $strSQL = "SELECT name FROM `prj_project` WHERE uid=1"; $d = $VTs->QueryData($strSQL); $data = $d[0]; break; } // $data = $VTs->QueryData($strSQL); $data["status"] = $action["status"]; $pageContent = $VTs->Data2Json($data); //-----------BI結束------------ //關閉資料庫連線 $VTs->DBClose(); //釋放 $VTs = null; $this->viewContnet['pageContent'] = $pageContent; return new ViewModel($this->viewContnet); }
public function getqcimglistAction() { $VTs = new clsSystem(); $VTs->initialization(); //-----BI開始----- $action = array(); $action["status"] = false; if (!empty($_POST["qcid"])) { $qcid = $_POST["qcid"]; //取得資料庫資料 $strSQL = "select * from qc_checklist a "; $strSQL .= "left join img_picture b on a.imgid = b.uid "; // $strSQL .= "where a.uid = ".$qcid." and (a.isok = 0 or a.isok is NULL) order by a.uid"; $strSQL .= "where a.uid = " . $qcid . " and a.isok = 1 order by a.uid"; $data = $VTs->QueryData($strSQL); if (!empty($data)) { //CreateDirectory $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\"; if (file_exists($filePath)) { $filePath .= $data[0]["imgfile"]; } else { $VTs->CreateDirectory($filePath); $filePath .= $data[0]["imgfile"]; } if (file_exists($filePath)) { $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true); $action["imgs"] = $imgArr; $action["status"] = true; } else { $action["msg"] = 'Can not find img files'; } } else { $action["msg"] = 'Can not find img files'; } } else { $action["msg"] = 'Qc id is Empty'; } $pageContent = $VTs->Data2Json($action); //-----BI結束----- $VTs = null; $this->viewContnet['pageContent'] = $pageContent; return new ViewModel($this->viewContnet); }