Commit 920ca4f5 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

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

parent 1e0f38b5
...@@ -98,17 +98,17 @@ def check_mcms_dept_buy_car(type=1): ...@@ -98,17 +98,17 @@ def check_mcms_dept_buy_car(type=1):
commonFuc().check_text_exist_result_text('error', 'succees') commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_dept_buy(): def check_mcms_dept_buy(type=16):
branch_id = get_branch_id() branch_id = get_branch_id()
sql = """select * from mcms_dept_buy where branch_id='%s' and bill_mode='16' order by create_time desc LIMIT 1;; sql = """select * from mcms_dept_buy where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;
""" % (branch_id) """ % (branch_id,type)
actual = check_mcms_dept_buy_sql(sql) actual = check_mcms_dept_buy_sql(sql)
print(actual) print(actual)
# 获取主键id # 获取主键id
sql = "select id from mcms_dept_buy where branch_id='%s' and bill_mode='16' order by create_time desc LIMIT 1;" % branch_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)
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='16' order by create_time desc LIMIT 1;" % branch_id 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 = 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)
...@@ -133,22 +133,38 @@ def check_mcms_dept_buy(): ...@@ -133,22 +133,38 @@ def check_mcms_dept_buy():
pkgDefName = commonFuc().analysis_json('pkgDefName', list_a) pkgDefName = commonFuc().analysis_json('pkgDefName', list_a)
#获取边仓id #获取边仓id
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("select bill_expdt_date from mcms_dept_buy where branch_id='%s' and bill_mode='16' order by create_time desc LIMIT 1;" % 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_user = get_login_user_uxid()
# rec_addr='二级检验科002' # rec_addr='二级检验科002'
create_user = rec_user create_user = rec_user
create_time = get_create_time("select create_time from mcms_dept_buy where branch_id='%s' and bill_mode='16' order by create_time desc LIMIT 1;" % branch_id) 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='16' order by create_time desc LIMIT 1;" % branch_id) 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_modified_user = rec_user
last_auditor = 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='16' order by create_time desc LIMIT 1;" % branch_id) 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' target_stock_name='自动化测试12345'
rec_addr=deptname2 rec_addr=deptname2
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', if type==16:
'mcms_dept_buy', id1, order_no1, get_hosid(), branch_id, deptid2, expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
deptname2, area_code, area_name, target_dept_id, target_dept_name, 'mcms_dept_buy', id1, order_no1, get_hosid(), branch_id, deptid2,
target_stock_id,target_stock_name, bill_expdt_date, rec_user, rec_addr,create_user, create_time, deptname2, area_code, area_name, target_dept_id, target_dept_name,
last_modified, last_modified_user) 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:
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,
target_stock_id, target_stock_name, bill_expdt_date, rec_user,
rec_addr, create_user, create_time,
last_modified, last_modified_user)
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy3', 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,
last_modified, last_modified_user)
print('expected', expected) print('expected', expected)
print('aaaaaaaaaaaaaaaaa') print('aaaaaaaaaaaaaaaaa')
actual_value1 = get_process_list2(actual) actual_value1 = get_process_list2(actual)
...@@ -160,6 +176,7 @@ def check_mcms_dept_buy(): ...@@ -160,6 +176,7 @@ def check_mcms_dept_buy():
print(expected_value2) print(expected_value2)
print('actual_value2') print('actual_value2')
print(actual_value2) print(actual_value2)
print(compare_text_index(actual_value2,expected_value2))
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')
...@@ -197,8 +214,10 @@ try: ...@@ -197,8 +214,10 @@ try:
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'], 3) second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'], 3)
check_mcms_dept_buy_car(3) check_mcms_dept_buy_car(3)
BuyCarSubmit() # 请领车提交 BuyCarSubmit() # 请领车提交
#调用函数对数据库中的数据进行验证和比对
check_mcms_dept_buy() list_data=['16','20','66']
for i in list_data:
check_mcms_dept_buy(int(i))
# for i in range(6): # 三个单据共审批6次 # for i in range(6): # 三个单据共审批6次
# approval_center() # approval_center()
# check_buyWayText()#验证出库渠道是否为边仓 # check_buyWayText()#验证出库渠道是否为边仓
......
...@@ -25,6 +25,26 @@ def get_process_list(request_body): ...@@ -25,6 +25,26 @@ def get_process_list(request_body):
return request_body_json return request_body_json
def compare_text_index(text1, text2):
import difflib, re
# 创建SequenceMatcher对象
matcher = difflib.SequenceMatcher(a=text1, b=text2)
# 获取差异报告
diff_report = matcher.get_opcodes()
# 检查差异报告中是否存在关键词错误
for tag, i1, i2, j1, j2 in diff_report:
if tag == 'replace':
print("{0} with {1}".format(text1[i1:i2], text2[j1:j2]))
elif tag == 'delete':
# 检查删除操作中是否包含关键词
print("{0} with {1}".format(text1[i1:i2], text2[j1:j2]))
elif tag == 'insert':
# 检查插入操作中是否包含关键词
print("{0} with {1}".format(text1[i1:i2], text2[j1:j2]))
return None
def get_process_list2(request_body): def get_process_list2(request_body):
request_body = str(request_body) request_body = str(request_body)
print('request_body', request_body) print('request_body', request_body)
......
"check_mcms_dept_buy_car_low_value": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": %s, "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"), "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "coding_type": 0}' "check_mcms_dept_buy_car_low_value": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": %s, "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"), "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "coding_type": 0}'
"check_mcms_dept_buy_car_high_value": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": %s, "pkg_def_id": null, "pkg_def_name": null, "pkg_def_qty": Decimal("1.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("1.00"), "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "coding_type": 0}' "check_mcms_dept_buy_car_high_value": '{"id": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "area_code": "%s", "area_name": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": %s, "pkg_def_id": null, "pkg_def_name": null, "pkg_def_qty": Decimal("1.00"), "buy_pkg_qty": Decimal("1.00"), "buy_qty": Decimal("1.00"), "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "coding_type": 0}'
"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_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}'
\ No newline at end of file "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}'
\ 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