ShuanghongS 3 недель назад
Родитель
Сommit
a5d94e10e2
4 измененных файлов с 53 добавлено и 49 удалено
  1. 10 10
      main_new_version.php
  2. 6 1
      service/destination_delivery.class.php
  3. 0 0
      service/ocean_order.class.php
  4. 37 38
      utils/common.class.php

+ 10 - 10
main_new_version.php

@@ -100,17 +100,17 @@ switch ($action) {
                         }
                         //特殊处理book,需要加二级菜
                         if($v['s_column'] =="Ocean Booking"){
-                            // $urlData = $menuSetting[$v['s_column']];
-                            // $menuList[] = array("index"=>"$index","label"=>$urlData['label'],"icon"=>$urlData['icon'],"path"=>$urlData['path']);
-                            $bookingManagement = array("index"=>"$index","label"=>"Booking","icon"=>"icon_booking__fill_b","type"=>"list");
-                            $children  = array(); 
-
                             $urlData = $menuSetting[$v['s_column']];
-                            $children[] = array("index"=>$index.'-1',"label"=>"Booking Management","path"=>$urlData['path']);
-                            $children[] = array("index"=>$index.'-2',"label"=>"Destination Delivery","path"=>"/destination-delivery");
-                            $bookingManagement["children"] = $children;
-                            $menuList[] = $bookingManagement;
-                            $index = $index + 1;
+                            $menuList[] = array("index"=>"$index","label"=>$urlData['label'],"icon"=>$urlData['icon'],"path"=>$urlData['path']);
+                            // $bookingManagement = array("index"=>"$index","label"=>"Booking","icon"=>"icon_booking__fill_b","type"=>"list");
+                            // $children  = array(); 
+
+                            // $urlData = $menuSetting[$v['s_column']];
+                            // $children[] = array("index"=>$index.'-1',"label"=>"Booking Management","path"=>$urlData['path']);
+                            // $children[] = array("index"=>$index.'-2',"label"=>"Destination Delivery","path"=>"/destination-delivery");
+                            // $bookingManagement["children"] = $children;
+                            // $menuList[] = $bookingManagement;
+                            // $index = $index + 1;
                         }
                     }
                 }

+ 6 - 1
service/destination_delivery.class.php

@@ -1558,7 +1558,12 @@ class destination_delivery {
                     ) r ON true
                 order by md.eta desc,md.h_bol asc
             )
-            select * from shipment_table where ".$recommended_delivery_sql;
+            select * from shipment_table 
+                where not exists(select 1 from  public.kln_destination_delivery kde 
+                            where status not in ('Cancel','Reject') 
+                                    and shipment_table.h_serial_no = any(kde.h_serial_no)
+                                    and (shipment_table.ctnr = ANY(regexp_split_to_array(kde.ctnr, ',')) or COALESCE(kde.ctnr,'') = '' )) 
+                and  ".$recommended_delivery_sql;
 
         $rs = common::excuteListSql($sql);
         error_log($sql);

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
service/ocean_order.class.php


+ 37 - 38
utils/common.class.php

@@ -457,6 +457,33 @@ class common {
         }
     }
 
