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
baffec21
Commit
baffec21
authored
Sep 26, 2024
by
xiao-hesheng
Browse files
流程五脚本提交
parent
4ee05bf4
Changes
3
Hide whitespace changes
Inline
Side-by-side
air_case/b6_spd3_core_business_flow_database_check/a_a5流程五_中心库入库结算_正结算1_提交采购计划_数据库验证.air/a_a5流程五_中心库入库结算_正结算1_提交采购计划_数据库验证.py
View file @
baffec21
# -*- encoding=utf8 -*-
# -*- encoding=utf8 -*-
import
traceback
import
traceback
from
air_case.public1.public1.public1
import
updateUserLoginDefaultRange
,
get_listUserMgrRangePage
,
call_login
from
air_case.public1.public1.public1
import
updateUserLoginDefaultRange
,
get_listUserMgrRangePage
,
call_login
,
\
get_branch_id
,
process_tuple
,
get_dept_buy_id
,
check_mcms_pur_plan_sql
,
get_hosid
,
get_id
,
\
get_stockAreaId_new_fromDb
,
get_login_user_uxid
,
get_expdt_date
,
get_create_time
,
get_process_list2
,
\
compare_text_index
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
...
@@ -19,7 +22,263 @@ from airtest.core.api import using
...
@@ -19,7 +22,263 @@ from airtest.core.api import using
import
sys
import
sys
import
time
import
time
module
=
"b6_spd3_core_business_flow_database_check"
# 检查采购计划主表
def
check_mcms_mcms_pur_plan
(
type
=
16
):
branch_id
=
get_branch_id
()
# 获取请领单主键id
sql
=
"select id from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
type
)
print
(
sql
)
id1
=
process_tuple
(
get_dept_buy_id
(
sql
))
sql
=
"select order_no from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
type
)
print
(
sql
)
buyOrderNo1
=
process_tuple
(
get_dept_buy_id
(
sql
))
# 根据请领单的id获取采购计划单主表主键
sql
=
"select id from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
id1
)
id2
=
process_tuple
(
get_dept_buy_id
(
sql
))
# 采购计划主表主键
sql
=
"select order_no from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
id1
)
PLAN_order_no
=
process_tuple
(
get_dept_buy_id
(
sql
))
# 采购计划主表order_no
# 要验证的数据sql
sql1
=
"select * from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
id1
)
# 获取实际值
actual
=
check_mcms_pur_plan_sql
(
sql1
)
print
(
'actual'
,
actual
)
hos_id
=
get_hosid
()
dept_id1
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室id"
,
'message6'
)[
'deptid1'
]
dept_name1
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid1'
]
dept_name2
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
rec_org_id
=
process_tuple
(
get_id
(
"select id from sys_org where branch_id='%s' and ename='%s';"
%
(
branch_id
,
dept_name2
)))
rec_org_name
=
dept_name2
info
=
FileUtils
().
r_info8
(
"b5_spd3_core_business_flow"
,
"库区信息"
,
'message22'
)
list_a
=
info
[
'list_a'
]
area_code
=
get_stockAreaId_new_fromDb
(
dept_name2
,
2
)
sql1
=
"select area_name from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
id1
)
area_name
=
process_tuple
(
get_id
(
sql1
))
source_id
=
id1
rec_user
=
get_login_user_uxid
()
sql1
=
"select rec_addr from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
id1
)
rec_addr
=
process_tuple
(
get_id
(
sql1
))
sql
=
"select bill_expdt_date from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
id1
)
print
(
sql
)
bill_expdt_date
=
get_expdt_date
(
sql
)
buyBillId
=
id1
planBillId
=
id2
buyOrderNo
=
buyOrderNo1
create_user
=
rec_user
create_time
=
get_create_time
(
"select create_time from mcms_pur_plan where branch_id='%s' and source_id='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
id1
))
last_modified
=
create_time
last_modified_user
=
create_user
planOrderNo
=
PLAN_order_no
if
type
==
16
:
# 验证子表数据
check_mcms_mcms_pur_plan_detail
(
id2
,
type
,
planOrderNo
)
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_pur_plan'
,
id2
,
PLAN_order_no
,
hos_id
,
get_branch_id
(),
dept_id1
,
dept_name1
,
rec_org_id
,
rec_org_name
,
area_code
,
area_name
,
source_id
,
rec_user
,
rec_addr
,
bill_expdt_date
,
buyBillId
,
planBillId
,
planOrderNo
,
buyOrderNo
,
create_user
,
create_time
,
last_modified
,
last_modified_user
)
elif
type
==
20
:
check_mcms_mcms_pur_plan_detail
(
id2
,
type
,
planOrderNo
)
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_pur_plan2'
,
id2
,
PLAN_order_no
,
hos_id
,
get_branch_id
(),
dept_id1
,
dept_name1
,
rec_org_id
,
rec_org_name
,
area_code
,
area_name
,
source_id
,
rec_user
,
rec_addr
,
bill_expdt_date
,
buyBillId
,
planBillId
,
planOrderNo
,
buyOrderNo
,
create_user
,
create_time
,
last_modified
,
last_modified_user
)
elif
type
==
66
:
check_mcms_mcms_pur_plan_detail
(
id2
,
type
,
planOrderNo
)
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_pur_plan3'
,
id2
,
PLAN_order_no
,
hos_id
,
get_branch_id
(),
dept_id1
,
dept_name1
,
rec_org_id
,
rec_org_name
,
area_code
,
area_name
,
source_id
,
rec_user
,
rec_addr
,
bill_expdt_date
,
buyBillId
,
planBillId
,
planOrderNo
,
buyOrderNo
,
create_user
,
create_time
,
last_modified
,
last_modified_user
)
else
:
expected
=
None
actual_value1
=
get_process_list2
(
actual
)
expected_value1
=
get_process_list2
(
expected
)
actual_value2
=
actual_value1
.
replace
(
" "
,
""
)
expected_value2
=
expected_value1
.
replace
(
" "
,
""
)
# print('actual_value2',actual_value2)
print
(
'expected_value2'
)
print
(
expected_value2
)
print
(
'actual_value2'
)
print
(
actual_value2
)
result
=
(
compare_text_index
(
actual_value2
,
expected_value2
))
print
(
'result'
,
result
)
if
actual_value2
==
expected_value2
:
print
(
'ok'
)
commonFuc
().
check_text_exist_result_text
(
'succees'
,
'succees'
)
else
:
print
(
'error'
)
commonFuc
().
check_text_exist_result_text
(
'error'
,
'succees'
)
# 检查采购计划子表
def
check_mcms_mcms_pur_plan_detail
(
id
,
type
,
planOrderNo
):
branch_id
=
get_branch_id
()
# 根据采购计划主表的id获取采购计划单子表主键
sql
=
"select id from mcms_pur_plan_detail where pid='%s' order by create_time desc LIMIT 1;"
%
(
id
)
id2
=
process_tuple
(
get_dept_buy_id
(
sql
))
# 采购计划单子表主键
# # 将采购计划子表主键写入文件中
# info = (id2, id2)
# titlename = ("id2", 'id2')
# FileUtils().w_info8(info, 'b6_spd3_core_business_flow_database_check', '采购计划单子表主键', titlename, 'message')
sql
=
"select order_no from mcms_pur_plan where id='%s' order by create_time desc LIMIT 1;"
%
(
id2
)
PLAN_order_no
=
process_tuple
(
get_dept_buy_id
(
sql
))
# 采购计划单子表order_no
# 要验证的数据sql
sql1
=
"select * from mcms_pur_plan_detail where id='%s' order by create_time desc LIMIT 1;"
%
(
id2
)
# 获取实际值
actual
=
check_mcms_pur_plan_sql
(
sql1
)
print
(
'actual'
,
actual
)
hos_id
=
get_hosid
()
dept_id1
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室id"
,
'message6'
)[
'deptid1'
]
dept_name1
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid1'
]
dept_name2
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
rec_org_id
=
process_tuple
(
get_id
(
"select id from sys_org where branch_id='%s' and ename='%s';"
%
(
branch_id
,
dept_name2
)))
rec_user
=
get_login_user_uxid
()
create_user
=
rec_user
# last_modified = create_time
last_modified_user
=
create_user
pid
=
id
if
type
==
16
:
hos_goods_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品审核信息'
,
'message2'
)[
"hosGoodsId"
]
mdm_goods_code
=
process_tuple
(
get_id
(
"select mdm_goods_code from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
# print(mdm_goods_code)
goods_code
=
process_tuple
(
get_id
(
"select goods_code from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
pkg_def_id
=
process_tuple
(
get_id
(
"select pkg_def_id from mcms_pkg where hos_goods_id='%s' LIMIT 1;"
%
hos_goods_id
))
supply_id
=
process_tuple
(
get_id
(
"select supply_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
prov_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_corpId"
]
prov_name
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_username"
]
sub_prov_id
=
prov_id
create_time
=
get_create_time
(
"select create_time from mcms_pur_plan_detail where id='%s';"
%
(
id2
))
last_modified
=
create_time
sub_prov_name
=
prov_name
source_id
=
process_tuple
(
get_id
(
"select source_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_pur_plan_detail'
,
id2
,
pid
,
planOrderNo
,
source_id
,
hos_goods_id
,
mdm_goods_code
,
goods_code
,
pkg_def_id
,
supply_id
,
prov_id
,
prov_name
,
sub_prov_id
,
sub_prov_name
,
create_user
,
create_time
,
last_modified
,
last_modified_user
)
elif
type
==
20
:
hos_goods_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品审核信息'
,
'message1'
)[
"hosGoodsId"
]
mdm_goods_code
=
process_tuple
(
get_id
(
"select mdm_goods_code from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
# print(mdm_goods_code)
goods_code
=
process_tuple
(
get_id
(
"select goods_code from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
pkg_def_id
=
process_tuple
(
get_id
(
"select pkg_def_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
supply_id
=
process_tuple
(
get_id
(
"select supply_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
prov_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_corpId"
]
prov_name
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_username"
]
sub_prov_id
=
prov_id
create_time
=
get_create_time
(
"select create_time from mcms_pur_plan_detail where id='%s';"
%
(
id2
))
last_modified
=
create_time
sub_prov_name
=
prov_name
source_id
=
process_tuple
(
get_id
(
"select source_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_pur_plan_detail2'
,
id2
,
pid
,
planOrderNo
,
source_id
,
hos_goods_id
,
mdm_goods_code
,
goods_code
,
supply_id
,
prov_id
,
prov_name
,
sub_prov_id
,
sub_prov_name
,
create_user
,
create_time
,
last_modified
,
last_modified_user
)
else
:
hos_goods_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品审核信息'
,
'message3'
)[
"hosGoodsId"
]
mdm_goods_code
=
process_tuple
(
get_id
(
"select mdm_goods_code from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
# print(mdm_goods_code)
goods_code
=
process_tuple
(
get_id
(
"select goods_code from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
pkg_def_id
=
process_tuple
(
get_id
(
"select pkg_def_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
supply_id
=
process_tuple
(
get_id
(
"select supply_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
prov_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_corpId"
]
prov_name
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'供货关系申请2'
,
'message'
)[
"e_username"
]
sub_prov_id
=
prov_id
create_time
=
get_create_time
(
"select create_time from mcms_pur_plan_detail where id='%s';"
%
(
id2
))
last_modified
=
create_time
sub_prov_name
=
prov_name
source_id
=
process_tuple
(
get_id
(
"select source_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';"
%
(
hos_goods_id
,
id2
)))
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_pur_plan_detail3'
,
id2
,
pid
,
planOrderNo
,
source_id
,
hos_goods_id
,
mdm_goods_code
,
goods_code
,
pkg_def_id
,
supply_id
,
prov_id
,
prov_name
,
sub_prov_id
,
sub_prov_name
,
create_user
,
create_time
,
last_modified
,
last_modified_user
)
actual_value1
=
get_process_list2
(
actual
)
expected_value1
=
get_process_list2
(
expected
)
actual_value2
=
actual_value1
.
replace
(
" "
,
""
)
expected_value2
=
expected_value1
.
replace
(
" "
,
""
)
# print('actual_value2',actual_value2)
print
(
'expected_value2'
)
print
(
expected_value2
)
print
(
'actual_value2'
)
print
(
actual_value2
)
result
=
(
compare_text_index
(
actual_value2
,
expected_value2
))
print
(
'result'
,
result
)
if
actual_value2
==
expected_value2
:
print
(
'ok'
)
commonFuc
().
check_text_exist_result_text
(
'succees'
,
'succees'
)
else
:
print
(
'error'
)
commonFuc
().
check_text_exist_result_text
(
'error'
,
'succees'
)
pro_path
=
commonFuc
().
get_pro_path2
()
pro_path
=
commonFuc
().
get_pro_path2
()
...
@@ -40,6 +299,8 @@ def main():
...
@@ -40,6 +299,8 @@ def main():
print
(
'流程五获取hosGoodsId出现错误,请检查脚本或者数据'
)
print
(
'流程五获取hosGoodsId出现错误,请检查脚本或者数据'
)
try
:
try
:
low_vaule_purchase_plan
(
token
,
uxid1
)
low_vaule_purchase_plan
(
token
,
uxid1
)
time
.
sleep
(
6
)
check_mcms_mcms_pur_plan
(
16
)
#低值采购计划数据检查
except
Exception
as
e
:
except
Exception
as
e
:
print
(
'低值采购计划提交出现错误,请检查脚本或者数据'
)
print
(
'低值采购计划提交出现错误,请检查脚本或者数据'
)
print
(
"发生异常:"
,
str
(
e
))
print
(
"发生异常:"
,
str
(
e
))
...
...
air_case/b6_spd3_core_business_flow_database_check/a_a9流程六_中心库入库结算_负结算_数据库验证.air/a_a9流程六_中心库入库结算_负结算_数据库验证.py
View file @
baffec21
...
@@ -1044,7 +1044,7 @@ try:
...
@@ -1044,7 +1044,7 @@ try:
time
.
sleep
(
3
)
time
.
sleep
(
3
)
invoice
(
2
,
OBh_ID
)
#type=2 传递结算单号,外网查询开票
invoice
(
2
,
OBh_ID
)
#type=2 传递结算单号,外网查询开票
time
.
sleep
(
3
)
time
.
sleep
(
3
)
# 检查
最终的
发票数据
,过程数据在流程五中检查
# 检查发票数据
check_mcms_invoice
()
check_mcms_invoice
()
time
.
sleep
(
3
)
time
.
sleep
(
3
)
# 检查付款单数据
# 检查付款单数据
...
...
air_case/b6_spd3_core_business_flow_database_check/a_b0流程七_中心库入库结算_正负结算_数据库验证.air/a_b0流程七_中心库入库结算_正负结算_数据库验证.py
View file @
baffec21
...
@@ -1232,7 +1232,7 @@ try:
...
@@ -1232,7 +1232,7 @@ try:
time
.
sleep
(
3
)
time
.
sleep
(
3
)
invoice
(
3
,
OBh_ID
)
# type=2 传递结算单号,外网查询开票
invoice
(
3
,
OBh_ID
)
# type=2 传递结算单号,外网查询开票
time
.
sleep
(
3
)
time
.
sleep
(
3
)
# 检查
最终的
发票数据
,过程数据在流程五中检查
# 检查发票数据
check_mcms_invoice
()
check_mcms_invoice
()
time
.
sleep
(
3
)
time
.
sleep
(
3
)
# 检查付款单数据
# 检查付款单数据
...
...
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