unidom-shipment 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/app/models/unidom/shipment/shipment_item.rb +2 -0
- data/app/models/unidom/shipment/shipment_package.rb +14 -0
- data/app/models/unidom/shipment/shipment_package_item.rb +14 -0
- data/app/models/unidom/shipment/shipment_receipt.rb +23 -0
- data/db/migrate/20021011000000_create_unidom_shipment_packages.rb +22 -0
- data/db/migrate/20021012000000_create_unidom_shipment_package_items.rb +30 -0
- data/db/migrate/20021013000000_create_unidom_shipment_receipts.rb +38 -0
- data/lib/unidom/shipment/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db3f11fd844936751b8ec3bf6ae4d46ccebbe400
|
4
|
+
data.tar.gz: dcda5f4ca3a5aa23138a5e7f5d04288246466399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 996c0d30c181ea7c578dddd67c1931d63b6304d4899cbf8d136ccb7df14808e3f659f6f919c54932d77a6bfd7ef410a8f7b243c0c3815a7f4c19436d2fa04113
|
7
|
+
data.tar.gz: 7df87e7d26546a25c87acdc1e72aafd6f068780ccb5b5b60a2e7376de6a0eb9dff1b58c8ed722dc3fbdabc3438031af5d6733d1594c93bb98e5e4ab4697d8da3
|
data/README.md
CHANGED
@@ -38,4 +38,9 @@ The migration versions start with 200210.
|
|
38
38
|
shipment = Unidom::Shipment::Shipment.valid_at.alive.first
|
39
39
|
shipment_item = Unidom::Shipment::ShipmentItem.valid_at.alive.first
|
40
40
|
shipment_items = shipment.items
|
41
|
+
inventory_item = Unidom::Inventory::GroupedInventoryItem.valid_at.alive.first
|
42
|
+
|
43
|
+
shipment_package = Unidom::Shipment::ShipmentPackage.valid_at.alive.first
|
44
|
+
shipment_package_item = shipment_package.items.create! shipment_item: shipment_item, quantity: 10
|
45
|
+
shipment_receipt = shipment_package.receipts.create! shipped: shipment_item.shipped, store_item: inventory_item
|
41
46
|
```
|
@@ -11,4 +11,6 @@ class Unidom::Shipment::ShipmentItem < Unidom::Shipment::ApplicationRecord
|
|
11
11
|
belongs_to :shipment, class_name: 'Unidom::Shipment::Shipment'
|
12
12
|
belongs_to :shipped, polymorphic: true
|
13
13
|
|
14
|
+
has_many :package_items, class_name: 'Unidom::Shipment::ShipmentPackageItem'
|
15
|
+
|
14
16
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Shipment Package 是装运包裹。
|
2
|
+
# #items 是包裹项。
|
3
|
+
# #receipts 是收据。
|
4
|
+
|
5
|
+
class Unidom::Shipment::ShipmentPackage < Unidom::Shipment::ApplicationRecord
|
6
|
+
|
7
|
+
self.table_name = 'unidom_shipment_packages'
|
8
|
+
|
9
|
+
include Unidom::Common::Concerns::ModelExtension
|
10
|
+
|
11
|
+
has_many :items, class_name: 'Unidom::Shipment::ShipmentPackageItem', foreign_key: :package_id
|
12
|
+
has_many :receipts, class_name: 'Unidom::Shipment::ShipmentReceipt', foreign_key: :package_id
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Shipment Package Item 是装运包裹内容。
|
2
|
+
|
3
|
+
class Unidom::Shipment::ShipmentPackageItem < Unidom::Shipment::ApplicationRecord
|
4
|
+
|
5
|
+
self.table_name = 'unidom_shipment_package_items'
|
6
|
+
|
7
|
+
include Unidom::Common::Concerns::ModelExtension
|
8
|
+
|
9
|
+
validates :quantity, presence: true, numericality: { greater_than: 0, less_than: 1_000_000_000 }
|
10
|
+
|
11
|
+
belongs_to :package, class_name: 'Unidom::Shipment::ShipmentPackage'
|
12
|
+
belongs_to :shipment_item, class_name: 'Unidom::Shipment::ShipmentItem'
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Shipment Receipt 是装运收据。
|
2
|
+
# #package 是装运包裹。
|
3
|
+
# #shipped 是被装运的产品、货物等。
|
4
|
+
# #store_item 是对应存储的项。
|
5
|
+
|
6
|
+
class Unidom::Shipment::ShipmentReceipt < Unidom::Shipment::ApplicationRecord
|
7
|
+
|
8
|
+
self.table_name = 'unidom_shipment_receipts'
|
9
|
+
|
10
|
+
include Unidom::Common::Concerns::ModelExtension
|
11
|
+
|
12
|
+
validates :accepted_quantity, presence: true, numericality: { greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
|
13
|
+
validates :rejected_quantity, presence: true, numericality: { greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
|
14
|
+
|
15
|
+
belongs_to :package, class_name: 'Unidom::Shipment::ShipmentPackage'
|
16
|
+
belongs_to :shipped, polymorphic: true
|
17
|
+
belongs_to :store_item, polymorphic: true
|
18
|
+
|
19
|
+
before_validation do
|
20
|
+
self.received_at = Time.now if received_at.blank?
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateUnidomShipmentPackages < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_shipment_packages, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.text :instruction
|
8
|
+
t.text :description
|
9
|
+
|
10
|
+
t.column :state, 'char(1)', null: false, default: 'C'
|
11
|
+
t.datetime :opened_at, null: false, default: ::Time.utc(1970)
|
12
|
+
t.datetime :closed_at, null: false, default: ::Time.utc(3000)
|
13
|
+
t.boolean :defunct, null: false, default: false
|
14
|
+
t.jsonb :notation, null: false, default: {}
|
15
|
+
|
16
|
+
t.timestamps null: false
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class CreateUnidomShipmentPackageItems < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_shipment_package_items, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.references :package, type: :uuid, null: false
|
8
|
+
t.references :shipment_item, type: :uuid, null: false
|
9
|
+
|
10
|
+
t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
|
11
|
+
|
12
|
+
t.text :instruction
|
13
|
+
t.text :description
|
14
|
+
|
15
|
+
t.column :state, 'char(1)', null: false, default: 'C'
|
16
|
+
t.datetime :opened_at, null: false, default: ::Time.utc(1970)
|
17
|
+
t.datetime :closed_at, null: false, default: ::Time.utc(3000)
|
18
|
+
t.boolean :defunct, null: false, default: false
|
19
|
+
t.jsonb :notation, null: false, default: {}
|
20
|
+
|
21
|
+
t.timestamps null: false
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
add_index :unidom_shipment_package_items, :package_id
|
26
|
+
add_index :unidom_shipment_package_items, :shipment_item_id
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class CreateUnidomShipmentReceipts < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_shipment_receipts, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.references :package, type: :uuid, null: false
|
8
|
+
t.references :shipped, type: :uuid, null: false,
|
9
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
10
|
+
t.references :store_item, type: :uuid, null: false,
|
11
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
12
|
+
|
13
|
+
t.decimal :accepted_quantity, null: false, default: 0.0, precision: 12, scale: 2
|
14
|
+
t.decimal :rejected_quantity, null: false, default: 0.0, precision: 12, scale: 2
|
15
|
+
|
16
|
+
t.datetime :received_at, null: false, default: nil
|
17
|
+
|
18
|
+
t.text :rejection_reason
|
19
|
+
t.text :instruction
|
20
|
+
t.text :description
|
21
|
+
|
22
|
+
t.column :state, 'char(1)', null: false, default: 'C'
|
23
|
+
t.datetime :opened_at, null: false, default: ::Time.utc(1970)
|
24
|
+
t.datetime :closed_at, null: false, default: ::Time.utc(3000)
|
25
|
+
t.boolean :defunct, null: false, default: false
|
26
|
+
t.jsonb :notation, null: false, default: {}
|
27
|
+
|
28
|
+
t.timestamps null: false
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
add_index :unidom_shipment_receipts, :package_id
|
33
|
+
add_index :unidom_shipment_receipts, :shipped_id
|
34
|
+
add_index :unidom_shipment_receipts, :store_item_id
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-shipment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -46,10 +46,16 @@ files:
|
|
46
46
|
- app/models/unidom/shipment/application_record.rb
|
47
47
|
- app/models/unidom/shipment/shipment.rb
|
48
48
|
- app/models/unidom/shipment/shipment_item.rb
|
49
|
+
- app/models/unidom/shipment/shipment_package.rb
|
50
|
+
- app/models/unidom/shipment/shipment_package_item.rb
|
51
|
+
- app/models/unidom/shipment/shipment_receipt.rb
|
49
52
|
- app/views/layouts/unidom/shipment/application.html.erb
|
50
53
|
- config/routes.rb
|
51
54
|
- db/migrate/20021001000000_create_unidom_shipments.rb
|
52
55
|
- db/migrate/20021002000000_create_unidom_shipment_items.rb
|
56
|
+
- db/migrate/20021011000000_create_unidom_shipment_packages.rb
|
57
|
+
- db/migrate/20021012000000_create_unidom_shipment_package_items.rb
|
58
|
+
- db/migrate/20021013000000_create_unidom_shipment_receipts.rb
|
53
59
|
- lib/tasks/shipment_tasks.rake
|
54
60
|
- lib/unidom/shipment.rb
|
55
61
|
- lib/unidom/shipment/engine.rb
|