Sha256: 5c3f720d945d60ac957346b8ad5056ef1cbe54863bb86e6d32d51a6a4e0987ac

Contents?: true

Size: 946 Bytes

Versions: 8

Compression:

Stored size: 946 Bytes

Contents

##
# Shipment Receipt 是装运收据。
# #package 是装运包裹。
# #shipped 是被装运的产品、货物等。
# #store_item 是对应存储的项。

class Unidom::Shipment::ShipmentReceipt < Unidom::Shipment::ApplicationRecord

  self.table_name = 'unidom_shipment_receipts'

  include Unidom::Common::Concerns::ModelExtension

  validates :accepted_quantity, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
  validates :rejected_quantity, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }

  belongs_to :package,    class_name:  'Unidom::Shipment::ShipmentPackage'
  belongs_to :shipped,    polymorphic: true
  belongs_to :store_item, polymorphic: true

  before_validation do
    self.received_at = Time.now if received_at.blank?
  end

end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Shipment::ShipmentReceipt'

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
unidom-shipment-1.0 app/models/unidom/shipment/shipment_receipt.rb
unidom-shipment-0.7.8 app/models/unidom/shipment/shipment_receipt.rb
unidom-shipment-0.7.7 app/models/unidom/shipment/shipment_receipt.rb
unidom-shipment-0.7.6 app/models/unidom/shipment/shipment_receipt.rb
unidom-shipment-0.7.5 app/models/unidom/shipment/shipment_receipt.rb
unidom-shipment-0.7.4 app/models/unidom/shipment/shipment_receipt.rb
unidom-shipment-0.7.3 app/models/unidom/shipment/shipment_receipt.rb
unidom-shipment-0.7.2 app/models/unidom/shipment/shipment_receipt.rb