ShuanghongS il y a 1 an
Parent
commit
e67984f990
3 fichiers modifiés avec 91 ajouts et 28 suppressions
  1. 8 0
      service/ocean_booking.class.php
  2. 8 0
      service/ocean_order.class.php
  3. 75 28
      utils/common.class.php

+ 8 - 0
service/ocean_booking.class.php

@@ -456,6 +456,14 @@ class ocean_booking {
         if(!empty($sql)){
             $rs = common::excuteListSql($sql);
         }
+        //去除null
+        foreach($rs as $index => $val) {
+            foreach($val as $index_2 => $_val) {
+                if(empty($rs[$index][$index_2]) || $rs[$index][$index_2] == null){
+                    $rs[$index][$index_2] = "";
+                }
+            }
+        }
         foreach($rs as $index => $val) {
             //合并显示 vessel
             if(array_key_exists("f_vessel", $val)){

+ 8 - 0
service/ocean_order.class.php

@@ -841,6 +841,14 @@ class ocean_order {
         if(!empty($sql)){
             $rs = common::excuteListSql($sql);
         }
+        //去除null
+        foreach($rs as $index => $val) {
+            foreach($val as $index_2 => $_val) {
+                if(empty($rs[$index][$index_2]) || $rs[$index][$index_2] == null){
+                    $rs[$index][$index_2] = "";
+                }
+            }
+        }
         //对查询的结果做特殊处理,比如要拼接某个值,合并值等
         foreach($rs as $index => $val) {
             //返回加密serial_no

+ 75 - 28
utils/common.class.php

@@ -1115,48 +1115,63 @@ class common {
         $dashboard_filter  =array();
         if(!empty($user_dashboard_filter)){
             $dashboard_filter = json_decode($user_dashboard_filter,true);
-            if(!empty($dashboard_filter['date_end'])){
-                $dashboard_filter['date_end'] = common::usDate2sqlDate($dashboard_filter['date_end']);
-            }
-            if(!empty($dashboard_filter['date_start'])){
-                $dashboard_filter['date_start'] = common::usDate2sqlDate($dashboard_filter['date_start']);
-            }
         }else{
             $threeMonthsAgoTimestamp = strtotime('-3 months');
-            $date_start = date('Y-m-01', $threeMonthsAgoTimestamp);
-            $date_end = date('Y-m-t');
-            $date_start_two = date('m/01/Y', $threeMonthsAgoTimestamp);
-            $date_end_two = date('m/t/Y');
-
-            $date_start_ym = date('Y-m', $threeMonthsAgoTimestamp);
-            $date_end_ym = date('Y-m');
-            $date_start_two_ym = date('m/01/Y', $threeMonthsAgoTimestamp);
-            $date_end_two_ym = date('m/t/Y');
+            $date_start = date('Y-m-d', $threeMonthsAgoTimestamp);
+            $date_end = date('Y-m-d');
+            $date_start_two = date('m/d/Y', $threeMonthsAgoTimestamp);
+            $date_end_two = date('m/d/Y');
+
+            //ETD
+            $_12MonthsAgoTimestamp = strtotime('-11 months');
+            $etd_date_start = date('Y-m-d', $_12MonthsAgoTimestamp);
+            $etd_date_end = date('Y-m-d');
+            $etd_date_start_two = date('m/d/Y', $_12MonthsAgoTimestamp);
+            $etd_date_end_two = date('m/d/Y');
 
             //柜子
-            $MonthsAgoTimestamp = strtotime('-12 months');
-            $date_start_ctnr = date('Y-m', $MonthsAgoTimestamp);
-            $date_end_ctnr = date('Y-m');
-            $date_start_two_ctnr = date('m/Y', $MonthsAgoTimestamp);
-            $date_end_two_ctnr = date('m/Y');
+            $ctnr_date_start = date('Y-m', $_12MonthsAgoTimestamp);
+            $ctnr_date_end = date('Y-m');
+            $ctnr_date_start_two = date('m/Y', $_12MonthsAgoTimestamp);
+            $ctnr_date_end_two = date('m/Y');
+
+            //Top
+            $top_date_start = date('Y-m-d', $_12MonthsAgoTimestamp);
+            $top_date_end = date('Y-m-d');
+            $top_date_start_two = date('m/d/Y', $_12MonthsAgoTimestamp);
+            $top_date_end_two = date('m/d/Y');
 
             //KPIDefaulteData
-            $dashboard_filter['KPIDefaulteData'] = array("transportation" =>array('All'),"date_type"=>"ETD","date_start"=>$date_start,"date_start_two"=>$date_start_two,
-            "date_end"=>$date_end,"date_end_two"=>$date_end_two);
+            $dashboard_filter['KPIDefaulteData'] = array("transportation" =>array('All'),"date_type"=>"ETD","date_start"=>$date_start_two,"date_start_two"=>$date_start,
+            "date_end"=>$date_end_two,"date_end_two"=>$date_end);
+
             //PendingDefaultData
             $dashboard_filter['PendingDefaultData'] = array("transportation" =>array('All'),"date_type"=>"ETD","date_start"=>"","date_start_two"=>"",
                 "date_end"=>"","date_end_two"=>"");
+
             //RecentDefaultData
-            $dashboard_filter['RecentDefaultData'] = array("transportation" =>array('All'),"date_type"=>"ETD","date_start"=>$date_start,"date_start_two"=>$date_start_two,
-                "date_end"=>$date_end,"date_end_two"=>$date_end_two);
+            $dashboard_filter['RecentDefaultData'] = array("transportation" =>array('All'),"date_type"=>"ETD","date_start"=>$date_start_two,"date_start_two"=>$date_start,
+                "date_end"=>$date_end_two,"date_end_two"=>$date_end);
             
             //ETDDefaultData
-            $dashboard_filter['ETDDefaultData'] = array("transportation" =>array('All'),"date_type"=>"ETA","date_start"=>$date_start_ym,"date_start_two"=>$date_start_two_ym,
-            "date_end"=>$date_end_ym,"date_end_two"=>$date_end_two_ym);
+            $dashboard_filter['ETDDefaultData'] = array("transportation" =>array('All'),"date_type"=>"ETA","date_start"=>$etd_date_start_two,"date_start_two"=>$etd_date_start,
+            "date_end"=>$etd_date_end_two,"date_end_two"=>$etd_date_end);
 
             //ContainerefaultData
-            $dashboard_filter['ContainerefaultData'] = array("transportation" =>array('Sea'),"date_type"=>"ETA","date_start"=>$date_start_two_ctnr,"date_start_two"=>$date_start_ctnr,
-             "date_end"=>$date_end_two_ctnr,"date_end_two"=>$date_end_ctnr);
+            $dashboard_filter['ContainerefaultData'] = array("transportation" =>array('Sea'),"date_type"=>"ETA","date_start"=>$ctnr_date_start_two,"date_start_two"=>$ctnr_date_start,
+             "date_end"=>$ctnr_date_end_two,"date_end_two"=>$ctnr_date_end);
+
+            //Top10faultData
+            $dashboard_filter['Top10faultData'] = array("transportation" =>array('All'),"date_type"=>"ETA","date_start"=>$top_date_start_two,"date_start_two"=>$top_date_start,
+            "date_end"=>$top_date_end_two,"date_end_two"=>$top_date_end);
+
+            //OriginCo2Top10faultData
+            $dashboard_filter['OriginCo2Top10faultData'] = array("transportation" =>array('All'),"date_type"=>"ETA","date_start"=>$top_date_start_two,"date_start_two"=>$top_date_start,
+            "date_end"=>$top_date_end_two,"date_end_two"=>$top_date_end);
+
+            //DestinationCo2Top10faultData
+            $dashboard_filter['DestinationCo2Top10faultData'] = array("transportation" =>array('All'),"date_type"=>"ETA","date_start"=>$top_date_start_two,"date_start_two"=>$top_date_start,
+            "date_end"=>$top_date_end_two,"date_end_two"=>$top_date_end);
         }
         return  array("Management" => $Management,"dashboard_filter" =>$dashboard_filter);
     }
@@ -1275,6 +1290,22 @@ class common {
         $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
         $sqlWhere = " " . $sqlWhere;
 
+        $date_type = strtolower($_REQUEST["date_type"]);
+        if (isset($_REQUEST['date_start']) && !empty($_REQUEST['date_start']))
+            $sqlWhere .= " and $date_type >= '" . common::usDate2sqlDate($_REQUEST['date_start']) . " 00:00:00'";
+        if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end']))
+            $sqlWhere .= " and $date_type <= '" . common::usDate2sqlDate($_REQUEST['date_end']) . " 23:59:59'";
+         
+        $transportation = strtolower($_REQUEST["transportation"]);
+        if(!is_array($transportation)){
+            $transportation = array($transportation);
+        }
+        if(count($transportation) == 1 && strtolower($transportation[0]) == 'all' ){
+
+        }else{
+            //这里不用处理,只有sea的数据
+        }
+
         $ContainerCount_Title = array();
         //先查询总的排放量sea air road,确定排名后,在分别查询对应的sea air road
         if ($type == "co2e_orgin"){
@@ -1352,6 +1383,22 @@ class common {
         $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
         $sqlWhere = " " . $sqlWhere;
 
+        $date_type = strtolower($_REQUEST["date_type"]);
+        if (isset($_REQUEST['date_start']) && !empty($_REQUEST['date_start']))
+            $sqlWhere .= " and $date_type >= '" . common::usDate2sqlDate($_REQUEST['date_start']) . " 00:00:00'";
+        if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end']))
+            $sqlWhere .= " and $date_type <= '" . common::usDate2sqlDate($_REQUEST['date_end']) . " 23:59:59'";
+         
+        $transportation = strtolower($_REQUEST["transportation"]);
+        if(!is_array($transportation)){
+            $transportation = array($transportation);
+        }
+        if(count($transportation) == 1 && strtolower($transportation[0]) == 'all' ){
+
+        }else{
+            //这里不用处理,只有sea的数据
+        }
+
         $toporiginType = "shippr_uncode";
         $shippr_uncode_10_sql ="with aa as  (select count(shippr_uncode) as num,shippr_uncode,
                                 (array_agg(shipper_city))[1] AS shipper_city from online_ocean