ShuanghongS 3 долоо хоног өмнө
parent
commit
3593f23f4a

+ 8 - 5
service/destination_delivery.class.php

@@ -299,12 +299,12 @@ class destination_delivery {
 
             $sqlWhere = ' where ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
             //兜底规则
-            //$sqlWhere .= " and eta >= now() - INTERVAL '3 months' and eta <= now() + INTERVAL '1 months'";
-            $consignee = common::check_input($_POST ['consignee']);
+            $sqlKNDDWhere = "and exists(select 1 from public.kln_ocean ". $sqlWhere."  and kln_ocean.serial_no = any(kln_destination_delivery.h_serial_no) limit 1)";  
+
+            $consignee = common::check_input($_POST ['consignee']); 
             if(!empty($consignee)){
-                $sqlWhere .= " and consignee ilike '".$consignee."%'";
-            }
-            $sqlKNDDWhere = "and exists(select 1 from public.kln_ocean ". $sqlWhere."  and kln_ocean.serial_no = any(kln_destination_delivery.h_serial_no) limit 1)";                    
+                $sqlKNDDWhere .= " and consignee ilike '%".$consignee."%'";
+            }                 
 
             $sql  = "select DISTINCT consignee AS code from public.kln_destination_delivery
                     where 
@@ -807,6 +807,9 @@ class destination_delivery {
 
             $sqlWhere_bk= $sqlWhere;
             $sqlKNDDWhere = "and exists(select 1 from public.kln_ocean ". $sqlWhere_bk."  and kln_ocean.serial_no = any(kln_destination_delivery.h_serial_no) limit 1)";
+            if(!empty($consignee)){
+                $sqlKNDDWhere .= " and consignee ilike '%".$consignee."%'";
+            }
 
             //兜底规则
             $sqlWhere .= " and eta >= now() - INTERVAL '3 months' and eta <= now() + INTERVAL '1 months' and 1<>1 ";