def get_test_code():
    """
    获取验证码
    :return:
    """
    con, curs = cit()
    try:
        #select a.send_content from xdw_app.sa_sms a where a.create_time<trunc(sysdate+1) order by a.create_time desc
        sql = [
            '''
 SELECT a.send_content FROM xdw_app.sa_sms a WHERE a.create_time<trunc(sysdate+1)
 AND  a.mobile_no='enc_23EB56B76F418687F02A9137C891FCE3'ORDER BY a.create_time DESC '''
        ]
        for sql1 in sql:
            curs.execute(sql1)
            cur = curs.fetchone()
            a = str(cur)
            import re
            line = re.findall(r"\d+\.?\d*", a)
            close_oracle(con, curs)
            print(line[0])
            return line[0]
    except Exception as e:
        print(e)
        close_oracle(con, curs)
Beispiel #2
0
    def _get_long_card_position(user_id, card_name):
        card_list = []
        # con, curs = cit()
        # con, curs = basic_sit()
        if get_env_script_runs_on().lower() == 'cit':
            con, curs = cit()
        else:
            con, curs = sit()
        try:
            sql = ''' select card_name from xdw_app.v_feature_card v  where 1=1 and owner_bu_id =
            (select h.creator_ukid from xdw_app.hm_creator_relation h where h.participant_ukid = '%s')
            and receiver_id='%s' and client_show >=0 order by card_name''' % (
                user_id, user_id)
            curs.execute(sql)
            result = curs.fetchall()
            for r in result:
                card_list.append(r[0])
            try:
                position = card_list.index(card_name) + 1
            except Exception as e:
                print(e, 'Get Card List fail.')
                raise GetCardListFailureException
            return position

        except Exception as e:
            print('获取长期卡片出错')
            print(e)
            close_oracle(con, curs)
Beispiel #3
0
def two_commodity_not_deliver():    # 俩商品无需发货
    con, curs = cit()
    sql = ['''delete from xdw_app.im_platform_item t where t.sku_num_id in (3103351104677,3103351104877)''',
           '''insert into xdw_app.im_platform_item (PLATFORM_ITEM_UKID, PLATFORM_ID, SHOP_ID, OWNER_ID, IDENTIFY_CODE,
IDENTIFY_UKID, ITEM_STATUS, PRODUCT_NUM_ID, PRODUCT_OUTER_ID, SKU_NUM_ID, SKU_OUTER_ID, PRODUCT_TITLE, SKU_NAME,
SELL_PRICE, PLATFORM_IMG_URL, BRAND_NAME, CATEGORY, CREATE_TIME, CREATE_USER_ID, UPDATE_TIME, UPDATE_USER_ID,
ITEM_COUNT)values ('51768000000008002', '10', '251627', '251627', '34143554352kz7206002110', '51768800000008007',
'30', '1489161932', '34143554352', '3103351104677', 'kz7206002110',
'宝宝蝴蝶结打底裙裤 2016秋季女童童装 儿童长裤打底裤女 kz-7206', null, '0',
'http://img03.taobao.net/bao/uploaded/i3/T1HXdXXgPSt0JxZ2.8_070458.jpg', null, null,
to_date('03-11-2016 20:10:05', 'dd-mm-yyyy hh24:mi:ss'), '199284',
to_date('03-11-2016 20:10:05', 'dd-mm-yyyy hh24:mi:ss'), null, '8888')''',
           '''insert into xdw_app.im_platform_item (PLATFORM_ITEM_UKID, PLATFORM_ID, SHOP_ID, OWNER_ID, IDENTIFY_CODE,
IDENTIFY_UKID, ITEM_STATUS, PRODUCT_NUM_ID, PRODUCT_OUTER_ID, SKU_NUM_ID, SKU_OUTER_ID, PRODUCT_TITLE, SKU_NAME,
SELL_PRICE, PLATFORM_IMG_URL, BRAND_NAME, CATEGORY, CREATE_TIME, CREATE_USER_ID, UPDATE_TIME, UPDATE_USER_ID,
ITEM_COUNT)values ('51768200000009001', '10', '251627', '251627', '34143000001kz7206002111', '51768900000008006', '30',
'8888800001', '34143000001', '3103351104877', 'kz7206002111', '宝宝尿不湿 儿童长裤打底裤女 kz-7206', null, '0',
'http://taobao.net/bao/uploaded/i0.jpg', null, null, to_date('03-11-2016 20:10:05', 'dd-mm-yyyy hh24:mi:ss'), '199284',
to_date('03-11-2016 20:10:06', 'dd-mm-yyyy hh24:mi:ss'), null, '9999')
''']
    for sql1 in sql:
        curs.execute(sql1)
        con.commit()
    close_oracle(con, curs)
    pass
