comee_core 0.3.1 → 0.3.3
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/customs_details_controller.rb +15 -1
- data/app/controllers/comee/core/users_controller.rb +3 -3
- data/app/models/comee/core/customs_detail.rb +0 -4
- data/app/models/comee/core/goods_issued_note.rb +8 -0
- data/app/models/comee/core/reorder_report.rb +8 -0
- data/app/serializers/comee/core/sales_order_item_serializer.rb +1 -1
- data/app/serializers/comee/core/sales_order_serializer.rb +1 -1
- data/app/services/comee/core/beo_service.rb +233 -57
- data/config/routes.rb +1 -3
- data/db/migrate/20231125115522_create_comee_core_customs_details.rb +12 -12
- data/lib/comee/core/version.rb +1 -1
- 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: 27037927222c47f336ab62f1a7663b4711e4e9d72569f8a22b6f9aa6456fc771
|
4
|
+
data.tar.gz: 4c530f8a8f820da46cd03a5d8715256eae40c9b229ca22448b95a57c5ed847dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bc9dbf09a3f5131dec303aca390b204e5556aac0e7aea017feddcb19142fdfdaf0902f0ee7e30ada6753347e55e58951a0c0a5fd178f846b46822d7c21d2404
|
7
|
+
data.tar.gz: a31dd17eb583fe4182b0c070a915acb8fb8fc56066569418af0865218c330fbb65c9bb3db73b8ccd22823b5fb4fc907eba9277efce4472140975cedacf3f44fa
|
@@ -9,15 +9,29 @@ module Comee
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def send_customs_details
|
12
|
-
service = BeoService.new(
|
12
|
+
service = BeoService.new(publish_params[:ids])
|
13
13
|
data = service.send_customs_details
|
14
14
|
render json: {success: true, data: data}
|
15
15
|
rescue StandardError => e
|
16
16
|
render json: {success: false, error: e.message}, status: 422
|
17
17
|
end
|
18
18
|
|
19
|
+
def generate_beo_xml
|
20
|
+
service = BeoService.new(publish_params[:ids])
|
21
|
+
data = service.preprocess_data(xml: true)
|
22
|
+
render json: {success: true, data: data}
|
23
|
+
rescue StandardError => e
|
24
|
+
render json: {success: false, error: e.message}, status: 422
|
25
|
+
end
|
26
|
+
|
19
27
|
private
|
20
28
|
|
29
|
+
def publish_params
|
30
|
+
params.require(:payload).permit(
|
31
|
+
ids: []
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
21
35
|
def model_params
|
22
36
|
params.require(:payload).permit(
|
23
37
|
:registration_type,
|
@@ -8,12 +8,12 @@ module Comee
|
|
8
8
|
if @user.authenticate(change_password_params[:old_password])
|
9
9
|
if @user.update(password: change_password_params[:new_password],
|
10
10
|
password_confirmation: change_password_params[:new_password_confirmation])
|
11
|
-
render json:
|
11
|
+
render json: {success: true, data: serialize(@user)}
|
12
12
|
else
|
13
|
-
render json: {
|
13
|
+
render json: {success: false, error: @user.errors.full_messages[0]}, status: 422
|
14
14
|
end
|
15
15
|
else
|
16
|
-
render json: {error: "Old password
|
16
|
+
render json: {success: false, error: "Old password doesn't match!"}, status: 422
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -10,10 +10,6 @@ module Comee
|
|
10
10
|
def self.ransackable_associations(_auth_object = nil)
|
11
11
|
%w[sales_order]
|
12
12
|
end
|
13
|
-
|
14
|
-
validates :registration_type, :export_declaration_type, :participant_constellation, :mode_of_transport_type, :destination_country,
|
15
|
-
:additional_identifier, :packaging_type, :export_customs_office, :customs_office_of_exit, :mode_of_transport,
|
16
|
-
:delivery_term_code, presence: true
|
17
13
|
end
|
18
14
|
end
|
19
15
|
end
|
@@ -6,6 +6,14 @@ module Comee
|
|
6
6
|
|
7
7
|
validates :gin_number, :stock_transfer_request, uniqueness: true
|
8
8
|
validates :date_issued, :gin_number, presence: true
|
9
|
+
|
10
|
+
def self.ransackable_attributes(_auth_object = nil)
|
11
|
+
%w[gin_number date_issued stock_transfer_request_id]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.ransackable_associations(_auth_object = nil)
|
15
|
+
%w[stock_transfer_request]
|
16
|
+
end
|
9
17
|
end
|
10
18
|
end
|
11
19
|
end
|
@@ -8,6 +8,14 @@ module Comee
|
|
8
8
|
validates :report_date, presence: true
|
9
9
|
validates :reference_number, uniqueness: true
|
10
10
|
|
11
|
+
def self.ransackable_attributes(_auth_object = nil)
|
12
|
+
%w[reference_number report_date store_id]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.ransackable_associations(_auth_object = nil)
|
16
|
+
%w[store]
|
17
|
+
end
|
18
|
+
|
11
19
|
private
|
12
20
|
|
13
21
|
def set_reference_number
|
@@ -3,7 +3,7 @@ module Comee
|
|
3
3
|
class SalesOrderItemSerializer < ActiveModel::Serializer
|
4
4
|
attributes :id, :serial_no, :customer_item_no, :customer_item_description, :quantity, :quantity_delivered, :quantity_canceled,
|
5
5
|
:price, :handover_date, :delivery_date, :eb_number, :lead_time, :comment, :action_note, :purchase_order_item_id,
|
6
|
-
:total_price, :canceled, :processing_status, :additional_details
|
6
|
+
:total_price, :canceled, :processing_status, :additional_details, :created_at
|
7
7
|
belongs_to :sales_order
|
8
8
|
belongs_to :customer_order_item
|
9
9
|
belongs_to :source
|
@@ -4,7 +4,7 @@ module Comee
|
|
4
4
|
attributes :id, :order_number, :order_date, :order_terms, :shipment_address, :delivery_address, :invoice_address,
|
5
5
|
:destination, :handover_date, :shipping_date, :delivery_date, :consignee, :parent_client_name, :payment_term,
|
6
6
|
:delivery_term, :payment_penalty, :status, :purchase_status, :total_price, :amount_paid, :pallete_note,
|
7
|
-
:remark, :created_by, :files_url
|
7
|
+
:remark, :created_by, :files_url, :created_at
|
8
8
|
belongs_to :customer_order
|
9
9
|
belongs_to :client
|
10
10
|
belongs_to :fulfillment_center
|
@@ -3,54 +3,105 @@ require "httparty"
|
|
3
3
|
module Comee
|
4
4
|
module Core
|
5
5
|
class BeoService
|
6
|
-
def initialize(
|
6
|
+
def initialize(ids)
|
7
7
|
@atlas_token = ENV.fetch("ATLAS_TOKEN")
|
8
8
|
@atlas_base_url = ENV.fetch("ATLAS_BASE_URL")
|
9
9
|
@encoded_auth = ENV.fetch("ENCODED_AUTH")
|
10
|
-
@
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
@ids = ids
|
11
|
+
end
|
12
|
+
|
13
|
+
def preprocess_data(xml: false)
|
14
|
+
@ids.each do |id|
|
15
|
+
@line_items = if xml
|
16
|
+
shipment_items = Comee::Core::ShipmentItem.includes(sales_order_item: :sales_order)
|
17
|
+
.where(sales_order_item: {sales_order_id: id})
|
18
|
+
sales_order_item_ids = shipment_items.map { |item| item.sales_order_item_id }
|
19
|
+
Comee::Core::SalesOrderItem.where(id: sales_order_item_ids)
|
20
|
+
else
|
21
|
+
Comee::Core::ShipmentInstructionItem.includes(shipment_item: {sales_order_item: :sales_order})
|
22
|
+
.where(shipment_instruction_id: id)
|
23
|
+
end
|
24
|
+
sales_order_ids = if xml
|
25
|
+
@line_items.map(&:sales_order_id)
|
26
|
+
else
|
27
|
+
@line_items.map { |item| item.shipment_item.sales_order_item.sales_order.id }
|
28
|
+
end
|
29
|
+
@customs_details = Comee::Core::CustomsDetail.includes(sales_order: :customer_order).where(sales_order_id: sales_order_ids)
|
30
|
+
@transportation_routes = []
|
31
|
+
@position_data = []
|
32
|
+
|
33
|
+
packaging_types = @line_items.map do |line_item|
|
34
|
+
if xml
|
35
|
+
Comee::Core::ShipmentItem.find_by(sales_order_item_id: line_item.id).package_type.split(" ")[0]
|
36
|
+
else
|
37
|
+
line_item.shipment_item.package_type.split(" ")[0]
|
38
|
+
end
|
39
|
+
end.uniq
|
40
|
+
|
41
|
+
@no_of_packages = packaging_types.count
|
42
|
+
@package_type = packaging_types.count == 1 && packaging_types.first == "PX" ? "PX" : "PK"
|
43
|
+
@total_weight = @line_items.sum do |line_item|
|
44
|
+
if xml
|
45
|
+
(line_item.quantity * line_item.product.weight).round(2)
|
46
|
+
else
|
47
|
+
(line_item.shipment_item.sales_order_item.quantity * line_item.shipment_item.sales_order_item.product.weight).round(2)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
raise(StandardError, "No customs detail filed for sales order") unless @customs_details.present?
|
52
|
+
|
53
|
+
@address = @customs_details[0].sales_order.customer_order.client.address.split(", ")
|
54
|
+
@customs_details[0].transportation_route.each do |tr|
|
55
|
+
@transportation_routes << tr["route"][0, 2]
|
56
|
+
end
|
57
|
+
|
58
|
+
@data = xml ? generate_xml : prepare_data
|
20
59
|
end
|
60
|
+
|
61
|
+
xml ? @data : JSON(@data)
|
21
62
|
end
|
22
63
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
@
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
64
|
+
def position_data
|
65
|
+
position_items = []
|
66
|
+
@line_items.each_with_index do |line_item, index|
|
67
|
+
si = line_item.shipment_item
|
68
|
+
customs_detail = @customs_details.find_by(sales_order_id: si.sales_order_item.sales_order_id)
|
69
|
+
mp = Comee::Core::MasterPrice.includes(:country_of_origin).find_by(primary: true,
|
70
|
+
product_id: si
|
71
|
+
.sales_order_item.product.id)
|
72
|
+
|
73
|
+
position_items << {
|
74
|
+
"warePositionsnummer": index + 1,
|
75
|
+
"wareWarennummerKN8": si.sales_order_item.product.hs_code,
|
76
|
+
"wareWarenbezeichnung": si.sales_order_item.product.hs_description,
|
77
|
+
"wareRegistriernummerFremdsystem": customs_detail.sales_order.customer_order.order_number,
|
32
78
|
"wareUrsprungsbundesland": mp.state_of_origin,
|
33
|
-
"wareEigenmasse":
|
34
|
-
"wareRohmasse":
|
79
|
+
"wareEigenmasse": si.sales_order_item.product.weight * si.sales_order_item.quantity,
|
80
|
+
"wareRohmasse": index.zero? ? @total_weight : 0,
|
35
81
|
"ausfuhrLand": "DE",
|
36
82
|
"ursprungsland": mp.country_of_origin.code,
|
37
83
|
"beantragtesVerfahren": "10",
|
38
84
|
"vorhergehendesVerfahren": "00",
|
39
85
|
"zusatzlichesVerfahren": "F61",
|
40
|
-
"aussenhandelsstatistikMenge":
|
41
|
-
"aussenhandelsstatistikWert":
|
86
|
+
"aussenhandelsstatistikMenge": si.sales_order_item.quantity,
|
87
|
+
"aussenhandelsstatistikWert": (si.sales_order_item.quantity *
|
88
|
+
si.sales_order_item.price * 1.05).round(2),
|
42
89
|
"packstuck": [
|
43
90
|
{
|
44
|
-
"packstuckNummer":
|
45
|
-
"packstuckAnzahl":
|
46
|
-
"packstuckVerpackungsart":
|
47
|
-
"packstuckZeichenNummern":
|
91
|
+
"packstuckNummer": index + 1,
|
92
|
+
"packstuckAnzahl": index.zero? ? @no_of_packages : 0,
|
93
|
+
"packstuckVerpackungsart": @package_type,
|
94
|
+
"packstuckZeichenNummern": customs_detail.sales_order.customer_order.order_number
|
48
95
|
}
|
49
96
|
]
|
50
97
|
}
|
51
98
|
end
|
52
99
|
|
53
|
-
|
100
|
+
position_items
|
101
|
+
end
|
102
|
+
|
103
|
+
def prepare_data
|
104
|
+
{
|
54
105
|
"dataIdentifier": "",
|
55
106
|
"kundenNumber": "",
|
56
107
|
"mandantId": "",
|
@@ -67,43 +118,43 @@ module Comee
|
|
67
118
|
{
|
68
119
|
"kopf": {
|
69
120
|
"eoriNiederlassungsnummer": "DE47897410000",
|
70
|
-
"
|
71
|
-
"
|
72
|
-
"artderAnmeldungAusfuhr": @customs_detail.export_declaration_type,
|
121
|
+
"artderAnmeldung": @customs_details[0].registration_type.split(" ")[0],
|
122
|
+
"artderAnmeldungAusfuhr": @customs_details[0].export_declaration_type,
|
73
123
|
"ausfuhrLand": "DE",
|
74
|
-
"beteiligtenKonstellation": @
|
75
|
-
"sicherheit": @
|
76
|
-
"container": @
|
77
|
-
"bestimmungsLand": @
|
78
|
-
"referenznummerUCR": @
|
79
|
-
"lrn": @
|
80
|
-
"beforderungsmittelImInlandVerkehrszweig": @
|
81
|
-
"beforderungsmittelderGrenzeVerkehrszweig": @
|
82
|
-
"beforderungsmittelderGrenzeArt": @
|
124
|
+
"beteiligtenKonstellation": @customs_details[0].participant_constellation.split(" ")[0],
|
125
|
+
"sicherheit": @customs_details[0].registration_type.split(" ")[0] == "CO" ? 0 : 2,
|
126
|
+
"container": @customs_details[0].containerized == true ? 1 : 0,
|
127
|
+
"bestimmungsLand": @customs_details[0].destination_country,
|
128
|
+
"referenznummerUCR": @customs_details.map(&:sales_order).map(&:customer_order).map(&:consignee).join(" "),
|
129
|
+
"lrn": @customs_details.map(&:sales_order).map(&:customer_order).map(&:order_number).join(" "),
|
130
|
+
"beforderungsmittelImInlandVerkehrszweig": @customs_details[0].mode_of_transport,
|
131
|
+
"beforderungsmittelderGrenzeVerkehrszweig": @customs_details[0].mode_of_transport_at_border,
|
132
|
+
"beforderungsmittelderGrenzeArt": @customs_details[0].mode_of_transport_type,
|
83
133
|
"beforderungsmittelderGrenzeKennzeichen": "UNBEKANNT",
|
84
|
-
"beforderungsmittelderGrenzeStaatszugehorigkeit": @
|
134
|
+
"beforderungsmittelderGrenzeStaatszugehorigkeit": @customs_details[0].mode_of_transport_nationality.split(" ")[0],
|
135
|
+
"gesamtRohmasse": @total_weight,
|
85
136
|
"beforderungsmittelBeimAbgang": [
|
86
137
|
{
|
87
138
|
"sequenznummer": "1",
|
88
|
-
"artderIdentifikation": @
|
89
|
-
"kennzeichen": @
|
90
|
-
"staatszugehorigkeit": @
|
139
|
+
"artderIdentifikation": @customs_details[0].type_of_identification.split(" ")[0],
|
140
|
+
"kennzeichen": @customs_details[0].additional_identifier.split(" ")[0],
|
141
|
+
"staatszugehorigkeit": @customs_details[0].nationality.split(" ")[0]
|
91
142
|
}
|
92
143
|
],
|
93
|
-
"ausfuhrzollstelleDienststellennummer": @
|
94
|
-
"vorgeseheneAusgangszollstelleDienststellennummer": @
|
144
|
+
"ausfuhrzollstelleDienststellennummer": @customs_details[0].export_customs_office.split(" ")[0],
|
145
|
+
"vorgeseheneAusgangszollstelleDienststellennummer": @customs_details[0].customs_office_of_exit.split(" ")[0],
|
95
146
|
"geschaftsvorgangArt": "11",
|
96
|
-
"geschaftsvorgangRechnungspreis": @
|
147
|
+
"geschaftsvorgangRechnungspreis": @customs_details[0].sales_order.total_price.round(2),
|
97
148
|
"geschaftsvorgangWahrung": "EUR",
|
98
149
|
"beforderungsroute": {
|
99
150
|
"ausgewahlteLander": @transportation_routes,
|
100
|
-
"beforderungsVon": @
|
101
|
-
"beforderungsBis": @
|
151
|
+
"beforderungsVon": @customs_details[0].transportation_route[0]["route"].split(" ")[0],
|
152
|
+
"beforderungsBis": @customs_details[0].transportation_route[-1]["route"].split(" ")[0]
|
102
153
|
},
|
103
154
|
"empfanger": {
|
104
155
|
"tin": "",
|
105
156
|
"niederlassungsNummer": "",
|
106
|
-
"name": @
|
157
|
+
"name": @customs_details[0].sales_order.customer_order.client.name,
|
107
158
|
"strasse": @address[0],
|
108
159
|
"plz": @address[-1],
|
109
160
|
"ort": "#{@address[1].split(' ')[-3]} #{@address[1].split(' ')[-2]}",
|
@@ -111,24 +162,22 @@ module Comee
|
|
111
162
|
},
|
112
163
|
"warenortArtdesOrtes": "B",
|
113
164
|
"warenortArtDerOrtsbestimmung": "Y",
|
114
|
-
"warenortZusatzlicheKennung": @
|
115
|
-
"lieferbedingungIncotermCode": @
|
165
|
+
"warenortZusatzlicheKennung": @customs_details[0].additional_identifier.split(" ")[0],
|
166
|
+
"lieferbedingungIncotermCode": @customs_details[0].delivery_term_code[0, 3],
|
116
167
|
"lieferbedingungOrt": "Hamburg"
|
117
168
|
},
|
118
|
-
"position":
|
169
|
+
"position": position_data
|
119
170
|
}
|
120
171
|
]
|
121
172
|
}
|
122
173
|
}
|
123
174
|
}
|
124
|
-
|
125
|
-
JSON(data)
|
126
175
|
end
|
127
176
|
|
128
177
|
def send_customs_details
|
129
178
|
response = HTTParty.post("#{@atlas_base_url}/PutData", headers: {'Content-Type': "application/json",
|
130
179
|
'token': @atlas_token,
|
131
|
-
'bearertoken': bearer_token}, body:
|
180
|
+
'bearertoken': bearer_token}, body: preprocess_data)
|
132
181
|
unless [200, 201].include?(response.code)
|
133
182
|
raise(StandardError,
|
134
183
|
"Failed to send POST request with token: #{response.code} - #{response.body}")
|
@@ -137,6 +186,133 @@ module Comee
|
|
137
186
|
JSON.parse(response.body)
|
138
187
|
end
|
139
188
|
|
189
|
+
def xml_position_data(xml)
|
190
|
+
@line_items.each_with_index do |line_item, index|
|
191
|
+
customs_detail = @customs_details.find_by(sales_order_id: line_item.sales_order_id)
|
192
|
+
mp = Comee::Core::MasterPrice.includes(:country_of_origin).find_by(primary: true,
|
193
|
+
product_id: line_item.product.id)
|
194
|
+
|
195
|
+
xml.Position do
|
196
|
+
xml.Positionsnummer (index + 1).to_s
|
197
|
+
xml.Warenbezeichnung line_item.product.hs_description
|
198
|
+
xml.Registriernummer_Fremdsystem customs_detail.sales_order.customer_order.order_number
|
199
|
+
xml.Kennnummer_der_Sendung @customs_details.map(&:sales_order).map(&:customer_order).map(&:consignee).join(" ")
|
200
|
+
xml.Ursprungsbundesland mp.state_of_origin
|
201
|
+
xml.Ursprungsland mp.country_of_origin.code
|
202
|
+
xml.Eigenmasse line_item.product.weight * line_item.quantity
|
203
|
+
xml.Rohmasse index.zero? ? @total_weight : 0
|
204
|
+
xml.Gefahrgutnummer_UNDG
|
205
|
+
xml.Warennummer_KN8 line_item.product.hs_code
|
206
|
+
xml.Verfahren do
|
207
|
+
xml.angemeldetes "10"
|
208
|
+
xml.vorangegangenes "00"
|
209
|
+
xml.weiteres "F61"
|
210
|
+
xml.Ausfuhrerstattung
|
211
|
+
end
|
212
|
+
xml.Aussenhandelsstatistik do
|
213
|
+
xml.Menge line_item.quantity
|
214
|
+
xml.Wert (line_item.quantity *
|
215
|
+
line_item.price * 1.05).round(2)
|
216
|
+
end
|
217
|
+
xml.Vorpapier do
|
218
|
+
xml.Typ
|
219
|
+
xml.Referenz
|
220
|
+
xml.Zusatz
|
221
|
+
end
|
222
|
+
xml.Packstuecke do
|
223
|
+
xml.Anzahl index.zero? ? @no_of_packages : 0
|
224
|
+
xml.Nummer index + 1
|
225
|
+
xml.Verpackungsart @package_type
|
226
|
+
xml.Zeichen_Nummern customs_detail.sales_order.customer_order.order_number
|
227
|
+
end
|
228
|
+
xml.Unterlage do
|
229
|
+
xml.Qualifizierung
|
230
|
+
xml.Typ
|
231
|
+
xml.Referenz
|
232
|
+
xml.Zusatz
|
233
|
+
xml.Detail
|
234
|
+
xml.Datum_der_Ausstellung
|
235
|
+
xml.Datum_des_Gueltigkeitsendes
|
236
|
+
xml.Wert
|
237
|
+
xml.Masseinheit
|
238
|
+
xml.Aschreibungsmenge
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def generate_xml
|
245
|
+
Nokogiri::XML::Builder.new(encoding: "Windows-1252") do |xml|
|
246
|
+
xml.BEO_ATLAS("xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
|
247
|
+
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema") do
|
248
|
+
xml.Nachricht do
|
249
|
+
xml.Zollnummer_Sender "4789741"
|
250
|
+
xml.Nachrichten_Typ "DEXPDF"
|
251
|
+
xml.BEO_Atlas_KundenID
|
252
|
+
xml.Anwendung
|
253
|
+
xml.Name "Maveko_korrigiert"
|
254
|
+
end
|
255
|
+
xml.Kopf do
|
256
|
+
xml.EORI_Number "DE47897410000"
|
257
|
+
xml.Art_der_Ausfuhranmeldung @customs_details[0].export_declaration_type
|
258
|
+
xml.Ausfuhrland "DE"
|
259
|
+
xml.Bestimmungsland @customs_details[0].destination_country
|
260
|
+
xml.Container @customs_details[0].containerized == true ? 1 : 0
|
261
|
+
xml.send("Beteiligten-Konstellation", @customs_details[0].participant_constellation.split(" ")[0])
|
262
|
+
xml.send("Gesamt-Rohmasse", @total_weight)
|
263
|
+
xml.Kennnummer_der_Sendung @customs_details.map(&:sales_order).map(&:customer_order).map(&:consignee).join(" ")
|
264
|
+
xml.Bezugsnummer @customs_details.map(&:sales_order).map(&:customer_order).map(&:order_number).join(" ")
|
265
|
+
xml.inlandischerVerkehrszweig @customs_details[0].mode_of_transport
|
266
|
+
xml.verkehrszweigAnDerGrenze @customs_details[0].mode_of_transport_at_border
|
267
|
+
xml.Befoerderungsmittel_an_der_Grenze do
|
268
|
+
xml.Art @customs_details[0].mode_of_transport_type
|
269
|
+
xml.Kennzeichen "UNBEKANNT"
|
270
|
+
end
|
271
|
+
xml.Befoerderungsmittel_am_Abgang do
|
272
|
+
xml.sequenznummer "1"
|
273
|
+
xml.Art @customs_details[0].type_of_identification.split(" ")[0]
|
274
|
+
xml.Kennzeichen @customs_details[0].additional_identifier.split(" ")[0]
|
275
|
+
xml.Staatszugehoerigkeit @customs_details[0].nationality.split(" ")[0]
|
276
|
+
end
|
277
|
+
xml.Ausfuhrzollstelle do
|
278
|
+
xml.Dienststellennummer @customs_details[0].export_customs_office.split(" ")[0]
|
279
|
+
end
|
280
|
+
xml.Vorgesehene_Ausgangszollstelle do
|
281
|
+
xml.Dienststellennummer @customs_details[0].customs_office_of_exit.split(" ")[0]
|
282
|
+
end
|
283
|
+
xml.Geschaeftsvorgang do
|
284
|
+
xml.Art "11"
|
285
|
+
xml.Rechnungspreis @customs_details[0].sales_order.total_price.round(2)
|
286
|
+
xml.Waehrung "EUR"
|
287
|
+
end
|
288
|
+
xml.Befoerderungsroute do
|
289
|
+
@transportation_routes.each do |tr|
|
290
|
+
xml.Land tr
|
291
|
+
end
|
292
|
+
end
|
293
|
+
xml.Empfaenger do
|
294
|
+
xml.Identifikationsart
|
295
|
+
xml.TIN
|
296
|
+
xml.Niederlassungsnummer
|
297
|
+
xml.Name @customs_details[0].sales_order.customer_order.client.name
|
298
|
+
xml.Strasse @address[0]
|
299
|
+
xml.PLZ @address[-1]
|
300
|
+
xml.Ort "#{@address[1].split(' ')[-3]} #{@address[1].split(' ')[-2]}"
|
301
|
+
xml.Land @address[1].split(" ")[-1]
|
302
|
+
end
|
303
|
+
xml.Lieferbedingung do
|
304
|
+
xml.send("Incoterm-Code", @customs_details[0].delivery_term_code[0, 3])
|
305
|
+
xml.Ort "Hamburg"
|
306
|
+
xml.Land "DE"
|
307
|
+
end
|
308
|
+
end
|
309
|
+
xml.Waren do
|
310
|
+
xml_position_data(xml)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end.to_xml
|
314
|
+
end
|
315
|
+
|
140
316
|
private
|
141
317
|
|
142
318
|
def bearer_token
|
data/config/routes.rb
CHANGED
@@ -157,10 +157,8 @@ Comee::Core::Engine.routes.draw do
|
|
157
157
|
resources :customs_details do
|
158
158
|
collection do
|
159
159
|
post "filter"
|
160
|
-
end
|
161
|
-
|
162
|
-
member do
|
163
160
|
post "send", action: :send_customs_details
|
161
|
+
post "generate_beo_xml", action: :generate_beo_xml
|
164
162
|
end
|
165
163
|
end
|
166
164
|
|
@@ -5,18 +5,18 @@ class CreateComeeCoreCustomsDetails < ActiveRecord::Migration[7.1]
|
|
5
5
|
null: false,
|
6
6
|
index: {name: "soi_on_cccd_indx"},
|
7
7
|
foreign_key: {to_table: :comee_core_sales_orders}
|
8
|
-
t.string :registration_type
|
9
|
-
t.string :export_declaration_type
|
10
|
-
t.string :participant_constellation
|
11
|
-
t.string :mode_of_transport_type
|
12
|
-
t.string :destination_country
|
13
|
-
t.boolean :containerized,
|
14
|
-
t.string :additional_identifier
|
15
|
-
t.string :packaging_type
|
16
|
-
t.string :export_customs_office
|
17
|
-
t.string :customs_office_of_exit
|
18
|
-
t.string :mode_of_transport
|
19
|
-
t.string :delivery_term_code
|
8
|
+
t.string :registration_type
|
9
|
+
t.string :export_declaration_type
|
10
|
+
t.string :participant_constellation
|
11
|
+
t.string :mode_of_transport_type
|
12
|
+
t.string :destination_country
|
13
|
+
t.boolean :containerized, default: false
|
14
|
+
t.string :additional_identifier
|
15
|
+
t.string :packaging_type
|
16
|
+
t.string :export_customs_office
|
17
|
+
t.string :customs_office_of_exit
|
18
|
+
t.string :mode_of_transport
|
19
|
+
t.string :delivery_term_code
|
20
20
|
t.string :mrn
|
21
21
|
t.string :office_number
|
22
22
|
t.float :quantity
|
data/lib/comee/core/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.3
|
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-06-
|
11
|
+
date: 2024-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|