unidom-inventory 0.4 → 0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/app/models/unidom/inventory/concerns/as_inventory_item.rb +2 -0
- data/app/models/unidom/inventory/item_issuing.rb +18 -0
- data/app/models/unidom/inventory/lot.rb +0 -1
- data/app/models/unidom/inventory/pick_item.rb +14 -0
- data/app/models/unidom/inventory/pick_list.rb +11 -0
- data/db/migrate/20020921000000_create_unidom_pick_lists.rb +22 -0
- data/db/migrate/20020922000000_create_unidom_pick_items.rb +31 -0
- data/db/migrate/20020923000000_create_unidom_item_issuings.rb +34 -0
- data/lib/unidom/inventory/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: f5478f1bad555fc1a2a79c73149c2f68d8152541
|
4
|
+
data.tar.gz: eddb97b1856d6e4da7f8d324608df5515a3f1a1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff4b4696568e894df9813d74e71c96211763385dfab254c6763976a0e80612e47ca8377ad630a1fdaf24adebb2d8b6fdf9b0e78a268131dd6d8438efd07be30c
|
7
|
+
data.tar.gz: 79215e93fe985eec472b13e512dc6f23bb61c28321db94a506aba17cd3b403b07b1b6ca4258c87c27bf31886872111dc01afb01306a7d511d7c2a85e3e1a9ec9
|
data/README.md
CHANGED
@@ -7,7 +7,10 @@
|
|
7
7
|
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Inventory domain model engine includes the Serialized Inventory Item, the Grouped Inventory Item, the Lot, and the Inventory Item Variance models.
|
8
8
|
Unidom (统一领域对象模型)是一系列的领域模型引擎。库存领域模型引擎包括序列化库存项、分组库存项、批量和库存项变化的模型。
|
9
9
|
|
10
|
+
|
11
|
+
|
10
12
|
## Recent Update
|
13
|
+
|
11
14
|
Check out the [Road Map](ROADMAP.md) to find out what's the next.
|
12
15
|
Check out the [Change Log](CHANGELOG.md) to find out what's new.
|
13
16
|
|
@@ -40,26 +43,37 @@ grouped_inventory_item = Unidom::Inventory::GroupedInventoryItem.create! store:
|
|
40
43
|
|
41
44
|
lot.grouped_inventory_items.create! store: @shop, stored: @product, quantity: 100
|
42
45
|
lot.serialized_inventory_items.create! store: @shop, stored: @product, serial_number: '19840101'
|
46
|
+
|
47
|
+
pick_list = Unidom::Inventory::PickList.create!
|
48
|
+
pick_item = pick_list.items.create! inventory_item: grouped_inventory_item, quantity: 100
|
49
|
+
item_issuing = Unidom::Inventory::ItemIssuing.create! pick_item: pick_item, inventory_item: grouped_inventory_item, target_item: nil
|
50
|
+
# target_item could be nil or any model like: shipment item or order item
|
43
51
|
```
|
44
52
|
|
45
53
|
|
46
54
|
|
47
55
|
## Include the Concerns
|
56
|
+
|
48
57
|
```ruby
|
49
58
|
include Unidom::Inventory::AsInventoryItem
|
50
59
|
```
|
51
60
|
|
52
61
|
### As Inventory Item concern
|
62
|
+
|
53
63
|
The As Inventory Item concern do the following tasks for the includer automatically:
|
54
64
|
1. Define the belongs_to :stored macro as: ``belongs_to :stored, polymorphic: true``
|
55
65
|
2. Define the belongs_to :store macro as: ``belongs_to :store, polymorphic: true``
|
66
|
+
3. Define the belongs_to :lot macro as: ``belongs_to :lot, class_name: 'Unidom::Inventory::Lot'``
|
67
|
+
4. Define the has_many :pick_items macro as: ``has_many :pick_items, class_name: 'Unidom::Inventory::PickItem', as: :inventory_item``
|
56
68
|
|
57
69
|
### As Store concern
|
70
|
+
|
58
71
|
The As Store concern do the following tasks for the includer automatically:
|
59
72
|
1. Define the has_many :grouped_inventory_items macro as: ``has_many :grouped_inventory_items, class_name: 'Unidom::Inventory::GroupedInventoryItem', foreign_key: :store_id``
|
60
73
|
2. Define the has_many :serialized_inventory_items macro as: ``has_many :serialized_inventory_items, class_name: 'Unidom::Inventory::SerializedInventoryItem', foreign_key: :store_id``
|
61
74
|
|
62
75
|
### As Stored concern
|
76
|
+
|
63
77
|
The As Stored concern do the following tasks for the includer automatically:
|
64
78
|
1. Define the has_many :grouped_inventory_items macro as: ``has_many :grouped_inventory_items, class_name: 'Unidom::Inventory::GroupedInventoryItem', foreign_key: :stored_id``
|
65
79
|
2. Define the has_many :serialized_inventory_items macro as: ``has_many :serialized_inventory_items, class_name: 'Unidom::Inventory::SerializedInventoryItem', foreign_key: :stored_id``
|
@@ -8,6 +8,8 @@ module Unidom::Inventory::Concerns::AsInventoryItem
|
|
8
8
|
belongs_to :store, polymorphic: true
|
9
9
|
belongs_to :lot, class_name: 'Unidom::Inventory::Lot'
|
10
10
|
|
11
|
+
has_many :pick_items, class_name: 'Unidom::Inventory::PickItem', as: :inventory_item
|
12
|
+
|
11
13
|
end
|
12
14
|
|
13
15
|
module ClassMethods
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Item Issuing 是条目出库。
|
2
|
+
# #pick_item 是出库项。
|
3
|
+
# #inventory_item 是库存项,可以由 #pick_item 导出。
|
4
|
+
# #target_item 是目标项,比如: ShipmentItem 、 OrderItem 等。
|
5
|
+
|
6
|
+
class Unidom::Inventory::ItemIssuing < ActiveRecord::Base
|
7
|
+
|
8
|
+
self.table_name = 'unidom_item_issuings'
|
9
|
+
|
10
|
+
include Unidom::Common::Concerns::ModelExtension
|
11
|
+
|
12
|
+
validates :quantity, presence: true, numericality: true
|
13
|
+
|
14
|
+
belongs_to :pick_item, class_name: 'Unidom::Inventory::PickItem'
|
15
|
+
belongs_to :inventory_item, polymorphic: true
|
16
|
+
belongs_to :target_item, polymorphic: true
|
17
|
+
|
18
|
+
end
|
@@ -5,7 +5,6 @@ class Unidom::Inventory::Lot < ActiveRecord::Base
|
|
5
5
|
self.table_name = 'unidom_lots'
|
6
6
|
|
7
7
|
include Unidom::Common::Concerns::ModelExtension
|
8
|
-
include Unidom::Inventory::Concerns::AsInventoryItem
|
9
8
|
|
10
9
|
validates :quantity, presence: true, numericality: true
|
11
10
|
validates :identification_number, presence: true, length: { in: 2..columns_hash['identification_number'].limit }
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Pick Item 是出库单项。
|
2
|
+
|
3
|
+
class Unidom::Inventory::PickItem < ActiveRecord::Base
|
4
|
+
|
5
|
+
self.table_name = 'unidom_pick_items'
|
6
|
+
|
7
|
+
include Unidom::Common::Concerns::ModelExtension
|
8
|
+
|
9
|
+
validates :quantity, presence: true, numericality: true
|
10
|
+
|
11
|
+
belongs_to :pick_list, class_name: 'Unidom::Inventory::PickList'
|
12
|
+
belongs_to :inventory_item, polymorphic: true
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Pick List 是出库单。
|
2
|
+
|
3
|
+
class Unidom::Inventory::PickList < ActiveRecord::Base
|
4
|
+
|
5
|
+
self.table_name = 'unidom_pick_lists'
|
6
|
+
|
7
|
+
include Unidom::Common::Concerns::ModelExtension
|
8
|
+
|
9
|
+
has_many :items, class_name: 'Unidom::Inventory::PickItem' #, foreign_key: :pick_list_id
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateUnidomPickLists < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_pick_lists, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.text :description
|
8
|
+
t.text :instruction
|
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,31 @@
|
|
1
|
+
class CreateUnidomPickItems < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_pick_items, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.references :pick_list, type: :uuid, null: false
|
8
|
+
t.references :inventory_item, type: :uuid, null: false,
|
9
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
10
|
+
|
11
|
+
t.decimal :quantity, null: false, default: 0.0, precision: 10, scale: 6
|
12
|
+
|
13
|
+
t.text :description
|
14
|
+
t.text :instruction
|
15
|
+
|
16
|
+
t.column :state, 'char(1)', null: false, default: 'C'
|
17
|
+
t.datetime :opened_at, null: false, default: ::Time.utc(1970)
|
18
|
+
t.datetime :closed_at, null: false, default: ::Time.utc(3000)
|
19
|
+
t.boolean :defunct, null: false, default: false
|
20
|
+
t.jsonb :notation, null: false, default: {}
|
21
|
+
|
22
|
+
t.timestamps null: false
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
add_index :unidom_pick_items, :pick_list_id
|
27
|
+
add_index :unidom_pick_items, :inventory_item_id
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class CreateUnidomItemIssuings < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_item_issuings, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.references :pick_item, type: :uuid, null: false
|
8
|
+
t.references :inventory_item, type: :uuid, null: false,
|
9
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
10
|
+
t.references :target_item, type: :uuid, null: true,
|
11
|
+
polymorphic: { null: true, default: nil, limit: 200 }
|
12
|
+
|
13
|
+
t.decimal :quantity, null: false, default: 0.0, precision: 10, scale: 6
|
14
|
+
|
15
|
+
t.text :description
|
16
|
+
t.text :instruction
|
17
|
+
|
18
|
+
t.column :state, 'char(1)', null: false, default: 'C'
|
19
|
+
t.datetime :opened_at, null: false, default: ::Time.utc(1970)
|
20
|
+
t.datetime :closed_at, null: false, default: ::Time.utc(3000)
|
21
|
+
t.boolean :defunct, null: false, default: false
|
22
|
+
t.jsonb :notation, null: false, default: {}
|
23
|
+
|
24
|
+
t.timestamps null: false
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
add_index :unidom_item_issuings, :pick_item_id
|
29
|
+
add_index :unidom_item_issuings, :inventory_item_id
|
30
|
+
add_index :unidom_item_issuings, :target_item_id
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-inventory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.5'
|
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-10-
|
11
|
+
date: 2016-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -44,13 +44,19 @@ files:
|
|
44
44
|
- app/models/unidom/inventory/concerns/as_store.rb
|
45
45
|
- app/models/unidom/inventory/concerns/as_stored.rb
|
46
46
|
- app/models/unidom/inventory/grouped_inventory_item.rb
|
47
|
+
- app/models/unidom/inventory/item_issuing.rb
|
47
48
|
- app/models/unidom/inventory/lot.rb
|
49
|
+
- app/models/unidom/inventory/pick_item.rb
|
50
|
+
- app/models/unidom/inventory/pick_list.rb
|
48
51
|
- app/models/unidom/inventory/serialized_inventory_item.rb
|
49
52
|
- app/views/layouts/unidom/inventory/application.html.erb
|
50
53
|
- config/routes.rb
|
51
54
|
- db/migrate/20020901000000_create_unidom_serialized_inventory_items.rb
|
52
55
|
- db/migrate/20020902000000_create_unidom_grouped_inventory_items.rb
|
53
56
|
- db/migrate/20020911000000_create_unidom_lots.rb
|
57
|
+
- db/migrate/20020921000000_create_unidom_pick_lists.rb
|
58
|
+
- db/migrate/20020922000000_create_unidom_pick_items.rb
|
59
|
+
- db/migrate/20020923000000_create_unidom_item_issuings.rb
|
54
60
|
- lib/tasks/inventory_tasks.rake
|
55
61
|
- lib/unidom/inventory.rb
|
56
62
|
- lib/unidom/inventory/engine.rb
|