def delete_entity_shop(user_id=None): try: con, curs = sit() sql = [ # 恢复激活实体店的输入项 '''delete from xdw_app.ms_card t where t.card_step = '1' and t.owner_bu_id= '%s' ''' % 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 = 'PHY_STORE'))''' % 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 = 'PHY_STORE'))''' % user_id, '''delete from xdw_app.IM_ITEM t where t.create_user_id = '%s' and t.item_type = 'PHY_STORE' ''' % user_id, '''delete from xdw_app.ba_shop t where t.create_user_id='%s' ''' % user_id, '''delete from xdw_app.ms_card t where t.owner_bu_id = '%s' and t.card_name = '激活实体店' and t.card_step='3' ''' % user_id ] for sql1 in sql: curs.execute(sql1) con.commit() close_oracle(con, curs) print('恢复实体店原始状态成功,不含杂质\n') except Exception as e: print(e)
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)
def one_commodity_not_deliver(): con, curs = sit() 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', '90', '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
def activation_depot_status(admin=None): con, curs = sit() sql = '''select t.client_show from xdw_app.ms_card t where t.owner_bu_id = '%s'and t.card_name = '激活仓库' ''' % admin curs.execute(sql) status = curs.fetchone() print(status[0]) assert_equal(status[0], 1) close_oracle(con, curs) pass
def register_suppliers_sql(user_id): try: con, curs = sit() sql = [ '''delete from XDW_APP.ts_registered_supplier t where t.create_user_id='%s' ''' % user_id ] for sql1 in sql: curs.execute(sql1) con.commit() close_oracle(con, curs) print('数据删除成功') except Exception as e: print(e)
def delete_commodity(user_id=None): try: con, curs = sit() sql = ['''delete from xdw_app.cm_identify_relation t where t.issue_party='%s' and t.identify_type='ITEM_CODE' ''' % 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)
def delete_entity_shop(admin=None): try: con, curs = sit() sql = [ # 恢复激活实体店的输入项 '''update xdw_app.ts_operation t set t.status = '0' where t.operation_name = '导入历史采购单' and t.owner_bu_id = '%s' ''' % admin, '''update xdw_app.ms_card t set t.status = '0' where t.card_name = '导入历史采购单' and t.owner_bu_id = '%s' ''' % 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, '''update xdw_app.ts_operation t set t.status = '0' where t.operation_name = '激活实体店' and t.owner_bu_id = '%s' ''' % admin, '''update xdw_app.ms_card t set t.status = '0' where t.card_name = '激活实体店' and t.owner_bu_id = '%s' ''' % 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, '''update xdw_app.ms_card t set t.card_step = '' where t.card_ukid =(select t.card_ukid from xdw_app.ms_card t where t.owner_bu_id = '%s' and t.card_name = '激活实体店')''' % admin, '''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 = '实体店'))''' % admin, '''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 = '实体店'))''' % admin, '''delete from basic_owner.IM_ITEM t where t.create_user_id = '%s' and t.item_type = '实体店' ''' % admin, '''delete from xdw_app.ba_shop t where t.shop_name = '店大欺人' ''' # '''delete from xdw_app.ts_tc_relation t where t.sn = # (select t.operation_ukid||'-UploadPurchaseExcel' from # (select to_char(t.operation_ukid) operation_ukid from xdw_app.ts_operation t # where t.owner_bu_id = '%s' and t.operation_type = 'PhysicalStoreService' )t) ''' % admin ] for sql1 in sql: curs.execute(sql1) con.commit() close_oracle(con, curs) print('恢复实体店原始状态成功,不含杂质\n') except Exception as e: print(e)
def delete_depot_card(admin=None): try: con, curs = sit() sql = [ # 恢复激活仓库的输入项 '''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 = 'STOCK'))''' % admin, '''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 = 'STOCK'))''' % admin, '''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 = 'STOCK')''' % admin, '''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 = 'STOCK')''' % admin, '''delete from xdw_app.IM_ITEM t where t.create_user_id = '%s' and t.item_type = 'STOCK' ''' % admin ] for sql1 in sql: curs.execute(sql1) con.commit() close_oracle(con, curs) print('恢复仓库原始状态成功,不含杂质\n') except Exception as e: print(e)