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