<< Masa.20110901-fulltext-search-migel | 2011 | Masa.20110830-debug-memory-leak-migel-overwriting-original-generic-flag-oddb_org >>
suspend
Goal/Estimate/Evaluation:
Run
Access
For example
... 201:CU 202:7601001315747 201:BY 202:1075 201:DP 202:7601001315747 220:xxxx 221:xxxx 222:xxxx 223:xxxx 225:6593 231:xxxx 237:61 238:1 300:4 301:20110727 ...
Note
Experiment
$: << "./lib"
require 'lib/conversion/propharma_bdd'
require 'lib/conversion/pharmacieplus_bdd'
require 'lib/conversion/bdd_csv'
require 'lib/conversion/bdd_i2'
# PharmaciePlusBdd (xml input file) -> BddI2 (formatted txt file)
reader = XmlConv::Conversion::PharmaciePlusBdd
input = reader.parse(File.read('input.xml'))
model = reader.convert(input)
writer = XmlConv::Conversion::BddI2
output = writer.convert(model)
print output.to_s
Run
masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ ruby -I lib convert_test_pharmacieplus_bdd_i2.rb
Result
201:CU 202:7601001315747 201:BY 202:1075 201:DP 202:7601001315747 220:xxxx 221:xxxx 222:xxxx 223:xxxx 225:6593 231:secretariat@pharmacieplus.ch 237:61 238:1 300:4 301:20110831 ...
Note
Note
masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ grep -r 251 lib/
lib/xmlconv/i2/order.rb: output << sprintf("250:ADE\n251:%s\n", @ade_id)
masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ head lib/conversion/bdd_i2.rb require 'xmlconv/i2/document' require 'xmlconv/i2/address' require 'xmlconv/i2/position'
Experiment
def _doc_add_delivery(doc, delivery, sender_id='YWESEE')
order = I2::Order.new
order.sender_id = sender_id
# customer_id is in reality the delivery_id assigned by the
# customer - the slight confusion is due to automatic naming
#transaction_id = delivery.customer_id
#order.ade_id = order.delivery_id = transaction_id
#doc.header.transaction_id = sprintf(transaction_id.to_s.rjust(8, '0'))
transaction_id = delivery.customer_id
order.ade_id = order.delivery_id = transaction_id
doc.header.transaction_id = sprintf(transaction_id.to_s.rjust(8, '0'))
Run
masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ ruby convert_test_pharmacieplus_to_bdd_i2.rb
Result
001:7601001000681 002:ORDERX 003:220 010:KD7601001315747_00005286.dat 100:YWESEEPP 101:5286 201:CU 202:7601001315747 201:BY 202:1075 201:DP 202:7601001315747 220:xxxx 221:xxxx 222:xxxx 223:xxxx 225:6593 231:xxxx 237:61 238:1250:ADE251:5286300:4 301:20110831
Note
Run
Setup
masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ ls xml_orders/ input.xml ... (one minute later) masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ ls xml_orders/ masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $
Result
Experiment
def _execute(transaction)
p "getin _execute"
transaction.transaction_id = next_transaction_id
p "B"
transaction.execute
p "C"
#transaction.postprocess
ret = transaction.postprocess
p "D"
ret
rescue Exception => error
Result
"getin poll_sources" "getin load_sources" CONFIG.polling_file = "/home/masa/ywesee/globopharm.xmlconv.bbmb.ch/etc/polling.yml" source.class = XmlConv::Util::PollingMission transaction.class = XmlConv::Util::Transaction "getin _execute" "B" "C" ...
Result
IMPORTANT
The postprocess needs '/IN/Temp' directory on the FTP server
tmp_destination: "/IN/Temp"
z.B.
masa@masa ~/work $ grep -r KD7601001005631_00005286 KD7601001005631_00005286012.dat 010:KD7601001005631_00005286.dat
Note
suspend
Problem
Experiment
Result
Note
Experiment
def _doc_add_delivery(doc, delivery, sender_id='YWESEE')
order = I2::Order.new
order.sender_id = sender_id
# customer_id is in reality the delivery_id assigned by the
# customer - the slight confusion is due to automatic naming
transaction_id = delivery.customer_id
order.ade_id = order.delivery_id = transaction_id
#doc.header.transaction_id = sprintf(transaction_id.to_s.rjust(8, '0'))
order.add_date(I2::Date.from_date(::Date.today, :order, :order))
Result
Note
Commit
Problem
Note
def search_migel_products(query, lang)
migel_code = if query =~ /(\d){9}/
query.split(/(\d\d)/).select{|x| !x.empty?}.join('.')
elsif query =~ /(\d\d\.){4}\d/
query
end
if migel_code
MIGEL_SERVER.migelid.search_by_migel_code(migel_code)
else
search_method = 'search_by_name_' + lang.downcase.to_s
MIGEL_SERVER.search_migelid_by_name(query, lang.downcase.to_s)
end
end
def search_migelid_by_name(query, lang)
search_method = 'search_by_name_' + lang
result = []
if groups = Migel::Model::Group.send(search_method, query) and !groups.empty?
groups.each do |group|
result.concat group.subgroups.collect{|sg| sg.migelids}.flatten
end
end
if subgroups = Migel::Model::Subgroup.send(search_method, query) and !subgroups.empty?
result.concat subgroups.collect{|sg| sg.migelids}.flatten
end
result.concat Migel::Model::Migelid.send(search_method, query)
ODBA::DRbWrapper.new(result.uniq)
end
Run
Access (search 'material')
Result


Note
Next
Question