cqpCow 1 năm trước cách đây
mục cha
commit
e15905337b
2 tập tin đã thay đổi với 36 bổ sung0 xóa
  1. 28 0
      app/Service/RangeService.php
  2. 8 0
      app/Service/SalesOrderService.php

+ 28 - 0
app/Service/RangeService.php

@@ -3,6 +3,7 @@
 namespace App\Service;
 
 use App\Model\ConstructionInfo;
+use App\Model\Customer;
 use App\Model\CustomerInfo;
 use App\Model\Depart;
 use App\Model\Employee;
@@ -423,6 +424,33 @@ class RangeService extends Service
         return array_column($return,'data_id');
     }
 
+    //客户联系方式
+    public function salesOrderCustomerMessageSearch($data){
+        $return = CustomerInfo::where('del_time',0)
+            ->where("type",CustomerInfo::type_one)
+            ->where('contact_info','LIKE', '%'.$data['contact_info'].'%')
+            ->select('customer_id')
+            ->get()->toArray();
+
+        return array_column($return,'customer_id');
+    }
+
+    //客户创建人
+    public function salesOrderCustomerCrtSearch($user,$data){
+        $emp_id = Employee::where('del_time',0)
+            ->where('emp_name','LIKE', '%'.$data['customer_crt_name'].'%')
+            ->select('id')->get()->toArray();
+        $emp_id = array_column($emp_id,'id');
+
+        $model2 = Customer::Clear($user,$data);
+        $customer = $model2->where('del_time',0)
+            ->whereIn('crt_id', $emp_id)
+            ->select('id')
+            ->get()->toArray();
+
+        return array_column($customer,'id');
+    }
+
     //收付款人搜索
     public function paymentReceiptSearch($data){
         $emp_id = Employee::where('del_time',0)

+ 8 - 0
app/Service/SalesOrderService.php

@@ -773,6 +773,14 @@ class SalesOrderService extends Service
             $model->whereIn('id',$sale_order_id);
         }
         if(! empty($data['purchase_order_number'])) $model->where('contact_order_no','LIKE', '%'.$data['purchase_order_number'].'%');
+        if(! empty($data['contact_info'])){
+            $customer_id = (new RangeService())->salesOrderCustomerMessageSearch($data);
+            $model->whereIn('customer_id',$customer_id);
+        }
+        if(! empty($data['customer_crt_name'])){
+            $customer_id = (new RangeService())->salesOrderCustomerCrtSearch($user,$data);
+            $model->whereIn('customer_id',$customer_id);
+        }
 
         $list = $this->limit($model,'',$data);
         $list = $this->fillData($list,$data);