cqpCow 1 yıl önce
ebeveyn
işleme
a44a2440bc

+ 5 - 0
app/Model/Construction.php

@@ -32,5 +32,10 @@ class Construction extends UseScopeBaseModel
         self::STATE_ONE => '施工中',
         self::STATE_TWO => '已施工',
     ];
+
+    public static $pq_name = [
+        self::STATE_ZERO => '未排期',
+        self::STATE_ONE => '已排期',
+    ];
     const range_function = 'constructionRange';
 }

+ 19 - 8
app/Service/ConstructionService.php

@@ -310,13 +310,13 @@ class ConstructionService extends Service
             ProductInventoryService::changeLockNumber($user,[],$product_save);
 
             //排班修改
-            $schedule = ScheduleInfo::where('del_time',0)
-                ->where('schedule_id',$construction['schedule_id'])
-                ->where('start_time',$construction['day_start_stamp'])
-                ->where('end_time',$construction['day_end_stamp'])
-                ->where('is_use','>', ScheduleInfo::not_use)
-                ->first();
-            if(! empty($schedule)) ScheduleInfo::where('id',$schedule->id)->update(['is_use' => ScheduleInfo::not_use]);
+//            $schedule = ScheduleInfo::where('del_time',0)
+//                ->where('schedule_id',$construction['schedule_id'])
+//                ->where('start_time',$construction['day_start_stamp'])
+//                ->where('end_time',$construction['day_end_stamp'])
+//                ->where('is_use','>', ScheduleInfo::not_use)
+//                ->first();
+//            if(! empty($schedule)) ScheduleInfo::where('id',$schedule->id)->update(['is_use' => ScheduleInfo::not_use]);
 
             DB::commit();
         }catch (\Exception $exception){
@@ -474,10 +474,11 @@ class ConstructionService extends Service
     public function constructionList($data,$user){
         $model = Construction::Clear($user,$data);
         $model = $model->where('del_time',0)
-            ->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','service_price','storehouse_id','start_time','end_time')
+            ->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','service_price','storehouse_id','start_time','end_time','pq_state','day_start_stamp','day_end_stamp')
             ->orderby('id', 'desc');
 
         if(isset($data['state'])) $model->where('state', $data['state']);
+        if(isset($data['pq_state'])) $model->where('pq_state', $data['pq_state']);
         if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
         if(! empty($data['model_type'])) $model->where('model_type',$data['model_type']);
         if(! empty($data['time_type'])) {
@@ -498,6 +499,10 @@ class ConstructionService extends Service
             $model->where('start_time','>=',$return[0]);
             $model->where('end_time','<=',$return[1]);
         }
+        if(! empty($data['pq_period'][0]) && ! empty($data['pq_period'][1])) {
+            $model->where('day_start_stamp','>=',$this->changeDateToDateMin($data['pq_period'][0]));
+            $model->where('day_end_stamp','<=',$this->changeDateToDateMin($data['pq_period'][1]));
+        }
         if(! empty($data['sale_order'])){
             $model2 = SalesOrder::Clear($user,$data);
             $sale = $model2->where('del_time',0)
@@ -713,6 +718,12 @@ class ConstructionService extends Service
             $data['data'][$key]['handover_time'] = $tmp_sales_time;
             $data['data'][$key]['storehouse_title'] = $storehouse[$value['storehouse_id']] ?? '';
             $data['data'][$key]['dispatch_company'] = $dispatch[$value['sales_order_id']] ?? '';
+            $data['data'][$key]['pq_state_title'] = Construction::$pq_name[$value['pq_state']] ?? '';
+            $str = "";
+            $start_time = $value['day_start_stamp'] ? date("Y-m-d H:i",$value['day_start_stamp']) : '';
+            $end_time = $value['day_end_stamp'] ? date("Y-m-d H:i",$value['day_end_stamp']) : '';
+            if(! empty($start_time) && ! empty($end_time)) $str = $start_time . '——' . $end_time;
+            $data['data'][$key]['pq_period'] = $str;
         }
 
         return $data;

+ 8 - 0
config/header/34.php

@@ -51,6 +51,14 @@ return [
         'value' => '订单状态',
     ],
     [
+        'key' => 'pq_state_title',
+        'value' => '是否排期施工',
+    ],
+    [
+        'key' => 'pq_period',
+        'value' => '排期时间',
+    ],
+    [
         'key' => 'crt_time',
         'value' => '创建时间',
     ],

+ 9 - 0
routes/wx.php

@@ -68,4 +68,13 @@ Route::group(['middleware'=> ['checkWx']],function ($route){
     $route->any('ReturnExchangeOrderAdd', 'Api\ReturnExchangeOrderController@ReturnExchangeOrderAdd');
     $route->any('ReturnExchangeOrderDel', 'Api\ReturnExchangeOrderController@ReturnExchangeOrderDel');
 
+    //排班设置
+    $route->any('scheduleList', 'Api\ScheduleController@getList');
+    $route->any('scheduleEdit', 'Api\ScheduleController@edit');
+    $route->any('scheduleDetail', 'Api\ScheduleController@detail');
+    $route->any('scheduleAdd', 'Api\ScheduleController@add');
+    $route->any('scheduleDel', 'Api\ScheduleController@del');
+    $route->any('scheduleGetForConstruction', 'Api\ScheduleController@scheduleGetForConstruction');
+    //排期
+    $route->any('pq','Api\DeleteController@pq');
 });