|
@@ -24,6 +24,7 @@ class ConstructionService extends Service
|
|
$model->order_number = $data['order_number'];
|
|
$model->order_number = $data['order_number'];
|
|
$model->title = $data['title'] ?? '';
|
|
$model->title = $data['title'] ?? '';
|
|
$model->customer_id = $data['customer_id'] ?? 0;
|
|
$model->customer_id = $data['customer_id'] ?? 0;
|
|
|
|
+ $model->customer_contact_id = $data['customer_contact_id'] ?? 0;
|
|
$model->install_method = $data['install_method'] ?? 0;
|
|
$model->install_method = $data['install_method'] ?? 0;
|
|
$model->install_position = $data['install_position'] ?? '';
|
|
$model->install_position = $data['install_position'] ?? '';
|
|
$model->sales_order_id = $data['sales_order_id'] ?? 0;
|
|
$model->sales_order_id = $data['sales_order_id'] ?? 0;
|
|
@@ -110,6 +111,7 @@ class ConstructionService extends Service
|
|
$model->order_number = $data['order_number'];
|
|
$model->order_number = $data['order_number'];
|
|
$model->title = $data['title'] ?? '';
|
|
$model->title = $data['title'] ?? '';
|
|
$model->customer_id = $data['customer_id'] ?? 0;
|
|
$model->customer_id = $data['customer_id'] ?? 0;
|
|
|
|
+ $model->customer_contact_id = $data['customer_contact_id'] ?? 0;
|
|
$model->install_method = $data['install_method'] ?? 0;
|
|
$model->install_method = $data['install_method'] ?? 0;
|
|
$model->install_position = $data['install_position'] ?? '';
|
|
$model->install_position = $data['install_position'] ?? '';
|
|
$model->sales_order_id = $data['sales_order_id'] ?? 0;
|
|
$model->sales_order_id = $data['sales_order_id'] ?? 0;
|
|
@@ -211,6 +213,10 @@ class ConstructionService extends Service
|
|
->first();
|
|
->first();
|
|
if(empty($construction)) return [false,'施工订单不存在或已被删除'];
|
|
if(empty($construction)) return [false,'施工订单不存在或已被删除'];
|
|
$construction = $construction->toArray();
|
|
$construction = $construction->toArray();
|
|
|
|
+ $customer_title = Customer::where('id',$construction['customer_id'])->value('title');
|
|
|
|
+ $construction['customer_title'] = $customer_title;
|
|
|
|
+ $emp_title = Employee::where('id',$construction['customer_contact_id'])->value('emp_name');
|
|
|
|
+ $construction['customer_contact_title'] = $emp_title;
|
|
$construction['employee_one'] = $construction['construction_contact'] = $construction['product'] = [];
|
|
$construction['employee_one'] = $construction['construction_contact'] = $construction['product'] = [];
|
|
$array = [
|
|
$array = [
|
|
$construction['install_method'],
|
|
$construction['install_method'],
|
|
@@ -274,7 +280,7 @@ class ConstructionService extends Service
|
|
public function constructionList($data,$user){
|
|
public function constructionList($data,$user){
|
|
$model = new Construction(['userData' => $user]);
|
|
$model = new Construction(['userData' => $user]);
|
|
$model = $model->where('del_time',0)
|
|
$model = $model->where('del_time',0)
|
|
- ->select('title','id','model_type','order_number','customer_id','install_method','install_position','sales_order_id','construction_fee','construction_time','handover_time','urgency','crt_id','crt_time','mark','state','address1','address2','introduction')
|
|
|
|
|
|
+ ->select('title','id','model_type','order_number','customer_id','customer_contact_id','install_method','install_position','sales_order_id','construction_fee','construction_time','handover_time','urgency','crt_id','crt_time','mark','state','address1','address2','introduction')
|
|
->orderby('id', 'desc')
|
|
->orderby('id', 'desc')
|
|
->where('model_type',$data['model_type']);
|
|
->where('model_type',$data['model_type']);
|
|
|
|
|
|
@@ -334,7 +340,7 @@ class ConstructionService extends Service
|
|
$basic_map = BasicType::whereIn('id',$array)
|
|
$basic_map = BasicType::whereIn('id',$array)
|
|
->pluck('title','id')
|
|
->pluck('title','id')
|
|
->toArray();
|
|
->toArray();
|
|
- $emp = Employee::whereIn('id',array_unique(array_column($data['data'],'crt_id')))
|
|
|
|
|
|
+ $emp = Employee::whereIn('id',array_unique(array_merge_recursive(array_column($data['data'],'crt_id'),array_column($data['data'],'customer_contact_id'))))
|
|
->pluck('emp_name','id')
|
|
->pluck('emp_name','id')
|
|
->toArray();
|
|
->toArray();
|
|
$customer = Customer::whereIn('id',array_unique(array_column($data['data'],'customer_id')))
|
|
$customer = Customer::whereIn('id',array_unique(array_column($data['data'],'customer_id')))
|
|
@@ -347,6 +353,7 @@ class ConstructionService extends Service
|
|
$data['data'][$key]['customer_title'] = $customer[$value['customer_id']] ?? '';
|
|
$data['data'][$key]['customer_title'] = $customer[$value['customer_id']] ?? '';
|
|
$data['data'][$key]['crt_time'] = $value['crt_time'] ? date('Y-m-d H:i:s',$value['crt_time']) : '';
|
|
$data['data'][$key]['crt_time'] = $value['crt_time'] ? date('Y-m-d H:i:s',$value['crt_time']) : '';
|
|
$data['data'][$key]['crt_name'] = $emp[$value['crt_id']] ?? '';
|
|
$data['data'][$key]['crt_name'] = $emp[$value['crt_id']] ?? '';
|
|
|
|
+ $data['data'][$key]['customer_contact_title'] = $emp[$value['customer_contact_id']] ?? '';
|
|
}
|
|
}
|
|
|
|
|
|
return $data;
|
|
return $data;
|