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

优化脚本

parent 93574ab8
......@@ -27,10 +27,10 @@ def dept_query_byID():
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
# 新建一个院区
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\a4_院区新增.air')
using(pro_path + r'\\air_case\\b2_herp3_bs\\a4_院区新增.air')
from a4_院区新增 import branch_add #导入即调用了脚本新增了院区下面再调用一次会有重复数据
# pro_path = commonFuc().get_pro_path()
# sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\a4_院区新增.air')
# using(pro_path + r'\\air_case\\b2_herp3_bs\\a4_院区新增.air')
# from a4_院区新增 import branch_add #导入即调用了脚本新增了院区下面再调用一次会有重复数据
# id2, name = branch_add()
# info = (id2, name)
# FileUtils().w_info2(info, module, '院区新增')
......
......@@ -79,9 +79,9 @@ def test1():
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\r_c3库房管理_库区设置_新增库区.air')
using(pro_path + r'\\air_case\\b2_herp3_bs\\r_c3库房管理_库区设置_新增库区.air')
from r_c3库房管理_库区设置_新增库区 import test1
from r_c3库房管理_库区设置_新增库区 import test2
print('stockId',stockId)
test1(stockId)
test2(stockId)
# o5科室管理_科室产品分配_添加科室产品页面_查询全部
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "basic_mcmsGoodsInfo_insert")
......@@ -90,8 +90,10 @@ def test1():
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
dept2_id = FileUtils().r_info(module, '科室信息')["dept2_id"]
# 请求体
request_body = commonFuc().get_business_data(module, "payload58_6",dept2_id)
request_body = commonFuc().get_business_data(module, "payload58_6_2",dept2_id)
request_body='['+str(request_body)+']'
new_request_body = request_body.replace("'", '"')
print(new_request_body)
......
......@@ -63,9 +63,9 @@ def test1():
# date2=timeUtils().get_time_hms(2)
# for i in list2:
# dept2_id = FileUtils().r_info(module, '科室信息')["dept2_id"]
dept1_id = FileUtils().r_info8(module, '部门和库区信息','message5')["dept1_id"]
# 请求体
request_body = commonFuc().get_business_data(module, "payload61_2")
request_body = commonFuc().get_business_data(module, "payload61_2",dept1_id)
# request_body='['+str(request_body)+']'
# new_request_body = request_body.replace("'", '"')
# print(new_request_body)
......
......@@ -63,9 +63,9 @@ def test1():
# date2=timeUtils().get_time_hms(2)
# for i in list2:
# dept2_id = FileUtils().r_info(module, '科室信息')["dept2_id"]
dept1_id = FileUtils().r_info8(module, '部门和库区信息','message5')["dept1_id"]
# 请求体
request_body = commonFuc().get_business_data(module, "payload61_5",userid)
request_body = commonFuc().get_business_data(module, "payload61_5",userid,dept1_id)
# request_body='['+str(request_body)+']'
# new_request_body = request_body.replace("'", '"')
# print(new_request_body)
......
......@@ -95,4 +95,6 @@ def test1(name='东土城院区中心库房'):
print(id1)
return id1
# break
test1()
#获取院区名称
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
test1(branch_name+'中心库房')
......@@ -22,7 +22,7 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
module = "b2_herp3_bs"
def test1(stockId='c66b6ed38dbb4fbc8603dc00cdabb572'):
def test2(stockId='c66b6ed38dbb4fbc8603dc00cdabb572'):
"""
场景:r_c3库房管理_库区设置_新增库区
用例名称:r_c3库房管理_库区设置_新增库区
......@@ -86,4 +86,11 @@ def test1(stockId='c66b6ed38dbb4fbc8603dc00cdabb572'):
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
test1()
#从r_b9库房管理_库区设置_库房查询_查询全部.air获取库房id
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
using(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
from r_b9库房管理_库区设置_库房查询_查询全部 import test1
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId =test1(branch_name+'中心库房')
test2(stockId)
......@@ -22,7 +22,7 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
module = "b2_herp3_bs"
def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5',stockId='c66b6ed38dbb4fbc8603dc00cdabb572'):
def test2(dept_id='d69a68df361a4289b2262e4ef75b55a5',stockId='c66b6ed38dbb4fbc8603dc00cdabb572'):
"""
场景:r_c5库房管理_库区设置_库区查询_查询全部
用例名称:r_c5库房管理_库区设置_库区查询_查询全部
......@@ -77,11 +77,33 @@ def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5',stockId='c66b6ed38dbb4fbc86
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
# data1 = commonFuc().analysis_json('data', data)
data1 = commonFuc().analysis_json('data', data)
# pageSize = commonFuc().analysis_json('pageSize', data)
# print(pageSize, type(pageSize))
if code == 0 and len(data) >= 1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
test1()
# 增加一段返回库区id
print('data1', data1)
for i in data1:
shelfName = commonFuc().analysis_json('shelfName', i)
print(shelfName)
if shelfName == '自动化测试':
print(shelfName, 'ccccccccccccccccccccccccccc')
id1 = commonFuc().analysis_json('id', i)
print(id1)
return id1
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
using(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
from r_b9库房管理_库区设置_库房查询_查询全部 import test1
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId =test1(branch_name+'中心库房')
#读取科室id
info = FileUtils().r_info8("b2_herp3_bs", "一级科室信息",'message4')
print(info)
dept1_id = info['dept1_id']
# test1(dept1_id)
test2(dept1_id,stockId)
......@@ -22,7 +22,7 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
module = "b2_herp3_bs"
def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockAreaId='b72a363163ff4670b4fa0390de5adb8c'):
def test3(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockAreaId='b72a363163ff4670b4fa0390de5adb8c'):
"""
场景:r_d0库房管理_库区设置_人员管理_添加人员_查询人员
用例名称:r_d0库房管理_库区设置_人员管理_添加人员_查询人员
......@@ -45,16 +45,25 @@ def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockAreaId='b72a363163ff4
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
str = commonFuc().get_business_data(module, 'data20')
list2 = list(str.split(","))
print(list2)
# str = commonFuc().get_business_data(module, 'data20')
# list2 = list(str.split(","))
# print(list2)
# #调用新增用户脚本
# pro_path = commonFuc().get_pro_path()
# sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\r_f0用户管理_用户管理_新增用户.air')
# using(pro_path + r'\\air_case\\b2_herp3_bs\\r_f0用户管理_用户管理_新增用户.air')
# from r_f0用户管理_用户管理_新增用户 import test1
# test1(dept_id)
info = FileUtils().r_info8(module, "用户名信息",'message3')
# print(info)
username1 = info['username1']
list2=commonFuc().get_str(username1)
for i in list2:
# # 请求体
request_body = commonFuc().get_business_data(module, "payload62_8", dept_id, stockAreaId, i)
# print('request_body',request_body)
print('request_body',request_body)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultbbbbbbbbbbb', result)
......@@ -70,5 +79,29 @@ def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockAreaId='b72a363163ff4
else:
commonFuc().check_text_exist('error', result)
#读取科室id
info = FileUtils().r_info8("b2_herp3_bs", "一级科室信息",'message4')
print(info)
dept1_id = info['dept1_id']
#获取库房id========= 开始====
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
using(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
from r_b9库房管理_库区设置_库房查询_查询全部 import test1
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId =test1(branch_name+'中心库房')
#获取库房id==========结束============
#====获取库区id===== 开始========
sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\r_c5库房管理_库区设置_库区查询_查询全部.air')
using(pro_path + r'\\air_case\\b2_herp3_bs\\r_c5库房管理_库区设置_库区查询_查询全部.air')
from r_c5库房管理_库区设置_库区查询_查询全部 import test2
stockAreaId=test2(dept1_id,stockId)
#====获取库区id===== 结束========
test3(dept1_id,stockAreaId)
test1()
#将中心库id和库区id写入文件
info = (dept1_id, stockAreaId)
titlename = ('dept1_id', 'stockAreaId')
FileUtils().w_info8(info, module, '部门和库区信息', titlename,'message5')
\ No newline at end of file
......@@ -22,13 +22,26 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
module = "b2_herp3_bs"
def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockAreaId='b72a363163ff4670b4fa0390de5adb8c'):
def test3(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockAreaId='b72a363163ff4670b4fa0390de5adb8c'):
"""
场景:r_d2库房管理_库区设置_人员管理_添加人员
用例名称:r_d2库房管理_库区设置_人员管理_添加人员
输入:""
输出:"rtn_msg": {"code": 0, "msg": null, "data":[]}
"""
#登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8(module, "用户名信息",'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token1, projectCode1, uxid1, corpId1, info1 = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束
# 内网登录
username = commonFuc().get_business_data(module, "username")
## print('医院名称',username)
......@@ -52,7 +65,7 @@ def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockAreaId='b72a363163ff4
# for i in list2:
# # 请求体
request_body = commonFuc().get_business_data(module, "payload62_9",dept_id,stockAreaId)
request_body = commonFuc().get_business_data(module, "payload62_9",dept_id,stockAreaId,username1,uxid1,username1)
# request_body = commonFuc().get_business_data(module, "payload62_9")
request_body='['+str(request_body)+']'
new_request_body = request_body.replace("'", '"')
......@@ -81,4 +94,25 @@ def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockAreaId='b72a363163ff4
commonFuc().check_text_exist('error', result)
test1()
#读取科室id
info = FileUtils().r_info8("b2_herp3_bs", "一级科室信息",'message4')
print(info)
dept1_id = info['dept1_id']
#获取库房id========= 开始====
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
using(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
from r_b9库房管理_库区设置_库房查询_查询全部 import test1
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId =test1(branch_name+'中心库房')
#获取库房id==========结束============
#====获取库区id===== 开始==========
sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\r_c5库房管理_库区设置_库区查询_查询全部.air')
using(pro_path + r'\\air_case\\b2_herp3_bs\\r_c5库房管理_库区设置_库区查询_查询全部.air')
from r_c5库房管理_库区设置_库区查询_查询全部 import test2
stockAreaId=test2(dept1_id,stockId)
#====获取库区id===== 结束==========
test3(dept1_id,stockAreaId)
......@@ -22,7 +22,7 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
module = "b2_herp3_bs"
def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockId='c66b6ed38dbb4fbc8603dc00cdabb572'):
def test2(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockId='c66b6ed38dbb4fbc8603dc00cdabb572'):
"""
场景:r_d4库房管理_库区设置_货位管理_添加货位
用例名称:r_d4库房管理_库区设置_货位管理_添加货位
......@@ -86,5 +86,15 @@ def test1(dept_id='d69a68df361a4289b2262e4ef75b55a5', stockId='c66b6ed38dbb4fbc8
else:
commonFuc().check_text_exist('error', result)
#从r_b9库房管理_库区设置_库房查询_查询全部.air获取库房id
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
using(pro_path + r'\\air_case\\b2_herp3_bs\\r_b9库房管理_库区设置_库房查询_查询全部.air')
from r_b9库房管理_库区设置_库房查询_查询全部 import test1
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId =test1(branch_name+'中心库房')
test1()
info = FileUtils().r_info8(module, "部门和库区信息",'message5')
dept1_id=info['dept1_id']
test2(dept1_id,stockId)
......@@ -50,7 +50,7 @@ def test1(orgName='d69a68df361a4289b2262e4ef75b55a5'):
info = (username, username)
titlename = ('username1', 'username2')
# 将二级科室id写入文件中
# 将用户名信息写入文件中
FileUtils().w_info8(info, module, '用户名信息', titlename,"message3")
# # 请求体
......@@ -68,5 +68,8 @@ def test1(orgName='d69a68df361a4289b2262e4ef75b55a5'):
commonFuc().check_text_exist('error', result)
test1()
#读取科室id
info = FileUtils().r_info8("b2_herp3_bs", "一级科室信息",'message4')
print(info)
dept1_id = info['dept1_id']
test1(dept1_id)
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delData
from common.fileUtls import FileUtils
__author__ = "xiaohesheng"
......@@ -129,7 +130,7 @@ def apply():
print("产品信息审核查询返回结果", result)
checkDict=commonFuc().get_business_data(module,'checkDict')
commonFuc().check_result(checkDict,result)
def select1():
def select1(messageNO='message2'):
module = "a5_mdm3_pdm"
token,projectCode,uxid,corpId,username=e_login(2)
......@@ -169,8 +170,10 @@ def select1():
print(id1, auditOrgId, hosGoodsId,provGoodsid,goodsAuditBillId,targetId)
info = (id1, auditOrgId,hosGoodsId,provGoodsid,goodsAuditBillId,targetId)
titlename = ("MSPid", 'hosId','hosGoodsId','provGoodsid','goodsAuditBillId','targetId')
# 将产品审核信息写入到文件中
# 将产品审核信息写入到b5_spd3_core_business_flow模块messsage文件中
FileUtils().w_info6(info, module, '产品审核信息', titlename,'message2')
#将产品审核信息写入到文件中
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '产品审核信息', titlename, messageNO)
else:
commonFuc().check_text_exist(0, result)
def add_goods1():#低值
......@@ -290,18 +293,29 @@ def add_goods4():
commonFuc().check_text_exist(code, result)
else:
commonFuc().check_text_exist(-1, result)
#删除上次新增的产品,避免产生过多的重复数据
list2=[]
for i in range(1, 6):
info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息", 'message%s' % i)
hosGoodsId = info['hosGoodsId']
list2.append(hosGoodsId)
print(list2)
for i in list2:
print(i,'aaaaaaaaaaaaaaaa')
delData().Del_goods_info(i)
add_goods()#直销高值
select1()
select1('message1')
apply()
add_goods1()#直销低值
select1()
select1('message2')
apply()
add_goods2()#直销试剂
select1()
select1('message3')
apply()
add_goods3()#集配
select1()
select1('message4')
apply()
add_goods4()#定向 "isSubprov": "1"
select1()
select1('message5')
apply()
\ No newline at end of file
# -*- encoding=utf8 -*-
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
__author__ = "xiaohesheng"
......@@ -8,171 +9,172 @@ case_tag:api,mdm-core,a_a4_流程四_基础模块设置,id2302,id2302-4,sit,on
主数据平台:a_a3_流程三_产品导入和审批
"""
from common.common_func import commonFuc
from air_case.mdm_login.登录网系统.登录网系统 import login_system
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 h_login():
module = "a4_mdm3_cm"
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password1")
print('医院名称', username)
print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
def test1():
#院区新增
execute_command("python runner_test.py tag id2263-4 debug sit")
#新增科室
execute_command("python runner_test.py tag id2263-19,id2263-20,id2263-21,id2263-22,id2263-23,id2263-24,id2263-25,id2263-26 debug sit")
#一键导入所有产品
execute_command("python runner_test.py tag id2263-48 debug sit")
#r_b8库房管理_库区设置_同步库房信息
execute_command("python runner_test.py tag id2263-221 debug sit")
#新增用户
execute_command("python runner_test.py tag id2263-253 debug sit")
# 根据院区名称查询中心库房id
execute_command("python runner_test.py tag id2263-222 debug sit")
# 新增库区
execute_command("python runner_test.py tag id2263-226 debug sit")
#查询库区
execute_command("python runner_test.py tag id2263-228 debug sit")
# r_d0库房管理_库区设置_人员管理_添加人员_查询人员
execute_command("python runner_test.py tag id2263-233 debug sit")
#r_d2库房管理_库区设置_人员管理_添加人员
execute_command("python runner_test.py tag id2263-235 debug sit")
#r_d4库房管理_库区设置_货位管理_添加货位
execute_command("python runner_test.py tag id2263-237 debug sit")
#科室管理-科室人员查询 设置科室负责人
execute_command("python runner_test.py tag id2263-219 debug sit")
def test2():#科室添加产品信息(产品是从外网同步过来的)
module = "b2_herp3_bs"
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
import time
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
#
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "basic_mcmsGoodsInfo_insert")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
list2 = []
i=1
while True:
if i==1000:
print('6000秒过去了,产品还没过来,检查同步是否正常')
break
try:
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
for i in range(1,6):
info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息",'message%s'%i)
hosGoodsId = info['hosGoodsId']
list2.append(hosGoodsId)
except:
print('产品没有同步过来,等待6秒')
time.sleep(6)
i=i+1
continue
else:
return token,projectCode,uxid,corpId,username
def e_login(type=1):
module = "a4_mdm3_cm"
username='username'
if type==1:#注册一个新企业,并审批
pro_path=commonFuc().get_pro_path()
sys.path.append(pro_path+r'\\air_case\\a2_mdm3_ea\\企业审核.air')
using(pro_path+r'\\air_case\\a2_mdm3_ea\\企业审核.air')
from 企业审核 import test1
info = FileUtils().r_info("a2_mdm3_ea", "企业信息")
print(info)
username = info['cname']
print('aaaaaaaaaaaaaaaaaaaaaaaaaaa',username)
else:#读取文件中存入的企业信息
info = FileUtils().r_info("a2_mdm3_ea", "企业信息")
print(info)
username = info['cname']
print('aaaaaaaaaaaaaaaaaaaaaaaaaaa', username)
#a2供货关系申请_客户类型_医院_登录_企业登录
break
dept2_id = FileUtils().r_info(module, '科室信息')["dept2_id"]
for i in list2:
# 请求体
request_body = commonFuc().get_business_data(module, "payload58_6",dept2_id,i)
request_body='['+str(request_body)+']'
new_request_body = request_body.replace("'", '"')
print(new_request_body)
import json
request_body_json = json.loads(new_request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body_json,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)
if code==0 and data==1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
def dept_query_all(): #科室查询,将科室id写入文件中
module = "b2_herp3_bs"
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
print(username, password)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
import time
while True:
try:
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
except:
time.sleep(6)
continue
else:
return token, projectCode, uxid, corpId, username
# break
def add_goods():
token, projectCode, uxid, corpId, e_name = e_login(2)
# 获取医院corpId
h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login()
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b9_科室管理_科室登记_科室查询
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "deptPage_url")
module = "a5_mdm3_pdm"
#b18供货目录申请_客户类型_医院_提交供货申请单_添加产品
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "addGoodsHandleInfos_url")
print('url',url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
goodsname = commonFuc().randomString(5)
request_body = commonFuc().get_business_data(module, "payload_1", h_corpId,h_name,corpId,e_name,goodsname,e_name)
# request_body = commonFuc().get_business_data(module, "payload10_1")
# print('request_body',request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
commonFuc().get_business_data(module, "X-APP-CODE"))
# #请求体
request_body=commonFuc().get_business_data(module, "payload13",branch_id)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
print('result', result)
#断言
code=commonFuc().analysis_json('code',result)
data=commonFuc().analysis_json('data',result)
if code==0:
commonFuc().check_text_exist(code,result)
data = commonFuc().analysis_json('data', result)
total= commonFuc().analysis_json('total',data)
if total==4:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist(-1, result)
def apply():
module = "a5_mdm3_pdm"
token,projectCode,uxid,corpId,username=e_login(2)
#获取医院corpId
h_token,h_projectCode,h_uxid,h_corpId,h_name=h_login()
# 登录
username = h_name
password = commonFuc().get_business_data(module, "password1")
print(username, password)
commonFuc().check_text_exist('error', result)
#将deptid写入文件
data1 = commonFuc().analysis_json('data', data)
print('data1',data1)
info=[]
for i in data1:
deptid = commonFuc().analysis_json('id', i)
info.append(deptid)
titlename=['deptid1','deptid2','deptid3','deptid4']
FileUtils().w_info8(info, module, '所有科室id',titlename,'message6')
def grants_user(orgName='d69a68df361a4289b2262e4ef75b55a5',mgrRangeId='feb0cc16618c437fb4d033cd339a0377'):
module = "b2_herp3_bs"
# 内网登录
username = commonFuc().get_business_data(module, "username")
## 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()
# 审批产品驳回
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "singleAudit_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
info = FileUtils().r_info6(module, "产品审核信息",'message2')
print(info)
MSPid = info['MSPid']
hosId = info['hosId']
hosGoodsId = info['hosGoodsId']
provGoodsid = info['provGoodsid']
goodsAuditBillId= info['goodsAuditBillId']
targetId= info['targetId']
request_body = commonFuc().get_business_data(module, "payload3_1",MSPid,hosId,hosGoodsId,provGoodsid,goodsAuditBillId,targetId)
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
print('产品信息审核查询请求体', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print("产品信息审核查询返回结果", result)
checkDict=commonFuc().get_business_data(module,'checkDict')
commonFuc().check_result(checkDict,result)
def select1():
module = "a5_mdm3_pdm"
token,projectCode,uxid,corpId,username=e_login(2)
#获取医院corpId
h_token,h_projectCode,h_uxid,h_corpId,h_name=h_login()
# 登录
username = h_name
password = commonFuc().get_business_data(module, "password1")
print(username, password)
# 获取token和projectCode
token, projectCode, uxid, corpId,info = login_system(username, password).get_token()
# 产品信息审核查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "getAuditGoodsListByPage_url")
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "sys_user_grants_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
commonFuc().get_business_data(module, "X-APP-CODE"))
request_body = commonFuc().get_business_data(module, "payload2",h_corpId)
# print('产品信息审核查询请求体', request_body)
# 发送请求
# # 请求体
request_body = commonFuc().get_business_data(module, "payload63_12_2", orgName,mgrRangeId)
print('request_body', request_body)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print("产品信息审核查询返回结果", result)
print('resultaaaaaaaaaaaaaaaaaaa', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total=commonFuc().analysis_json('total', data)
data1=commonFuc().analysis_json('data', data)
if total>=1:
id1 = commonFuc().analysis_json('id', data1[0])
auditOrgId=commonFuc().analysis_json('hosId', data1[0])
hosGoodsId=commonFuc().analysis_json('hosGoodsid', data1[0])
provGoodsid=commonFuc().analysis_json('provGoodsid', data1[0])
goodsAuditBillId=commonFuc().analysis_json('billId', data1[0])
targetId=commonFuc().analysis_json('id', data1[0])
print(id1, auditOrgId, hosGoodsId,provGoodsid,goodsAuditBillId,targetId)
info = (id1, auditOrgId,hosGoodsId,provGoodsid,goodsAuditBillId,targetId)
titlename = ("MSPid", 'hosId','hosGoodsId','provGoodsid','goodsAuditBillId','targetId')
# 将产品审核信息写入到文件中
FileUtils().w_info6(info, module, '产品审核信息', titlename,'message2')
else:
if code == 0 and data == 2:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
add_goods()
select1()
apply()
\ No newline at end of file
try:
test1()
test2()
dept_query_all()
# grants_user()
except:
commonFuc().check_text_exist('1','2')
......@@ -74,6 +74,9 @@ class commonFuc(object):
url = 'http://spdtest.cmic.com.cn:8080'
return url
def get_api_add_port_url(self,url,port=":8080"):
url=url+port
return url
def get_token(self, module, enc_user_id="enc_user_id"):
enc_user_id = self.get_business_data(module, enc_user_id)
......
......@@ -195,10 +195,33 @@ class delData(object):
cursor.execute("commit;")
print('带量项目主表信息删除成功 ')
cursor.close()
def Del_goods_info(self,goodsid):
#内网的
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
charset="utf8")
cursor = connection.cursor()
# 删除产品信息
sql = "delete from mcms_goods_info where id='%s';"%goodsid
print(sql)
cursor.execute(sql)
cursor.execute("commit;")
print('内网产品信息删除成功 ')
cursor.close()
#外网的
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd_ybtest_hdi",
charset="utf8")
cursor = connection.cursor()
sql = "delete from mcms_goods_info where id='%s';"%goodsid
print(sql)
cursor.execute(sql)
cursor.execute("commit;")
print('外网产品信息删除成功 ')
cursor.close()
# delData().Delete_branch_by_id()
# delData().Delete_goods_change_info()
# delData().Delete_sys_config()
# delData().Delete_sys_message_template()
# delData().get_shelf_name_version()
# delData().Delete_role()
# delData().Delete_user()
\ No newline at end of file
# delData().Delete_user()
# delData().Del_goods_info(i)
\ No newline at end of file
产品审核信息:
MSPid: MSP2404170032_1
MSPid: MSP2404170039_1
hosId: h0347
hosGoodsId: h034700002953
provGoodsid: provGood-99220058
goodsAuditBillId: MSP2404170032
targetId: MSP2404170032_1
hosGoodsId: h034700002959
provGoodsid: provGood-99220064
goodsAuditBillId: MSP2404170039
targetId: MSP2404170039_1
......@@ -208,62 +208,11 @@ json_headers2: {
"payload11": {"pageNum": 1,"pageSize": 50,"queryObject": {"hosId": "h0347","searchText": "p00002a0c","firmType": 1}}
"payload12": {"pageNum": 1,"pageSize": 50,"queryObject": {"hosId": "h0347","searchText": "国药器械光谷分公司","firmType": 1}}
"payload13": {"pageNum": 1,"pageSize": 50,"orderBy": "code asc","queryObject": {"ename": "","branchId": "院区id", "branchId": "%s", "hosId": "医院id", "hosId": "h0347" }}
"payload14": {
"branchId": "%s",
"cname": "",
"ename": "设备科室001",
"code": "001",
"address": "设备科室001001",
"contactWay": "设备科室001001",
"deptKind": 1,
"deptCate": 1,
"deptLevel": "1",
"flag": "1",
"corpId": "h0347"
}
"payload15": {
"branchId": "%s",
"cname": "",
"ename": "二级科室002",
"code": "002",
"address": "二级科室002",
"contactWay": "二级科室002",
"deptKind": 2,
"deptCate": 1,
"deptLevel": "2",
"flag": "1",
"corpId": "h0347"
}
"payload16": {
"branchId": "院区id",
"branchId": "%s",
"pid": "科室id,002是003的上级科室",
"pid": "%s",
"cname": "",
"ename": "三级科室003",
"code": "003",
"address": "三级科室003",
"contactWay": "三级科室003",
"deptKind": 3,
"deptCate": 1,
"deptLevel": "3",
"flag": "1",
"corpId": "h0347"
}
"payload17": {
"branchId": "%s",
"pid": "%s",
"cname": "",
"ename": "四级科室004",
"code": "004",
"address": "四级科室004",
"contactWay": "四级科室004",
"deptKind": 4,
"deptCate": 1,
"deptLevel": "4",
"flag": "1",
"corpId": "h0347"
}
"payload14": {"branchId":"%s","cname":"","ename":"设备科001","erpCode":"001","address":"设备科001","contactWay":"13401003250","deptKind":1,"deptCate":1,"deptLevel":"1","flag":"1","hisDeptCodes":"","deptType":"0","packetType":"0","corpId":"h0347","corpKind":1}
"payload15": {"branchId":"%s","cname":"","ename":"二级检验科002","erpCode":"002","address":"二级检验科002","contactWay":"13401003250","deptKind":7,"deptCate":1,"deptLevel":"2","flag":"1","hisDeptCodes":"","deptType":"0","packetType":"0","corpId":"h0347","corpKind":1}
"payload16": {"branchId":"%s","pid":"%s","cname":"","ename":"三级检测组003","erpCode":"003","address":"三级检测组003","contactWay":"12401003250","deptKind":7,"deptCate":1,"deptLevel":"3","flag":"1","hisDeptCodes":"","deptType":"0","packetType":"0","corpId":"h0347","corpKind":1}
"payload17": {"branchId":"%s","pid":"%s","cname":"","ename":"科室004","erpCode":"004","address":"三级科室004","contactWay":"三级科室004","deptKind":5,"deptCate":1,"deptLevel":"4","flag":"1","hisDeptCodes":"","deptType":"0","packetType":"0","corpId":"h0347","corpKind":1}
"payload18": {
"id": "%s",
"address": "二级科室002",
......@@ -427,7 +376,8 @@ json_headers2: {
"payload58_3": {"queryObject":{"deptId":"%s","hosId":"h0347","goodsMfrsName":"北京国瑞辉煌医疗器械有限公司","goodsName":"00001946","goodsSpec":"","purModes":["10"]},"pageNum":1,"pageSize":200}
"payload58_4": {"queryObject":{"deptId":"%s","hosId":"h0347","goodsMfrsName":"北京国瑞辉煌医疗器械有限公司","goodsName":"超声治疗仪-高值","goodsSpec":"","purModes":["20"]},"pageNum":1,"pageSize":200}
"payload58_5": {"queryObject":{"deptId":"%s","hosId":"h0347","goodsMfrsName":"北京国瑞辉煌医疗器械有限公司","goodsName":"荧光试纸-试剂","goodsSpec":"","purModes":["60"]},"pageNum":1,"pageSize":200}
"payload58_6": {"deptId":"%s","hosGoodsId":"h034700001743","grantRule":1,"purMode":10}
"payload58_6": {"deptId":"%s","hosGoodsId":"%s","grantRule":1,"purMode":10}
"payload58_6_2": {"deptId":"%s","hosGoodsId":"h034700001743","grantRule":1,"purMode":10}
"payload58_7": {"deptId":"%s","hosGoodsId":"h034700001743222","grantRule":1,"purMode":10}
"payload58_8": {"consumeMode":null,"id":"2c127343e49947f5855021c790f4b08e","pkgDefId":"56b010aba2e04f978e3038c0f53d910c","stockLower":0,"stockUpper":0,"targetDeptId":"d69a68df361a4289b2262e4ef75b55a5","shelfCode":"area0354-2-01-02","codingType":1,"grantWay":1,"packetQty":33,"tbStatus":0}
"payload58_9": {"consumeMode":null,"id":"2c127343e49947f5855021c790f4b08e","pkgDefId":"56b010aba2e04f978e3038c0f53d910c","stockLower":0,"stockUpper":0,"targetDeptId":"d69a68df361a4289b2262e4ef75b55a5","shelfCode":"area0354-2-01-02","codingType":1,"grantWay":1,"packetQty":33,"tbStatus":1}
......@@ -473,10 +423,10 @@ json_headers2: {
"payload60_4": {"id":"%s","branchId":"h0347-2011","deptId":"96c4d23bff8541599eb1a7f5f813e421","orderNum":2,"intervalType":"0","intervalNum":2,"intervalWeek":"","hosId":"h0347"}
"payload61": {"corpId":"h0347","orgName":""}
"payload61_1": {"corpId":"h0347","orgName":"%s"}
"payload61_2": {"queryObject":{"orgId":"feb0cc16618c437fb4d033cd339a0377","cname":""},"pageNum":1,"pageSize":50}
"payload61_2": {"queryObject":{"orgId":"%s","cname":""},"pageNum":1,"pageSize":50}
"payload61_3": {"queryObject":{"orgId":"feb0cc16618c437fb4d033cd339a0377","cname":"%s"},"pageNum":1,"pageSize":50}
"payload61_4": {"queryObject":{"orgId":"feb0cc16618c437fb4d033cd339a0377","cname":"%s"},"pageNum":1,"pageSize":50}
"payload61_5": {"userLeaderId":"%s","id":"feb0cc16618c437fb4d033cd339a0377"}
"payload61_5": {"userLeaderId":"%s","id":"%s"}
"payload61_6": {"queryObject":{"orgId":"feb0cc16618c437fb4d033cd339a0377","cname":""},"pageNum":1,"pageSize":"%s"}
"payload62": {"hosId":"h0347"}
"payload62_1": {"hosId":"h0347","stockCode":""}
......@@ -487,7 +437,7 @@ json_headers2: {
"payload62_6": {"queryObject":{"deptId":"%s","stockAreaId":"%s","stockCode":"自动化测试","stockType":"0"},"pageNum":1,"pageSize":50}
"payload62_7": {"id":"%s","lastModified":"%s","version":"%s","createTime":"%s","createUser":"UID-050151","lastModifiedUser":"UID-050151","stockId":"%s","shelfCode":"%s","shelfName":"%s","address":"%s","shelfType":null,"stockType":0,"defaultFlag":1,"specialFlag":0,"parentId":null,"levelCode":null,"tbStatus":1,"linkman":"UID-048618","recPhone":"%s","delFlag":0,"shelfNo":"%s","shelfKind":0,"hosId":null,"deptId":null,"areaCode":null,"areaName":null,"stockName":null,"probeId":null,"bindFlag":null}
"payload62_8": {"deptId":"%s","stockAreaId":"%s","userName":"%s"}
"payload62_9": {"delFlag":1,"deptId":"%s","deptName":"001","hosId":"h0347","roleId":null,"roleName":"内网医院初始化模板角色(内置)","stockAreaId":"%s","tbStatus":1,"userCode":"xhs","userId":"UID-048618","userName":"xhs"}
"payload62_9": {"delFlag":1,"deptId":"%s","deptName":"设备科001","hosId":"h0347","roleId":null,"roleName":"医院管理员","stockAreaId":"%s","tbStatus":1,"userCode":"%s","userId":"%s","userName":"%s"}
"payload62_10": {"queryObject":{"deptId":"%s","stockAreaId":"%s","hosId":"h0347"},"pageNum":1,"pageSize":50}
"payload62_11": {"delFlag":0,"id":"%s"}
"payload62_12": {"shelfNum":"2","shelfColumn":2,"shelfPlie":2,"version":"","defaultFlag":0,"tbStatus":1,"shelfKind":0,"parentId":"%s","stockCode":"%s","shelfNo":"自动化测试","stockId":"%s","stockAreaId":"%s"}
......@@ -510,6 +460,9 @@ json_headers2: {
"payload63_10": {"userCode":"%s","cname":"%s","tel":"xhs0301","orgCode":"001","orgId":"%s","id":"%s","enableFlag":"0","roleCode":"ro00442","projectCode":"herp","erpCode":"%s"}
"payload63_11": {"userCode":"%s","cname":"%s","tel":"xhs0301","orgCode":"001","orgId":"%s","id":"%s","enableFlag":"1","roleCode":"ro00442","projectCode":"herp","erpCode":"%s_update"}
"payload63_12": {"roleCode":"ro00442","userId":"h0347_UID-051050","projectCode":"herp","grantInfos":[{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-2011","mgrBranchName":"东土城院区","mgrRangeId":"%s","mgrRangeName":"001","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-2011","mgrBranchName":"东土城院区","mgrRangeId":"%s","mgrRangeName":"008","roleCode":"ro00442"}]}
"payload63_12_2": {"roleCode":"ro00442","userId":"%s","projectCode":"herp","grantInfos":[{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-3492","mgrBranchName":"东土城路院区9Rqb*","mgrRangeId":"b9bff6c3f73e49988f917ce17d8c7dc9","mgrRangeName":"二级检验科002","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-3492","mgrBranchName":"东土城路院区9Rqb*","mgrRangeId":"d2f0004e6aa947c7a5dfed90bfd2a11f","mgrRangeName":"设备科001","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-3492","mgrBranchName":"东土城路院区9Rqb*","mgrRangeId":"b7844205bc8a4610b2a382d2baed8bbc","mgrRangeName":"三级检测组003","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-3492","mgrBranchName":"东土城路院区9Rqb*","mgrRangeId":"bdf679e54f8949f98869484d29dff6dc","mgrRangeName":"科室004","roleCode":"ro00442"}]}
"payload64": {"pageNum":1,"pageSize":50,"queryObject":{"startTime":"","endTime":""}}
"payload64_1": {"pageNum":1,"pageSize":200,"queryObject":{"methodCode":"S0102","operType":"restful","startTime":"2024-02-28 00:00:00","endTime":"2024-02-29 23:59:59"}}
"payload64_2": {"pageNum":1,"pageSize":200,"queryObject":{"methodCode":"%s","operType":"restful","startTime":"2024-02-28 00:00:00","endTime":"2024-02-29 23:59:59"}}
......
院区新增:
branch_id: h0347-3459
branch_name: 东土城路院区wf(pk
branch_id: h0347-3495
branch_name: 东土城路院区cRaEI
科室信息:
dept2_id: d2bfbdd0e21f43aca9527b60d813dd18
dept2_name: 二级科室002
单元包信息:
branchGoodsId: h0347-345900000010
hosGoodsId: h034700000010
dept2_id: 522d4b2c90f84d799a706943852ce157
dept2_name: 二级检验科002
......@@ -56,7 +56,7 @@
<tr width="600">
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分8</td>
<td class='details-col-elapsed'>0分2</td>
<td class="details-col-elapsed">100.0%</td>
</tr>
</table>
......@@ -72,9 +72,9 @@
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/a_a3_流程三_产品导入和审批/log.html' target='_blank'>a_a3_流程三_产品导入和审批</a></td>
<td class="details-col-elapsed"><a href='../log/a1_医院信息登记/log.html' target='_blank'>a1_医院信息登记</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">8.679</td>
<td class="details-col-elapsed">2.058</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