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
d29b23a3
Commit
d29b23a3
authored
Jul 19, 2024
by
xiao-hesheng
Browse files
数据库验证流程十一脚本编写
parent
ed7102f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
air_case/b6_spd3_core_business_flow_database_check/a_b4流程十一请领业务流_二级库向直送_数据库验证.air/a_b4流程十一请领业务流_二级库向直送_数据库验证.py
View file @
d29b23a3
...
...
@@ -10,7 +10,7 @@ from common.db.sql.sql_tools import get_create_time, check_mcms_dept_buy_car_sql
get_expdt_date1
,
process_date
,
get_mdm_goods_code1
,
get_goods_code1
,
get_goods_name
,
get_goods_gg
,
\
get_goods_mfrs_id
,
get_supply_id
,
check_mcms_pur_sql
,
check_source_id
,
get_pkg_def_id
,
get_buyBillId
,
\
get_planBillId
,
get_planOrderNo
,
get_buyOrderNo
,
get_purOrderNo
,
get_purBillId
,
get_purBillDate
,
get_distrBillId
,
\
get_distrOrderNo
get_distrOrderNo
,
get_distr_detail_id
from
common.db.sql.sql_tools_out
import
check_out_check_mcms_purchase
from
common.fileUtls
import
FileUtils
...
...
@@ -1463,9 +1463,11 @@ def check_mcms_check(type=1):
create_user
=
get_login_user_uxid
()
sql
=
"select create_time from mcms_check where id='%s';"
%
check_no
create_time
=
get_create_time
(
sql
)
last_modified
=
create_time
sql
=
"select last_modified from mcms_check where id='%s';"
%
check_no
last_modified
=
get_create_time
(
sql
)
last_modified_user
=
create_user
if
type
==
1
:
check_mcms_check_batch
(
type
,
check_no
,
order_no
,
hos_goods_id
)
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_check'
,
check_no
,
order_no
,
get_hosid
(),
get_branch_id
(),
source_id
,
source_no
,
prov_id
,
prov_name
,
rec_org_id
,
rec_org_name
,
dept_id
,
dept_name
,
buyBillId
,
...
...
@@ -1473,6 +1475,7 @@ def check_mcms_check(type=1):
distrBillId
,
distrOrderNo
,
checkBillId
,
checkOrderNo
,
create_user
,
create_time
,
last_modified
,
last_modified_user
)
elif
type
==
2
:
check_mcms_check_batch
(
type
,
check_no
,
order_no
,
hos_goods_id
)
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_check1'
,
check_no
,
order_no
,
get_hosid
(),
get_branch_id
(),
source_id
,
source_no
,
prov_id
,
prov_name
,
rec_org_id
,
rec_org_name
,
dept_id
,
dept_name
,
buyBillId
,
...
...
@@ -1482,6 +1485,7 @@ def check_mcms_check(type=1):
create_time
,
last_modified
,
last_modified_user
)
else
:
check_mcms_check_batch
(
type
,
check_no
,
order_no
,
hos_goods_id
)
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_check2'
,
check_no
,
order_no
,
get_hosid
(),
get_branch_id
(),
source_id
,
source_no
,
prov_id
,
prov_name
,
rec_org_id
,
rec_org_name
,
dept_id
,
dept_name
,
buyBillId
,
...
...
@@ -1491,9 +1495,87 @@ def check_mcms_check(type=1):
create_time
,
last_modified
,
last_modified_user
)
# 对比预期值和实际值是否一致
comparison_result
(
actual
,
expected
)
# comparison_result(actual, expected)
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_check_batch
(
type
,
check_no
,
order_no
,
hos_goods_id
):
print
(
'数据库检查验收单子表'
)
if
type
==
1
:
bill_mode
=
16
elif
type
==
2
:
bill_mode
=
20
else
:
bill_mode
=
66
sql
=
"select * from mcms_check_batch where pid='%s'"
%
check_no
# 获取实际值
actual
=
check_mcms_pur_plan_sql
(
sql
)
print
(
'actual'
,
actual
)
id
=
get_id
(
"select id from mcms_check_batch where pid='%s'"
%
check_no
)
pid
=
check_no
branch_id
=
get_branch_id
()
distr_detail_id
=
get_distr_detail_id
(
branch_id
,
bill_mode
)
source_detail_id
=
distr_detail_id
mdm_goods_code
=
get_mdm_goods_code1
(
hos_goods_id
)
goods_code
=
get_goods_code1
(
hos_goods_id
)
sql
=
"select id from mcms_pkg where pkg_type='%s'order by create_time desc LIMIT 1;"
%
bill_mode
barcode_id
=
get_id
(
sql
)
create_user
=
get_login_user_uxid
()
create_time
=
get_create_time
(
"select create_time from mcms_check_batch where pid='%s'"
%
check_no
)
last_modified
=
get_create_time
(
"select last_modified from mcms_check_batch where pid='%s'"
%
check_no
)
last_modified_user
=
create_user
if
type
==
1
:
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_check_batch'
,
id
,
pid
,
order_no
,
source_detail_id
,
distr_detail_id
,
hos_goods_id
,
mdm_goods_code
,
goods_code
,
barcode_id
,
create_user
,
create_time
,
last_modified
)
elif
type
==
2
:
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_check_batch1'
,
id
,
pid
,
order_no
,
source_detail_id
,
distr_detail_id
,
hos_goods_id
,
mdm_goods_code
,
goods_code
,
barcode_id
,
create_user
,
create_time
,
last_modified
)
else
:
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_check_batch2'
,
id
,
pid
,
order_no
,
source_detail_id
,
distr_detail_id
,
hos_goods_id
,
mdm_goods_code
,
goods_code
,
barcode_id
,
create_user
,
create_time
,
last_modified
)
# 对比预期值和实际值是否一致
# comparison_result(actual, expected)
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'
)
try
:
pro_path
=
commonFuc
().
get_pro_path2
()
print
(
'pro_path'
,
pro_path
)
...
...
@@ -1509,65 +1591,67 @@ try:
from
a_b4流程十一请领业务流_二级库向直送
import
check_accept_order
for
i
in
range
(
1
):
updateUserLoginDefaultRange
(
get_listUserMgrRangePage
(
2
))
# 设置登录账号默认权限是二级库
goods_move2
()
# 设置产品出库渠道为直送
# # 低值
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
()
# 请领车提交
list_data
=
[
'16'
,
'20'
,
'66'
]
for
i
in
list_data
:
check_mcms_dept_buy
(
int
(
i
))
mcms_dept_buy_detail
(
int
(
i
))
for
i
in
range
(
6
):
# 三个单据共审批6次
approval_center
()
list_data
=
[
'16'
,
'20'
,
'66'
]
for
i
in
list_data
:
check_mcms_dept_buy_approval_after
(
int
(
i
))
mcms_dept_buy_detail_approval_after
(
int
(
i
))
time
.
sleep
(
20
)
# 检查自动生成的采购计划数据
list_data
=
[
'16'
,
'20'
,
'66'
]
for
i
in
list_data
:
check_mcms_mcms_pur_plan
(
int
(
i
))
# 采购模块处理
purchase_module_process
()
# 三个单据共审批三次
approval_center
(
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'采购计划单号试剂'
,
'message12'
))
approval_center
(
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'采购计划单号'
,
'message7'
))
approval_center
(
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'采购计划单号高值'
,
'message11'
))
time
.
sleep
(
20
)
list_data
=
[
'16'
,
'20'
,
'66'
]
for
i
in
list_data
:
check_mcms_purchase
(
int
(
i
))
#检查同步到外网的采购订单数据跟内网的是否一致
check_mcms_purchase_out_and_in
(
1
)
print
(
'检查同步到外网的采购订单数据跟内网的是否一致'
)
check_mcms_purchase_out_and_in
(
2
)
order_dp
(
1
)
# 1低值
time
.
sleep
(
6
)
order_dp
(
2
)
# 2高值
time
.
sleep
(
6
)
order_dp
(
3
)
# 3试剂
time
.
sleep
(
6
)
time
.
sleep
(
20
)
list_data
=
[
'16'
,
'20'
,
'66'
]
for
i
in
list_data
:
check_hdi_distr
(
int
(
i
))
time
.
sleep
(
20
)
check_accept_order
(
1
)
# 低值
time
.
sleep
(
6
)
# updateUserLoginDefaultRange(get_listUserMgrRangePage(2)) # 设置登录账号默认权限是二级库
# goods_move2() # 设置产品出库渠道为直送
# # # 低值
# 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() # 请领车提交
#
# list_data = ['16', '20', '66']
# for i in list_data:
# check_mcms_dept_buy(int(i))
# mcms_dept_buy_detail(int(i))
# for i in range(6): # 三个单据共审批6次
# approval_center()
# list_data = ['16', '20', '66']
# for i in list_data:
# check_mcms_dept_buy_approval_after(int(i))
# mcms_dept_buy_detail_approval_after(int(i))
#
# time.sleep(20)
# # 检查自动生成的采购计划数据
# list_data = ['16', '20', '66']
# for i in list_data:
# check_mcms_mcms_pur_plan(int(i))
# # 采购模块处理
# purchase_module_process()
#
# # 三个单据共审批三次
# approval_center(FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号试剂', 'message12'))
# approval_center(FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号', 'message7'))
# approval_center(FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号高值', 'message11'))
# time.sleep(20)
# list_data = ['16', '20', '66']
# for i in list_data:
# check_mcms_purchase(int(i))
#
# #检查同步到外网的采购订单数据跟内网的是否一致
# check_mcms_purchase_out_and_in(1)
# print('检查同步到外网的采购订单数据跟内网的是否一致')
# check_mcms_purchase_out_and_in(2)
# order_dp(1) # 1低值
# time.sleep(6)
# order_dp(2) # 2高值
# time.sleep(6)
# order_dp(3) # 3试剂
# time.sleep(6)
# time.sleep(20)
# list_data = ['16', '20', '66']
# for i in list_data:
# time.sleep(6)
# check_hdi_distr(int(i))
#
# time.sleep(20)
# check_accept_order(1) # 低值
# time.sleep(6)
# 上面暂时注释========================================
check_mcms_check
(
1
)
# 调用函数检查验收单数据库写值
check_accept_order
(
2
)
# 高值
...
...
@@ -1576,7 +1660,7 @@ try:
check_accept_order
(
3
)
# 试剂
time
.
sleep
(
6
)
check_mcms_check
(
3
)
# 调用函数检查验收单数据库写值
# 上面暂时注释========================================
# 这里验收后会自动生成入库单,批次信息,需要同步验证入库单和批次信息
# 根据验收单号到mcms_psi表查询入库单
...
...
common/db/sql/sql_tools.py
View file @
d29b23a3
...
...
@@ -155,6 +155,7 @@ def get_expdt_date1(sql):
db
,
cursor
=
get_sql_conn
()
cursor
.
execute
(
sql
)
results
=
cursor
.
fetchone
()
cursor
.
close
()
return
results
def
get_id
(
sql
):
db
,
cursor
=
get_sql_conn
()
...
...
@@ -297,6 +298,13 @@ def get_distrBillId(branch_id,bill_mode):
"select id from hdi_distr a where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
bill_mode
))
return
distr_main_key
def
get_distr_detail_id
(
branch_id
,
bill_mode
):
distr_main_key
=
get_distrBillId
(
branch_id
,
bill_mode
)
distr_detail_id
=
get_id
(
"select id from hdi_distr_detail a where pid='%s' order by create_time desc LIMIT 1;"
%
(
distr_main_key
))
return
distr_detail_id
def
get_distrOrderNo
(
branch_id
,
bill_mode
):
# 查询配送单order_no
distr_order_no
=
get_id
(
...
...
data/b6_spd3_core_business_flow_database_check/data
View file @
d29b23a3
...
...
@@ -58,3 +58,6 @@
"mcms_check1": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "hos_id": "%s", "branch_id": "%s", "source_id": "%s", "source_no": "%s", "source_type": "PSD", "tb_status": 20, "prov_id": "%s", "prov_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "dept_id": "%s", "dept_name": "%s", "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "initial_order": None, "remark": ""}'
"mcms_check2": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "hos_id": "%s", "branch_id": "%s", "source_id": "%s", "source_no": "%s", "source_type": "PSD", "tb_status": 20, "prov_id": "%s", "prov_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "dept_id": "%s", "dept_name": "%s", "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "initial_order": None, "remark": ""}'
"mcms_check_batch": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "distr_detail_id": "%s", "pur_mode": 10, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "barcode_id": "%s", "sub_barcode_id": None, "qty": Decimal("100.00"), "reject_qty": Decimal("0.00"), "reject_reason": None, "settlement": 1, "tb_status": 1, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}'
"mcms_check_batch1": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "distr_detail_id": "%s", "pur_mode": 20, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "barcode_id": "%s", "sub_barcode_id": None, "qty": Decimal("1.00"), "reject_qty": Decimal("0.00"), "reject_reason": None, "settlement": 1, "tb_status": 1, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}'
"mcms_check_batch2": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "distr_detail_id": "%s", "pur_mode": 60, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "barcode_id": "%s", "sub_barcode_id": None, "qty": Decimal("100.00"), "reject_qty": Decimal("0.00"), "reject_reason": None, "settlement": 1, "tb_status": 1, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}'
\ 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