|
@@ -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 , "暂无质保信息"];
|