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

新增流程十数据库验证脚本

parent c53f42eb
......@@ -97,49 +97,99 @@ def check_mcms_dept_buy_car(type=1):
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def mcms_dept_buy_detail(type=16):
branch_id = get_branch_id()
if type==16:
# 获取主表主键
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)
id1 = process_tuple(get_dept_buy_id(sql))
# 获取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;" % (
id1 = process_tuple(get_dept_buy_id(sql))
# 获取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;" % (
branch_id, type)
order_no1 = get_dept_buy_id(sql1)
order_no1 = process_tuple(order_no1)
#子表sql
sql1="select * from mcms_dept_buy_detail where pid='%s';"%id1
#从数据库中获取实际值
actual = check_mcms_dept_buy_sql(sql1)
print('actual',actual)
#获取子表id
detail_id=get_id("select id from mcms_dept_buy_detail where pid='%s';"%id1)
print('detail_id',detail_id)
order_no1 = get_dept_buy_id(sql1)
order_no1 = process_tuple(order_no1)
# 子表sql
sql1 = "select * from mcms_dept_buy_detail where pid='%s';" % id1
# 从数据库中获取实际值
actual = check_mcms_dept_buy_sql(sql1)
print('actual', actual)
hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
# print(hos_goods_id,process_tuple(hos_goods_id))
# 获取子表id
detail_id = get_id("select id from mcms_dept_buy_detail where pid='%s';" % id1)
print('detail_id', detail_id)
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
list_a = info['list_a']
mdm_goods_code =get_mdm_goods_code("select mdm_goods_code from mcms_goods_info where id='%s';"%hos_goods_id)
goods_code = get_mdm_goods_code("select hos_goods_code from mcms_goods_info where id='%s';"%hos_goods_id)
pkg_def_id = get_id("select pkg_def_id from mcms_pkg where hos_goods_id='%s' LIMIT 1;"%hos_goods_id)
pkg_def_name = get_id("select pkg_def_name from mcms_pkg where hos_goods_id='%s' LIMIT 1;"%hos_goods_id)
create_user=get_login_user_uxid()
create_time= get_create_time("select create_time from mcms_dept_buy_detail where pid='%s';" % id1)
last_modified=create_time
last_modified_user=create_user
if type==16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'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,
create_time, last_modified, last_modified_user)
elif type==20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'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,
create_time, last_modified, last_modified_user)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy_detail2', detail_id, id1, order_no1, hos_goods_id,
mdm_goods_code, goods_code, pkg_def_id, pkg_def_name, 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(" ", "")
# 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 result==None:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
else:
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_dept_buy(type=16):
branch_id = get_branch_id()
sql = """select * 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)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
# 获取主键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)
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)
id1 = get_dept_buy_id(sql)
# 获取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;" % (branch_id,type)
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)
order_no1 = get_dept_buy_id(sql1)
print(process_tuple(id1), process_tuple(order_no1))
id1=process_tuple(id1)
order_no1=process_tuple(order_no1)
id1 = process_tuple(id1)
order_no1 = process_tuple(order_no1)
deptid2 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
deptname2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
# target_dept_id=FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
# area_code = get_stockAreaId_new(deptid2, deptname2, 2)
info=FileUtils().r_info8("b5_spd3_core_business_flow", "库区信息", 'message22')
info = FileUtils().r_info8("b5_spd3_core_business_flow", "库区信息", 'message22')
list_a = info['list_a']
area_code= commonFuc().analysis_json('shelfCode', list_a)
area_code = commonFuc().analysis_json('shelfCode', list_a)
area_name = '默认库区'
# 读取文件中的信息
info = FileUtils().r_info8('b5_spd3_core_business_flow', "二级库请领产品信息", 'message21')
......@@ -150,26 +200,35 @@ def check_mcms_dept_buy(type=16):
goodsCode = commonFuc().analysis_json('goodsCode', list_a)
pkgDefId = commonFuc().analysis_json('pkgDefId', list_a)
pkgDefName = commonFuc().analysis_json('pkgDefName', list_a)
#获取边仓id
target_stock_id = get_id("select logic_id FROM yb_direct WHERE branch_id ='%s';"%branch_id)
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))
# 获取边仓id
target_stock_id = get_id("select logic_id FROM yb_direct WHERE branch_id ='%s';" % branch_id)
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))
rec_user = get_login_user_uxid()
# rec_addr='二级检验科002'
create_user = rec_user
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;" % (branch_id,type))
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;" % (branch_id,type))
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;" % (
branch_id, type))
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;" % (
branch_id, type))
last_modified_user = rec_user
last_auditor = rec_user
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;" % (branch_id,type))
target_stock_name='自动化测试12345'
rec_addr=deptname2
if type==16:
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;" % (
branch_id, type))
target_stock_name = '自动化测试12345'
rec_addr = deptname2
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy', id1, order_no1, get_hosid(), branch_id, deptid2,
deptname2, area_code, area_name, target_dept_id, target_dept_name,
target_stock_id,target_stock_name, bill_expdt_date, rec_user, rec_addr,create_user, create_time,
target_stock_id, target_stock_name, bill_expdt_date, rec_user,
rec_addr, create_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',
'mcms_dept_buy2', id1, order_no1, get_hosid(), branch_id, deptid2,
deptname2, area_code, area_name, target_dept_id, target_dept_name,
......@@ -187,7 +246,7 @@ def check_mcms_dept_buy(type=16):
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
actual_value1 = get_process_list2(actual)
expected_value1=get_process_list2(expected)
expected_value1 = get_process_list2(expected)
actual_value2 = actual_value1.replace(" ", "")
expected_value2 = expected_value1.replace(" ", "")
# print('actual_value2',actual_value2)
......@@ -195,7 +254,7 @@ def check_mcms_dept_buy(type=16):
print(expected_value2)
print('actual_value2')
print(actual_value2)
print(compare_text_index(actual_value2,expected_value2))
print(compare_text_index(actual_value2, expected_value2))
if actual_value2 == expected_value2:
print('ok')
commonFuc().check_text_exist_result_text('succees', 'succees')
......@@ -237,8 +296,8 @@ try:
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']
# 调用函数对数据库中的数据进行验证和比对
list_data = ['16', '20', '66']
for i in list_data:
check_mcms_dept_buy(int(i))
mcms_dept_buy_detail(int(i))
......@@ -246,5 +305,7 @@ try:
# approval_center()
# check_buyWayText()#验证出库渠道是否为边仓
# commonFuc().check_text_exist_result_text('succees', 'succees')
except:
except Exception as e:
# 打印错误信息
print(f"发生错误: {e}")
commonFuc().check_text_exist_result_text('error', 'succees')
......@@ -26,6 +26,7 @@ def get_process_list(request_body):
def compare_text_index(text1, text2):
import difflib, re
# 创建SequenceMatcher对象
matcher = difflib.SequenceMatcher(a=text1, b=text2)
......
......@@ -164,5 +164,11 @@ def process_tuple(tuple1):
new_str1 = new_str1.replace("'", '')
return new_str1
def get_mdm_goods_code(sql):
db, cursor = get_sql_conn()
cursor.execute(sql)
results = cursor.fetchall()
cursor.close()
return results
# hos_goods_id = 'h034700004220'
# main2(hos_goods_id)
\ No newline at end of file
......@@ -4,4 +4,6 @@
"mcms_dept_buy": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "source_id": None, "buy_way": "2", "create_type": "SG", "buy_kind": "KS", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_stock_name": "%s", "bill_expdt_date": %s, "bill_expect_date": None, "priority": 0, "buy_priority": 0, "barcode_flag": 1, "pkg_flag": 1, "remark": "", "dept_audit_remark": None, "audit_remark": None, "close_remark": None, "srv_id": None, "srv_name": None, "gen_status": 0, "close_status": 0, "tb_status": 10, "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "close_time": None, "old_order_no": None}'
"mcms_dept_buy2": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "source_id": None, "buy_way": "2", "create_type": "SG", "buy_kind": "KS", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_stock_name": "%s", "bill_expdt_date": %s, "bill_expect_date": None, "priority": 0, "buy_priority": 0, "barcode_flag": 1, "pkg_flag": 0, "remark": "", "dept_audit_remark": None, "audit_remark": None, "close_remark": None, "srv_id": None, "srv_name": None, "gen_status": 0, "close_status": 0, "tb_status": 10, "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "close_time": None, "old_order_no": None}'
"mcms_dept_buy3": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "source_id": None, "buy_way": "2", "create_type": "SG", "buy_kind": "KS", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_stock_name": "%s", "bill_expdt_date": %s, "bill_expect_date": None, "priority": 0, "buy_priority": 0, "barcode_flag": 1, "pkg_flag": 1, "remark": "", "dept_audit_remark": None, "audit_remark": None, "close_remark": None, "srv_id": None, "srv_name": None, "gen_status": 0, "close_status": 0, "tb_status": 10, "rec_user": "%s", "rec_phone": "None", "rec_addr": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "close_time": None, "old_order_no": None}'
"mcms_dept_buy_detail": {"id": "Bh034720240710000410001", "pid": "Bh03472024071000041", "order_no": "BUY2024071006209", "order_num": 1, "source_id": None, "hos_goods_id": "h034700004523", "mdm_goods_code": "11661476", "goods_code": "00004523", "price": Decimal("99.999900"), "pur_mode": 10, "pkg_def_id": "0ad202620eb54335b560f4a41883a342", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("100.00"), "send_pkg_qty": "0", "send_qty": "0", "rec_pkg_qty": "0", "rec_qty": "0", "tb_status": 10, "close_type": 0, "remark": None, "close_remark": None, "close_time": None, "create_user": "h0347_UID-051406", "create_time": datetime.datetime(2024, 7, 10, 13, 52, 8), "last_modified": datetime.datetime(2024, 7, 10, 13, 52, 8), "last_modified_user": "h0347_UID-051406", "version": 0, "del_flag": 0, "re_order_no": None, "coding_type": 0}
\ No newline at end of file
"mcms_dept_buy_detail": '{"id": "%s", "pid": "%s", "order_no": "%s", "order_num": 1, "source_id": None, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "price": Decimal("99.999900"), "pur_mode": 10, "pkg_def_id": "%s", "pkg_def_name": "%s", "pkg_def_qty": Decimal("100.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("100.00"), "send_pkg_qty": "0", "send_qty": "0", "rec_pkg_qty": "0", "rec_qty": "0", "tb_status": 10, "close_type": 0, "remark": None, "close_remark": None, "close_time": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0, "re_order_no": None, "coding_type": 0}'
"mcms_dept_buy_detail1": '{"id": "%s", "pid": "%s", "order_no": "%s", "order_num": 1, "source_id": None, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "price": Decimal("99.999900"), "pur_mode": 10, "pkg_def_id": "%s", "pkg_def_name": "%s", "pkg_def_qty": Decimal("100.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("100.00"), "send_pkg_qty": "0", "send_qty": "0", "rec_pkg_qty": "0", "rec_qty": "0", "tb_status": 10, "close_type": 0, "remark": None, "close_remark": None, "close_time": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0, "re_order_no": None, "coding_type": 0}'
"mcms_dept_buy_detail2": '{"id": "%s", "pid": "%s", "order_no": "%s", "order_num": 1, "source_id": None, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "price": Decimal("99.999900"), "pur_mode": 10, "pkg_def_id": "%s", "pkg_def_name": "%s", "pkg_def_qty": Decimal("100.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("100.00"), "send_pkg_qty": "0", "send_qty": "0", "rec_pkg_qty": "0", "rec_qty": "0", "tb_status": 10, "close_type": 0, "remark": None, "close_remark": None, "close_time": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0, "re_order_no": None, "coding_type": 0}'
\ No newline at end of file
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