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

__author__ = "xiaohesheng"

"""
case_tag:api,mdm-web,产品信息审核_获取产品详情信息,id2251,id2251-6,sit,on
主数据平台:产品信息审核_获取产品详情信息
"""
module = "mdm3_pim"
from common.common_func import commonFuc, using
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
pro_path=commonFuc().get_pro_path()
# sys.path.append(pro_path+r'\\air_case\\mdm3_pim\\a3产品信息审核_查询.air')
# using(pro_path+r'\\air_case\\mdm3_pim\\a3产品信息审核_查询.air')
# from a3产品信息审核_查询 import *
sys.path.append(pro_path+r'\\air_case\\mdm3_pim\\a5产品信息审核_锁定后查询.air')
using(pro_path+r'\\air_case\\mdm3_pim\\a5产品信息审核_锁定后查询.air')
from a5产品信息审核_锁定后查询 import *

"""
 场景:产品信息审核_锁定后查询
 用例名称：产品信息审核_锁定后查询
 输入：无
 输出："rtn_msg": "ok"
"""
# 登录
username = global_var_cname
password = commonFuc().get_business_data(module, "password")
print(username, password)
# 获取token和projectCode
token, projectCode, uxid, corpId,info = login_system(username, password).get_token()
# 产品信息审核查询
module = "mdm3_pim"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "getGoodsRegistBillDetail_url")
GRBid=global_var_GRBid
url = url + GRBid + "/1"
print('url', url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
                                        commonFuc().get_business_data(module, "json_contentType"), token,
                                        projectCode)

# 发送请求
result = commonFuc().http_get(url, headers)
# print('产品锁定后查询获取必要信息', result)
# print('data',data)
goodsRegistVO_id = commonFuc().analysis_json('id', commonFuc().analysis_json('goodsRegistVO',
                                                                             commonFuc().analysis_json('data', result)))
print('goodsRegistVO_id', goodsRegistVO_id)

goodsName = global_var_p_name
goodsMfrsId = commonFuc().analysis_json('goodsMfrsId', commonFuc().analysis_json('goodsRegistVO',
                                                                                 commonFuc().analysis_json('data',
                                                                                                           result)))
corpId = commonFuc().analysis_json('corpId', commonFuc().analysis_json('goodsRegistVO',
                                                                       commonFuc().analysis_json('data', result)))
registrationRegistVO_id = commonFuc().analysis_json('id', commonFuc().analysis_json('registrationRegistVO',
                                                                                    commonFuc().analysis_json('data',
                                                                                                              result)))
goodsSpecsRegistVOList_id = commonFuc().analysis_json('id', commonFuc().analysis_json('goodsSpecsRegistVOList',
                                                                                      commonFuc().analysis_json('data',
                                                                                                                result)))
print(goodsRegistVO_id, goodsMfrsId, corpId, registrationRegistVO_id, goodsSpecsRegistVOList_id)
#断言
commonFuc().check_text_exist(goodsName,result)