Commit 7ec8fadc authored by xiao-hesheng's avatar xiao-hesheng
Browse files

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

parent 93784609
......@@ -312,12 +312,21 @@ def check_mcms_psi_dept_batch(DR_ID,type,order_no):
def check_mcms_psi_dept_out_and_in(type1=16,type2=10):
branch_id = get_branch_id()
sql = " select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_XH' order by CREATE_TIME desc LIMIT 1;" % (
if type1==20:
sql = " select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_XH' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type1)
else:
sql = " select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_CB' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type1)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
DR_ID=get_id(" select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_XH' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type1))
if type1==20:
DR_ID=get_id(" select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_XH' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type1))
else:
DR_ID = get_id(
" select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_CB' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type1))
sql = "select order_no from mcms_psi_dept where id='%s';" % DR_ID
order_no = get_id(sql)
target_corp_id = get_hosid()
......@@ -400,104 +409,108 @@ def check_mcms_psi_dept_out_and_in(type1=16,type2=10):
print('error')
commonFuc().check_text_exist_result_text('error', 'succees')
#检查拆包后生成的入库单============================================================
branch_id = get_branch_id()
sql = " select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_CB' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type2)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
DR_ID1 = get_id(
" select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_CB' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type2))
sql = "select order_no from mcms_psi_dept where id='%s';" % DR_ID1
order_no1 = get_id(sql)
target_corp_id = get_hosid()
target_branch_id = get_branch_id()
target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
target_stock_id = get_stockId_fromdb(target_dept_name + '库房')
target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 2)
PICK_id = get_PICK_id(branch_id, type1)
source_id = DR_ID
source_corp_id = get_hosid()
source_branch_id = get_branch_id()
source_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
source_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
source_stock_id = get_stockId_fromdb(source_dept_name + '库房')
source_area_code = get_stockAreaId_new_fromDb(source_dept_name, 2)
buyBillId = get_buyBillId(branch_id, type1)
pickOrderNo = get_PICK_order_no(branch_id, type1)
buyOrderNo = get_buyOrderNo(branch_id, type1)
pickBillId = get_PICK_id(branch_id, type1)
psiDeptOutBillId = DR_ID
psiDeptOutOrderNo = order_no
psiDeptInBillId=DR_ID1
psiDeptInOrderNo=order_no1
create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_time = get_create_time("select create_time from mcms_psi_dept where id='%s';" % DR_ID1)
last_modified = get_create_time("select last_modified from mcms_psi_dept where id='%s';" % DR_ID1)
last_modified_user = create_user
accounter = create_user
source_no=order_no
last_auditor=create_user
last_audit_time= get_create_time("select last_audit_time from mcms_psi_dept where id='%s';" % DR_ID1)
account_date = process_tuple(get_create_time("select account_date from mcms_psi_dept where id='%s';" % DR_ID1))
if type2 == 10:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID, type2)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept7', DR_ID1, order_no1, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id,source_no, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter, account_date,
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo
, psiDeptInBillId,psiDeptInOrderNo,create_user, create_time, last_modified, last_modified_user,
last_auditor,last_audit_time
if type1==20:
print('高值直接出库,不存在拆包业务,也就不存在自动的入库业务')
else:
branch_id = get_branch_id()
sql = " select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_CB' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type2)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
DR_ID1 = get_id(
" select id from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_CB' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, type2))
sql = "select order_no from mcms_psi_dept where id='%s';" % DR_ID1
order_no1 = get_id(sql)
target_corp_id = get_hosid()
target_branch_id = get_branch_id()
target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
target_stock_id = get_stockId_fromdb(target_dept_name + '库房')
target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 2)
PICK_id = get_PICK_id(branch_id, type1)
source_id = DR_ID
source_corp_id = get_hosid()
source_branch_id = get_branch_id()
source_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
source_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
source_stock_id = get_stockId_fromdb(source_dept_name + '库房')
source_area_code = get_stockAreaId_new_fromDb(source_dept_name, 2)
buyBillId = get_buyBillId(branch_id, type1)
pickOrderNo = get_PICK_order_no(branch_id, type1)
buyOrderNo = get_buyOrderNo(branch_id, type1)
pickBillId = get_PICK_id(branch_id, type1)
psiDeptOutBillId = DR_ID
psiDeptOutOrderNo = order_no
psiDeptInBillId=DR_ID1
psiDeptInOrderNo=order_no1
create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'])
create_time = get_create_time("select create_time from mcms_psi_dept where id='%s';" % DR_ID1)
last_modified = get_create_time("select last_modified from mcms_psi_dept where id='%s';" % DR_ID1)
last_modified_user = create_user
accounter = create_user
source_no=order_no
last_auditor=create_user
last_audit_time= get_create_time("select last_audit_time from mcms_psi_dept where id='%s';" % DR_ID1)
account_date = process_tuple(get_create_time("select account_date from mcms_psi_dept where id='%s';" % DR_ID1))
if type2 == 10:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID, type2)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept7', DR_ID1, order_no1, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id,source_no, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter, account_date,
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo
, psiDeptInBillId,psiDeptInOrderNo,create_user, create_time, last_modified, last_modified_user,
last_auditor,last_audit_time
)
elif type1 == 20:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID, type2)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept8', DR_ID, order_no, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
buyBillId, pickOrderNo, buyOrderNo, pickBillId, psiDeptOutBillId,
psiDeptOutOrderNo
, create_user, create_time, last_modified, last_modified_user)
else:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID, type2)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept9', DR_ID1, order_no1, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id,source_no, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter, account_date,
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo
, psiDeptInBillId,psiDeptInOrderNo,create_user, create_time, last_modified, last_modified_user,
last_auditor,last_audit_time)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
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)
print(compare_text_index(actual_value2, expected_value2))
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')
)
elif type1 == 20:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID, type2)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept8', DR_ID, order_no, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
buyBillId, pickOrderNo, buyOrderNo, pickBillId, psiDeptOutBillId,
psiDeptOutOrderNo
, create_user, create_time, last_modified, last_modified_user)
else:
# 子表检查
check_mcms_psi_dept_batch_in(DR_ID, type2)
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept9', DR_ID1, order_no1, target_corp_id, target_branch_id,
target_dept_id, target_dept_name, target_stock_id
, target_area_code, source_id,source_no, source_corp_id, source_branch_id,
source_dept_id, source_dept_name, source_stock_id, source_area_code,
accounter, account_date,
pickOrderNo, pickBillId, psiDeptOutBillId, psiDeptOutOrderNo
, psiDeptInBillId,psiDeptInOrderNo,create_user, create_time, last_modified, last_modified_user,
last_auditor,last_audit_time)
print('expected', expected)
print('aaaaaaaaaaaaaaaaa')
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)
print(compare_text_index(actual_value2, expected_value2))
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')
#========================================================
pro_path = commonFuc().get_pro_path2()
......@@ -512,8 +525,9 @@ try:
# sCan_grant(3) # 试剂扫码发放
# check_mcms_psi_dept_out_and_in(66,67)
# second_dept_consume_Out_Stock(2) # 高值消耗出库
check_mcms_psi_dept_out_and_in(20, 67)
# check_mcms_psi_dept_out_and_in(20, 67)
second_dept_consume_in_Stock(2) # 高值消耗退货入库
check_mcms_psi_dept_out_and_in(20, 67)
second_dept_consume_Out_Stock(1) # 低值消耗出库
second_dept_consume_in_Stock(1) # 低值消耗退回入库
second_dept_consume_Out_Stock(3) # 试剂消耗出库
......
......@@ -152,7 +152,7 @@
"mcms_psi_dept6": '{"id":"%s","order_no":"%s","bill_mode":"66","rec_type":"YND","psi_flag":-1,"psi_kind":"206","stock_kind":"CK_CB","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":"%s","target_area_name":"默认库区","source_id":"%s","source_no":null,"source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":0,"patient_id":null,"patient_name":null,"machine_id":null,"machine_name":null,"his_charge_no":null,"remark":null,"tb_status":40,"accounter":"%s","account_date":"%s","bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":2,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":null}'
#高值消耗出库
"mcms_psi_dept5": '{"id":"%s","order_no":"%s","bill_mode":"20","rec_type":"YND","psi_flag":-1,"psi_kind":"207","stock_kind":"CK_XH","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":"%s","target_area_name":"默认库区","source_id":"%s","source_no":null,"source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":2,"patient_id":"","patient_name":"","machine_id":null,"machine_name":null,"his_charge_no":"%s","remark":null,"tb_status":30,"accounter":"%s","account_date":"%s","bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":2,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":null}'
"mcms_psi_dept5": '{"id":"%s","order_no":"%s","bill_mode":"20","rec_type":"YND","psi_flag":-1,"psi_kind":"207","stock_kind":"CK_XH","target_corp_id":"%s","target_branch_id":"%s","target_dept_id":"%s","target_dept_name":"%s","target_stock_id":"%s","target_area_code":"%s","target_area_name":"默认库区","source_id":"%s","source_no":null,"source_repl_id":null,"source_corp_id":"%s","source_branch_id":"%s","source_dept_id":"%s","source_dept_name":"%s","source_stock_id":"%s","source_area_code":"%s","source_area_name":"默认库区","consume_type":2,"patient_id":"","patient_name":"","machine_id":null,"machine_name":null,"his_charge_no":"%s","remark":null,"tb_status":30,"accounter":"%s","account_date":"%s","bill_relation_json":"{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s"}","create_user":"%s","create_time":%s,"last_modified":%s,"last_modified_user":"%s","version":1,"last_auditor":null,"last_audit_time":null,"reject_reason":null,"reject_user":null,"reject_time":null,"initial_order":null,"source_type":"SG","target_coding_type":null}'
#拆包入库单主表
"mcms_psi_dept7": '{"id": "%s", "order_no": "%s", "bill_mode": "10", "rec_type": "YND", "psi_flag": 1, "psi_kind": "106", "stock_kind": "RK_CB", "target_corp_id": "%s", "target_branch_id": "%s", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_area_code": "%s", "target_area_name": "默认库区", "source_id": "%s", "source_no": "%s", "source_repl_id": None, "source_corp_id": "%s", "source_branch_id": "%s", "source_dept_id": "%s", "source_dept_name": "%s", "source_stock_id": "%s", "source_area_code": "%s", "source_area_name": "默认库区", "consume_type": 0, "patient_id": None, "patient_name": None, "machine_id": None, "machine_name": None, "his_charge_no": None, "remark": None, "tb_status": 30, "accounter": "%s", "account_date": "%s", "bill_relation_json": "{"pickOrderNo":"%s","pickBillId":"%s","psiDeptOutBillId":"%s","psiDeptOutOrderNo":"%s","psiDeptInBillId":"%s","psiDeptInOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "last_auditor": "%s", "last_audit_time": %s, "reject_reason": None, "reject_user": None, "reject_time": None, "initial_order": None, "source_type": "SG", "target_coding_type": None}'
......
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