ShuanghongS 3 周之前
父節點
當前提交
5501806319
共有 2 個文件被更改,包括 31 次插入9 次删除
  1. 12 5
      service/destination_delivery.class.php
  2. 19 4
      utils/utils.class.php

+ 12 - 5
service/destination_delivery.class.php

@@ -1127,10 +1127,10 @@ class destination_delivery {
             $status = common::check_input($_POST['status']);
             $notes = common::check_input($_POST['notes']);
             $action_user = _getLoginName();
-
+            error_log("review: 1");
             //前端按钮 后台权限拦截
             common::checkedActionLegal($serial_no,$operate);
-
+            error_log("review: 1.1");
             global $db;
             $db->StartTrans();
             try {
@@ -1163,16 +1163,21 @@ class destination_delivery {
                                 serial_no, action,notes, create_by, created_time, created_zone)
                         VALUES ('$serial_no', '$status','$notes', '$action_user', now(), ''); ";
 
+                error_log("review: sql:".$sql);  
+
                 $db->Execute($sql) or ((!$db->ErrorMsg()) or error_log(common::dbLog($db, $sql), 0));
                 $rs = $db->CompleteTrans();
             } catch (Exception $e) {
+                error_log("review:".$e->getMessage());
                 $db->RollbackTrans();
             } 
 
             if ($rs === FALSE){
+                error_log("review: 2");
                 $data = array("msg" => "Update Error");
                 common::echo_json_encode(200,$data);
             } else{
+                error_log("review: 3");
                 //状态变更时,发送邮件提醒 
                 $data = common::excuteObjectSql("select *, 
                             TO_CHAR(delivery_date, 'Mon-DD-YYYY HH24:MI') as _delivery_date,
@@ -1180,10 +1185,12 @@ class destination_delivery {
                             TO_CHAR(update_time, 'Mon-DD-YYYY') as _update_time 
                         from public.kln_destination_delivery where serial_no = '$serial_no'");
                 $shipmentsData = $this->search_shipment_with_booking($data['serial_no'],$data['h_serial_no'],$data['ctnr']);
-                $email_sql = common::sendDestinationDeliveryReminder($data,$shipmentsData,$status);       
+                $email_sql = common::sendDestinationDeliveryReminder($data,$shipmentsData,$status);     
+                error_log("review: email_sql:".$email_sql);  
                 if(!empty($email_sql)){
                     common::excuteUpdateSql($email_sql);
-                }        
+                } 
+                error_log("review: 4");       
                 $data = array("msg" =>"success");
                 common::echo_json_encode(200,$data);
             }       
@@ -1312,7 +1319,7 @@ class destination_delivery {
                         sum(case when status ='Approve' then 1 else 0 end) as approved_rc
                     from public.kln_destination_delivery kd 
                         where ".$sqlDeliveryWhere."
-                            and exists(select 1 from public.kln_ocean oo ". $sqlWhere."  and oo.serial_no = any(h_serial_no) limit 1)
+                            and exists(select 1 from public.kln_ocean ". $sqlWhere."  and kln_ocean.serial_no = any(kd.h_serial_no) limit 1)
                     group by delivery_date::date  order by delivery_date::date desc";
             $rs  = common::excuteListSql($sql);
             error_log("delivery_date_load:".$sql);        

+ 19 - 4
utils/utils.class.php

@@ -199,8 +199,21 @@ 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.kln_ocean where md5(serial_no)=md5('$serial_no') "
-                        . "order by schem_not_display nulls last limit 1");
+                        . "order by schem_not_display nulls last limit 1");  
         $schema = $ocean["order_from"] . ".";
+        if(empty($ocean)){
+            $ocean = common::excuteObjectSql("select sales_rep, last_user, created_by,'public' as order_from, h_bol, consignee, dest_op, destination_station as agent from public.ocean 
+                    where md5(serial_no)=md5('$serial_no') order by schem_not_display nulls last limit 1");  
+            $schema = "public.";
+        }
+        //如果不是ocean air 直接返回,这里搬得ocean当前取值逻辑
+        if(empty($ocean)){
+            $email["email"] = "";
+            $email["h_bol"] = "";
+            $email["consignee"] = "";
+            return $email;
+        }
+
         $dest_op_from_agent = common::excuteOneSql("select dest_op_from_agent from " . $schema . "ocean where md5(serial_no)=md5('$serial_no')");
         if ($ocean["agent"] == "KYMTL" || $ocean["agent"] == "KYYYZ") {
             $email = array();
@@ -499,12 +512,14 @@ class utils {
         }
         
         $operateInfo = utils::getPageByAction($_REQUEST["action"],$_REQUEST["operate"]);
-        $page = $operateInfo["page"];
-        $operation = $operateInfo["operate"];
-        $operation_detail = utils::analyzeOperationDetail($_REQUEST["action"],$_REQUEST["operate"]);
+        $page = common::check_input($operateInfo["page"]);
+        $operation = common::check_input($operateInfo["operate"]);
+        $operation_detail = common::check_input(utils::analyzeOperationDetail($_REQUEST["action"],$_REQUEST["operate"]));
         if(empty($operation_detail)){
             $operation_detail = common::check_input(utils::jsonFiltration("null", "\"\"", json_encode($_REQUEST)));
         }
+
+        $user_name = common::check_input($user_name);
         //过滤一分钟以内,相同用户的重复请求
         $exist_sql = "select count(1) from public.customer_service_operation_log 
             where user_name = '$user_name'