unidom-product 1.4.2 → 1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d05131d2301bbc977c251a32b3d27d647a90779b
4
- data.tar.gz: 5566ecca6c39d895aeb0ba41abcefcfe46ffc39f
3
+ metadata.gz: d268689de78ed2f974f2165c087399ffa8d0a473
4
+ data.tar.gz: 4a82aea6ce5a12ec4b2daf80a5b543c8cf2522fc
5
5
  SHA512:
6
- metadata.gz: 2d8d756788b19de1f44132485e6117550e30cd37722845cb6d1f05e8c0cf9895b0c7f30267ee6f96c2e0048d7112a67c32a78c9cf0e46949ea17279a48429555
7
- data.tar.gz: fe906b934f712d83ad450647597aad143ae1536a4a2108f16ddfa1354d8ba6ac10dfb4e7396c3c1c0ba52f6e3d896b0254bdabc5e03a992c50ce07f52c228f09
6
+ metadata.gz: 3258d57de42b55347bd862161f51cc24b2b1bd87107745373eec771de3fbe752ce24c6a55f2edd63bbe998db8d80f702b9d3fe06aeced5ad2a28e8ae65fb5c77
7
+ data.tar.gz: f485a9e551bf650ee022baf4e5c14a4ec8e9ac7fb611f4f44650d15155cb6a5c3e5da4e7ef5a2998297112c740a8915afe2bee947a70508550e038df2e0354af
@@ -2,17 +2,20 @@
2
2
  # source 是来源产品。如组合后的产品、被换代的产品、不兼容产品中的主产品。
3
3
  # target 是目标产品。如参与组合的产品、替换其它产品的新产品、不兼容产品中的次要产品。
4
4
  # product_association_code 是产品关联:
5
- # CPLM 是产品补充 complement
6
- # ICPT 是产品不兼容 incompatibility
7
- # OBSL 是产品废弃 obsolescence
8
- # PCKG 是销售包装 package
9
- # SBST 是产品替代 substitute
5
+ # CPLM 是产品补充 complement: from, thru, reason
6
+ # ICPT 是产品不兼容 incompatibility: from, thru, reason
7
+ # OBSL 是产品废弃 obsolescence: on, reason
8
+ # PCKG 是销售包装(行销组件) package: quantity, usage
9
+ # SBST 是产品替代 substitute: from, thru, quantity, comments
10
+ # 构成: from, thru, quantity, usage, comments
11
+ #
10
12
 
11
13
  class Unidom::Product::ProductAssociating < Unidom::Product::ApplicationRecord
12
14
 
13
15
  self.table_name = 'unidom_product_associatings'
14
16
 
15
17
  include Unidom::Common::Concerns::ModelExtension
18
+ include ProgneTapera::EnumCode
16
19
 
17
20
  validates :quantity, presence: true, numericality: { greater_than_or_equal_to: 0 }
18
21
 
@@ -22,6 +25,8 @@ class Unidom::Product::ProductAssociating < Unidom::Product::ApplicationRecord
22
25
  scope :source_is, ->(product) { where source_id: to_id(product) }
23
26
  scope :target_is, ->(product) { where target_id: to_id(product) }
24
27
 
28
+ code :product_association, Unidom::Product::ProductAssociation
29
+
25
30
  def self.associate!(source, with: target, due_to: 'PCKG', ordinal: 1, quantity: 1, at: Time.now)
26
31
 
27
32
  associating = source_is(source).target_is(with).product_association_coded_as(due_to).valid_at.alive.first
@@ -0,0 +1,7 @@
1
+ class Unidom::Product::ProductAssociation < ActiveRecord::Type::Value
2
+
3
+ include ProgneTapera::EnumConfig
4
+
5
+ enum :unidom_product_association
6
+
7
+ end
@@ -1,8 +1,8 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Product</title>
5
- <%= stylesheet_link_tag "unidom/product/application", media: "all" %>
4
+ <title>Unidom Product</title>
5
+ <%= stylesheet_link_tag 'unidom/product/application', media: "all" %>
6
6
  <%= csrf_meta_tags %>
7
7
  </head>
8
8
  <body>
data/config/enum.yml ADDED
@@ -0,0 +1,11 @@
1
+ enum:
2
+
3
+ unidom_product_association:
4
+ complement:
5
+ code: 'CPLM'
6
+ incompatibility:
7
+ code: 'ICPT'
8
+ obsolescence:
9
+ code: 'OBSL'
10
+ substitute:
11
+ code: 'SBST'
@@ -0,0 +1,8 @@
1
+ 'zh-CN':
2
+ enum:
3
+
4
+ unidom_product_association:
5
+ complement: 补充
6
+ incompatibility: 不兼容
7
+ obsolescence: 废弃
8
+ substitute: 替代
@@ -1,3 +1,5 @@
1
+ require 'unidom/common/yaml_helper'
2
+
1
3
  module Unidom
2
4
  module Product
3
5
 
@@ -5,6 +7,10 @@ module Unidom
5
7
 
6
8
  isolate_namespace ::Unidom::Product
7
9
 
10
+ initializer :load_config_initializers do |app|
11
+ Unidom::Common::YamlHelper.load_enum config: app.config, root: config.root
12
+ end
13
+
8
14
  initializer :append_migrations do |app|
9
15
  config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path } unless app.root.to_s.match root.to_s
10
16
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Product
3
- VERSION = '1.4.2'.freeze
3
+ VERSION = '1.5'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-product
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: '1.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-11-12 00:00:00.000000000 Z
11
+ date: 2016-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: progne_tapera
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0.3'
27
41
  description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
42
  The Product domain model engine includes Product and its relative models. Unidom
29
43
  (统一领域对象模型)是一系列的领域模型引擎。产品领域模型引擎包括产品及其相关的模型。
@@ -50,7 +64,10 @@ files:
50
64
  - app/models/unidom/product/concerns/as_target_product_associating.rb
51
65
  - app/models/unidom/product/product.rb
52
66
  - app/models/unidom/product/product_associating.rb
67
+ - app/types/unidom/product/product_association.rb
53
68
  - app/views/layouts/unidom/product/application.html.erb
69
+ - config/enum.yml
70
+ - config/locales/enum.zh-CN.yml
54
71
  - config/routes.rb
55
72
  - db/migrate/20020201000000_create_unidom_products.rb
56
73
  - db/migrate/20020211000000_create_unidom_product_associatings.rb