diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" "b/air_case/b6_spd3_core_business_flow_database_check/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index 34ef1d1bef0f05104555262710a43d1fa2bcd971..bdc4bab66687dd472b558af3b557e65399925564 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" +++ "b/air_case/b6_spd3_core_business_flow_database_check/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_b4\346\265\201\347\250\213\345\215\201\344\270\200\350\257\267\351\242\206\344\270\232\345\212\241\346\265\201_\344\272\214\347\272\247\345\272\223\345\220\221\347\233\264\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -6,7 +6,8 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_ 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 + 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 from common.db.sql.sql_tools_out import check_out_check_mcms_purchase from common.fileUtls import FileUtils @@ -1120,17 +1121,24 @@ def check_hdi_distr(type=16): "select id from mcms_purchase where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( branch_id, type)) pur_bill_id = source_id - rec_user = '自动化测试w&vqF' + info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3') + rec_user = info['username1'] 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, type) print(sql) buyBillId = process_tuple(get_dept_buy_id(sql)) - 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)) + 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 = 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)) + # process_date(purBillDate) + distrBillId = distr_main_key distrOrderNo = distr_order_no - distrUser = get_login_user_uxid() + distrUser = get_login_user_uxid2() create_user = distrUser create_user_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"] create_time = get_create_time( @@ -1146,6 +1154,7 @@ def check_hdi_distr(type=16): 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))) + planOrderNo = process_tuple( get_id( "select order_no from spd3_herp_test2.mcms_pur_plan_detail where hos_goods_id='%s' order by create_time desc LIMIT 1;" % ( @@ -1170,11 +1179,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, pur_dept_name))) - rec_org_name = pur_dept_name + 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() + # import pdb + # pdb.set_trace() 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, diff --git a/air_case/public1/public1/public1.py b/air_case/public1/public1/public1.py index 5b4ea67012aea06a54fc589a33f61ce6931b3f14..8dca5eb332e447101f67c32b6687606082e7afc5 100644 --- a/air_case/public1/public1/public1.py +++ b/air_case/public1/public1/public1.py @@ -3449,4 +3449,19 @@ def get_login_user_uxid(): # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') # 获取token和projectCode token1, projectCode1, uxid1, corpId1, info1 = login_system(username, password).get_token() + return uxid1 + +def get_login_user_uxid2(): + module = "b5_spd3_core_business_flow" + # 登录获取用户id等信息,使用创建的用户登录===========开始 + info = FileUtils().r_info8(module, "供货关系申请2", 'message') + print(info) + username1 = info['e_username'] + + username = username1 + ## print('医院名称',username) + password = commonFuc().get_business_data(module, "password") + # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') + # 获取token和projectCode + token1, projectCode1, uxid1, corpId1, info1 = login(username, password,1) return uxid1 \ No newline at end of file diff --git a/common/db/sql/sql_tools.py b/common/db/sql/sql_tools.py index 35c38d3d40b0b5cef042ddde52b5dd548c6c2ef1..8ab92cf246048900c5811f55ee6473b2ed87d4c5 100644 --- a/common/db/sql/sql_tools.py +++ b/common/db/sql/sql_tools.py @@ -144,6 +144,11 @@ def get_expdt_date(sql): # print(new_str1) cursor.close() return new_str1 +def get_expdt_date1(sql): + db, cursor = get_sql_conn() + cursor.execute(sql) + results = cursor.fetchone() + return results def get_id(sql): db, cursor = get_sql_conn() cursor.execute(sql) @@ -188,5 +193,33 @@ def check_in_check_mcms_purchase(sql): # print(new_str1) cursor.close() return new_str1 +def process_date(str1): + # str1 = "datetime.datetime(2024, 9, 17, 15, 32, 58)" + str2 = str1.replace('datetime.datetime(', "") + str3 = str2.replace(')', "") + result = str3.split(",") + result.pop(3) + result.pop(4) + result.pop(3) + print(result) + b = [int(x) for x in result] + print(type(b), b) + date_list = b + # + from datetime import datetime + + # # 假设我们有一个列表,包含年、月、日 + # date_list = [2023, 3, 14] + # print(type(date_list),date_list) + # + # # 使用列表元素构造字符串 + date_string = '-'.join(map(str, date_list)) + # + # # 使用datetime.strptime将字符串转换为日期 + date = datetime.strptime(date_string, '%Y-%m-%d').date() + + # + print(date) # 输出: 2023-03-14 + return date # hos_goods_id = 'h034700004220' # main2(hos_goods_id) \ No newline at end of file diff --git a/common/db/sql/sql_tools_out.py b/common/db/sql/sql_tools_out.py index 7fe3f3e029d8738fff19c51c224618412ce601a9..f1b74091aa044bd2876faf09915ead98ea6f11f8 100644 --- a/common/db/sql/sql_tools_out.py +++ b/common/db/sql/sql_tools_out.py @@ -113,7 +113,11 @@ def process_tuple(tuple1): new_str1 = new_str1.replace(',', '') new_str1 = new_str1.replace("'", '') return new_str1 - +def get_expdt_date1(sql): + db, cursor = get_sql_conn() + cursor.execute(sql) + results = cursor.fetchone() + return results def get_mdm_goods_code(sql): db, cursor = get_sql_conn() cursor.execute(sql)