Beispiel #4
0
def delete_warehouse_card(user_id=None):
    try:
        con, curs = cit()
        sql = [  # 恢复激活实体店的输入项
            '''update xdw_app.ts_operation t set t.status = '0' where t.operation_name = '激活仓库' and
t.owner_bu_id = '%s' ''' % user_id,
            '''update xdw_app.ms_card t set t.status = '0' where t.card_name = '激活仓库' and
t.owner_bu_id = '%s' ''' % user_id,
            '''update xdw_app.cm_participant_relation t set t.relation_status = '20'
where t.ppt_relation_ukid =(select t.receiver_id from xdw_app.ms_card t where t.owner_bu_id = '%s' and
t.card_name = '激活仓库' )''' % user_id,
            '''delete from xdw_app.im_item_area t where t.building_ukid =
(select t.warehouse_building_ukid from xdw_app.ba_warehouse_building t where t.item_ukid =
(select t.item_ukid from xdw_app.IM_ITEM t where t.create_user_id = '%s' and t.item_type =  '仓库'))'''
            % user_id,
            '''delete from xdw_app.IM_ITEM_ADDRESS t where t.building_ukid =
(select t.warehouse_building_ukid from xdw_app.ba_warehouse_building t where t.item_ukid =
(select t.item_ukid from xdw_app.IM_ITEM t where t.create_user_id = '%s' and t.item_type =  '仓库'))'''
            % user_id,
            '''delete from xdw_app.im_warehouse_item t where t.item_ukid =
(select t.item_ukid from xdw_app.IM_ITEM t where t.create_user_id = '%s' and t.item_type =  '仓库')'''
            % user_id,
            '''delete from xdw_app.dd_resources_cost t where t.item_ukid =
(select t.item_ukid from xdw_app.IM_ITEM t where t.create_user_id = '%s' and t.item_type =  '仓库')'''
            % user_id
        ]
        for sql1 in sql:
            curs.execute(sql1)
            con.commit()
        close_oracle(con, curs)
        print('恢复仓库原始状态成功,不含杂质\n')
    except Exception as e:
        print(e)
Beispiel #5
0
def commodity_none():   # 商品都未铺货
    con, curs = cit()
    sql = ['''delete from xdw_app.im_platform_item t where t.sku_num_id in (3103351104677,3103351104877)''']
    curs.execute(sql)
    con.commit()
    close_oracle(con, curs)
    pass
Beispiel #6
0
def delete_bound_printer(user_id=10001646):
    con, curs = cit()
    try:
        sql = '''delete from xdw_app.Dm_Binding_Device where ppt_ukid = '%s' ''' % user_id
        curs.execute(sql)
        con.commit()

    except Exception as e:
        print('删除绑定的打印机失败')
        print(e)
        close_oracle(con, curs)
Beispiel #7
0
def create_and_buyer_order_one_commodity():    # 创建订单、买家待付款
    dic = {'1': '130', '0': '100'}
    con, curs = cit()
    sql = ['''select t.origin_trade_status from xdw_app.se_taobao_trade t where t.order_id = '2313605630412700' ''',
           '''select t.origin_order_status from xdw_app.se_taobao_item t where t.trade_ukid =
(select trade_ukid from xdw_app.se_taobao_trade where se_taobao_trade.order_id = '2313605630412700' )''']
    a = len(sql) - 1
    for sql1 in sql:
        curs.execute(sql1)
        status = curs.fetchone()
        assert_equal(int(status[0]), int(dic[str(a)]))
        a -= 1
