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

流程五脚本编写

parent c78deaa1
...@@ -20,13 +20,19 @@ python runner_test.py tag id2302-9 debug mdm3 ...@@ -20,13 +20,19 @@ python runner_test.py tag id2302-9 debug mdm3
def test1(): def test1():
#提交采购计划 #提交采购计划
execute_command("python runner_test.py tag id2302-5 debug mdm3") execute_command("python runner_test.py tag id2302-5 debug mdm3")
#企业审核 #外网配送
execute_command("python runner_test.py tag id2302-6 debug mdm3") execute_command("python runner_test.py tag id2302-6 debug mdm3")
#医院注册审核 #内网验收入库结算
execute_command("python runner_test.py tag id2302-7 debug mdm3") execute_command("python runner_test.py tag id2302-7 debug mdm3")
try: try:
# test1() # test1()
set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']) #先查询所有的部门信息写入文件
dept_query_all()
#设置库房人员,根据传入的科室id和科室名称来设置库房
#中心库type=1 二级type=2三级type=3
# set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'],2)
set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3'],3)
commonFuc().check_text_exist_result_text('succeed','succeed') commonFuc().check_text_exist_result_text('succeed','succeed')
except: except:
commonFuc().check_text_exist_result_text('error','1') commonFuc().check_text_exist_result_text('error','1')
\ No newline at end of file
...@@ -7,7 +7,8 @@ from common.common_func import commonFuc ...@@ -7,7 +7,8 @@ from common.common_func import commonFuc
from common.fileUtls import FileUtils from common.fileUtls import FileUtils
import json import json
#添加[]
# 添加[]
def get_process_list(request_body): def get_process_list(request_body):
request_body = "[" + str(request_body) + "]" request_body = "[" + str(request_body) + "]"
print('request_body', request_body) print('request_body', request_body)
...@@ -17,12 +18,18 @@ def get_process_list(request_body): ...@@ -17,12 +18,18 @@ def get_process_list(request_body):
print(new_request_body2) print(new_request_body2)
request_body_json = json.loads(new_request_body2, encoding='utf-8') request_body_json = json.loads(new_request_body2, encoding='utf-8')
return request_body_json return request_body_json
def get_branch_id(): def get_branch_id():
return FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"] return FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
def get_hosid(): def get_hosid():
branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"] branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"]
hosId = branch_id[0:5] hosId = branch_id[0:5]
return hosId return hosId
def approval_center(): def approval_center():
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始 # 登录获取用户id等信息,使用创建的用户登录===========开始
...@@ -61,7 +68,6 @@ def approval_center(): ...@@ -61,7 +68,6 @@ def approval_center():
commonFuc().check_text_exist(0, result) commonFuc().check_text_exist(0, result)
taskId = commonFuc().analysis_json('taskId', data1[0]) taskId = commonFuc().analysis_json('taskId', data1[0])
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "approvalBatch_url") url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "approvalBatch_url")
# 请求体 # 请求体
...@@ -80,15 +86,17 @@ def approval_center(): ...@@ -80,15 +86,17 @@ def approval_center():
commonFuc().check_text_exist(0, result) commonFuc().check_text_exist(0, result)
else: else:
commonFuc().check_text_exist('error', result) commonFuc().check_text_exist('error', result)
def login(username,password,type=1):
def login(username, password, type=1):
print('username,password', username, password) print('username,password', username, password)
#外网登录 # 外网登录
if type==1: if type == 1:
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
# # 获取token和projectCode # # 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token() token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 内网登录 # 内网登录
elif type==2: elif type == 2:
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
token, projectCode, uxid, corpId, info = login_system(username, password).get_token() token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
else: else:
...@@ -96,6 +104,7 @@ def login(username,password,type=1): ...@@ -96,6 +104,7 @@ def login(username,password,type=1):
token, projectCode, uxid, corpId, info = login_system(username, password).get_token() token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
return token, projectCode, uxid, corpId, info return token, projectCode, uxid, corpId, info
def settle(): # 结算相关 def settle(): # 结算相关
module = "b5_spd3_core_business_flow" module = "b5_spd3_core_business_flow"
# # 登录获取用户id等信息,使用创建的用户登录===========开始 # # 登录获取用户id等信息,使用创建的用户登录===========开始
...@@ -140,7 +149,8 @@ def settle(): # 结算相关 ...@@ -140,7 +149,8 @@ def settle(): # 结算相关
print('result', result) print('result', result)
# ================== 生成结算单============================== # ================== 生成结算单==============================
def get_stockId(name='东土城院区中心库房'):
def get_stockId(name, type=1):
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 内网登录 # 内网登录
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
...@@ -148,7 +158,7 @@ def get_stockId(name='东土城院区中心库房'): ...@@ -148,7 +158,7 @@ def get_stockId(name='东土城院区中心库房'):
password = commonFuc().get_business_data(module, "password") password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode # 获取token和projectCode
token, projectCode, uxid, corpId, info = login(username, password,2) token, projectCode, uxid, corpId, info = login(username, password, 2)
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockInfo_stockTree_url") url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockInfo_stockTree_url")
# url=url+userid # url=url+userid
print(url) print(url)
...@@ -158,7 +168,8 @@ def get_stockId(name='东土城院区中心库房'): ...@@ -158,7 +168,8 @@ def get_stockId(name='东土城院区中心库房'):
commonFuc().get_business_data(module, "X-APP-CODE")) commonFuc().get_business_data(module, "X-APP-CODE"))
# 请求体 # 请求体
request_body = commonFuc().get_business_data(module, "payload62_1") request_body = commonFuc().get_business_data(module, "payload62_1_1_1", get_hosid(), name)
print('request_body', request_body)
# # # 发送请求 # # # 发送请求
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result) print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
...@@ -170,17 +181,42 @@ def get_stockId(name='东土城院区中心库房'): ...@@ -170,17 +181,42 @@ def get_stockId(name='东土城院区中心库房'):
commonFuc().check_text_exist(0, result) commonFuc().check_text_exist(0, result)
else: else:
commonFuc().check_text_exist('error', result) commonFuc().check_text_exist('error', result)
# 增加一段根据库房名称返回id if type == 1:
print('data', data) # 增加一段根据库房名称返回id
for i in data: print('data', data)
cname = commonFuc().analysis_json('cname', i) for i in data:
print(cname) cname = commonFuc().analysis_json('cname', i)
if cname == name: print(cname)
print(cname, 'ccccccccccccccccccccccccccc') if cname == name:
id1 = commonFuc().analysis_json('id', i) print(cname, 'ccccccccccccccccccccccccccc')
# print(id1) id1 = commonFuc().analysis_json('id', i)
return id1 # print(id1)
# break return id1
# break
elif type == 2:
children = []
print('data', data)
for i in data:
print('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', i)
children = i['children']
break
for i in children:
cname = i['cname']
if cname == name:
id2 = commonFuc().analysis_json('id', i)
print(id2)
return id2
elif type == 3:
children = []
print('data', data)
children=commonFuc().analysis_json('children',commonFuc().analysis_json('children',data))
print('children',children)
for i in children:
id3=i['id']
print(id3)
return id3
def dept_query_all(): # 科室查询,将科室id写入文件中 def dept_query_all(): # 科室查询,将科室id写入文件中
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 内网登录 # 内网登录
...@@ -227,7 +263,8 @@ def dept_query_all(): # 科室查询,将科室id写入文件中 ...@@ -227,7 +263,8 @@ def dept_query_all(): # 科室查询,将科室id写入文件中
info1.append(ename) info1.append(ename)
FileUtils().w_info8(info1, module, '所有科室name', titlename, 'message6') FileUtils().w_info8(info1, module, '所有科室name', titlename, 'message6')
def get_stockAreaId(dept_id,stockId):
def get_stockAreaId(dept_id, stockId):
module = "b2_herp3_bs" module = "b2_herp3_bs"
# 内网登录 # 内网登录
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
...@@ -248,7 +285,7 @@ def get_stockAreaId(dept_id,stockId): ...@@ -248,7 +285,7 @@ def get_stockAreaId(dept_id,stockId):
# 请求体 # 请求体
request_body = commonFuc().get_business_data(module, "payload62_4", dept_id, stockId) request_body = commonFuc().get_business_data(module, "payload62_4", dept_id, stockId)
print('request_body查询库区id',request_body) print('request_body查询库区id', request_body)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result) print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言 # 断言
...@@ -268,29 +305,43 @@ def get_stockAreaId(dept_id,stockId): ...@@ -268,29 +305,43 @@ def get_stockAreaId(dept_id,stockId):
shelfName = commonFuc().analysis_json('shelfName', i) shelfName = commonFuc().analysis_json('shelfName', i)
print(shelfName) print(shelfName)
if shelfName == '默认库区': if shelfName == '默认库区':
import time
# time.sleep(60)
print(shelfName, 'ccccccccccccccccccccccccccc') print(shelfName, 'ccccccccccccccccccccccccccc')
id1 = commonFuc().analysis_json('id', i) id1 = commonFuc().analysis_json('id', i)
shelfCode = commonFuc().analysis_json('shelfCode', i) shelfCode = commonFuc().analysis_json('shelfCode', i)
areaName = commonFuc().analysis_json('shelfName', i) areaName = commonFuc().analysis_json('shelfName', i)
print('get_stockAreaIdssssssssssssssssssssssssssssssssss',id1) print('get_stockAreaIdssssssssssssssssssssssssssssssssss', id1)
return id1 return id1
def set_dept_user(dept_id,deptName):
module = "b2_herp3_bs"
def set_dept_user(dept_id, deptName, type=1):
module = "b2_herp3_bs"
stockId = 'stockId'
# 获取库房id========= 开始==== # 获取库房id========= 开始====
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"] if type == 1:
stockId=get_stockId(branch_name+'中心库房') # 中心库房名称
print(stockId) branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId = get_stockId(branch_name + '中心库房')
# 二级库房名称
elif type == 2:
stockId = get_stockId(deptName + '库房', 2)
print(stockId)
elif type == 3:
stockId = get_stockId(deptName + '库房', 3)
print(stockId)
# 获取库房id==========结束============ # 获取库房id==========结束============
# ====获取库区id===== 开始========== # ====获取库区id===== 开始==========
stockAreaId = get_stockAreaId(dept_id, stockId) stockAreaId = get_stockAreaId(dept_id, stockId)
print(stockAreaId)
# ====获取库区id===== 结束========== # ====获取库区id===== 结束==========
dept_query_all() # dept_query_all()
#登录获取用户id等信息,使用创建的用户登录===========开始 # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8(module, "用户名信息",'message3') info = FileUtils().r_info8(module, "用户名信息", 'message3')
print(info) print(info)
username1 = info['username1'] username1 = info['username1']
...@@ -311,27 +362,19 @@ def set_dept_user(dept_id,deptName): ...@@ -311,27 +362,19 @@ def set_dept_user(dept_id,deptName):
# print( token,projectCode,uxid,corpId,info) # print( token,projectCode,uxid,corpId,info)
# r_d2库房管理_库区设置_人员管理_添加人员 # r_d2库房管理_库区设置_人员管理_添加人员
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "basic_stockUser_insert_url") url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockUser_insert_url")
print('url库房管理_库区设置_人员管理_添加人员',url)
# 获取请求头信息 # 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2", headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token, commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE")) commonFuc().get_business_data(module, "X-APP-CODE"))
# # 请求体 # # 请求体
request_body = commonFuc().get_business_data(module, "payload62_9_1_1",dept_id,deptName,get_hosid(),stockAreaId,username1,uxid1,username1) request_body = commonFuc().get_business_data(module, "payload62_9_1_1", dept_id, deptName, get_hosid(), stockAreaId,
# request_body='['+str(request_body)+']' username1, uxid1, username1)
# new_request_body = request_body.replace("'", '"') print('url库房管理_库区设置_人员管理_添加人员request_body',request_body)
# new_request_body = new_request_body.replace("None", 'null')
# print('new_request_body',new_request_body) request_body_json = get_process_list(request_body)
# import json
# request_body_json=""
# try:
# request_body_json = json.loads(new_request_body)
# except json.decoder.JSONDecodeError as e:
# print("JSONDecodeError:", str(e))
# print('request_body',request_body)
request_body_json=get_process_list(request_body)
# # # # 发送请求 # # # # 发送请求
result = commonFuc().http_post(url, request_body_json, headers) result = commonFuc().http_post(url, request_body_json, headers)
print('resultbbbbbbbbbbb', result) print('resultbbbbbbbbbbb', result)
...@@ -346,6 +389,3 @@ def set_dept_user(dept_id,deptName): ...@@ -346,6 +389,3 @@ def set_dept_user(dept_id,deptName):
commonFuc().check_text_exist(0, result) commonFuc().check_text_exist(0, result)
else: else:
commonFuc().check_text_exist('error', result) commonFuc().check_text_exist('error', result)
企业信息: 企业信息:
e_id: CR202404260095 e_id: CR202404260114
cname: 国药集团公司MAU*o cname: 国药集团公司@IKPW
医院信息: 医院信息:
h_id: 湖南省人民医院VlNh5 h_id: 湖南省人民医院c8hq!
h_name: 湖南省人民医院VlNh5 h_name: 湖南省人民医院c8hq!
产品审核信息: 产品审核信息:
MSPid: MSP2404260027_1 MSPid: MSP2404260032_1
hosId: h0347 hosId: h0347
hosGoodsId: h034700003168 hosGoodsId: h034700003173
provGoodsid: provGood-99220277 provGoodsid: provGood-99220282
goodsAuditBillId: MSP2404260027 goodsAuditBillId: MSP2404260032
targetId: MSP2404260027_1 targetId: MSP2404260032_1
...@@ -433,6 +433,7 @@ json_headers2: { ...@@ -433,6 +433,7 @@ json_headers2: {
"payload61_6": {"queryObject":{"orgId":"feb0cc16618c437fb4d033cd339a0377","cname":""},"pageNum":1,"pageSize":"%s"} "payload61_6": {"queryObject":{"orgId":"feb0cc16618c437fb4d033cd339a0377","cname":""},"pageNum":1,"pageSize":"%s"}
"payload62": {"hosId":"h0347"} "payload62": {"hosId":"h0347"}
"payload62_1": {"hosId":"h0347","stockCode":""} "payload62_1": {"hosId":"h0347","stockCode":""}
"payload62_1_1_1": {"hosId":"%s","stockCode":"%s"}
"payload62_2": {"hosId":"h0347","stockCode":"%s"} "payload62_2": {"hosId":"h0347","stockCode":"%s"}
"payload62_3": {"address":"自动化测试","defaultFlag":1,"specialFlag":0,"shelfNo":"自动化测试","shelfName":"自动化测试","stockId":"%s","stockType":0,"tbStatus":1,"linkman":"UID-048618","recPhone":"xhs"} "payload62_3": {"address":"自动化测试","defaultFlag":1,"specialFlag":0,"shelfNo":"自动化测试","shelfName":"自动化测试","stockId":"%s","stockType":0,"tbStatus":1,"linkman":"UID-048618","recPhone":"xhs"}
"payload62_4": {"queryObject":{"deptId":"%s","stockAreaId":"%s","stockCode":"","stockType":"0"},"pageNum":1,"pageSize":50} "payload62_4": {"queryObject":{"deptId":"%s","stockAreaId":"%s","stockCode":"","stockType":"0"},"pageNum":1,"pageSize":50}
......
院区新增: 院区新增:
branch_id: h0347-3529 branch_id: h0347-3530
branch_name: 东土城路院区e)E2Z branch_name: 东土城路院区Aa0!9
科室信息: 科室信息:
dept2_id: ae4dd3f9939e4759a01b13aba449affd dept2_id: f3bdf3a5b94b4f8e9d10d6fe0339ecd6
dept2_name: 二级检验科002 dept2_name: 二级检验科002
...@@ -55,9 +55,9 @@ ...@@ -55,9 +55,9 @@
<tr width="600"> <tr width="600">
<td class='details-col-elapsed'>1</td> <td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0</td> <td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分32</td> <td class='details-col-elapsed'>0分8</td>
<td class="details-col-elapsed">0.0%</td> <td class="details-col-elapsed">100.0%</td>
</tr> </tr>
</table> </table>
...@@ -72,9 +72,9 @@ ...@@ -72,9 +72,9 @@
</tr> </tr>
<tr width="600"> <tr width="600">
<td class="details-col-elapsed"><a href='../log/a_a7流程_中心库入库结算_正结算3_内网验收入库结算/log.html' target='_blank'>a_a7流程_中心库入库结算_正结算3_内网验收入库结算</a></td> <td class="details-col-elapsed"><a href='../log/a_a9流程_中心库入库结算_结算/log.html' target='_blank'>a_a9流程_中心库入库结算_结算</a></td>
<td class="fail">失败</td> <td class="success">成功</td>
<td class="details-col-elapsed">32.68</td> <td class="details-col-elapsed">8.377</td>
<td class="details-col-elapsed">xiaohesheng</td> <td class="details-col-elapsed">xiaohesheng</td>
</tr> </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