Commit c1af44ea authored by xiao-hesheng's avatar xiao-hesheng
Browse files

优化脚本

parent a1410f35
......@@ -19,7 +19,7 @@ case_tag:api,herp-web,g2_18审批中心_列表查询,id2263,id2263-79,sit,on
from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "b2_herp3_bs"
def test1():
def test1(type=1):
"""
场景:g2_18审批中心_列表查询
用例名称:g2_18审批中心_列表查询
......
......@@ -132,6 +132,63 @@ def test1():
else:
commonFuc().check_text_exist('error', result)
def approval_center():
module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "apprCenter_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# 请求体
request_body = commonFuc().get_business_data(module, "payload50_6")
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', result)
data1 = commonFuc().analysis_json('data', data)
commonFuc().check_text_exist(0, result)
taskId = commonFuc().analysis_json('taskId', data1[0])
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "approvalBatch_url")
# 请求体
request_body = commonFuc().get_business_data(module, "payload50_7", taskId)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', result)
if code >= 0:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
def get_GoodsPkgDef(hosGoodsId):
# 获取院区产品id==================开始
......@@ -199,12 +256,20 @@ def get_GoodsPkgDef(hosGoodsId):
info = (unitPackageid, unitPackageid)
titlename = ('unitPackageid1', 'unitPackageid2')
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '产品包装信息', titlename, 'message6')
try:
# 获取低值的hosGoodsId
hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
get_GoodsPkgDef(hosGoodsId) # 获取单元包id
except:
print('流程五获取hosGoodsId出现错误,请检查数据')
test1()
# try:
# # 获取低值的hosGoodsId
# hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
# get_GoodsPkgDef(hosGoodsId) # 获取单元包id
# except:
# print('流程五获取hosGoodsId出现错误,请检查脚本或者数据')
# try:
# test1()
# except:
# print('采购计划提交出现错误,请检查脚本或者数据')
#审批
execute_command("python runner_test.py tag id2263-80 debug sit")
\ No newline at end of file
try:
approval_center()
except Exception as e:
print('审批采购计划出现错误,请检查脚本或者数据')
print("发生异常:", str(e))
\ No newline at end of file
# -*- encoding=utf8 -*-
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-core,a_a5流程五_中心库入库结算_正结算,id2302,id2302-5,sit,on
主数据平台:a_a5流程五_中心库入库结算_正结算
"""
from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
import time
module = "b5_spd3_core_business_flow"
def login():
module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
return token, projectCode, uxid, corpId, info
# 登录获取用户id等信息,使用创建的用户登录============结束
# 采购计划_低值
def test1():
module = "b3_herp3_purchase"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束
# 获取暂存的单号=======================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "herpService_purPlan_insert_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
print('headers', headers)
hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
pkgDefId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品包装信息', 'message6')["unitPackageid1"]
# 获取院区id
branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
hosId = branch_id[0:5]
deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"]
hospital_name = commonFuc().get_business_data(module, 'hospital_name')
areaCode = FileUtils().r_info8('b2_herp3_bs', 'shelfinfo', 'message7')["shelfCode"]
areaName = FileUtils().r_info8('b2_herp3_bs', 'shelfinfo', 'message7')["areaName"]
recUser = uxid
# # 请求体
request_body = commonFuc().get_business_data(module, "payload1_1_1", hosGoodsId, pkgDefId, hosId, branch_id,
hospital_name, deptid1, deptid1, areaCode, areaName, recUser)
print('request_body', request_body)
# new_request_body = request_body.replace("'", '"')
# new_request_body = new_request_body.replace("None", 'null')
# # print(new_request_body)
# import json
# request_body_json = json.loads(new_request_body)
# print('request_body_json', request_body_json)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
pid = commonFuc().analysis_json('data', result) # 采购计划号
# 获取暂存的单号==========================================================
# 获取采购计划详情中的id
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "herpService_purPlan_listVo_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
print('headers', headers)
# # 请求体
request_body = commonFuc().get_business_data(module, "payload11", pid)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
data = commonFuc().analysis_json('data', result)
id1 = commonFuc().analysis_json('id', data[0])
orderNo = commonFuc().analysis_json('orderNo', data[0])
print('orderNo',orderNo)
titlename=('orderNo1','orderNo2')
info=(orderNo,orderNo)
FileUtils().w_info8(info,'b5_spd3_core_business_flow', '采购计划单号', titlename, 'message7')
# =====================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "herpService_purPlan_submitPurPlan_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
print('headers', headers)
provId = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"]
provName = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"]
subProvId = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"]
subProvName = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"]
# # 请求体
request_body = commonFuc().get_business_data(module, "payload12_1_1", pid, id1, provId, provName, subProvId,
subProvName, hosGoodsId, pkgDefId)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultbbbbbbbbbbbbbbbbbbbb', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
if code == 0 and data == None:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
def approval_center():
module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "apprCenter_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# 请求体
request_body = commonFuc().get_business_data(module, "payload50_6")
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', result)
data1 = commonFuc().analysis_json('data', data)
commonFuc().check_text_exist(0, result)
taskId = commonFuc().analysis_json('taskId', data1[0])
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "approvalBatch_url")
# 请求体
request_body = commonFuc().get_business_data(module, "payload50_7", taskId)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', result)
if code >= 0:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
def get_GoodsPkgDef(hosGoodsId):
# 获取院区产品id==================开始
module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录===========结束
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "mcmsBranchGoodsInfo_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# 获取院区id
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
hos_id = branch_id[0:5]
print(hos_id)
# hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
GoodsId = hosGoodsId.replace(hos_id, '')
print(GoodsId)
deptid1 = FileUtils().r_info8(module, '所有科室id', 'message6')["deptid1"]
# #请求体
request_body = commonFuc().get_business_data(module, "payload39_1_1", branch_id, hos_id, GoodsId, deptid1)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result))
data = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))
branchGoodsId = commonFuc().analysis_json('branchGoodsId', data)
hosGoodsId = commonFuc().analysis_json('hosGoodsId', data)
# 获取院区产品id ===========结束
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "branchGoodsPkgDef_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# 获取院区id
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
# #请求体
request_body = commonFuc().get_business_data(module, "payload42_2", hos_id, branch_id, branchGoodsId)
print('request_body', request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
unitPackageid = commonFuc().analysis_json('id', commonFuc().analysis_json('data', result))
print('unitPackageid', unitPackageid)
info = (unitPackageid, unitPackageid)
titlename = ('unitPackageid1', 'unitPackageid2')
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '产品包装信息', titlename, 'message6')
# try:
# # 获取低值的hosGoodsId
# hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
# get_GoodsPkgDef(hosGoodsId) # 获取单元包id
# except:
# print('流程五获取hosGoodsId出现错误,请检查脚本或者数据')
# try:
# test1()
# except:
# print('采购计划提交出现错误,请检查脚本或者数据')
#审批
try:
approval_center()
except Exception as e:
print('审批采购计划出现错误,请检查脚本或者数据')
print("发生异常:", str(e))
\ No newline at end of file
院区新增:
branch_id: h0347-3498
branch_name: 东土城路院区i&FY9
branch_id: h0347-3502
branch_name: 东土城路院区d5UMZ
科室信息:
dept2_id: 27d8aecb78a04194a91cb3f9c70425e6
dept2_id: f77d430a8dd54881a080889b4bb84873
dept2_name: 二级检验科002
......@@ -55,9 +55,9 @@
<tr width="600">
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0</td>
<td class='details-col-elapsed'>0分5</td>
<td class="details-col-elapsed">0.0%</td>
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分2</td>
<td class="details-col-elapsed">100.0%</td>
</tr>
</table>
......@@ -73,8 +73,8 @@
<tr width="600">
<td class="details-col-elapsed"><a href='../log/a_a5流程五_中心库入库结算_正结算1/log.html' target='_blank'>a_a5流程五_中心库入库结算_正结算1</a></td>
<td class="fail">失败</td>
<td class="details-col-elapsed">5.482</td>
<td class="success">成功</td>
<td class="details-col-elapsed">2.642</td>
<td class="details-col-elapsed">xiaohesheng</td>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment