Commit 112d52a7 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

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

parent ccfb955c
...@@ -364,6 +364,7 @@ def pick_execute(): ...@@ -364,6 +364,7 @@ def pick_execute():
"herpService_stock_out_buyPage_url") "herpService_stock_out_buyPage_url")
info= FileUtils().r_info8('b5_spd3_core_business_flow', "二级库向二级库请领单号", 'message25') info= FileUtils().r_info8('b5_spd3_core_business_flow', "二级库向二级库请领单号", 'message25')
# print(info) # print(info)
DRNo_list = []
for i in range(1,4): for i in range(1,4):
if i==1: if i==1:
orderNo = info['buy_NO1'] orderNo = info['buy_NO1']
...@@ -433,6 +434,13 @@ def pick_execute(): ...@@ -433,6 +434,13 @@ def pick_execute():
print('提交拣货执行单', 'request_body', request_body) print('提交拣货执行单', 'request_body', request_body)
result = commonFuc().http_post(url, request_body, headers) result = commonFuc().http_post(url, request_body, headers)
print(' 提交拣货执行单,result1', result) print(' 提交拣货执行单,result1', result)
DR_id=commonFuc().analysis_json('data',result)
DRNo_list.append(DR_id)
# 将请领单号写入文件
info = (DRNo_list[0], DRNo_list[1], DRNo_list[2])
titlename = ('DR_NO1', 'DR_NO2', 'DR_NO3')
FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '拣货单id', titlename, 'message26')
# 复核=================================== # 复核===================================
......
...@@ -291,7 +291,68 @@ def check_mcms_dept_buy(type=16): ...@@ -291,7 +291,68 @@ def check_mcms_dept_buy(type=16):
else: else:
print('error') print('error')
commonFuc().check_text_exist_result_text('error', 'succees') commonFuc().check_text_exist_result_text('error', 'succees')
def check_mcms_psi_dept(type=16):
branch_id=get_branch_id()
sql=" select * from mcms_psi_dept where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_SL' order by CREATE_TIME desc LIMIT 1;"%(branch_id,type)
actual = check_mcms_dept_buy_sql(sql)
print(actual)
info = FileUtils().r_info8('b5_spd3_core_business_flow', "拣货单id", 'message26')
# print(info)
if type==16:
DR_ID=info['DR_NO2']
elif type==20:
DR_ID = info['DR_NO3']
else:
DR_ID = info['DR_NO1']
order_no = get_id("select order_no from mcms_psi_dept where id='%s';" % DR_ID)
target_corp_id=get_hosid()
target_branch_id=get_branch_id()
target_dept_id=FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid5']
target_dept_name=FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid5']
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,type)
source_id=PICK_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)
if type == 16:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_psi_dept1',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
)
elif type == 20:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy5_2')
else:
expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check',
'mcms_dept_buy5_3')
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')
try: try:
pro_path = commonFuc().get_pro_path2() pro_path = commonFuc().get_pro_path2()
print('pro_path', pro_path) print('pro_path', pro_path)
...@@ -349,11 +410,12 @@ try: ...@@ -349,11 +410,12 @@ try:
# for i in range(6): # 三个单据共审批6次 # for i in range(6): # 三个单据共审批6次
# approval_center() # approval_center()
# updateUserLoginDefaultRange(get_listUserMgrRangePage1(2)) # 设置登录账号默认权限是二级库 # updateUserLoginDefaultRange(get_listUserMgrRangePage1(2)) # 设置登录账号默认权限是二级库
# 二级科室领用出库 # # # 二级科室领用出库
# # # 低值拣货执行
# pick_execute()
# 上面暂时注释======================== # 上面暂时注释========================
# 低值拣货执行 #检查出库单
pick_execute() check_mcms_psi_dept(16)
second_dept_one_key_in(5) second_dept_one_key_in(5)
second_dept_one_key_in(5) second_dept_one_key_in(5)
second_dept_one_key_in(5) second_dept_one_key_in(5)
......
...@@ -169,6 +169,8 @@ def get_id(sql): ...@@ -169,6 +169,8 @@ def get_id(sql):
# print(new_str1) # print(new_str1)
cursor.close() cursor.close()
return new_str1 return new_str1
def get_dept_buy_id(sql): def get_dept_buy_id(sql):
db, cursor = get_sql_conn() db, cursor = get_sql_conn()
cursor.execute(sql) cursor.execute(sql)
...@@ -253,6 +255,12 @@ def check_source_id(hos_goods_id,source_id): ...@@ -253,6 +255,12 @@ def check_source_id(hos_goods_id,source_id):
return True return True
else: else:
return False return False
def get_PICK_id(branch_id,bill_mode):
sql = "select id from mcms_pick where branch_id='%s' and bill_mode='%s' order by CREATE_TIME desc LIMIT 1;" % (
branch_id, bill_mode)
print(sql)
return process_tuple(get_dept_buy_id(sql))
def get_buyBillId(branch_id,bill_mode): def get_buyBillId(branch_id,bill_mode):
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;" % ( 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;" % (
branch_id, bill_mode) branch_id, bill_mode)
......
...@@ -73,3 +73,4 @@ ...@@ -73,3 +73,4 @@
"mcms_dept_buy5_2": '{"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": null, "create_type": "SG", "buy_kind": "LY", "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": "xhs0301", "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_buy5_2": '{"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": null, "create_type": "SG", "buy_kind": "LY", "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": "xhs0301", "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_buy5_3": '{"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": null, "create_type": "SG", "buy_kind": "LY", "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": "xhs0301", "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_buy5_3": '{"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": null, "create_type": "SG", "buy_kind": "LY", "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": "xhs0301", "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_psi_dept1": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "rec_type": "YND", "psi_flag": -1, "psi_kind": "204", "stock_kind": "CK_SL", "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": None, "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": "", "patient_name": "", "machine_id": None, "machine_name": None, "his_charge_no": None, "remark": "", "tb_status": 20, "accounter": None, "account_date": None, "bill_relation_json": "{"buyBillId":"Bh03472024072300096","pickOrderNo":"JH202407230037","buyOrderNo":"BUY2024072309790","pickBillId":"PICKh03472407230037","psiDeptOutBillId":"DRh034720240723000050","psiDeptOutOrderNo":"DN20240723000050"}", "create_user": "h0347_UID-051420", "create_time": datetime.datetime(2024, 7, 23, 15, 22, 5), "last_modified": datetime.datetime(2024, 7, 23, 15, 22, 5), "last_modified_user": "h0347_UID-051420", "version": 0, "last_auditor": None, "last_audit_time": None, "reject_reason": None, "reject_user": None, "reject_time": None, "initial_order": None, "source_type": "SG", "target_coding_type": 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