+    /**
+     * 不转小写
+    */
+    public static function getInNotInSqlForSearchWithoutLower($contact_id, $type = 'in') {
+        if (empty($contact_id))
+            return " =''";
+        $contact_id = trim($contact_id);
+        $contact_id = trim($contact_id, ";");
+        $contact_id = trim($contact_id);
+        if ($type == 'in') {
+            if (utils::checkExist($contact_id, ";")) {
+                $ss = "";
+                $aa = explode(";", $contact_id);
+                foreach ($aa as $k => $v) {
+                    $v = trim($v);
+                    if (empty($ss))
+                        $ss = "'" . common::check_input($v) . "'";
+                    else
+                        $ss .= ",'" . common::check_input($v) . "'";
+                }
+                return  $ss;
+            } else {
+                return "'" . common::check_input($contact_id) . "'";
+            }
+        }
+    }
+
      /*
      * Encrypt a SQL query statement used to be passed as a parameter to get excel output
       encode  :DeCode('str','E');
@@ -621,17 +648,9 @@ class common {
                 if (!empty($d) && strtolower($d) != 'all') {
                     //$sql .= " and lower(agent)";
                     //$sql .= utils::getInSql($d);
-                    $inClause = utils::getInSql($d); 
-                    $sql .= " AND (";
-                    $sql .= " LOWER(agent) " . $inClause;
-                    //$sql .= " OR LOWER(to_other_stations) " . $inClause;
-                    $sql .= " OR EXISTS(SELECT 1 FROM ".$schemas.".ocean  where ocean.serial_no = ".$tableName.".serial_no AND LOWER(ocean.to_other_stations) " . $inClause.")" ;
-                    $sql .= " OR EXISTS (";
-                    $sql .= "     SELECT 1 FROM ".$schemas.".ocean_agent ";
-                    $sql .= "     WHERE ocean_agent.serial_no = ".$tableName.".serial_no ";
-                    $sql .= "       AND LOWER(ocean_agent.edi_agent) " . $inClause;
-                    $sql .= " )";
-                    $sql .= " )";
+                    $inClause = common::getInNotInSqlForSearchWithoutLower($d); 
+                    $arrayLiteral = 'ARRAY[' . $inClause . ']::text[]';
+                    $sql .= " and edi_agent && $arrayLiteral";
                 }
                 $sqlWhere .= " and (" . $sql . ")";
             }
@@ -772,17 +791,9 @@ class common {
                         if (!empty($d) && strtolower($d) != 'all') {
                             //$sql .= " and lower(agent)";
                             //$sql .= utils::getInSql($d);
-                            $inClause = utils::getInSql($d); 
-                            $sql .= " AND (";
-                            $sql .= " LOWER(agent) " . $inClause;
-                            //$sql .= " OR LOWER(to_other_stations) " . $inClause;
-                            $sql .= " OR EXISTS(SELECT 1 FROM ".$schames.".ocean  where ocean.serial_no = ".$tableName.".serial_no AND LOWER(ocean.to_other_stations) " . $inClause.")" ;
-                            $sql .= " OR EXISTS (";
-                            $sql .= "     SELECT 1 FROM ".$schames.".ocean_agent ";
-                            $sql .= "     WHERE ocean_agent.serial_no = ".$tableName.".serial_no ";
-                            $sql .= "       AND LOWER(ocean_agent.edi_agent) " . $inClause;
-                            $sql .= " )";
-                            $sql .= " )";
+                            $inClause = common::getInNotInSqlForSearchWithoutLower($d); 
+                            $arrayLiteral = 'ARRAY[' . $inClause . ']::text[]';
+                            $sql .= " and edi_agent && $arrayLiteral";
                         }
                         $sqlWhere .= " and (" . $sql . ")";
                     }
@@ -2618,24 +2629,12 @@ class common {
         $sqlWhere = " 1<>1 ";
         foreach($customerType as $value){
             //controlling_customer_code
-            if ($value == 'customer_code') {
-                if ($specialType == "container_bar") {
-                    $tempSql = " case when  order_from = 'public' 
-                                then (exists(select 1 from public.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($contactId)." limit 1))
+            if ($value == 'customer_code' && $specialType == "container_bar") {
+                $tempSql = " case when  order_from = 'public' 
+                                then (exists(select 1 from public.ocean_extend ex where ex.serial_no = online_container.serial_no and lower(ex.customer_code) " . common::getInNotInSql($contactId)." limit 1))
                             when order_from = 'sfs' 
-                                then (exists(select 1 from sfs.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($contactId)." limit 1))
+                                then (exists(select 1 from sfs.ocean_extend ex where ex.serial_no = online_container.serial_no and lower(ex.customer_code) " . common::getInNotInSql($contactId)." limit 1))
                             else 1<>1 end ";
-                } else {
-                    $tempSql = " case when transport_mode = 'sea' and order_from = 'public' 
-                                then (exists(select 1 from public.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($contactId)." limit 1))
-                            when transport_mode = 'sea' and order_from = 'sfs' 
-                                then (exists(select 1 from sfs.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($contactId)." limit 1))
-                            when transport_mode = 'air' and order_from = 'public' 
-                                then (exists(select 1 from public.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($contactId)." limit 1))
-                            when transport_mode = 'air' and order_from = 'sfs' 
-                                then (exists(select 1 from sfs.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($contactId)." limit 1))
-                            else 1<>1 end ";    
-                }
                 $sqlWhere .= " or ($tempSql)";
             } else {
                 $sqlWhere .= " or lower(".$value.") ". common::getInNotInSql($contactId);

Некоторые файлы не были показаны из-за большого количества измененных файлов