Commit d92167ec authored by xiao-hesheng's avatar xiao-hesheng
Browse files

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

parent 21f40ab5
......@@ -7,7 +7,8 @@ from air_case.public1.public1.public1 import *
from common.db.sql.sql_del_branch_info import delData
from common.db.sql.sql_tools import get_create_time, check_mcms_dept_buy_car_sql, get_dept_buy_id, \
check_mcms_dept_buy_sql, get_mdm_goods_code, get_expdt_date, check_mcms_pur_plan_sql, check_in_check_mcms_purchase, \
get_expdt_date1, process_date
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
from common.db.sql.sql_tools_out import check_out_check_mcms_purchase
from common.fileUtls import FileUtils
......@@ -1127,10 +1128,11 @@ def check_hdi_distr(type=16):
branch_id, type)
print(sql)
buyBillId = process_tuple(get_dept_buy_id(sql))
bill_relation_json=get_id("select bill_relation_json from hdi_distr a where id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
bill_relation_json = get_id(
"select bill_relation_json from hdi_distr a where id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
distr_main_key, type))
print(bill_relation_json)
purBillDate=reGetString(bill_relation_json,r'purBillDate":"',r'""distrBillId')
purBillDate = reGetString(bill_relation_json, r'purBillDate":"', r'""distrBillId')
# purBillDate = get_expdt_date(
# "select create_time from mcms_purchase where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
# branch_id, type))
......@@ -1147,7 +1149,7 @@ def check_hdi_distr(type=16):
last_modified_user = distrUser
if type == 16:
# 验证子表数据
# check_mcms_mcms_pur_plan_detail(id2, type, planOrderNo)
check_hdi_distr_detail(distr_main_key, type, purchase_id)
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
planBillId = process_tuple(
......@@ -1179,11 +1181,11 @@ def check_hdi_distr(type=16):
pur_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
pur_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
rec_org_id = process_tuple(
get_id("select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';" % (branch_id, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'])))
get_id("select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';" % (
branch_id, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'])))
rec_org_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
last_modified=create_time
# import pdb
# pdb.set_trace()
last_modified = create_time
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'hdi_distr', distr_main_key, distr_order_no, hos_id, get_hosname(),
get_branch_id(), source_id, pur_bill_id, prov_id, prov_name,
......@@ -1196,7 +1198,7 @@ def check_hdi_distr(type=16):
elif type == 20:
# 验证子表数据
# check_mcms_mcms_pur_plan_detail(id2, type, planOrderNo)
check_hdi_distr_detail(distr_main_key, type, purchase_id)
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
planBillId = process_tuple(
......@@ -1229,7 +1231,7 @@ def check_hdi_distr(type=16):
pur_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
rec_org_id = process_tuple(
get_id("select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';" % (
branch_id, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'])))
branch_id, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'])))
rec_org_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
last_modified = create_time
# import pdb
......@@ -1246,7 +1248,7 @@ def check_hdi_distr(type=16):
elif type == 66:
# 验证子表数据
# check_mcms_mcms_pur_plan_detail(id2, type, planOrderNo)
check_hdi_distr_detail(distr_main_key, type, purchase_id)
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
planBillId = process_tuple(
......@@ -1279,7 +1281,7 @@ def check_hdi_distr(type=16):
pur_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
rec_org_id = process_tuple(
get_id("select id from spd3_herp_test2.sys_org where branch_id='%s' and ename='%s';" % (
branch_id, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'])))
branch_id, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'])))
rec_org_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
last_modified = create_time
# import pdb
......@@ -1315,6 +1317,123 @@ def check_hdi_distr(type=16):
commonFuc().check_text_exist_result_text('error', 'succees')
def check_hdi_distr_detail(distr_main_key, type, purchase_id):
sql = "select * from hdi_distr_detail where pid = '%s';" % distr_main_key
# 获取实际值
actual = check_mcms_pur_plan_sql(sql)
print('actual', actual)
# 获取子表主键
distr_detail_main_key = get_id(
"select id from hdi_distr_detail where pid = '%s';" % (
distr_main_key))
source_id = purchase_id
source_detail_id = get_id("select id from mcms_purchase_detail where pid='%s'" % purchase_id)
pur_detail_id = source_detail_id
if type==16:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
elif type==20:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"]
else:
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"]
mdm_goods_code = get_mdm_goods_code1(hos_goods_id)
goods_code = get_goods_code1(hos_goods_id)
goods_name = get_goods_name(hos_goods_id)
goods_gg = get_goods_gg(hos_goods_id)
mfrs_id = get_goods_mfrs_id(hos_goods_id)
expdt_date = get_expdt_date(
"select expdt_date from hdi_distr_detail where pid = '%s';" % (
distr_main_key))
product_date = get_expdt_date(
"select product_date from hdi_distr_detail where pid = '%s';" % (
distr_main_key))
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 = get_supply_id(hos_goods_id)
sub_prov_id = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"]
sub_prov_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"]
planBillId = process_tuple(
get_id(
"select pid from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % (
hos_goods_id)))
sql = "select id from spd3_herp_test2.mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
get_branch_id(), type)
print(sql)
buyBillId = process_tuple(get_dept_buy_id(sql))
buyDetailId = get_id(
"select id from mcms_dept_buy_detail where pid='%s';" % buyBillId)
# planBillId = process_tuple(
# get_id(
# "select pid from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % (
# hos_goods_id)))
planDetailId = get_id(
"select id from spd3_herp_test2.mcms_pur_plan_detail where pid='%s';" % planBillId)
purDetailId = pur_detail_id
sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % (
get_branch_id(), type)
print(sql)
id1 = process_tuple(get_dept_buy_id(sql))
purBillId = id1
distrDetailId = distr_detail_main_key
distrBillId = distr_main_key
erpCode = mdm_goods_code#11661563
create_user = get_login_user_uxid2()
create_time = get_create_time(
"select create_time from hdi_distr_detail where id = '%s';" % (
distr_detail_main_key))
last_modified=create_time
last_modified_user=create_user
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'hdi_distr_detail', distr_detail_main_key, distr_main_key, source_id,
source_detail_id, pur_detail_id
, hos_goods_id, mdm_goods_code, goods_code, goods_name, goods_gg,
mfrs_id, expdt_date, product_date
, pkg_def_id, supply_id, sub_prov_id, sub_prov_name, planBillId,
buyDetailId, planDetailId, purDetailId, purBillId, distrDetailId,
distrBillId, goods_gg, goods_code, goods_name, erpCode,create_user,create_time,last_modified,last_modified_user)
elif type==20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'hdi_distr_detail', distr_detail_main_key, distr_main_key, source_id,
source_detail_id, pur_detail_id
, hos_goods_id, mdm_goods_code, goods_code, goods_name, goods_gg,
mfrs_id, expdt_date, product_date
, pkg_def_id, supply_id, sub_prov_id, sub_prov_name, planBillId,
buyDetailId, planDetailId, purDetailId, purBillId, distrDetailId,
distrBillId, goods_gg, goods_code, goods_name, erpCode, create_user,
create_time, last_modified, last_modified_user)
elif type==66:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'hdi_distr_detail', distr_detail_main_key, distr_main_key, source_id,
source_detail_id, pur_detail_id
, hos_goods_id, mdm_goods_code, goods_code, goods_name, goods_gg,
mfrs_id, expdt_date, product_date
, pkg_def_id, supply_id, sub_prov_id, sub_prov_name, planBillId,
buyDetailId, planDetailId, purDetailId, purBillId, distrDetailId,
distrBillId, goods_gg, goods_code, goods_name, erpCode, 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')
try:
pro_path = commonFuc().get_pro_path2()
print('pro_path', pro_path)
......
......@@ -174,13 +174,55 @@ def process_tuple(tuple1):
new_str1 = new_str1.replace(',', '')
new_str1 = new_str1.replace("'", '')
return new_str1
def get_mdm_goods_code1(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select mdm_goods_code from mcms_goods_info where id='%s'"%hos_goods_id)
results = cursor.fetchall()
cursor.close()
return process_tuple(results)
def get_goods_code1(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select hos_goods_code from mcms_goods_info where id='%s'"%hos_goods_id)
results = cursor.fetchall()
cursor.close()
return process_tuple(results)
def get_goods_name(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select goods_name from mcms_goods_info where id='%s'"%hos_goods_id)
results = cursor.fetchall()
cursor.close()
return process_tuple(results)
def get_goods_gg(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select goods_spec from mcms_goods_info where id='%s'"%hos_goods_id)
results = cursor.fetchall()
cursor.close()
return process_tuple(results)
def get_supply_id(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select id from supply_prov_hos_goods where hos_goods_id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
return process_tuple(results)
def get_goods_name1(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select goods_name from mcms_goods_info where id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
return process_tuple(results)
def get_mdm_goods_code(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
results = cursor.fetchall()
cursor.close()
return results
def get_goods_mfrs_id(hos_goods_id):
db, cursor = get_sql_conn()
cursor.execute("select goods_mfrs_id from mcms_goods_info where id='%s'" % hos_goods_id)
results = cursor.fetchall()
cursor.close()
return process_tuple(results)
def check_in_check_mcms_purchase(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
......
......@@ -43,3 +43,5 @@
"hdi_distr": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "rec_type": "HDI", "hos_id": "%s", "hos_name": "%s", "branch_id": "%s", "source_id": "%s", "source_type": "CGD", "pur_bill_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "settlement": None, "pur_dept_id": "%s", "pur_dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "rec_user": "%s", "rec_phone": "None", "rec_addr": "设备科001", "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s"}", "ext_info": "{"epidemicFlag":0,"purMode":10,"distrUser":"%s"}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "task_id": None, "convert_flag": 1, "convert_time": None, "convert_user_name": None, "reject_status": 0, "tb_status": 20, "create_user": "%s", "create_user_name": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "initial_order": None}'
"hdi_distr1": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "rec_type": "HDI", "hos_id": "%s", "hos_name": "%s", "branch_id": "%s", "source_id": "%s", "source_type": "CGD", "pur_bill_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "settlement": None, "pur_dept_id": "%s", "pur_dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "rec_user": "%s", "rec_phone": "None", "rec_addr": "设备科001", "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s"}", "ext_info": "{"epidemicFlag":0,"purMode":20,"distrUser":"%s"}", "barcode_flag": 1, "pkg_flag": 0, "remark": "", "task_id": None, "convert_flag": 1, "convert_time": None, "convert_user_name": None, "reject_status": 0, "tb_status": 20, "create_user": "%s", "create_user_name": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "initial_order": None}'
"hdi_distr2": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "rec_type": "HDI", "hos_id": "%s", "hos_name": "%s", "branch_id": "%s", "source_id": "%s", "source_type": "CGD", "pur_bill_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "settlement": None, "pur_dept_id": "%s", "pur_dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "rec_user": "%s", "rec_phone": "None", "rec_addr": "设备科001", "bill_relation_json": "{"buyBillId":"%s","planBillId":"%s","planOrderNo":"%s","buyOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s"}", "ext_info": "{"epidemicFlag":0,"purMode":10,"distrUser":"%s"}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "task_id": None, "convert_flag": 1, "convert_time": None, "convert_user_name": None, "reject_status": 0, "tb_status": 20, "create_user": "%s", "create_user_name": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "initial_order": None}'
"hdi_distr_detail": '{"id": "%s", "pid": "%s", "source_id": "%s", "source_detail_id": "%s", "pur_detail_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "goods_name": "%s", "goods_gg": "%s", "pur_mode": "10", "mfrs_id": "%s", "mfrs_name": "德国歌德公司 Geuder AG", "made": "德国", "unit": "支", "pur_price": Decimal("99.999900"), "batch_code": "333", "expdt_date": %s, "product_date": %s, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "supply_id": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "sub_price": Decimal("99.9999"), "distr_price": Decimal("99.9999"), "distr_pkg_qty": Decimal("1.00"), "distr_qty": Decimal("100.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","buyDetailId":"%s","planDetailId":"%s","purDetailId":"%s","purBillId":"%s","distrDetailId":"%s","distrBillId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":10,"goodsName":"%s","ygptCode":"","transCond":"","storageCond":"","erpCode":"%s","ybDefId":""}", "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}'
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