unidom-shipment 0.5.1 → 0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30038ff2d5cf92a198bb784b5abaca7418b3450d
4
- data.tar.gz: 0e7fdfd69b1aacb30c2e47212a28a99478f9cef1
3
+ metadata.gz: 72f9a1eb9afc7121908038c8d96b5def3a1301e5
4
+ data.tar.gz: 485a2c6e736e9fd26f704eb1a19f4293533a2ee6
5
5
  SHA512:
6
- metadata.gz: 9a018782afb78d3ef85a39617bc7682b76dd1e841b0bc2c08185c7de04a1ced0edcc3f334344d67b65ac56ccbf14ba71fd2888045c21a38ef227aabd05753898
7
- data.tar.gz: 8d2177620b4e332d7d75a422108155d2cda8d27bd57bc3d48e27f9cbc9a4e925e5315ea260547e379c4d93ca250a5886a68e952c7ed29e0bfbc476d63791e17f
6
+ metadata.gz: b4f91b27ce41acedda4d1b30837ccb0ec6f80b79297b5109fa3bb7b35b130fb8ee0d3d99705cdd30e3ecd3d80e4f7eb9af0c2d23d973564c7e5a911dd9581453
7
+ data.tar.gz: 9c09a19bdc10b9f343966ad572465967dcc0fd59eab9cbbf8ba98ec3bac1c27d96b02b5506c6ce7ccddb4773e3229f639a94e058b360bcaee5165e296a4eaa6b
data/README.md CHANGED
@@ -59,3 +59,18 @@ include Unidom::Shipment::Concerns::AsShipped
59
59
  The As Shipped concern do the following tasks for the includer automatically:
60
60
  1. Define the has_many :shipment_items macro as: ``has_many :shipment_items, class_name: 'Unidom::Shipment::ShipmentItem', foreign_key: :shipped_id``
61
61
  2. Define the has_many :shipment_receipts macro as: ``has_many :shipment_receipts, class_name: 'Unidom::Shipment::ShipmentReceipt', foreign_key: :shipped_id``
62
+
63
+
64
+
65
+ ## Enum codes
66
+
67
+ ### Conveyance enum code
68
+
69
+ ```ruby
70
+ Unidom::Shipment::Conveyance::customer_shipment # 客户装运
71
+ Unidom::Shipment::Conveyance::customer_return # 客户退回
72
+ Unidom::Shipment::Conveyance::purchase_shipment # 购买装运
73
+ Unidom::Shipment::Conveyance::purchase_return # 进货退回
74
+ Unidom::Shipment::Conveyance::transfer # 转运
75
+ Unidom::Shipment::Conveyance::drop_shipment # 直接装运
76
+ ```
@@ -1,3 +1,4 @@
1
+ ##
1
2
  # Shipment 是装运。
2
3
  # conveyance_code 是运送代码,可以是以下取值:
3
4
  # CSSP: Customer Shipment 客户装运,把货物发给客户。
@@ -12,6 +13,7 @@ class Unidom::Shipment::Shipment < Unidom::Shipment::ApplicationRecord
12
13
  self.table_name = 'unidom_shipments'
13
14
 
14
15
  include Unidom::Common::Concerns::ModelExtension
16
+ include ProgneTapera::EnumCode
15
17
 
16
18
  validates :estimated_amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
17
19
  validates :actual_amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
@@ -28,4 +30,6 @@ class Unidom::Shipment::Shipment < Unidom::Shipment::ApplicationRecord
28
30
 
29
31
  has_many :items, class_name: 'Unidom::Shipment::ShipmentItem'
30
32
 
33
+ code :conveyance, Unidom::Shipment::Conveyance
34
+
31
35
  end
@@ -1,3 +1,4 @@
1
+ ##
1
2
  # Shipment Item 是装运项。
2
3
 
3
4
  class Unidom::Shipment::ShipmentItem < Unidom::Shipment::ApplicationRecord
@@ -1,3 +1,4 @@
1
+ ##
1
2
  # Shipment Package 是装运包裹。
2
3
  # #items 是包裹项。
3
4
  # #receipts 是收据。
@@ -1,3 +1,4 @@
1
+ ##
1
2
  # Shipment Package Item 是装运包裹内容。
2
3
 
3
4
  class Unidom::Shipment::ShipmentPackageItem < Unidom::Shipment::ApplicationRecord
@@ -1,3 +1,4 @@
1
+ ##
1
2
  # Shipment Receipt 是装运收据。
2
3
  # #package 是装运包裹。
3
4
  # #shipped 是被装运的产品、货物等。
@@ -0,0 +1,7 @@
1
+ class Unidom::Shipment::Conveyance < ActiveRecord::Type::Value
2
+
3
+ include ProgneTapera::EnumConfig
4
+
5
+ enum :unidom_conveyance
6
+
7
+ end
data/config/enum.yml ADDED
@@ -0,0 +1,15 @@
1
+ enum:
2
+
3
+ unidom_conveyance:
4
+ customer_shipment:
5
+ code: CSSP
6
+ customer_return:
7
+ code: CSRT
8
+ purchase_shipment:
9
+ code: PCSP
10
+ purchase_return:
11
+ code: PCRT
12
+ transfer:
13
+ code: TRSF
14
+ drop_shipment:
15
+ code: DROP
@@ -0,0 +1,10 @@
1
+ 'zh-CN':
2
+ enum:
3
+
4
+ unidom_conveyance:
5
+ customer_shipment: 客户装运 # 把货物发给客户。
6
+ customer_return: 客户退回 # 从购买了产品的客户那里把退回的产品运回来。
7
+ purchase_shipment: 购买装运 # 从供应商那里把购买的货物运进来。
8
+ purchase_return: 进货退回 # 把发来的货物返回给供应商。
9
+ transfer: 转运 # 从内部组织到另一个内部组织调拨。
10
+ drop_shipment: 直接装运 # 销售商把产品从供应商那里直接运送给客户。
@@ -1,3 +1,5 @@
1
+ require 'unidom/common/yaml_helper'
2
+
1
3
  module Unidom
2
4
  module Shipment
3
5
 
@@ -5,6 +7,10 @@ module Unidom
5
7
 
6
8
  isolate_namespace ::Unidom::Shipment
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 Shipment
3
- VERSION = '0.5.1'.freeze
3
+ VERSION = '0.6'.freeze
4
4
  end
5
5
  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.5.1
4
+ version: '0.6'
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-12-06 00:00:00.000000000 Z
11
+ date: 2016-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -50,7 +50,10 @@ files:
50
50
  - app/models/unidom/shipment/shipment_package.rb
51
51
  - app/models/unidom/shipment/shipment_package_item.rb
52
52
  - app/models/unidom/shipment/shipment_receipt.rb
53
+ - app/types/unidom/shipment/conveyance.rb
53
54
  - app/views/layouts/unidom/shipment/application.html.erb
55
+ - config/enum.yml
56
+ - config/locales/enum.zh-CN.yml
54
57
  - config/routes.rb
55
58
  - db/migrate/20021001000000_create_unidom_shipments.rb
56
59
  - db/migrate/20021002000000_create_unidom_shipment_items.rb