diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_a2_\346\265\201\347\250\213\344\272\214\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a2_\346\265\201\347\250\213\344\272\214\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244\345\256\241\346\211\271_\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_a2_\346\265\201\347\250\213\344\272\214\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a2_\346\265\201\347\250\213\344\272\214\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index 04dc468eef5d437b02ec65f61c9bac6ec656b9ca..ff28f3a43c907114cdb181e6e7269beac4cc6ad0 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_a2_\346\265\201\347\250\213\344\272\214\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a2_\346\265\201\347\250\213\344\272\214\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244\345\256\241\346\211\271_\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_a2_\346\265\201\347\250\213\344\272\214\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a2_\346\265\201\347\250\213\344\272\214\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -1,6 +1,10 @@ # -*- encoding=utf8 -*- -from air_case.public1.public1.public1 import get_branch_id, check_mcms_pur_sql, get_create_time, \ - get_login_user_uxid_bydb, get_id, get_process_list2, compare_text_index +from air_case.public1.public1.public1 import updateUserLoginDefaultRange, get_listUserMgrRangePage, call_login, \ + get_branch_id, get_dept_buy_id, check_mcms_pur_plan_sql, get_hosid, get_id, \ + get_stockAreaId_new_fromDb, get_login_user_uxid, get_expdt_date, get_create_time, get_process_list2, \ + compare_text_index, check_mcms_pur_sql, check_source_id, get_mdm_goods_code1, get_goods_code1, get_supply_id, \ + get_pkg_def_id, get_goods_gg, get_goods_name, process_tuple, get_prov_id, get_prov_id1 +from common.db.sql.sql_tools_out import get_login_user_uxid_bydb from common.fileUtls import FileUtils __author__ = "xiaohesheng" @@ -15,28 +19,74 @@ from common.common_func import commonFuc from air_case.mdm_login.登录外网系统.登录外网系统 import login_system from airtest.core.api import using import sys -from air_case.public1.public1.public1 import * -def check_supply_relation(type=1): + +def check_supply_relation(): print('检查供应关系表数据') branch_id = get_branch_id() sql1 = "select * from spd_ybtest_hdi.supply_relation order by create_time desc limit 1;" actual = check_mcms_pur_sql(sql1) print('actual', actual) id=get_id("select id from spd_ybtest_hdi.supply_relation order by create_time desc limit 1;") - hos_id=get_hosid() - prov_id = get_prov_id() - sub_prov_id='p10d95' + hos_id=get_id("select hos_id from spd_ybtest_hdi.supply_relation where id='%s';" % id) + prov_id = get_prov_id1() + sub_prov_id=prov_id + contact_way=get_id("select contact_way from spd_ybtest_hdi.supply_relation where id='%s';" % id) + contact_user=get_id("select contact_user from spd_ybtest_hdi.supply_relation where id='%s';" % id) create_time = get_create_time("select create_time from spd_ybtest_hdi.supply_relation where id='%s';" % id) last_modified = get_create_time("select last_modified from spd_ybtest_hdi.supply_relation where id='%s';" % id) # username = commonFuc().get_business_data('b2_herp3_bs', "username") + auditor=get_id("select auditor from spd_ybtest_hdi.supply_relation where id='%s';" % id) + # create_user = get_login_user_uxid_bydb( + # FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"]) + # last_modified_user = create_user + audit_time= get_create_time("select audit_time from spd_ybtest_hdi.supply_relation where id='%s';" % id) + last_modified = get_create_time("select last_modified from spd_ybtest_hdi.supply_relation where id='%s';" % id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_supply_relation', id,hos_id,prov_id,sub_prov_id,contact_way + ,contact_user,auditor,audit_time, create_time, last_modified) + + 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 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') +def check_supply_relation2(): + print('检查供应关系表数据') + branch_id = get_branch_id() + sql1 = "select * from spd_ybtest_hdi.supply_relation order by create_time desc limit 1;" + actual = check_mcms_pur_sql(sql1) + print('actual', actual) + id=get_id("select id from spd_ybtest_hdi.supply_relation order by create_time desc limit 1;") + hos_id=get_id("select hos_id from spd_ybtest_hdi.supply_relation where id='%s';" % id) + prov_id = get_prov_id() + sub_prov_id=get_id("select sub_prov_id from spd_ybtest_hdi.supply_relation where id='%s';" % id) + contact_way=get_id("select contact_way from spd_ybtest_hdi.supply_relation where id='%s';" % id) + contact_user=get_id("select contact_user from spd_ybtest_hdi.supply_relation where id='%s';" % id) + create_time = get_create_time("select create_time from spd_ybtest_hdi.supply_relation where id='%s';" % id) + # last_modified = get_create_time("select last_modified from spd_ybtest_hdi.supply_relation where id='%s';" % id) + # username = commonFuc().get_business_data('b2_herp3_bs', "username") + auditor=get_id("select auditor from spd_ybtest_hdi.supply_relation where id='%s';" % id) create_user = get_login_user_uxid_bydb( FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"]) - last_modified_user = create_user - parent_id = get_id("select parent_id from mcms_stock_shelf where id='%s';" % id) + last_modified_user = get_id("select id from spd_ybtest_hdi.sys_user where user_code='test_1';") + audit_time= get_create_time("select audit_time from spd_ybtest_hdi.supply_relation where id='%s';" % id) + last_modified = get_create_time("select last_modified from spd_ybtest_hdi.supply_relation where id='%s';" % id) expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', - 'check_mcms_goods_info', id - , create_user, create_time, last_modified_user, last_modified) + 'check_supply_relation2', id,hos_id,prov_id,sub_prov_id,contact_way + ,contact_user,auditor,audit_time, create_user,create_time, last_modified_user,last_modified) actual_value1 = get_process_list2(actual) expected_value1 = get_process_list2(expected) @@ -70,12 +120,15 @@ try: # 供应关系申请-客户类型医院 FileUtils().w_info1(supply_and_marketing_apply(), module, '供货关系申请') submitSupplyRelation_pass() + check_supply_relation() # 供应关系申请-客户类型厂商 FileUtils().w_info1(supply_and_marketing_apply2(), module, '供货关系申请2') submitSupplyRelation_pass() + check_supply_relation2() commonFuc().check_text_exist_result_text('succees', 'succees') print('=================流程二结束=================') except Exception as e: # 打印错误信息 print(f"发生错误: {e}") + print("发生异常:", str(e)) print('a_a2_流程二供货关系申请提交审批,出现异常,请检查') diff --git a/air_case/public1/public1/public1.py b/air_case/public1/public1/public1.py index 6c414bedf61cedb56a284aa32b51f90ce37807c1..50478767d0758d0f46cfd00fda04f4340b9706e7 100644 --- a/air_case/public1/public1/public1.py +++ b/air_case/public1/public1/public1.py @@ -3764,6 +3764,10 @@ def comparison_result(actual, expected): def get_prov_id(): return FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"] +def get_prov_id1(): + return FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请', 'message')["e_corpId"] + + def get_prov_name(): return FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"] diff --git a/common/db/sql/sql_tools_out.py b/common/db/sql/sql_tools_out.py index f1b74091aa044bd2876faf09915ead98ea6f11f8..4d1d89ce8c07154c10d74408d91669288e38a542 100644 --- a/common/db/sql/sql_tools_out.py +++ b/common/db/sql/sql_tools_out.py @@ -1,3 +1,5 @@ +import time + import pymysql from common.fileUtls import FileUtils @@ -8,7 +10,11 @@ def get_db(): db = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd_hdiorder_test2", charset="utf8") return db - +def get_db1(): + # 打开数据库连接 + db = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd_ybtest_hdi", + charset="utf8") + return db def get_sql_conn(): """ @@ -17,6 +23,13 @@ def get_sql_conn(): db = get_db() cursor = db.cursor() return db, cursor +def get_sql_conn1(): + """ + 获取数据库连接 + """ + db = get_db1() + cursor = db.cursor() + return db, cursor def get_index_dict(cursor): @@ -135,6 +148,27 @@ def check_out_check_mcms_purchase(sql): new_str1 = new_str1.replace("'", '') # print(new_str1) cursor.close() + return new_str1 +def get_login_user_uxid_bydb(username): + while True: + db, cursor = get_sql_conn1() + sql = "select id from sys_user where user_code='%s';" % username + cursor.execute(sql) + results = cursor.fetchone() + str1 = str(results) + if str1=='None': + time.sleep(6) + continue + else: + new_str1 = str1.replace(',)', '') + new_str1 = new_str1.replace('(', '') + new_str1 = new_str1.replace(',', '') + new_str1 = new_str1.replace("'", '') + break + # print(new_str1) + cursor.close() + db.close() + return new_str1 # hos_goods_id = 'h034700004220' # main2(hos_goods_id) \ No newline at end of file diff --git a/data/a2_mdm3_ea/message b/data/a2_mdm3_ea/message index 7f644ad8c1a20ae0b33f20ef471475ebbb5844e3..3631b07b4850a177d163776f2295c4749e87a027 100644 --- a/data/a2_mdm3_ea/message +++ b/data/a2_mdm3_ea/message @@ -1,3 +1,3 @@ 企业信息: - e_id: CR202410310093 - cname: 国药集团公司M@n&X + e_id: CR202411050093 + cname: 国药集团公司C9U^w diff --git a/data/b5_spd3_core_business_flow/message b/data/b5_spd3_core_business_flow/message index 7441e5332c47717c0eacdeee73f3c414a918118d..92d5c1f690fce2f3fe0a1f973e087e9ee96b3899 100644 --- a/data/b5_spd3_core_business_flow/message +++ b/data/b5_spd3_core_business_flow/message @@ -1,5 +1,5 @@ 供货关系申请2: - e_corpId: p1e4bc + e_corpId: p1e4f5 h_corpId: h0347 - e_username: 国药集团公司M@n&X + e_username: 国药集团公司C9U^w h_name: test_1 diff --git a/data/b6_spd3_core_business_flow_database_check/data b/data/b6_spd3_core_business_flow_database_check/data index a245c71ef6d3641bbb2177bc5055752dbc298c72..14ed44c8080d7a67749b6998829c84988dd0534d 100644 --- a/data/b6_spd3_core_business_flow_database_check/data +++ b/data/b6_spd3_core_business_flow_database_check/data @@ -529,3 +529,7 @@ "check_mcms_goods_info_after_approval3": '{"id": "%s", "hos_goods_code": "%s", "hos_id": "%s", "prov_id": "%s", "prov_hos_goods_id": "%s", "srv_id": None, "mdm_goods_code": "%s", "mdm_goods_spec_code": "%s", "spd_goods_code": "%s", "goods_name": "%s", "goods_general_name": "检测试剂", "goods_mfrs_id": "mfrs-11229", "goods_mfrs_name": "德国歌德公司 Geuder AG", "goods_reg_cert": "", "goods_agent_mfrs_id": None, "brand": "", "short_pinyin": "%s", "kind_sixtyeight_code": None, "unit": "支", "goods_spec": "G-31891", "goods_package": Decimal("1.000000"), "bar_code_mng": 2, "unique_code_strategy": "0", "pur_mode": 60, "sub_pur_mode": None, "erp_code": None, "herp_code": "", "price": Decimal("99.9999"), "abroad_flag": None, "made": "德国", "property": None, "mgr_level": None, "goods_desc": "", "charge_flag": 1, "focus_control_type": None, "temp_flag": 0, "official_status": None, "focus_control": 0, "storage_conditions": "", "transport_conditions": "", "into_cost_flag": None, "rfid_flag": None, "purchase_flag": 1, "tb_status": 0, "version": 1, "create_user": "%s", "create_time": %s, "last_modified_user": "%s", "last_modified": %s, "sterilize_flag": 0, "multi_charge_flag": 0, "use_frequency": 1, "charge_unit": None, "remark": "无 "}' "check_mcms_goods_info_after_approval4": '{"id": "%s", "hos_goods_code": "%s", "hos_id": "%s", "prov_id": "%s", "prov_hos_goods_id": "%s", "srv_id": None, "mdm_goods_code": "%s", "mdm_goods_spec_code": "%s", "spd_goods_code": "%s", "goods_name": "%s", "goods_general_name": "一次性注射器", "goods_mfrs_id": "mfrs-11229", "goods_mfrs_name": "德国歌德公司 Geuder AG", "goods_reg_cert": "", "goods_agent_mfrs_id": None, "brand": "", "short_pinyin": "%s", "kind_sixtyeight_code": None, "unit": "支", "goods_spec": "G-31891", "goods_package": Decimal("1.000000"), "bar_code_mng": 2, "unique_code_strategy": "3", "pur_mode": 10, "sub_pur_mode": None, "erp_code": None, "herp_code": "", "price": Decimal("99.9999"), "abroad_flag": None, "made": "德国", "property": None, "mgr_level": None, "goods_desc": "", "charge_flag": 1, "focus_control_type": None, "temp_flag": 0, "official_status": None, "focus_control": 0, "storage_conditions": "", "transport_conditions": "", "into_cost_flag": None, "rfid_flag": None, "purchase_flag": 1, "tb_status": 0, "version": 1, "create_user": "%s", "create_time": %s, "last_modified_user": "%s", "last_modified": %s, "sterilize_flag": 0, "multi_charge_flag": 0, "use_frequency": 1, "charge_unit": None, "remark": "无 "}' "check_mcms_goods_info_after_approval5": '{"id": "%s", "hos_goods_code": "%s", "hos_id": "%s", "prov_id": "%s", "prov_hos_goods_id": "%s", "srv_id": None, "mdm_goods_code": "%s", "mdm_goods_spec_code": "%s", "spd_goods_code": "%s", "goods_name": "%s", "goods_general_name": "一次性注射器", "goods_mfrs_id": "mfrs-11229", "goods_mfrs_name": "德国歌德公司 Geuder AG", "goods_reg_cert": "", "goods_agent_mfrs_id": None, "brand": "", "short_pinyin": "%s", "kind_sixtyeight_code": None, "unit": "支", "goods_spec": "G-31891", "goods_package": Decimal("1.000000"), "bar_code_mng": 2, "unique_code_strategy": "3", "pur_mode": 10, "sub_pur_mode": None, "erp_code": None, "herp_code": "", "price": Decimal("99.9999"), "abroad_flag": None, "made": "德国", "property": None, "mgr_level": None, "goods_desc": "", "charge_flag": 1, "focus_control_type": None, "temp_flag": 0, "official_status": None, "focus_control": 0, "storage_conditions": "", "transport_conditions": "", "into_cost_flag": None, "rfid_flag": None, "purchase_flag": 1, "tb_status": 0, "version": 1, "create_user": "%s", "create_time": %s, "last_modified_user": "%s", "last_modified": %s, "sterilize_flag": 0, "multi_charge_flag": 0, "use_frequency": 1, "charge_unit": None, "remark": "无 "}' + +#检查供应关系表 +"check_supply_relation": '{"id": "%s", "hos_id": "%s", "prov_id": "%s", "sub_prov_id": "%s", "client_type": "1", "invitation_code": None, "contact_way": "%s", "contact_user": "%s", "tb_status": 20, "active_flag": "1", "auditor": "%s", "audit_time": %s, "audit_comment": None, "version": 1, "create_user": "GYQX-SPD:user-19669", "create_time": %s, "last_modified_user": "h0347:UID-042066", "last_modified": %s}' +"check_supply_relation2": '{"id":"%s","hos_id":"%s","prov_id":"%s","sub_prov_id":"%s","client_type":"2","invitation_code":"","contact_way":"%s","contact_user":"%s","tb_status":20,"active_flag":"1","auditor":"%s","audit_time":%s,"audit_comment":null,"version":1,"create_user":"%s","create_time":%s,"last_modified_user":"%s","last_modified":%s}' \ No newline at end of file