Beispiel #8
0
def get_bound_printer_info(user_id=10001646):
    con, curs = cit()
    try:
        sql = '''select identify_code from xdw_app.cm_Identify_Relation c where c.identify_relation_ukid in
                 (select t.active_device_ukid from Dm_Binding_Device t where t.PPT_UKID = '%s')''' % user_id
        curs.execute(sql)
        result = curs.fetchall()
        return result[0][0]
    except Exception as e:
        print('获取绑定的打印机信息失败')
        print(e)
        close_oracle(con, curs)
Beispiel #9
0
    def operation_bank_verification(self, admin=None):
        con, curs = cit()
        sql = '''select t.verification_code from xdw_app.cm_verification t where t.business_type = 'BANK'
and t.user_id = '%s' and t.status = 1''' % admin
        curs.execute(sql)
        number = curs.fetchone()
        close_oracle(con, curs)
        print(number)
        self.action.click(self.click_get_verification_code_locatot)
        self.action.set_value(number)
        self.action.click(self.click_next_button_locator)
        pass
Beispiel #10
0
def close_order():  # 关闭订单 所有的关闭都是不生成契约
    dic = {'1': '400', '0': '400'}
    con, curs = cit()
    sql = ['''select t.origin_trade_status from xdw_app.se_taobao_trade t where t.order_id = '2313605630412700' ''',
           '''select t.origin_order_status from xdw_app.se_taobao_item t where t.trade_ukid =
(select trade_ukid from xdw_app.se_taobao_trade where se_taobao_trade.order_id = '2313605630412700' )''']
    a = len(sql) - 1
    for sql1 in sql:
        curs.execute(sql1)
        status = curs.fetchone()
        assert_equal(int(status[0]), int(dic[str(a)]))
        a -= 1
        pass
def delete_address(user_id=None):
    try:
        con, curs = cit()
        sql = [  # 恢复激活实体店的输入项
            '''delete from xdw_app.TM_DELIVERY_ADDRESS t
where t.address_owner_ukid='%s' and t.address_nick_name='pd' ''' % user_id
        ]
        for sql1 in sql:
            curs.execute(sql1)
            con.commit()
        close_oracle(con, curs)
        print('恢复管理收货地址原始状态成功,不含杂质\n')
    except Exception as e:
        print(e)
Beispiel #12
0
def order_contract_content():    # 契约内容
    try:
        con, curs = cit()
        sql = '''select item_status  from xdw_app.dd_contract_item t where t.contract_ukid =
(select t.contract_ukid from xdw_app.dd_contract t where t.contract_id = '2313605630412700')'''
        curs.execute(sql)
        con.commit()
        status = curs.fetchone()
        print (status[0])
        assert status[0] == 10
        close_oracle(con, curs)
    except Exception as e:
        print ('ERROR:创建契约内容不为10\n')
        print (e)
Beispiel #13
0
def finish_order_two_commodity():     # 交易完成
    dic = {'3': '200', '2': '200', '1': '30', '0': '30'}
    con, curs = cit()
    sql = ['''select t.origin_trade_status from xdw_app.se_taobao_trade t where t.order_id = '2313605630412700' ''',
           '''select t.origin_order_status from xdw_app.se_taobao_item t where t.trade_ukid =
(select trade_ukid from xdw_app.se_taobao_trade where se_taobao_trade.order_id = '2313605630412700' )''',
           '''select t.contract_status from xdw_app.dd_contract t where t.contract_id = '2313605630412700' ''',
           '''select item_status  from xdw_app.dd_contract_item t where t.contract_ukid =
(select t.contract_ukid from xdw_app.dd_contract t where t.contract_id = '2313605630412700')''']
    a = len(sql) - 1
    for sql1 in sql:
        curs.execute(sql1)
        status = curs.fetchone()
        assert_equal(int(status[0]), int(dic[str(a)]))
        a -= 1
Beispiel #14
0
def delete_supply_card(user_id=None):  # 删除仓储需求、仓储供给、运输供应卡片
    try:
        con, curs = cit()
        sql = [
            '''delete from xdw_app.ms_card t where t.owner_bu_id = '%s' and t.card_name =
               '发布仓储供应' ''' % user_id,
            '''delete from xdw_app.ms_card t where t.owner_bu_id = '%s' and t.card_name =
               '发布供货供应' ''' % user_id,
            '''delete from xdw_app.ms_card t where t.owner_bu_id = '%s' and t.card_name =
               '发布运输供应' ''' % user_id
        ]
        for sql1 in sql:
            curs.execute(sql1)
            con.commit()
        close_oracle(con, curs)
        print('删除供应卡片\n')
    except Exception as e:
        print(e)
Beispiel #15
0
def delete_customer_card(user_id=199251):
    try:
        con, curs = cit()
        sql = [
            '''delete from xdw_app.ms_card t
                  where t.owner_bu_id = '%s' and t.card_name = '确定被服务的服务类型' '''
            % user_id,
            '''update xdw_app.ts_operation t set t.status = '0' where t.operation_name = '确定需要的服务类型'
                  and t.owner_bu_id = '%s' ''' % user_id,
            '''update xdw_app.ms_card t set t.status = '0' where t.card_name = '确定需要的服务类型'
                  and t.owner_bu_id = '%s' ''' % user_id,
            '''update xdw_app.cm_participant_relation t set t.relation_status = '20'where t.ppt_relation_ukid =
                (select t.receiver_id from xdw_app.ms_card t where t.owner_bu_id = '%s' and t.card_name =
                '确定需要的服务类型' )''' % user_id
        ]
        for sql1 in sql:
            curs.execute(sql1)
            con.commit()
        close_oracle(con, curs)
        print('删除我要客户卡片\n')
    except Exception as e:
        print(e)
Beispiel #16
0
def delete_business_framework(admin=None):
    try:
        con, curs = cit()
        sql = [
            '''update xdw_app.ms_card f set f.status=0 where
f.create_user_id='%s' and f.card_name='业务框架任务' ''' % admin,
            '''update xdw_app.ms_card f set f.status=0 where
f.create_user_id='%s' and f.card_name='业务框架任务' ''' % admin,
            '''delete from xdw_app.cm_participant_relation t where t.ppt_relation_ukid in
(select f.receiver_id from xdw_app.ms_card f where f.create_user_id='%s' and f.card_name='签订系统服务契约')'''
            % admin,
            '''update xdw_app.cm_participant_relation t set t.relation_status = '20' where t.ppt_relation_ukid =
(select t.receiver_id from xdw_app.ms_card t where t.owner_bu_id ='%s' and t.card_name = '业务框架任务' )'''
            % admin,
            '''delete from xdw_app.cm_participant_relation t where t.ppt_relation_ukid in
(select f.receiver_id from xdw_app.ms_card f where f.create_user_id='%s' and f.card_name='签订系统服务契约')'''
            % admin,
            '''delete from xdw_app.ts_operation t where
t.create_user_id='%s' and t.operation_name='签订系统服务契约' ''' % admin,
            '''delete from xdw_app.ms_card t where t.create_user_id='%s' and t.card_name='签订系统服务契约' '''
            % admin,
            '''delete from xdw_app.dd_contract t where t.create_user_id='%s' '''
            % admin,
            '''delete from xdw_app.ST_META_INVENTORY t where t.owner_id='%s' '''
            % admin,
            '''delete from xdw_app.CM_PARTICIPANT t where t.create_user_id='%s' and t.status=2 '''
            % admin,
            '''delete from xdw_app.RU_business_framework t where t.owner_id='%s' '''
            % admin,
            '''delete from xdw_app.ru_operation_log t where t.log_user_id='%s' '''
            % admin
        ]
        for sql1 in sql:
            curs.execute(sql1)
            con.commit()
            close_oracle(con, curs)
        print("业务架构任务恢复成功!!!")
    except Exception as e:
        print(e)
