コード例 #1
0
def order_list(token_b):
    timeStamp = time.time()
    timeArray = time.localtime(timeStamp)
    queryDate = time.strftime("%Y-%m-%d", timeArray)
    url = MERCHANT_URL + '/order/list'
    data = {
        "listType": "EAT",
        "orderStoreId": "",
        "page": "1",
        "queryDate": queryDate,
        "rows": "40",
        "token": token_b,
        "userId": "729",
        "isTestUser": "******",
        "shopId": "10041",
        "storeId": "104"
    }
    data_eval = my_request(url, data)
    my_log.debug('B端堂食待出餐订单' + str(data_eval))
    res = {
        "orderItemIdList":
        data_eval['_data']['orderDTOList'][0]['id'],
        "shippingType":
        data_eval['_data']['orderDTOList'][0]['shippingType'],
        "orderStoreId":
        data_eval['_data']['orderDTOList'][0]['orderItemDTOList'][0]['id']
    }
    return res
コード例 #2
0
 def mysql_exec(self, sql1):
     self.cur.execute(sql1)
     # row_3 = cur.execute(sql1)
     # print(row_3)  # 影响行数
     # row_1 = cur.fetchone()  # 获取第一行数据
     # print(row_1)
     # row_n = cur.fetchmany(3)  # 获取前n行数据
     # print(row_n)
     row_data = self.cur.fetchall()  # 获取所有数据
     self.conn.commit()
     my_log.debug('MYSQL查询数据' + str(row_data))
     return row_data
コード例 #3
0
ファイル: run_offline.py プロジェクト: gaozuxin/earth_jiekou
 def test_order_offline_004(self):
     my_log.info('*****************************用例' +
                 sys._getframe().f_code.co_name +
                 '开始执行****************************')
     """
     1.下单前后验证线上库存;
     2.拣货前后验证临时区库存;
     3.揽件前后验证仓库库存;
     """
     # 查询原材料前仓减超卖库存
     sql0 = """select b.stock_value - a.stock_less FROM (select stock_less,stock_id stock_id_a from twms_stock where stock_id  in (
                 select twms_stock.stock_id from twms_stock where warehouse_id = 10056 and goods_sku_id in (18024,20930))) a,
               (select s.stock_value,s.stock_id stock_id_b from twms_stock_item s  where  warehouse_type = 240 and stock_id in 	(
                 select twms_stock.stock_id from twms_stock where warehouse_id = 10056 and goods_sku_id  in (18024,20930))) b 
               where a.stock_id_a = b.stock_id_b"""
     redis_stock0 = self.my_redis.get_redis(18022)
     my_log.debug('下单前redis线上库存' + str(redis_stock0))
     orderid = self.offline_order.create_18022()  # 闪电付下单
     time.sleep(2)
     redis_stock1 = self.my_redis.get_redis(18022)
     my_log.debug('下单后redis线上库存' + str(redis_stock1))
     self.assertEqual(110000,
                      redis_stock0 - redis_stock1,
                      msg="自营餐食计件生产加工商品线上库存扣减有误")
     # 获取堂食待出餐订单
     listdata = order_list(self.token_b)
     sql_data0 = self.my.mysql_exec(sql0)
     sku1_stock_warehouse0 = sql_data0[0][0]
     sku2_stock_warehouse0 = sql_data0[1][0]
     my_log.debug('B端确认出餐前原材料1、原材料2仓库实物库存%s,%s' %
                  (sku1_stock_warehouse0, sku2_stock_warehouse0))
     # 堂食订单确认出餐
     confirmMeal(self.token_b, listdata)
     time.sleep(2)
     sql_data1 = self.my.mysql_exec(sql0)
     sku1_stock_warehouse1 = sql_data1[0][0]
     sku2_stock_warehouse1 = sql_data1[1][0]
     my_log.debug('B端确认出餐后原材料1、原材料2仓库实物库存%s,%s' %
                  (sku1_stock_warehouse1, sku2_stock_warehouse1))
     self.assertEqual(33000,
                      sku1_stock_warehouse0 - sku1_stock_warehouse1,
                      msg="自营餐食计件生产加工拣货原材料18024库存扣减有误")
     self.assertEqual(44000,
                      sku2_stock_warehouse0 - sku2_stock_warehouse1,
                      msg="自营餐食计件生产加工拣货原材料20930库存扣减有误")
     # B端餐食堂食核销
     confirm_data = confirm(self.token_b, listdata)
     my_log.debug('B端核销后订单状态%s' % confirm_data)
     self.assertEqual(46, confirm_data, msg='自营餐食计件生产加工商品订单核销失败')
     my_log.info('*****************************用例' +
                 sys._getframe().f_code.co_name +
                 '执行结束****************************')
