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 +4 -4
- data/app/models/unidom/product/product_associating.rb +10 -5
- data/app/types/unidom/product/product_association.rb +7 -0
- data/app/views/layouts/unidom/product/application.html.erb +2 -2
- data/config/enum.yml +11 -0
- data/config/locales/enum.zh-CN.yml +8 -0
- data/lib/unidom/product/engine.rb +6 -0
- data/lib/unidom/product/version.rb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d268689de78ed2f974f2165c087399ffa8d0a473
|
4
|
+
data.tar.gz: 4a82aea6ce5a12ec4b2daf80a5b543c8cf2522fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title>Product</title>
|
5
|
-
<%= stylesheet_link_tag
|
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
@@ -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
|
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
|
+
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
|
+
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
|