Commit fb4108062a78cde13572d3d1c7d4b79d9da0814f

Authored by chadzink
Committed by GitHub
1 parent d9a9cb5d

Add INVQRY business object (#13)

* WIP

* Added InvQry

Partial complete, not all data is parsed out of result XML
Current project does not need the result yet
lib/syspro.rb
... ... @@ -34,11 +34,12 @@ require 'syspro/business_objects/portor'
34 34 require 'syspro/business_objects/portoi'
35 35 require 'syspro/business_objects/porqry'
36 36 require 'syspro/business_objects/comsfm'
  37 +require 'syspro/business_objects/invqry'
37 38  
38 39 require 'syspro/business_objects/models/sor'
39 40 require 'syspro/business_objects/models/sor_detail'
40 41 require 'syspro/business_objects/models/por_detail'
41   -
  42 +require 'syspro/business_objects/models/inv_qry_options'
42 43 require 'syspro/business_objects/models/purchase_order'
43 44 require 'syspro/business_objects/models/purchase_orders/header'
44 45 require 'syspro/business_objects/models/purchase_orders/order_details'
... ... @@ -46,8 +47,8 @@ require 'syspro/business_objects/models/purchase_orders/stock_line'
46 47 require 'syspro/business_objects/models/purchase_orders/freight_line'
47 48 require 'syspro/business_objects/models/purchase_orders/misc_charge_line'
48 49 require 'syspro/business_objects/models/purchase_orders/comment_line'
49   -
50 50 require 'syspro/business_objects/models/comsfm_item'
  51 +require 'syspro/business_objects/models/inv'
51 52  
52 53 require 'syspro/business_objects/parsers/combrw_parser'
53 54 require 'syspro/business_objects/parsers/comfch_parser'
... ... @@ -56,6 +57,7 @@ require 'syspro/business_objects/parsers/sorqry_parser'
56 57 require 'syspro/business_objects/parsers/portor_parser'
57 58 require 'syspro/business_objects/parsers/portoi_parser'
58 59 require 'syspro/business_objects/parsers/comsfm_parser'
  60 +require 'syspro/business_objects/parsers/invqry_parser'
59 61  
60 62 # Main Module
61 63 module Syspro
... ...
lib/syspro/business_objects/invqry.rb 0 โ†’ 100644
  1 +# frozen_string_literal: true
  2 +
  3 +require 'syspro/business_objects/parsers/invqry_parser'
  4 +require 'erb'
  5 +
  6 +module Syspro
  7 + module BusinessObjects
  8 + class InvQry < ApiResource
  9 + include Syspro::ApiOperations::Query
  10 + include Syspro::BusinessObjects::Parsers
  11 +
  12 + attr_accessor :key_stock_code,
  13 + :filter_warehouse_list, # seperated by commas
  14 + :option
  15 +
  16 + def call(user_id)
  17 + xml_in = template.result(binding)
  18 + business_object = 'INVQRY'
  19 + params = { 'UserId' => user_id, 'BusinessObject' => business_object, 'XmlIn' => xml_in }
  20 + resp = InvQry.query(params)
  21 +
  22 + parse_response(resp)
  23 + end
  24 +
  25 + def template
  26 + ERB.new File.read(File.expand_path('schemas/invqry.xml.erb', File.dirname(__FILE__))), nil, '%'
  27 + end
  28 +
  29 + def parse_response(resp)
  30 + handle_errors(resp)
  31 + parser = InvQryParser.new(resp[0].data)
  32 + parser.parse
  33 + end
  34 +
  35 + def render_xml(inner_text, dflt_value = "")
  36 + inner_text ? inner_text.to_s : dflt_value
  37 + end
  38 + end
  39 + end
  40 +end
... ...
lib/syspro/business_objects/models/inv.rb 0 โ†’ 100644
  1 +module Syspro
  2 + module BusinessObjects
  3 + module Models
  4 + class Inv
  5 + attr_accessor :warehouse_totals,
  6 + :warehouse_items,
  7 + :stock_item,
  8 + :system_information
  9 +
  10 + def initialize
  11 + @warehouse_totals = WarehouseTotals.new
  12 + @warehouse_items = []
  13 + @stock_item = StockItem.new
  14 + @system_information = SystemInformation.new
  15 + end
  16 +
  17 + def addWarehouseItem(new_hash)
  18 + w = WarehouseItem.new
  19 +
  20 + # copy hash items that match into new warehouse item
  21 + new_hash.keys.each do |k|
  22 + w.send("#{k.to_s}=", new_hash[k]) if w.methods.include? k
  23 + end
  24 +
  25 + @warehouse_items.push(w)
  26 + end
  27 + end
  28 +
  29 + class WarehouseTotals
  30 + attr_accessor :qty_on_hand,
  31 + :available_qty
  32 +
  33 + # Not all xml parsed, see https://infozone.syspro.com/Support/businessobjectslibrary/INVQRYOUT.XML
  34 + end
  35 +
  36 + class WarehouseItem
  37 + attr_accessor :warehouse,
  38 + :description,
  39 + :qty_on_hand,
  40 + :available_qty,
  41 + :qty_on_order,
  42 + :qty_in_inspection,
  43 + :minimum_qty,
  44 + :maximum_qty,
  45 + :qty_on_back_order,
  46 + :qty_allocated,
  47 + :mtd_qty_received,
  48 + :mtd_qty_adjusted,
  49 + :mtd_qty_issued,
  50 + :ytd_qty_sold,
  51 + :prev_year_qty_sold,
  52 + :qty_in_transit,
  53 + :qty_allocated_wip,
  54 + :wip_qty_reserved,
  55 + :mtd_qty_sold,
  56 + :mtd_qty_trf,
  57 + :user_field1,
  58 + :user_field2,
  59 + :user_field3,
  60 + :default_bin,
  61 + :unit_cost,
  62 + :future_free,
  63 + :quantity_dispatch_not_invoiced
  64 + end
  65 +
  66 + class StockItem
  67 + attr_accessor :stock_code,
  68 + :description,
  69 + :long_desc
  70 + # Not all xml parsed, see https://infozone.syspro.com/Support/businessobjectslibrary/INVQRYOUT.XML
  71 + end
  72 +
  73 + class SystemInformation
  74 + attr_accessor :css_style,
  75 + :language,
  76 + :company_id,
  77 + :company_name
  78 + # Not all xml parsed, see https://infozone.syspro.com/Support/businessobjectslibrary/INVQRYOUT.XML
  79 + end
  80 + end
  81 + end
  82 +end
  83 +
... ...
lib/syspro/business_objects/models/inv_qry_options.rb 0 โ†’ 100644
  1 +module Syspro
  2 + module BusinessObjects
  3 + module Models
  4 + class InvQryOptions
  5 + attr_accessor :multi_media_image_type,
  6 + :include_history,
  7 + :include_bins,
  8 + :include_lots,
  9 + :include_serials,
  10 + :include_movements,
  11 + :movement_date_sequence,
  12 + :movement_start_date,
  13 + :max_number_movements,
  14 + :include_custom_forms,
  15 + :include_movement_issues,
  16 + :include_movement_transfers,
  17 + :include_movement_receipts,
  18 + :include_movement_physical,
  19 + :include_movement_adjustments,
  20 + :include_movement_cost_changes,
  21 + :include_movement_cost_mods,
  22 + :include_movement_invoices,
  23 + :include_movement_credit_notes,
  24 + :include_movement_debit_notes,
  25 + :include_movement_dispatch_notes,
  26 + :include_ecc,
  27 + :xsl_stylesheet
  28 +
  29 + end
  30 + end
  31 + end
  32 +end
  33 +
  34 +
  35 +
... ...
lib/syspro/business_objects/parsers/invqry_parser.rb 0 โ†’ 100644
  1 +# frozen_string_literal: true
  2 +
  3 +module Syspro
  4 + module BusinessObjects
  5 + module Parsers
  6 + class InvQryParser
  7 + attr_reader :doc
  8 +
  9 + def initialize(doc)
  10 + @calculated_weight = 0
  11 + @doc = doc
  12 + end
  13 +
  14 + def parse
  15 + parsed_inv = Syspro::BusinessObjects::Models::Inv.new
  16 +
  17 + doc.xpath("//WarehouseItem").each do |wh|
  18 + parsed_inv.addWarehouseItem({
  19 + "warehouse": wh.xpath("Warehouse").text,
  20 + "description": wh.xpath("Description").text,
  21 + "qty_on_hand": wh.xpath("QtyOnHand").text,
  22 + "available_qty": wh.xpath("AvailableQty").text,
  23 + "qty_on_order": wh.xpath("QtyOnOrder").text,
  24 + "qty_in_inspection": wh.xpath("QtyInInspection").text,
  25 + "minimum_qty": wh.xpath("MinimumQty").text,
  26 + "maximum_qty": wh.xpath("MaximumQty").text,
  27 + "qty_on_back_order": wh.xpath("QtyOnBackOrder").text,
  28 + "qty_allocated": wh.xpath("QtyAllocated").text,
  29 + "mtd_qty_received": wh.xpath("MtdQtyReceived").text,
  30 + "mtd_qty_adjusted": wh.xpath("MtdQtyAdjusted").text,
  31 + "mtd_qty_issued": wh.xpath("MtdQtyIssued").text,
  32 + "ytd_qty_sold": wh.xpath("YtdQtySold").text,
  33 + "prev_year_qty_sold": wh.xpath("PrevYearQtySold").text,
  34 + "qty_in_transit": wh.xpath("QtyInTransit").text,
  35 + "qty_allocated_wip": wh.xpath("QtyAllocatedWip").text,
  36 + "wip_qty_reserved": wh.xpath("WipQtyReserved").text,
  37 + "mtd_qty_sold": wh.xpath("MtdQtySold").text,
  38 + "mtd_qty_trf": wh.xpath("MtdQtyTrf").text,
  39 + "user_field1": wh.xpath("UserField1").text,
  40 + "user_field2": wh.xpath("UserField2").text,
  41 + "user_field3": wh.xpath("UserField3").text,
  42 + "default_bin": wh.xpath("DefaultBin").text,
  43 + "unit_cost": wh.xpath("UnitCost").text,
  44 + "future_free": wh.xpath("FutureFree").text,
  45 + "quantity_dispatch_not_invoiced": wh.xpath("QuantityDispatchNotInvoiced").text
  46 + })
  47 + end
  48 +
  49 + si = doc.xpath("InvQuery/SystemInformation").first
  50 + if si
  51 + parsed_inv.system_information.css_style = si.xpath("CssStyle").text
  52 + parsed_inv.system_information.language = si.xpath("Language").text
  53 + parsed_inv.system_information.company_id = si.xpath("CompanyId").text
  54 + parsed_inv.system_information.company_name = si.xpath("CompanyName").text
  55 + end
  56 +
  57 + st = doc.xpath("InvQuery/StockItem").first
  58 + if st
  59 + parsed_inv.stock_item.stock_code = st.xpath("StockCode").text
  60 + parsed_inv.stock_item.description = st.xpath("Description").text
  61 + parsed_inv.stock_item.long_desc = st.xpath("LongDesc").text
  62 + end
  63 +
  64 + wt = doc.xpath("InvQuery/WarehouseTotals").first
  65 + if wt
  66 + parsed_inv.warehouse_totals.qty_on_hand = wt.xpath("QtyOnHand").text
  67 + parsed_inv.warehouse_totals.available_qty = wt.xpath("AvailableQty").text
  68 + end
  69 +
  70 + parsed_inv
  71 + end
  72 + end
  73 + end
  74 + end
  75 +end
0 76 \ No newline at end of file
... ...
lib/syspro/business_objects/schemas/comsfm.xml.erb
1 1 <SetupCustomForm xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="COMSFM.XSD">
2 2 <Parameters>
3   - <ValidateOnly><%= @validate_only ? "Y" : "N" %></ValidateOnly>
  3 + <ValidateOnly><%= @validate_only ? @validate_only : "N" %></ValidateOnly>
4 4 </Parameters>
5 5 </SetupCustomForm>
6 6 \ No newline at end of file
... ...
lib/syspro/business_objects/schemas/invqry.xml.erb 0 โ†’ 100644
  1 +<?xml version="1.0" encoding="Windows-1252"?>
  2 +<Query xmlns:xsd="http://www.w3.org/2000/10/XMLSchema-instance" xsd:noNamespaceSchemaLocation="INVQRY.XSD">
  3 + <% if @key_stock_code %>
  4 + <Key>
  5 + <StockCode><%= @key_stock_code%></StockCode>
  6 + </Key>
  7 + <% end %>
  8 + <% if @option %>
  9 + <Option>
  10 + <MultiMediaImageType><%= render_xml(@option.multi_media_image_type, "GIF") %></MultiMediaImageType>
  11 + <IncludeHistory><%= render_xml(@option.include_history, "N") %></IncludeHistory>
  12 + <IncludeBins><%= render_xml(@option.include_bins, "N") %></IncludeBins>
  13 + <IncludeLots><%= render_xml(@option.include_lots, "N") %></IncludeLots>
  14 + <IncludeSerials><%= render_xml(@option.include_serials, "N") %></IncludeSerials>
  15 + <IncludeMovements><%= render_xml(@option.include_movements, "N") %></IncludeMovements>
  16 + <MovementDateSequence><%= render_xml(@option.movement_date_sequence, "A") %></MovementDateSequence>
  17 + <MovementStartDate><%= render_xml(@option.movement_start_date, "2001-01-12") %></MovementStartDate>
  18 + <MaxNumberMovements><%= render_xml(@option.max_number_movements, "100") %></MaxNumberMovements>
  19 + <IncludeCustomForms><%= render_xml(@option.include_custom_forms, "N") %></IncludeCustomForms>
  20 + <IncludeMovementIssues><%= render_xml(@option.include_movement_issues, "N") %></IncludeMovementIssues>
  21 + <IncludeMovementTransfers><%= render_xml(@option.include_movement_transfers, "N") %></IncludeMovementTransfers>
  22 + <IncludeMovementReceipts><%= render_xml(@option.include_movement_receipts, "N") %></IncludeMovementReceipts>
  23 + <IncludeMovementPhysical><%= render_xml(@option.include_movement_physical, "N") %></IncludeMovementPhysical>
  24 + <IncludeMovementAdjustments><%= render_xml(@option.include_movement_adjustments, "N") %></IncludeMovementAdjustments>
  25 + <IncludeMovementCostChanges><%= render_xml(@option.include_movement_cost_changes, "N") %></IncludeMovementCostChanges>
  26 + <IncludeMovementCostMods><%= render_xml(@option.include_movement_cost_mods, "N") %></IncludeMovementCostMods>
  27 + <IncludeMovementInvoices><%= render_xml(@option.include_movement_invoices, "N") %></IncludeMovementInvoices>
  28 + <IncludeMovementCreditNotes><%= render_xml(@option.include_movement_credit_notes, "N") %></IncludeMovementCreditNotes>
  29 + <IncludeMovementDebitNotes><%= render_xml(@option.include_movement_debit_notes, "N") %></IncludeMovementDebitNotes>
  30 + <IncludeMovementDispatchNotes><%= render_xml(@option.include_movement_dispatch_notes, "N") %></IncludeMovementDispatchNotes>
  31 + <IncludeEcc><%= render_xml(@option.include_ecc, "N") %></IncludeEcc>
  32 + <XslStylesheet><%= render_xml(@option.xsl_stylesheet, "") %></XslStylesheet>
  33 + </Option>
  34 + <% end %>
  35 + <Filter>
  36 + <Warehouse FilterType="L" FilterValue="<%= @filter_warehouse_list %>"/>
  37 + </Filter>
  38 +</Query>
0 39 \ No newline at end of file
... ...
test/cassettes/test_int_query.yml 0 โ†’ 100644
  1 +---
  2 +http_interactions:
  3 +- request:
  4 + method: get
  5 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/logon?CompanyId=<syspro_company>&CompanyPassword=&Operator=<syspro_username>&OperatorPassword=<syspro_password>
  6 + body:
  7 + encoding: US-ASCII
  8 + string: ''
  9 + headers:
  10 + User-Agent:
  11 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  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-Type:
  24 + - application/octet-stream
  25 + Server:
  26 + - Microsoft-HTTPAPI/2.0
  27 + Date:
  28 + - Wed, 16 Jan 2019 12:31:24 GMT
  29 + Content-<syspro_company>ength:
  30 + - '36'
  31 + body:
  32 + encoding: UTF-8
  33 + string: '84301CEF7CD018459F8CF02873A278A000 '
  34 + http_version:
  35 + recorded_at: Wed, 16 Jan 2019 12:31:23 GMT
  36 +- request:
  37 + method: get
  38 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/Query/Query?BusinessObject=INVQRY&UserId=84301CEF7CD018459F8CF02873A278A000%20%20&XmlIn=%3C?xml%20version=%221.0%22%20encoding=%22Windows-1252%22?%3E%0A%3CQuery%20xmlns:xsd=%22http://www.w3.org/2000/10/XM<syspro_company>Schema-instance%22%20xsd:noNamespaceSchema<syspro_company>ocation=%22INVQRY.XSD%22%3E%0A%20%20%0A%20%20%3CKey%3E%0A%20%20%20%20%3CStockCode%3E1003%3C/StockCode%3E%0A%20%20%3C/Key%3E%0A%20%20%0A%20%20%0A%20%20%3COption%3E%0A%20%20%20%20%3CMultiMediaImageType%3EGIF%3C/MultiMediaImageType%3E%0A%20%20%20%20%3CIncludeHistory%3EN%3C/IncludeHistory%3E%0A%20%20%20%20%3CIncludeBins%3EN%3C/IncludeBins%3E%0A%20%20%20%20%3CInclude<syspro_company>ots%3EY%3C/Include<syspro_company>ots%3E%0A%20%20%20%20%3CIncludeSerials%3EN%3C/IncludeSerials%3E%0A%20%20%20%20%3CIncludeMovements%3EN%3C/IncludeMovements%3E%0A%20%20%20%20%3CMovementDateSequence%3EA%3C/MovementDateSequence%3E%0A%20%20%20%20%3CMovementStartDate%3E2001-01-12%3C/MovementStartDate%3E%0A%20%20%20%20%3CMaxNumberMovements%3E100%3C/MaxNumberMovements%3E%0A%20%20%20%20%3CIncludeCustomForms%3EN%3C/IncludeCustomForms%3E%0A%20%20%20%20%3CIncludeMovementIssues%3EN%3C/IncludeMovementIssues%3E%0A%20%20%20%20%3CIncludeMovementTransfers%3EN%3C/IncludeMovementTransfers%3E%0A%20%20%20%20%3CIncludeMovementReceipts%3EN%3C/IncludeMovementReceipts%3E%0A%20%20%20%20%3CIncludeMovementPhysical%3EN%3C/IncludeMovementPhysical%3E%0A%20%20%20%20%3CIncludeMovementAdjustments%3EN%3C/IncludeMovementAdjustments%3E%0A%20%20%20%20%3CIncludeMovementCostChanges%3EN%3C/IncludeMovementCostChanges%3E%0A%20%20%20%20%3CIncludeMovementCostMods%3EN%3C/IncludeMovementCostMods%3E%0A%20%20%20%20%3CIncludeMovementInvoices%3EN%3C/IncludeMovementInvoices%3E%0A%20%20%20%20%3CIncludeMovementCreditNotes%3EN%3C/IncludeMovementCreditNotes%3E%0A%20%20%20%20%3CIncludeMovementDebitNotes%3EN%3C/IncludeMovementDebitNotes%3E%0A%20%20%20%20%3CIncludeMovementDispatchNotes%3EN%3C/IncludeMovementDispatchNotes%3E%0A%20%20%20%20%3CIncludeEcc%3EN%3C/IncludeEcc%3E%0A%20%20%20%20%3CXslStylesheet%3E%3C/XslStylesheet%3E%0A%20%20%3C/Option%3E%0A%20%20%0A%20%20%3CFilter%3E%0A%20%20%20%20%3CWarehouse%20FilterType=%22<syspro_company>%22%20FilterValue=%22P0%22/%3E%0A%20%20%3C/Filter%3E%0A%3C/Query%3E
  39 + body:
  40 + encoding: US-ASCII
  41 + string: ''
  42 + headers:
  43 + User-Agent:
  44 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  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-Type:
  57 + - application/octet-stream
  58 + Server:
  59 + - Microsoft-HTTPAPI/2.0
  60 + Date:
  61 + - Wed, 16 Jan 2019 12:31:25 GMT
  62 + Content-<syspro_company>ength:
  63 + - '13919'
  64 + body:
  65 + encoding: UTF-8
  66 + string: "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n<InvQuery <syspro_company>anguage='05'
  67 + <syspro_company>anguage2='EN' CssStyle='' DecFormat='1' DateFormat='01' Role='01'
  68 + Version='7.0.042' OperatorPrimaryRole=' '>\n<StockItem>\n<StockCode>1003</StockCode>\n<Description>MWN
  69 + MIX</Description>\n<<syspro_company>ongDesc>MIDWEST NATIVE SPEARMINT MIX</<syspro_company>ongDesc>\n<Decimals>
  70 + \ 3</Decimals>\n<AlternateKey1/>\n<AlternateKey2/>\n<Version/>\n<Release/>\n<StockUom><syspro_company>B</StockUom>\n<AlternateUom>KG</AlternateUom>\n<ConvFactAltUom>
  71 + \ 2.204620</ConvFactAltUom>\n<ConvMulDiv>M</ConvMulDiv>\n<OtherUom>DR</OtherUom>\n<ConvFactOthUom>
  72 + \ 400.000000</ConvFactOthUom>\n<MulDiv>M</MulDiv>\n<ManufactureUom><syspro_company>B</ManufactureUom>\n<ConvFactMuM>
  73 + \ 1.000000</ConvFactMuM>\n<ManMulDiv>M</ManMulDiv>\n<StockAndAltUm>N</StockAndAltUm>\n<PartCategory>M</PartCategory>\n<PartCategoryDesc>Made-in</PartCategoryDesc>\n<Supplier/>\n<ProductClass>SMWN</ProductClass>\n<ProductClassDesc>MIDWEST
  74 + NATIVE SPEARMINT</ProductClassDesc>\n<Buyer/>\n<BuyerDesc/>\n<Planner/>\n<PlannerDesc/>\n<TraceableType>T</TraceableType>\n<TraceableTypeDesc>Traceable
  75 + item</TraceableTypeDesc>\n<MpsFlag>N</MpsFlag>\n<MpsFlagDesc>Non-MPS item</MpsFlagDesc>\n<SupercessionDate/>\n<ResourceCode/>\n<ResourceCodeDesc/>\n<ComponentCount>00000</ComponentCount>\n<InclInStrValid>Yes</InclInStrValid>\n<<syspro_company>abourCost>
  76 + \ 0.00000</<syspro_company>abourCost>\n<Edited_<syspro_company>abourCost>0.000</Edited_<syspro_company>abourCost>\n<MaterialCost>
  77 + \ 0.00000</MaterialCost>\n<Edited_MaterialCost>0.000</Edited_MaterialCost>\n<FixedOverhead>
  78 + \ 0.00000</FixedOverhead>\n<Edited_FixedOverhead>0.000</Edited_FixedOverhead>\n<VariableOverhead>
  79 + \ 0.00000</VariableOverhead>\n<Edited_VariableOverhead>0.000</Edited_VariableOverhead>\n<SubContractCost>
  80 + \ 0.00000</SubContractCost>\n<Edited_SubContractCost>0.000</Edited_SubContractCost>\n<TotalCost>
  81 + \ 0.00000</TotalCost>\n<Edited_TotalCost>0.000</Edited_TotalCost>\n<CostPriceCurrency>$</CostPriceCurrency>\n<EbqNumeric>
  82 + \ 400.000000</EbqNumeric>\n<GrossReqRule>I</GrossReqRule>\n<GrossReqRuleDesc>Included</GrossReqRuleDesc>\n<DrawOfficeNum/>\n<Ebq>
  83 + \ 400.000000</Ebq>\n<Edited_Ebq>400.000</Edited_Ebq>\n<DockToStock>
  84 + \ 0</DockToStock>\n<Manuf<syspro_company>eadTime> 0</Manuf<syspro_company>eadTime>\n<TariffCode/>\n<UserField1/>\n<UserField2>
  85 + \ 0.00000</UserField2>\n<UserField3/>\n<UserField4/>\n<UserField5/>\n<<syspro_company>eadTime>
  86 + \ 0</<syspro_company>eadTime>\n<WarehouseToUse>H1</WarehouseToUse>\n<WarehouseToUseDesc>HARRAH-<syspro_company>ABBEEMINT
  87 + OWNED</WarehouseToUseDesc>\n<MinimumPricePctAboveCost> 0.00</MinimumPricePctAboveCost>\n<Edited_MinimumPricePctAboveCost>0.00</Edited_MinimumPricePctAboveCost>\n<GstTaxCode>A</GstTaxCode>\n<GstTaxCodeDesc>NO
  88 + TAX</GstTaxCodeDesc>\n<GstIncludedInPrice>N</GstIncludedInPrice>\n<DemandTimeFenceInDays>
  89 + \ 0</DemandTimeFenceInDays>\n<Shelf<syspro_company>ifeInDays> 0</Shelf<syspro_company>ifeInDays>\n<MakeToOrderFlag>N</MakeToOrderFlag>\n<DistributionWarehouseToUse/>\n<DistributionWarehouseToUseDesc/>\n<CountryOfOrigin/>\n<CountryOfOriginDesc/>\n<EccUser/>\n<EccUserDesc/>\n<BuyingRule>A</BuyingRule>\n<BuyingRuleDesc><syspro_company>ot
  90 + for lot</BuyingRuleDesc>\n<FixedTimeDaysForRuleC> 1</FixedTimeDaysForRuleC>\n<EbqPan>EBQ
  91 + Quantity</EbqPan>\n<PanSize> 0.000000</PanSize>\n<Edited_PanSize>0.000</Edited_PanSize>\n<PercentageYield>100</PercentageYield>\n<<syspro_company>ow<syspro_company>evelCode>
  92 + 0</<syspro_company>ow<syspro_company>evelCode>\n<WipCtlGlCode/>\n<DateStockAdded>2006-03-21</DateStockAdded>\n<AbcPreProd>
  93 + \ 0.00000</AbcPreProd>\n<Edited_AbcPreProd>0.000</Edited_AbcPreProd>\n<AbcManufacturing>
  94 + \ 0.00000</AbcManufacturing>\n<Edited_AbcManufacturing>0.000</Edited_AbcManufacturing>\n<AbcSales>
  95 + \ 0.00000</AbcSales>\n<Edited_AbcSales>0.000</Edited_AbcSales>\n<AbcCumPreProd>
  96 + \ 0.00000</AbcCumPreProd>\n<Edited_AbcCumPreProd>0.000</Edited_AbcCumPreProd>\n<AbcCumManuf>
  97 + \ 0.00000</AbcCumManuf>\n<Edited_AbcCumManuf>0.000</Edited_AbcCumManuf>\n<SpecificGravity>
  98 + 0.0000</SpecificGravity>\n<Edited_SpecificGravity>0.00</Edited_SpecificGravity>\n<Mass>
  99 + \ 1.000000</Mass>\n<Volume> 0.000000</Volume>\n<PriceCategory>A</PriceCategory>\n<PriceMethod>C</PriceMethod>\n<PriceMethodDesc>Coded</PriceMethodDesc>\n<CycleCount>
  100 + 0</CycleCount>\n<TaxCode>A</TaxCode>\n<TaxCodeDesc>NO TAX</TaxCodeDesc>\n<OtherTaxCode/>\n<OtherTaxCodeDesc/>\n<<syspro_company>istPriceCode>A</<syspro_company>istPriceCode>\n<SerialMethod>N</SerialMethod>\n<SerialMethodDesc>None</SerialMethodDesc>\n<KitType>N</KitType>\n<KitTypeDesc>Not
  101 + applicable</KitTypeDesc>\n<BulkIssueFlag>N</BulkIssueFlag>\n<BulkIssueFlagDesc>None</BulkIssueFlagDesc>\n<AbcClass/>\n<StockMovementReq>Y</StockMovementReq>\n<ClearingFlag>N</ClearingFlag>\n<AbcAnalysisReq>Y</AbcAnalysisReq>\n<AbcCostingReq>N</AbcCostingReq>\n<CostUom><syspro_company>B</CostUom>\n<SellingPrice>
  102 + \ 0.00000</SellingPrice>\n<PriceBasis/>\n<PriceBasisDesc/>\n<Edited_SellingPrice>0.000</Edited_SellingPrice>\n<SellingPriceCurrency>$</SellingPriceCurrency>\n<GrossProfitPct>
  103 + \ 0.000</GrossProfitPct>\n<StockOnHold/>\n<StockOnHoldDesc/>\n<StockOnHoldReason/>\n<StockOnHoldReasonDesc/>\n<ApprovedManufactures>\n</ApprovedManufactures>\n<Narrations>\n</Narrations>\n</StockItem>\n<WarehouseItem>\n<Warehouse>P0</Warehouse>\n<Description>PORTAGE-GROWER
  104 + OWNED</Description>\n<QtyOnHand> 747.800000</QtyOnHand>\n<Edited_QtyOnHand>747.800</Edited_QtyOnHand>\n<AvailableQty>
  105 + \ 747.800000</AvailableQty>\n<Edited_AvailableQty>747.800</Edited_AvailableQty>\n<QtyOnOrder>
  106 + \ 806.730000</QtyOnOrder>\n<Edited_QtyOnOrder>806.730</Edited_QtyOnOrder>\n<QtyInInspection>
  107 + \ 0.000000</QtyInInspection>\n<Edited_QtyInInspection>0.000</Edited_QtyInInspection>\n<MinimumQty>
  108 + \ 0.000000</MinimumQty>\n<Edited_MinimumQty>0.000</Edited_MinimumQty>\n<MaximumQty>
  109 + \ 0.000000</MaximumQty>\n<Edited_MaximumQty>0.000</Edited_MaximumQty>\n<QtyOnBackOrder>
  110 + \ 0.000000</QtyOnBackOrder>\n<Edited_QtyOnBackOrder>0.000</Edited_QtyOnBackOrder>\n<QtyAllocated>
  111 + \ 0.000000</QtyAllocated>\n<Edited_QtyAllocated>0.000</Edited_QtyAllocated>\n<MtdQtyReceived>
  112 + \ 0.000000</MtdQtyReceived>\n<Edited_MtdQtyReceived>0.000</Edited_MtdQtyReceived>\n<MtdQtyAdjusted>
  113 + \ 0.000000</MtdQtyAdjusted>\n<Edited_MtdQtyAdjusted>0.000</Edited_MtdQtyAdjusted>\n<MtdQtyIssued>
  114 + \ 0.000000</MtdQtyIssued>\n<Edited_MtdQtyIssued>0.000</Edited_MtdQtyIssued>\n<YtdQtySold>
  115 + \ 0.000000</YtdQtySold>\n<Edited_YtdQtySold>0.000</Edited_YtdQtySold>\n<PrevYearQtySold>
  116 + \ 0.000000</PrevYearQtySold>\n<Edited_PrevYearQtySold>0.000</Edited_PrevYearQtySold>\n<QtyInTransit>
  117 + \ 0.000000</QtyInTransit>\n<Edited_QtyInTransit>0.000</Edited_QtyInTransit>\n<QtyAllocatedWip>
  118 + \ 0.000000</QtyAllocatedWip>\n<Edited_QtyAllocatedWip>0.000</Edited_QtyAllocatedWip>\n<Edited_WipQtyReserved>0.000</Edited_WipQtyReserved>\n<MtdQtySold>
  119 + \ 0.000000</MtdQtySold>\n<Edited_MtdQtySold>0.000</Edited_MtdQtySold>\n<MtdQtyTrf>
  120 + \ 0.000000</MtdQtyTrf>\n<Edited_MtdQtyTrf>0.000</Edited_MtdQtyTrf>\n<Date<syspro_company>astSale/>\n<Date<syspro_company>astCostChange/>\n<Date<syspro_company>astCostEntered/>\n<UserField1/>\n<UserField2/>\n<UserField3/>\n<DefaultBin>P0</DefaultBin>\n<UnitCost>
  121 + \ 0.00000</UnitCost>\n<FutureFree> 1554.530000</FutureFree>\n<Edited_FutureFree>1,554.530</Edited_FutureFree>\n<QuantityDispatchNotInvoiced>
  122 + \ 0.000000</QuantityDispatchNotInvoiced>\n<Edited_QuantityDispatchNotInvoiced>0.000</Edited_QuantityDispatchNotInvoiced>\n<Parameters>\n<SafetyStock<syspro_company>evel>
  123 + \ 0.000000</SafetyStock<syspro_company>evel>\n<Edited_SafetyStock<syspro_company>evel>0.000</Edited_SafetyStock<syspro_company>evel>\n<ReOrderQuantity>
  124 + \ 0.000000</ReOrderQuantity>\n<Edited_ReOrderQuantity>0.000</Edited_ReOrderQuantity>\n<PalletQuantity>
  125 + \ 0.000000</PalletQuantity>\n<Edited_PalletQuantity>0.000</Edited_PalletQuantity>\n<DefaultBin<syspro_company>ocation>P0</DefaultBin<syspro_company>ocation>\n<ABCclassification/>\n<RequisitionsInProgress/>\n<<syspro_company>andedCostMultiplier>
  126 + \ 1.000000</<syspro_company>andedCostMultiplier>\n<Edited_<syspro_company>andedCostMultiplier>1.000</Edited_<syspro_company>andedCostMultiplier>\n</Parameters>\n<Costs>\n<Method>FIFO</Method>\n<<syspro_company>astCostEntered>
  127 + \ 0.00000</<syspro_company>astCostEntered>\n<Current> 0.00000</Current>\n<<syspro_company>astNonMerchandise>
  128 + \ 0.00000</<syspro_company>astNonMerchandise>\n</Costs>\n<MTDValues>\n<MTDSalesValue>
  129 + \ 0.00</MTDSalesValue>\n</MTDValues>\n<YTDValues>\n<YTDQtyIssued>
  130 + \ 0.00</YTDQtyIssued>\n<YTDSalesValue> 0.00</YTDSalesValue>\n<YTDUsageValue>
  131 + \ 0.00</YTDUsageValue>\n<PYSalesValue> 0.00</PYSalesValue>\n</YTDValues>\n<<syspro_company>astActivityDates>\n<Date<syspro_company>astStockMovement>2017/08/02</Date<syspro_company>astStockMovement>\n<DateOf<syspro_company>astPurchase>2017/08/02</DateOf<syspro_company>astPurchase>\n<DateOf<syspro_company>astCount/>\n<DateWarehouseAdded>2006/03/21</DateWarehouseAdded>\n</<syspro_company>astActivityDates>\n<<syspro_company>otItem>\n<<syspro_company>otJob>064017</<syspro_company>otJob>\n<DrawingNum/>\n<DrawingNumDesc/>\n<Bin>064017</Bin>\n<Version/>\n<Release/>\n<QtyOnHand>
  132 + \ 283.200000</QtyOnHand>\n<Edited_QtyOnHand>283.200</Edited_QtyOnHand>\n<AvailableQty>
  133 + \ 283.200000</AvailableQty>\n<Edited_AvailableQty>283.200</Edited_AvailableQty>\n<Note/>\n<<syspro_company>otHoldFlag/>\n<ExpiryDate/>\n</<syspro_company>otItem>\n<<syspro_company>otItem>\n<<syspro_company>otJob>064020</<syspro_company>otJob>\n<DrawingNum/>\n<DrawingNumDesc/>\n<Bin>064020</Bin>\n<Version/>\n<Release/>\n<QtyOnHand>
  134 + \ 148.000000</QtyOnHand>\n<Edited_QtyOnHand>148.000</Edited_QtyOnHand>\n<AvailableQty>
  135 + \ 148.000000</AvailableQty>\n<Edited_AvailableQty>148.000</Edited_AvailableQty>\n<Note/>\n<<syspro_company>otHoldFlag/>\n<ExpiryDate/>\n</<syspro_company>otItem>\n<<syspro_company>otItem>\n<<syspro_company>otJob>064042</<syspro_company>otJob>\n<DrawingNum/>\n<DrawingNumDesc/>\n<Bin>064042</Bin>\n<Version/>\n<Release/>\n<QtyOnHand>
  136 + \ 25.600000</QtyOnHand>\n<Edited_QtyOnHand>25.600</Edited_QtyOnHand>\n<AvailableQty>
  137 + \ 25.600000</AvailableQty>\n<Edited_AvailableQty>25.600</Edited_AvailableQty>\n<Note/>\n<<syspro_company>otHoldFlag/>\n<ExpiryDate/>\n</<syspro_company>otItem>\n<<syspro_company>otItem>\n<<syspro_company>otJob>064064</<syspro_company>otJob>\n<DrawingNum/>\n<DrawingNumDesc/>\n<Bin>064064</Bin>\n<Version/>\n<Release/>\n<QtyOnHand>
  138 + \ 291.000000</QtyOnHand>\n<Edited_QtyOnHand>291.000</Edited_QtyOnHand>\n<AvailableQty>
  139 + \ 291.000000</AvailableQty>\n<Edited_AvailableQty>291.000</Edited_AvailableQty>\n<Note/>\n<<syspro_company>otHoldFlag/>\n<ExpiryDate/>\n</<syspro_company>otItem>\n</WarehouseItem>\n<WarehouseTotals>\n<QtyOnHand>
  140 + \ 747.800000</QtyOnHand>\n<Edited_QtyOnHand>747.800</Edited_QtyOnHand>\n<AvailableQty>
  141 + \ 747.800000</AvailableQty>\n<Edited_AvailableQty>747.800</Edited_AvailableQty>\n<QtyOnOrder>
  142 + \ 806.730000</QtyOnOrder>\n<Edited_QtyOnOrder>806.730</Edited_QtyOnOrder>\n<QtyInInspection>
  143 + \ 0.000000</QtyInInspection>\n<Edited_QtyInInspection>0.000</Edited_QtyInInspection>\n<MinimumQty>
  144 + \ 0.000000</MinimumQty>\n<Edited_MinimumQty>0.000</Edited_MinimumQty>\n<MaximumQty>
  145 + \ 0.000000</MaximumQty>\n<Edited_MaximumQty>0.000</Edited_MaximumQty>\n<QtyOnBackOrder>
  146 + \ 0.000000</QtyOnBackOrder>\n<Edited_QtyOnBackOrder>0.000</Edited_QtyOnBackOrder>\n<QtyAllocated>
  147 + \ 0.000000</QtyAllocated>\n<Edited_QtyAllocated>0.000</Edited_QtyAllocated>\n<MtdQtyReceived>
  148 + \ 0.000000</MtdQtyReceived>\n<Edited_MtdQtyReceived>0.000</Edited_MtdQtyReceived>\n<MtdQtyAdjusted>
  149 + \ 0.000000</MtdQtyAdjusted>\n<Edited_MtdQtyAdjusted>0.000</Edited_MtdQtyAdjusted>\n<MtdQtyIssued>
  150 + \ 0.000000</MtdQtyIssued>\n<Edited_MtdQtyIssued>0.000</Edited_MtdQtyIssued>\n<MtdQtySold>
  151 + \ 0.000000</MtdQtySold>\n<Edited_MtdQtySold>0.000</Edited_MtdQtySold>\n<YtdQtySold>
  152 + \ 0.000000</YtdQtySold>\n<Edited_YtdQtySold>0.000</Edited_YtdQtySold>\n<PrevYearQtySold>
  153 + \ 0.000000</PrevYearQtySold>\n<Edited_PrevYearQtySold>0.000</Edited_PrevYearQtySold>\n<QtyInTransit>
  154 + \ 0.000000</QtyInTransit>\n<Edited_QtyInTransit>0.000</Edited_QtyInTransit>\n<QtyAllocatedWip>
  155 + \ 0.000000</QtyAllocatedWip>\n<Edited_QtyAllocatedWip>0.000</Edited_QtyAllocatedWip>\n<MtdQtyTrf>
  156 + \ 0.000000</MtdQtyTrf>\n<Edited_MtdQtyTrf>0.000</Edited_MtdQtyTrf>\n<UnitCost>
  157 + \ 0.00000</UnitCost>\n<SalesQtyTot1> 0.000000</SalesQtyTot1>\n<Edited_SalesQtyTot1>0.000</Edited_SalesQtyTot1>\n<SalesQtyTot2>
  158 + \ 0.000000</SalesQtyTot2>\n<Edited_SalesQtyTot2>0.000</Edited_SalesQtyTot2>\n<SalesQtyTot3>
  159 + \ 0.000000</SalesQtyTot3>\n<Edited_SalesQtyTot3>0.000</Edited_SalesQtyTot3>\n<SalesQtyTot4>
  160 + \ 0.000000</SalesQtyTot4>\n<Edited_SalesQtyTot4>0.000</Edited_SalesQtyTot4>\n<SalesQtyTot5>
  161 + \ 0.000000</SalesQtyTot5>\n<Edited_SalesQtyTot5>0.000</Edited_SalesQtyTot5>\n<SalesQtyTot6>
  162 + \ 0.000000</SalesQtyTot6>\n<Edited_SalesQtyTot6>0.000</Edited_SalesQtyTot6>\n<SalesQtyTot7>
  163 + \ 0.000000</SalesQtyTot7>\n<Edited_SalesQtyTot7>0.000</Edited_SalesQtyTot7>\n<SalesQtyTot8>
  164 + \ 0.000000</SalesQtyTot8>\n<Edited_SalesQtyTot8>0.000</Edited_SalesQtyTot8>\n<SalesQtyTot9>
  165 + \ 0.000000</SalesQtyTot9>\n<Edited_SalesQtyTot9>0.000</Edited_SalesQtyTot9>\n<SalesQtyTot10>
  166 + \ 0.000000</SalesQtyTot10>\n<Edited_SalesQtyTot10>0.000</Edited_SalesQtyTot10>\n<SalesQtyTot11>
  167 + \ 0.000000</SalesQtyTot11>\n<Edited_SalesQtyTot11>0.000</Edited_SalesQtyTot11>\n<SalesQtyTot12>
  168 + \ 0.000000</SalesQtyTot12>\n<Edited_SalesQtyTot12>0.000</Edited_SalesQtyTot12>\n<Parameters>\n<SafetyStock<syspro_company>evel>
  169 + \ 0.000000</SafetyStock<syspro_company>evel>\n<Edited_SafetyStock<syspro_company>evel>0.000</Edited_SafetyStock<syspro_company>evel>\n<ReOrderQuantity>
  170 + \ 0.000000</ReOrderQuantity>\n<Edited_ReOrderQuantity>0.000</Edited_ReOrderQuantity>\n<PalletQuantity>
  171 + \ 0.000000</PalletQuantity>\n<Edited_PalletQuantity>0.000</Edited_PalletQuantity>\n<DefaultBin<syspro_company>ocation>P0</DefaultBin<syspro_company>ocation>\n<ABCclassification/>\n<RequisitionsInProgress/>\n<<syspro_company>andedCostMultiplier>
  172 + \ 1.000000</<syspro_company>andedCostMultiplier>\n<Edited_<syspro_company>andedCostMultiplier>1.000</Edited_<syspro_company>andedCostMultiplier>\n</Parameters>\n<Costs>\n<Method>FIFO</Method>\n<<syspro_company>astCostEntered>
  173 + \ 0.00000</<syspro_company>astCostEntered>\n<Current> 0.00000</Current>\n<<syspro_company>astNonMerchandise>
  174 + \ 0.00000</<syspro_company>astNonMerchandise>\n</Costs>\n<MTDValues>\n<MTDSalesValue>
  175 + \ 0.00</MTDSalesValue>\n</MTDValues>\n<YTDValues>\n<YTDQtyIssued>
  176 + \ 0.00</YTDQtyIssued>\n<YTDSalesValue> 0.00</YTDSalesValue>\n<YTDUsageValue>
  177 + \ 0.00</YTDUsageValue>\n<PYSalesValue> 0.00</PYSalesValue>\n</YTDValues>\n</WarehouseTotals>\n</InvQuery>\n "
  178 + http_version:
  179 + recorded_at: Wed, 16 Jan 2019 12:31:24 GMT
  180 +recorded_with: VCR 4.0.0
... ...
test/cassettes/test_logon.yml
... ... @@ -25,12 +25,12 @@ http_interactions:
25 25 Server:
26 26 - Microsoft-HTTPAPI/2.0
27 27 Date:
28   - - Wed, 09 Jan 2019 22:58:07 GMT
  28 + - Mon, 14 Jan 2019 22:56:14 GMT
29 29 Content-<syspro_company>ength:
30   - - '36'
  30 + - '32'
31 31 body:
32 32 encoding: UTF-8
33   - string: '8513E1BCC242674D9F3CC6CD27658BFA00 '
  33 + string: 'ERROR: Invalid operator password'
34 34 http_version:
35   - recorded_at: Wed, 09 Jan 2019 22:58:05 GMT
  35 + recorded_at: Mon, 14 Jan 2019 22:56:14 GMT
36 36 recorded_with: VCR 4.0.0
... ...
test/invqry_test.rb 0 โ†’ 100644
  1 +# frozen_string_literal: true
  2 +
  3 +require 'test_helper'
  4 +
  5 +class InvQryTest < Minitest::Test
  6 + extend Minitest::Spec::DSL
  7 + before { VCR.insert_cassette name }
  8 + after { VCR.eject_cassette }
  9 +
  10 + let(:username) { ENV['SYSPRO_USERNAME'] }
  11 + let(:password) { ENV['SYSPRO_PASSWORD'] }
  12 + let(:company) { ENV['SYSPRO_COMPANY'] }
  13 + let(:company_password) { '' }
  14 +
  15 + let(:user_id) do
  16 + Syspro::Logon.logon(username, password, company, company_password)
  17 + end
  18 +
  19 + def test_int_query
  20 + invqry_req = Syspro::BusinessObjects::InvQry.new
  21 +
  22 + invqry_req.key_stock_code = '1003'
  23 + invqry_req.filter_warehouse_list = 'P0'
  24 + invqry_req.option = Syspro::BusinessObjects::Models::InvQryOptions.new
  25 + invqry_req.option.include_lots = "Y"
  26 +
  27 + invqry_rsp = invqry_req.call(user_id.guid)
  28 +
  29 + assert_kind_of Syspro::BusinessObjects::Models::Inv, invqry_rsp
  30 + end
  31 +end
0 32 \ No newline at end of file
... ...
test/portoi_test.rb
... ... @@ -69,7 +69,6 @@ class PorToiTest &lt; Minitest::Test
69 69  
70 70 po.order_details = Syspro::BusinessObjects::Models::PurchaseOrders::OrderDetails.new
71 71 po.order_details.stock_lines = [line1]
72   - binding.pry
73 72  
74 73 syspro_po = po.call(user_id.guid)
75 74  
... ...