ShuanghongS преди 3 месеца
родител
ревизия
6a8dad0613
променени са 3 файла, в които са добавени 42 реда и са изтрити 52 реда
  1. 30 23
      service/destination_delivery.class.php
  2. 0 29
      service/login.class.php
  3. 12 0
      service/ocean_order.class.php

+ 30 - 23
service/destination_delivery.class.php

@@ -833,25 +833,32 @@ class destination_delivery {
             $special_requirements = common::check_input($_POST['special_requirements']);
 
             //检查不能重复添加booking  这里空运没问题,但是会遇到相同hbol 不同的柜子情况,本质上来说就是一条
-            //$sqlWhere = ' where ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
+            $sqlWhere = ' where ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
             //兜底规则
-            //$sqlWhere .= " and  eta >= now() - INTERVAL '6 months' and eta <= now() + INTERVAL '6 months'";
-
-            // $ckeckedSql = "with save_table as (select regexp_split_to_table('".utils::implode(',',$h_serial_no)."', ',') as serial_no)
-            // select string_agg(h_bol, ';') as h_bol from public.kln_destination_delivery kde
-            //         where exists(select 1 from save_table where save_table.serial_no = any(kde.h_serial_no))
-            //             and exists(select 1 from public.kln_ocean oo ". $sqlWhere."  and oo.serial_no = any(kde.h_serial_no))";
-            // //代表编辑
-            // if(!empty($serial_no)){
-            //     $ckeckedSql .=" and kde.serial_no <> '$serial_no'";
-            // }            
-
-            // $checkeData = common::excuteObjectSql($ckeckedSql);
-            // if(!empty($checkeData['h_bol'])){
-            //     $data = array("msg" =>"The ".$checkeData['h_bol'] ." already exists");
-            //     common::echo_json_encode(200,$data); 
-            //     exit();
-            // }
+            $sqlWhere .= " and  eta >= now() - INTERVAL '6 months' and eta <= now() + INTERVAL '6 months'";
+
+            $ckeckedSql = "with save_table as (
+                    select regexp_split_to_table('".utils::implode(',',$h_serial_no)."', ',') as serial_no
+                ),
+                save_table_ctnr as (
+                    select regexp_split_to_table('".utils::implode(',',$ctnr)."', ',') as ctnr
+                )
+                select h_bol,ctnr from public.kln_destination_delivery kde
+                    where exists(select 1 from save_table where save_table.serial_no = any(kde.h_serial_no))
+                        and (exists(select 1 from save_table_ctnr where save_table_ctnr.ctnr = ANY(regexp_split_to_array(kde.ctnr, ',')) 
+                            or COALESCE(kde.ctnr,'') = ''))
+                        and exists(select 1 from public.kln_ocean oo ". $sqlWhere."  and oo.serial_no = any(kde.h_serial_no) limit 1)";
+            //代表编辑
+            if(!empty($serial_no)){
+                $ckeckedSql .=" and kde.serial_no <> '$serial_no'";
+            }            
+            
+            $checkeData = common::excuteObjectSql($ckeckedSql);
+            if(!empty($checkeData['h_bol'])){
+                $data = array("msg" =>"The ".$checkeData['h_bol'] .",".$checkeData['ctnr'] ." already exists");
+                common::echo_json_encode(200,$data); 
+                exit();
+            }
 
             $sql = "";
             //代表修改
@@ -1213,17 +1220,17 @@ class destination_delivery {
         //vessel name
         $vessel = $_REQUEST['vessel'];
         if (!empty($vessel)){
-            $sqlWhere .= " and lower(vessel) like '%".strtolower($vessel)."'%";
+            $sqlWhere .= " and lower(vessel) like '%".strtolower($vessel)."%'";
         }
 
         $consignee = $_REQUEST['consignee'];
-        if (!empty($vessel)){
-            $sqlWhere .= " and lower(consignee) like '%".strtolower($consignee)."'%";
+        if (!empty($consignee)){
+            $sqlWhere .= " and lower(consignee) like '%".strtolower($consignee)."%'";
         }
 
         $shipper = $_REQUEST['shipper'];
-        if (!empty($vessel)){
-            $sqlWhere .= " and lower(shipper) like '%".strtolower($shipper)."'%";
+        if (!empty($shipper)){
+            $sqlWhere .= " and lower(shipper) like '%".strtolower($shipper)."%'";
         }
 
         if (isset($_REQUEST['eta_start']) && !empty($_REQUEST['eta_start']))

+ 0 - 29
service/login.class.php

@@ -1543,35 +1543,6 @@ class login {
         return $sql;
     }
 
-    /**
-     * 邮件链接 重置密码或者激活密码
-    */
-    private function resetAndActivateInit(){
-        $verifcation_code = $_REQUEST['verifcation_code'];
-        $AES_encrypted = utils::AES_encrypted($verifcation_code);
-
-        $secret_key = common::excuteOneSql("select secret_key from customer_service_secret_key 
-                        where secret_key = '$verifcation_code' 
-                        and create_time >= current_date - INTERVAL '7 days' limit 1");
-
-        if(!empty($AES_encrypted) && !empty($secret_key)){
-            //验证成功且数据库里有该code,进行密码的重置和修改逻辑
-            $data = array(
-                'msg' => "success",
-                'data' => ''
-            );
-            common::echo_json_encode(200, $data);
-            exit();
-        } else {
-            $data = array(
-                'msg' => 'verifcation_Invalid',
-                'data' => ''
-            );
-            common::echo_json_encode(500, $data);
-            exit();
-        }
-    }
-
     private function resetAndActivateUpdate(){
         $verifcation_code = $_REQUEST['verifcation_code'];
         $AES_encrypted = utils::AES_encrypted($verifcation_code);

+ 12 - 0
service/ocean_order.class.php

@@ -1103,6 +1103,14 @@ class ocean_order {
         $serial_no = common::deCode($_GET['a'], 'D');
         $sql = $this->getOceanDetail($serial_no);
         $ocean = common::excuteObjectSql($sql);
+        //(本质是是底表ocean 和 kln_oceans数据没有及时同步,详细页面有查询的ocean的时间照成的时间不一致),
+        //单独处理一些,用kln_ocean里面的字段,与查询页面保持一致: etd as oo_etd, eta as oo_eta,atd as oo_atd,ata as oo_ata,
+        //这样改动最小
+        //这个是同步问题,同步是实时的
+        //$ocean["f_etd"] = $ocean["oo_etd"];
+        //$ocean["m_eta"] = $ocean["oo_eta"];
+        //$ocean["atd"] = $ocean["oo_atd"];
+        //$ocean["ata"] = $ocean["oo_ata"];
         
         if (!empty($ocean)) {
             $ocean['_isf_bol'] = $ocean['isf_bol'];
@@ -1923,6 +1931,10 @@ class ocean_order {
                     mport_of_discharge_un,
                     place_of_receipt_un,
                     place_of_delivery_un,
+                    etd as oo_etd,
+                    eta as oo_eta,
+                    atd as oo_atd,
+                    ata as oo_ata,
                     (select time_zone from public.city_timezone where uncode = oo.fport_of_loading_un limit 1) as pol_timezone,
                     (select uncity from $order_from.ports where uncode = oo.fport_of_loading_un limit 1) as pol_uncity,
                     (select time_zone from public.city_timezone where uncode = oo.mport_of_discharge_un limit 1) as mpod_timezone,