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
2702fa5d
Commit
2702fa5d
authored
Jul 16, 2024
by
xiao-hesheng
Browse files
数据库验证流程十一脚本编写
parent
93ddcb5c
Changes
3
Hide whitespace changes
Inline
Side-by-side
air_case/b6_spd3_core_business_flow_database_check/a_b3流程十请领业务流_二级库向边仓_数据库验证.air/a_b3流程十请领业务流_二级库向边仓_数据库验证.py
View file @
2702fa5d
...
...
@@ -48,7 +48,7 @@ def check_mcms_dept_buy_car(type=1):
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
(
deptid2
,
deptname2
,
2
)
areaCode
=
get_stockAreaId_new
_fromDb
(
deptname2
,
2
)
areaName
=
'默认库区'
# 读取文件中的信息
info
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
"二级库请领产品信息"
,
'message21'
)
...
...
air_case/b6_spd3_core_business_flow_database_check/a_b4流程十一请领业务流_二级库向直送_数据库验证.air/a_b4流程十一请领业务流_二级库向直送_数据库验证.py
View file @
2702fa5d
...
...
@@ -50,7 +50,7 @@ def check_mcms_dept_buy_car(type=1):
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
(
deptid2
,
deptname2
,
2
)
areaCode
=
get_stockAreaId_new_fromDb
(
deptname2
,
2
)
areaName
=
'默认库区'
# 读取文件中的信息
info
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
"二级库请领产品信息"
,
'message21'
)
...
...
@@ -240,7 +240,7 @@ def check_mcms_dept_buy(type=16):
rec_addr
=
deptname2
dept_id1
=
FileUtils
().
r_info8
(
"b2_herp3_bs"
,
"所有科室id"
,
'message6'
)[
'deptid1'
]
stock_name
=
get_branch_name
()
+
"中心库房"
target_stock_id
=
get_stockId_fromdb
(
stock_name
,
1
)
target_stock_id
=
get_stockId_fromdb
(
stock_name
)
if
type
==
16
:
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_dept_buy_direct_sending'
,
id1
,
order_no1
,
get_hosid
(),
branch_id
,
...
...
@@ -324,7 +324,7 @@ def check_mcms_dept_buy_approval_after(type=16):
# # 获取边仓id
# target_stock_id = get_id("select logic_id FROM yb_direct WHERE branch_id ='%s';" % branch_id)
stock_name
=
get_branch_name
()
+
"中心库房"
target_stock_id
=
get_stockId_fromdb
(
stock_name
,
1
)
target_stock_id
=
get_stockId_fromdb
(
stock_name
)
bill_expdt_date
=
get_expdt_date
(
"select bill_expdt_date from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
type
))
...
...
@@ -494,6 +494,8 @@ def check_mcms_mcms_pur_plan(type=16):
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
#验证子表数据
check_mcms_mcms_pur_plan_detail
(
id2
)
# 要验证的数据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
)
...
...
@@ -571,27 +573,18 @@ def check_mcms_mcms_pur_plan(type=16):
commonFuc
().
check_text_exist_result_text
(
'error'
,
'succees'
)
def
check_mcms_mcms_pur_plan_detail
(
type
=
16
):
def
check_mcms_mcms_pur_plan_detail
(
id
):
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
,
'type'
,
type
)
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
# 根据采购计划主表的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
))
# 采购计划单子表主键
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 where
branch_id='%s' and source_
id='%s' order by create_time desc LIMIT 1;"
%
(
branch_id
,
id1
)
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
)
...
...
@@ -606,50 +599,53 @@ def check_mcms_mcms_pur_plan_detail(type=16):
list_a
=
info
[
'list_a'
]
area_code
=
commonFuc
().
analysis_json
(
'shelfCode'
,
list_a
)
area_name
=
'默认库区'
source_id
=
id1
#
source_id = id1
rec_user
=
get_login_user_uxid
()
rec_addr
=
'自动化测试'
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
)
#
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
#
buyBillId = id1
planBillId
=
id2
buyOrderNo
=
buyOrderNo1
#
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
#
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
source_id
=
id
pid
=
id
if
type
==
16
:
hos_goods_id
=
FileUtils
().
r_info8
(
'b5_spd3_core_business_flow'
,
'产品审核信息'
,
'message2'
)[
"hosGoodsId"
]
expected
=
commonFuc
().
get_business_data
(
'b6_spd3_core_business_flow_database_check'
,
'mcms_pur_plan'
,
id2
,
PLAN_order_no
,
ho
s_id
,
'mcms_pur_plan'
,
id2
,
pid
,
planOrderNo
,
source_id
,
hos_good
s_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
:
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
)
else
:
import
pdb
pdb
.
set_trace
()
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
)
actual_value1
=
get_process_list2
(
actual
)
#
elif type == 20:
#
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)
#
else:
#
import pdb
#
pdb.set_trace()
#
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)
#
#
actual_value1 = get_process_list2(actual)
expected_value1
=
get_process_list2
(
expected
)
actual_value2
=
actual_value1
.
replace
(
" "
,
""
)
expected_value2
=
expected_value1
.
replace
(
" "
,
""
)
...
...
@@ -667,14 +663,6 @@ def check_mcms_mcms_pur_plan_detail(type=16):
print
(
'error'
)
commonFuc
().
check_text_exist_result_text
(
'error'
,
'succees'
)
try
:
# add_dept2() # 新增一个二级科室
# add_new_deptinfo() # 写入科室信息到文件中
# grants_user_new() #新增授权
# 设置部门用户
# set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid5'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid5'],2)
# 设置部门负责人
# set_dept_lead_new(FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid5"]) # 设置二级科室负责人
# 从下面开始,上面的暂时注释
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_b4流程十一请领业务流_二级库向直送.air'
)
...
...
@@ -718,7 +706,7 @@ try:
list_data
=
[
'16'
,
'20'
,
'66'
]
for
i
in
list_data
:
check_mcms_mcms_pur_plan
(
int
(
i
))
# check_mcms_mcms_pur_plan_detail(int(i))
# 采购模块处理
purchase_module_process
()
...
...
data/b6_spd3_core_business_flow_database_check/data
View file @
2702fa5d
...
...
@@ -28,4 +28,7 @@
"mcms_pur_plan": '{"id": "%s", "order_no": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "area_code": "%s", "area_name": "%s", "create_type": "SG", "source_id": "%s", "source_type": "QLD", "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "priority": 0, "bill_expdt_date": %s, "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s"}", "remark": "", "close_status": 0, "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "last_auditor": None, "last_audit_time": None, "rec_type": "HDI", "audit_remark": None}'
"mcms_pur_plan2": '{"id": "%s", "order_no": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "area_code": "%s", "area_name": "%s", "create_type": "SG", "source_id": "%s", "source_type": "QLD", "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "priority": 0, "bill_expdt_date": %s, "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s"}", "remark": "", "close_status": 0, "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "last_auditor": None, "last_audit_time": None, "rec_type": "HDI", "audit_remark": None}'
"mcms_pur_plan3": '{"id": "%s", "order_no": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "area_code": "%s", "area_name": "%s", "create_type": "SG", "source_id": "%s", "source_type": "QLD", "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "priority": 0, "bill_expdt_date": %s, "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s"}", "remark": "", "close_status": 0, "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "last_auditor": None, "last_audit_time": None, "rec_type": "HDI", "audit_remark": None}'
\ No newline at end of file
"mcms_pur_plan3": '{"id": "%s", "order_no": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "area_code": "%s", "area_name": "%s", "create_type": "SG", "source_id": "%s", "source_type": "QLD", "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "priority": 0, "bill_expdt_date": %s, "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s"}", "remark": "", "close_status": 0, "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "last_auditor": None, "last_audit_time": None, "rec_type": "HDI", "audit_remark": None}'
"mcms_pur_plan_detail": '{'id': '%s', 'pid': '%s', 'order_no': '%s', 'source_id': '%s', 'hos_goods_id': '%s', 'mdm_goods_code': '11661562', 'goods_code': '00004600', 'pur_mode': 20, 'pkg_def_id': None, 'pkg_def_name': None, 'pkg_def_qty': Decimal('1.00'), 'plan_pkg_qty': Decimal('1.00'), 'plan_qty': Decimal('1.00'), 'pkg_qty': Decimal('1.00'), 'price': Decimal('99.999900'), 'qty': Decimal('1.00'), 'in_settlement': None, 'supply_id': 'c9236fdca0c442feb44314027c78ebcb', 'prov_id': 'p1e35e', 'prov_name': '国药集团公司S57ui', 'sub_send_flag': 10, 'sub_prov_id': 'p1e35e', 'sub_prov_name': '国药集团公司S57ui', 'contract_id': None, 'remark': None, 'close_status': 0, 'tb_status': 10, 'pur_task_id': None, 'create_user': 'h0347_UID-051420', 'create_time': datetime.datetime(2024, 7, 16, 10, 27, 19), 'last_modified': datetime.datetime(2024, 7, 16, 10, 27, 19), 'last_modified_user': 'h0347_UID-051420', 'version': 0, 'coding_type': 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