$value){ $sql3="select * from ytiot_t_route2 where id= ".$res2[0]['route']; $res3=add($sql3); if(!empty($res3)){ // if(strpos($res3[$key]['route'],$res1[0]['id']) !== false){ echo json_encode($res4); exit(); // }else{ // echo 6; // exit(); // } } } } } public function sftjewm(){ $data=I('post.data'); $company=I('post.company'); // $sql="insert into ytiot_t_qrcode_analysis (analysis_content) value ('".$data."')"; $sql="insert into ytiot_t_qrcode_analysis2 (analysis_content,company_code) value ('".$data."','".$company."')"; $res=addDataInfo($sql); if($res){ echo 1; exit(); }else{ echo 0; exit(); } } // public function qd(){ // $data=I(); // $sql="insert into ytiot_t_maintenance_record value (".$data['name'].",".$data['route'].",'".$data['inspection_time']."',".$data['analysis_content'].",".$data['firecl'].",'".$data['qk']."')"; // $res=addDataInfo($sql); // if($res){ // // }else{ // $this->display('Index2/wbprc1'); // } // // } public function wbfrom(){ $res1 =I(); $this->assign('res1',$res1); $this->display('Index2/wbfrom'); } public function xjd_inset(){ $data=I(); // print_r($data); // exit(); $sql4="select id,completion_status,company_code from ytiot_t_maintenance_plan where id=".$data['xjjh_id']; // print_r($data); // print_r($sql4);exit(); $patrol_planid=add($sql4); // $sql88="select id from ytiot_t_qrcode_analysis id=".$data['analysis_content']; // $analysis_content=add($sql88); // $sql1="select id from ytiot_t_patrol_point where label=".$data['analysis_content']; // $resid=add($sql1); if(empty($data['xjd_id'])){ $this->success('维保点为空',U('Index/index'),3); exit(); } $sql8="select company_code from ytiot_t_maintenance_person where id=".$data['name_id']; $rescompany_code=add($sql8); if(empty($rescompany_code)){ $this->success('维保人为空',U('Index/index'),3); exit(); } // print_r($patrol_planid);exit(); $sql2="insert into ytiot_t_maintenance_record (personnel,route,inspection_time,point_position,xjzt,qk,company_code) value (".$data['name_id'].",".$data['route'].",'".$data['inspection_time']."','".$data['xjd_id']."',".$data['zt'].",'".$data['qk']."','".$patrol_planid[0]['company_code']."')"; // echo $sql; // exit(); $res=addDataInfo($sql2); if($res){ $sql3="select route from ytiot_t_route2 where id=".$data['route']; $routeid=add($sql3); $arr=explode(",",$routeid[0]['route']);//二维码解析id $z=count($arr); $bl1=1/$z*100; $bl=round($bl1,2); $time=date("Y-m-d"); // $sql4="select id,completion_status from ytiot_t_patrol_plan where route=".$data['route']." and personnel=".$data['name_id']." and planned_date='".$time."' and company_code=".$data['company']; // $sql4="select id,completion_status from ytiot_t_patrol_plan where id=".$data['xjjh_id']; // $patrol_planid=add($sql4); // print_r($sql4); // print_r($patrol_planid); // exit(); // $zbl=(int)$patrol_planid[0]['completion_status']+(int)$bl; $zbl=$patrol_planid[0]['completion_status']+$bl; // $sql5="update ytiot_t_patrol_plan set completion_status=".$zbl." where route=".$data['route']." and personnel=".$data['name_id']." and planned_date='".$time."'"; $sql5="update ytiot_t_maintenance_plan set completion_status=".$zbl." where id=".$data['xjjh_id']; // print_r($sql5); // exit(); $res1=addDataInfo($sql5); if($res1){ // $this->success('保存成功',U('Inspection/index'),3); $this->success('保存成功',U('Maintenance/index?companyid='.$rescompany_code[0]['company_code']),3); }else{ $this->success('保存失败1bl',U('Maintenance/index'),3); } }else{ $this->success('保存失败',U('Index/index'),3); } } }