MonthlyReportController.class.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace Home\Controller;
  3. use Think\Controller;
  4. include '../Common/function.php';
  5. class MonthlyReportController extends ComController {
  6. public function index(){
  7. $data =I();
  8. $company_code=$data['companyid'];
  9. $sql="select * from yt_t_month_report where company_code='".$company_code."' GROUP BY event_time";
  10. $res=add66($sql);
  11. $this->assign('res',$res);
  12. $this->assign('company_code',$company_code);
  13. $this->display('Index/monthly_report_list');
  14. }
  15. public function monthly_details(){
  16. $data =I();
  17. $company_code=$data['companyid'];
  18. $id=$data['id'];
  19. $sql="select * from yt_t_month_report where id=".$id;
  20. $res=add66($sql);
  21. if (!empty($res)){
  22. $project_info=json_decode($res[0]['project_info'], true);
  23. $instal_device_info=json_decode($res[0]['instal_device_info'], true);
  24. $this->assign('zs',$instal_device_info['total']);
  25. unset($instal_device_info['total']);
  26. foreach ($instal_device_info as $key => $value){
  27. $instal_device_info[$key]['xh']=$key;
  28. }
  29. // print_r($res[0]['monitor_point_info']);
  30. $monitor_point_info=json_decode($res[0]['monitor_point_info'],true);
  31. // print_r($monitor_point_info);
  32. $this->assign('zs1',$monitor_point_info['total']);
  33. unset($monitor_point_info['total']);
  34. foreach ($monitor_point_info as $key => $value){
  35. $monitor_point_info[$key]['xh']=$key;
  36. }
  37. $count_time=json_decode($res[0]['count_time'],true);
  38. $count_report=json_decode($res[0]['count_report'],true);
  39. foreach ($count_report as $key => $value){
  40. $count_report[$key]['xh']=$key;
  41. }
  42. $alarm_total=json_decode($res[0]['alarm_total'],true);
  43. $fire_data=json_decode($res[0]['fire_data'],true);
  44. $fire_data['process_rate']=$fire_data['process_rate']*1000;
  45. $fire_data['unprocess']=$fire_data['unprocess']*1000;
  46. $water_data=json_decode($res[0]['water_data'],true);
  47. $rtu_data=json_decode($res[0]['rtu_data'],true);
  48. $conclusion=json_decode($res[0]['conclusion'],true);
  49. $other=$conclusion['other'];
  50. $propose_data=$conclusion['propose'];
  51. $propose=array();
  52. $a=0;
  53. foreach ($propose_data as $key => $value){
  54. if (!empty($propose_data[$key]['data1'])){
  55. $propose[$a]['data1']=$propose_data[$key]['data1'];
  56. $a+=1;
  57. }
  58. }
  59. //
  60. // print_r($propose);
  61. // print_r($other);
  62. }
  63. $this->assign('company_code',$company_code);
  64. $this->assign('company_name',$res[0]['company_name']);
  65. $this->assign('event_time',$res[0]['event_time']);
  66. $this->assign('project_info',$project_info);
  67. $this->assign('instal_device_info',$instal_device_info);
  68. $this->assign('monitor_point_info',$monitor_point_info);
  69. $this->assign('count_time',$count_time);
  70. $this->assign('count_time',$count_time);
  71. $this->assign('count_report',$count_report);
  72. $this->assign('alarm_total',$alarm_total);
  73. $this->assign('fire_data',$fire_data);
  74. $this->assign('water_data',$water_data);
  75. $this->assign('rtu_data',$rtu_data);
  76. $this->assign('propose',$propose);
  77. $this->assign('other',$other);
  78. $this->display('Index/monthly_report_details');
  79. }
  80. }