diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256_\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_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index a5102e65f87722aab49d552e86ad8787846e3f7f..e2ed0efeb52bb2fd56c95303acb86cc75a841e83 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256_\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_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -21,7 +21,7 @@ import time module = "b6_spd3_core_business_flow_database_check" -def check_test1_info(): +def check_basics_set_info(): print('检查院区数据,科室数据,库房库区数据') # 获取实际值 # 要验证的数据sql @@ -66,16 +66,15 @@ def check_test1_info(): commonFuc().check_text_exist_result_text('error', 'succees') # 验证科室数据 # 要验证的数据sql - for i in range(4): sql1 = "select * from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET %s;" % ( - branch_id, i) + branch_id, i) actual = check_mcms_pur_sql(sql1) print('actual', actual) id = get_id( "select id from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET %s;" % (branch_id, i)) pid = get_id("select pid from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET %s;" % ( - branch_id, i)) + branch_id, i)) code = get_id("select code from sys_org where branch_id='%s' and id='%s';" % (branch_id, id)) corp_id = get_hosid() last_update_datetime = get_create_time("select last_update_datetime from sys_org where id='%s';" % id) @@ -116,32 +115,135 @@ def check_test1_info(): # 要验证的数据sql for i in range(3): sql1 = "select * from mcms_stock_info where branch_id='%s' order by stock_level desc LIMIT 1 OFFSET %s;" % ( - branch_id, i) + branch_id, i) actual = check_mcms_pur_sql(sql1) print('actual', actual) id = get_id( "select id from mcms_stock_info where branch_id='%s' order by stock_level desc LIMIT 1 OFFSET %s;" % ( - branch_id, i)) + branch_id, i)) hos_id = get_hosid() pid = get_id( "select pid from mcms_stock_info where branch_id='%s' order by stock_level desc LIMIT 1 OFFSET %s;" % ( - branch_id, i)) + branch_id, i)) stock_code = get_id( "select stock_code from mcms_stock_info where branch_id='%s' and id='%s';" % (branch_id, id)) corp_id = get_hosid() create_time = get_create_time("select create_time from mcms_stock_info where id='%s';" % id) last_modified = get_create_time("select last_modified from mcms_stock_info where id='%s';" % id) - if i==0: - dept_id=get_id("select id from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET 1;"%branch_id) - elif i==1: - dept_id=get_id("select id from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET 2;"%branch_id) + if i == 0: + dept_id = get_id( + "select id from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET 1;" % branch_id) + elif i == 1: + dept_id = get_id( + "select id from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET 2;" % branch_id) else: - dept_id=get_id("select id from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET 3;"%branch_id) + dept_id = get_id( + "select id from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET 3;" % branch_id) + if i==2: + stock_name=get_branch_name() + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_stock_info' + str(i), id, hos_id, pid, branch_id, + stock_code, stock_name,dept_id, create_user, create_time, last_modified, + last_modified_user + ) + else: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_stock_info' + str(i), id, hos_id, pid, branch_id, + stock_code, dept_id, 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') + #检查新增的用户信息 + # 要验证的数据sql + sql1 = "select * from sys_user order by create_time desc LIMIT 1 OFFSET 0;" + actual = check_mcms_pur_sql(sql1) + print('actual', actual) + id = get_id( + "select id from sys_user order by create_time desc LIMIT 1 OFFSET 0;") + hos_id = get_hosid() + user_code = get_id( + "select user_code from sys_user where id='%s';"%id) + + create_time = get_create_time("select create_time from sys_user where id='%s';" % id) + last_modified = get_create_time("select last_modified from sys_user where id='%s';" % id) + last_update_datetime = get_create_time("select last_update_datetime from sys_user where id='%s';" % id) + corp_id=get_hosid() + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_sys_user', id, user_code, last_update_datetime, create_time, + create_user, last_modified, last_modified_user,corp_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_dept_goods_info(): + print('检查科室添加产品信息') + hos_id=get_hosid() + hos_name=get_hosname() + dept_id=FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'] + dept_name=FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'] + # 要验证的数据sql + for i in range(5): + sql1 = "select * from mcms_dept_goods_info order by create_time desc LIMIT 1 OFFSET %s;" % ( + i) + actual = check_mcms_pur_sql(sql1) + print('actual', actual) + id = get_id( + "select id from mcms_dept_goods_info order by create_time desc LIMIT 1 OFFSET %s;" % ( + i)) + hos_goods_id = get_id( + "select hos_goods_id from mcms_dept_goods_info where id='%s';" % ( + id)) + if check_hos_goods_id(hos_goods_id)==True: + commonFuc().check_text_exist_result_text('succees', 'succees') + else: + commonFuc().check_text_exist_result_text('error', 'succees') + pid = get_id( + "select pid from mcms_stock_info order by create_time desc LIMIT 1 OFFSET %s;" % ( + i)) + + stock_code = get_id( + "select stock_code from mcms_stock_info where id='%s';" % (id)) + corp_id = get_hosid() + create_time = get_create_time("select create_time from mcms_stock_info where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_stock_info where id='%s';" % id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', - 'check_mcms_stock_info' + str(i), id, hos_id, pid, branch_id, - stock_code, dept_id,create_user, create_time, last_modified, last_modified_user + 'check_mcms_stock_info' + str(i), id, hos_id, pid ) actual_value1 = get_process_list2(actual) @@ -162,6 +264,15 @@ def check_test1_info(): print('error') commonFuc().check_text_exist_result_text('error', 'succees') +def check_hos_goods_id(hos_goods_id): + print('检查产品信息') + for i in range(1, 6): + info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息", 'message%s' % i) + hosGoodsId = info['hosGoodsId'] + if hos_goods_id==hosGoodsId: + return True + return False + pro_path = commonFuc().get_pro_path2() print('pro_path', pro_path) @@ -172,11 +283,15 @@ from a_a4_流程四_基础模块设置 import test1, test2, grants_user, add_Sto try: # ==============删除业务数据和报表数据 - # test1()#参数2是新增院区后缀为6位数的参数1是老模式 - # 检查院区数据,科室数据,库房库区数据 - check_test1_info() - test2() # 科室添加产品信息(产品是从外网同步过来的) - dept_query_all() # 科室查询,将科室id写入文件中 + # test1() # 参数2是新增院区后缀为6位数的参数1是老模式 + # test2() # 科室添加产品信息(产品是从外网同步过来的) + # dept_query_all() # 科室查询,将科室id写入文件中 + # time.sleep(6) + # 检查院区数据,科室数据,库房,新增用户数据 + check_basics_set_info() + time.sleep(3) + #检查mcms_dept_goods_info表数据,验证科室添加的产品信息 + check_mcms_dept_goods_info() grants_user() # 给用户授权 set_dept_lead1() # 设置一级科室负责人 add_StockArea() # 添加库区 diff --git a/common/db/sql/sql_del_branch_info.py b/common/db/sql/sql_del_branch_info.py index b27538444268bea77692227b34c7576dab0830e4..dcdf956db00c340e09b7bba3873354921667ebed 100644 --- a/common/db/sql/sql_del_branch_info.py +++ b/common/db/sql/sql_del_branch_info.py @@ -477,16 +477,16 @@ class delData(object): hosGoodsId1 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId'] hosGoodsId2 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'] hosGoodsId3 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'] - # 条码 - # sql1 = "delete from mcms_pkg where branch_id='%s';" % branch_id - # sql2 = "delete from mcms_pkg_batch where hos_goods_id in('%s','%s','%s');" % ( - # hosGoodsId1, hosGoodsId2, hosGoodsId3) - # sql3 = "delete from hdi_barcode where branch_id='%s';" % branch_id - # sql4 = "delete from cabinet_epc_info where branch_id=%s" % branch_id - # cursor.execute(sql1) - # cursor.execute(sql2) - # cursor.execute(sql3) - # cursor.execute("commit;") + # 包库存 + sql1 = "delete from mcms_pkg where branch_id='%s';" % branch_id + sql2 = "delete from mcms_pkg_batch where hos_goods_id in('%s','%s','%s');" % ( + hosGoodsId1, hosGoodsId2, hosGoodsId3) + sql3 = "delete from hdi_barcode where branch_id='%s';" % branch_id + sql4 = "delete from cabinet_epc_info where branch_id=%s" % branch_id + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute("commit;") # 批次 sql = "delete from mcms_hos_batch where branch_id='%s';" % branch_id cursor.execute(sql) diff --git a/data/b6_spd3_core_business_flow_database_check/data b/data/b6_spd3_core_business_flow_database_check/data index 13587d08d0afa62e08d5046fc697be64a026406b..c27ca301ec5ba5879dfe2c22ad9240693aa3fae5 100644 --- a/data/b6_spd3_core_business_flow_database_check/data +++ b/data/b6_spd3_core_business_flow_database_check/data @@ -487,4 +487,7 @@ #库房数据 "check_mcms_stock_info0": '{"id": "%s", "hos_id": "%s", "pid": "%s", "branch_id": "%s", "stock_code": "%s", "stock_name": "三级检测组003库房", "stock_fzr": None, "stock_phone": "12401003250", "dept_id": "%s", "stock_level": "3", "short_pinyin": "sjjcz003", "address": "三级检测组003", "mgr_type": 1, "remark": None, "version": 1, "lock_flag": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "del_flag": 0, "ordinal": 99999999}' "check_mcms_stock_info1": '{"id": "%s", "hos_id": "%s", "pid": "%s", "branch_id": "%s", "stock_code": "%s", "stock_name": "二级检验科002库房", "stock_fzr": None, "stock_phone": "13401003250", "dept_id": "%s", "stock_level": "2", "short_pinyin": "ejjyk002", "address": "二级检验科002", "mgr_type": 1, "remark": None, "version": 1, "lock_flag": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "del_flag": 0, "ordinal": 99999999}' -"check_mcms_stock_info2": '{"id": "%s", "hos_id": "%s", "pid": "%s", "branch_id": "%s", "stock_code": "%s", "stock_name": "东土城路院区wSIoT中心库房", "stock_fzr": None, "stock_phone": "13401003250", "dept_id": "%s", "stock_level": "1", "short_pinyin": "sbk001", "address": "设备科001", "mgr_type": 1, "remark": None, "version": 0, "lock_flag": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "del_flag": 0, "ordinal": 99999999}' +"check_mcms_stock_info2": '{"id": "%s", "hos_id": "%s", "pid": "%s", "branch_id": "%s", "stock_code": "%s", "stock_name": "%s中心库房", "stock_fzr": None, "stock_phone": "13401003250", "dept_id": "%s", "stock_level": "1", "short_pinyin": "sbk001", "address": "设备科001", "mgr_type": 1, "remark": None, "version": 0, "lock_flag": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "del_flag": 0, "ordinal": 99999999}' + +#新增用户数据检查 +"check_sys_user": '{"id": "%s", "user_code": "%s", "kind": 0, "enable_flag": 1, "create_datetime": None, "create_user_id": None, "last_update_datetime": %s, "version": 0, "create_time": %s, "create_user": "%s", "last_modified": %s, "last_modified_user": "%s", "corp_id": "%s"}' \ No newline at end of file