Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-airtest-web-spd
Commits
4e63a54a
Commit
4e63a54a
authored
Jul 29, 2024
by
xiao-hesheng
Browse files
数据库验证流程十三脚本编写
parent
f721bf16
Changes
4
Hide whitespace changes
Inline
Side-by-side
air_case/b6_spd3_core_business_flow_database_check/a_b3流程十请领业务流_二级库向边仓_数据库验证.air/a_b3流程十请领业务流_二级库向边仓_数据库验证.py
View file @
4e63a54a
...
@@ -465,8 +465,7 @@ def mcms_dept_buy_detail_approval_after(type=16):
...
@@ -465,8 +465,7 @@ def mcms_dept_buy_detail_approval_after(type=16):
print
(
'error'
)
print
(
'error'
)
commonFuc
().
check_text_exist_result_text
(
'error'
,
'succees'
)
commonFuc
().
check_text_exist_result_text
(
'error'
,
'succees'
)
def
main
():
try
:
# ==================暂时注释===================================
# ==================暂时注释===================================
set_dept_lead
()
# 设置二级科室负责人
set_dept_lead
()
# 设置二级科室负责人
# 科室必须同步到外网,集中管控平台创建边仓才能选择到用户,"deptType":"0"
# 科室必须同步到外网,集中管控平台创建边仓才能选择到用户,"deptType":"0"
...
@@ -510,8 +509,12 @@ try:
...
@@ -510,8 +509,12 @@ try:
check_mcms_dept_buy_approval_after
(
int
(
i
))
check_mcms_dept_buy_approval_after
(
int
(
i
))
mcms_dept_buy_detail_approval_after
(
int
(
i
))
mcms_dept_buy_detail_approval_after
(
int
(
i
))
check_buyWayText
()
#
验证出库渠道是否为边仓
check_buyWayText
()
#
验证出库渠道是否为边仓
commonFuc
().
check_text_exist_result_text
(
'succees'
,
'succees'
)
commonFuc
().
check_text_exist_result_text
(
'succees'
,
'succees'
)
try
:
main
()
except
Exception
as
e
:
except
Exception
as
e
:
# 打印错误信息
# 打印错误信息
print
(
f
"发生错误:
{
e
}
"
)
print
(
f
"发生错误:
{
e
}
"
)
...
...
air_case/b6_spd3_core_business_flow_database_check/a_b4流程十一请领业务流_二级库向直送_数据库验证.air/a_b4流程十一请领业务流_二级库向直送_数据库验证.py
View file @
4e63a54a
...
@@ -1166,7 +1166,9 @@ def check_hdi_distr(type=16):
...
@@ -1166,7 +1166,9 @@ def check_hdi_distr(type=16):
get_id
(
"select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';"
%
(
get_id
(
"select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';"
%
(
branch_id
,
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
])))
branch_id
,
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
])))
rec_org_name
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
rec_org_name
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
last_modified
=
create_time
last_modified
=
get_create_time
(
"select last_modified from hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
type
))
confirmUser
=
distrUser
confirmUser
=
distrUser
ext_info
=
get_ext_info
(
branch_id
,
type
)
ext_info
=
get_ext_info
(
branch_id
,
type
)
confirmTime
=
reGetString
(
ext_info
,
r
'"confirmTime":"'
,
r
'""confirmUser'
)
confirmTime
=
reGetString
(
ext_info
,
r
'"confirmTime":"'
,
r
'""confirmUser'
)
...
@@ -1218,7 +1220,9 @@ def check_hdi_distr(type=16):
...
@@ -1218,7 +1220,9 @@ def check_hdi_distr(type=16):
get_id
(
"select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';"
%
(
get_id
(
"select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';"
%
(
branch_id
,
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
])))
branch_id
,
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
])))
rec_org_name
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
rec_org_name
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
last_modified
=
create_time
last_modified
=
get_create_time
(
"select last_modified from hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
type
))
confirmUser
=
distrUser
confirmUser
=
distrUser
ext_info
=
get_ext_info
(
branch_id
,
type
)
ext_info
=
get_ext_info
(
branch_id
,
type
)
confirmTime
=
reGetString
(
ext_info
,
r
'"confirmTime":"'
,
r
'""confirmUser'
)
confirmTime
=
reGetString
(
ext_info
,
r
'"confirmTime":"'
,
r
'""confirmUser'
)
...
@@ -1270,7 +1274,9 @@ def check_hdi_distr(type=16):
...
@@ -1270,7 +1274,9 @@ def check_hdi_distr(type=16):
get_id
(
"select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';"
%
(
get_id
(
"select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';"
%
(
branch_id
,
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
])))
branch_id
,
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
])))
rec_org_name
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
rec_org_name
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
last_modified
=
create_time
last_modified
=
get_create_time
(
"select last_modified from hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
type
))
confirmUser
=
distrUser
confirmUser
=
distrUser
ext_info
=
get_ext_info
(
branch_id
,
type
)
ext_info
=
get_ext_info
(
branch_id
,
type
)
confirmTime
=
reGetString
(
ext_info
,
r
'"confirmTime":"'
,
r
'""confirmUser'
)
confirmTime
=
reGetString
(
ext_info
,
r
'"confirmTime":"'
,
r
'""confirmUser'
)
...
...
data/b5_spd3_core_business_flow/message15
View file @
4e63a54a
验收单号
:
验收单号
:
CHECK_NO1
:
CHECKh0347202407290003
1
CHECK_NO1
:
CHECKh0347202407290003
4
CHECK_NO2
:
CHECKh0347202407290003
1
CHECK_NO2
:
CHECKh0347202407290003
4
main1/main_text2.py
0 → 100644
View file @
4e63a54a
import
time
import
sys
import
os
# print('根据当前文件获取当前文件所在目录的路径', os.path.dirname(__file__))
import
traceback
from
air_case.public1.public1.public1
import
approval_center
,
approval_center_all
curPath
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
# 获取当前文件的所在目录的绝对路径
# print('将路径中的/换成\\', curPath) # C:\Users\Administrator\Desktop\temp\dbshop99\main
# # #将当前文件的所在目录的绝对路径进行分离,分离成 ('C:\\Users\\Administrator\\Desktop\\temp\\dbshop99', 'main'),存到元组中
# print('切割路径,切割成一个元组,将路径分离', os.path.split(curPath))
rootPath
=
os
.
path
.
split
(
curPath
)[
0
]
# [0]表示元组中的为一个元素
# print('当前项目的根目录', rootPath)
sys
.
path
.
append
(
rootPath
)
# 将项目的根目录路径添加到环境变量中,然后在cmd命令行中就可以正常运行脚本
sys
.
path
.
append
(
os
.
path
.
join
(
rootPath
,
'common'
))
# print('根据当前文件获取当前文件所在目录的路径', os.path.dirname(__file__))
from
airtest.core.helper
import
using
from
common.common_func
import
commonFuc
from
common.db.sql.sql_del_branch_info
import
delData
import
tkinter
as
tk
from
tkinter
import
*
import
tkinter.messagebox
from
common.run_cmd_script
import
execute_command
pro_path
=
commonFuc
().
get_pro_path2
()
print
(
'pro_path'
,
pro_path
)
def
main_text
():
# 创建窗口
root
=
tk
.
Tk
()
# 获取屏幕宽高
window_width
=
root
.
winfo_screenwidth
()
window_height
=
root
.
winfo_screenheight
()
# 设置窗口大小
root
.
geometry
(
'800x560'
)
# 刷新窗口参数
root
.
update
()
# 计算窗口居中时左上角的坐标
x
=
(
window_width
-
root
.
winfo_width
())
//
2
y
=
(
window_height
-
root
.
winfo_height
())
//
2
# 设置窗口左上角的坐标
root
.
geometry
(
"+{}+{}"
.
format
(
x
,
y
))
root
.
title
(
string
=
"数据库验证核心业务流"
)
root
.
resizable
(
False
,
False
)
# for a in ['n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw']:
# Button(root,
# text='anchor',
# anchor=a,
# width=30,
# height=4).pack()
def
flow1
():
print
(
'调用流程一'
)
# from execute import flow1
# flow1()
# print('流程一执行完毕')
# execute_command("python runner_test.py tag id2302-1 debug mdm3")
# sys.exit(0)
def
flow2
():
print
(
'调用流程二'
)
# from execute import flow2
# flow2()
# print('流程2执行完毕')
# execute_command("python runner_test.py tag id2302-2 debug mdm3")
# sys.exit(0)
def
flow3
():
print
(
'调用流程三'
)
# from execute import flow3
# flow3()
# print('流程3执行完毕')
# execute_command("python runner_test.py tag id2302-3 debug mdm3")
# sys.exit(0)
def
flow4
():
print
(
'调用流程四'
)
# execute_command("python runner_test.py tag id2302-4 debug mdm3")
# from execute import flow4
# flow4()
# print('流程4执行完毕')
# sys.exit(0)
def
flow5
():
print
(
'调用流程五'
)
# execute_command("python runner_test.py tag id2302-5,id2302-6,id2302-7,id2302-8 debug mdm3")
# from execute import flow5,flow6,flow7,flow8
# flow5()
# flow6()
# flow7()
# flow8()
# print('流程5执行完毕')
# sys.exit(0)
def
flow6
():
print
(
'调用流程六'
)
# from execute import flow9
# flow9()
# print('流程6执行完毕')
# sys.exit(0)
def
flow7
():
print
(
'流程七开始执行'
)
# from execute import flow10
# flow10()
# print('流程七执行完毕')
# sys.exit(0)
def
flow8
():
print
(
'调用流程八'
)
# from execute import flow11
# flow11()
# print('流程八执行完毕','流程八执行完毕 ')
# sys.exit(0)
def
flow9
():
print
(
'调用流程九'
)
# from execute import flow12
# flow12()
# print('流程9执行完毕','流程9执行完毕')
# sys.exit(0)
def
flow10
():
print
(
'数据库验证_流程十'
)
sys
.
path
.
append
(
pro_path
+
r
'/air_case/b6_spd3_core_business_flow_database_check/a_b3流程十请领业务流_二级库向边仓_数据库验证.air'
)
using
(
pro_path
+
r
'//air_case/b6_spd3_core_business_flow_database_check/a_b3流程十请领业务流_二级库向边仓_数据库验证.air'
)
from
a_b3流程十请领业务流_二级库向边仓_数据库验证
import
main
# main()
print
(
'数据库验证_流程十执行完毕'
,
'流程十执行完毕'
)
# sys.exit(0)
def
flow11
():
print
(
'调用流程十一'
)
sys
.
path
.
append
(
pro_path
+
r
'/air_case/b6_spd3_core_business_flow_database_check/a_b4流程十一请领业务流_二级库向直送_数据库验证.air'
)
using
(
pro_path
+
r
'//air_case/b6_spd3_core_business_flow_database_check/a_b4流程十一请领业务流_二级库向直送_数据库验证.air'
)
# from a_b4流程十一请领业务流_二级库向直送_数据库验证 import main
# print('流程11执行完毕','flow11执行完毕')
# sys.exit(0)
def
flow12
():
print
(
'调用流程十二'
)
sys
.
path
.
append
(
pro_path
+
r
'/air_case/b6_spd3_core_business_flow_database_check/a_b5流程十二请领业务流_二级库向二级库_数据库验证.air'
)
using
(
pro_path
+
r
'//air_case/b6_spd3_core_business_flow_database_check/a_b5流程十二请领业务流_二级库向二级库_数据库验证.air'
)
# from a_b5流程十二请领业务流_二级库向二级库_数据库验证 import main
# print('流程12执行完毕', 'flow12执行完毕')
# sys.exit(0)
def
flow13
():
print
(
'调用流程十三'
)
sys
.
path
.
append
(
pro_path
+
r
'/air_case/b6_spd3_core_business_flow_database_check/a_b6流程十三请领业务流_三级库向二级库_数据库验证.air'
)
using
(
pro_path
+
r
'//air_case/b6_spd3_core_business_flow_database_check/a_b6流程十三请领业务流_三级库向二级库_数据库验证.air'
)
# from a_b6流程十三请领业务流_三级库向二级库_数据库验证 import main
print
(
'流程13执行完毕'
,
'flow13执行完毕'
)
# sys.exit(0)
def
flow14
():
print
(
'调用流程十四'
)
# from execute import flow17
# flow17()
# print('流程14执行完毕', 'flow14执行完毕')
# sys.exit(0)
def
flow15
():
print
(
'调用流程十五'
)
# from execute import flow18
# flow18()
# print('流程十五执行完毕')
# sys.exit(0)
def
flow16
():
# from execute import flow19
# flow19()
print
(
'流程十六执行完毕'
)
sys
.
exit
(
0
)
def
flow17
():
# from execute import flow20
# flow20()
print
(
'流程十七执行完毕'
)
sys
.
exit
(
0
)
def
flow18
():
# from execute import flow21
# flow21()
print
(
'流程十八执行完毕'
)
sys
.
exit
(
0
)
def
flow0
():
# execute_command("python runner_test.py tag id2302-23 debug mdm3")
sys
.
exit
(
0
)
def
exit
():
print
(
'退出'
)
sys
.
exit
(
0
)
def
del_data
():
# 删除自动化脚本产生的数据
result
=
confirm
()
if
result
==
True
:
result1
=
confirm1
()
if
result1
==
True
:
delData
().
Delete_branch_by_id
()
delData
().
Delete_goods_change_info
()
delData
().
Delete_probeInfo_other
()
# delData().Del_supply_relation()
delData
().
Delete_business_Data
()
delData
().
Del_reporter_data
()
delData
().
Delete_business_Data_All
()
delData
().
Delete_business_Data_All2
()
print
(
'===================删除垃圾数据完毕============================'
)
else
:
print
(
'Cancel'
)
# def flow5_flow18():
# #脚本运行前清空所有待审批数据
# approval_center_all()
# try:
# flow5()
# flow6()
# flow7()
# flow8()
# flow9()
# flow10()
# flow11()
# flow12()
# flow13()
# flow14()
# flow15()
# flow16()
# flow17()
# flow18()
# except Exception as e:
# print('脚本出现异常,请检查脚本或者数据')
# print("发生异常:", str(e))
# traceback.print_exc()
# def flow11_flow18():
# flow11()
# flow12()
# flow13()
# flow14()
# flow15()
# flow16()
# flow17()
# flow18()
def
confirm
():
result
=
tkinter
.
messagebox
.
askokcancel
(
"确认"
,
"您确定要执行此操作吗?"
)
# print(result)
print
(
"用户选择了:"
,
"OK"
if
result
else
"Cancel"
)
return
result
def
confirm1
():
result
=
tkinter
.
messagebox
.
askokcancel
(
"再次确认"
,
"您确定要执行此删除操作吗?数据删除后不可逆."
)
# print(result)
print
(
"用户选择了:"
,
"OK"
if
result
else
"Cancel"
)
return
result
def
download_data
():
print
(
'从Jenkins服务器下载data数据'
)
# 文本显示的位置。
Button
(
root
,
text
=
'流程一
\n
外网企业注册审批'
,
width
=
16
,
height
=
8
,
command
=
flow1
).
grid
(
row
=
2
,
column
=
0
)
Button
(
root
,
text
=
'流程二
\n
供货关系申请审批'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow2
).
grid
(
row
=
2
,
column
=
2
)
Button
(
root
,
text
=
'流程三
\n
流程三_产品导
\n
入和审批'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow3
).
grid
(
row
=
2
,
column
=
4
)
Button
(
root
,
text
=
'流程
\n
内网基础模块设置'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow4
).
grid
(
row
=
2
,
column
=
6
)
Button
(
root
,
text
=
'流程五
\n
中心库入库正结算
\n
开票'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow5
).
grid
(
row
=
2
,
column
=
8
)
Button
(
root
,
text
=
'流程六
\n
中心库入库负结算'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow6
).
grid
(
row
=
2
,
column
=
10
)
Button
(
root
,
text
=
'流程七
\n
中心库入库正负结算'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow7
).
grid
(
row
=
3
,
column
=
0
)
Button
(
root
,
text
=
'流程八
\n
高值跟台业务'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow8
).
grid
(
row
=
3
,
column
=
2
)
Button
(
root
,
text
=
'流程九
\n
请领业务二级库向
\n
中心库'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow9
).
grid
(
row
=
3
,
column
=
4
)
Button
(
root
,
text
=
'流程十
\n
请领业务流_二级库
\n
向边仓'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow10
).
grid
(
row
=
3
,
column
=
6
)
Button
(
root
,
text
=
'流程十一
\n
请领业务流_二级库
\n
向直送'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow11
).
grid
(
row
=
3
,
column
=
8
)
Button
(
root
,
text
=
'流程十二
\n
请领业务流_二级库
\n
向二级库'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow12
).
grid
(
row
=
3
,
column
=
10
)
Button
(
root
,
text
=
'流程十三
\n
请领业务流_三级库
\n
向二级库'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow13
).
grid
(
row
=
4
,
column
=
0
)
Button
(
root
,
text
=
'流程十四
\n
退库业务消耗退库'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow14
).
grid
(
row
=
4
,
column
=
2
)
Button
(
root
,
text
=
'流程十五
\n
退库业务三级库向
\n
二级库退库'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow15
).
grid
(
row
=
4
,
column
=
4
)
Button
(
root
,
text
=
'流程十六
\n
退库业务_二级库向
\n
一级库退库'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow16
).
grid
(
row
=
4
,
column
=
6
)
Button
(
root
,
text
=
'流程十七
\n
退库业务_中心库退
\n
供应商'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow17
).
grid
(
row
=
4
,
column
=
8
)
Button
(
root
,
text
=
'流程十八
\n
中心库业务_拆包功能'
,
anchor
=
'center'
,
width
=
16
,
height
=
8
,
command
=
flow18
).
grid
(
row
=
4
,
column
=
10
)
#Button(root, text='一键执行', anchor='center', width=8, height=2,command=flow0).grid(row=5,column=2)
# Button(root, text='流程五开始\n一键执行', anchor='center', width=8, height=2,command=flow5_flow18).grid(row=5,column=4)
Button
(
root
,
text
=
'删除垃圾
\n
数据'
,
anchor
=
'center'
,
width
=
8
,
height
=
2
,
command
=
del_data
).
grid
(
row
=
5
,
column
=
6
)
# Button(root, text='流程十一开始\n一键执行', anchor='center', width=8, height=2,command=flow11_flow18).grid(row=5,column=8)
Button
(
root
,
text
=
'从jenkins
\n
下载data
\n
数据'
,
anchor
=
'center'
,
width
=
8
,
height
=
2
,
command
=
download_data
).
grid
(
row
=
5
,
column
=
10
)
Button
(
root
,
text
=
'退 出'
,
anchor
=
'center'
,
width
=
8
,
height
=
2
,
command
=
exit
).
grid
(
row
=
5
,
column
=
10
)
# Button(root, text='anchor', anchor='e', width=30, height=4).pack()
# Button(root, text='anchor', anchor='w', width=30, height=4).pack()
# Button(root, text='anchor', anchor='ne', width=30, height=4).pack()
# Button(root, text='anchor', anchor='nw', width=30, height=4).pack()
# Button(root, text='anchor', anchor='se', width=30, height=4).pack()
# Button(root, text='anchor', anchor='sw', width=30, height=4).pack()
root
.
mainloop
()
main_text
()
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment