# -*- encoding=utf8 -*-
from common.fileUtls import FileUtils

__author__ = "xiaohesheng"

"""
case_tag:api,mdm-web,b19供货目录申请_客户类型_医院_提交供货申请单_搜索产品,id2255,id2255-19,sit,on
主数据平台:b19供货目录申请_客户类型_医院_提交供货申请单_搜索产品 
"""

from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from airtest.core.api import using
import sys
module = "a4_mdm3_cm"
def submitSupplyRelation_reject():
    module = "a4_mdm3_cm"
    pro_path = commonFuc().get_pro_path()
    sys.path.append(pro_path + r'\\air_case\\a4_mdm3_cm\\b17供货目录申请_客户类型_医院_企业账号登录.air')
    using(pro_path + r'\\air_case\\a4_mdm3_cm\\b17供货目录申请_客户类型_医院_企业账号登录.air')
    from b17供货目录申请_客户类型_医院_企业账号登录 import e_login
    token, projectCode, uxid, corpId, e_name = e_login()
    print(token, projectCode, uxid, corpId, e_name)

    sys.path.append(pro_path + r'\\air_case\\a4_mdm3_cm\\b10供货关系审核_驳回_客户类型_医院_医院账号登录.air')
    using(pro_path + r'\\air_case\\a4_mdm3_cm\\b10供货关系审核_驳回_客户类型_医院_医院账号登录.air')
    from b10供货关系审核_驳回_客户类型_医院_医院账号登录 import h_login
    h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login()
    print(h_token, h_projectCode, h_uxid, h_corpId, h_name)
    print("===================================================")
    """
     场景:b19供货目录申请_客户类型_医院_提交供货申请单_搜索产品
     用例名称：b19供货目录申请_客户类型_医院_提交供货申请单_搜索产品
     输入：医院id
     输出："rtn_msg": 0
    """
    #b19供货目录申请_客户类型_医院_提交供货申请单_搜索产品
    module = "mdm3_cm"
    url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVo_url")
    # 获取请求头信息
    headers = commonFuc().get_business_data(module, "json_headers2",
                                            commonFuc().get_business_data(module, "json_contentType"), token,
                                            projectCode)
    contactUser=commonFuc().randomString(5)
    contactWay=contactUser
    request_body = commonFuc().get_business_data(module, "payload9", h_corpId,corpId)
    print('request_body',request_body)
    # 发送请求
    result = commonFuc().http_post(url, request_body, headers)
    print('result', result)
    #断言
    checkDict=commonFuc().get_business_data(module,'checkDict4')
    commonFuc().check_result(checkDict,result)
submitSupplyRelation_reject()

