cqp hace 2 meses
padre
commit
7b50c423e4
Se han modificado 2 ficheros con 9 adiciones y 3 borrados
  1. 6 2
      app/Service/DataSyncToU8Service.php
  2. 3 1
      app/Service/TSpaceService.php

+ 6 - 2
app/Service/DataSyncToU8Service.php

@@ -354,7 +354,7 @@ class DataSyncToU8Service extends Service
         $save = ProductSnInfo::where('del_time',0)
             ->whereIn("code", $code)
             ->whereIn('sn', $sn)
-            ->select('code','sn','data_id','type','product_id')
+            ->select('code','sn','data_id','type','product_id','warranty_id')
             ->get()->toArray();
 
         $category_map = Product::whereIn('id',array_unique(array_column($save,'product_id')))
@@ -374,7 +374,11 @@ class DataSyncToU8Service extends Service
                 if(! $data_id){
                     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['type'] == ProductSnInfo::type_three){
+                        if($value['warranty_id'] != $data_id || $value['type'] != $data_type) return [false, '产品编码:' . $value['code'] . '的sn码已被' .ProductSnInfo::$type_name[$data_type] . '使用'];
+                    }else{
+                        if($value['data_id'] != $data_id || $value['type'] != $data_type) return [false, '产品编码:' . $value['code'] . '的sn码已被' .ProductSnInfo::$type_name[$data_type] . '使用'];
+                    }
                 }
             }
         }

+ 3 - 1
app/Service/TSpaceService.php

@@ -801,8 +801,10 @@ class TSpaceService extends Service
 //            list($status, $msg) = (new DataSyncToU8Service())->snForWarranty($data);
 //            if(! $status) return [false, $msg];
             $submit_info[] = $order['code'] . $data['sn'];
+            $data_id = $order['data_id'];
+            if($order['type'] == ProductSnInfo::type_three) $data_id = $order['id'];
             $message = [
-                'id' => $order['data_id'],
+                'id' => $data_id,
                 'data_type' => $order['type']
             ];
             list($status, $msg) = (new DataSyncToU8Service())->snForCheck([$order['code']], [$data['sn']], $submit_info, $message);