cqp 3 месяцев назад
Родитель
Сommit
3b7b619ce8
2 измененных файлов с 16 добавлено и 0 удалено
  1. 8 0
      app/Service/CustomerSupplyService.php
  2. 8 0
      app/Service/QuantizationService.php

+ 8 - 0
app/Service/CustomerSupplyService.php

@@ -234,6 +234,14 @@ class CustomerSupplyService extends Service
         return [true, $list];
     }
 
+    public function customerSupplyListForSearch($data,$user){
+        $model = $this->customerSupplyCommon($data, $user,['id']);
+        $id = $model->get()->toArray();
+        $id = array_column($id,'id');
+
+        return [true, $id];
+    }
+
     public function customerSupplyRule(&$data, $user, $is_add = true){
         if(empty($data['code'])) return [false, '编码不能为空'];
         if(empty($data['title'])) return [false, '名称不能为空'];

+ 8 - 0
app/Service/QuantizationService.php

@@ -457,6 +457,14 @@ class QuantizationService extends Service
 
         if(! empty($data['type'])) $model->where('type', $data['type']);
         if(! empty($data['id'])) $model->whereIn('id', $data['id']);
+        if(! empty($data['customer_supply_title'])){
+            list($status, $id) = (new CustomerSupplyService())->customerSupplyListForSearch(['title' => $data['customer_supply_title']], $user);
+            $model->whereIn('customer_supply_id', $id);
+        }
+        if(! empty($data['customer_supply_code'])){
+            list($status, $id) = (new CustomerSupplyService())->customerSupplyListForSearch(['code' => $data['customer_supply_code']], $user);
+            $model->whereIn('customer_supply_id', $id);
+        }
         if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) {
             $return = $this->changeDateToTimeStampAboutRange($data['crt_time']);
             $model->where('crt_time','>=',$return[0]);