GuanyiErp

管易erp api

Installation

Add this line to your application's Gemfile:

gem 'guanyi-erp'

And then execute:

$ bundle

Or install it yourself as:

$ gem install guanyi-erp 

Usage

config/guanyi_erp.yml

development:
  app_key: testkey 
  secret: mySecret 
  session_key: mySessionKey 
  api_base_path: http://demo.guanyierp.com/erpapi/rest/erp_open
production:
  app_key: a
  secret: a
  session_key: b
  api_base_path: c
test:
  app_key: a
  secret: a
  session_key: b
  api_base_path: c

库存查询(gy.erp.stock.get)

GuanyiErp.api_erp_stock_get({item_code: 'mx1115', sku_code: 'mx115-BK'})

订单新增(gy.erp.trade.add)

GuanyiErp.api_erp_trade_add(
        {platform_code: '1', #平台订单号(必填防止重复导单)
         shop_code: 'UD', #ERP店铺编码
         express_code: 'EMS', #物流编码
         warehouse_code: 'C001c', #仓库编码
         cod: false, #是否货到付款
         vip_code: '001',
         deal_datetime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
         pay_datetime: Time.now.strftime('%Y-%m-%d %H:%M:%S'), #付款时间
         receiver_name: '木卯',
         receiver_address: '测试地址',
         receiver_mobile: '15201280641',
         receiver_phone: '15201280641',
         receiver_province: '河北省',
         receiver_city: '石家庄市',
         receiver_district: '桥东区',
         post_fee: 12, #物流费
         discount_fee: 5, #让利金额
         invoices: [],
         # payments: [{
         #                pay_type_code: '1012014021233754645',
         #                paytime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
         #                payment: 100.1,
         #                account: '',
         #                pay_code: ''
         #            }],
         details: [
             {
                 item_code: 'mx1115',
                 sku_code: 'mx115-BK',
                 price: '98',
                 qty: 2
             }
         ] #商品信息
        })

订单查询(gy.erp.trade.get)

 GuanyiErp.api_erp_trade_get({platform_code: '1',receiver_mobile:'15201280641'})

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/GuanyiErp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.