view · edit · sidebar · attach · print · history

20110614-update-order-process-bbmb_ch

<< | Index | >>


  1. Review the task
  2. Review the order process
  3. Update the order process
  4. Check xmlconv process
  5. New Praeparate file update_swissmedic ch.oddb

Goal/Estimate/Evaluation
  • finish bbmb task / 70% / 70%
Milestones
  • Review the process of order
Summary
Commits
Next

Review the task

Email

When putting the order file onto the FTP-Server for Pickup we need
to replace the GAG-Code with the new EAN-Code of the client.

Review the order process

Confirm the oder process

1. Login as an customer

2. Search a product

3. Select a product

4. Send the oder

5. Result

Console log

ftp.puttextfile(/tmp/bbmb.2783.0, /Spital/Temp/KD584674_1308035516.dat)
ftp.rename(/Spital/Temp/KD584674_1308035516.dat, /Spital/In/KD584674_1308035516.dat)

Oder file

masa@masa ~/ftp_share/Spital/In $ ls -al
insgesamt 4
drwxrwxr-x 2 masa     ftp_group   8 14. Jun 09:11 .
drwxr-xr-x 4 masa     masa       24  1. Dez 2010  ..
-rw------- 1 ftp_user ftp_group 256 14. Jun 09:11 KD584674_1308035516.dat
masa@masa ~/ftp_share/Spital/In $ sudo cat KD584674_1308035516.dat 
Passwort: 
001:7601001000681
002:ORDERX
003:220
010:KD584674_1308035516.dat
100:YWESEE
101:
201:CU
202:584674
201:BY
202:1075
231:Hatapharm AG
237:61
238:16
250:ADE
251:1308035516
300:4
301:20110614
500:1
501:7680317060176
502:26203
520:10
521:PCE
540:2
541:20110614

Consider

  • The oder file is produced on the ftp server
  • The file name include the customer_id (Kundennr)
  • Probably the '202' indicates the customer_id (Kundennr)

Update the order process

Experiment

    def transmission_filename(user, order, flavor=BBMB::DEFAULT_FLAVOR)
      case flavor
      when 'astrazeneca'
        "AZ#{user.value(:customer_id)}_#{order.uid}.dat1"
      else
        #"KD#{user.value(:customer_id)}_#{order.uid}.dat"
        "KD#{user.value(:customer_ean13)}_#{order.uid}.dat"
      end
    end
    def transmission_header(user, order)
      header1 = [
        "001:#{self::class::EPIN}",
        "002:ORDERX",
        "003:220",
        "010:#{transmission_filename(user, order)}",
        "100:YWESEE",
        "101:#{order.reference}",
        "201:CU",
        #"202:#{user.value(:customer_id)}",
        "202:#{user.value(:customer_ean13)}",
        "201:BY",
        "202:1075",
        "231:#{user.value(:organisation)}",
      ]

Reboot

  • bin/bbmbd

Run

  • confirm ywskund (EAN-Code)
masa@masa ~/ftp_share/YWESEE/Out $ cat ywskund
584674;584674;22;SD-Lie;;Hatapharm AG;;hoge hoge 11;;CH;8000;hogehoge;011 / 111 22 33;;;011 / 111 22 44;customer@ywesee.com;1234567890123;
  • update (bin/admin)
masa@masa ~/ywesee/bbmb.ch $ bin/admin
ch.bbmb.globopharm> update
  • order (on browser)

Result

masa@masa ~/ftp_share/Spital/In $ ls -al
insgesamt 4
drwxrwxr-x 2 masa     ftp_group   8 14. Jun 10:14 .
drwxr-xr-x 4 masa     masa       24  1. Dez 2010  ..
-rw------- 1 ftp_user ftp_group 270 14. Jun 10:14 KD1234567890123_1308039243.dat
masa@masa ~/ftp_share/Spital/In $ sudo cat KD1234567890123_1308039243.dat 
001:7601001000681
002:ORDERX
003:220
010:KD1234567890123_1308039243.dat
100:YWESEE
101:
201:CU
202:1234567890123
201:BY
202:1075
231:Hatapharm AG
237:61
238:16
250:ADE
251:1308039243
300:4
301:20110614
500:1
501:7680317060176
502:26203
520:10
521:PCE
540:2
541:20110614

Note

  • Looks good

Next

  • The case of no EAN-Code for the customer

Experiment

    def transmission_filename(user, order, flavor=BBMB::DEFAULT_FLAVOR)
      case flavor
      when 'astrazeneca'
        #"AZ#{user.value(:customer_id)}_#{order.uid}.dat1"
        "AZ#{user.value(:customer_ean13) || user.value(:customer_id)}_#{order.uid}.dat1"
      else
        #"KD#{user.value(:customer_id)}_#{order.uid}.dat"
        "KD#{user.value(:customer_ean13) || user.value(:customer_id)}_#{order.uid}.dat"
      end
    end
    def transmission_header(user, order)
      header1 = [
        "001:#{self::class::EPIN}",
        "002:ORDERX",
        "003:220",
        "010:#{transmission_filename(user, order)}",
        "100:YWESEE",
        "101:#{order.reference}",
        "201:CU",
        #"202:#{user.value(:customer_id)}",
        "202:#{user.value(:customer_ean13) || user.value(:customer_id)}",
        "201:BY",
        "202:1075",
        "231:#{user.value(:organisation)}",
      ]

Create a new kunde

 masa@masa ~/ftp_share/YWESEE/Out $ cat ywskund
 584674;584674;22;SD-Lie;;Hatapharm AG;;hoge hoge 11;;CH;8000;hogehoge;011 / 111 22 33;;;011 / 111 22 44;customer@ywesee.com;1234567890123;
 584675;584675;22;SD-Lie;;Hatakepharm AG;;hoge hoge 11;;CH;8000;hogehoge;011 / 111 22 33;;;011 / 111 22 44;customer2@ywesee.com;;

Run

  • update (bin/admin)
  • reboot bbmbd
  • order by the new customer without EAN-Code (on browser)

Result

 masa@masa ~/ftp_share/Spital/In $ sudo cat KD584675_1308040289.dat 
 001:7601001000681
 002:ORDERX
 003:220
 010:KD584675_1308040289.dat
 100:YWESEE
 101:
 201:CU
 202:584675
 201:BY
 202:1075
 231:Hatakepharm AG
 237:61
 250:ADE
 251:1308040289
 300:4
 301:20110614
 500:1
 501:7680317060176
 502:26203
 520:1
 521:PCE
 540:2
 541:20110614

Note

  • the customer_id (Kundennr) is used for the order

Run

  • order by a customer with EAN-Code

Result

 masa@masa ~/ftp_share/Spital/In $ ls -al
 insgesamt 8
 drwxrwxr-x 2 masa     ftp_group  16 14. Jun 10:47 .
 drwxr-xr-x 4 masa     masa       24  1. Dez 2010  ..
 -rw------- 1 ftp_user ftp_group 268 14. Jun 10:47 KD1234567890123_1308041255.dat
 -rw------- 1 ftp_user ftp_group 250 14. Jun 10:31 KD584675_1308040289.dat
 masa@masa ~/ftp_share/Spital/In $ sudo cat KD1234567890123_1308041255.dat 
 001:7601001000681
 002:ORDERX
 003:220
 010:KD1234567890123_1308041255.dat
 100:YWESEE
 101:
 201:CU
 202:1234567890123
 201:BY
 202:1075
 231:Hatapharm AG
 237:61
 238:1
 250:ADE
 251:1308041255
 300:4
 301:20110614
 500:1
 501:7680317060176
 502:26203
 520:1
 521:PCE
 540:2
 541:20110614 

Commit

Note

src/util/bbmbapp.rb#run_updater

UPDATE_HOUR = 1
next_run = Time.local(today.year, today.month, today.day, UPDATE_HOUR)

Check xmlconv process

Email

How is the data transferred to bbmb.ch from globopharm.xmlconv.bbmb.ch (these are the XML orders)? 

New Praeparate file update_swissmedic ch.oddb

Email

Check Process

module ODDB
  class SwissmedicPlugin < Plugin
    PREPARATIONS_COLUMNS = [ :iksnr, :seqnr, :name_base, :company,
      :index_therapeuticus, :atc_class, :production_science,
      :sequence_ikscat, :ikscat, :registration_date, :sequence_date,
      :expiry_date, :substances, :package_count, :package_sizes, :composition,
      :indication_registration, :indication_sequence ]
view · edit · sidebar · attach · print · history
Page last modified on June 15, 2011, at 03:51 PM