Browse Source

客户简称-》为了用友

cqpCow 1 năm trước cách đây
mục cha
commit
0bc255ac0b
1 tập tin đã thay đổi với 29 bổ sung6 xóa
  1. 29 6
      app/Service/SalesOrderService.php

+ 29 - 6
app/Service/SalesOrderService.php

@@ -59,6 +59,7 @@ class SalesOrderService extends Service
             $model->install_method = $data['install_method'] ?? 0;
             $model->install_position = $data['install_position'] ?? 0;
             $model->customer_id = $data['customer_id'] ?? 0;
+            $model->customer_short_name = $data['customer_short_name'] ?? "";
             $model->customer_contact = $data['customer_contact'] ?? "";
             $model->sign_time = $data['sign_time'] ?? 0;
             $model->product_total = $data['product_total'] ?? 0;
@@ -239,6 +240,7 @@ class SalesOrderService extends Service
             $model->install_method = $data['install_method'] ?? 0;
             $model->install_position = $data['install_position'] ?? 0;
             $model->customer_id = $data['customer_id'] ?? 0;
+            $model->customer_short_name = $data['customer_short_name'] ?? "";
             $model->customer_contact = $data['customer_contact'] ?? "";
             $model->sign_time = $data['sign_time'] ?? 0;
             $model->product_total = $data['product_total'] ?? 0;
@@ -812,6 +814,10 @@ class SalesOrderService extends Service
         if(! empty($data['expire_time'])) $data['expire_time'] = $this->changeDateToDateMin($data['expire_time']);
 //        if(empty($data['employee_two'])) return [false,'请选择负责人'];
 //        if(empty($data['product'])) return [false,'请选择产品'];
+        //限制频率
+        list($status,$msg) = $this->limitingSendRequestBackgExpire("saleOrder" . $data['order_number']);
+        if(! $status) return [false, $msg];
+
         if(! empty($data['product'])){
             foreach ($data['product'] as $value){
                 if(empty($value['number'])) return [false,'产品数量不能为空'];
@@ -836,16 +842,33 @@ class SalesOrderService extends Service
         if(empty($data['depart_id'])) $data['depart_id'] = $this->getDepart($user);
         $data['top_depart_id'] = $user['depart_map'][$data['depart_id']] ?? 0;
 
+        //是否总部
+        $is_head_now = 0;
+        if($data['top_depart_id'] == $user['head']['id']) $is_head_now = 1;
+
         if($data['model_type'] == SalesOrder::Model_type_one){
-//            if(empty($data['order_type'])) return [false,'订单类型不能为空'];
             if(! empty($data['construction_time'])) $data['construction_time'] = $this->changeDateToDateMin($data['construction_time']);
             if(! empty($data['handover_time'])) $data['handover_time'] = $this->changeDateToDateMin($data['handover_time']);
-//            if(empty($data['deal_type'])) return [false,'成交类型不能为空'];
+            if($is_head_now){
+                if(empty($data['plat_type'])) return [false,'平台类型不能为空'];
+                if(empty($data['customer_short_name'])) return [false,'客户简称不能为空'];
+            }
         }elseif($data['model_type'] == SalesOrder::Model_type_two){
-        }else{
-//            if(empty($data['car_type'])) return [false,'车型不能为空'];
-//            if(empty($data['year'])) return [false,'年份不能为空'];
-//            if(empty($data['mileage'])) return [false,'表显里程不能为空'];
+
+        }elseif($data['model_type'] == SalesOrder::Model_type_three){
+
+        }elseif($data['model_type'] == SalesOrder::Model_type_four){
+            if($is_head_now){
+                if(empty($data['plat_type'])) return [false,'平台类型不能为空'];
+                if(empty($data['customer_short_name'])) return [false,'客户简称不能为空'];
+            }
+        }elseif($data['model_type'] == SalesOrder::Model_type_five){
+            if($is_head_now){
+                if(empty($data['plat_type'])) return [false,'平台类型不能为空'];
+                if(empty($data['customer_short_name'])) return [false,'客户简称不能为空'];
+            }
+        }elseif($data['model_type'] == SalesOrder::Model_type_six){
+
         }
 
         //收付款信息