ShuanghongS 1 nedēļu atpakaļ
vecāks
revīzija
078935f73d

+ 19 - 14
service/column.class.php

@@ -24,12 +24,28 @@ class column {
             //      where lower(login_name)='" . strtolower(_getLoginName()) . "' and lower(model_name) = '" . strtolower($model_name) . "'");
         }
         if (empty($type)) {
+            if($model_name <> 'destination_delivery_shipment_search'){
+                //预先初始化,空的也要保留
+                $children['All'] = array();
+                $children['Reference No.'] = array();
+                $children['General'] = array();
+                $children['Parties'] = array();
+                $children['Packing'] = array();
+                $children['Time'] = array();
+                $children['Places'] = array();
+                $children['Transportation'] = array();
+                $children['Others'] = array();
+            }else{
+                //预先初始化,空的也要保留.只需要ALL
+                $children['All'] = array();
+            }
+
             $allData = $this->getDisplayColumnAllReomveDefault($model_name);
-            $groupColumns_all = $this->allGroupColumns($allData);
+            $groupColumns_all = $this->allGroupColumns($allData,$children);
 
             //总分组的检索要去掉右边的已经选中的部分
             $dataLeft = $this->getDisplayColumn($model_name,false);
-            $groupColumns_left = $this->allGroupColumns($dataLeft);
+            $groupColumns_left = $this->allGroupColumns($dataLeft,$children);
 
             $setting = $this->getDisplayColumn($model_name);
             $groupSetting = $this->groupColumnsSetting($setting);
@@ -327,18 +343,7 @@ class column {
     /**
      * 通用返回setting 分组数据
      */
-    public function allGroupColumns($allData){
-        $children = array();
-        //预先初始化,空的也要保留
-        $children['All'] = array();
-        $children['Reference No.'] = array();
-        $children['General'] = array();
-        $children['Parties'] = array();
-        $children['Packing'] = array();
-        $children['Time'] = array();
-        $children['Places'] = array();
-        $children['Transportation'] = array();
-        $children['Others'] = array();
+    public function allGroupColumns($allData,$children){
         foreach ($allData as $key => $data) {
             //固定ALl的分组
             if (array_key_exists("All", $children)) {

+ 29 - 16
service/destination_delivery.class.php

@@ -588,6 +588,13 @@ class destination_delivery {
             exit();
         }
 
+        /**
+         * customize columns的按鈕
+        */
+        if ($operate == 'destination_delivery_shipment_display') {
+            column::getInstance()->settingDisplay('destination_delivery_shipment_search', '');
+        }
+
         if ($operate == "destination_delivery_shipment_search") {
             //search
             //栏位信息
@@ -1495,22 +1502,28 @@ class destination_delivery {
                 from matched_data md
                 LEFT JOIN LATERAL (
                     SELECT 
-                        r.*
+                        r.*,
+                        CASE 
+                          WHEN md.transport_mode = 'sea' THEN
+                              CASE 
+                                  WHEN r.ports != 'ALL' AND r.carrier != 'ALL' THEN 4
+                                  WHEN r.ports != 'ALL' AND r.carrier = 'ALL'  THEN 3
+                                  WHEN r.ports = 'ALL'  AND r.carrier != 'ALL' THEN 2
+                                  ELSE 1
+                              END
+                          WHEN md.transport_mode = 'air' THEN
+                              CASE 
+                                  WHEN r.ports != 'ALL' THEN 2   
+                                  ELSE 1                          
+                              END
+                          ELSE 0
+                      END AS match_score
                     FROM public.kln_destination_delivery_rule r 
-                    WHERE md.transport_mode = r.mode_type 
-                        and r.recommended_delivery_serial_no = md.dc_serial_no
-                        AND ((md.transport_mode = 'sea' AND (
-                                (r.ports ilike '%'|| md.mport_of_discharge_un ||'%' AND r.carrier ilike '%'|| md.carrier ||'%') 
-                                OR (r.ports ilike '%'|| md.mport_of_discharge_un ||'%' AND r.carrier = 'ALL')
-                                OR (r.ports = 'ALL' AND r.carrier ilike '%'|| md.carrier ||'%')
-                                OR (r.ports = 'ALL' AND r.carrier = 'ALL'))
-                            ) 
-                            OR (md.transport_mode = 'air' AND (
-                                r.ports ilike '%'|| md.mport_of_discharge_un ||'%'
-                                OR r.ports = 'ALL')
-                            )
-                        )
-                        ORDER BY priority asc
+                    WHERE  r.recommended_delivery_serial_no = md.dc_serial_no
+                        AND r.mode_type = md.transport_mode
+                        AND (COALESCE(r.ports,'') = 'ALL' OR COALESCE(r.ports,'') ilike '%'|| md.mport_of_discharge_un ||'%')
+                        AND (COALESCE(r.carrier,'') = 'ALL' OR COALESCE(r.carrier,'') ilike '%'|| md.carrier ||'%' )
+                        ORDER BY match_score DESC,priority asc
                         LIMIT 1
                     ) r ON true
                 order by md.eta desc,md.h_bol asc
@@ -1518,7 +1531,7 @@ class destination_delivery {
             select * from shipment_table where ".$recommended_delivery_sql;
 
         $rs = common::excuteListSql($sql);
-        //error_log($sql);
+        error_log($sql);
         if(empty($rs)){
             return array("msg"=>"No Eligible Shipments for Booking","data"=>"");
         }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
service/ocean_order.class.php


+ 1 - 1
utils/common.class.php

@@ -3687,7 +3687,7 @@ class common {
         }
         $content = strtr($contents['content'], $replacements);
         $content = common::check_input($content);
-        error_log($content);
+        //error_log($content);
 
         $sql = "INSERT INTO email_record(type, title, from_email, to_email, content, insert_date, cc_email, attachment_path)
             VALUES ('" . $report_type . "', '" . $subject . "', '" . $email_from . "', '".$to_email . "', '" . $content . "', now(), '" . $cc_email . "', '');";

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels