|
@@ -270,12 +270,19 @@ class ConstructionService extends Service
|
|
|
* @param $data
|
|
|
* @return array
|
|
|
*/
|
|
|
- public function constructionDetail($data){
|
|
|
- if($this->isEmpty($data,'id')) return [false,'请选择数据!'];
|
|
|
+ public function detail($data){
|
|
|
+ if(empty($data['id']) && empty($data['order_number'])) return [false,'请选择数据!'];
|
|
|
|
|
|
- $construction = Construction::where('del_time',0)
|
|
|
- ->where('id',$data['id'])
|
|
|
- ->first();
|
|
|
+ if(! empty($data['id'])){
|
|
|
+ $construction = Construction::where('del_time',0)
|
|
|
+ ->where('id',$data['id'])
|
|
|
+ ->first();
|
|
|
+ }else{
|
|
|
+ $construction = Construction::where('del_time',0)
|
|
|
+ ->where('order_number',$data['order_number'])
|
|
|
+ ->first();
|
|
|
+ $data['id'] = empty($construction->id) ? 0 : $construction->id;
|
|
|
+ }
|
|
|
if(empty($construction)) return [false,'施工订单不存在或已被删除'];
|
|
|
$construction = $construction->toArray();
|
|
|
$address = '';
|
|
@@ -399,6 +406,14 @@ class ConstructionService extends Service
|
|
|
$model->where('start_time','>=',$return[0]);
|
|
|
$model->where('end_time','<=',$return[1]);
|
|
|
}
|
|
|
+ if(! empty($data['sale_order'])){
|
|
|
+ $model2 = SalesOrder::Clear($user,$data);
|
|
|
+ $sale = $model2->where('del_time',0)
|
|
|
+ ->where('order_number', 'LIKE', '%'.$data['sale_order'].'%')
|
|
|
+ ->select('id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $model->whereIn('sales_order_id',array_unique(array_column($sale,'id')));
|
|
|
+ }
|
|
|
|
|
|
$list = $this->limit($model,'',$data);
|
|
|
$list = $this->fillData($list);
|