Commit 37555d33 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

数据库验证流程十脚本编写

parent 6c95a9f0
...@@ -114,9 +114,9 @@ def mcms_dept_buy_detail(type=16): ...@@ -114,9 +114,9 @@ def mcms_dept_buy_detail(type=16):
# 从数据库中获取实际值 # 从数据库中获取实际值
actual = check_mcms_dept_buy_sql(sql1) actual = check_mcms_dept_buy_sql(sql1)
print('actual', actual) print('actual', actual)
if type==16: if type == 16:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type==20: elif type == 20:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else: else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
...@@ -128,24 +128,28 @@ def mcms_dept_buy_detail(type=16): ...@@ -128,24 +128,28 @@ def mcms_dept_buy_detail(type=16):
print('detail_id', detail_id) print('detail_id', detail_id)
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21') info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
list_a = info['list_a'] list_a = info['list_a']
mdm_goods_code =process_tuple(get_mdm_goods_code("select mdm_goods_code from mcms_goods_info where id='%s';"%hos_goods_id)) mdm_goods_code = process_tuple(
goods_code = process_tuple(get_mdm_goods_code("select hos_goods_code from mcms_goods_info where id='%s';"%hos_goods_id)) get_mdm_goods_code("select mdm_goods_code from mcms_goods_info where id='%s';" % hos_goods_id))
pkg_def_id = process_tuple(get_id("select pkg_def_id from mcms_pkg where hos_goods_id='%s' LIMIT 1;"%hos_goods_id)) goods_code = process_tuple(
if pkg_def_id=='None': get_mdm_goods_code("select hos_goods_code from mcms_goods_info where id='%s';" % hos_goods_id))
pkg_def_id = process_tuple(
get_id("select pkg_def_id from mcms_pkg where hos_goods_id='%s' LIMIT 1;" % hos_goods_id))
if pkg_def_id == 'None':
print(pkg_def_id) print(pkg_def_id)
pkg_def_id=pkg_def_id.replace("'","") pkg_def_id = pkg_def_id.replace("'", "")
print(pkg_def_id) print(pkg_def_id)
pkg_def_name = process_tuple(get_id("select pkg_def_name from mcms_pkg where hos_goods_id='%s' LIMIT 1;"%hos_goods_id)) pkg_def_name = process_tuple(
create_user=get_login_user_uxid() get_id("select pkg_def_name from mcms_pkg where hos_goods_id='%s' LIMIT 1;" % hos_goods_id))
create_time= get_create_time("select create_time from mcms_dept_buy_detail where pid='%s';" % id1) create_user = get_login_user_uxid()
last_modified=create_time create_time = get_create_time("select create_time from mcms_dept_buy_detail where pid='%s';" % id1)
last_modified_user=create_user last_modified = create_time
if type==16: last_modified_user = create_user
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_detail', detail_id, id1, order_no1, hos_goods_id, 'mcms_dept_buy_detail', detail_id, id1, order_no1, hos_goods_id,
mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user, mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user,
create_time, last_modified, last_modified_user) create_time, last_modified, last_modified_user)
elif type==20: elif type == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_detail1', detail_id, id1, order_no1, hos_goods_id, 'mcms_dept_buy_detail1', detail_id, id1, order_no1, hos_goods_id,
mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user, mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user,
...@@ -165,8 +169,8 @@ def mcms_dept_buy_detail(type=16): ...@@ -165,8 +169,8 @@ def mcms_dept_buy_detail(type=16):
print(expected_value2) print(expected_value2)
print('actual_value2') print('actual_value2')
print(actual_value2) print(actual_value2)
result=(compare_text_index(actual_value2,expected_value2)) result = (compare_text_index(actual_value2, expected_value2))
print('result',result) print('result', result)
if actual_value2 == expected_value2: if actual_value2 == expected_value2:
print('ok') print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees') commonFuc().check_text_exist_result_text('succees', 'succees')
...@@ -183,11 +187,11 @@ def check_mcms_dept_buy(type=16): ...@@ -183,11 +187,11 @@ def check_mcms_dept_buy(type=16):
print(actual) print(actual)
# 获取主键id # 获取主键id
sql = "select id from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( 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) branch_id, type)
id1 = get_dept_buy_id(sql) id1 = get_dept_buy_id(sql)
# 获取order_no # 获取order_no
sql1 = "select order_no from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( sql1 = "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) branch_id, type)
order_no1 = get_dept_buy_id(sql1) order_no1 = get_dept_buy_id(sql1)
print(process_tuple(id1), process_tuple(order_no1)) print(process_tuple(id1), process_tuple(order_no1))
id1 = process_tuple(id1) id1 = process_tuple(id1)
...@@ -214,21 +218,21 @@ def check_mcms_dept_buy(type=16): ...@@ -214,21 +218,21 @@ def check_mcms_dept_buy(type=16):
target_stock_id = get_id("select logic_id FROM yb_direct WHERE branch_id ='%s';" % branch_id) target_stock_id = get_id("select logic_id FROM yb_direct WHERE branch_id ='%s';" % branch_id)
bill_expdt_date = get_expdt_date( 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;" % ( "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)) branch_id, type))
rec_user = get_login_user_uxid() rec_user = get_login_user_uxid()
# rec_addr='二级检验科002' # rec_addr='二级检验科002'
create_user = rec_user create_user = rec_user
create_time = get_create_time( create_time = get_create_time(
"select create_time from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( "select create_time from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)) branch_id, type))
last_modified = get_create_time( last_modified = get_create_time(
"select last_modified from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( "select last_modified from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)) branch_id, type))
last_modified_user = rec_user last_modified_user = rec_user
last_auditor = rec_user last_auditor = rec_user
last_audit_time = get_create_time( last_audit_time = get_create_time(
"select last_audit_time from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( "select last_audit_time from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)) branch_id, type))
target_stock_name = '自动化测试12345' target_stock_name = '自动化测试12345'
rec_addr = deptname2 rec_addr = deptname2
if type == 16: if type == 16:
...@@ -281,11 +285,11 @@ def check_mcms_dept_buy_approval_after(type=16): ...@@ -281,11 +285,11 @@ def check_mcms_dept_buy_approval_after(type=16):
print(actual) print(actual)
# 获取主键id # 获取主键id
sql = "select id from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( 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) branch_id, type)
id1 = get_dept_buy_id(sql) id1 = get_dept_buy_id(sql)
# 获取order_no # 获取order_no
sql1 = "select order_no from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( sql1 = "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) branch_id, type)
order_no1 = get_dept_buy_id(sql1) order_no1 = get_dept_buy_id(sql1)
print(process_tuple(id1), process_tuple(order_no1)) print(process_tuple(id1), process_tuple(order_no1))
id1 = process_tuple(id1) id1 = process_tuple(id1)
...@@ -312,44 +316,47 @@ def check_mcms_dept_buy_approval_after(type=16): ...@@ -312,44 +316,47 @@ def check_mcms_dept_buy_approval_after(type=16):
target_stock_id = get_id("select logic_id FROM yb_direct WHERE branch_id ='%s';" % branch_id) target_stock_id = get_id("select logic_id FROM yb_direct WHERE branch_id ='%s';" % branch_id)
bill_expdt_date = get_expdt_date( 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;" % ( "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)) branch_id, type))
rec_user = get_login_user_uxid() rec_user = get_login_user_uxid()
# rec_addr='二级检验科002' # rec_addr='二级检验科002'
create_user = rec_user create_user = rec_user
create_time = get_create_time( create_time = get_create_time(
"select create_time from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( "select create_time from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)) branch_id, type))
last_modified = get_create_time( last_modified = get_create_time(
"select last_modified from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( "select last_modified from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)) branch_id, type))
last_modified_user = rec_user last_modified_user = rec_user
last_auditor = rec_user last_auditor = rec_user
last_audit_time = get_create_time( last_audit_time = get_create_time(
"select last_audit_time from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( "select last_audit_time from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
branch_id, type)) branch_id, type))
target_stock_name = '自动化测试12345' target_stock_name = '自动化测试12345'
rec_addr = deptname2 rec_addr = deptname2
if type == 16: if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_approval_after', id1, order_no1, get_hosid(), branch_id, deptid2, 'mcms_dept_buy_approval_after', id1, order_no1, get_hosid(), branch_id,
deptid2,
deptname2, area_code, area_name, target_dept_id, target_dept_name, deptname2, area_code, area_name, target_dept_id, target_dept_name,
target_stock_id, target_stock_name, bill_expdt_date, rec_user, target_stock_id, target_stock_name, bill_expdt_date, rec_user,
rec_addr, create_user, create_time, rec_addr, create_user, create_time,
last_modified, last_modified_user,last_auditor,last_audit_time) last_modified, last_modified_user, last_auditor, last_audit_time)
elif type == 20: elif type == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_approval_after2', id1, order_no1, get_hosid(), branch_id, deptid2, 'mcms_dept_buy_approval_after2', id1, order_no1, get_hosid(),
branch_id, deptid2,
deptname2, area_code, area_name, target_dept_id, target_dept_name, deptname2, area_code, area_name, target_dept_id, target_dept_name,
target_stock_id, target_stock_name, bill_expdt_date, rec_user, target_stock_id, target_stock_name, bill_expdt_date, rec_user,
rec_addr, create_user, create_time, rec_addr, create_user, create_time,
last_modified, last_modified_user,last_auditor,last_audit_time) last_modified, last_modified_user, last_auditor, last_audit_time)
else: else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_approval_after3', id1, order_no1, get_hosid(), branch_id, deptid2, 'mcms_dept_buy_approval_after3', id1, order_no1, get_hosid(),
branch_id, deptid2,
deptname2, area_code, area_name, target_dept_id, target_dept_name, deptname2, area_code, area_name, target_dept_id, target_dept_name,
target_stock_id, target_stock_name, bill_expdt_date, rec_user, target_stock_id, target_stock_name, bill_expdt_date, rec_user,
rec_addr, create_user, create_time, rec_addr, create_user, create_time,
last_modified, last_modified_user,last_auditor,last_audit_time) last_modified, last_modified_user, last_auditor, last_audit_time)
print('expected', expected) print('expected', expected)
print('aaaaaaaaaaaaaaaaa') print('aaaaaaaaaaaaaaaaa')
...@@ -387,9 +394,9 @@ def mcms_dept_buy_detail_approval_after(type=16): ...@@ -387,9 +394,9 @@ def mcms_dept_buy_detail_approval_after(type=16):
# 从数据库中获取实际值 # 从数据库中获取实际值
actual = check_mcms_dept_buy_sql(sql1) actual = check_mcms_dept_buy_sql(sql1)
print('actual', actual) print('actual', actual)
if type==16: if type == 16:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type==20: elif type == 20:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else: else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
...@@ -401,31 +408,38 @@ def mcms_dept_buy_detail_approval_after(type=16): ...@@ -401,31 +408,38 @@ def mcms_dept_buy_detail_approval_after(type=16):
print('detail_id', detail_id) print('detail_id', detail_id)
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21') info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
list_a = info['list_a'] list_a = info['list_a']
mdm_goods_code =process_tuple(get_mdm_goods_code("select mdm_goods_code from mcms_goods_info where id='%s';"%hos_goods_id)) mdm_goods_code = process_tuple(
goods_code = process_tuple(get_mdm_goods_code("select hos_goods_code from mcms_goods_info where id='%s';"%hos_goods_id)) get_mdm_goods_code("select mdm_goods_code from mcms_goods_info where id='%s';" % hos_goods_id))
pkg_def_id = process_tuple(get_id("select pkg_def_id from mcms_pkg where hos_goods_id='%s' LIMIT 1;"%hos_goods_id)) goods_code = process_tuple(
if pkg_def_id=='None': get_mdm_goods_code("select hos_goods_code from mcms_goods_info where id='%s';" % hos_goods_id))
pkg_def_id = process_tuple(
get_id("select pkg_def_id from mcms_pkg where hos_goods_id='%s' LIMIT 1;" % hos_goods_id))
if pkg_def_id == 'None':
print(pkg_def_id) print(pkg_def_id)
pkg_def_id=pkg_def_id.replace("'","") pkg_def_id = pkg_def_id.replace("'", "")
print(pkg_def_id) print(pkg_def_id)
pkg_def_name = process_tuple(get_id("select pkg_def_name from mcms_pkg where hos_goods_id='%s' LIMIT 1;"%hos_goods_id)) pkg_def_name = process_tuple(
create_user=get_login_user_uxid() get_id("select pkg_def_name from mcms_pkg where hos_goods_id='%s' LIMIT 1;" % hos_goods_id))
create_time= get_create_time("select create_time from mcms_dept_buy_detail where pid='%s';" % id1) create_user = get_login_user_uxid()
last_modified=get_create_time("select last_modified from mcms_dept_buy_detail where pid='%s';" % id1) create_time = get_create_time("select create_time from mcms_dept_buy_detail where pid='%s';" % id1)
last_modified_user=create_user last_modified = get_create_time("select last_modified from mcms_dept_buy_detail where pid='%s';" % id1)
if type==16: last_modified_user = create_user
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_detail_approval_after', detail_id, id1, order_no1, hos_goods_id, 'mcms_dept_buy_detail_approval_after', detail_id, id1, order_no1,
hos_goods_id,
mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user, mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user,
create_time, last_modified, last_modified_user) create_time, last_modified, last_modified_user)
elif type==20: elif type == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_detail_approval_after1', detail_id, id1, order_no1, hos_goods_id, 'mcms_dept_buy_detail_approval_after1', detail_id, id1, order_no1,
hos_goods_id,
mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user, mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user,
create_time, last_modified, last_modified_user) create_time, last_modified, last_modified_user)
else: else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_detail_approval_after2', detail_id, id1, order_no1, hos_goods_id, 'mcms_dept_buy_detail_approval_after2', detail_id, id1, order_no1,
hos_goods_id,
mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user, mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, create_user,
create_time, last_modified, last_modified_user) create_time, last_modified, last_modified_user)
...@@ -438,14 +452,16 @@ def mcms_dept_buy_detail_approval_after(type=16): ...@@ -438,14 +452,16 @@ def mcms_dept_buy_detail_approval_after(type=16):
print(expected_value2) print(expected_value2)
print('actual_value2') print('actual_value2')
print(actual_value2) print(actual_value2)
result=(compare_text_index(actual_value2,expected_value2)) result = (compare_text_index(actual_value2, expected_value2))
print('result',result) print('result', result)
if actual_value2 == expected_value2: if actual_value2 == expected_value2:
print('ok') print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees') commonFuc().check_text_exist_result_text('succees', 'succees')
else: else:
print('error') print('error')
commonFuc().check_text_exist_result_text('error', 'succees') commonFuc().check_text_exist_result_text('error', 'succees')
try: try:
# ==================暂时注释=================================== # ==================暂时注释===================================
# set_dept_lead() # 设置二级科室负责人 # set_dept_lead() # 设置二级科室负责人
...@@ -483,7 +499,7 @@ try: ...@@ -483,7 +499,7 @@ try:
# mcms_dept_buy_detail(int(i)) # mcms_dept_buy_detail(int(i))
# for i in range(6): # 三个单据共审批6次 # for i in range(6): # 三个单据共审批6次
# approval_center() # approval_center()
#==================上面暂时注释=================================== # ==================上面暂时注释===================================
list_data = ['16', '20', '66'] list_data = ['16', '20', '66']
for i in list_data: for i in list_data:
check_mcms_dept_buy_approval_after(int(i)) check_mcms_dept_buy_approval_after(int(i))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment