$value) { $str = str_replace('"]', '', $ResData[$key]['content']); $ResData[$key]['content'] = str_replace('["', '', $str); } $res['msg'] = '操作成功'; $res['flag'] = true; $res['record_count'] = (int)$Res[0]['record_count']; $res['data'] = $ResData; echo json_encode($res); } //人员督察单详情查询 public function getManualInspectorDetails(){ $Data = I(); $id=$Data['id']; $company_code = $Data['company_code']; if (empty($id)){ $res['msg'] = '操作失败,缺少参数'; $res['flag'] = false; echo json_encode($res); } $Res = query_187_ytapi("select * from person_data where id=" .$id); if ($Res[0]['clzt']) { $Res[0]['wtype'] = "已处理"; } else { $Res[0]['wtype'] = "未处理"; } $str = str_replace('"]', '', $Res[0]['content']); $Res[0]['content'] = str_replace('["', '', $str); if ($Res[0]['cl_time'] == '1978-00-00 00:00:00') { $Res[0]['cl_time'] = ''; } $res['msg'] = '操作成功'; $res['flag'] = true; $res['data'] = $Res; echo json_encode($res); } //电子督察单列表页 public function getElectronicInspectorList(){ $Data = I(''); $clzt = $Data['clzt']; $company_code = $Data['company_code']; if (empty($company_code)){ $res['msg'] = '操作失败,缺少参数'; $res['flag'] = false; echo json_encode($res); } if ($clzt==1){ $status = "and clzt=1"; $clzt=1; }else{ $status = "and clzt=0"; $clzt=0; } $Res = query_187_ytapi("select count(*) as record_count from jingan_analysis_data where status=0 and clzt='".$clzt."' and company_code='" . $company_code."' and content != '设备离线'"); $ResData = query_187_ytapi("select id,content,timestamp,supervise_code,clzt from jingan_analysis_data where status=0 and content !='设备离线' and company_code='" . $company_code . "' " . $status . " order by timestamp desc LIMIT 1000"); foreach ($ResData as $key => $value) { $str = str_replace('"]', '', $ResData[$key]['content']); $ResData[$key]['content'] = str_replace('["', '', $str); } $res['msg'] = '操作成功'; $res['flag'] = true; $res['record_count'] = (int)$Res[0]['record_count']; $res['data'] = $ResData; echo json_encode($res); } //电子督察单详情页 public function getElectronicInspectorDetails(){ $Data = I(); if (empty($Data['id'])){ $res['msg'] = '操作失败,缺少参数'; $res['flag'] = false; echo json_encode($res); } $Res = query_187_ytapi("select * from jingan_analysis_data where id=" . $Data['id']." and status=0"); // print_r($Res); if ($Res[0]['clzt']) { $Res[0]['wtype'] = "已处理"; } else { $Res[0]['wtype'] = "未处理"; } $str = str_replace('"]', '', $Res[0]['content']); $Res[0]['content'] = str_replace('["', '', $str); if ($Res[0]['cl_time'] == '1978-00-00 00:00:00') { $Res[0]['cl_time'] = ''; } if ($Res[0]['type']==1||$Res[0]['type']==2||$Res[0]['type']==3){ if (!empty($Res[0]['mainframe_id'])){ $a=substr($Res[0]['mainframe_id'],2); } $arr=M()->query("select owner_name from sp_owner where owner_code='".$a."'"); if(strlen($Res[0]['loop_number'])==4){ $zj=substr($Res[0]['loop_number'],0,strlen($Res[0]['loop_number'])-3); $hl=(int)substr($Res[0]['loop_number'],1); $arr1=M()->query("select info from sp_owner_point where device_code='".$a."' and `loop`='".$hl."' and pno='".$Res[0]['position_number']."' and host_num='".$zj."'"); }else{ $arr1=M()->query("select info from sp_owner_point where device_code='".$a."' and `loop`='".$Res[0]['loop_number']."' and pno='".$Res[0]['position_number']."'"); } if (!empty($arr1[0]['info'])){ $Res[0]['nr']="设备名称:".$arr[0]['owner_name'].",回路号:".$Res[0]['loop_number'].",点位号:".$Res[0]['position_number'].",点位描述:".$arr1[0]['info'].""; }else{ $Res[0]['nr']="设备名称:".$arr[0]['owner_name'].",回路号:".$Res[0]['loop_number'].",点位号:".$Res[0]['position_number']; } }else if ($Res[0]['type']==4){ if (strpos($Res[0]['content'],"泵") !== false){ if (!empty($Res[0]['device_id'])){ $arr=M()->query("select owner_name from sp_owner where owner_code='".substr($Res[0]['device_id'],0,strlen($Res[0]['device_id'])-1)."'"); if (!empty($arr[0]['owner_name'])){ $Res[0]['nr']="设备名称:".$arr[0]['owner_name']; }else{ $arr1=M()->query("select owner_name from sp_owner where owner_code='".$Res[0]['device_id']."'"); if (!empty($arr1[0]['owner_name'])){ $Res[0]['nr']="设备名称:".$arr1[0]['owner_name']; }else{ $Res[0]['nr']=""; } } } } }else{ $Res[0]['nr']=""; } $res['msg'] = '操作成功'; $res['flag'] = true; $res['data'] = $Res; echo json_encode($res); } //人员督察单处理 public function setManualInspector(){ $Data = I(); $cl_time = Date('Y-m-d H:i:s'); if (!empty($_SESSION['phone'])) { $Data['clr'] = $_SESSION['phone']; } if ($Data['plcl'] == 1) { $ResData = query_187_ytapi("select * from person_data where artificial_code='" . $Data['artificial_code'] . "' and clzt=0 LIMIT 1"); $res_u = insert_187_ytapi("update person_data set clzt=1,clnr='" . $Data['clnr'] . "',clr_phone='" . $Data['clr'] . "',cl_time='" . $cl_time . "' where artificial_code='" . $Data['artificial_code'] . "' and clzt=0"); // $data = [ // 'sign' => $ResData[0]['sign'], // 'artificial_id' => $ResData[0]['artificial_id'], // 'artificial_code' => $ResData[0]['artificial_code'], // 'pid' => $ResData[0]['pid'], // 'status' => $ResData[0]['status'], // 'content' => $ResData[0]['content'], // ]; } else { $res_u = ytapi_insert("update person_data set clzt=1,clnr='" . $Data['clnr'] . "',clr_phone='" . $Data['clr'] . "',cl_time='" . $cl_time . "' where id=" . $Data['id']); $ResData = ytapi_query("select * from person_data where id=" . $Data['id']); if ($Data['company_code'] == 10209 || $Data['company_code'] == 10198 || $Data['company_code'] == 10195 || $Data['company_code'] == 10078 || $Data['company_code'] == 10069 || $Data['company_code'] == 10083 || $Data['comcompany_code'] == 10064 || $Data['company_code'] == 10067 || $Data['company_code'] == 10215 || $Data['company_code'] == 10216 || $Data['company_code'] == 10214 || $Data['company_code'] == 10212 || $Data['company_code'] == 10206 || $Data['company_code'] == 10114 || $Data['company_code'] == 10077 || $Data['company_code'] == 10122 || $Data['company_code'] == 10074 || $Data['company_code'] == 10076 || $Data['company_code'] == 10079 || $Data['company_code'] == 10066 || $Data['company_code'] == 10065 || $Data['company_code'] == 10070 || $Data['company_code'] == 10063) { $area_status = 2; } elseif ($Data['company_code'] == 10113 || $Data['company_code'] == 10012) { $area_status = 1; } $data = [ "SubType" => '999', 'artificial_id' => $ResData[0]['artificial_id'], 'reason' => $ResData[0]['clnr'], 'handler' => $ResData[0]['clr_phone'], 'mobile' => $ResData[0]['clr_phone'], 'area_status' => $area_status, ]; $url = 'http://47.98.201.187:55335/report'; $data = json_encode($data); $result = http_post_advertise($url, $data); } if ($res_u){ $res['msg'] = '操作成功'; $res['flag'] = true; echo json_encode($res); }else{ $res['msg'] = '操作失败'; $res['flag'] = false; echo json_encode($res); } } //电子督察单处理 public function setElectronicInspector(){ $Data = I(); $cl_time = Date('Y-m-d H:i:s'); if (!empty($_SESSION['phone'])) { $Data['clr'] = $_SESSION['phone']; } $res_u = ytapi_insert("update jingan_analysis_data set clzt=1,clnr='" . $Data['clnr'] . "',cl_phone='" . $Data['clr'] . "',cl_time='" . $cl_time . "' where id=" . $Data['id']); $ResData = ytapi_query("select * from jingan_analysis_data where id=" . $Data['id']); if ($Data['company_code'] == 10209 || $Data['company_code'] == 10198 || $Data['company_code'] == 10195 || $Data['company_code'] == 10078 || $Data['company_code'] == 10069 || $Data['company_code'] == 10083 || $Data['company_code'] == 10064 || $Data['company_code'] == 10067 || $Data['company_code'] == 10215 || $Data['company_code'] == 10216 || $Data['company_code'] == 10214 || $Data['company_code'] == 10212 || $Data['company_code'] == 10206 || $Data['company_code'] == 10114 || $Data['company_code'] == 10077 || $Data['company_code'] == 10122 || $Data['company_code'] == 10074 || $Data['company_code'] == 10076 || $Data['company_code'] == 10079 || $Data['company_code'] == 10066 || $Data['company_code'] == 10065 || $Data['company_code'] == 10070 || $Data['company_code'] == 10063) { $area_status = 2; } elseif ($Data['company_code'] == 10113 || $Data['company_code'] == 10012) { $area_status = 1; } $data = [ "SubType" => $Data['SubType'], 'artificial_id' => $ResData[0]['supervise_id'], 'reason' => $ResData[0]['clnr'], 'handler' => $ResData[0]['cl_phone'], 'mobile' => $ResData[0]['cl_phone'], 'area_status' => $area_status, ]; $url = 'http://47.98.201.187:55335/report'; $data = json_encode($data); $result = http_post_advertise($url, $data); if ($res_u){ $res['msg'] = '操作成功'; $res['flag'] = true; echo json_encode($res); }else{ $res['msg'] = '操作失败'; $res['flag'] = false; echo json_encode($res); } } }