getdevice1($companys); if (empty($hj_x)&&empty($sj_x)&&empty($rtu_x)&&empty($efire_x)&&empty($video_x)){ $where2['company_code'] = $companys; $data_statistics = M('company_sync')->where($where2)->find(); $hj_wcl_count=$data_statistics['device_01_alarm']-$data_statistics['device_01_alarm_confirm']+$data_statistics['device_01_out']-$data_statistics['device_01_out_confirm']; $sj_wcl_count=$data_statistics['device_02_alarm']+$data_statistics['device_00_alarm']-($data_statistics['device_02_alarm_confirm']+$data_statistics['device_00_alarm_confirm']) +$data_statistics['device_00_out']-$data_statistics['device_00_out_confirm']+$data_statistics['device_02_out']-$data_statistics['device_02_out_confirm']; $rtu_wcl_count=$data_statistics['device_06_alarm'] - $data_statistics['device_06_alarm_confirm']+$data_statistics['device_06_out']-$data_statistics['device_06_out_confirm']; $efire_wcl_count= $data_statistics['device_07_alarm'] - $data_statistics['device_07_alarm_confirm']+$data_statistics['device_07_out']-$data_statistics['device_07_out_confirm']; $video_wcl_count=$data_statistics['device_16_alarm'] - $data_statistics['device_16_alarm_confirm']+$data_statistics['device_16_out']-$data_statistics['device_16_out_confirm']; //火警报警未处理数量 if($hj_wcl_count>99){ $hj_x = '99+'; }else{ $hj_x = $hj_wcl_count; } //水警报警未处理数量 if ($sj_wcl_count>99){ $sj_x = '99+'; }else{ $sj_x = $sj_wcl_count; } //rtu报警未处理数量 if ($rtu_wcl_count>99){ $rtu_x = '99+'; }else{ $rtu_x = $rtu_wcl_count; } //电气火灾未处理数量 if ($efire_wcl_count>99){ $efire_x='99+'; }else{ $efire_x=$efire_wcl_count; } //视频监测未处理数量 if ($video_wcl_count>99){ $video_x='99+'; }else{ $video_x=$video_wcl_count; } } //电梯监测未处理数量 if (is_null($elevator_x)&&$elevator_x==''){ $elevator=M()->query("SELECT count(*) FROM sp_lifter2017 where device_code in (".$device_code_list.") and clzt='0'"); if ($elevator[0]['count(*)']>99){ $elevator_x = '99+'; }else{ $elevator_x = $elevator[0]['count(*)']; } } //门磁未处理数量 if (is_null($mc_x)&&$mc_x==''){ $mc=M()->query("SELECT count(*) FROM sp_door2020 where device_code in (".$device_code_list.") and clzt='0'"); if ($mc[0]['count(*)']>99){ $mc_x = '99+'; }else{ $mc_x = $mc[0]['count(*)']; } } // //可燃气体 if (is_null($combustible_gas_x)&&$combustible_gas_x==''){ $combustible_gas=M()->query("SELECT count(*) FROM sp_gas2020 where device_code in (".$device_code_list.") and clzt='0'"); if($combustible_gas[0]['count(*)']>99){ $combustible_gas_x = '99+'; }else{ $combustible_gas_x = $combustible_gas[0]['count(*)']; } } //井盖监测未处理数量 if (is_null($iw_x)&&$iw_x==''){ $iw=M()->query("SELECT count(*) as sl FROM sp_iw2017 where device_code in (".$device_code_list.") and clzt='0'"); if ($iw[0]['sl']>99){ $iw_x = '99+'; }else{ $iw_x = $iw[0]['sl']; } } //消防栓监测未处理数量 if (is_null($fire_hydrant_x)&&$fire_hydrant_x==''){ $fire_hydrant=M()->query("SELECT count(a.id) as sl FROM sp_sj2017 a JOIN sp_owner b ON a.device_code=b.owner_code WHERE b.company='".$companys."' AND b.dwtype='4' and a.clzt='0'"); if ($fire_hydrant[0]['sl']>99){ $fire_hydrant_x = '99+'; }else{ $fire_hydrant_x = $fire_hydrant[0]['sl']; } } $this->assign('companys',$companys); $this->assign('hj_x',$hj_x); $this->assign('sj_x',$sj_x); $this->assign('rtu_x',$rtu_x); $this->assign('efire_x',$efire_x); $this->assign('video_x',$video_x); $this->assign('elevator_x',$elevator_x); $this->assign('mc_x',$mc_x); $this->assign('iw_x',$iw_x); $this->assign('fire_hydrant_x',$fire_hydrant_x); $this->assign('combustible_gas_x',$combustible_gas_x); $this->display('Index/comprehensive_alarm'); } //获取 权限 设备编号 001,001 public function getdevice1($company){ $device=M()->query("SELECT o.owner_code,c.owner_name FROM sp_owner o join sp_owner_company c ON o.company =c.owner_id WHERE o.company ='".$company."'"); $this->owner_name=$device[0]['owner_name']; $str=""; foreach ($device as $val) { $str.="'".$val['owner_code']."',"; } $newstr = substr($str,0,strlen($str)-1); return $newstr; } }