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
d6e1a941
Commit
d6e1a941
authored
Sep 03, 2024
by
xiao-hesheng
Browse files
流程九脚本提交
parent
f25b4ac4
Changes
1
Hide whitespace changes
Inline
Side-by-side
air_case/b6_spd3_core_business_flow_database_check/a_b2流程九请领业务流_二级库向中心库_数据库验证.air/a_b2流程九请领业务流_二级库向中心库_数据库验证.py
View file @
d6e1a941
...
...
@@ -4,6 +4,7 @@ import traceback
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
air_case.public1.public1.public1
import
*
from
common.db.sql.sql_tools
import
get_create_time
,
check_mcms_dept_buy_car_sql
from
common.fileUtls
import
FileUtils
from
common.run_cmd_script
import
execute_command
...
...
@@ -21,7 +22,85 @@ python runner_test.py tag id2303-12 debug mdm3
如果二级库请领了,在中心库生成拣货单无法成功,原因是中心库没库存了
脚本存在上下游的关系,下面的业务会修改出库渠道,如果调试脚本,注意这个因素的影响
"""
def
check_mcms_dept_buy_car
(
type
=
1
):
hos_goods_id
=
'hos_goods_id'
if
type
==
1
:
hos_goods_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品审核信息'
,
'message2'
)[
"hosGoodsId"
]
elif
type
==
2
:
hos_goods_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品审核信息'
,
'message1'
)[
"hosGoodsId"
]
elif
type
==
3
:
hos_goods_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品审核信息'
,
'message3'
)[
"hosGoodsId"
]
branch_id
=
get_branch_id
()
# 获取create_time的值
create_time
=
get_create_time
(
"select create_time from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s'order by create_time desc LIMIT 1;"
%
(
branch_id
,
hos_goods_id
))
print
(
'create_time'
,
create_time
)
id
=
get_id
(
"select id from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
hos_goods_id
))
print
(
'id'
,
id
)
create_user
=
get_id
(
"select create_user from mcms_dept_buy_car where branch_id='%s'and hos_goods_id='%s' order by create_time desc LIMIT 1;;"
%
(
branch_id
,
hos_goods_id
))
print
(
'create_time'
,
create_time
,
'id'
,
id
)
sql
=
"""select * from mcms_dept_buy_car where branch_id='%s' and hos_goods_id='%s' order by create_time desc LIMIT 1;
"""
%
(
branch_id
,
hos_goods_id
)
# 要验证的sql,取自数据库的表中
actual_value1
=
check_mcms_dept_buy_car_sql
(
sql
)
print
(
actual_value1
)
deptid2
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室id"
,
'message6'
)[
'deptid2'
]
deptname2
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
areaCode
=
get_stockAreaId_new_fromDb
(
deptname2
,
2
)
areaName
=
'默认库区'
# 读取文件中的信息
info
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
"二级库请领产品信息"
,
'message21'
)
list_a
=
info
[
'list_a'
]
mdm_goods_code
=
commonFuc
().
analysis_json
(
'mdmGoodsCode'
,
list_a
)
pur_mode
=
commonFuc
().
analysis_json
(
'purMode'
,
list_a
)
goodsCode
=
commonFuc
().
analysis_json
(
'goodsCode'
,
list_a
)
pkgDefId
=
commonFuc
().
analysis_json
(
'pkgDefId'
,
list_a
)
pkgDefName
=
commonFuc
().
analysis_json
(
'pkgDefName'
,
list_a
)
last_modified_user
=
create_user
last_modified
=
create_time
# print('actual_value1',actual_value1)
actual_value2
=
get_process_list2
(
actual_value1
)
# print('actual_value2')
# print( actual_value2)
# prov_hos_goods_id = '8d6273b7bca84dd8aace12b9422d7fd6'
expected_value2
=
'expected_value2'
if
type
==
1
or
type
==
3
:
expected_value2
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'check_mcms_dept_buy_car_low_value'
,
id
,
get_hosid
(),
branch_id
,
deptid2
,
deptname2
,
areaCode
,
areaName
,
hos_goods_id
,
mdm_goods_code
,
goodsCode
,
pur_mode
,
pkgDefId
,
pkgDefName
,
create_user
,
create_time
,
last_modified
,
last_modified_user
)
elif
type
==
2
:
expected_value2
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'check_mcms_dept_buy_car_high_value'
,
id
,
get_hosid
(),
branch_id
,
deptid2
,
deptname2
,
areaCode
,
areaName
,
hos_goods_id
,
mdm_goods_code
,
goodsCode
,
pur_mode
,
create_user
,
create_time
,
last_modified
,
last_modified_user
)
# print('expected_value2', expected_value2)
# expected_value2=get_process_list2(expected_value2)
actual_value2
=
actual_value2
.
replace
(
" "
,
""
)
expected_value2
=
expected_value2
.
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
()
print
(
'pro_path'
,
pro_path
)
sys
.
path
.
append
(
pro_path
+
r
'/air_case/b5_spd3_core_business_flow/a_b2流程九请领业务流_二级库向中心库.air'
)
...
...
@@ -30,25 +109,27 @@ from a_b2流程九请领业务流_二级库向中心库 import goods_move3, seco
centeStock_pick
,
pick_execute
try
:
updateUserLoginDefaultRange
(
get_listUserMgrRangePage
(
2
))
# 设置登录账号默认权限是二级库
goods_move3
()
# 二级库区信息写入文件
get_stockAreaId_new
(
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室id"
,
'message6'
)[
'deptid2'
],
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
],
2
)
# get_stockAreaId_new(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3'],3)
# 设置库区联系人
# set_stockShelf_Linkman()
deptName2
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室name"
,
'message6'
)[
'deptid2'
]
# 设置库区联系人
set_stockShelf_Linkman
(
FileUtils
().
r_info8
(
'b2_herp3_bs'
,
'所有科室id'
,
'message6'
)[
"deptid2"
],
get_stockAreaId2_new_fromDb
(
deptName2
,
2
))
# 低值
second_dept_Request
(
FileUtils
().
r_info8
(
"b5_spd3_core_business_flow"
,
"产品审核信息"
,
'message2'
)[
'hosGoodsId'
],
1
)
# updateUserLoginDefaultRange(get_listUserMgrRangePage(2)) # 设置登录账号默认权限是二级库
# goods_move3()
# # 二级库区信息写入文件
# get_stockAreaId_new(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'],
# FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'], 2)
# # get_stockAreaId_new(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3'],3)
# # 设置库区联系人
# # set_stockShelf_Linkman()
# deptName2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
# # 设置库区联系人
# set_stockShelf_Linkman(FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid2"],
# get_stockAreaId2_new_fromDb(deptName2, 2))
# # 低值
# second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'], 1)
check_mcms_dept_buy_car
(
1
)
# 高值
second_dept_Request
(
FileUtils
().
r_info8
(
"b5_spd3_core_business_flow"
,
"产品审核信息"
,
'message1'
)[
'hosGoodsId'
],
2
)
check_mcms_dept_buy_car
(
2
)
# 试剂
second_dept_Request
(
FileUtils
().
r_info8
(
"b5_spd3_core_business_flow"
,
"产品审核信息"
,
'message3'
)[
'hosGoodsId'
],
3
)
check_mcms_dept_buy_car
(
3
)
BuyCarSubmit
()
# 请领车提交
"""
这里的审批跟审批流的设置有关
...
...
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