Commit 514a458466256c83a885c17c9fb6db04b87034bf
Committed by
GitHub
Merge pull request #3 from wildland/sales-order
Sales order
Showing
10 changed files
with
386 additions
and
3 deletions
Show diff stats
lib/syspro.rb
... | ... | @@ -25,10 +25,14 @@ require 'syspro/api_operations/query' |
25 | 25 | require 'syspro/business_objects/combrw' |
26 | 26 | require 'syspro/business_objects/comfch' |
27 | 27 | require 'syspro/business_objects/comfnd' |
28 | +require 'syspro/business_objects/sorqry' | |
29 | + | |
30 | +require 'syspro/business_objects/models/sor_detail' | |
28 | 31 | |
29 | 32 | require 'syspro/business_objects/parsers/combrw_parser' |
30 | 33 | require 'syspro/business_objects/parsers/comfch_parser' |
31 | 34 | require 'syspro/business_objects/parsers/comfnd_parser' |
35 | +require 'syspro/business_objects/parsers/sorqry_parser' | |
32 | 36 | |
33 | 37 | # Main Module |
34 | 38 | module Syspro | ... | ... |
lib/syspro/api_operations/query.rb
1 | +module Syspro | |
2 | + module BusinessObjects | |
3 | + module Models | |
4 | + class Sor | |
5 | + attr_accessor :customer, :name, :customer_po_number, :cust_stock_code, :stock_code, :description, | |
6 | + :supply_wh, :release_manager, :release_status, :purchase_order, :shipment_days, | |
7 | + :num_day_drops, :num_week_drops, :day_in_week, :num_month_drops, :day_in_month, | |
8 | + :price_contract_num, :stock_uom, :contract_qty, :total_delivered, :total_received, | |
9 | + :opening_cume, :data_last_inv, :base_date, :expiry_date, :last_invoice, :buying_group, | |
10 | + :last_dispatch_note, :confirmed_release_details, :unconfirmed_release_details, :release_details, | |
11 | + :delivery_history_details, :release_history_details, :sor_detail, :contract_item | |
12 | + end | |
13 | + end | |
14 | + end | |
15 | +end | |
16 | + | ... | ... |
1 | +module Syspro | |
2 | + module BusinessObjects | |
3 | + module Models | |
4 | + class SorDetail | |
5 | + attr_accessor :sales_order, :document_type, :document_type_desc, :inter_branch_transfer, :inter_wh_sale, | |
6 | + :source_warehouse, :target_warehouse, :gtr_reference, :customer, :customer_name, :tax_status_code, | |
7 | + :tax_status, :gst_tax_status_code, :gst_tax_status, :eu_flag, :eu_flag_desc, :sold_to_name, | |
8 | + :sold_addr_1, :sold_addr_2, :sold_addr_3, :sold_addr_3_locality, :sold_addr_4, :sold_addr_5, | |
9 | + :sold_postal_code, :sold_gps_lat, :sold_gps_long, :salesperson, :scheduled_ord_flag, :disc_pct_1, | |
10 | + :disc_pct_2, :disc_pct_3, :salsls_name, :order_status, :order_status_desc, :customer_po_number, | |
11 | + :order_date, :git_reference, :req_ship_date, :shipping_instrs, :shipping_instrs_cod, :special_instrs, | |
12 | + :inv_terms_override, :delivery_note, :last_del_note, :time_del_prted_hh, :time_del_prted_mm, :last_invoice, | |
13 | + :date_last_inv_prt, :time_inv_prt_hh, :time_inv_prt_mm, :tblart_description, :branch, :salbrn_description, | |
14 | + :ent_invoice, :order_type, :area, :salare_description, :tax_exempt_number, :gst_exempt_number, :currency, | |
15 | + :tblcur_description, :ship_address_1, :ship_address_2, :ship_address_3, :ship_address_3_locality, | |
16 | + :ship_address_4, :ship_address_5, :ship_postal_code, :ship_gps_lat, :ship_gps_long, :ship_complete, | |
17 | + :email, :fix_exchange_rate, :exchange_rate, :edited_exchange_rate, :mul_div, :consolidated_order, | |
18 | + :gst_deduction, :credited_inv_date, :job, :serialized_flag, :counter_sales_flag, :nationality, | |
19 | + :delivery_terms, :shipping_location, :transaction_nature, :transport_mode, :process_flag, | |
20 | + :jobs_exist_flag, :alternate_key, :hierarchy_flag, :deposit_flag, :edi_source, :mult_ship_code, | |
21 | + :company_tax_no, :last_operator, :operator, :state, :county_zip, :extended_tax_code, :web_created, | |
22 | + :quote, :dispatches_made, :live_disp_exist, :num_dispatches, :include_in_mrp, :header_text, | |
23 | + :header_notes, :commissions | |
24 | + end | |
25 | + end | |
26 | + end | |
27 | +end | |
28 | + | ... | ... |
lib/syspro/business_objects/parsers/sorqry_parser.rb
0 → 100644
1 | +# frozen_string_literal: true | |
2 | + | |
3 | +module Syspro | |
4 | + module BusinessObjects | |
5 | + module Parsers | |
6 | + class SorQryParser | |
7 | + attr_reader :doc | |
8 | + | |
9 | + def initialize(doc) | |
10 | + @doc = doc | |
11 | + end | |
12 | + | |
13 | + def parse | |
14 | + sor = Syspro::BusinessObjects::Models::SorDetail.new() | |
15 | + sor.sales_order = doc.first_element_child.xpath("SalesOrder").text | |
16 | + sor.document_type = doc.first_element_child.xpath("DocumentType").text | |
17 | + sor.document_type_desc = doc.first_element_child.xpath("DocumentTypeDesc").text | |
18 | + sor.inter_branch_transfer = doc.first_element_child.xpath("InterBranchTransfer").text | |
19 | + sor.inter_wh_sale = doc.first_element_child.xpath("InterWhSale").text | |
20 | + sor.source_warehouse = doc.first_element_child.xpath("SourceWarehouse").text | |
21 | + sor.target_warehouse = doc.first_element_child.xpath("TargetWarehouse").text | |
22 | + sor.gtr_reference = doc.first_element_child.xpath("GtrReference").text | |
23 | + sor.customer = doc.first_element_child.xpath("Customer").text | |
24 | + sor.customer_name = doc.first_element_child.xpath("CustomerName").text | |
25 | + sor.tax_status_code = doc.first_element_child.xpath("TaxStatusCode").text | |
26 | + sor.tax_status = doc.first_element_child.xpath("TaxStatus").text | |
27 | + sor.gst_tax_status_code = doc.first_element_child.xpath("GstTaxStatusCode").text | |
28 | + sor.gst_tax_status = doc.first_element_child.xpath("GstTaxStatus").text | |
29 | + sor.eu_flag = doc.first_element_child.xpath("EuFlag").text | |
30 | + sor.eu_flag_desc = doc.first_element_child.xpath("EuFlagDesc").text | |
31 | + sor.sold_to_name = doc.first_element_child.xpath("SoldToName").text | |
32 | + sor.sold_addr_1 = doc.first_element_child.xpath("SoldAddr1").text | |
33 | + sor.sold_addr_2 = doc.first_element_child.xpath("SoldAddr2").text | |
34 | + sor.sold_addr_3 = doc.first_element_child.xpath("SoldAddr3").text | |
35 | + sor.sold_addr_3_locality = doc.first_element_child.xpath("SoldAddr3Locality").text | |
36 | + sor.sold_addr_4 = doc.first_element_child.xpath("SoldAddr4").text | |
37 | + sor.sold_addr_5 = doc.first_element_child.xpath("SoldAddr5").text | |
38 | + sor.sold_postal_code = doc.first_element_child.xpath("SoldPostalCode").text | |
39 | + sor.sold_gps_lat = doc.first_element_child.xpath("SoldGpsLat").text | |
40 | + sor.sold_gps_long = doc.first_element_child.xpath("SoldGpsLong").text | |
41 | + sor.salesperson = doc.first_element_child.xpath("Salesperson").text | |
42 | + sor.scheduled_ord_flag = doc.first_element_child.xpath("ScheduledOrdFlag").text | |
43 | + sor.disc_pct_1 = doc.first_element_child.xpath("DiscPct1").text | |
44 | + sor.disc_pct_2 = doc.first_element_child.xpath("DiscPct2").text | |
45 | + sor.disc_pct_3 = doc.first_element_child.xpath("DiscPct3").text | |
46 | + sor.salsls_name = doc.first_element_child.at_xpath('//SALSLS:Name').children.text | |
47 | + sor.order_status = doc.first_element_child.xpath("OrderStatus").text | |
48 | + sor.order_status_desc = doc.first_element_child.xpath("OrderStatusDesc").text | |
49 | + sor.customer_po_number = doc.first_element_child.xpath("CustomerPoNumber").text | |
50 | + sor.order_date = doc.first_element_child.xpath("OrderDate").text | |
51 | + sor.git_reference = doc.first_element_child.xpath("GITReference").text | |
52 | + sor.req_ship_date = doc.first_element_child.xpath("ReqShipDate").text | |
53 | + sor.shipping_instrs = doc.first_element_child.xpath("ShippingInstrs").text | |
54 | + sor.shipping_instrs_cod = doc.first_element_child.xpath("ShippingInstrsCod").text | |
55 | + sor.special_instrs = doc.first_element_child.xpath("SpecialInstrs").text | |
56 | + sor.inv_terms_override = doc.first_element_child.xpath("InvTermsOverride").text | |
57 | + sor.delivery_note = doc.first_element_child.xpath("DeliveryNote").text | |
58 | + sor.last_del_note = doc.first_element_child.xpath("LastDelNote").text | |
59 | + sor.time_del_prted_hh = doc.first_element_child.xpath("TimeDelPrtedHh").text | |
60 | + sor.time_del_prted_mm = doc.first_element_child.xpath("TimeDelPrtedMm").text | |
61 | + sor.last_invoice = doc.first_element_child.xpath("LastInvoice").text | |
62 | + sor.date_last_inv_prt = doc.first_element_child.xpath("DateLastInvPrt").text | |
63 | + sor.time_inv_prt_hh = doc.first_element_child.xpath("TimeInvPrtHh").text | |
64 | + sor.time_inv_prt_mm = doc.first_element_child.xpath("TimeInvPrtMm").text | |
65 | + sor.tblart_description = doc.first_element_child.xpath("//TBLART:Description").children.text | |
66 | + sor.branch = doc.first_element_child.xpath("Branch").text | |
67 | + sor.salbrn_description = doc.first_element_child.xpath("//SALBRN:Description").children.text | |
68 | + sor.ent_invoice = doc.first_element_child.xpath("EntInvoice").text | |
69 | + sor.order_type = doc.first_element_child.xpath("OrderType").text | |
70 | + sor.area = doc.first_element_child.xpath("Area").text | |
71 | + sor.salare_description = doc.first_element_child.xpath("//SALARE:Description").children.text | |
72 | + sor.tax_exempt_number = doc.first_element_child.xpath("TaxExemptNumber").text | |
73 | + sor.gst_exempt_number = doc.first_element_child.xpath("GstExemptNumber").text | |
74 | + sor.currency = doc.first_element_child.xpath("Currency").text | |
75 | + sor.tblcur_description = doc.first_element_child.xpath("//TBLCUR:Description").children.text | |
76 | + sor.ship_address_1 = doc.first_element_child.xpath("ShipAddress1").text | |
77 | + sor.ship_address_2 = doc.first_element_child.xpath("ShipAddress2").text | |
78 | + sor.ship_address_3 = doc.first_element_child.xpath("ShipAddress3").text | |
79 | + sor.ship_address_3_locality = doc.first_element_child.xpath("ShipAddress3Locality").text | |
80 | + sor.ship_address_4 = doc.first_element_child.xpath("ShipAddress4").text | |
81 | + sor.ship_address_5 = doc.first_element_child.xpath("ShipAddress5").text | |
82 | + sor.ship_postal_code = doc.first_element_child.xpath("ShipPostalCode").text | |
83 | + sor.ship_gps_lat = doc.first_element_child.xpath("ShipGpsLat").text | |
84 | + sor.ship_gps_long = doc.first_element_child.xpath("ShipGpsLong").text | |
85 | + sor.ship_complete = doc.first_element_child.xpath("ShipComplete").text | |
86 | + sor.email = doc.first_element_child.xpath("Email").text | |
87 | + sor.fix_exchange_rate = doc.first_element_child.xpath("FixExchangeRate").text | |
88 | + sor.exchange_rate = doc.first_element_child.xpath("ExchangeRate").text | |
89 | + sor.edited_exchange_rate = doc.first_element_child.xpath("EditedExchangeRate").text | |
90 | + sor.mul_div = doc.first_element_child.xpath("MulDiv").text | |
91 | + sor.consolidated_order = doc.first_element_child.xpath("ConsolidatedOrder").text | |
92 | + sor.gst_deduction = doc.first_element_child.xpath("GstDeduction").text | |
93 | + sor.credited_inv_date = doc.first_element_child.xpath("CreditedInvDate").text | |
94 | + sor.job = doc.first_element_child.xpath("Job").text | |
95 | + sor.serialized_flag = doc.first_element_child.xpath("SerializedFlag").text | |
96 | + sor.counter_sales_flag = doc.first_element_child.xpath("CounterSalesFlag").text | |
97 | + sor.nationality = doc.first_element_child.xpath("Nationality").text | |
98 | + sor.delivery_terms = doc.first_element_child.xpath("DeliveryTerms").text | |
99 | + sor.shipping_location = doc.first_element_child.xpath("ShippingLocation").text | |
100 | + sor.transaction_nature = doc.first_element_child.xpath("TransactionNature").text | |
101 | + sor.transport_mode = doc.first_element_child.xpath("TransportMode").text | |
102 | + sor.process_flag = doc.first_element_child.xpath("ProcessFlag").text | |
103 | + sor.jobs_exist_flag = doc.first_element_child.xpath("JobsExistFlag").text | |
104 | + sor.alternate_key = doc.first_element_child.xpath("AlternateKey").text | |
105 | + sor.hierarchy_flag = doc.first_element_child.xpath("HierarchyFlag").text | |
106 | + sor.deposit_flag = doc.first_element_child.xpath("DepositFlag").text | |
107 | + sor.edi_source = doc.first_element_child.xpath("EdiSource").text | |
108 | + sor.mult_ship_code = doc.first_element_child.xpath("MultShipCode").text | |
109 | + sor.company_tax_no = doc.first_element_child.xpath("CompanyTaxNo").text | |
110 | + sor.last_operator = doc.first_element_child.xpath("LastOperator").text | |
111 | + sor.operator = doc.first_element_child.xpath("Operator").text | |
112 | + sor.state = doc.first_element_child.xpath("State").text | |
113 | + sor.county_zip = doc.first_element_child.xpath("CountyZip").text | |
114 | + sor.extended_tax_code = doc.first_element_child.xpath("ExtendedTaxCode").text | |
115 | + sor.web_created = doc.first_element_child.xpath("WebCreated").text | |
116 | + sor.quote = doc.first_element_child.xpath("Quote").text | |
117 | + sor.dispatches_made = doc.first_element_child.xpath("DispatchesMade").text | |
118 | + sor.live_disp_exist = doc.first_element_child.xpath("LiveDispExist").text | |
119 | + sor.num_dispatches = doc.first_element_child.xpath("NumDispatches").text | |
120 | + sor.include_in_mrp = doc.first_element_child.xpath("IncludeInMrp").text | |
121 | + sor.header_text = doc.first_element_child.xpath("HeaderText").text | |
122 | + sor.header_notes = doc.first_element_child.xpath("HeaderNotes").text | |
123 | + | |
124 | + commissions = doc.first_element_child.xpath("Commissions") | |
125 | + commissions_obj = commissions.children.map do |el| | |
126 | + next if el.name == "text" | |
127 | + { | |
128 | + name: el.name, | |
129 | + text: el.text | |
130 | + } | |
131 | + end.compact | |
132 | + sor.commissions = commissions_obj | |
133 | + | |
134 | + sor | |
135 | + end | |
136 | + end | |
137 | + end | |
138 | + end | |
139 | +end | |
140 | + | ... | ... |
1 | +<?xml version="1.0" encoding="Windows-1252"?> | |
2 | +<Query xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="SORQRY.XSD"> | |
3 | + <Key> | |
4 | + <SalesOrder><%= @sales_order %></SalesOrder> | |
5 | + <% unless @invoice.nil? %> | |
6 | + <Invoice><%= @invoice %></Invoice> | |
7 | + <% end %> | |
8 | + </Key> | |
9 | + <Option> | |
10 | + <IncludeStockedLines><%= @stocked_lines ? "N" : "Y" %></IncludeStockedLines> | |
11 | + <IncludeNonStockedLines><%= @non_stocked_lines ? "N" : "Y" %></IncludeNonStockedLines> | |
12 | + <IncludeFreightLines><%= @freight_lines ? "N" : "Y" %></IncludeFreightLines> | |
13 | + <IncludeMiscLines><%= @misc_lines ? "N" : "Y" %></IncludeMiscLines> | |
14 | + <IncludeCommentLines><%= @comment_lines ? "N" : "Y" %></IncludeCommentLines> | |
15 | + <IncludeCompletedLines><%= @completed_lines ? "N" : "Y" %></IncludeCompletedLines> | |
16 | + <IncludeSerials><%= @serials ? "N" : "Y" %></IncludeSerials> | |
17 | + <IncludeLots><%= @lots ? "N" : "Y" %></IncludeLots> | |
18 | + <IncludeBins><%= @bins ? "N" : "Y" %></IncludeBins> | |
19 | + <IncludeAttachedItems><%= @attached_items ? "N" : "Y" %></IncludeAttachedItems> | |
20 | + <IncludeCustomForms><%= @custom_forms ? "N" : "Y" %></IncludeCustomForms> | |
21 | + <IncludeDetailLineCustomForms><%= @detail_line_custom_forms ? "N" : "Y" %></IncludeDetailLineCustomForms> | |
22 | + <IncludeValues><%= @values ? "N" : "Y" %></IncludeValues> | |
23 | + <ReturnLineShipDate><%= @line_ship_date ? "N" : "Y" %></ReturnLineShipDate> | |
24 | + <XslStylesheet/> | |
25 | + </Option> | |
26 | +</Query> | |
27 | + | ... | ... |
1 | +# frozen_string_literal: true | |
2 | + | |
3 | +require 'syspro/business_objects/parsers/sorqry_parser' | |
4 | +require 'erb' | |
5 | + | |
6 | +module Syspro | |
7 | + module BusinessObjects | |
8 | + class SorQry < ApiResource | |
9 | + include Syspro::ApiOperations::Query | |
10 | + include Syspro::BusinessObjects::Parsers | |
11 | + | |
12 | + attr_accessor :sales_order, :invoice, :stocked_lines, :non_stocked_lines, :freight_lines, | |
13 | + :misc_lines, :comment_lines, :completed_lines, :serials, :lots, :bins, | |
14 | + :attached_items, :custom_forms, :detail_line_custom_forms, :values, :line_ship_date | |
15 | + | |
16 | + def call(user_id) | |
17 | + xml_in = template.result(binding) | |
18 | + business_object = 'SORQRY' | |
19 | + params = { 'UserId' => user_id, 'BusinessObject' => business_object, 'XmlIn' => xml_in } | |
20 | + resp = SorQry.query(params) | |
21 | + | |
22 | + parse_response(resp) | |
23 | + end | |
24 | + | |
25 | + def template | |
26 | + ERB.new File.read(File.expand_path('schemas/sorqry.xml.erb', File.dirname(__FILE__))), nil, '%' | |
27 | + end | |
28 | + | |
29 | + def parse_response(resp) | |
30 | + handle_errors(resp) | |
31 | + parser = SorQryParser.new(resp[0].data) | |
32 | + parser.parse | |
33 | + end | |
34 | + | |
35 | + def handle_errors(resp) | |
36 | + body = resp[0].http_body | |
37 | + raise SysproError, body if body =~ /^(ERROR)/ | |
38 | + end | |
39 | + end | |
40 | + end | |
41 | +end | |
42 | + | ... | ... |
lib/syspro/get_logon_profile.rb
... | ... | @@ -18,7 +18,7 @@ module Syspro |
18 | 18 | OpenStruct.new( |
19 | 19 | company_name: doc.xpath('//CompanyName').text, |
20 | 20 | operator_code: doc.xpath('//OperatorCode').text, |
21 | - operator_code: doc.xpath('//OperatorGroup').text, | |
21 | + operator_group: doc.xpath('//OperatorGroup').text, | |
22 | 22 | operator_email_address: doc.xpath('//OperatorEmailAddress').text, |
23 | 23 | operator_location: doc.xpath('//OperatorLocation').text, |
24 | 24 | operator_language_code: doc.xpath('//OperatorLanguageCode').text, | ... | ... |
1 | +--- | |
2 | +http_interactions: | |
3 | +- request: | |
4 | + method: get | |
5 | + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/logon?CompanyId=L&CompanyPassword=&Operator=wland&OperatorPassword=piperita2016 | |
6 | + body: | |
7 | + encoding: US-ASCII | |
8 | + string: '' | |
9 | + headers: | |
10 | + User-Agent: | |
11 | + - Syspro/7 RubyBindings/1.0.0.alpha.1 | |
12 | + Content-Type: | |
13 | + - application/x-www-form-urlencoded | |
14 | + Accept-Encoding: | |
15 | + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 | |
16 | + Accept: | |
17 | + - "*/*" | |
18 | + response: | |
19 | + status: | |
20 | + code: 200 | |
21 | + message: OK | |
22 | + headers: | |
23 | + Content-Length: | |
24 | + - '36' | |
25 | + Content-Type: | |
26 | + - application/octet-stream | |
27 | + Server: | |
28 | + - Microsoft-HTTPAPI/2.0 | |
29 | + Date: | |
30 | + - Thu, 26 Apr 2018 19:08:08 GMT | |
31 | + body: | |
32 | + encoding: UTF-8 | |
33 | + string: 'E3333B82C68A4F4893184E2DE8C42E4A00 ' | |
34 | + http_version: | |
35 | + recorded_at: Thu, 26 Apr 2018 19:08:09 GMT | |
36 | +- request: | |
37 | + method: get | |
38 | + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/Query/Query?BusinessObject=SORQRY&UserId=E3333B82C68A4F4893184E2DE8C42E4A00%20%20&XmlIn=%3C?xml%20version=%221.0%22%20encoding=%22Windows-1252%22?%3E%0A%3CQuery%20xmlns:xsd=%22http://www.w3.org/2001/XMLSchema-instance%22%20xsd:noNamespaceSchemaLocation=%22SORQRY.XSD%22%3E%0A%20%20%3CKey%3E%0A%20%20%20%20%3CSalesOrder%3E16R069%3C/SalesOrder%3E%0A%20%20%20%20%0A%20%20%3C/Key%3E%0A%20%20%3COption%3E%0A%20%20%20%20%3CIncludeStockedLines%3EN%3C/IncludeStockedLines%3E%0A%20%20%20%20%20%20%3CIncludeNonStockedLines%3EN%3C/IncludeNonStockedLines%3E%0A%20%20%20%20%20%20%3CIncludeFreightLines%3EN%3C/IncludeFreightLines%3E%0A%20%20%20%20%20%20%3CIncludeMiscLines%3EN%3C/IncludeMiscLines%3E%0A%20%20%20%20%20%20%3CIncludeCommentLines%3EN%3C/IncludeCommentLines%3E%0A%20%20%20%20%20%20%3CIncludeCompletedLines%3EN%3C/IncludeCompletedLines%3E%0A%20%20%20%20%20%20%3CIncludeSerials%3EN%3C/IncludeSerials%3E%0A%20%20%20%20%20%20%3CIncludeLots%3EN%3C/IncludeLots%3E%0A%20%20%20%20%20%20%3CIncludeBins%3EN%3C/IncludeBins%3E%0A%20%20%20%20%20%20%3CIncludeAttachedItems%3EN%3C/IncludeAttachedItems%3E%0A%20%20%20%20%20%20%3CIncludeCustomForms%3EN%3C/IncludeCustomForms%3E%0A%20%20%20%20%20%20%3CIncludeDetailLineCustomForms%3EN%3C/IncludeDetailLineCustomForms%3E%0A%20%20%20%20%20%20%3CIncludeValues%3EN%3C/IncludeValues%3E%0A%20%20%20%20%20%20%3CReturnLineShipDate%3EN%3C/ReturnLineShipDate%3E%0A%20%20%20%20%20%20%3CXslStylesheet/%3E%0A%20%20%3C/Option%3E%0A%3C/Query%3E%0A%0A | |
39 | + body: | |
40 | + encoding: US-ASCII | |
41 | + string: '' | |
42 | + headers: | |
43 | + User-Agent: | |
44 | + - Syspro/7 RubyBindings/1.0.0.alpha.1 | |
45 | + Content-Type: | |
46 | + - application/x-www-form-urlencoded | |
47 | + Accept-Encoding: | |
48 | + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 | |
49 | + Accept: | |
50 | + - "*/*" | |
51 | + response: | |
52 | + status: | |
53 | + code: 200 | |
54 | + message: OK | |
55 | + headers: | |
56 | + Content-Length: | |
57 | + - '3812' | |
58 | + Content-Type: | |
59 | + - application/octet-stream | |
60 | + Server: | |
61 | + - Microsoft-HTTPAPI/2.0 | |
62 | + Date: | |
63 | + - Thu, 26 Apr 2018 19:08:15 GMT | |
64 | + body: | |
65 | + encoding: UTF-8 | |
66 | + string: "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n<SorDetail Language='05' | |
67 | + Language2='EN' CssStyle='' DecFormat='1' DateFormat='01' Role='01' Version='7.0.047' | |
68 | + OperatorPrimaryRole=' ' xmlns:SALARE=\"SALARE\" xmlns:SALSLS=\"SALSLS\" | |
69 | + xmlns:TBLART=\"TBLART\" xmlns:SALBRN=\"SALBRN\" xmlns:TBLCUR=\"TBLCUR\" >\n<SalesOrder>16R069</SalesOrder>\n<DocumentType>O</DocumentType>\n<DocumentTypeDesc>Order</DocumentTypeDesc>\n<InterBranchTransfer/>\n<InterWhSale/>\n<SourceWarehouse/>\n<TargetWarehouse/>\n<GtrReference/>\n<Customer>SYM000</Customer>\n<CustomerName>SYMRISE | |
70 | + GLOBAL</CustomerName>\n<TaxStatusCode>E</TaxStatusCode>\n<TaxStatus>Exempt | |
71 | + from tax</TaxStatus>\n<GSTTaxStatusCode>E</GSTTaxStatusCode>\n<GSTTaxStatus>Exempt | |
72 | + from tax</GSTTaxStatus>\n<EUFlag>N</EUFlag>\n<EUFlagDesc>EU</EUFlagDesc>\n<SoldToName>SYMRISE | |
73 | + GLOBAL</SoldToName>\n<SoldAddr1>FR KREDITOREN</SoldAddr1>\n<SoldAddr2>POSTFACH | |
74 | + 1253</SoldAddr2>\n<SoldAddr3>D-37601 HOLZMINDEN</SoldAddr3>\n<SoldAddr3Locality/>\n<SoldAddr4>GERMANY</SoldAddr4>\n<SoldAddr5/>\n<SoldPostalCode/>\n<SoldGpsLat> | |
75 | + \ 0.000000</SoldGpsLat>\n<SoldGpsLong> 0.000000</SoldGpsLong>\n<Salesperson>DAL</Salesperson>\n<ScheduledOrdFlag/>\n<DiscPct1>0.00</DiscPct1>\n<DiscPct2>0.00</DiscPct2>\n<DiscPct3>0.00</DiscPct3>\n<Commissions>\n<Salesperson>DAL</Salesperson>\n<CommissionSales1>0.00</CommissionSales1>\n<Edited_CommissionSales1>0.00</Edited_CommissionSales1>\n<Salesperson2/>\n<CommissionSales2>0.00</CommissionSales2>\n<Edited_CommissionSales2>0.00</Edited_CommissionSales2>\n<Salesperson3/>\n<CommissionSales3>0.00</CommissionSales3>\n<Edited_CommissionSales3>0.00</Edited_CommissionSales3>\n<Salesperson4/>\n<CommissionSales4>0.00</CommissionSales4>\n<Edited_CommissionSales4>0.00</Edited_CommissionSales4>\n</Commissions>\n<SALSLS:Name>DAN | |
76 | + A LABBEE</SALSLS:Name>\n<OrderStatus>*</OrderStatus>\n<OrderStatusDesc>Cancelled | |
77 | + during entry</OrderStatusDesc>\n<CustomerPoNumber/>\n<OrderDate>2014-08-13</OrderDate>\n<GITReference/>\n<ReqShipDate>2017-05-31</ReqShipDate>\n<ShippingInstrs/>\n<ShippingInstrsCod/>\n<SpecialInstrs/>\n<InvTermsOverride>3</InvTermsOverride>\n<DeliveryNote/>\n<LastDelNote/>\n<TimeDelPrtedHh>00</TimeDelPrtedHh>\n<TimeDelPrtedMm>00</TimeDelPrtedMm>\n<LastInvoice/>\n<DateLastInvPrt/>\n<TimeInvPrtedHh>00</TimeInvPrtedHh>\n<TimeInvPrtedMm>00</TimeInvPrtedMm>\n<TBLART:Description>NET | |
78 | + 30 DAYS</TBLART:Description>\n<Branch>HQ</Branch>\n<SALBRN:Description>HARRAH, | |
79 | + WASHINGTON RECEIVABLES</SALBRN:Description>\n<EntInvoice/>\n<OrderType/>\n<Area>FG</Area>\n<SALARE:Description>FOREIGN</SALARE:Description>\n<TaxExemptNumber/>\n<GstExemptNum/>\n<Currency>$</Currency>\n<TBLCUR:Description>DOLLAR</TBLCUR:Description>\n<ShipAddress1>IMPORTANT</ShipAddress1>\n<ShipAddress2>THIS | |
80 | + IS A GLOBAL ACCOUNT</ShipAddress2>\n<ShipAddress3>USED TO HOLD</ShipAddress3>\n<ShipAddress3Locality/>\n<ShipAddress4>SCHEDULED | |
81 | + ORDERS ON CONTRACTS</ShipAddress4>\n<ShipAddress5>DO NOT SHIP FROM GLOBAL</ShipAddress5>\n<ShipPostalCode/>\n<ShipGpsLat> | |
82 | + \ 0.000000</ShipGpsLat>\n<ShipGpsLong> 0.000000</ShipGpsLong>\n<ShipComplete>N</ShipComplete>\n<Email/>\n<FixExchangeRate>N</FixExchangeRate>\n<ExchangeRate> | |
83 | + \ 1.000000</ExchangeRate>\n<Edited_ExchangeRate>1.000000</Edited_ExchangeRate>\n<MulDiv>M</MulDiv>\n<ConsolidatedOrder/>\n<GstDeduction>I</GstDeduction>\n<CreditedInvDate/>\n<Job/>\n<SerialisedFlag/>\n<CounterSalesFlag/>\n<Nationality/>\n<DeliveryTerms/>\n<ShippingLocation/>\n<TransactionNature>000</TransactionNature>\n<TransportMode>00</TransportMode>\n<ProcessFlag>0</ProcessFlag>\n<JobsExistFlag/>\n<AlternateKey/>\n<HierarchyFlag/>\n<DepositFlag/>\n<EdiSource/>\n<MultShipCode/>\n<CompanyTaxNo/>\n<LastOperator>MATTB</LastOperator>\n<Operator/>\n<State/>\n<CountyZip/>\n<ExtendedTaxCode/>\n<WebCreated/>\n<Quote/>\n<DispatchesMade/>\n<LiveDispExist/>\n<NumDispatches>0</NumDispatches>\n<IncludeInMrp>Y</IncludeInMrp>\n<HeaderText>\n</HeaderText>\n<HeaderNotes>\n</HeaderNotes>\n</SorDetail>\n " | |
84 | + http_version: | |
85 | + recorded_at: Thu, 26 Apr 2018 19:08:15 GMT | |
86 | +recorded_with: VCR 4.0.0 | ... | ... |
1 | +# frozen_string_literal: true | |
2 | + | |
3 | +require 'test_helper' | |
4 | + | |
5 | +class SorTest < Minitest::Test | |
6 | + extend Minitest::Spec::DSL | |
7 | + before { VCR.insert_cassette name } | |
8 | + after { VCR.eject_cassette } | |
9 | + | |
10 | + let(:username) { 'wland' } | |
11 | + let(:password) { 'piperita2016' } | |
12 | + let(:company) { 'L' } | |
13 | + let(:company_password) { '' } | |
14 | + let(:user_id) do | |
15 | + Syspro::Logon.logon(username, password, company, company_password) | |
16 | + end | |
17 | + | |
18 | + def test_sor_query | |
19 | + sorqbs = Syspro::BusinessObjects::SorQry.new | |
20 | + | |
21 | + sorqbs.sales_order = '16R069' | |
22 | + sorqbs.invoice = nil | |
23 | + sorqbs.stocked_lines = true | |
24 | + sorqbs.non_stocked_lines = true | |
25 | + sorqbs.freight_lines = true | |
26 | + sorqbs.misc_lines = true | |
27 | + sorqbs.comment_lines = true | |
28 | + sorqbs.completed_lines = true | |
29 | + sorqbs.serials = true | |
30 | + sorqbs.lots = true | |
31 | + sorqbs.bins = true | |
32 | + sorqbs.attached_items = true | |
33 | + sorqbs.custom_forms = true | |
34 | + sorqbs.detail_line_custom_forms = true | |
35 | + sorqbs.values = true | |
36 | + sorqbs.line_ship_date = true | |
37 | + | |
38 | + sor_result = sorqbs.call(user_id.guid) | |
39 | + assert_kind_of Syspro::BusinessObjects::Models::SorDetail, sor_result | |
40 | + end | |
41 | +end | |
42 | + | ... | ... |