unidom-shipment 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 24ac5171783e30f48c2c858aeb53c5977c6aa6cf
4
+ data.tar.gz: b367e8a32f7723ccc3cc6266ab2bf391ff4d7d15
5
+ SHA512:
6
+ metadata.gz: 0d9176a827d2b0dbe1f19289b80012a842200b0cfd06f5e4e22e9933d919f4b003fa1a4755b04c4da29fe813d9c77e729494688befceaba89e151319f91b2e2d
7
+ data.tar.gz: 9329363695116d5f69d2a66154d5f33915d5e3d775ac0c1dc67ac30425cb80436be76dbe52c5f7f15d18b5a062c095268ef8e7a606b8859e48db51acc3a56519
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Topbit Du
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Unidom Shipment 装运领域模型引擎
2
+
3
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
+ [![Gem Version](https://badge.fury.io/rb/unidom-shipment.svg)](https://badge.fury.io/rb/unidom-shipment)
5
+
6
+ Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Shipment domain model engine includes the Shipment and the Shipment Item.
7
+ Unidom (统一领域对象模型)是一系列的领域模型引擎。装运领域模型引擎包括装运和装运项的模型。
8
+
9
+
10
+
11
+ ## Recent Update
12
+
13
+ Check out the [Road Map](ROADMAP.md) to find out what's the next.
14
+ Check out the [Change Log](CHANGELOG.md) to find out what's new.
15
+
16
+
17
+
18
+ ## Usage in Gemfile
19
+
20
+ ```ruby
21
+ gem 'unidom-shipment'
22
+ ```
23
+
24
+
25
+
26
+ ## Run the Database Migration
27
+
28
+ ```shell
29
+ rake db:migrate
30
+ ```
31
+ The migration versions start with 200210.
32
+
33
+
34
+
35
+ ## Call the Model
36
+
37
+ ```ruby
38
+ shipment = Unidom::Shipment::Shipment.valid_at.alive.first
39
+ shipment_item = Unidom::Shipment::ShipmentItem.valid_at.alive.first
40
+ shipment_items = shipment.items
41
+ ```
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Unidom Shipment'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+ load 'rails/tasks/statistics.rake'
20
+
21
+
22
+
23
+ #Bundler::GemHelper.install_tasks
24
+ require 'bundler/gem_tasks'
25
+
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/unidom/shipment .js
2
+ //= link_directory ../stylesheets/unidom/shipment .css
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_self
@@ -0,0 +1,14 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_self
14
+ */
@@ -0,0 +1,3 @@
1
+ class Unidom::Shipment::ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
3
+ end
@@ -0,0 +1,2 @@
1
+ module Unidom::Shipment::ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class Unidom::Shipment::ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class Unidom::Shipment::ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class Unidom::Shipment::ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,31 @@
1
+ # Shipment 是装运。
2
+ # conveyance_code 是运送代码,可以是以下取值:
3
+ # CSSP: Customer Shipment 客户装运,把货物发给客户。
4
+ # CSRT: Customer Return 客户退回,从购买了产品的客户那里把退回的产品运回来。
5
+ # PCSP: Purchase Shipment 购买装运,从供应商那里把购买的货物运进来。
6
+ # PCRT: Purchase Return 进货退回,把发来的货物返回给供应商。
7
+ # TRSF: Transfer 转运,从内部组织到另一个内部组织调拨。
8
+ # DROP: Drop Shipment 直接装运,销售商把产品从供应商那里直接运送给客户。
9
+
10
+ class Unidom::Shipment::Shipment < Unidom::Shipment::ApplicationRecord
11
+
12
+ self.table_name = 'unidom_shipments'
13
+
14
+ include Unidom::Common::Concerns::ModelExtension
15
+
16
+ validates :estimated_amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
17
+ validates :actual_amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
18
+
19
+ belongs_to :sender_party, polymorphic: true
20
+ belongs_to :sender_agent, polymorphic: true
21
+ belongs_to :sender_location, polymorphic: true
22
+ belongs_to :sender_contact, polymorphic: true
23
+
24
+ belongs_to :receiver_party, polymorphic: true
25
+ belongs_to :receiver_agent, polymorphic: true
26
+ belongs_to :receiver_location, polymorphic: true
27
+ belongs_to :receiver_contact, polymorphic: true
28
+
29
+ has_many :items, class_name: 'Unidom::Shipment::ShipmentItem'
30
+
31
+ end
@@ -0,0 +1,14 @@
1
+ # Shipment Item 是装运项。
2
+
3
+ class Unidom::Shipment::ShipmentItem < Unidom::Shipment::ApplicationRecord
4
+
5
+ self.table_name = 'unidom_shipment_items'
6
+
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
9
+ validates :quantity, presence: true, numericality: { greater_than_or_equal_to: 0 }
10
+
11
+ belongs_to :shipment, class_name: 'Unidom::Shipment::Shipment'
12
+ belongs_to :shipped, polymorphic: true
13
+
14
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Unidom Shipment</title>
5
+ <%= stylesheet_link_tag 'unidom/shipment/application', media: 'all' %>
6
+ <%= csrf_meta_tags %>
7
+ </head>
8
+ <body>
9
+
10
+ <%= yield %>
11
+
12
+ <%= javascript_include_tag 'unidom/shipment/application' %>
13
+
14
+ </body>
15
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Unidom::Shipment::Engine.routes.draw do
2
+ end
@@ -0,0 +1,64 @@
1
+ class CreateUnidomShipments < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_shipments, id: :uuid do |t|
6
+
7
+ t.references :sender_party, type: :uuid, null: false,
8
+ polymorphic: { null: false, default: '', limit: 200 }
9
+ t.references :sender_agent, type: :uuid, null: false,
10
+ polymorphic: { null: false, default: '', limit: 200 }
11
+ t.references :sender_location, type: :uuid, null: false,
12
+ polymorphic: { null: false, default: '', limit: 200 }
13
+ t.references :sender_contact, type: :uuid, null: false,
14
+ polymorphic: { null: false, default: '', limit: 200 }
15
+
16
+ t.references :receiver_party, type: :uuid, null: false,
17
+ polymorphic: { null: false, default: '', limit: 200 }
18
+ t.references :receiver_agent, type: :uuid, null: false,
19
+ polymorphic: { null: false, default: '', limit: 200 }
20
+ t.references :receiver_location, type: :uuid, null: false,
21
+ polymorphic: { null: false, default: '', limit: 200 }
22
+ t.references :receiver_contact, type: :uuid, null: false,
23
+ polymorphic: { null: false, default: '', limit: 200 }
24
+
25
+ t.column :conveyance_code, 'char(4)', null: false, default: 'ZZZZ'
26
+
27
+ t.date :estimated_ready_on, null: false, default: nil
28
+ t.date :estimated_shipped_on, null: false, default: nil
29
+ t.date :estimated_arrived_on, null: false, default: nil
30
+
31
+ t.datetime :last_cancellable_at, null: false, default: nil
32
+
33
+ t.datetime :shipped_at, null: true
34
+ t.datetime :received_at, null: true
35
+ t.datetime :cancelled_at, null: true
36
+
37
+ t.decimal :estimated_amount, null: false, default: 0.0, precision: 12, scale: 2
38
+ t.decimal :actual_amount, null: false, default: 0.0, precision: 12, scale: 2
39
+
40
+ t.text :instruction
41
+ t.text :description
42
+
43
+ t.column :state, 'char(1)', null: false, default: 'C'
44
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
45
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
46
+ t.boolean :defunct, null: false, default: false
47
+ t.jsonb :notation, null: false, default: {}
48
+
49
+ t.timestamps null: false
50
+
51
+ end
52
+
53
+ add_index :unidom_shipments, :sender_party_id
54
+ add_index :unidom_shipments, :sender_agent_id
55
+ add_index :unidom_shipments, :sender_location_id
56
+ add_index :unidom_shipments, :sender_contact_id
57
+ add_index :unidom_shipments, :receiver_party_id
58
+ add_index :unidom_shipments, :receiver_agent_id
59
+ add_index :unidom_shipments, :receiver_location_id
60
+ add_index :unidom_shipments, :receiver_contact_id
61
+
62
+ end
63
+
64
+ end
@@ -0,0 +1,32 @@
1
+ class CreateUnidomShipmentItems < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_shipment_items, id: :uuid do |t|
6
+
7
+ t.references :shipment, type: :uuid, null: false
8
+ t.references :shipped, type: :uuid, null: false,
9
+ polymorphic: { null: false, default: '', limit: 200 }
10
+
11
+ t.integer :ordinal, null: false, default: 0
12
+ t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
13
+
14
+ t.text :instruction
15
+ t.text :description
16
+
17
+ t.column :state, 'char(1)', null: false, default: 'C'
18
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
19
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
20
+ t.boolean :defunct, null: false, default: false
21
+ t.jsonb :notation, null: false, default: {}
22
+
23
+ t.timestamps null: false
24
+
25
+ end
26
+
27
+ add_index :unidom_shipment_items, :shipment_id
28
+ add_index :unidom_shipment_items, :shipped_id
29
+
30
+ end
31
+
32
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :shipment do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,6 @@
1
+ require 'unidom/shipment/engine'
2
+
3
+ module Unidom
4
+ module Shipment
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ module Unidom
2
+ module Shipment
3
+
4
+ class Engine < ::Rails::Engine
5
+
6
+ isolate_namespace ::Unidom::Shipment
7
+
8
+ initializer :append_migrations do |app|
9
+ 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
+ end
11
+
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module Unidom
2
+ module Shipment
3
+ VERSION = '0.1'.freeze
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: unidom-shipment
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Topbit Du
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: unidom-common
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
+ The Shipment domain model engine includes the Shipment and the Shipment Item. Unidom
29
+ (统一领域对象模型)是一系列的领域模型引擎。装运领域模型引擎包括装运和装运项的模型。
30
+ email:
31
+ - topbit.du@gmail.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - MIT-LICENSE
37
+ - README.md
38
+ - Rakefile
39
+ - app/assets/config/unidom-shipment_manifest.js
40
+ - app/assets/javascripts/unidom/shipment/application.js
41
+ - app/assets/stylesheets/unidom/shipment/application.css
42
+ - app/controllers/unidom/shipment/application_controller.rb
43
+ - app/helpers/unidom/shipment/application_helper.rb
44
+ - app/jobs/unidom/shipment/application_job.rb
45
+ - app/mailers/unidom/shipment/application_mailer.rb
46
+ - app/models/unidom/shipment/application_record.rb
47
+ - app/models/unidom/shipment/shipment.rb
48
+ - app/models/unidom/shipment/shipment_item.rb
49
+ - app/views/layouts/unidom/shipment/application.html.erb
50
+ - config/routes.rb
51
+ - db/migrate/20021001000000_create_unidom_shipments.rb
52
+ - db/migrate/20021002000000_create_unidom_shipment_items.rb
53
+ - lib/tasks/shipment_tasks.rake
54
+ - lib/unidom/shipment.rb
55
+ - lib/unidom/shipment/engine.rb
56
+ - lib/unidom/shipment/version.rb
57
+ homepage: https://github.com/topbitdu/unidom-shipment
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.6.4
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Unidom Shipment Domain Model Engine 装运领域模型引擎
81
+ test_files: []