ShuanghongS 1 주 전
부모
커밋
3670e99e2b
3개의 변경된 파일75개의 추가작업 그리고 13개의 파일을 삭제
  1. 16 10
      main_new_version.php
  2. 2 2
      service/AIClientFactory.php
  3. 57 1
      utils/common.class.php

+ 16 - 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;
                         }
                     }
                 }
@@ -159,6 +159,8 @@ switch ($action) {
         $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
         $sqlWhere = " " . $sqlWhere;
         $sqlWhere .= common::getDashboardTransportationSqlWhere();
+        $sqlWhere .= common::getDashboardContactIDSqlWhere();
+        
         $sqlWhere = common::check_input($sqlWhere);
 
         // $list = common::excuteListSql("select * from public.online_order_status_date_kln_pending('$type'::text, '$sqlWhere'::text) "
@@ -220,6 +222,7 @@ switch ($action) {
         $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
         $sqlWhere = " " . $sqlWhere;
         $sqlWhere = $sqlWhere . common::getDashboardTransportationSqlWhere();
+        $sqlWhere .= common::getDashboardContactIDSqlWhere();
         $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) "
@@ -266,6 +269,7 @@ switch ($action) {
         $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
         $sqlWhere = " " . $sqlWhere;
         $sqlWhere = $sqlWhere . common::getDashboardTransportationSqlWhere();
+        $sqlWhere .= common::getDashboardContactIDSqlWhere();
         $sqlWhere = common::check_input($sqlWhere);
         
         $date_type = strtolower($_REQUEST["date_type"]);
@@ -347,6 +351,7 @@ switch ($action) {
         $list= array();
         $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
         $sqlWhere = common::check_input($sqlWhere);
+        $sqlWhere .= common::getDashboardContactIDSqlWhere("container_bar");
         $sqlWhere = " " . $sqlWhere;
         //这个20  40  45都查询出来。否则值查询都对应的size,其他的不查询
         $value_arr = 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) "
@@ -603,6 +608,7 @@ switch ($action) {
 
         $sqlWhere = ' where ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
         $sqlWhere .= common::getDashboardTransportationSqlWhere();
+        $sqlWhere .= common::getDashboardContactIDSqlWhere();
         
         // test dome 
         // $_POST['is_default'] = "no";

+ 2 - 2
service/AIClientFactory.php

@@ -38,8 +38,8 @@ class AIClientFactory
             'messages' => $messages,
             'system' => $systemPrompt,
             'max_tokens' => $config['max_tokens'],
-            'temperature' => $config['temperature'],
-            'top_p' => $config['top_p']
+            'temperature' => $config['temperature']
+            //'top_p' => $config['top_p']
         ];
 
         // Prepare headers

+ 57 - 1
utils/common.class.php

@@ -1432,6 +1432,8 @@ class common {
             $mode_param = common::getInNotInSqlForSearch($transport_mode);
         }
         $sqlWhere .= " and transport_mode_extend in ($mode_param)";
+
+        $sqlWhere .= common::getDashboardContactIDSqlWhere();
          
         $ContainerCount_Title = array();
         //先查询总的排放量sea air road,确定排名后,在分别查询对应的sea air road 
@@ -1698,7 +1700,8 @@ class common {
             $transport_mode = utils::implode(';', $transportation);
             $mode_param = common::getInNotInSqlForSearch($transport_mode);
         }
-        $sqlWhere .= " and transport_mode_extend in ($mode_param)";    
+        $sqlWhere .= " and transport_mode_extend in ($mode_param)"; 
+        $sqlWhere .= common::getDashboardContactIDSqlWhere();   
          
         $toporiginType = "shippr_uncode";
         $shippr_uncode_10_sql ="with aa as  (select count(shippr_uncode) as num,shippr_uncode,
@@ -2538,6 +2541,56 @@ class common {
         return " and transport_mode_extend in ($mode_param)";
     }
 
+    public static function getDashboardContactIDSqlWhere($specialType = ""){
+        //$_REQUEST["customerCode"] = array("Al121212121","Al12121551");
+        //$_REQUEST["customerType"] = array("customer_code","consignee_id");
+        if(empty($_REQUEST["customerCode"]) 
+            || empty($_REQUEST["customerType"])
+            || common::isArrayAllEmpty($_REQUEST["customerCode"]) 
+            || common::isArrayAllEmpty($_REQUEST["customerType"])){
+            return "";
+        }
+        $contactId = $_REQUEST["customerCode"];
+        if(!is_array($contactId)){
+            $contactId = array($contactId);
+        }
+        $contactId = utils::implode(';', $contactId);
+
+        //shipper_id  consignee_id   customer_code billto_id  notify_party_id
+        $customerType = $_REQUEST["customerType"];
+        if(!is_array($customerType)){
+            $customerType = array($customerType);
+        }
+
+        $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))
+                            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))
+                            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);
+            }
+        }
+        return " and ($sqlWhere)";
+    }
+
 
     /*
      *  Create Directory
@@ -5238,6 +5291,9 @@ class common {
      * 判断数组值为空
      */
     public static function isArrayAllEmpty($arr) {
+        if(!is_array($arr)){
+            $arr = array($arr);
+        }
         foreach ($arr as $value) {
             if (trim((string)$value) !== '') {
                 return false; // 只要有一个非空,就返回 false