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

流程五脚本编写

parent 7629a758
# -*- encoding=utf8 -*-
import json
import traceback
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from air_case.public1.public1.public1 import *
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
from common.timeUtils import timeUtils
from airtest.core.api import using
__author__ = "xiaohesheng"
"""
case_tag:api,spd_core,a_a9流程六_中心库入库结算_负结算,id2302,id2302-9,sit,on
主数据平台:a_a9流程六_中心库入库结算_负结算
python runner_test.py tag id2302-9 debug mdm3
"""
def test1():
#提交采购计划
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-7 debug mdm3")
try:
# test1()
set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'])
commonFuc().check_text_exist_result_text('succeed','succeed')
except:
commonFuc().check_text_exist_result_text('error','1')
\ No newline at end of file
import sys
from airtest.core.helper import using
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from common.common_func import commonFuc from common.common_func import commonFuc
from common.fileUtls import FileUtils from common.fileUtls import FileUtils
...@@ -134,4 +138,214 @@ def settle(): # 结算相关 ...@@ -134,4 +138,214 @@ def settle(): # 结算相关
print('request_body', request_body) print('request_body', request_body)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print('result', result) print('result', result)
# ================== 生成结算单============================== # ================== 生成结算单==============================
\ No newline at end of file
def get_stockId(name='东土城院区中心库房'):
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(username, password,2)
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockInfo_stockTree_url")
# url=url+userid
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"))
# 请求体
request_body = commonFuc().get_business_data(module, "payload62_1")
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
if code == 0 and len(data) >= 1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
# 增加一段根据库房名称返回id
print('data', data)
for i in data:
cname = commonFuc().analysis_json('cname', i)
print(cname)
if cname == name:
print(cname, 'ccccccccccccccccccccccccccc')
id1 = commonFuc().analysis_json('id', i)
# print(id1)
return id1
# break
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,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
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_add_port_url() + commonFuc().get_business_data(module, "deptPage_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, "payload13", branch_id)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', 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('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')
info1 = []
for i in data1:
ename = commonFuc().analysis_json('ename', i)
info1.append(ename)
FileUtils().w_info8(info1, module, '所有科室name', titlename, 'message6')
def get_stockAreaId(dept_id,stockId):
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()
# print( token,projectCode,uxid,corpId,info)
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockShelf_page_url")
# url=url+userid
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"))
# 请求体
request_body = commonFuc().get_business_data(module, "payload62_4", dept_id, stockId)
print('request_body查询库区id',request_body)
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
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)
# 增加一段返回库区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)
shelfCode = commonFuc().analysis_json('shelfCode', i)
areaName = commonFuc().analysis_json('shelfName', i)
print('get_stockAreaIdssssssssssssssssssssssssssssssssss',id1)
return id1
def set_dept_user(dept_id,deptName):
module = "b2_herp3_bs"
# 获取库房id========= 开始====
branch_name = FileUtils().r_info(module, '院区新增')["branch_name"]
stockId=get_stockId(branch_name+'中心库房')
print(stockId)
# 获取库房id==========结束============
# ====获取库区id===== 开始==========
stockAreaId = get_stockAreaId(dept_id, stockId)
# ====获取库区id===== 结束==========
dept_query_all()
#登录获取用户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)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
# r_d2库房管理_库区设置_人员管理_添加人员
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "basic_stockUser_insert_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, "payload62_9_1_1",dept_id,deptName,get_hosid(),stockAreaId,username1,uxid1,username1)
# request_body='['+str(request_body)+']'
# new_request_body = request_body.replace("'", '"')
# new_request_body = new_request_body.replace("None", 'null')
# print('new_request_body',new_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)
print('resultbbbbbbbbbbb', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
data1 = commonFuc().analysis_json('data', data)
# print(type(data1))
# pageSize = commonFuc().analysis_json('pageSize', data)
# print(pageSize, type(pageSize))
if code == 0 and data == 1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
企业信息: 企业信息:
e_id: CR202404250076 e_id: CR202404250171
cname: 国药集团公司bcmfE cname: 国药集团公司Pd98F
医院信息: 医院信息:
h_id: 湖南省人民医院zkOr^ h_id: 湖南省人民医院0Ypq(
h_name: 湖南省人民医院zkOr^ h_name: 湖南省人民医院0Ypq(
产品审核信息: 产品审核信息:
MSPid: MSP2404250022_1 MSPid: MSP2404250042_1
hosId: h0347 hosId: h0347
hosGoodsId: h034700003116 hosGoodsId: h034700003136
provGoodsid: provGood-99220225 provGoodsid: provGood-99220245
goodsAuditBillId: MSP2404250022 goodsAuditBillId: MSP2404250042
targetId: MSP2404250022_1 targetId: MSP2404250042_1
...@@ -441,6 +441,9 @@ json_headers2: { ...@@ -441,6 +441,9 @@ json_headers2: {
"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_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_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":"%s","userId":"%s","userName":"%s"} "payload62_9": {"delFlag":1,"deptId":"%s","deptName":"设备科001","hosId":"h0347","roleId":null,"roleName":"医院管理员","stockAreaId":"%s","tbStatus":1,"userCode":"%s","userId":"%s","userName":"%s"}
"payload62_9_1_1": {"delFlag":1,"deptId":"%s","deptName":"%s","hosId":"%s","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_10": {"queryObject":{"deptId":"%s","stockAreaId":"%s","hosId":"h0347"},"pageNum":1,"pageSize":50}
"payload62_11": {"delFlag":0,"id":"%s"} "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"} "payload62_12": {"shelfNum":"2","shelfColumn":2,"shelfPlie":2,"version":"","defaultFlag":0,"tbStatus":1,"shelfKind":0,"parentId":"%s","stockCode":"%s","shelfNo":"自动化测试","stockId":"%s","stockAreaId":"%s"}
......
院区新增: 院区新增:
branch_id: h0347-3519 branch_id: h0347-3523
branch_name: 东土城路院区dD7&m branch_name: 东土城路院区pIXfi
科室信息: 科室信息:
dept2_id: 0538cdc4d76142c988c53927079462cd dept2_id: 9454bb017ad4445caaf66a61b8ca207c
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'>1</td> <td class='details-col-elapsed'>0</td>
<td class='details-col-elapsed'>0分25秒</td> <td class='details-col-elapsed'>0分5秒</td>
<td class="details-col-elapsed">100.0%</td> <td class="details-col-elapsed">0.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_a8流程_中心库入库结算_结算3_外网开票/log.html' target='_blank'>a_a8流程_中心库入库结算_结算3_外网开票</a></td> <td class="details-col-elapsed"><a href='../log/a_a9流程_中心库入库结算_结算/log.html' target='_blank'>a_a9流程_中心库入库结算_结算</a></td>
<td class="success">成功</td> <td class="fail">失败</td>
<td class="details-col-elapsed">25.005</td> <td class="details-col-elapsed">5.267</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