ShuanghongS 10 месяцев назад
Родитель
Сommit
42124d383b

+ 3 - 3
main_new_version.php

@@ -173,7 +173,7 @@ switch ($action) {
         $sqlWhere = common::check_input($sqlWhere);
 
         $list = common::excuteListSql("select * from public.online_order_status_date_kln_r1_r2('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text,'$date_type'::text) "
-                             . "r (c bigint, e integer, b integer, d text)");               
+                             . "r (c bigint, e integer, b integer, d text)");                               
         $key = "[";
         $value = "[";
         $totalValue = 0;
@@ -485,7 +485,7 @@ switch ($action) {
             $sql = "with ss as (select '$serial_no' as sn)
             , aa as (
                 select place_of_receipt_un, place_of_delivery_un, fport_of_loading_un, mport_of_discharge_un, port_of_loading, port_of_discharge, place_of_delivery_exp, place_of_receipt_exp,dd.*
-                    from public.online_ocean oo 
+                    from public.kln_ocean oo 
                     left join LATERAL (
                         select (select uncode from ports where  code = o.port_of_transshipment) as port_of_transshipment_un,
                                 port_of_transshipment_name
@@ -508,7 +508,7 @@ switch ($action) {
             $sql = "with ss as (select '$serial_no' as sn)
             , aa as (
                 select place_of_receipt_un, place_of_delivery_un, fport_of_loading_un, mport_of_discharge_un, port_of_loading, port_of_discharge, place_of_delivery_exp, place_of_receipt_exp
-                    from public.online_ocean oo 
+                    from public.kln_ocean oo 
                     where serial_no=(select sn from ss) limit 1
             )
             , rr as (

+ 1 - 1
service/login.class.php

@@ -1158,7 +1158,7 @@ class login {
             exit();
         }else{
             $reference_number_lower = strtolower($reference_number);
-            $online_ocean_sql = "select serial_no,order_from from kln_ocean 
+            $online_ocean_sql = "select serial_no,order_from from public.kln_ocean 
                 where ((ARRAY['$reference_number_lower'] && array_append(ARRAY[lower(booking_no::text), lower(h_bol::text), lower(m_bol), lower(carrier_booking), lower(quote_no), lower(tracking_no)]||string_to_array(lower(ctnrs),','), ''::text))
                     or lower(po_no) like '%$reference_number_lower%'
                     or lower(invoice_no) like '%$reference_number_lower%')";

+ 4 - 5
service/ocean_booking.class.php

@@ -349,7 +349,7 @@ class ocean_booking {
             $_schemas = "ocean";
         }
         $sql = "with o as(
-            SELECT  o.*,'' as incoterms from ocean o where lower(serial_no) = '" . strtolower($serial_no) . "''
+            SELECT  o.*,'' as incoterms from ocean o where serial_no = '" .$serial_no . "''
         )
         SELECT o.booking_no as _booking_no,
             o.* ,sh.*, cn.* ,aa.*,dd.*,ob.* ,
@@ -494,9 +494,9 @@ class ocean_booking {
         }
         //air要关联ata_date as ata, atd没有对应字段
         $sql = "with o as(
-            SELECT  o.* from kln_booking o where serial_no = '" . $serial_no . "'
+            SELECT  o.* from public.kln_booking o where serial_no = '" . $serial_no . "'
         )
-        SELECT *, po_no as _po_no,'' as incoterms,null as atd
+        SELECT *, po_no as _po_no,'' as incoterms,null as atd,
             sh.*, cn.*, aa.*, dd.*
         from o
             LEFT JOIN LATERAL ( SELECT company as cn_company,
@@ -530,8 +530,7 @@ class ocean_booking {
                 address_4 as dd_address_4,
                 city as dd_city, state as dd_state, zipcode as dd_zipcode, country as dd_country,
                 phone_1 as dd_phone
-            FROM $_schemas.contacts c WHERE o.agent::text = c.contact_id::text) dd ON true
-        where lower(o.serial_no) = '" . strtolower($serial_no) . "'";
+            FROM $_schemas.contacts c WHERE o.agent::text = c.contact_id::text) dd ON true";
         $ocean = common::excuteObjectSql($sql);
 
         $vueData = $this->returnBookingDetailData($ocean,$status);

+ 3 - 3
service/ocean_order.class.php

@@ -510,7 +510,7 @@ class ocean_order {
                 sum(case when (m_iffdel is not null) then 1 else 0 end) as completed,
                 string_agg(distinct incoterms, '<$>') as incoterm_str,
                 string_agg(distinct service, '<$>') as service_str 
-            from kln_ocean". $sqlWhere_befrom_filterTag;
+            from public.kln_ocean". $sqlWhere_befrom_filterTag;
             error_log("online_ocean_search_All_Status: ".$sql);
 
             $sql_all_status_data = common::excuteObjectSql($sql);
@@ -690,7 +690,7 @@ class ocean_order {
             // most update status
             $_schemas = $_REQUEST["_schemas"];
             $mostStatusSql = "select last_status_loc, last_status_city, to_char(last_status_315_date, 'MM/DD/YYYY') as last_status_315_date,last_status_315_code "
-                    . ", fport_of_loading_un, mport_of_discharge_un, place_of_receipt_un, place_of_delivery_un FROM public.online_ocean "
+                    . ", fport_of_loading_un, mport_of_discharge_un, place_of_receipt_un, place_of_delivery_un FROM public.kln_ocean "
                     . "where serial_no= '" . $ocean["serial_no"] . "'";
             if (!empty($_schemas)) {
                 $mostStatusSql .= " and order_from='" . $_schemas . "'";
@@ -1436,7 +1436,7 @@ class ocean_order {
                         WHEN (m_iffdel is not null) THEN 'Completed'::text
                         ELSE 'Created'::text
                     END AS new_status
-                FROM  public.online_ocean oo WHERE oo.serial_no::text = o.serial_no::text and order_from = '$order_from') oo ON true
+                FROM  public.kln_ocean oo WHERE oo.serial_no::text = o.serial_no::text and order_from = '$order_from') oo ON true
             LEFT JOIN LATERAL ( SELECT company as cn_company,
                 address_1 as cn_address_1,
                 address_2 as cn_address_2,

+ 6 - 6
utils/common.class.php

@@ -1207,12 +1207,12 @@ class common {
         //这里的问题跟 top 一样 。总的排放量查询有问题。目前是总的排放量 暂时等于 sea的排放量
         if ($type == "co2e_orgin"){
             $co2e_shippr_sql = "select SUM(COALESCE(carbon_emission,0)) as catnum ,
-                shippr_uncode as station from kln_ocean  where 1=1 and COALESCE(shippr_uncode,'')<>'' and carbon_emission is not null  $sqlWhere group by shippr_uncode order by catnum desc limit 10";
+                shippr_uncode as station from public.kln_ocean  where 1=1 and COALESCE(shippr_uncode,'')<>'' and carbon_emission is not null  $sqlWhere group by shippr_uncode order by catnum desc limit 10";
             $co2e_aLL = common::excuteListSql($co2e_shippr_sql);
         }
         if ($type == "co2e_destination"){
             $co2e_consignee_sql = "select SUM(COALESCE(carbon_emission,0)) as catnum ,
-                consignee_uncode as station from kln_ocean  where 1=1 and COALESCE(consignee_uncode,'')<>'' and carbon_emission is not null $sqlWhere group by consignee_uncode order by catnum desc limit 10";
+                consignee_uncode as station from public.kln_ocean  where 1=1 and COALESCE(consignee_uncode,'')<>'' and carbon_emission is not null $sqlWhere group by consignee_uncode order by catnum desc limit 10";
             $co2e_aLL = common::excuteListSql($co2e_consignee_sql);
         }
         //最大Y值
@@ -1304,7 +1304,7 @@ class common {
          
         $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 kln_ocean  
+                                (array_agg(shipper_city))[1] AS shipper_city from public.kln_ocean  
                         where 1=1 and COALESCE(shippr_uncode,'')<>'' $sqlWhere group by shippr_uncode order by num desc limit 10)
             select   aa.*,dd.* from  aa  
             left join LATERAL ( select lon as lng, lat as lat,
@@ -1318,7 +1318,7 @@ class common {
         if(count($shippr_uncode_10) == 1 && empty($shippr_uncode_10[0]["shippr_uncode"])){
             $toporiginType = "fport_of_loading_un";
             $shippr_uncode_10_sql = "with aa as  (select count(fport_of_loading_un) as num,fport_of_loading_un as shippr_uncode 
-                    from kln_ocean where 1=1 and COALESCE(fport_of_loading_un,'')<>'' $sqlWhere group by fport_of_loading_un order by num desc limit 10)
+                    from public.kln_ocean where 1=1 and COALESCE(fport_of_loading_un,'')<>'' $sqlWhere group by fport_of_loading_un order by num desc limit 10)
                     select   aa.*,dd.* from  aa  
                         left join LATERAL ( select lon as lng, lat as lat,
                             '' as label, '' as infor, 3 as sort,
@@ -1331,7 +1331,7 @@ class common {
         $topdestinationinType = "consignee_uncode";
         $consignee_uncode_10_sql = "with aa as  (select count(consignee_uncode) as num,consignee_uncode,
                     (array_agg(consignee_city))[1] AS consignee_city 
-                from kln_ocean  where 1=1  and COALESCE(consignee_uncode,'')<>''  $sqlWhere group by consignee_uncode order by num desc limit 10)
+                from public.kln_ocean  where 1=1  and COALESCE(consignee_uncode,'')<>''  $sqlWhere group by consignee_uncode order by num desc limit 10)
         select   aa.*,dd.* from  aa  
         left join LATERAL ( select lon as lng, lat as lat,
             '' as label, '' as infor, 3 as sort,
@@ -1342,7 +1342,7 @@ class common {
         //如果值没有:客户地址-->站点地址-->Port地址(POL/POD) 
         if(count($consignee_uncode_10) == 1 && empty($consignee_uncode_10[0]["consignee_uncode"])){
             $topdestinationinType = "mport_of_discharge_un";
-            $consignee_uncode_10_sql = "with aa as  (select count(mport_of_discharge_un) as num,mport_of_discharge_un as consignee_uncode from kln_ocean where 1=1 and COALESCE(mport_of_discharge_un,'')<>'' $sqlWhere group by mport_of_discharge_un order by num desc limit 10)
+            $consignee_uncode_10_sql = "with aa as  (select count(mport_of_discharge_un) as num,mport_of_discharge_un as consignee_uncode from public.kln_ocean where 1=1 and COALESCE(mport_of_discharge_un,'')<>'' $sqlWhere group by mport_of_discharge_un order by num desc limit 10)
                 select   aa.*,dd.* from  aa  
                 left join LATERAL ( select lon as lng, lat as lat,
                     '' as label, '' as infor, 3 as sort,

+ 4 - 4
utils/utils.class.php

@@ -198,7 +198,7 @@ class utils {
     }
 
     public static function getEmail($serial_no) {
-        $ocean = common::excuteObjectSql("select sales_rep, last_user, created_by, order_from, h_bol, consignee, dest_op, agent from public.online_ocean where md5(serial_no)=md5('$serial_no') "
+        $ocean = common::excuteObjectSql("select sales_rep, last_user, created_by, order_from, h_bol, consignee, dest_op, agent from public.kln_ocean where md5(serial_no)=md5('$serial_no') "
                         . "order by schem_not_display nulls last limit 1");
         $schema = $ocean["order_from"] . ".";
         $dest_op_from_agent = common::excuteOneSql("select dest_op_from_agent from " . $schema . "ocean where md5(serial_no)=md5('$serial_no')");
@@ -509,7 +509,7 @@ class utils {
         }
 
         if(($action == "ocean_booking" || $action == "ocean_order") && $operate == "detail"){
-            $tabel = $action == "ocean_booking" ? "online_booking" : "online_ocean";
+            $tabel = $action == "ocean_booking" ? "kln_booking" : "kln_ocean";
             $serial_no = common::deCode($_GET['a'], 'D');
             $sql = "SELECT booking_no,h_bol from public.$tabel where serial_no = '$serial_no' limit 1";
             $data = common::excuteObjectSql($sql);
@@ -619,9 +619,9 @@ class utils {
         foreach ($ids_arr as $value) {
             if (!empty($value)) {
                 if (empty($sql)) {
-                    $sql .= "SELECT $str FROM kln_ocean  where $shipment_mode_where  and $filed = '$value'";
+                    $sql .= "SELECT $str FROM public.kln_ocean  where $shipment_mode_where  and $filed = '$value'";
                 } else {
-                    $sql .= " union all SELECT $str from online_ocean  where $shipment_mode_where and $filed = '$value'";
+                    $sql .= " union all SELECT $str from public.kln_ocean  where $shipment_mode_where and $filed = '$value'";
                 }
             }
         }