cqp 3 bulan lalu
induk
melakukan
22cf9de60e

+ 2 - 2
app/Model/Construction.php

@@ -44,8 +44,8 @@ class Construction extends UseScopeBaseModel
         self::STATE_DIFF_TWO => '已预约施工',
         self::STATE_TWO => '施工中',
         self::STATE_THREE => '待确认',
-        self::STATE_FOUR => '验车',
-        self::STATE_FIVE => '交车',
+        self::STATE_FOUR => '验车',
+        self::STATE_FIVE => '交车',
         self::STATE_SIX => '已交车',
     ];
 

+ 2 - 2
app/Service/DataSyncToU8Service.php

@@ -372,9 +372,9 @@ class DataSyncToU8Service extends Service
             $key = $value['code'] . $value['sn'];
             if(in_array($key, $submit_info)) {
                 if(! $data_id){
-                    return [false, '产品编码:' . $value['code'] . '的sn码已在(' .ProductSnInfo::$type_name[$value['type']]] . ')中使用';
+                    return [false, '产品编码:' . $value['code'] . '的sn码已在(' .ProductSnInfo::$type_name[$value['type']]. ')中使用'];
                 }else{
-                    if($value['data_id'] != $data_id || $value['type'] != $data_type) return [false, '产品编码:' . $value['code'] . '的sn码已被' .ProductSnInfo::$type_name[$data_type]] . '使用';
+                    if($value['data_id'] != $data_id || $value['type'] != $data_type) return [false, '产品编码:' . $value['code'] . '的sn码已被' .ProductSnInfo::$type_name[$data_type] . '使用'];
                 }
             }
         }

+ 18 - 3
app/Service/TSpaceService.php

@@ -504,6 +504,7 @@ class TSpaceService extends Service
 
             (new DataSyncToU8Service())->updateByVinNo($data);
 
+            if(! empty($data['auto_id'])) (new DataSyncToU8Service())->updateSnInfo(1, [$data['auto_id']], 1);
             DB::commit();
         }catch (\Throwable $exception){
             DB::rollBack();
@@ -559,7 +560,6 @@ class TSpaceService extends Service
             'crt_id' => 0,
             'is_active' => Warranty::type_one,
             'sn_type' => 1,
-            'auto_id' => $data['auto_id'] ?? 0,
         ];
         $sn_update = [
             'data_id' => 0,
@@ -569,6 +569,7 @@ class TSpaceService extends Service
             'sn' => $data['sn'],
             'crt_time' => $time,
             'warranty_id' => 0,
+            'auto_id' => $data['auto_id'] ?? 0,
         ];
 
         return [true, [$warranty, $sn_update]];
@@ -582,6 +583,13 @@ class TSpaceService extends Service
             ->where('customer_contact',$data['customer_contact'])
             ->where('is_active',Warranty::type_zero)
             ->whereIn('type',[ProductSnInfo::type_one, ProductSnInfo::type_two])
+            ->where(function ($query) {
+                $query->where('type', '!=', ProductSnInfo::type_one)
+                    ->orWhere(function ($q) {
+                        $q->where('type', ProductSnInfo::type_one)
+                            ->where('sn', '<>', '');
+                    });
+            })//sn限制
             ->select('id','data_id','data_title','type','product_id','title','sn','customer_name','customer_contact','vin_no','warranty_time','construction_site_title','start_time');
 
         $list = $this->limit($model,'', $data);
@@ -790,8 +798,8 @@ class TSpaceService extends Service
         $bool = $this->isValidVin($data['vin_no']);
         if(! $bool) return [false, '车架号错误,请填写完整车架号'];
         if(! empty($data['sn'])){
-            list($status, $msg) = (new DataSyncToU8Service())->snForWarranty($data);
-            if(! $status) return [false, $msg];
+//            list($status, $msg) = (new DataSyncToU8Service())->snForWarranty($data);
+//            if(! $status) return [false, $msg];
             $submit_info[] = $order['code'] . $data['sn'];
             $message = [
                 'id' => $order['data_id'],
@@ -894,6 +902,13 @@ class TSpaceService extends Service
             ->when($search_field == 2, function ($query) use ($search) {
                 return $query->where("vin_no", $search);
             })
+            ->where(function ($query) {
+                $query->where('type', '!=', ProductSnInfo::type_one)
+                    ->orWhere(function ($q) {
+                        $q->where('type', ProductSnInfo::type_one)
+                            ->where('sn', '<>', '');
+                    });
+            })//sn限制
             ->orderBy('id','desc')
             ->get()->toArray();
         if(empty($order_list)) return [false , "暂无质保信息"];

+ 2 - 2
config/specialButton.php

@@ -81,14 +81,14 @@ return [
 //    ],
     [
         "id" => \App\Model\RoleMenuButton::special_eve,
-        "title" => "验车",
+        "title" => "验车",
         "sort" => -11,
         "func" => "special_sure_car",
         "menu_id" => 34,
     ],
     [
         "id" => \App\Model\RoleMenuButton::special_twl,
-        "title" => "交车",
+        "title" => "交车",
         "sort" => -12,
         "func" => "special_wait_submit_car",
         "menu_id" => 34,