Class: Unidom::ArticleNumber::VehicleIdentificationNumber

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Concerns::AsBarcode, Common::Concerns::ModelExtension
Defined in:
app/models/unidom/article_number/vehicle_identification_number.rb

Overview

VIN (Vehicle Identification Number) 是车辆识别码。en.wikipedia.org/wiki/Vehicle_identification_number GB 16735-2004

Instance Method Summary collapse

Instance Method Details

#code=(code) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'app/models/unidom/article_number/vehicle_identification_number.rb', line 19

def code=(code)
  code = code.to_s
  write_attribute :code, code
  if code.present?
    write_attribute :world_manufacturer_identifier, code[0..2]
    write_attribute :vehicle_descriptor_section,    code[3..7]
    write_attribute :check_digit,                   code[8]
    write_attribute :vehicle_identifier_section,    code[9..16]
  end
end