unidom-inventory 0.7.4 → 0.7.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 +36 -10
- data/app/controllers/unidom/inventory/application_controller.rb +3 -0
- data/app/jobs/unidom/inventory/application_job.rb +3 -0
- data/app/mailers/unidom/inventory/application_mailer.rb +3 -0
- data/app/models/unidom/inventory/application_record.rb +3 -0
- data/app/models/unidom/inventory/grouped_inventory_item.rb +1 -1
- data/app/models/unidom/inventory/inventory_item_variance.rb +5 -1
- data/app/models/unidom/inventory/item_issuing.rb +1 -1
- data/app/models/unidom/inventory/lot.rb +1 -1
- data/app/models/unidom/inventory/pick_item.rb +1 -1
- data/app/models/unidom/inventory/pick_list.rb +1 -1
- data/app/models/unidom/inventory/serialized_inventory_item.rb +1 -1
- data/lib/unidom/inventory/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3def5f3156c518aea115d97b00a070fe8d1f67d4
|
4
|
+
data.tar.gz: 8530497bac887d9e94f1f80a3055fa454077cf4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1eea9bb7dc43e33bfa6f2758a537727ba799781fe088ce75029050eb3b6fd17fc172f80d5a12b80e81484bae5bdc9547d9ac81a17bd3ac027b99e3f49de4db57
|
7
|
+
data.tar.gz: 9b0522a0c0c2294297654e6d6f582734ac1f300dd38b93c6530d3a4aa28b13669604787634ffadd390ddafbc3c913a26268fd37563e4a931dc7756e70d57a4fa
|
data/README.md
CHANGED
@@ -67,22 +67,48 @@ include Unidom::Inventory::Concerns::AsStored
|
|
67
67
|
|
68
68
|
### As Inventory Item concern
|
69
69
|
|
70
|
-
The As Inventory Item concern do the following tasks for the includer automatically:
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
70
|
+
The As Inventory Item concern do the following tasks for the includer automatically:
|
71
|
+
|
72
|
+
1. Define the belongs_to :stored macro as: ``belongs_to :stored, polymorphic: true``
|
73
|
+
|
74
|
+
2. Define the belongs_to :store macro as: ``belongs_to :store, polymorphic: true``
|
75
|
+
|
76
|
+
3. Define the belongs_to :lot macro as: ``belongs_to :lot, class_name: 'Unidom::Inventory::Lot'``
|
77
|
+
|
78
|
+
4. Define the has_many :pick_items macro as: ``has_many :pick_items, class_name: 'Unidom::Inventory::PickItem', as: :inventory_item``
|
79
|
+
|
80
|
+
5. Define the has_many :variances macro as: ``has_many :variances, class_name: 'Unidom::Inventory::InventoryItemVariance', as: :inventory_item``
|
81
|
+
|
76
82
|
6. Define the #is_adjusted! method as: ``is_adjusted!(quantity, due_to: nil, at: Time.now, description: nil, instruction: nil)``
|
77
83
|
|
78
84
|
### As Store concern
|
79
85
|
|
80
|
-
The As Store concern do the following tasks for the includer automatically:
|
81
|
-
|
86
|
+
The As Store concern do the following tasks for the includer automatically:
|
87
|
+
|
88
|
+
1. Define the has_many :grouped_inventory_items macro as: ``has_many :grouped_inventory_items, class_name: 'Unidom::Inventory::GroupedInventoryItem', foreign_key: :store_id``
|
89
|
+
|
82
90
|
2. Define the has_many :serialized_inventory_items macro as: ``has_many :serialized_inventory_items, class_name: 'Unidom::Inventory::SerializedInventoryItem', foreign_key: :store_id``
|
83
91
|
|
84
92
|
### As Stored concern
|
85
93
|
|
86
|
-
The As Stored concern do the following tasks for the includer automatically:
|
87
|
-
|
94
|
+
The As Stored concern do the following tasks for the includer automatically:
|
95
|
+
|
96
|
+
1. Define the has_many :grouped_inventory_items macro as: ``has_many :grouped_inventory_items, class_name: 'Unidom::Inventory::GroupedInventoryItem', foreign_key: :stored_id``
|
97
|
+
|
88
98
|
2. Define the has_many :serialized_inventory_items macro as: ``has_many :serialized_inventory_items, class_name: 'Unidom::Inventory::SerializedInventoryItem', foreign_key: :stored_id``
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
## Disable the Model & Migration
|
103
|
+
|
104
|
+
If you only need the app components other than models, the migrations should be neglected, and the models should not be loaded.
|
105
|
+
```ruby
|
106
|
+
# config/initializers/unidom.rb
|
107
|
+
Unidom::Common.configure do |options|
|
108
|
+
|
109
|
+
options[:neglected_namespaces] = %w{
|
110
|
+
Unidom::Inventory
|
111
|
+
}
|
112
|
+
|
113
|
+
end
|
114
|
+
```
|
@@ -18,6 +18,10 @@ class Unidom::Inventory::InventoryItemVariance < Unidom::Inventory::ApplicationR
|
|
18
18
|
scope :inventory_item_is, ->(inventory_item) { where inventory_item: inventory_item }
|
19
19
|
scope :caused_by, ->(reason) { where reason: reason }
|
20
20
|
|
21
|
+
##
|
22
|
+
# 对库存项 inventory_item 进行调整。调整数量为 quantity ,缺省为 nil 。调整原因为 due_to 。调整时间为 at ,缺省为当前时间。
|
23
|
+
# 另有适用于己方的备注信息 description 和适用于对方的备注信息 instruction 。
|
24
|
+
# Unidom::Inventory::InventoryItemVariance.adjust! inventory_item, quantity: 3
|
21
25
|
def self.adjust!(inventory_item, quantity: nil, due_to: nil, at: Time.now, description: nil, instruction: nil)
|
22
26
|
if inventory_item.respond_to? :quantity
|
23
27
|
inventory_item.increment! :quantity, quantity
|
@@ -32,4 +36,4 @@ class Unidom::Inventory::InventoryItemVariance < Unidom::Inventory::ApplicationR
|
|
32
36
|
create! inventory_item: inventory_item, reason: due_to, quantity: quantity, description: description, instruction: instruction, opened_at: at
|
33
37
|
end
|
34
38
|
|
35
|
-
end
|
39
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Inventory::InventoryItemVariance'
|
@@ -16,4 +16,4 @@ class Unidom::Inventory::ItemIssuing < Unidom::Inventory::ApplicationRecord
|
|
16
16
|
belongs_to :inventory_item, polymorphic: true
|
17
17
|
belongs_to :target_item, polymorphic: true
|
18
18
|
|
19
|
-
end
|
19
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Inventory::ItemIssuing'
|
@@ -13,4 +13,4 @@ class Unidom::Inventory::Lot < Unidom::Inventory::ApplicationRecord
|
|
13
13
|
has_many :grouped_inventory_items, class_name: 'Unidom::Inventory::GroupedInventoryItem'
|
14
14
|
has_many :serialized_inventory_items, class_name: 'Unidom::Inventory::SerializedInventoryItem'
|
15
15
|
|
16
|
-
end
|
16
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Inventory::Lot'
|
@@ -12,4 +12,4 @@ class Unidom::Inventory::PickItem < Unidom::Inventory::ApplicationRecord
|
|
12
12
|
belongs_to :pick_list, class_name: 'Unidom::Inventory::PickList'
|
13
13
|
belongs_to :inventory_item, polymorphic: true
|
14
14
|
|
15
|
-
end
|
15
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Inventory::PickItem'
|
@@ -10,4 +10,4 @@ class Unidom::Inventory::SerializedInventoryItem < Unidom::Inventory::Applicatio
|
|
10
10
|
|
11
11
|
validates :serial_number, presence: true, length: { in: 2..columns_hash['serial_number'].limit }
|
12
12
|
|
13
|
-
end
|
13
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Inventory::SerializedInventoryItem'
|
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.7.
|
4
|
+
version: 0.7.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: 2017-01-
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.9'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
28
|
The Inventory domain model engine includes the Serialized Inventory Item, the Grouped
|
29
29
|
Inventory Item, the Lot, and the Inventory Item Variance models. Unidom (统一领域对象模型)是一系列的领域模型引擎。库存领域模型引擎包括序列化库存项、分组库存项、批量和库存项变化的模型。
|