diff --git "a/air_case/a4_mdm3_cm/a3\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267_\345\256\242\346\210\267\347\261\273\345\236\213_\345\214\273\351\231\242_\344\276\233\351\224\200\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244.air/a3\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267_\345\256\242\346\210\267\347\261\273\345\236\213_\345\214\273\351\231\242_\344\276\233\351\224\200\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244.py" "b/air_case/a4_mdm3_cm/a3\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267_\345\256\242\346\210\267\347\261\273\345\236\213_\345\214\273\351\231\242_\344\276\233\351\224\200\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244.air/a3\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267_\345\256\242\346\210\267\347\261\273\345\236\213_\345\214\273\351\231\242_\344\276\233\351\224\200\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244.py" index 6e6e70d6a45c004444fbdda7bddb656f0af30792..fc92113427198cbc625c874e2abe3acdeffa77f6 100644 --- "a/air_case/a4_mdm3_cm/a3\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267_\345\256\242\346\210\267\347\261\273\345\236\213_\345\214\273\351\231\242_\344\276\233\351\224\200\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244.air/a3\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267_\345\256\242\346\210\267\347\261\273\345\236\213_\345\214\273\351\231\242_\344\276\233\351\224\200\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244.py" +++ "b/air_case/a4_mdm3_cm/a3\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267_\345\256\242\346\210\267\347\261\273\345\236\213_\345\214\273\351\231\242_\344\276\233\351\224\200\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244.air/a3\344\276\233\350\264\247\345\205\263\347\263\273\347\224\263\350\257\267_\345\256\242\346\210\267\347\261\273\345\236\213_\345\214\273\351\231\242_\344\276\233\351\224\200\345\205\263\347\263\273\347\224\263\350\257\267\346\217\220\344\272\244.py" @@ -43,15 +43,15 @@ def supply_and_marketing_apply(): contactWay = contactUser request_body = commonFuc().get_business_data(module, "payload", h_corpId, contactUser, contactWay) # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - # #获取接口返回数据 - # - check_dict = commonFuc().get_business_data(module, "checkDict") - commonFuc().check_result(check_dict, result) - e_corpId = corpId - e_username = username - return e_corpId, h_corpId, e_username, h_name + # result = commonFuc().http_post(url, request_body, headers) + # print('result', result) + # # #获取接口返回数据 + # # + # check_dict = commonFuc().get_business_data(module, "checkDict") + # commonFuc().check_result(check_dict, result)z + # e_corpId = corpId + # e_username = username + # return e_corpId, h_corpId, e_username, h_name # supply_and_marketing_apply() diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_a9\346\265\201\347\250\213\345\205\255_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\350\264\237\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a9\346\265\201\347\250\213\345\205\255_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\350\264\237\347\273\223\347\256\227_\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_a9\346\265\201\347\250\213\345\205\255_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\350\264\237\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a9\346\265\201\347\250\213\345\205\255_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\350\264\237\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index 43f041fa224889672d21d7482db91db8765245d5..4b4c022117fcc29a6fbcab607aa5e9fac64b98d9 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_a9\346\265\201\347\250\213\345\205\255_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\350\264\237\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a9\346\265\201\347\250\213\345\205\255_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\350\264\237\347\273\223\347\256\227_\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_a9\346\265\201\347\250\213\345\205\255_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\350\264\237\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a9\346\265\201\347\250\213\345\205\255_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\350\264\237\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -4,6 +4,7 @@ import traceback from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system from air_case.public1.public1.public1 import * +from common.dateUtils import dateUtils from common.fileUtls import FileUtils from common.run_cmd_script import execute_command @@ -17,224 +18,1039 @@ case_tag:api,b6_spd3_core_business_flow_database_check,a_a9流程六_中心库 主数据平台:a_a9流程六_中心库入库结算_负结算 python runner_test.py tag id2303-9 debug mdm3 """ +def check_mcms_out_un_balance(type=1): + print('===检查待结算数据,如果没有数据,说明结算点功能有问题====') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_out_un_balance where branch_id='%s' and from_kind='CK_TH' and hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id, hos_goods_id) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_out_un_balance where branch_id='%s' and from_kind='CK_TH' and hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id, hos_goods_id) + id = get_id(sql) + hos_id = get_hosid() + prov_id = get_prov_id() + sub_prov_id = prov_id + settle_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] + distr_detail_id = get_id("select distr_detail_id from mcms_out_un_balance where id='%s';" % id) + if check_distr_detail_id(distr_detail_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + hos_batch_id = get_id("select hos_batch_id from mcms_out_un_balance where id='%s';" % id) + if check_batch_id(hos_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + # 从文件中获取条码信息 + info = FileUtils().r_info8('b5_spd3_core_business_flow', "条码信息", 'message18') + list_a = info['list_a'] + bar_id = commonFuc().analysis_json('id', list_a) + bar_code = commonFuc().analysis_json('pkgCodeSee', list_a) + from_id = get_id( + "select id from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % (hos_goods_id)) + from_order_no = get_id( + "select order_no from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + hos_goods_id)) + account_date = get_account_date1("select account_date from mcms_out_un_balance where id='%s';" % id) + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = account_user_id + create_time = get_create_time("select create_time from mcms_out_un_balance where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_out_un_balance where id='%s';" % id) + last_modified_user = create_user + goods_code = get_goods_code1(hos_goods_id) + charge_dept_id = settle_dept_id + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_out_un_balance_0918', id, + hos_id, branch_id, prov_id, sub_prov_id, settle_dept_id, distr_detail_id, + hos_batch_id + , bar_id, bar_code, from_id, from_order_no, account_date, account_user_id, + hos_goods_id, goods_code, create_user, create_time, last_modified, + last_modified_user, charge_dept_id + ) + + # 对比预期值和实际值是否一致 + 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_mcms_out_balance(type=1, OBh_ID=""): + print('===检查结算数据======') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_out_balance where branch_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_out_balance where branch_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id) + id = get_id(sql) + if id == OBh_ID: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + + order_no = get_id( + "select order_no from mcms_out_balance where branch_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id)) + hos_id = get_hosid() + prov_id = get_prov_id() + prov_name = get_prov_name() + sub_prov_id = prov_id + settle_dept_id = None + distr_detail_id = get_id("select distr_detail_id from mcms_out_un_balance where id='%s';" % id) + if check_distr_detail_id(distr_detail_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + hos_batch_id = get_id("select hos_batch_id from mcms_out_un_balance where id='%s';" % id) + if check_batch_id(hos_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + # 从文件中获取条码信息 + info = FileUtils().r_info8('b5_spd3_core_business_flow', "条码信息", 'message18') + list_a = info['list_a'] + bar_id = commonFuc().analysis_json('id', list_a) + bar_code = commonFuc().analysis_json('pkgCodeSee', list_a) + from_id = get_id( + "select id from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % (hos_goods_id)) + from_order_no = get_id( + "select order_no from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + hos_goods_id)) + settle_start_time = get_account_date1("select settle_start_time from mcms_out_balance where id='%s';" % id) + settle_end_time = get_account_date1("select settle_end_time from mcms_out_balance where id='%s';" % id) + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = account_user_id + create_time = get_create_time("select create_time from mcms_out_balance where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_out_balance where id='%s';" % id) + last_modified_user = create_user + goods_code = get_goods_code1(hos_goods_id) + charge_dept_id = settle_dept_id + settle_month = get_id("select settle_month from mcms_out_balance where id='%s';" % id) + year, month = dateUtils().get_year_month(dateUtils().get_current_time()) + if month < 10: + month = "0" + str(month) + year_month = str(year) + str(month) + if year_month == settle_month: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_out_balance_0918', id, + order_no, branch_id, hos_id, prov_id, prov_name, settle_month, + settle_start_time, settle_end_time, create_user, create_time, + last_modified, last_modified_user + ) + + # 对比预期值和实际值是否一致 + 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') + + # 检查结算表子表数据 + check_mcms_out_balance_detail(type, id) + check_mcms_out_balance_detail2(type, id) + + +def check_mcms_out_balance_detail(type=1, pid=""): + print('===检查结算数据子表======') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_out_balance_detail where pid='%s' order by id LIMIT 1;;" % ( + pid) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1;" % ( + pid) + id = get_id(sql) + sql = "select id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % ( + pid) + id2 = get_id(sql) + hos_id = get_hosid() + prov_id = get_prov_id() + prov_name = get_prov_name() + sub_prov_id = prov_id + settle_dept_id = None + distr_detail_id = get_id("select distr_detail_id from mcms_out_balance_detail where id='%s';" % id) + if check_distr_detail_id(distr_detail_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + hos_batch_id = get_id("select hos_batch_id from mcms_out_balance_detail where id='%s';" % id) + if check_batch_id(hos_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + # 从文件中获取条码信息 + info = FileUtils().r_info8('b5_spd3_core_business_flow', "条码信息", 'message18') + list_a = info['list_a'] + bar_id = commonFuc().analysis_json('id', list_a) + bar_code = commonFuc().analysis_json('pkgCodeSee', list_a) + from_id = get_id( + "select id from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % (hos_goods_id)) + from_order_no = get_id( + "select order_no from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + hos_goods_id)) + + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = account_user_id + create_time = get_create_time("select create_time from mcms_out_balance_detail where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_out_balance_detail where id='%s';" % id) + last_modified_user = create_user + # goods_code = get_goods_code1(hos_goods_id) + # charge_dept_id = settle_dept_id + # settle_month = get_id("select settle_month from mcms_out_balance where id='%s';" % id) + # year, month = dateUtils().get_year_month(dateUtils().get_current_time()) + + out_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] + out_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + sub_prov_name = prov_name + account_date = get_account_date1("select account_date from mcms_out_balance_detail where id='%s';" % id) + un_settle_id = get_id( + "select id from mcms_out_un_balance where branch_id='%s' and from_kind='CK_TH' and hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id, hos_goods_id)) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_out_balance_detail_0918_1', id, + pid, prov_id, prov_name, sub_prov_id, sub_prov_name, out_dept_id, + out_dept_name, account_date, from_id, from_order_no, hos_goods_id, bar_id, + bar_code, distr_detail_id, hos_batch_id, un_settle_id, create_user, + create_time, last_modified, last_modified_user, hos_id + ) + + # 对比预期值和实际值是否一致 + 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_mcms_out_balance_detail2(type=1, pid=""): + print('===检查结算数据子表======') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_out_balance_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % ( + pid) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + # sql = "select id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1;" % ( + # pid) + # id = get_id(sql) + sql = "select id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % ( + pid) + id = get_id(sql) + hos_id = get_hosid() + prov_id = get_prov_id() + prov_name = get_prov_name() + sub_prov_id = prov_id + settle_dept_id = None + distr_detail_id = get_id("select distr_detail_id from mcms_out_balance_detail where id='%s';" % id) + if check_distr_detail_id(distr_detail_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + hos_batch_id = get_id("select hos_batch_id from mcms_out_balance_detail where id='%s';" % id) + if check_batch_id(hos_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + # 从文件中获取条码信息 + info = FileUtils().r_info8('b5_spd3_core_business_flow', "条码信息", 'message18') + list_a = info['list_a'] + bar_id = get_id("select bar_id from mcms_out_balance_detail where id='%s';" % (id)) + bar_code = get_id("select bar_code from mcms_out_balance_detail where id='%s';" % (id)) + from_id = get_id( + "select from_id from mcms_out_balance_detail where id='%s';" % (id)) + if check_batch_id(from_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + from_order_no = get_id( + "select order_no from mcms_psi_batch where id='%s';" % (from_id)) + + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = account_user_id + create_time = get_create_time("select create_time from mcms_out_balance_detail where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_out_balance_detail where id='%s';" % id) + last_modified_user = create_user + + out_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] + out_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + sub_prov_name = prov_name + account_date = get_account_date1("select account_date from mcms_out_balance_detail where id='%s';" % id) + un_settle_id = get_id( + "select un_settle_id from mcms_out_balance_detail where id='%s';" % id) + if check_un_balance_id(un_settle_id): + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_out_balance_detail_0918_2', id, + pid, prov_id, prov_name, sub_prov_id, sub_prov_name, out_dept_id, + out_dept_name, account_date, from_id, from_order_no, hos_goods_id, bar_id, + bar_code, distr_detail_id, hos_batch_id, un_settle_id, create_user, + create_time, last_modified, last_modified_user, hos_id + ) + + # 对比预期值和实际值是否一致 + 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_mcms_out_balance_approve_after(type=1, OBh_ID=""): + print('===检查结算数据======') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_out_balance where branch_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_out_balance where branch_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id) + id = get_id(sql) + if id == OBh_ID: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + + order_no = get_id( + "select order_no from mcms_out_balance where branch_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id)) + hos_id = get_hosid() + prov_id = get_prov_id() + prov_name = get_prov_name() + sub_prov_id = prov_id + settle_dept_id = None + distr_detail_id = get_id("select distr_detail_id from mcms_out_un_balance where id='%s';" % id) + if check_distr_detail_id(distr_detail_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + hos_batch_id = get_id("select hos_batch_id from mcms_out_un_balance where id='%s';" % id) + if check_batch_id(hos_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + # 从文件中获取条码信息 + info = FileUtils().r_info8('b5_spd3_core_business_flow', "条码信息", 'message18') + list_a = info['list_a'] + bar_id = commonFuc().analysis_json('id', list_a) + bar_code = commonFuc().analysis_json('pkgCodeSee', list_a) + from_id = get_id( + "select id from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % (hos_goods_id)) + from_order_no = get_id( + "select order_no from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + hos_goods_id)) + settle_start_time = get_account_date1("select settle_start_time from mcms_out_balance where id='%s';" % id) + settle_end_time = get_account_date1("select settle_end_time from mcms_out_balance where id='%s';" % id) + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = account_user_id + create_time = get_create_time("select create_time from mcms_out_balance where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_out_balance where id='%s';" % id) + last_modified_user = create_user + goods_code = get_goods_code1(hos_goods_id) + charge_dept_id = settle_dept_id + settle_month = get_id("select settle_month from mcms_out_balance where id='%s';" % id) + year, month = dateUtils().get_year_month(dateUtils().get_current_time()) + if month < 10: + month = "0" + str(month) + year_month = str(year) + str(month) + if year_month == settle_month: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + check_user = create_user + check_time = get_create_time("select check_time from mcms_out_balance where id='%s';" % id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_out_balance_0919', id, + order_no, branch_id, hos_id, prov_id, prov_name, settle_month, + settle_start_time, settle_end_time, create_user, create_time, + last_modified, last_modified_user, check_user, check_time + ) + + # 对比预期值和实际值是否一致 + 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') + + # 检查结算表子表数据 + check_mcms_out_balance_detail_approve_after(type, id) + check_mcms_out_balance_detail_approve_after2(type, id) + + +def check_mcms_out_balance_detail_approve_after(type=1, pid=""): + print('===检查结算数据子表======') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_out_balance_detail where pid='%s' order by id LIMIT 1;;" % ( + pid) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1;" % ( + pid) + id = get_id(sql) + sql = "select id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % ( + pid) + id2 = get_id(sql) + hos_id = get_hosid() + prov_id = get_prov_id() + prov_name = get_prov_name() + sub_prov_id = prov_id + settle_dept_id = None + distr_detail_id = get_id("select distr_detail_id from mcms_out_balance_detail where id='%s';" % id) + if check_distr_detail_id(distr_detail_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + hos_batch_id = get_id("select hos_batch_id from mcms_out_balance_detail where id='%s';" % id) + if check_batch_id(hos_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + # 从文件中获取条码信息 + info = FileUtils().r_info8('b5_spd3_core_business_flow', "条码信息", 'message18') + list_a = info['list_a'] + bar_id = commonFuc().analysis_json('id', list_a) + bar_code = commonFuc().analysis_json('pkgCodeSee', list_a) + from_id = get_id( + "select id from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % (hos_goods_id)) + from_order_no = get_id( + "select order_no from mcms_psi_batch where hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + hos_goods_id)) + + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = account_user_id + create_time = get_create_time("select create_time from mcms_out_balance_detail where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_out_balance_detail where id='%s';" % id) + last_modified_user = create_user + # goods_code = get_goods_code1(hos_goods_id) + # charge_dept_id = settle_dept_id + # settle_month = get_id("select settle_month from mcms_out_balance where id='%s';" % id) + # year, month = dateUtils().get_year_month(dateUtils().get_current_time()) + + out_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] + out_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + sub_prov_name = prov_name + account_date = get_account_date1("select account_date from mcms_out_balance_detail where id='%s';" % id) + un_settle_id = get_id( + "select id from mcms_out_un_balance where branch_id='%s' and from_kind='CK_TH' and hos_goods_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id, hos_goods_id)) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_out_balance_detail_0919_1', id, + pid, prov_id, prov_name, sub_prov_id, sub_prov_name, out_dept_id, + out_dept_name, account_date, from_id, from_order_no, hos_goods_id, bar_id, + bar_code, distr_detail_id, hos_batch_id, un_settle_id, create_user, + create_time, last_modified, last_modified_user, hos_id + ) + + # 对比预期值和实际值是否一致 + 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 test1(): - # 提交采购计划 - execute_command("python runner_test.py tag id2302-5 debug mdm3") - # 外网配送 - execute_command("python runner_test.py tag id2302-6 debug mdm3") - # 内网验收入库结算 - execute_command("python runner_test.py tag id2302-7 debug mdm3") - - -# 中心库退货 -def center_warehouse_return(): - module = "b6_spd3_core_business_flow_database_check" - # # 登录获取用户id等信息,使用创建的用户登录===========开始 - info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3') - username = info['username1'] - password = commonFuc().get_business_data("b2_herp3_bs", "password") - print('username,password', username, password) - # # 获取token和projectCode - token, projectCode, uxid, corpId, info = login(username, password, 2) - # 登录获取用户id等信息,使用创建的用户登录============结束 - # 到库房明细查询,查询产品的udi码 - get_udi(1) - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_pick_submit_url") - print('url', url) - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - commonFuc().get_business_data(module, "X-APP-CODE")) - # 从文件中获取必要信息 - info = FileUtils().r_info8(module, "条码信息", 'message18') - # print('info', info) +def check_mcms_out_balance_detail_approve_after2(type=1, pid=""): + print('===检查结算数据子表======') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_out_balance_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % ( + pid) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + # sql = "select id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1;" % ( + # pid) + # id = get_id(sql) + sql = "select id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % ( + pid) + id = get_id(sql) + hos_id = get_hosid() + prov_id = get_prov_id() + prov_name = get_prov_name() + sub_prov_id = prov_id + settle_dept_id = None + distr_detail_id = get_id("select distr_detail_id from mcms_out_balance_detail where id='%s';" % id) + if check_distr_detail_id(distr_detail_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + hos_batch_id = get_id("select hos_batch_id from mcms_out_balance_detail where id='%s';" % id) + if check_batch_id(hos_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + # 从文件中获取条码信息 + info = FileUtils().r_info8('b5_spd3_core_business_flow', "条码信息", 'message18') list_a = info['list_a'] - print('list_a', list_a[0], type(list_a), len(list_a)) - UTid = 'UT' - areaCode = 'areaCode' - createTime = 'createTime' - hosId = 'hosId' - stockId = 'stockId' - areaCode = 'areaCode' - areaName = 'areaName' - shelfCode = 'shelfCode' - codeType = 'codeType' - tagType = 'tagType' - hosGoodsId = 'hosGoodsId' - mdmGoodsCode = 'mdmGoodsCode' - goodsCode = 'goodsCode' - goodsDi = 'goodsDi' - barName = 'barName' - batchCode = 'batchCode' - expdtDate = 'expdtDate' - productDate = 'productDate' - pkgCode = 'pkgCode' - pkgCodeSee = 'pkgCodeSee' - ssccCode = 'ssccCode' - tbStatus = 'tbStatus' - pkgDefQty = 'pkgDefQty' - purBillId = 'purBillId' - distrBillId = 'distrBillId' - inStockTime = 'inStockTime' - distrDetailId = 'distrDetailId' - purMode = 'purMode' - goodsMfrsName = 'goodsMfrsName' - goodsSpec = 'goodsSpec' - unit = 'unit' - goodsName = 'goodsName' - printNum = 'printNum' - made = 'made' - provId = 'provId' - provName = 'provName' - subProvId = 'subProvId' - subProvName = 'subProvName' - hosGoodsCode = 'hosGoodsCode' - subSendFlag = 'subSendFlag' - onlyKey = 'onlyKey' - pkgDefId = 'pkgDefId' - pkgDefName = 'pkgDefName' - print('aaaaaaaaaaaaaaaaaaaaaaaaa', list_a[0]) - list_b = list_a[0] - for i in list_b: - print(i) - UTid = i['id'] - areaCode = i['areaCode'] - createTime = i['createTime'] - hosId = i['hosId'] - stockId = i['stockId'] - areaCode = i['areaCode'] - areaName = i['areaName'] - shelfCode = i['shelfCode'] - codeType = i['codeType'] - tagType = i['tagType'] - hosGoodsId = i['hosGoodsId'] - mdmGoodsCode = i['mdmGoodsCode'] - goodsCode = i['goodsCode'] - goodsDi = i['goodsDi'] - barName = i['barName'] - batchCode = i['batchCode'] - expdtDate = i['expdtDate'] - productDate = i['productDate'] - pkgCode = i['pkgCode'] - pkgCodeSee = i['pkgCodeSee'] - ssccCode = i['ssccCode'] - tbStatus = i['tbStatus'] - onlyKey = i['hosGoodsId'] - ext = i['ext'] - print('ext', ext) - distrDetailId = ext['distrDetailId'] - distrBillId = ext['distrBillId'] - purBillId = ext['purBillId'] - pkgDefQty = ext['pkgDefQty'] - pkgDefId = ext['pkgDefId'] - pkgDefName = ext['pkgDefName'] - purMode = i['purMode'] - goodsMfrsName = i['goodsMfrsName'] - goodsSpec = i['goodsSpec'] - unit = i['unit'] - goodsName = i['goodsName'] - pkgDefId = i['pkgDefId'] - pkgDefQty = i['pkgDefQty'] - pkgDefName = i['pkgDefName'] - printNum = i['printNum'] - made = i['made'] - provId = i['provId'] - provName = i['provName'] - subProvId = i['subProvId'] - subProvName = i['subProvName'] - hosGoodsCode = i['hosGoodsCode'] - subSendFlag = i['subSendFlag'] - areaName = i['areaName'] - hosId = i['hosId'] - break - deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"] - deptName = FileUtils().r_info8('b2_herp3_bs', '所有科室name', 'message6')["deptid1"] - # # 请求体 - request_body = commonFuc().get_business_data(module, "payload19", areaCode, UTid, createTime, UTid, hosId, stockId, - areaCode, areaName, shelfCode, codeType, tagType, hosGoodsId, - mdmGoodsCode, goodsCode, goodsDi, barName, batchCode, expdtDate, - productDate, pkgCode, pkgCodeSee, ssccCode, tbStatus, distrDetailId, - distrBillId, purBillId, pkgDefQty, pkgDefId, pkgDefName, purMode, - goodsMfrsName, goodsSpec, unit, goodsName, pkgDefId, pkgDefQty, - pkgDefName, printNum, made, provId, provName, subProvId, subProvName, - hosGoodsCode, subSendFlag, onlyKey, areaName, hosId, get_branch_id(), - deptid1, deptName, stockId) - print('request_body', 'ccccccc', request_body) - - # # # # 发送请求 - result = commonFuc().http_post(url, request_body, headers) + bar_id = get_id("select bar_id from mcms_out_balance_detail where id='%s';" % (id)) + bar_code = get_id("select bar_code from mcms_out_balance_detail where id='%s';" % (id)) + from_id = get_id( + "select from_id from mcms_out_balance_detail where id='%s';" % (id)) + if check_batch_id(from_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + from_order_no = get_id( + "select order_no from mcms_psi_batch where id='%s';" % (from_id)) + + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = account_user_id + create_time = get_create_time("select create_time from mcms_out_balance_detail where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_out_balance_detail where id='%s';" % id) + last_modified_user = create_user + + out_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] + out_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + sub_prov_name = prov_name + account_date = get_account_date1("select account_date from mcms_out_balance_detail where id='%s';" % id) + un_settle_id = get_id( + "select un_settle_id from mcms_out_balance_detail where id='%s';" % id) + if check_un_balance_id(un_settle_id): + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_out_balance_detail_0919_2', id, + pid, prov_id, prov_name, sub_prov_id, sub_prov_name, out_dept_id, + out_dept_name, account_date, from_id, from_order_no, hos_goods_id, bar_id, + bar_code, distr_detail_id, hos_batch_id, un_settle_id, create_user, + create_time, last_modified, last_modified_user, hos_id + ) + + # 对比预期值和实际值是否一致 + 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_mcms_invoice(): + print('检查发票数据') + prov_id = get_prov_id() + # if type == 1: + # hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + # elif type == 2: + # hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + # else: + # hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + + sql = "select * from mcms_invoice where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + prov_id) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_invoice where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + prov_id) + id = get_id(sql) + hos_id = get_hosid() + prov_name = get_prov_name() + + create_user = get_login_user_uxid_bydb( + FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username']) + # create_user = account_user_id + create_time = get_create_time("select create_time from mcms_invoice where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_invoice where id='%s';" % id) + last_modified_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + + year, month = dateUtils().get_year_month(dateUtils().get_current_time()) + if month < 10: + month = "0" + str(month) + year_month = str(year) + str(month) + settle_months = year_month + invoice_date = get_account_date1("select invoice_date from mcms_invoice where id='%s';" % id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_invoice_0924', id, + hos_id, prov_id, prov_name, invoice_date, settle_months, create_user, + create_time, last_modified, last_modified_user + ) + + # 对比预期值和实际值是否一致z + 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') + # 检查发票子表数据 + check_mcms_invoice_detail(1, id) + # check_mcms_invoice_detail2(1, id) + + +def check_mcms_invoice_detail(type=1, pid=""): + print('检查发票子表数据') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_invoice_detail where pid='%s' order by id LIMIT 1;" % ( + pid) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_invoice_detail where pid='%s' order by id LIMIT 1;" % ( + pid) + id = get_id(sql) + hos_id = get_hosid() + prov_id = get_prov_id() + prov_name = get_prov_name() + sub_prov_id = prov_id + settle_dept_id = None + distr_detail_id = get_id("select distr_detail_id from mcms_out_balance_detail where id='%s';" % id) + if check_distr_detail_id(distr_detail_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + hos_batch_id = get_id("select hos_batch_id from mcms_out_balance_detail where id='%s';" % id) + if check_batch_id(hos_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = get_login_user_uxid_bydb( + FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username']) + create_time = get_create_time("select create_time from mcms_invoice_detail where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_invoice_detail where id='%s';" % id) + last_modified_user = create_user + + year, month = dateUtils().get_year_month(dateUtils().get_current_time()) + if month < 10: + month = "0" + str(month) + settle_month = str(year) + str(month) + hobd_id = get_id("select id from mcms_out_balance_detail where prov_id='%s' order by id desc LIMIT 1 OFFSET 1;" % ( + prov_id)) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_invoice_detail_0919_1', id, + pid, hobd_id, branch_id, hos_goods_id, settle_month, create_user, + create_time, last_modified, last_modified_user, hos_id + ) + + # 对比预期值和实际值是否一致 + 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) - PICK_ID = commonFuc().analysis_json('data', result) - # =====================出库复核列表查询获取pickid=============== - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_pick_return_page_url") - print('url', url) - request_body = commonFuc().get_business_data(module, "payload20", get_branch_id(), get_hosid(), deptid1) - # # # # 发送请求 - result = commonFuc().http_post(url, request_body, headers) + 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_mcms_invoice_detail2(type=1, pid=""): + print('检查发票子表数据') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_invoice_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % ( + pid) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_invoice_detail where pid='%s' order by id LIMIT 1 OFFSET 1;" % ( + pid) + id = get_id(sql) + hos_id = get_hosid() + prov_id = get_prov_id() + prov_name = get_prov_name() + sub_prov_id = prov_id + settle_dept_id = None + distr_detail_id = get_id("select distr_detail_id from mcms_out_balance_detail where id='%s';" % id) + if check_distr_detail_id(distr_detail_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + hos_batch_id = get_id("select hos_batch_id from mcms_out_balance_detail where id='%s';" % id) + if check_batch_id(hos_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('success', 'success') + else: + commonFuc().check_text_exist_result_text('error', 'success') + + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = get_login_user_uxid_bydb( + FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username']) + create_time = get_create_time("select create_time from mcms_invoice_detail where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_invoice_detail where id='%s';" % id) + last_modified_user = create_user + + year, month = dateUtils().get_year_month(dateUtils().get_current_time()) + if month < 10: + month = "0" + str(month) + settle_month = str(year) + str(month) + hobd_id = get_id("select id from mcms_out_balance_detail where prov_id='%s' order by id desc LIMIT 1;" % ( + prov_id)) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_invoice_detail_0919_2', id, + pid, hobd_id, branch_id, hos_goods_id, settle_month, create_user, + create_time, last_modified, last_modified_user, hos_id + ) + + # 对比预期值和实际值是否一致 + 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_mcms_invoice_ext(): + print('检查付款单数据') + prov_id = get_prov_id() + # if type == 1: + # hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + # elif type == 2: + # hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + # else: + # hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + + sql = "select * from mcms_invoice_ext where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + prov_id) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_invoice_ext where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + prov_id) + id = get_id(sql) + hos_id = get_hosid() + prov_name = get_prov_name() + + create_user = get_login_user_uxid_bydb( + FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username']) + # create_user = account_user_id + create_time = get_create_time("select create_time from mcms_invoice_ext where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_invoice_ext where id='%s';" % id) + last_modified_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = last_modified_user + year, month = dateUtils().get_year_month(dateUtils().get_current_time()) + if month < 10: + month = "0" + str(month) + year_month = str(year) + str(month) + settle_months = year_month + pay_date = get_account_date1("select pay_date from mcms_invoice_ext where id='%s';" % id) + pay_user = create_user + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_invoice_ext_0924', id, + hos_id, prov_id, prov_name, pay_date, create_user, + create_time, last_modified, last_modified_user, pay_user + ) + + # 对比预期值和实际值是否一致 + 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') + # 检查子表数据 + check_mcms_invoice_ext_detail(1, id) + + +def check_mcms_invoice_ext_detail(type=1, pid=""): + print('检查付款单子表数据') + if type == 1: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 2: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] + else: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] + branch_id = get_branch_id() + sql = "select * from mcms_invoice_ext_detail where pid='%s';" % ( + pid) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_invoice_ext_detail where pid='%s';" % ( + pid) + id = get_id(sql) + hos_id = get_hosid() + prov_id = get_prov_id() + + account_user_id = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_user = account_user_id + create_time = get_create_time("select create_time from mcms_invoice_ext_detail where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_invoice_ext_detail where id='%s';" % id) + last_modified_user = create_user + + invoice_id = get_id("select id from mcms_invoice where prov_id='%s' order by CREATE_TIME desc LIMIT 1;" % ( + prov_id)) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_invoice_ext_detail_0919_1', id, + pid, invoice_id, create_user, create_time, last_modified, + last_modified_user, hos_id + ) + + # 对比预期值和实际值是否一致 + 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') + - # =====================出库复核列表查询获取pickid=============== - # =======================查看出库单详细信息=============== - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_pick_checkReview_url") - url = url + ' '.join(PICK_ID) + '?pickedFlag=true' - print('url', url) - # # # # 发送请求 - result = commonFuc().http_get(url, headers) - print('查看出库单详细信息result', result) - # =======================查看出库单详细信息=============== - # ========================扫码复核 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, - "herpService_stock_hdiBarcode_scan_url") - url = url + pkgCode - print('url', url) - # # # # 发送请求 - result = commonFuc().http_get(url, headers) - print('扫码复核result', result) - data = commonFuc().analysis_json('data', result) - UT_id = commonFuc().analysis_json('id', data) - createTime = commonFuc().analysis_json('createTime', data) - snCode = commonFuc().analysis_json('snCode', data) - tbStatus=commonFuc().analysis_json('tbStatus', data) - print(UT_id) - # ========================扫码复核 - # ========出库复核提交========== - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, - "herpService_stock_review_pass_submit_url") - - print('url', url) - sourceId = ' '.join(PICK_ID) - # 请求体 - request_body = commonFuc().get_business_data(module, "payload21", UT_id, createTime, snCode, hosId, stockId, - areaCode, areaName, shelfCode, codeType, tagType, hosGoodsId, - mdmGoodsCode, goodsCode, goodsDi, barName, batchCode, expdtDate, - productDate, pkgCode, pkgCodeSee, ssccCode, tbStatus, distrDetailId, - distrBillId, purBillId, pkgDefQty, pkgDefId, pkgDefName, purMode, - goodsMfrsName, goodsSpec, unit, goodsName, pkgDefId, pkgDefQty, - pkgDefName, made, hosGoodsCode, sourceId) - print('request_body', request_body) - # # # # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('herpService_stock_review_pass_submit_urlresult', result) - # ========出库复核提交 +pro_path = commonFuc().get_pro_path2() +print('pro_path', pro_path) +sys.path.append(pro_path + r'/air_case/b5_spd3_core_business_flow/a_a9流程六_中心库入库结算_负结算.air') +using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_a9流程六_中心库入库结算_负结算.air') +from a_a9流程六_中心库入库结算_负结算 import center_warehouse_return try: - # test1() # 提交采购计划 # 外网配送 # 内网验收入库结算 - # 先查询所有的部门信息写入文件 - dept_query_all() - # 设置库房人员,根据传入的科室id和科室名称来设置库房 - # 中心库type=1 二级type=2三级type=3 - set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'],2) - set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3'],3) - updateUserLoginDefaultRange(get_listUserMgrRangePage(1)) #设置登录账号默认权限是中心库 - center_warehouse_return()#中心库退货 + # updateUserLoginDefaultRange(get_listUserMgrRangePage(1)) # 设置登录账号默认权限是1级库 + # # test1() # 提交采购计划 # 外网配送 # 内网验收入库结算 + # # 先查询所有的部门信息写入文件 + # dept_query_all() + # # 设置库房人员,根据传入的科室id和科室名称来设置库房 + # # 中心库type=1 二级type=2三级type=3 + # set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'],2) + # set_dept_user(FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'],FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid3'],3) + # # updateUserLoginDefaultRange(get_listUserMgrRangePage(1)) #设置登录账号默认权限是中心库 # center_warehouse_return()#中心库退货 - OBh_ID=settle() # 生成结算单 + # # center_warehouse_return()#中心库退货 + # OBh_ID=settle() # 生成结算单 # print(OBh_ID) - # 调用审批结算单 - approval_center(OBh_ID) - invoice(2,OBh_ID)#type=2 传递结算单号,外网查询开票 + # time.sleep(6) + # check_mcms_out_balance(1, OBh_ID) # 结算审批前的结算数据 + # # 调用审批结算单 + # approval_center(OBh_ID) + # time.sleep(6) + # check_mcms_out_balance_approve_after(1, OBh_ID) # 结算审批后的结算数据 + # time.sleep(3) + # invoice(2,OBh_ID)#type=2 传递结算单号,外网查询开票 + # time.sleep(3) + # 检查最终的发票数据,过程数据在流程五中检查 + check_mcms_invoice() + time.sleep(3) + # 检查付款单数据 + check_mcms_invoice_ext() commonFuc().check_text_exist_result_text('succees', 'succees') -except: - commonFuc().check_text_exist_result_text('error', '1') +except Exception as e: + # 打印错误信息 + print(f"发生错误: {e}") + commonFuc().check_text_exist_result_text('error', 'succees') \ No newline at end of file diff --git a/data/b6_spd3_core_business_flow_database_check/data b/data/b6_spd3_core_business_flow_database_check/data index 1c819e849c21ff034d1fe9119af4607646355bc0..f3dca4e7e567457ce26867c093eeb9b766855017 100644 --- a/data/b6_spd3_core_business_flow_database_check/data +++ b/data/b6_spd3_core_business_flow_database_check/data @@ -394,3 +394,8 @@ #中心库入库结算_正负结算_付款单子表 "check_mcms_invoice_ext_detail_0919_1": '{"id": "%s", "pid": "%s", "invoice_id": "%s", "remark": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "hos_id": "%s"}' + +#中心库入库结算_负结算_开票数据主表 +"check_mcms_invoice_0924": '{"id": "%s", "hos_id": "%s", "branch_id": None, "invoice_code": "1", "invoice_number": "test", "invoice_num": 1, "prov_id": "%s", "prov_name": "%s", "invoice_amount": Decimal("-9999.990000"), "tb_status": 50, "invoice_date": %s, "settle_months": "%s", "tax_amount": None, "payment_bill_id": None, "yxpt_order_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 6, "invoice_qty": Decimal("-100.0000"), "remarks": "", "invoice_tag": None, "ext_info": None}' +#中心库入库结算_负结算_付款单主表 +"check_mcms_invoice_ext_0924": '{"id": "%s", "hos_id": "%s", "prov_id": "%s", "prov_name": "%s", "payment_status": 20, "pay_channel": "YGPT", "pay_amount": Decimal("-9999.9900"), "remain_pay_amount": Decimal("0.0000"), "remark": None, "pay_date": %s, "pay_count": 1, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "pay_user": "%s"}' diff --git a/main1/main_text.py b/main1/main_text.py index a1cb00de5245e202c0bf4ad3d9db688b99228e3a..202e3e7c5a31c784c4bdfba362df783c448d6c5f 100644 --- a/main1/main_text.py +++ b/main1/main_text.py @@ -229,7 +229,7 @@ def main_text(): print('Cancel') def flow5_flow18(): - date1= timeUtils().get_time_hms(1) + date1= timeUtils().get_time_hms(5) sys.stdout = Logger(date1+"output.txt") sys.stderr = Logger(date1+"error.txt")