|
@@ -362,11 +362,25 @@ class RangeService extends Service
|
|
|
if(! $bool){
|
|
|
$current_top_depart_id = $user['depart_top'][0] ?? [];
|
|
|
$current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
|
|
|
- $sales_order_id = SalesOrder::whereIn('id', $sales_order_id)
|
|
|
+ //查找是否合同指派了门店
|
|
|
+ $dispatch_company = SeeRange::where('del_time',0)
|
|
|
+ ->whereIn('data_id',$sales_order_id)
|
|
|
+ ->where('param_id', $current_top_depart_id)
|
|
|
+ ->where('data_type',SeeRange::type_seven)
|
|
|
+ ->where('type',SeeRange::data_three)
|
|
|
+ ->select('data_id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $dispatch_company = array_column($dispatch_company,'data_id');
|
|
|
+
|
|
|
+ // 找出仅在 $array1 中存在的元素
|
|
|
+ $diff1 = array_diff($sales_order_id, $dispatch_company);
|
|
|
+
|
|
|
+ $sales_order_id = SalesOrder::whereIn('id', $diff1)
|
|
|
->where('top_depart_id',$current_top_depart_id)
|
|
|
->select('id')
|
|
|
->get()->toArray();
|
|
|
$sales_order_id = array_column($sales_order_id,'sales_order_id');
|
|
|
+ $sales_order_id = array_merge_recursive($sales_order_id,$dispatch_company);
|
|
|
}
|
|
|
|
|
|
//指派后 可见范围id
|