Beispiel #17
0
def delete_all():  # 恢复数据
    con, curs = cit()
    sql = ['''delete from xdw_app.se_taobao_item t where t.trade_ukid =
(select trade_ukid from xdw_app.se_taobao_trade where se_taobao_trade.order_id = '2313605630412700')''',
           '''delete from xdw_app.se_taobao_trade t where t.order_id = '2313605630412700' ''',
           '''delete from xdw_app.cm_address where cm_address.contract_ukid =
(select t.contract_ukid from xdw_app.dd_contract t where t.contract_id = '2313605630412700')''',
           '''delete from xdw_app.dd_obligation where dd_obligation.contract_ukid =
(select t.contract_ukid from xdw_app.dd_contract t where t.contract_id = '2313605630412700')''',
           '''delete from xdw_app.dd_unit_price where dd_unit_price.contract_ukid =
(select t.contract_ukid from xdw_app.dd_contract t where t.contract_id = '2313605630412700')''',
           '''delete from xdw_app.dd_fee_amount where dd_fee_amount.contract_ukid =
(select t.contract_ukid from xdw_app.dd_contract t where t.contract_id = '2313605630412700')''',
           '''delete from xdw_app.dd_fee_add_item where dd_fee_add_item.contract_ukid =
(select t.contract_ukid from xdw_app.dd_contract t where t.contract_id = '2313605630412700')''',
           '''delete from xdw_app.dd_contract_item where dd_contract_item.contract_ukid =
(select t.contract_ukid from xdw_app.dd_contract t where t.contract_id = '2313605630412700')''',
           '''delete from xdw_app.dd_contract t where t.contract_id = '2313605630412700' ''']
    for sql1 in sql:
        curs.execute(sql1)
        con.commit()
    close_oracle(con, curs)
    pass
Beispiel #18
0
def delete_entity_shop(user_id=None):
    try:
        con, curs = cit()
        sql = [  # 恢复激活实体店的输入项
            '''update xdw_app.ms_card t set t.card_step = '0' where t.card_ukid =
(select t.card_ukid from xdw_app.ms_card t where t.owner_bu_id = '%s' and t.card_name = '激活实体店')'''
            % user_id,
            '''delete from xdw_app.im_item_area t where t.building_ukid = (select t.sales_building_ukid
from basic_owner.ba_sales_building t where t.item_ukid =(select t.item_ukid from basic_owner.IM_ITEM t where
t.create_user_id = '%s'  and t.item_type = '实体店'))''' % user_id,
            '''delete from xdw_app.IM_ITEM_ADDRESS t where t.building_ukid = (select t.sales_building_ukid
            from basic_owner.ba_sales_building t where t.item_ukid =(select t.item_ukid from basic_owner.IM_ITEM t where
            t.create_user_id = '%s'  and t.item_type = '实体店'))''' % user_id,
            '''delete from basic_owner.IM_ITEM t where t.create_user_id = '%s'  and t.item_type = '实体店' '''
            % user_id
        ]
        for sql1 in sql:
            curs.execute(sql1)
            con.commit()
        close_oracle(con, curs)
        print('恢复实体店原始状态成功,不含杂质\n')
    except Exception as e:
        print(e)
Beispiel #19
0
def delete_commodity2(user_id=None):
    try:
        con, curs = cit()
        sql = [
            '''delete from xdw_app.cm_identify_item t where t.participant_ukid = '%s' and t.issue_party =
                  '商家' ''' % user_id,  # 上传的信息
            '''update xdw_app.ts_operation t set t.status = '0' where t.operation_name = '激活商品'
                  and t.owner_bu_id =  '%s' ''' % user_id,
            '''update xdw_app.ts_operation t set t.status = '0' where t.operation_name = '激活商品'
                  and t.owner_bu_id = '%s' ''' % user_id,
            '''update xdw_app.ms_card t set t.status = '0' where t.card_name = '激活商品'
                  and t.owner_bu_id = '%s' ''' % user_id,
            '''update xdw_app.cm_participant_relation t set t.relation_status = '20'
                  where t.ppt_relation_ukid = (select t.receiver_id from xdw_app.ms_card t
                  where t.owner_bu_id = '%s' and t.card_name = '激活商品' )''' %
            user_id
        ]
        for sql1 in sql:
            curs.execute(sql1)
            con.commit()
        close_oracle(con, curs)
        print('恢复激活商品\n')
    except Exception as e:
        print(e)