ShuanghongS 1 year ago
parent
commit
9743e0e5f8
2 changed files with 11 additions and 9 deletions
  1. 4 4
      main_new_version.php
  2. 7 5
      service/ocean_order.class.php

+ 4 - 4
main_new_version.php

@@ -61,10 +61,10 @@ switch ($action) {
         exit();
         break;
     case 'main_filter':
-            $data  = common::getManagement();
-            common::echo_json_encode(200, $data['dashboard_filter']);
-            exit();
-            break;    
+        $data  = common::getManagement();
+        common::echo_json_encode(200, $data['dashboard_filter']);
+        exit();
+        break;    
     case 'main_report':
         $type = $_REQUEST["r_type"];
         $container_type = $_REQUEST["container_type"];

+ 7 - 5
service/ocean_order.class.php

@@ -1115,11 +1115,14 @@ class ocean_order {
         if($_schemas == 'public'){
             $_schemas = "ocean";
         }
-        $sql = "SELECT m_eta as _m_eta,  h_bol as _h_bol, m_bol as _m_bol,job_no as _job_bol,
+        $sql = "with o as(
+            SELECT  o.* from ocean o where serial_no = '" . $serial_no . "'
+        )
+        SELECT m_eta as _m_eta,  h_bol as _h_bol, m_bol as _m_bol,job_no as _job_bol,
                 o.* ,sh.*, cn.* ,aa.*,dd.*,fd.*,oo.*,
                 (select uncode from ports where  code = o.port_of_transshipment) as port_of_transshipment_un
-            from ocean o 
-            LEFT JOIN LATERAL ( SELECT tracking_no as _tracking_no,shippr_uncode,shipper_city,
+        from o 
+        LEFT JOIN LATERAL ( SELECT tracking_no as _tracking_no,shippr_uncode,shipper_city,
                     consignee_uncode,consignee_city,incoterms,
                     fport_of_loading_un,
                     mport_of_discharge_un,
@@ -1180,8 +1183,7 @@ class ocean_order {
             LEFT JOIN LATERAL ( SELECT 
                 city as fd_city,
                 (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
-            FROM $_schemas.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true
-        where serial_no = '" . $serial_no . "'";
+            FROM $_schemas.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true";
         //error_log($sql);
         return $sql;
     }