示例#1
0
def continually_create_self_operated_order(minute=1, thread_num="", count=10, interval="0.01"):
    """

    :param count:
    :param minute:持续时间
    :param thread_num: 线程名称
    :param interval: 创建运单时间间隔
    """
    client = KafkaClient(hosts=tmsBase.kafka_client)
    topic = client.topics[KafkaTopics.RAINBOW.value]
    duration = minute * 60
    start_time = datetime.now()
    end_time = datetime.now()
    length = 0

    print "Thread-%s begin batch create self operated orders" % thread_num
    with topic.get_producer() as producer:
        while (end_time - start_time).seconds < duration:
            length += InnerInvoker.create_self_operated_order(
                count=count, thread_no=thread_num, interval=interval, producer=producer
            )[1]
            end_time = datetime.now()
    print "Thread-%s totally created  %s self operated orders " % (thread_num, length)
from time import sleep
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..\\..\\..\\'))
from keywords.tms.interface.innerInvoker import InnerInvoker
from keywords.tms.base.baseInfo import BaseInfo
from keywords.tms.rainbow import RainbowFlow, RainbowUtil
from keywords.tms.express.expressFlow import ExpressFlow
from keywords.tms.express.expressUtil import ExpressUtil
from parameters.tms import tmsBase
from keywords.tms.interface.posInvoker import PosInvoker


__author__ = 'bida'

if __name__ == '__main__':
    order_ids = InnerInvoker.create_self_operated_order(count=2)[0]

    sleep(tmsBase.wait_time)

    if BaseInfo.get_distributor_id(account='ADMIN', distributor_short_name='autoexpress') == 0:
        obj = BaseInfo.get_subdistributor_id(subdistributor_short_name='autoexpress')
        delivery_dealer = obj[0] + '-' + obj[1]
    else:
        delivery_dealer = BaseInfo.get_distributor_id(account='ADMIN', distributor_short_name='autoexpress') + '-'

    RainbowFlow.sorting_forward_to_delivery_dealer(order_ids=order_ids,
                                                   delivery_dealer=delivery_dealer,
                                                   account='TIANJINSORTING')
    sleep(tmsBase.wait_time)
    ExpressFlow.express_delivery(target='2',
                                 order_ids=order_ids,
# -*- encoding:utf-8 -*-
import sys
# reload(sys)
# sys.setdefaultencoding('gbk')
import os

sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..\\..\\..\\'))
from keywords.tms.interface.innerInvoker import InnerInvoker

__author__ = 'bida'

if __name__ == '__main__':
    InnerInvoker.create_self_operated_order(count=sys.argv[1],
                                            entrepot_id=sys.argv[2],
                                            shipment_type=sys.argv[3],
                                            receive_street_id=sys.argv[4],
                                            distributor=sys.argv[5].decode('gbk'),
                                            armoney=sys.argv[6],
                                            order_type=sys.argv[7],
                                            pay_id=sys.argv[8],
                                            send_city=sys.argv[9])