ShuanghongS hai 1 mes
pai
achega
056dd05b8b
Modificáronse 2 ficheiros con 19 adicións e 2 borrados
  1. 6 2
      service/destination_delivery.class.php
  2. 13 0
      utils/common.class.php

+ 6 - 2
service/destination_delivery.class.php

@@ -799,7 +799,11 @@ class destination_delivery {
 
         if ($operate == "save"){
             $serial_no = common::deCode($_POST['serial_no'], 'D');
-
+            //DB2510210001-->DB+年+月+日+自增序號四位
+            //获取自然序列
+            $sequence = common::getDeliveryBookingSequence();  
+            $booking_no_new = "DB".date("ymd").$sequence;
+            
             $booking_no = $_POST['booking_no'];  
             $manifest_type = $_POST['manifest_type'];  
             $h_bol = $_POST['h_bol']; 
@@ -942,7 +946,7 @@ class destination_delivery {
                             recommended_delivery_from, recommended_delivery_to,kln_pic,
                             create_by, created_time, modify_by, update_time)
                     VALUES ('$serial_no', ".$tags_sql.",".$country_sql.",
-                            '".$sData['booking_no']."', '".utils::implode(',',$sData['h_bol'])."','".common::check_input(json_encode($sData['h_bol_multiple_link']))."',
+                            '".$booking_no_new."', '".utils::implode(',',$sData['h_bol'])."','".common::check_input(json_encode($sData['h_bol_multiple_link']))."',
                             '".utils::implode(',',$sData['m_bol'])."', '".utils::implode(',',$sData['ctnr'])."',
                             '".$sData['consignee']."', $delivery_date,'$delivery_mode','$status', '$delivery_address','$delivery_address_detail', '$special_requirements','$delivery_reference',
                             $recommended_delivery_window_date_from, $recommended_delivery_window_date_to,'',

+ 13 - 0
utils/common.class.php

@@ -2621,6 +2621,19 @@ class common {
         return $sequence;
     }
 
+    /**
+     * Delivery Booking No获取自然序列号
+    */
+    public static function getDeliveryBookingSequence(){
+        $sequence = common::excuteOneSql("select count(*) from public.kln_destination_delivery where created_time >= CURRENT_DATE");
+        $sequence = empty($sequence)? "1" : $sequence + 1;
+        if($sequence >9999){
+            return $sequence;
+        }
+        $sequence = sprintf("%04d", $sequence);
+        return $sequence;
+    }
+
     /**
      * 处理chat 返回的json字符串
     */