Commit 050fbfe0 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程九脚本编写

parent ffa55214
...@@ -72,4 +72,3 @@ def test1(): ...@@ -72,4 +72,3 @@ def test1():
test1() test1()
dept_query_all()
\ No newline at end of file
# -*- encoding=utf8 -*- # -*- encoding=utf8 -*-
from air_case.public1.public1.public1 import get_hosid from air_case.public1.public1.public1 import get_hosid
from common.db.sql.sql_del_branch_info import delData
from common.fileUtls import FileUtils from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command from common.run_cmd_script import execute_command
...@@ -262,6 +263,8 @@ def grants_user(orgName='d69a68df361a4289b2262e4ef75b55a5', mgrRangeId='feb0cc16 ...@@ -262,6 +263,8 @@ def grants_user(orgName='d69a68df361a4289b2262e4ef75b55a5', mgrRangeId='feb0cc16
commonFuc().check_text_exist('error', result) commonFuc().check_text_exist('error', result)
try: try:
delData().Delete_business_Data()#删除业务数据
delData().Del_reporter_data() # 删除报表数据
test1() test1()
test2()# 科室添加产品信息(产品是从外网同步过来的) test2()# 科室添加产品信息(产品是从外网同步过来的)
dept_query_all()# 科室查询,将科室id写入文件中 dept_query_all()# 科室查询,将科室id写入文件中
......
...@@ -13,7 +13,7 @@ from airtest.core.api import using ...@@ -13,7 +13,7 @@ from airtest.core.api import using
__author__ = "xiaohesheng" __author__ = "xiaohesheng"
""" """
case_tag:api,spd_core1,a_b2流程九请领业务流_二级库向中心库,id2302,id2302-12,sit,on case_tag:api,spd_core,a_b2流程九请领业务流_二级库向中心库,id2302,id2302-12,sit,on
核心业务流:a_b2流程九请领业务流_二级库向中心库 核心业务流:a_b2流程九请领业务流_二级库向中心库
python runner_test.py tag id2302-12 debug mdm3 python runner_test.py tag id2302-12 debug mdm3
""" """
......
# -*- 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_core1,a_b3流程十请领业务流_二级库向边仓,id2302,id2302-13,sit,on
核心业务流:a_b3流程十请领业务流_二级库向边仓
python runner_test.py tag id2302-13 debug mdm3
"""
try:
token, projectCode, uxid, corpId, info=login_platform()
print(token, projectCode, uxid, corpId, info)
commonFuc().check_text_exist_result_text('succees', 'succees')
except:
commonFuc().check_text_exist_result_text('error', '1')
# -*- encoding=utf8 -*-
__author__ = "xiaohesheng"
"""
case_tag:mdm-web,10086登录,用例集id2226
主数据平台:统一登录接口,第一步获取验证码,第二步登录系统,第三步平台登录验证token
"""
from common.common_func import commonFuc
from common.tokenUtils import *
class login_system():
module = "mdm3_login"
def __init__(self, username, password):
self.username = username
self.password = password
# 获取验证码接口
def get_token(self):
url = commonFuc().get_api_url() + commonFuc().get_business_data(self.module, "VerifyCode_url")
# print("aaaaaaaaaaaaaaaaaa" + url)
# 发送请求
result = commonFuc().http_get(url, headers="", params="")
# print(result)
uuid = commonFuc().analysis_json('uuId', result)
# print(uuid)
# 如果不传参数就使用默认数据登录
# username = commonFuc().get_business_data(self.module, "username")
# password = commonFuc().get_business_data(self.module, "password")
# print(username,password)
username = self.username
password = self.password
EncryptPassword = TokenUtils(username, password, uuid).get_PasswordEncrypt()
# print('加密后的密码', EncryptPassword) # 加密后的密码
login_url = commonFuc().get_api_url() + commonFuc().get_business_data(self.module, "login_url")
request_body = commonFuc().get_business_data(self.module, "payload", username, EncryptPassword, uuid)
# print(request_body)
# #获取请求头信息
headers = commonFuc().get_business_data(self.module, "json_headers",
commonFuc().get_business_data(self.module, "json_contentType"))
# print(headers)
# 发送登录请求
result = commonFuc().http_post(login_url, request_body, headers)
token = commonFuc().analysis_json('token', result)
uxid = commonFuc().analysis_json('uxid', result)
projectCode = commonFuc().analysis_json('projectCode', result)
# print(token, uxid)
# 平台登录,请求头里面有token
headers = commonFuc().get_business_data(self.module, "json_headers2",
commonFuc().get_business_data(self.module, "json_contentType"), token,
projectCode)
# print('平台登录请求头', headers)
platform_login_url = commonFuc().get_api_url() + commonFuc().get_business_data(self.module,
"platform_login_url")
request_body = commonFuc().get_business_data(self.module, "payload2", token, uxid, projectCode)
# print(request_body)
# 发送平台登录请求
result = commonFuc().http_post(platform_login_url, request_body, headers)
print('平台登录接口结果', result)
# 获取预期结果
check_dict = commonFuc().get_business_data(self.module, "checkDict")
# print(check_dict)
# 断言实际结果中是否不包含预期的文本
commonFuc().check_text_exist(uxid, result)
corpId=commonFuc().analysis_json('corpId', result)
info=(token,projectCode,uxid,corpId)
return token,projectCode,uxid,corpId,info
login_system('test001', '1qaz!QAZ').get_token()
# if __name__ == '__main__':
# print(login_system('test001','1qaz!QAZ').get_token())
#1679886114521 a123456!
...@@ -2462,4 +2462,14 @@ def second_dept_one_key_in(): ...@@ -2462,4 +2462,14 @@ def second_dept_one_key_in():
# # # # 发送请求 # # # # 发送请求
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 login_platform():
module = "a3_mdm3_hs"
from air_case.mdm_login.登录外网系统.登录资源管控平台 import login_system
# 登录
username = commonFuc().get_business_data(module, "username2")
password = commonFuc().get_business_data(module, "password")
print(username, password)
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
return token, projectCode, uxid, corpId, info
\ No newline at end of file
...@@ -286,25 +286,25 @@ class delData(object): ...@@ -286,25 +286,25 @@ class delData(object):
hosGoodsId2 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'] hosGoodsId2 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId']
hosGoodsId3 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'] hosGoodsId3 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId']
# 条码 # 条码
sql1 = "delete from mcms_pkg where branch_id=%s" % branch_id sql1 = "delete from mcms_pkg where branch_id='%s';" % branch_id
sql2 = "delete from mcms_pkg_batch where hos_goods_id in('%s','%s','%s');" % ( sql2 = "delete from mcms_pkg_batch where hos_goods_id in('%s','%s','%s');" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3) hosGoodsId1, hosGoodsId2, hosGoodsId3)
sql3 = "delete from hdi_barcode where branch_id=%s" % branch_id sql3 = "delete from hdi_barcode where branch_id='%s';" % branch_id
sql4 = "delete from cabinet_epc_info where branch_id=%s" % branch_id # sql4 = "delete from cabinet_epc_info where branch_id=%s" % branch_id
cursor.execute(sql1) cursor.execute(sql1)
cursor.execute(sql2) cursor.execute(sql2)
cursor.execute(sql3) cursor.execute(sql3)
cursor.execute(sql4)
cursor.execute("commit;") cursor.execute("commit;")
# 批次 # 批次
sql = "delete from mcms_hos_batch where branch_id=%s" % branch_id sql = "delete from mcms_hos_batch where branch_id='%s'" % branch_id
cursor.execute(sql) cursor.execute(sql)
cursor.execute("commit;") cursor.execute("commit;")
# 库存 # 库存
sql1 = "delete from mcms_stockpile where branch_id=%s" % branch_id sql1 = "delete from mcms_stockpile where branch_id='%s';" % branch_id
sql2 = "delete from mcms_stockpile_taking where hos_goods_id in('%s','%s','%s')" % ( sql2 = "delete from mcms_stockpile_taking where hos_goods_id in('%s','%s','%s');" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3) hosGoodsId1, hosGoodsId2, hosGoodsId3)
sql3 = "delete from mcms_stockpile_flow where branch_id=%s" % branch_id sql3 = "delete from mcms_stockpile_flow where branch_id='%s';" % branch_id
cursor.execute(sql1) cursor.execute(sql1)
cursor.execute(sql2) cursor.execute(sql2)
cursor.execute(sql3) cursor.execute(sql3)
...@@ -344,7 +344,7 @@ class delData(object): ...@@ -344,7 +344,7 @@ class delData(object):
cursor.execute("commit;") cursor.execute("commit;")
# 验收单 # 验收单
sql1 = "delete from mcms_check where prov_name like '%国药集团公司_____';" sql1 = "delete from mcms_check where branch_id ='%s';"%branch_id
sql2 = "delete from mcms_check_batch where hos_goods_id in('%s','%s','%s')" % ( sql2 = "delete from mcms_check_batch where hos_goods_id in('%s','%s','%s')" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3) hosGoodsId1, hosGoodsId2, hosGoodsId3)
cursor.execute(sql1) cursor.execute(sql1)
...@@ -361,7 +361,8 @@ class delData(object): ...@@ -361,7 +361,8 @@ class delData(object):
cursor.execute(sql3) cursor.execute(sql3)
cursor.execute("commit;") cursor.execute("commit;")
# 单据 # 单据
sql1 = "delete from mcms_psi where target_branch_id=%s" % branch_id sql1 = "delete from mcms_psi where target_branch_id='%s';" % branch_id
sql6="delete from mcms_psi where target_dept_name like '%国药集团公司_____';"
sql2 = "delete from mcms_psi_batch where hos_goods_id in('%s','%s','%s');" % ( sql2 = "delete from mcms_psi_batch where hos_goods_id in('%s','%s','%s');" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3) hosGoodsId1, hosGoodsId2, hosGoodsId3)
sql3 = "delete from mcms_psi_dept where target_branch_id='%s';" % branch_id sql3 = "delete from mcms_psi_dept where target_branch_id='%s';" % branch_id
...@@ -373,6 +374,7 @@ class delData(object): ...@@ -373,6 +374,7 @@ class delData(object):
cursor.execute(sql3) cursor.execute(sql3)
cursor.execute(sql4) cursor.execute(sql4)
cursor.execute(sql5) cursor.execute(sql5)
cursor.execute(sql6)
cursor.execute("commit;") cursor.execute("commit;")
# 手术通知单 # 手术通知单
...@@ -446,3 +448,4 @@ class delData(object): ...@@ -446,3 +448,4 @@ class delData(object):
# delData().Del_goods_info(i) # delData().Del_goods_info(i)
# delData().Del_supply_relation() # delData().Del_supply_relation()
# delData().Del_reporter_data() # delData().Del_reporter_data()
# delData().Delete_business_Data()
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<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'>1</td>
<td class='details-col-elapsed'>1分45</td> <td class='details-col-elapsed'>0分3</td>
<td class="details-col-elapsed">100.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_b1流程八_高值跟台业务流程/log.html' target='_blank'>a_b1流程八_高值跟台业务流程</a></td> <td class="details-col-elapsed"><a href='../log/a_b3流程十请领业务流_二级库向边仓/log.html' target='_blank'>a_b3流程十请领业务流_二级库向边仓</a></td>
<td class="success">成功</td> <td class="success">成功</td>
<td class="details-col-elapsed">105.043</td> <td class="details-col-elapsed">3.737</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