comee_core 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/customer_order_items_controller.rb +1 -0
- data/app/controllers/comee/core/customer_orders_controller.rb +1 -1
- data/app/controllers/comee/core/product_lookups_controller.rb +1 -1
- data/app/controllers/comee/core/quotation_request_items_controller.rb +1 -0
- data/app/controllers/comee/core/sales_order_items_controller.rb +2 -2
- data/app/controllers/comee/core/sales_orders_controller.rb +5 -3
- data/app/models/comee/core/customer_order_item.rb +4 -2
- data/app/models/comee/core/sales_order.rb +5 -7
- data/app/models/comee/core/sales_order_item.rb +2 -1
- data/app/serializers/comee/core/customer_order_item_serializer.rb +2 -2
- data/app/serializers/comee/core/quotation_request_item_serializer.rb +2 -1
- data/app/serializers/comee/core/sales_order_item_serializer.rb +2 -2
- data/app/serializers/comee/core/sales_order_serializer.rb +5 -2
- data/app/services/comee/core/customer_order_service.rb +11 -1
- data/app/services/comee/core/quotation_request_service.rb +1 -0
- data/db/migrate/20230811102708_create_comee_core_customer_order_items.rb +1 -0
- data/db/migrate/20230812190652_create_comee_core_sales_orders.rb +12 -4
- data/db/migrate/20230812212844_create_comee_core_sales_order_items.rb +1 -0
- data/db/migrate/20231121132709_create_comee_core_quotation_request_items.rb +1 -0
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/customer_order_items.rb +1 -0
- data/spec/factories/comee/core/quotation_request_items.rb +1 -0
- data/spec/factories/comee/core/sales_order_items.rb +1 -0
- data/spec/factories/comee/core/sales_orders.rb +12 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 854004edc559daff1dd6605fc7b95b1f83602629d2e59771a487226c95833350
|
4
|
+
data.tar.gz: 48fe39dcd8d5867fb4abff691bd615f1eb434b7e01cc31771bb0a1a57765af09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d47550e712d840c8b1d62fd3b0a7b5a34b5bd8aaf71e6fbbc48cede293d9192d0a2d6801f9176c5d09d5d42b688c28cbb7b468ea035253131f4bb049d55ffb03
|
7
|
+
data.tar.gz: 743df5145f4670590dbeeb08c36d32a9fea41a465ae05e8594230c554e76abb9e540122c57455a1744a8f7fd575b08ee93802c695f336188cba9dc1b773d9daf
|
@@ -68,7 +68,7 @@ module Comee
|
|
68
68
|
.permit(
|
69
69
|
:order_number, :order_date, :order_terms, :consignee, :shipment_address, :final_destination,
|
70
70
|
:final_delivery_date, :handover_date, :shipping_date, :delivery_address, :invoice_address, :status, :client_id,
|
71
|
-
items: %i[customer_item_no product_id quantity price total_price unit_id delivery_date]
|
71
|
+
items: %i[customer_item_no customer_item_description product_id quantity price total_price unit_id delivery_date]
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
@@ -29,8 +29,8 @@ module Comee
|
|
29
29
|
|
30
30
|
def model_params
|
31
31
|
params.require(:payload).permit(:sales_order_id, :customer_order_item_id, :product_id, :unit_id, :quantity, :quantity_delivered,
|
32
|
-
:customer_item_no, :price, :handover_date, :delivery_date,
|
33
|
-
:action_note, :po_reference, :pallet_no, :source_id)
|
32
|
+
:customer_item_no, :customer_item_description, :price, :handover_date, :delivery_date,
|
33
|
+
:eb_number, :lead_time, :comment, :action_note, :po_reference, :pallet_no, :source_id)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -58,9 +58,11 @@ module Comee
|
|
58
58
|
private
|
59
59
|
|
60
60
|
def model_params
|
61
|
-
params.require(:payload).permit(:order_number, :
|
62
|
-
:
|
63
|
-
:consignee, :
|
61
|
+
params.require(:payload).permit(:order_number, :order_date, :customer_order_id, :fulfillment_center_id, :client_id,
|
62
|
+
:order_terms, :shipment_address, :delivery_address, :invoice_address, :destination,
|
63
|
+
:handover_date, :shipping_date, :delivery_date, :consignee, :payment_term, :deivery_term,
|
64
|
+
:payment_penalty, :status, :total_price, :amount_paid, :pallete_note, :remark,
|
65
|
+
files: [])
|
64
66
|
end
|
65
67
|
|
66
68
|
def back_order_params
|
@@ -7,14 +7,16 @@ module Comee
|
|
7
7
|
belongs_to :product
|
8
8
|
belongs_to :unit
|
9
9
|
|
10
|
-
validates :customer_item_no, :quantity, :price, :delivery_date, presence: true
|
10
|
+
validates :customer_item_no, :customer_item_description, :quantity, :price, :delivery_date, presence: true
|
11
|
+
validates :quantity, :price, numericality: {greater_than_or_equal_to: 0}
|
12
|
+
validates :total_price, numericality: {greater_than_or_equal_to: 0}, allow_nil: true
|
11
13
|
|
12
14
|
def calculate_total_price
|
13
15
|
self.total_price = price * quantity
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.ransackable_attributes(_auth_object = nil)
|
17
|
-
%w[id customer_order_id product_id unit_id]
|
19
|
+
%w[id customer_order_id product_id unit_id customer_item_no customer_item_description delivery_date]
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.ransackable_associations(_auth_object = nil)
|
@@ -14,15 +14,13 @@ module Comee
|
|
14
14
|
enum :status, {draft: 0, submitted: 1, confirmed: 2, canceled: 3}
|
15
15
|
|
16
16
|
validates :order_number, presence: true, uniqueness: true
|
17
|
-
validates :status, presence: true
|
18
|
-
validates :payment_penalty,
|
19
|
-
presence: true,
|
20
|
-
numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
|
17
|
+
validates :order_date, :status, presence: true
|
18
|
+
validates :payment_penalty, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}, allow_nil: true
|
21
19
|
|
22
|
-
validates :
|
23
|
-
:amount_paid,
|
20
|
+
validates :amount_paid,
|
24
21
|
presence: true,
|
25
|
-
numericality: {greater_than_or_equal_to: 0}
|
22
|
+
numericality: {greater_than_or_equal_to: 0},
|
23
|
+
allow_nil: true
|
26
24
|
|
27
25
|
def total_price
|
28
26
|
sales_order_items = SalesOrderItem.where(sales_order_id: id)
|
@@ -10,7 +10,7 @@ module Comee
|
|
10
10
|
belongs_to :source, class_name: "Comee::Core::FulfillmentCenter", optional: true
|
11
11
|
has_many :shipment_items
|
12
12
|
|
13
|
-
validates :customer_item_no, :delivery_date, presence: true
|
13
|
+
validates :customer_item_no, :customer_item_description, :delivery_date, presence: true
|
14
14
|
validates :quantity, :price, presence: true, numericality: {greater_than: 0}
|
15
15
|
validates :quantity_delivered, numericality: {greater_than_or_equal_to: 0}
|
16
16
|
|
@@ -22,6 +22,7 @@ module Comee
|
|
22
22
|
%w[
|
23
23
|
id
|
24
24
|
customer_item_no
|
25
|
+
customer_item_description
|
25
26
|
customer_order_item_id
|
26
27
|
delivery_date
|
27
28
|
eb_number
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class CustomerOrderItemSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :customer_item_no, :quantity, :price, :total_price, :delivery_date,
|
5
|
-
:product_id, :unit_id
|
4
|
+
attributes :id, :customer_item_no, :customer_item_description, :quantity, :price, :total_price, :delivery_date,
|
5
|
+
:canceled, :customer_order_id, :product_id, :unit_id
|
6
6
|
belongs_to :product
|
7
7
|
belongs_to :unit
|
8
8
|
belongs_to :customer_order
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class QuotationRequestItemSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :customer_item_no, :price, :margin, :margin_type, :valid_from, :valid_to,
|
4
|
+
attributes :id, :customer_item_no, :customer_item_description, :price, :margin, :margin_type, :valid_from, :valid_to,
|
5
|
+
:quantity, :expected_delivery_date
|
5
6
|
belongs_to :product
|
6
7
|
belongs_to :quotation_request
|
7
8
|
belongs_to :unit
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class SalesOrderItemSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :customer_item_no, :quantity, :quantity_delivered, :price, :handover_date,
|
5
|
-
:lead_time, :comment, :action_note, :po_reference, :total_price
|
4
|
+
attributes :id, :customer_item_no, :customer_item_description, :quantity, :quantity_delivered, :price, :handover_date,
|
5
|
+
:delivery_date, :eb_number, :lead_time, :comment, :action_note, :po_reference, :total_price
|
6
6
|
|
7
7
|
belongs_to :sales_order
|
8
8
|
belongs_to :customer_order_item
|
@@ -1,12 +1,15 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class SalesOrderSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :order_number, :
|
5
|
-
:
|
4
|
+
attributes :id, :order_number, :order_date, :order_terms, :shipment_address, :delivery_address, :invoice_address,
|
5
|
+
:destination, :handover_date, :shipping_date, :delivery_date, :consignee, :parent_client_name, :payment_term,
|
6
|
+
:delivery_term, :payment_penalty, :status, :total_price, :amount_paid, :pallete_note, :remark, :created_by,
|
7
|
+
:files_url
|
6
8
|
belongs_to :customer_order
|
7
9
|
belongs_to :client
|
8
10
|
belongs_to :fulfillment_center
|
9
11
|
has_many :sales_order_items
|
12
|
+
has_one :customs_detail
|
10
13
|
end
|
11
14
|
end
|
12
15
|
end
|
@@ -138,9 +138,18 @@ module Comee
|
|
138
138
|
CustomerOrder.transaction do
|
139
139
|
sales_order = SalesOrder.create!(
|
140
140
|
order_number: order.order_number,
|
141
|
+
order_date: order.order_date,
|
141
142
|
customer_order: order,
|
142
143
|
status: SalesOrder.statuses[:draft],
|
143
144
|
client: order.client,
|
145
|
+
order_terms: order.order_terms,
|
146
|
+
shipment_address: order.shipment_address,
|
147
|
+
invoice_address: order.invoice_address,
|
148
|
+
delivery_address: order.delivery_address,
|
149
|
+
destination: order.final_destination,
|
150
|
+
handover_date: order.handover_date,
|
151
|
+
shipping_date: order.shipping_date,
|
152
|
+
delivery_date: order.final_delivery_date,
|
144
153
|
consignee: order.consignee,
|
145
154
|
created_by: accepted_by || ""
|
146
155
|
)
|
@@ -173,7 +182,8 @@ module Comee
|
|
173
182
|
customer_order_item_id: item.id,
|
174
183
|
product_id: item.product_id,
|
175
184
|
unit_id: unit_id,
|
176
|
-
customer_item_no: item.
|
185
|
+
customer_item_no: item.customer_item_no,
|
186
|
+
customer_item_description: item.customer_item_description,
|
177
187
|
quantity: quantity,
|
178
188
|
price: price,
|
179
189
|
total_price: quantity * price,
|
@@ -118,6 +118,7 @@ module Comee
|
|
118
118
|
product_id: item.product_id,
|
119
119
|
unit_id: item.unit_id,
|
120
120
|
customer_item_no: item.customer_item_no,
|
121
|
+
customer_item_description: item.customer_item_description,
|
121
122
|
quantity: item.quantity,
|
122
123
|
price: item.price,
|
123
124
|
delivery_date: item.expected_delivery_date,
|
@@ -14,6 +14,7 @@ class CreateComeeCoreCustomerOrderItems < ActiveRecord::Migration[7.1]
|
|
14
14
|
index: {name: "unit_on_cccuoi_indx"},
|
15
15
|
foreign_key: {to_table: :comee_core_units}
|
16
16
|
t.string :customer_item_no, null: false
|
17
|
+
t.string :customer_item_description, null: false
|
17
18
|
t.float :quantity, null: false, default: 0
|
18
19
|
t.float :price, null: false, default: 0
|
19
20
|
t.float :total_price, null: false, default: 0
|
@@ -2,6 +2,7 @@ class CreateComeeCoreSalesOrders < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :comee_core_sales_orders do |t|
|
4
4
|
t.string :order_number, null: false
|
5
|
+
t.date :order_date, null: false
|
5
6
|
t.references :customer_order,
|
6
7
|
null: false,
|
7
8
|
index: {name: "co_on_ccso_indx"},
|
@@ -14,16 +15,23 @@ class CreateComeeCoreSalesOrders < ActiveRecord::Migration[7.0]
|
|
14
15
|
null: false,
|
15
16
|
index: {name: "client_on_ccso_indx"},
|
16
17
|
foreign_key: {to_table: :comee_core_clients}
|
18
|
+
t.string :order_terms
|
19
|
+
t.string :shipment_address
|
20
|
+
t.string :delivery_address
|
21
|
+
t.string :invoice_address
|
22
|
+
t.string :destination
|
23
|
+
t.date :shipping_date
|
24
|
+
t.date :delivery_date
|
25
|
+
t.date :handover_date
|
17
26
|
t.string :consignee
|
18
27
|
t.string :parent_client_name
|
19
28
|
t.string :payment_term
|
20
29
|
t.string :delivery_term
|
21
|
-
t.float :payment_penalty,
|
30
|
+
t.float :payment_penalty, default: 0
|
22
31
|
t.integer :status, null: false, default: 0
|
23
|
-
t.float :total_price,
|
24
|
-
t.float :amount_paid,
|
32
|
+
t.float :total_price, default: 0.0
|
33
|
+
t.float :amount_paid, default: 0.0
|
25
34
|
t.string :pallete_note
|
26
|
-
t.date :handover_date
|
27
35
|
t.string :remark
|
28
36
|
t.string :created_by
|
29
37
|
|
@@ -22,6 +22,7 @@ class CreateComeeCoreSalesOrderItems < ActiveRecord::Migration[7.0]
|
|
22
22
|
index: {name: "source_on_ccsoi_indx"},
|
23
23
|
foreign_key: {to_table: :comee_core_fulfillment_centers}
|
24
24
|
t.string :customer_item_no, null: false
|
25
|
+
t.string :customer_item_description, null: false
|
25
26
|
t.float :quantity, null: false
|
26
27
|
t.float :quantity_delivered, null: false, default: 0
|
27
28
|
t.float :price, null: false
|
@@ -10,6 +10,7 @@ class CreateComeeCoreQuotationRequestItems < ActiveRecord::Migration[7.1]
|
|
10
10
|
index: {name: "rfq_on_ccrfqi_indx"},
|
11
11
|
foreign_key: {to_table: :comee_core_quotation_requests}
|
12
12
|
t.string :customer_item_no
|
13
|
+
t.string :customer_item_description
|
13
14
|
t.float :quantity, null: false
|
14
15
|
t.float :price, null: false, default: 0
|
15
16
|
t.float :margin, null: false, default: 0
|
data/lib/comee/core/version.rb
CHANGED
@@ -1,19 +1,28 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :sales_order, class: "Comee::Core::SalesOrder" do
|
3
3
|
order_number { Faker::Alphanumeric.alpha(number: 10) }
|
4
|
+
order_date { Date.current }
|
4
5
|
customer_order
|
5
6
|
fulfillment_center
|
6
7
|
client
|
8
|
+
order_terms { Faker::Lorem.sentence }
|
9
|
+
shipment_address { Faker::Address.full_address }
|
10
|
+
delivery_address { Faker::Address.full_address }
|
11
|
+
invoice_address { Faker::Address.full_address }
|
12
|
+
destination { Faker::Address.city }
|
13
|
+
handover_date { Date.current.advance(weeks: 1) }
|
14
|
+
shipping_date { Date.current.advance(days: 10) }
|
15
|
+
delivery_date { Date.current.advance(days: 15) }
|
16
|
+
consignee { Faker::Name.name }
|
17
|
+
parent_client_name { Faker::Name.name }
|
7
18
|
payment_term { Faker::Lorem.sentence }
|
8
19
|
delivery_term { Faker::Lorem.sentence }
|
9
20
|
payment_penalty { 0 }
|
21
|
+
status { Comee::Core::SalesOrder.statuses[:draft] }
|
10
22
|
total_price { 0 }
|
11
23
|
amount_paid { 0 }
|
12
|
-
status { Comee::Core::SalesOrder.statuses[:draft] }
|
13
24
|
pallete_note { Faker::Lorem.sentence }
|
14
|
-
consignee { Faker::Name.name }
|
15
25
|
remark { Faker::Lorem.sentence }
|
16
|
-
parent_client_name { Faker::Name.name }
|
17
26
|
created_by { Faker::Name.name }
|
18
27
|
end
|
19
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comee_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|