コード例 #4
0
def quickpayinfo(token_b, memberCode):
    url = MERCHANT_URL + '/verification/quickpayinfo'
    data = {
        "memberCode": memberCode,
        "autoPass": False,
        "checkDeviceNo": "729",
        "maxInterval": 60,
        "token": token_b,
        "userId": "729",
        "isTestUser": "******",
        "shopId": "10041",
        "storeId": "104"
    }
    data_eval = my_request(url, data)
    my_log.debug('闪电付待核销订单查询' + str(data_eval))
    return data_eval
コード例 #5
0
def confirmMeal(token_b, res_data):
    url = MERCHANT_URL + '/order/confirmMeal'
    data = {
        "orderItemIdList": [res_data["orderStoreId"]],
        "orderStoreId": res_data["orderItemIdList"],
        "shippingType": res_data["shippingType"],
        "userName": "******",
        "token": token_b,
        "userId": "729",
        "isTestUser": "******",
        "shopId": "10041",
        "storeId": "104"
    }
    data_eval = my_request(url, data)
    my_log.debug('B端确认出餐' + str(data_eval))
    return data_eval
コード例 #6
0
def quickpaycheck(token_b, orderId):
    url = MERCHANT_URL + '/verification/quickpaycheck'
    data = {
        "checkDeviceNo": "729",
        "orderId": orderId,
        "orderStoreId": "",
        "memberId": "1145",
        "token": token_b,
        "userId": "729",
        "isTestUser": "******",
        "shopId": "10041",
        "storeId": "104"
    }
    data_eval = my_request(url, data)
    my_log.debug('闪电付订单核销' + str(data_eval))
    return data_eval['_data']['checkResult']
コード例 #7
0
def confirm(token_b, res_data):
    url = MERCHANT_URL + '/verification/confirm'
    data = {
        "listType": "EAT",
        "storeOrderIdList": [res_data["orderItemIdList"]],
        "orderItemIdList": [res_data["orderStoreId"]],
        "shippingType": res_data["shippingType"],
        "token": token_b,
        "userId": "729",
        "isTestUser": "******",
        "shopId": "10041",
        "storeId": "104"
    }
    data_eval = my_request(url, data)
    my_log.debug('B端仅供堂食核销' + str(data_eval))
    res = data_eval["_data"]["orderDTOList"][0]["shipmentStatus"]
    return res
コード例 #8
0
ファイル: run_offline.py プロジェクト: gaozuxin/earth_jiekou
 def test_order_offline_002(self):
     my_log.info('*****************************用例' +
                 sys._getframe().f_code.co_name +
                 '开始执行****************************')
     """
     1.下单前后验证线上库存;
     2.拣货前后验证临时区库存;
     3.揽件前后验证仓库库存;
     """
     # 查询前仓减超卖库存
     sql0 = """select b.stock_value - a.stock_less FROM (select stock_less from twms_stock where stock_id  in (
                 select twms_stock.stock_id from twms_stock where warehouse_id = 10056 and goods_sku_id = 18025)) a,
               (select stock_value from twms_stock_item  where  warehouse_type = 240 and stock_id in 	(
                 select twms_stock.stock_id from twms_stock where warehouse_id = 10056 and goods_sku_id = 18025)) b """
     redis_stock0 = self.my_redis.get_redis(18025)
     my_log.debug('下单前redis线上库存' + str(redis_stock0))
     sql_data0 = self.my.mysql_exec(sql0)
     stock_warehouse0 = sql_data0[0][0]
     my_log.debug('下单前仓库实物库存' + str(stock_warehouse0))
     orderid = self.offline_order.create_18025()  # 闪电付下单
     time.sleep(2)
     redis_stock1 = self.my_redis.get_redis(18025)
     my_log.debug('下单后redis线上库存' + str(redis_stock1))
     sql_data1 = self.my.mysql_exec(sql0)
     stock_warehouse1 = sql_data1[0][0]
     my_log.debug('下单后仓库实物库存' + str(stock_warehouse1))
     self.assertEqual(110000,
                      redis_stock0 - redis_stock1,
                      msg="自营实物生产加工商品线上库存扣减有误")
     self.assertEqual(110000,
                      stock_warehouse0 - stock_warehouse1,
                      msg="自营实物计件生产加工下单实物库存扣减有误")
     # 获取会员码
     # member_code = get_member_code(self.token_c)
     # print(member_code)
     #核销闪电付订单
     res = quickpaycheck(self.token_b, orderid)
     self.assertEqual(1, res, msg='自营实物生产加工商品订单核销失败')
     my_log.info('*****************************用例' +
                 sys._getframe().f_code.co_name +
                 '执行结束****************************')