diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_a1_\346\265\201\347\250\213\344\270\200\345\244\226\347\275\221\344\274\201\344\270\232\346\263\250\345\206\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a1_\346\265\201\347\250\213\344\270\200\345\244\226\347\275\221\344\274\201\344\270\232\346\263\250\345\206\214\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_a1_\346\265\201\347\250\213\344\270\200\345\244\226\347\275\221\344\274\201\344\270\232\346\263\250\345\206\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a1_\346\265\201\347\250\213\344\270\200\345\244\226\347\275\221\344\274\201\344\270\232\346\263\250\345\206\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index f7279dd3c9242fc7f2bfb2c431dea5754cba076c..aba1ce4d9ef7841eb606d66766582cbb1697fd6c 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_a1_\346\265\201\347\250\213\344\270\200\345\244\226\347\275\221\344\274\201\344\270\232\346\263\250\345\206\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a1_\346\265\201\347\250\213\344\270\200\345\244\226\347\275\221\344\274\201\344\270\232\346\263\250\345\206\214\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_a1_\346\265\201\347\250\213\344\270\200\345\244\226\347\275\221\344\274\201\344\270\232\346\263\250\345\206\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a1_\346\265\201\347\250\213\344\270\200\345\244\226\347\275\221\344\274\201\344\270\232\346\263\250\345\206\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -17,14 +17,12 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_ from airtest.core.api import using import sys +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_a1_流程一外网企业注册审批.air') +using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_a1_流程一外网企业注册审批.air') +from a_a1_流程一外网企业注册审批 import test1 -def test1(): - #企业注册 - execute_command("python runner_test.py tag id2232 debug mdm3") - #企业审核 - execute_command("python runner_test.py tag id2248 debug mdm3") - #医院注册审核 - execute_command("python runner_test.py tag id2249 debug mdm3") try: test1() commonFuc().check_text_exist_result_text('succees','succees') 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 3a47a0b26e2db5201495167d2021a21255250aba..3d247f3435d1b8695abb9ebf9ed9ded41b743a10 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" @@ -13,167 +13,27 @@ from common.common_func import commonFuc from air_case.mdm_login.登录外网系统.登录外网系统 import login_system from airtest.core.api import using import sys -module = "b6_spd3_core_business_flow_database_check" -def h_login(): - #供货关系申请_客户类型_医院_登录_医院登录获取医院id - module = "a4_mdm3_cm" - #如果需要h0347医院账号登录,这里就从data文件获取登录医院的用户名 - #username = commonFuc().get_business_data(module, "username") +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_a2_流程二供货关系申请提交审批.air') +using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_a2_流程二供货关系申请提交审批.air') +from a_a2_流程二供货关系申请提交审批 import h_login, e_login, supply_and_marketing_apply, submitSupplyRelation_pass, \ + supply_and_marketing_apply2 - - username = commonFuc().get_business_data(module, "username") - password = commonFuc().get_business_data(module, "password1") - print('医院名称', username) - print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # 获取token和projectCode - import time - while True: - try: - token,projectCode,uxid,corpId,info= login_system(username, password).get_token() - except: - time.sleep(6) - continue - else: - return token,projectCode,uxid,corpId,username -def e_login(type=1): - module = "a4_mdm3_cm" - username='username' - if type==1:#注册一个新企业,并审批 - pro_path=commonFuc().get_pro_path() - sys.path.append(pro_path+r'\\air_case\\a2_mdm3_ea\\企业审核.air') - using(pro_path+r'\\air_case\\a2_mdm3_ea\\企业审核.air') - from 企业审核 import test1 - - info = FileUtils().r_info("a2_mdm3_ea", "企业信息") - print(info) - username = info['cname'] - print('aaaaaaaaaaaaaaaaaaaaaaaaaaa',username) - else:#读取文件中存入的企业信息 - info = FileUtils().r_info("a2_mdm3_ea", "企业信息") - print(info) - username = info['cname'] - print('aaaaaaaaaaaaaaaaaaaaaaaaaaa', username) - #a2供货关系申请_客户类型_医院_登录_企业登录 - # print('医院名称',username) - password = commonFuc().get_business_data(module, "password") - print(username, password) - # 获取token和projectCode - import time - i=1 - while True: - if i==1000: - print('6000秒过去了,新注册的企业还未登录,检查同步是否正常') - break - try: - token,projectCode,uxid,corpId,info= login_system(username, password).get_token() - except: - print('新注册的企业登录失败,等待6秒') - time.sleep(6) - i=i+1 - continue - else: - return token, projectCode, uxid, corpId, username - # break -def supply_and_marketing_apply(): - - token, projectCode, uxid, corpId, username = e_login() - # 获取医院corpId - h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login() - - module = "a4_mdm3_cm" - # a3供货关系申请_客户类型_医院_供销关系申请提交 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitSupplyRelation_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - contactUser = commonFuc().randomString(5) - 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 - -def submitSupplyRelation_pass(): - module = "a4_mdm3_cm" - token, projectCode, uxid, corpId, h_name = h_login() - print(token, projectCode, uxid, corpId, h_name) - pro_path = commonFuc().get_pro_path() - #查询待审核数据========================================= - # a11供货关系审核_驳回_客户类型_医院_供销关系审核_查询待审核数据1 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - - request_body = commonFuc().get_business_data(module, "payload6", corpId) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - id1 = commonFuc().analysis_json('id', commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))) - print('id1', id1) - # 查询待审核数据====================================== - #b15供货关系审核_通过_客户类型_医院 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "auditSupplyRelation_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - contactUser=commonFuc().randomString(5) - contactWay=contactUser - request_body = commonFuc().get_business_data(module, "payload7_2", id1,contactUser,contactWay) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - #断言 - checkDict=commonFuc().get_business_data(module,'checkDict') - commonFuc().check_result(checkDict,result) -def supply_and_marketing_apply2(): - pro_path=commonFuc().get_pro_path() - - token,projectCode,uxid,corpId,username=e_login(2) - #获取医院corpId - - h_token,h_projectCode,h_uxid,h_corpId,h_name=h_login() - - module = "a4_mdm3_cm" - #a3供货关系申请_客户类型_医院_供销关系申请提交 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitSupplyRelation_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - contactUser=commonFuc().randomString(5) - contactWay=contactUser - request_body = commonFuc().get_business_data(module, "payload_2",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 try: - h_login()#医院登录 - e_login(1)#企业登录 - #供应关系申请-客户类型医院 + module = "b5_spd3_core_business_flow" + h_login() # 医院登录 + e_login(1) # 企业登录 + # 供应关系申请-客户类型医院 FileUtils().w_info1(supply_and_marketing_apply(), module, '供货关系申请') submitSupplyRelation_pass() - #供应关系申请-客户类型厂商 + # 供应关系申请-客户类型厂商 FileUtils().w_info1(supply_and_marketing_apply2(), module, '供货关系申请2') submitSupplyRelation_pass() - commonFuc().check_text_exist_result_text('succees','succees') -except: - print('a_a2_流程二供货关系申请提交审批,出现异常,请检查') \ No newline at end of file + commonFuc().check_text_exist_result_text('succees', 'succees') + print('=================流程二结束=================') +except Exception as e: + # 打印错误信息 + print(f"发生错误: {e}") + print('a_a2_流程二供货关系申请提交审批,出现异常,请检查') diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_a3_\346\265\201\347\250\213\344\270\211_\344\272\247\345\223\201\345\257\274\345\205\245\345\222\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a3_\346\265\201\347\250\213\344\270\211_\344\272\247\345\223\201\345\257\274\345\205\245\345\222\214\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_a3_\346\265\201\347\250\213\344\270\211_\344\272\247\345\223\201\345\257\274\345\205\245\345\222\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a3_\346\265\201\347\250\213\344\270\211_\344\272\247\345\223\201\345\257\274\345\205\245\345\222\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index 3db97c18f44478cdff80a84a8b2f49d942ee4112..076c326e9b9cda22d9b04720a9e549db20a75dc1 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_a3_\346\265\201\347\250\213\344\270\211_\344\272\247\345\223\201\345\257\274\345\205\245\345\222\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a3_\346\265\201\347\250\213\344\270\211_\344\272\247\345\223\201\345\257\274\345\205\245\345\222\214\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_a3_\346\265\201\347\250\213\344\270\211_\344\272\247\345\223\201\345\257\274\345\205\245\345\222\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a3_\346\265\201\347\250\213\344\270\211_\344\272\247\345\223\201\345\257\274\345\205\245\345\222\214\345\256\241\346\211\271_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -16,381 +16,33 @@ from air_case.mdm_login.登录外网系统.登录外网系统 import login_syste from airtest.core.api import using import sys -module = "b6_spd3_core_business_flow_database_check" - - -def h_login(): - module = "a4_mdm3_cm" - username = commonFuc().get_business_data(module, "username") - password = commonFuc().get_business_data(module, "password1") - print('医院名称', username) - print(username, password, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # 获取token和projectCode - import time - while True: - try: - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - except: - time.sleep(6) - continue - else: - return token, projectCode, uxid, corpId, username - - -def e_login(type=1): - module = "a4_mdm3_cm" - username = 'username' - if type == 1: # 注册一个新企业,并审批 - pro_path = commonFuc().get_pro_path() - sys.path.append(pro_path + r'\\air_case\\a2_mdm3_ea\\企业审核.air') - using(pro_path + r'\\air_case\\a2_mdm3_ea\\企业审核.air') - from 企业审核 import test1 - - info = FileUtils().r_info("a2_mdm3_ea", "企业信息") - print(info) - username = info['cname'] - print('aaaaaaaaaaaaaaaaaaaaaaaaaaa', username) - else: # 读取文件中存入的企业信息 - info = FileUtils().r_info("a2_mdm3_ea", "企业信息") - print(info) - username = info['cname'] - print('aaaaaaaaaaaaaaaaaaaaaaaaaaa', username) - # a2供货关系申请_客户类型_医院_登录_企业登录 - # print('医院名称',username) - password = commonFuc().get_business_data(module, "password") - print(username, password) - # 获取token和projectCode - import time - while True: - try: - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - except: - time.sleep(6) - continue - else: - return token, projectCode, uxid, corpId, username - # break - - -# 高值 -def add_goods(): - token, projectCode, uxid, corpId, e_name = e_login(2) - - # 获取医院corpId - h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login() - - module = "a5_mdm3_pdm" - # b18供货目录申请_客户类型_医院_提交供货申请单_添加产品 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "addGoodsHandleInfos_url") - print('url', url) - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - goodsname = commonFuc().randomString(5) - request_body = commonFuc().get_business_data(module, "payload_1", h_corpId, h_name, corpId, e_name, goodsname, - e_name) - # request_body = commonFuc().get_business_data(module, "payload10_1") - - # print('request_body',request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - if code == 0: - commonFuc().check_text_exist(code, result) - else: - commonFuc().check_text_exist(-1, result) - - -def apply(): - module = "a5_mdm3_pdm" - - token, projectCode, uxid, corpId, username = e_login(2) - # 获取医院corpId - - h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login() - - # 登录 - username = h_name - password = commonFuc().get_business_data(module, "password1") - print(username, password) - # 获取token和projectCode - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - # 审批产品驳回 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "singleAudit_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - info = FileUtils().r_info6(module, "产品审核信息", 'message2') - print(info) - MSPid = info['MSPid'] - hosId = info['hosId'] - hosGoodsId = info['hosGoodsId'] - provGoodsid = info['provGoodsid'] - goodsAuditBillId = info['goodsAuditBillId'] - targetId = info['targetId'] - - request_body = commonFuc().get_business_data(module, "payload3_1", MSPid, hosId, hosGoodsId, provGoodsid, - goodsAuditBillId, targetId) - - print('产品信息审核查询请求体', request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print("产品信息审核查询返回结果", result) - checkDict = commonFuc().get_business_data(module, 'checkDict') - commonFuc().check_result(checkDict, result) - - -def select1(messageNO='message2'): - module = "a5_mdm3_pdm" - - token, projectCode, uxid, corpId, username = e_login(2) - # 获取医院corpId - - h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login() - - # 登录 - username = h_name - password = commonFuc().get_business_data(module, "password1") - print(username, password) - # 获取token和projectCode - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - # 产品信息审核查询 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "getAuditGoodsListByPage_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - - request_body = commonFuc().get_business_data(module, "payload2", h_corpId) - - # print('产品信息审核查询请求体', request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print("产品信息审核查询返回结果", result) - data = commonFuc().analysis_json('data', result) - total = commonFuc().analysis_json('total', data) - data1 = commonFuc().analysis_json('data', data) - if total >= 1: - id1 = commonFuc().analysis_json('id', data1[0]) - auditOrgId = commonFuc().analysis_json('hosId', data1[0]) - hosGoodsId = commonFuc().analysis_json('hosGoodsid', data1[0]) - provGoodsid = commonFuc().analysis_json('provGoodsid', data1[0]) - goodsAuditBillId = commonFuc().analysis_json('billId', data1[0]) - targetId = commonFuc().analysis_json('id', data1[0]) - print(id1, auditOrgId, hosGoodsId, provGoodsid, goodsAuditBillId, targetId) - info = (id1, auditOrgId, hosGoodsId, provGoodsid, goodsAuditBillId, targetId) - titlename = ("MSPid", 'hosId', 'hosGoodsId', 'provGoodsid', 'goodsAuditBillId', 'targetId') - # 将产品审核信息写入到b5_spd3_core_business_flow模块messsage文件中 - FileUtils().w_info6(info, module, '产品审核信息', titlename, 'message2') - # 将产品审核信息写入到文件中 - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '产品审核信息', titlename, messageNO) - else: - commonFuc().check_text_exist(0, result) - - -def add_goods1(): # 低值 - token, projectCode, uxid, corpId, e_name = e_login(2) - - # 获取医院corpId - h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login() - - module = "a5_mdm3_pdm" - # b18供货目录申请_客户类型_医院_提交供货申请单_添加产品 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "addGoodsHandleInfos_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - goodsname = commonFuc().randomString(5) - request_body = commonFuc().get_business_data(module, "payload", h_corpId, h_name, corpId, e_name, goodsname, e_name) - # request_body = commonFuc().get_business_data(module, "payload10_1") - - # print('request_body',request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - if code == 0: - commonFuc().check_text_exist(code, result) - else: - commonFuc().check_text_exist(-1, result) - - -def add_goods2(): # 试剂 - token, projectCode, uxid, corpId, e_name = e_login(2) - - # 获取医院corpId - h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login() - - module = "a5_mdm3_pdm" - # b18供货目录申请_客户类型_医院_提交供货申请单_添加产品 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "addGoodsHandleInfos_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - goodsname = commonFuc().randomString(5) - request_body = commonFuc().get_business_data(module, "payload_2", h_corpId, h_name, corpId, e_name, goodsname, - e_name) - # request_body = commonFuc().get_business_data(module, "payload10_1") - - # print('request_body',request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - if code == 0: - commonFuc().check_text_exist(code, result) - else: - commonFuc().check_text_exist(-1, result) - - -def add_goods3(): - token, projectCode, uxid, corpId, e_name = e_login(2) - - # 获取医院corpId - h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login() - - module = "a5_mdm3_pdm" - # b18供货目录申请_客户类型_医院_提交供货申请单_添加产品 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "addGoodsHandleInfos_url") - print('url', url) - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - goodsname = commonFuc().randomString(5) - request_body = commonFuc().get_business_data(module, "payload_1_1", h_corpId, h_name, corpId, e_name, goodsname, - '浙江高仰医疗科技有限公司', 'p10d95') - # request_body = commonFuc().get_business_data(module, "payload10_1") - - # print('request_body',request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - if code == 0: - commonFuc().check_text_exist(code, result) - else: - commonFuc().check_text_exist(-1, result) - - -def add_goods4(): - token, projectCode, uxid, corpId, e_name = e_login(2) - - # 获取医院corpId - h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login() - - module = "a5_mdm3_pdm" - # b18供货目录申请_客户类型_医院_提交供货申请单_添加产品 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "addGoodsHandleInfos_url") - print('url', url) - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - goodsname = commonFuc().randomString(5) - request_body = commonFuc().get_business_data(module, "payload_1_2", h_corpId, h_name, corpId, e_name, goodsname, - '浙江高仰医疗科技有限公司', 'p10d95') - # request_body = commonFuc().get_business_data(module, "payload10_1") - - # print('request_body',request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - if code == 0: - commonFuc().check_text_exist(code, result) - else: - commonFuc().check_text_exist(-1, result) - - -def supplyProvHosGoods_add_DI(): - module = "a5_mdm3_pdm" - token, projectCode, uxid, corpId, e_name = e_login(2) - - # 维护产品DI信息列表查询 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "hdiFusion_getHosGoodsForDiList_url") - print('维护产品DI信息列表查询url', url) - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - - request_body = commonFuc().get_business_data(module, "payload6", get_hosid()) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - # import pdb - # pdb.set_trace() - print('维护产品DI信息列表查询result', result) - data = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)) - print('维护产品DI信息列表查询data', data) - for i in data: - hosGoodsId = commonFuc().analysis_json('id', i) - url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "hdiFusion_getGoodsinfoAndDiLst_url") - request_body1 = commonFuc().get_business_data(module, "payload6_1", hosGoodsId) - print('request_body1', request_body1) - result1 = commonFuc().http_post(url1, request_body1, headers) - packUnit = commonFuc().analysis_json('unit', commonFuc().analysis_json('goodsInfo', - commonFuc().analysis_json('data', - result1))) - basGoodsId = commonFuc().analysis_json('spdGoodsCode', commonFuc().analysis_json('goodsInfo', - commonFuc().analysis_json( - 'data', result1))) - url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "hdiFusion_supplyProvHosGoods_add_url") - request_body2 = commonFuc().get_business_data(module, "payload6_2", packUnit, basGoodsId) - print('request_body2', request_body2) - result2 = commonFuc().http_post(url2, request_body2, headers) - print('result2', result2) - - -# 删除上次新增的产品,避免产生过多的重复数据====这里不能每天删除,万一导入产品功能出现问题会影响后续脚本 -# 每隔一段时间来删除重复的产品数据即可,内外网同步删除 -# try: -# list2=[] -# for i in range(1, 6): -# info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息", 'message%s' % i) -# hosGoodsId = info['hosGoodsId'] -# list2.append(hosGoodsId) -# print(list2) -# for i in list2: -# print(i,'aaaaaaaaaaaaaaaa') -# delData().Del_goods_info(i) -# except: -# print('产品数据删除出现异常') # 删除上次新增的产品,避免产生过多的重复数据====这里不能每天删除,万一导入产品功能出现问题会影响后续脚本 # 每隔一段时间来删除重复的产品数据即可,内外网同步删除 +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_a3_流程三_产品导入和审批.air') +using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_a3_流程三_产品导入和审批.air') +from a_a3_流程三_产品导入和审批 import add_goods, select1, apply, add_goods1, add_goods2, add_goods3, add_goods4, \ + supplyProvHosGoods_add_DI + try: # ==============分割线 暂时注释=============== - add_goods()#直销高值 + add_goods() # 直销高值 select1('message1') apply() - add_goods1()#直销低值 + add_goods1() # 直销低值 select1('message2') apply() - add_goods2()#直销试剂 + add_goods2() # 直销试剂 select1('message3') apply() - add_goods3()#集配 + add_goods3() # 集配 select1('message4') apply() - add_goods4()#定向 "isSubprov": "1" + add_goods4() # 定向 "isSubprov": "1" select1('message5') apply() - #20240618外网在配送的时候增加了DI验证,加入维护di的脚本 + # 20240618外网在配送的时候增加了DI验证,加入维护di的脚本 supplyProvHosGoods_add_DI() # ==============分割线 暂时注释=============== commonFuc().check_text_exist_result_text('succees', 'succees') @@ -399,5 +51,6 @@ except: commonFuc().check_text_exist_result_text('产品新增失败', '产品新增成功') else: # 删除今天之前的产品信息(包含内外网) - delData().Del_goods_info_all() + # delData().Del_goods_info_all() commonFuc().check_text_exist_result_text('succees', 'succees') + print('=================流程三结束=================') 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 84ebdb461dcfd67fb15856d28fd9eaf2eb3ceab4..a5102e65f87722aab49d552e86ad8787846e3f7f 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" @@ -7,7 +7,7 @@ from common.run_cmd_script import execute_command __author__ = "xiaohesheng" """ -case_tag:api,b6_spd3_core_business_flow_database_check1,a_a4_流程四_基础模块设置,id2303,id2303-4,sit,on +case_tag:api,b6_spd3_core_business_flow_database_check,a_a4_流程四_基础模块设置,id2303,id2303-4,sit,on 主数据平台:a_a4_流程四_基础模块设置 python runner_test.py tag id2303-4 debug mdm3 """ @@ -21,289 +21,167 @@ import time module = "b6_spd3_core_business_flow_database_check" -def test1(): - # 院区新增 - execute_command("python runner_test.py tag id2263-4 debug sit") - # 新增科室 - execute_command( - "python runner_test.py tag id2263-19,id2263-20,id2263-21,id2263-22,id2263-23,id2263-24,id2263-25,id2263-26 debug sit") - # 一键导入所有产品 - execute_command("python runner_test.py tag id2263-48 debug sit") - #导入同步过来的新产品,防止因同步时间差导致新建的产品没有导入过来 - for i in range(1, 6): - info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息", 'message%s' % i) - hosGoodsId = info['hosGoodsId'] - import_goods(hosGoodsId) - - # r_b8库房管理_库区设置_同步库房信息 - execute_command("python runner_test.py tag id2263-221 debug sit") - # 新增用户 - execute_command("python runner_test.py tag id2263-253 debug sit") - # 根据院区名称查询中心库房id - execute_command("python runner_test.py tag id2263-222 debug sit") - # 新增库区 - execute_command("python runner_test.py tag id2263-226 debug sit") - # 查询库区 - execute_command("python runner_test.py tag id2263-228 debug sit") - - # r_d0库房管理_库区设置_人员管理_添加人员_查询人员 - execute_command("python runner_test.py tag id2263-233 debug sit") - # r_d2库房管理_库区设置_人员管理_添加人员 - execute_command("python runner_test.py tag id2263-235 debug sit") - # r_d4库房管理_库区设置_货位管理_添加货位 - execute_command("python runner_test.py tag id2263-237 debug sit") - # 科室管理-科室人员查询 设置科室负责人 - execute_command("python runner_test.py tag id2263-219 debug sit") - -def import_goods(hosGoodsId): - module = "b2_herp3_bs" - # 内网登录 - username = commonFuc().get_business_data(module, "username") - # print('医院名称',username) - password = commonFuc().get_business_data(module, "password") - # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # 获取token和projectCode - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - # 院区产品设置_查询院区产品 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "mcmsDeptGoodsInfo_url") - print('院区产品设置_查询院区产品',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")) - # 获取院区id - branch_id = FileUtils().r_info(module, '院区新增')["branch_id"] - # hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] - goodsId=hosGoodsId.replace(get_hosid(), "") - # #请求体 - request_body = commonFuc().get_business_data(module, "payload32_1",get_hosid(), goodsId,branch_id) - print('import_goods',request_body) - # # # 发送请求 - result='result' - # j=1 - while True: - # if j==600: - # print('600秒过去了,导入产品需要停止') - # break - result = commonFuc().http_post(url, request_body, headers) - total=commonFuc().analysis_json('total',commonFuc().analysis_json('data',result)) - print('import_goods', total) - if total==0: - print('产品暂时没有同步到内网,等待6秒') - # j=j+6 - time.sleep(6) - # 再次调用一键导入产品 - execute_command("python runner_test.py tag id2263-48 debug sit") - else: - break +def check_test1_info(): + print('检查院区数据,科室数据,库房库区数据') + # 获取实际值 + # 要验证的数据sql + sql1 = "select * from mcms_branch_info order by create_time desc LIMIT 1;" + actual = check_mcms_pur_sql(sql1) + print('actual', actual) + id = get_id("select id from mcms_branch_info order by create_time desc LIMIT 1;") + branch_id = get_branch_id() + if branch_id == id: + print('ok') + commonFuc().check_text_exist_result_text('succees', 'succees') + else: + commonFuc().check_text_exist_result_text('error', 'succees') + hos_id = get_hosid() + name = get_id("select name from mcms_branch_info order by create_time desc LIMIT 1;") + address = name + create_time = get_create_time("select create_time from mcms_branch_info where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_branch_info where id='%s';" % id) + username = commonFuc().get_business_data('b2_herp3_bs', "username") + create_user = get_login_user_uxid_bydb(username) + last_modified_user = create_user + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_mcms_branch_info', id, hos_id, name, address, create_time, + create_user + , 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) - - -def test2(): # 科室添加产品信息(产品是从外网同步过来的) - module = "b2_herp3_bs" - # 内网登录 - username = commonFuc().get_business_data(module, "username") - # print('医院名称',username) - password = commonFuc().get_business_data(module, "password") - # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # 获取token和projectCode - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - - # - url = commonFuc().get_api_add_port_url()+commonFuc().get_business_data(module, "basic_mcmsGoodsInfo_insert") - print('basic_mcmsGoodsInfo_insert',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")) - list2 = [] - i = 1 - while True: - if i == 1000: - print('6000秒过去了,产品还没过来,检查同步是否正常') - break - try: - for i in range(1, 6): - info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息", 'message%s' % i) - hosGoodsId = info['hosGoodsId'] - list2.append(hosGoodsId) - except: - print('产品没有同步过来,等待6秒') - time.sleep(6) - i = i + 1 - continue + 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 + + 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) + 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)) + 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) + create_time = get_create_time("select create_time from sys_org where id='%s';" % id) + last_modified = get_create_time("select last_modified from sys_org where id='%s';" % id) + if i < 3: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_dept_info' + str(i), id, pid, code, corp_id, branch_id, + last_update_datetime + , create_time, create_user, last_modified_user, last_modified) else: - break - - dept2_id = FileUtils().r_info(module, '科室信息')["dept2_id"] - j=1 - for i in list2: - # 请求体 - if j==1: - request_body = commonFuc().get_business_data(module, "payload58_6_3", dept2_id, i,20) - elif j==2: - request_body = commonFuc().get_business_data(module, "payload58_6_3", dept2_id, i, 10) - elif j==3: - request_body = commonFuc().get_business_data(module, "payload58_6_3", dept2_id, i, 60) + user_leader_id = get_login_user_uxid_bydb( + FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'check_dept_info' + str(i), id, pid, code, corp_id, branch_id, + last_update_datetime + , create_time, create_user, last_modified_user, last_modified, + user_leader_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: - request_body = commonFuc().get_business_data(module, "payload58_6_3", dept2_id, i,20) - j=j+1 - request_body = '[' + str(request_body) + ']' - new_request_body = request_body.replace("'", '"') - print(new_request_body) - import json - request_body_json = json.loads(new_request_body) - # # # 发送请求 - result = commonFuc().http_post(url, request_body_json, headers) - print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result) - # 断言 - # checkDict=commonFuc().get_business_data(module,'checkDict10') - # commonFuc().check_result(checkDict,result) - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - if code == 0 and data == 1: - commonFuc().check_text_exist(0, result) + print('error') + commonFuc().check_text_exist_result_text('error', 'succees') + # 检查库房数据 + # 要验证的数据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) + 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)) + 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)) + + 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) else: - commonFuc().check_text_exist('error', result) - - - -def grants_user(orgName='d69a68df361a4289b2262e4ef75b55a5', mgrRangeId='feb0cc16618c437fb4d033cd339a0377'): - module = "b2_herp3_bs" - # 登录获取用户id等信息,使用创建的用户登录===========开始 - info = FileUtils().r_info8(module, "用户名信息", 'message3') - print(info) - username1 = info['username1'] - - username = username1 - ## print('医院名称',username) - password = commonFuc().get_business_data(module, "password") - # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # 获取token和projectCode - token1, projectCode1, uxid1, corpId1, info1 = login_system(username, password).get_token() - # 登录获取用户id等信息,使用创建的用户登录============结束 - # 内网登录 - username = commonFuc().get_business_data(module, "username") - ## print('医院名称',username) - password = commonFuc().get_business_data(module, "password") - # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # 获取token和projectCode - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - # print( token,projectCode,uxid,corpId,info) + dept_id=get_id("select id from sys_org where branch_id='%s' order by create_time desc LIMIT 1 OFFSET 3;"%branch_id) - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "sys_user_grants_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")) - userId = uxid1 - mgrBranchId = FileUtils().r_info(module, '院区新增')["branch_id"] - mgrBranchName = FileUtils().r_info(module, '院区新增')["branch_name"] - deptid1 = FileUtils().r_info8(module, '所有科室id','message6')["deptid1"] - deptid2 = FileUtils().r_info8(module, '所有科室id','message6')["deptid2"] - deptid3 = FileUtils().r_info8(module, '所有科室id','message6')["deptid3"] - deptid4 = FileUtils().r_info8(module, '所有科室id','message6')["deptid4"] - - # # 请求体 - request_body = commonFuc().get_business_data(module, "payload63_12_2", userId, mgrBranchId, mgrBranchName, deptid1, - mgrBranchId, mgrBranchName, deptid2, mgrBranchId, mgrBranchName, - deptid3, mgrBranchId, mgrBranchName, deptid4 + 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 ) - print('request_body', request_body) - # # # # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('resultaaaaaaaaaaaaaaaaaaa', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - if code == 0 and data == 4: - commonFuc().check_text_exist(0, result) - else: - commonFuc().check_text_exist('error', result) - -def add_StockArea():#添加货位 - module='b2_herp3_bs' - # 登录获取用户id等信息,使用创建的用户登录===========开始 - info = FileUtils().r_info8(module, "用户名信息", 'message3') - print(info) - username1 = info['username1'] - - username = username1 - ## print('医院名称',username) - password = commonFuc().get_business_data(module, "password") - # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # 获取token和projectCode - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - # 登录获取用户id等信息,使用创建的用户登录============结束 - - # 获取库区id - deptid1 = FileUtils().r_info8(module, '所有科室id','message6')["deptid1"] - branch_name = FileUtils().r_info(module, '院区新增')["branch_name"] - stockId = get_stockId(branch_name + '中心库房') - - - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockShelf_page_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")) - request_body = commonFuc().get_business_data(module, "payload62_6", deptid1, stockId) - print('request_body',request_body) - result = commonFuc().http_post(url, request_body, headers) - print('result',result) - data = commonFuc().analysis_json('data', result) - data1 = commonFuc().analysis_json('data', data) - id1 = commonFuc().analysis_json('id', data1) - shelfCode = commonFuc().analysis_json('shelfCode', data1) - createTime = commonFuc().analysis_json('createTime', data1) - stockId = commonFuc().analysis_json('stockId', data1) - shelfName = commonFuc().analysis_json('shelfName', data1) - address = commonFuc().analysis_json('address', data1) - recPhone = commonFuc().analysis_json('recPhone', data1) - lastModified = commonFuc().analysis_json('lastModified', data1) - shelfNo = commonFuc().analysis_json('shelfNo', data1) - print(id1, lastModified, shelfCode, createTime, stockId, shelfName, address, recPhone, shelfNo) - print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result) - # r_d4库房管理_库区设置_货位管理_添加货位 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "basic_stockUser_insertShelf_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")) - - # # 请求体 - request_body = commonFuc().get_business_data(module, "payload62_12", id1, shelfCode, stockId, id1) - - print('request_body', request_body) - # # # # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('resultbbbbbbbbbbb', result) - - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) + 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') - # pageSize = commonFuc().analysis_json('pageSize', data) - # print(pageSize, type(pageSize)) - if code == 0 and data == 4: - commonFuc().check_text_exist(0, result) - else: - commonFuc().check_text_exist('error', 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_a4_流程四_基础模块设置.air') +using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_a4_流程四_基础模块设置.air') +from a_a4_流程四_基础模块设置 import test1, test2, grants_user, add_StockArea try: + # ==============删除业务数据和报表数据 - # delData().Delete_business_Data()#删除业务数据 - # delData().Del_reporter_data() # 删除报表数据 - #==============删除业务数据和报表数据 - test1() - test2()# 科室添加产品信息(产品是从外网同步过来的) - dept_query_all()# 科室查询,将科室id写入文件中 - grants_user()#给用户授权 - set_dept_lead1() #设置一级科室负责人 - add_StockArea()#添加库区 + # test1()#参数2是新增院区后缀为6位数的参数1是老模式 + # 检查院区数据,科室数据,库房库区数据 + check_test1_info() + test2() # 科室添加产品信息(产品是从外网同步过来的) + dept_query_all() # 科室查询,将科室id写入文件中 + grants_user() # 给用户授权 + set_dept_lead1() # 设置一级科室负责人 + add_StockArea() # 添加库区 commonFuc().check_text_exist_result_text('succees', 'succees') + print('=================流程四结束=================') except Exception as e: - commonFuc().check_text_exist_result_text('succees','error') - print("发生异常:", str(e)) \ No newline at end of file + print("发生异常:", str(e)) + commonFuc().check_text_exist_result_text('succees', 'error') diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_a5\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2271_\346\217\220\344\272\244\351\207\207\350\264\255\350\256\241\345\210\222_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a5\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2271_\346\217\220\344\272\244\351\207\207\350\264\255\350\256\241\345\210\222_\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_a5\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2271_\346\217\220\344\272\244\351\207\207\350\264\255\350\256\241\345\210\222_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a5\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2271_\346\217\220\344\272\244\351\207\207\350\264\255\350\256\241\345\210\222_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index 09e1b37eef1e7d12017785cb5c7b5c913fdd6227..67fbef9a66aa335840fae66c12f163a9fbd5c768 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_a5\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2271_\346\217\220\344\272\244\351\207\207\350\264\255\350\256\241\345\210\222_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a5\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2271_\346\217\220\344\272\244\351\207\207\350\264\255\350\256\241\345\210\222_\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_a5\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2271_\346\217\220\344\272\244\351\207\207\350\264\255\350\256\241\345\210\222_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a5\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2271_\346\217\220\344\272\244\351\207\207\350\264\255\350\256\241\345\210\222_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -2,10 +2,10 @@ import traceback from air_case.public1.public1.public1 import updateUserLoginDefaultRange, get_listUserMgrRangePage, call_login, \ - get_branch_id, process_tuple, get_dept_buy_id, check_mcms_pur_plan_sql, get_hosid, get_id, \ + 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 + get_pkg_def_id, get_goods_gg, get_goods_name, get_login_user_uxid_bydb, process_tuple from common.fileUtls import FileUtils from common.run_cmd_script import execute_command @@ -66,7 +66,7 @@ def check_mcms_mcms_pur_plan(type=16): branch_id) area_name = process_tuple(get_id(sql1)) source_id = None - rec_user = get_login_user_uxid() + rec_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) sql1 = "select rec_addr from mcms_pur_plan where branch_id='%s' order by create_time desc LIMIT 1;" % ( branch_id) rec_addr = process_tuple(get_id(sql1)) @@ -160,7 +160,7 @@ def check_mcms_mcms_pur_plan_detail(id, type, planOrderNo): dept_name2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'] rec_org_id = process_tuple( get_id("select id from sys_org where branch_id='%s' and ename='%s';" % (branch_id, dept_name2))) - rec_user = get_login_user_uxid() + rec_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) create_user = rec_user # last_modified = create_time last_modified_user = create_user @@ -219,7 +219,9 @@ def check_mcms_mcms_pur_plan_detail(id, type, planOrderNo): create_time = get_create_time( "select create_time from mcms_pur_plan_detail where id='%s';" % ( id2)) - last_modified = create_time + last_modified = get_create_time( + "select last_modified from mcms_pur_plan_detail where id='%s';" % ( + id2)) sub_prov_name = prov_name source_id = process_tuple( get_id("select source_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';" % ( @@ -254,7 +256,9 @@ def check_mcms_mcms_pur_plan_detail(id, type, planOrderNo): create_time = get_create_time( "select create_time from mcms_pur_plan_detail where id='%s';" % ( id2)) - last_modified = create_time + last_modified = get_create_time( + "select last_modified from mcms_pur_plan_detail where id='%s';" % ( + id2)) sub_prov_name = prov_name source_id = process_tuple( get_id("select source_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';" % ( @@ -323,7 +327,7 @@ def check_mcms_purchase(type=16): branch_id, id1) area_name = process_tuple(get_id(sql1)) rec_user = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'] - # rec_user = get_login_user_uxid() + # rec_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) sql1 = "select rec_addr from mcms_purchase where branch_id='%s' and id='%s' order by create_time desc LIMIT 1;" % ( branch_id, id1) rec_addr = process_tuple(get_id(sql1)) @@ -332,7 +336,7 @@ def check_mcms_purchase(type=16): print(sql) bill_expdt_date = get_expdt_date(sql) - create_user = get_login_user_uxid() + create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) create_time = get_create_time( "select create_time from mcms_purchase where branch_id='%s' and id='%s' order by create_time desc LIMIT 1;" % ( branch_id, id1)) @@ -411,9 +415,9 @@ def check_mcms_purchase(type=16): 'mcms_purchase2_0927', id1, order_no, hos_id, get_branch_id(), dept_id1, dept_name1, rec_org_id, rec_org_name, area_code, area_name, bill_expdt_date, source_id, rec_user, - rec_addr, prov_id, prov_name, exe_prov_id, exe_prov_name, buyBillId, + rec_addr, prov_id, prov_name, exe_prov_id, exe_prov_name, planBillId, planOrderNo, - buyOrderNo, purOrderNo, purBillId, close_date, create_user, + purOrderNo, purBillId, close_date, create_user, create_time, last_modified, last_auditor, last_audit_time ) elif type == 66: @@ -446,9 +450,9 @@ def check_mcms_purchase(type=16): 'mcms_purchase3_0927', id1, order_no, hos_id, get_branch_id(), dept_id1, dept_name1, rec_org_id, rec_org_name, area_code, area_name, bill_expdt_date, source_id, rec_user, - rec_addr, prov_id, prov_name, exe_prov_id, exe_prov_name, buyBillId, + rec_addr, prov_id, prov_name, exe_prov_id, exe_prov_name, planBillId, planOrderNo, - buyOrderNo, purOrderNo, purBillId, close_date, create_user, + purOrderNo, purBillId, close_date, create_user, create_time, last_modified, last_auditor, last_audit_time ) else: @@ -493,7 +497,7 @@ def check_mcms_purchase_detail(id, type, OrderNo): dept_name2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'] rec_org_id = process_tuple( get_id("select id from sys_org where branch_id='%s' and ename='%s';" % (branch_id, dept_name2))) - rec_user = get_login_user_uxid() + rec_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) create_user = rec_user # last_modified = create_time last_modified_user = create_user @@ -531,7 +535,7 @@ def check_mcms_purchase_detail(id, type, OrderNo): goodsGg = get_goods_gg(hos_goods_id) goodsCode = get_goods_code1(hos_goods_id) goodsName = get_goods_name(hos_goods_id) - create_user = get_login_user_uxid() + create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) create_time = get_create_time("select create_time from mcms_purchase_detail where id='%s';" % detail_main_key) last_modified = create_time last_modified_user = create_user @@ -591,27 +595,35 @@ from a_a5流程五_中心库入库结算_正结算1_提交采购计划 import go def main(): try: - # token, projectCode1, uxid1, corpId1, info1 = call_login(2) - # updateUserLoginDefaultRange(get_listUserMgrRangePage(1)) # 设置登录账号默认权限是1级库 - # goods_move3(token) - # # 获取低值的hosGoodsId - # hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] - # get_GoodsPkgDef(hosGoodsId,token) # 获取单元包id - # low_vaule_purchase_plan(token,uxid1)#低值采购计划提交 - # time.sleep(6) - # check_mcms_mcms_pur_plan(16)#低值采购计划数据检查 - # #审批 - # approval_center(token) - # time.sleep(6) - check_mcms_purchase(16)#检查采购订单数据 + token, projectCode1, uxid1, corpId1, info1 = call_login(2) + updateUserLoginDefaultRange(get_listUserMgrRangePage(1)) # 设置登录账号默认权限是1级库 + goods_move3(token) + # 获取低值的hosGoodsId + hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + get_GoodsPkgDef(hosGoodsId,token) # 获取单元包id + low_vaule_purchase_plan(token,uxid1)#低值采购计划提交 + time.sleep(6) + check_mcms_mcms_pur_plan(16)#低值采购计划数据检查 + #审批 + approval_center(token) + time.sleep(6) + check_mcms_purchase(16)#检查低值采购订单数据 hight_vaule_purchase_plan(token,uxid1)#高值采购计划提交 time.sleep(6) + check_mcms_mcms_pur_plan(20) # 高值采购计划数据检查 approval_center(token) - reagent_purchase_plan(token,uxid1) + time.sleep(6) + check_mcms_purchase(20) #检查高值采购订单数据 + time.sleep(6) + reagent_purchase_plan(token,uxid1)#试剂采购计划提交 + time.sleep(6) + check_mcms_mcms_pur_plan(66) #试剂采购计划数据检查 approval_center(token) + time.sleep(6) + check_mcms_purchase(66) # 检查试剂采购订单数据 commonFuc().check_text_exist_result_text('succees', 'succees') except Exception as e: - print('出现错误,请检查脚本或者数据') + # print('出现错误,请检查脚本或者数据') print(f"发生错误: {e}") print("发生异常:", str(e)) diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_a6\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2272_\345\244\226\347\275\221\351\205\215\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a6\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2272_\345\244\226\347\275\221\351\205\215\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_a6\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2272_\345\244\226\347\275\221\351\205\215\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a6\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2272_\345\244\226\347\275\221\351\205\215\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index 08836ace609c60f12321d5c88afee13666335d18..fb090c003fcead10c66d6e08e9f2c360f84c07d7 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_a6\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2272_\345\244\226\347\275\221\351\205\215\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a6\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2272_\345\244\226\347\275\221\351\205\215\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_a6\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2272_\345\244\226\347\275\221\351\205\215\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a6\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2272_\345\244\226\347\275\221\351\205\215\351\200\201_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -2,6 +2,10 @@ import traceback from air_case.mdm_login.登录外网系统.登录外网系统 import login_system +from air_case.public1.public1.public1 import get_branch_id, get_hosid, process_tuple, get_dept_buy_id, reGetString, \ + get_login_user_uxid2, get_create_time, get_ext_info, get_process_list2, compare_text_index, check_mcms_pur_plan_sql, \ + get_id, get_mdm_goods_code1, get_goods_code1, get_goods_name, get_goods_gg, get_goods_mfrs_id, get_expdt_date, \ + get_supply_id, call_login, get_hosname from common.fileUtls import FileUtils from common.run_cmd_script import execute_command from common.timeUtils import timeUtils @@ -19,250 +23,381 @@ from airtest.core.api import using import sys import time -module = "b6_spd3_core_business_flow_database_check" -def order_dp(type=1): - # execute_command("python runner_test.py tag id2302-5 debug mdm3") - # # 登录获取用户id等信息,使用创建的用户登录===========开始 - info = FileUtils().r_info8('b5_spd3_core_business_flow', "供货关系申请2", 'message') - # print(info) - username = info['e_username'] +def check_hdi_distr(type=16): + from common.db.sql.sql_tools_out import check_mcms_pur_plan_sql, get_id + branch_id = get_branch_id() + # 验证配送单主表 + sql = "select * from spd_hdiorder_test2.hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + hos_id = get_hosid() + # 获取采购订单id + purchase_id = get_id( + "select id from mcms_purchase where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type)) + # 查询配送单主键 + distr_main_key = get_id( + "select id from spd_hdiorder_test2.hdi_distr a where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type)) + # 查询配送单order_no + distr_order_no = get_id( + "select order_no from spd_hdiorder_test2.hdi_distr a where id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + distr_main_key, type)) + # 从采购订单获取source_id + source_id = get_id( + "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 + 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)) + bill_relation_json = get_id( + "select bill_relation_json from spd_hdiorder_test2.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') + distrBillId = distr_main_key + distrOrderNo = distr_order_no + 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( + "select create_time from spd_hdiorder_test2.hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type)) + last_modified_user = distrUser + if type == 16: + # 验证子表数据 + time.sleep(5) + check_hdi_distr_detail(distr_main_key, type, purchase_id) + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] - password = commonFuc().get_business_data("b2_herp3_bs", "password1") - # username = '001f90380' - # password='1qaz!QAZ' - print('username,password', username, password) - # # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # # 获取token和projectCode - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - # 登录获取用户id等信息,使用创建的用户登录============结束 + planBillId = process_tuple( + 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))) - # =========================查询待确认订单====================== - module = "a6_mdm3_dp" - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "purchase_page_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"] - hos_id = branch_id[0:5] - exeProvId = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"] + 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;" % ( + hos_goods_id))) + sql = "select order_no 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) + buyOrderNo = process_tuple(get_dept_buy_id(sql)) + sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type) + print(sql) + id1 = process_tuple(get_dept_buy_id(sql)) + sql = "select order_no from mcms_purchase where branch_id='%s' and bill_mode='%s'and id='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type, id1) + print(sql) + purOrderNo = process_tuple(get_dept_buy_id(sql)) + purBillId = id1 + prov_id = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"] + prov_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"] + exe_prov_id = prov_id + exe_prov_name = prov_name + 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, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']))) + rec_org_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + last_modified = get_create_time( + "select last_modified from spd_hdiorder_test2.hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type)) + confirmUser = distrUser + ext_info = get_ext_info(branch_id, type) + confirmTime = reGetString(ext_info, r'"confirmTime":"', r'""confirmUser') + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'hdi_distr_0929', distr_main_key, distr_order_no, hos_id, get_hosname(), + get_branch_id(), source_id, pur_bill_id, prov_id, prov_name, + exe_prov_id, exe_prov_name, pur_dept_id, pur_dept_name, rec_org_id, + rec_org_name, rec_user, planBillId, planOrderNo, + purOrderNo, purBillId, purBillDate, distrBillId, distrOrderNo, + confirmTime, confirmUser, distrUser, create_user, create_user_name, + create_time, last_modified, + last_modified_user + ) - if type == 1: - orderNo1 = FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号', 'message7')["orderNo1"] - print(orderNo1) - elif type == 2: - orderNo1 = FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号高值', 'message11')["orderNo1"] - print(orderNo1) - elif type == 3: - orderNo1 = FileUtils().r_info8('b5_spd3_core_business_flow', '采购计划单号试剂', 'message12')["orderNo1"] - print(orderNo1) - else: - orderNo1 = 'orderNo1' - request_body = commonFuc().get_business_data(module, "payload1_1_1", orderNo1, hos_id, exeProvId) - # print('request_body',request_body) - # 发送请求 - while True: - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - total = commonFuc().analysis_json('total', data) - if total == 1: - break - else: - time.sleep(6) + elif type == 20: + # 验证子表数据 + time.sleep(5) + check_hdi_distr_detail(distr_main_key, type, purchase_id) + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message1')["hosGoodsId"] - data1 = commonFuc().analysis_json('data', data) - id1 = commonFuc().analysis_json('id', data1[0]) - print('id1', id1) + planBillId = process_tuple( + 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))) - data = commonFuc().analysis_json('data', result) - data1 = commonFuc().analysis_json('data', data) - list_a = [] - list_b = [] - list_c = [] - list_a.append(data1) - list_b.append(data1) - list_c.append(data1) - # print('list_a', len(list_a), list_a) - info = (list_a, list_b, list_c) - titlename = ('list_a', 'list_b', 'list_c') - # 将配送订单信息息写入到文件中 - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '配送订单信息', titlename, 'message8') - # 从message8文件中获取信息 - info = FileUtils().r_info8('b5_spd3_core_business_flow', "配送订单信息", 'message8') - # print('info', info) - list_a = info['list_a'] - list_a = ','.join(map(str, list_a)) - import json - new_request_body = list_a.replace("'", '"') - new_request_body1 = new_request_body.replace("None", 'null') - print(new_request_body1) - list_a2 = json.loads(new_request_body1) - # print('list_a', list_a) - billMode = "billMode" - createUser = 'createUser' - hosId = 'hosId' - provId = 'provId' - for i in list_a2: - billMode = i["billMode"] - createUser = i["createUser"] - hosId = i['hosId'] - provId = i['provId'] - break + 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;" % ( + hos_goods_id))) + sql = "select order_no 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) + buyOrderNo = process_tuple(get_dept_buy_id(sql)) + sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type) + print(sql) + id1 = process_tuple(get_dept_buy_id(sql)) + sql = "select order_no from mcms_purchase where branch_id='%s' and bill_mode='%s'and id='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type, id1) + print(sql) + purOrderNo = process_tuple(get_dept_buy_id(sql)) + purBillId = id1 + prov_id = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"] + prov_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"] + exe_prov_id = prov_id + exe_prov_name = prov_name + 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, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']))) + rec_org_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + last_modified = get_create_time( + "select last_modified from hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type)) + confirmUser = distrUser + ext_info = get_ext_info(branch_id, type) + confirmTime = reGetString(ext_info, r'"confirmTime":"', r'""confirmUser') + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'hdi_distr1_0929', distr_main_key, distr_order_no, hos_id, get_hosname(), + get_branch_id(), source_id, pur_bill_id, prov_id, prov_name, + exe_prov_id, exe_prov_name, pur_dept_id, pur_dept_name, rec_org_id, + rec_org_name, rec_user, planBillId, planOrderNo, + purOrderNo, purBillId, purBillDate, distrBillId, distrOrderNo, + confirmTime, confirmUser, distrUser, create_user, create_user_name, + create_time, last_modified, + last_modified_user + ) - # =========================查询待确认订单====================== - # ==============================确认订单================== - module = "a6_mdm3_dp" + elif type == 66: + # 验证子表数据 + time.sleep(5) + check_hdi_distr_detail(distr_main_key, type, purchase_id) + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message3')["hosGoodsId"] - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "ensure_url") + planBillId = process_tuple( + 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))) - request_body = commonFuc().get_business_data(module, "payload2", id1, uxid) + 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;" % ( + hos_goods_id))) + sql = "select order_no 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) + buyOrderNo = process_tuple(get_dept_buy_id(sql)) + sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type) + print(sql) + id1 = process_tuple(get_dept_buy_id(sql)) + sql = "select order_no from mcms_purchase where branch_id='%s' and bill_mode='%s'and id='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type, id1) + print(sql) + purOrderNo = process_tuple(get_dept_buy_id(sql)) + purBillId = id1 + prov_id = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"] + prov_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"] + exe_prov_id = prov_id + exe_prov_name = prov_name + 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, FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']))) + rec_org_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + last_modified = get_create_time( + "select last_modified from spd_hdiorder_test2.hdi_distr where branch_id = '%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + branch_id, type)) + confirmUser = distrUser + ext_info = get_ext_info(branch_id, type) + confirmTime = reGetString(ext_info, r'"confirmTime":"', r'""confirmUser') + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'hdi_distr2_0929', distr_main_key, distr_order_no, hos_id, get_hosname(), + get_branch_id(), source_id, pur_bill_id, prov_id, prov_name, + exe_prov_id, exe_prov_name, pur_dept_id, pur_dept_name, rec_org_id, + rec_org_name, rec_user, planBillId, planOrderNo, + purOrderNo, purBillId, purBillDate, distrBillId, distrOrderNo, + confirmTime, confirmUser, distrUser, create_user, create_user_name, + create_time, last_modified, + last_modified_user + ) - # print('request_body',request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) + else: + expected = None + 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) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - if code == 0: - commonFuc().check_text_exist(code, result) + if actual_value2 == expected_value2: + print('ok') + commonFuc().check_text_exist_result_text('succees', 'succees') else: - commonFuc().check_text_exist('error', result) - # ==============================确认订单================== - # ==============================配送================== - # url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "purchase_page_url") - # - # request_body = commonFuc().get_business_data(module, "payload3_1_1",exeProvId,hos_id) - # # 发送请求 - # result = commonFuc().http_post(url, request_body, headers) - # print('result', result) - # #断言 - # code=commonFuc().analysis_json('code',result) - # data=commonFuc().analysis_json('data',result) - # total=commonFuc().analysis_json('total',data) - # data1 = commonFuc().analysis_json('data', data) - # id1=commonFuc().analysis_json('id', data1[0]) - # print('id1',id1) - # ==================a3获取订单详细信息中的子表id_3_0医院 - # a1订单配送列表数据查询_全部 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "detail_id_url") + print('error') + commonFuc().check_text_exist_result_text('error', 'succees') - request_body = commonFuc().get_business_data(module, "payload4", id1) - # print('request_body',request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('resulta3获取订单详细信息中的子表id_3_0医院', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - total = commonFuc().analysis_json('total', data) - - commonFuc().check_text_exist(code, result) - data1 = commonFuc().analysis_json('data', data) - id2 = commonFuc().analysis_json('id', data1[0]) - print(id1, id2) - data1 = commonFuc().analysis_json('data', data) - list_a = [] - list_b = [] - list_c = [] - list_a.append(data1) - list_b.append(data1) - list_c.append(data1) - # print('list_a', len(list_a), list_a) - info = (list_a, list_b, list_c) - titlename = ('list_a', 'list_b', 'list_c') - # 将配送订单信息息写入到文件中 - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '配送订单详细信息', titlename, 'message9') +def check_hdi_distr_detail(distr_main_key, type, purchase_id): + sql = "select * from spd_hdiorder_test2.hdi_distr_detail where pid = '%s';" % distr_main_key + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + # 获取子表主键 + distr_detail_main_key = get_id( + "select id from spd_hdiorder_test2.hdi_distr_detail where pid = '%s';" % ( + distr_main_key)) + source_id = purchase_id + source_detail_id = get_id("select id from mcms_purchase_detail where pid='%s'" % purchase_id) + pur_detail_id = source_detail_id + if type == 16: + hos_goods_id = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] + elif type == 20: + 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"] - # ==================a3获取订单详细信息中的子表id_3_0医院 - # ==================订单配送======================== - module = "a6_mdm3_dp" - # a1订单配送列表数据查询_全部 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submit_url") - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - # 从message9文件中获取信息 - info = FileUtils().r_info8('b5_spd3_core_business_flow', "配送订单详细信息", 'message9') - print('info从message9文件中获取信息', info) - # print('info', info) - list_a = info['list_a'] - # print('list_a',list_a,type(list_a)) - # list_a = ','.join(map(str, list_a)) - # import json - # new_request_body = list_a.replace("'", '"') - # new_request_body1 = new_request_body.replace("None", 'null') - # print('new_request_body1',new_request_body1) - # - # list_a2 = json.loads(new_request_body1) - # print('list_a2', list_a2) - # print('list_a2', type(list_a2)) - hosGoodsId = 'hosGoodsId' - mdmGoodsCode = 'mdmGoodsCode' - goodsCode = 'goodsCode' - pkgDefId = 'pkgDefId' - erpCode = 'erpCode' - for i in list_a: - print('aaaaaaaaaaaaaaaaaaaaaaaaaaaa', i) - for j in i: - print('bbbbbbbbbbbbbbbbbbb', j) - hosGoodsId = j['hosGoodsId'] - mdmGoodsCode = j['mdmGoodsCode'] - goodsCode = j['goodsCode'] - pkgDefId = j['pkgDefId'] - erpCode = j['erpCode'] - break - # # #获取日期 - productDate = timeUtils().get_time_hms(5) - expdtDate = timeUtils().get_time_add(190, 2) - if type == 1: - request_body = commonFuc().get_business_data(module, "payload9_2_1_1", id1, id1, hosId, provId, billMode, - createUser, username, createUser, id2, hosGoodsId, mdmGoodsCode, - goodsCode, pkgDefId, productDate, expdtDate, erpCode, id2) - elif type == 2: - request_body = commonFuc().get_business_data(module, "payload9_2_1_2", id1, id1, hosId, provId, billMode, - createUser, username, createUser, id2, hosGoodsId, mdmGoodsCode, - goodsCode, productDate, expdtDate, erpCode, id2) - elif type == 3: - request_body = commonFuc().get_business_data(module, "payload9_2_1_3", id1, id1, hosId, provId, billMode, - createUser, username, createUser, id2, hosGoodsId, mdmGoodsCode, - goodsCode, pkgDefId, productDate, expdtDate, erpCode, id2) + mdm_goods_code = get_mdm_goods_code1(hos_goods_id) + goods_code = get_goods_code1(hos_goods_id) + goods_name = get_goods_name(hos_goods_id) + goods_gg = get_goods_gg(hos_goods_id) + mfrs_id = get_goods_mfrs_id(hos_goods_id) + expdt_date = get_expdt_date( + "select expdt_date from spd_hdiorder_test2.hdi_distr_detail where pid = '%s';" % ( + distr_main_key)) + product_date = get_expdt_date( + "select product_date from spd_hdiorder_test2.hdi_distr_detail where pid = '%s';" % ( + distr_main_key)) + pkg_def_id = process_tuple( + get_id("select pkg_def_id from mcms_pkg where hos_goods_id='%s' LIMIT 1;" % hos_goods_id)) + supply_id = get_supply_id(hos_goods_id) + sub_prov_id = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"] + sub_prov_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"] + planBillId = process_tuple( + 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))) + 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;" % ( + get_branch_id(), type) + print(sql) + buyBillId = process_tuple(get_dept_buy_id(sql)) + buyDetailId = get_id( + "select id from mcms_dept_buy_detail where pid='%s';" % buyBillId) + # planBillId = process_tuple( + # 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))) + planDetailId = get_id( + "select id from spd3_herp_test2.mcms_pur_plan_detail where pid='%s';" % planBillId) + purDetailId = pur_detail_id + sql = "select id from mcms_purchase where branch_id='%s' and bill_mode='%s' order by create_time desc LIMIT 1;" % ( + get_branch_id(), type) + print(sql) + id1 = process_tuple(get_dept_buy_id(sql)) + purBillId = id1 + distrDetailId = distr_detail_main_key + distrBillId = distr_main_key + erpCode = mdm_goods_code # 11661563 + create_user = get_login_user_uxid2() + create_time = get_create_time( + "select create_time from spd_hdiorder_test2.hdi_distr_detail where id = '%s';" % ( + distr_detail_main_key)) + last_modified = get_create_time( + "select last_modified from spd_hdiorder_test2.hdi_distr_detail where id = '%s';" % ( + distr_detail_main_key)) + last_modified_user = create_user + if type == 16: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'hdi_distr_detail_0929', distr_detail_main_key, distr_main_key, source_id, + source_detail_id, pur_detail_id + , hos_goods_id, mdm_goods_code, goods_code, goods_name, goods_gg, + mfrs_id, expdt_date, product_date + , pkg_def_id, supply_id, sub_prov_id, sub_prov_name, planBillId, + planDetailId, purDetailId, purBillId, distrDetailId, + distrBillId, goods_gg, goods_code, goods_name, erpCode, create_user, + create_time, last_modified, last_modified_user) + elif type == 20: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'hdi_distr_detail2_0929', distr_detail_main_key, distr_main_key, source_id, + source_detail_id, pur_detail_id + , hos_goods_id, mdm_goods_code, goods_code, goods_name, goods_gg, + mfrs_id, expdt_date, product_date + , pkg_def_id, supply_id, sub_prov_id, sub_prov_name, planBillId, + planDetailId, purDetailId, purBillId, distrDetailId, + distrBillId, goods_gg, goods_code, goods_name, erpCode, create_user, + create_time, last_modified, last_modified_user) + elif type == 66: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'hdi_distr_detail3_0929', distr_detail_main_key, distr_main_key, source_id, + source_detail_id, pur_detail_id + , hos_goods_id, mdm_goods_code, goods_code, goods_name, goods_gg, + mfrs_id, expdt_date, product_date + , pkg_def_id, supply_id, sub_prov_id, sub_prov_name, planBillId, + planDetailId, purDetailId, purBillId, distrDetailId, + distrBillId, goods_gg, goods_code, goods_name, erpCode, create_user, + create_time, last_modified, last_modified_user) + else: + expected = None - print('request_body', request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) + # comparison_result(actual, expected) + 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) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - id1 = commonFuc().analysis_json('id', data) - info = (id1, id1) - titlename = ('distrBillId1', 'distrBillId2') - # 将配送订单信息息写入到文件中 - if type==1: - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '低值配送单号', titlename, 'message10') - elif type==2: - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '高值配送单号', titlename, 'message10') - elif type==3: - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '试剂配送单号', titlename, 'message10') - if code == 0: - commonFuc().check_text_exist(code, result) + if actual_value2 == expected_value2: + print('ok') + commonFuc().check_text_exist_result_text('succees', 'succees') else: - commonFuc().check_text_exist('error', result) -# ==================订单配送===================================== + print('error') + commonFuc().check_text_exist_result_text('error', 'succees') + + +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_a6流程五_中心库入库结算_正结算2_外网配送.air') +using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_a6流程五_中心库入库结算_正结算2_外网配送.air') +from a_a6流程五_中心库入库结算_正结算2_外网配送 import order_dp + try: - order_dp(1)# 1低值 - order_dp(2)#2高值 - order_dp(3)#3试剂 + token, projectCode1, uxid1, corpId1, info1 = call_login(1) + # + order_dp(1, token, projectCode1, uxid1) # 1低值 + order_dp(2, token, projectCode1, uxid1) # 2高值 + order_dp(3, token, projectCode1, uxid1) # 3试剂 + time.sleep(12) + list_data = ['16', '20', '66'] + for i in list_data: + time.sleep(6) + check_hdi_distr(int(i)) # 检查配送单(外网) except Exception as e: print('订单配送发生错误,请检查脚本或者数据') print("发生异常:", str(e)) diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_a7\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\206\205\347\275\221\351\252\214\346\224\266\345\205\245\345\272\223\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a7\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\206\205\347\275\221\351\252\214\346\224\266\345\205\245\345\272\223\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_a7\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\206\205\347\275\221\351\252\214\346\224\266\345\205\245\345\272\223\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a7\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\206\205\347\275\221\351\252\214\346\224\266\345\205\245\345\272\223\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index 43940d2a8ce1c6aa5a5c1b1e528cf94e2e5ad43d..ded2f416c832d24d5df5ee68f14d063c3122c575 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_a7\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\206\205\347\275\221\351\252\214\346\224\266\345\205\245\345\272\223\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a7\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\206\205\347\275\221\351\252\214\346\224\266\345\205\245\345\272\223\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_a7\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\206\205\347\275\221\351\252\214\346\224\266\345\205\245\345\272\223\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a7\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\206\205\347\275\221\351\252\214\346\224\266\345\205\245\345\272\223\347\273\223\347\256\227_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" @@ -3,6 +3,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 from common.timeUtils import timeUtils @@ -21,401 +22,1156 @@ from airtest.core.api import using import sys import time -module = "b6_spd3_core_business_flow_database_check" - - -def check_accept_order(type=1): - # execute_command("python runner_test.py tag id2302-6 debug mdm3") - # # 登录获取用户id等信息,使用创建的用户登录===========开始 - info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3') - # print(info) - username = info['username1'] - - password = commonFuc().get_business_data("b2_herp3_bs", "password") - # username = '001f90380' - # password='1qaz!QAZ' - print('username,password', username, password) - # # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # # 获取token和projectCode - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - # 登录获取用户id等信息,使用创建的用户登录============结束 - - # =========================查询待验收订单====================== - module = "b5_spd3_core_business_flow" - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "check_wait_page_url") - print('url', url) - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"] - hos_id = branch_id[0:5] +def check_mcms_check(type=1): if type == 1: - sourceOrderNo = FileUtils().r_info8(module, '低值配送单号', 'message10')["distrBillId1"] + bill_mode = 16 elif type == 2: - sourceOrderNo = FileUtils().r_info8(module, '高值配送单号', 'message10')["distrBillId1"] - elif type == 3: - sourceOrderNo = FileUtils().r_info8(module, '试剂配送单号', 'message10')["distrBillId1"] - else: - sourceOrderNo = FileUtils().r_info8(module, '低值配送单号', 'message10')["distrBillId1"] - request_body = commonFuc().get_business_data(module, "payload", hos_id, branch_id, sourceOrderNo) - print('request_body', request_body) - # 发送请求 - while True: - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - total = commonFuc().analysis_json('total', data) - if total == 1: - break - else: - time.sleep(6) - - data = commonFuc().analysis_json('data', result) - data1 = commonFuc().analysis_json('data', data) - list_a = [] - list_b = [] - list_c = [] - list_a.append(data1) - list_b.append(data1) - list_c.append(data1) - # print('list_a', len(list_a), list_a) - info = (list_a, list_b, list_c) - titlename = ('list_a', 'list_b', 'list_c') - # 将验收单信息写入到文件中 - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '验收单信息', titlename, 'message13') - # 从message13文件中获取信息 - info = FileUtils().r_info8('b5_spd3_core_business_flow', "验收单信息", 'message13') - # print('info', info) - list_a = info['list_a'] - print('list_a', list_a) - sourceType = "sourceType" - billMode = 'billMode' - recOrgId = 'recOrgId' - recOrgName = 'recOrgName' - sourceOrgId = 'sourceOrgId' - sourceOrgName = 'sourceOrgName' - sourceVersion = 'sourceVersion' - tbStatus = 'tbStatus' - for i in list_a: - print('i', i) - for j in i: - sourceType = j["sourceType"] - billMode = j["billMode"] - recOrgId = j['recOrgId'] - recOrgName = j['recOrgName'] - sourceOrgId = j['sourceOrgId'] - sourceOrgName = j['sourceOrgName'] - sourceVersion = j['sourceVersion'] - tbStatus = j['tbStatus'] - break - - # =========================查询待验收订单====================== - # ==============================查看订单详情================== - - sourceId = sourceOrderNo - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "check_wait_detail_url") - print('url', url) - request_body = commonFuc().get_business_data(module, "payload1", sourceId, sourceType, billMode, branch_id) - - # print('request_body',request_body) - # 发送请求 - while True: - time.sleep(6) - result = commonFuc().http_post(url, request_body, headers) - code = commonFuc().analysis_json('code', result) - if code == 0: - break - else: - print('验收单数据未同步完成,等待6秒') + bill_mode = 20 + else: + bill_mode = 66 + print('检查验收单数据库写值') + check_no = FileUtils().r_info8('b5_spd3_core_business_flow', '验收单号', 'message15')['CHECK_NO1'] + sql = "select * from mcms_check where id = '%s';" % check_no + order_no = get_id("select order_no from mcms_check where id = '%s';" % check_no) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + if type == 1: + source_id = FileUtils().r_info8('b5_spd3_core_business_flow', '低值配送单号', 'message10')['distrBillId1'] + elif type == 2: + source_id = FileUtils().r_info8('b5_spd3_core_business_flow', '高值配送单号', 'message10')['distrBillId1'] + else: + source_id = FileUtils().r_info8('b5_spd3_core_business_flow', '试剂配送单号', 'message10')['distrBillId1'] + source_no = source_id + prov_id = get_prov_id() + prov_name = get_prov_name() + rec_org_id = get_rec_org_id(1) + rec_org_name = get_rec_org_name(1) + dept_id = rec_org_id + dept_name = rec_org_name + branch_id = get_branch_id() + buyBillId = get_buyBillId(branch_id, bill_mode) + buyOrderNo = get_buyOrderNo(branch_id, bill_mode) + 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"] + planBillId = get_planBillId(hos_goods_id) + planOrderNo = get_planOrderNo(hos_goods_id) + purOrderNo = get_purOrderNo(branch_id, bill_mode) + purBillId = get_purBillId(branch_id, bill_mode) + bill_relation_json = get_mcms_chek_purBillDate(branch_id, bill_mode) + purBillDate = reGetString(bill_relation_json, r'purBillDate":"', r'""distrBillId') + distrBillId = get_distrBillId(branch_id, bill_mode) + distrOrderNo = get_distrOrderNo(branch_id, bill_mode) + checkBillId = check_no + checkOrderNo = order_no + create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + sql = "select create_time from mcms_check where id='%s';" % check_no + create_time = get_create_time(sql) + sql = "select last_modified from mcms_check where id='%s';" % check_no + last_modified = get_create_time(sql) + last_modified_user = create_user + if type == 1: + check_mcms_check_batch(type, check_no, order_no, hos_goods_id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'mcms_check_1008', check_no, + order_no, get_hosid(), get_branch_id(), source_id, source_no, prov_id, + prov_name, rec_org_id, rec_org_name, dept_id, dept_name, + planBillId, planOrderNo, purOrderNo, purBillId, + purBillDate, + distrBillId, distrOrderNo, checkBillId, checkOrderNo, create_user, + create_time, last_modified, + last_modified_user) + elif type == 2: + check_mcms_check_batch(type, check_no, order_no, hos_goods_id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'mcms_check1_1008', check_no, + order_no, get_hosid(), get_branch_id(), source_id, source_no, prov_id, + prov_name, rec_org_id, rec_org_name, dept_id, dept_name, + planBillId, planOrderNo, purOrderNo, purBillId, + purBillDate, + distrBillId, distrOrderNo, checkBillId, checkOrderNo, create_user, + create_time, last_modified, + last_modified_user) + else: + check_mcms_check_batch(type, check_no, order_no, hos_goods_id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'mcms_check2_1008', check_no, + order_no, get_hosid(), get_branch_id(), source_id, source_no, prov_id, + prov_name, rec_org_id, rec_org_name, dept_id, dept_name, + planBillId, planOrderNo, purOrderNo, purBillId, + purBillDate, + distrBillId, distrOrderNo, checkBillId, checkOrderNo, create_user, + create_time, last_modified, + last_modified_user) + # 对比预期值和实际值是否一致 + # comparison_result(actual, expected) + 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) - # 断言 - data = commonFuc().analysis_json('data', result) - list_a = [] - list_b = [] - list_c = [] - list_a.append(data) - list_b.append(data) - list_c.append(data) - # print('list_a', len(list_a), list_a) - info = (list_a, list_b, list_c) - titlename = ('list_a', 'list_b', 'list_c') - # 将验收单详细信息写入到文件中 - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '验收单详情信息', titlename, 'message14') - # 读取viewId - info = FileUtils().r_info8('b5_spd3_core_business_flow', "验收单详情信息", 'message14') - # print('info', info) + 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_check_batch(type, check_no, order_no, hos_goods_id): + print('数据库检查验收单子表') + if type == 1: + bill_mode = 16 + elif type == 2: + bill_mode = 20 + else: + bill_mode = 66 + sql = "select * from mcms_check_batch where pid='%s' order by create_time desc LIMIT 1;" % check_no + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + id = get_id("select id from mcms_check_batch where pid='%s' order by create_time desc LIMIT 1;" % check_no) + pid = check_no + branch_id = get_branch_id() + distr_detail_id = get_distr_detail_id(branch_id, bill_mode) + source_detail_id = distr_detail_id + mdm_goods_code = get_mdm_goods_code1(hos_goods_id) + goods_code = get_goods_code1(hos_goods_id) + sql = "select barcode_id from mcms_check_batch where pid='%s' order by create_time desc LIMIT 1;" % ( + check_no) + barcode_id = get_id(sql) + if check_barcode_id(barcode_id)==True: + commonFuc().check_text_exist_result_text('succees', 'succees') + else: + commonFuc().check_text_exist_result_text('error', 'succees') + + + create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_time = get_create_time("select create_time from mcms_check_batch where pid='%s'" % check_no) + last_modified = get_create_time("select last_modified from mcms_check_batch where pid='%s'" % check_no) + last_modified_user = create_user + if type == 1: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'mcms_check_batch', id, + pid, order_no, source_detail_id, distr_detail_id, hos_goods_id, + mdm_goods_code, + goods_code, barcode_id, create_user, create_time, last_modified, + last_modified_user + ) + elif type == 2: + + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'mcms_check_batch1', id, + pid, order_no, source_detail_id, distr_detail_id, hos_goods_id, + mdm_goods_code, + goods_code, barcode_id, create_user, create_time, last_modified, + last_modified_user + ) + else: + + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'mcms_check_batch2', id, + pid, order_no, source_detail_id, distr_detail_id, hos_goods_id, + mdm_goods_code, + goods_code, barcode_id, create_user, create_time, last_modified, + last_modified_user + ) + # 对比预期值和实际值是否一致 + # comparison_result(actual, expected) + 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_psi(type=1): + print('检查中心库入库单') + if type == 1: + bill_mode = 16 + elif type == 2: + bill_mode = 20 + else: + bill_mode = 66 + branch_id = get_branch_id() + sql = "select * from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_YS' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id, bill_mode) + # 获取实际值 + actual = check_mcms_pur_plan_sql(sql) + print('actual', actual) + sql = "select id from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_YS' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id, bill_mode) + id = get_id(sql) + sql = "select order_no from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_YS' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id, bill_mode) + order_no = get_id(sql) + target_corp_id = get_hosid() + target_branch_id = get_branch_id() + target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] + target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + stock_name = get_branch_name() + "中心库房" + target_stock_id = get_stockId_fromdb(stock_name) + target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 1) + # source_id = FileUtils().r_info8('b5_spd3_core_business_flow', '验收单号', 'message15')['CHECK_NO1'] + sql = "select source_id from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='RK_YS' order by CREATE_TIME desc LIMIT 1;" % ( + branch_id, bill_mode) + source_id=get_id(sql) + # source_no = get_distrBillId(branch_id, bill_mode) + source_no=None + source_repl_id = source_no + source_corp_id = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_corpId"] + source_dept_id = source_corp_id + source_dept_name = FileUtils().r_info8('b5_spd3_core_business_flow', '供货关系申请2', 'message')["e_username"] + source_stock_id = source_corp_id + accounter = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + account_date = get_create_time("select account_date from mcms_psi where id='%s';" % id) + + buyBillId = get_buyBillId(branch_id, bill_mode) + 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"] + planBillId = get_planBillId(hos_goods_id) + planOrderNo = get_planOrderNo(hos_goods_id) + buyOrderNo = get_buyOrderNo(branch_id, bill_mode) + purOrderNo = get_purOrderNo(branch_id, bill_mode) + purBillId = get_purBillId(branch_id, bill_mode) + bill_relation_json = get_purBillDate2(branch_id, bill_mode) + purBillDate = reGetString(bill_relation_json, r'purBillDate":"', r'""distrBillId') + distrBillId = get_distrBillId(branch_id, bill_mode) + distrOrderNo = get_distrOrderNo(branch_id, bill_mode) + checkBillId = source_id + sql = "select order_no from mcms_check where id='%s';" % checkBillId + checkOrderNo = get_id(sql) + psiInBillId = id + psiInOrderNo = order_no + create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_time = get_create_time("select create_time from mcms_psi where id='%s';" % id) + last_modified = get_create_time("select last_modified from mcms_psi where id='%s';" % id) + last_modified_user = create_user + if type == 1: + # 检查子表 + check_mcms_psi_batch_in(id, type, order_no, source_id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi1_1008', id, + order_no, target_corp_id, target_branch_id, target_dept_id, + target_dept_name, target_stock_id + , target_area_code, source_id, source_no, source_repl_id, + source_corp_id, source_dept_id, source_dept_name + , source_stock_id, accounter, account_date, planBillId, + planOrderNo, purOrderNo, purBillId + , purBillDate, distrBillId, distrOrderNo, checkBillId, checkOrderNo, + psiInBillId, psiInOrderNo, create_user + , create_time, last_modified, last_modified_user) + elif type == 2: + check_mcms_psi_batch_in(id, type, order_no, source_id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi2_1008', id, + order_no, target_corp_id, target_branch_id, target_dept_id, + target_dept_name, target_stock_id + , target_area_code, source_id, source_no, source_repl_id, + source_corp_id, source_dept_id, source_dept_name + , source_stock_id, accounter, account_date, planBillId, + planOrderNo, purOrderNo, purBillId + , purBillDate, distrBillId, distrOrderNo, checkBillId, checkOrderNo, + psiInBillId, psiInOrderNo, create_user + , create_time, last_modified, last_modified_user) + else: + check_mcms_psi_batch_in(id, type, order_no, source_id) + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi3_1008', id, + order_no, target_corp_id, target_branch_id, target_dept_id, + target_dept_name, target_stock_id + , target_area_code, source_id, source_no, source_repl_id, + source_corp_id, source_dept_id, source_dept_name + , source_stock_id, accounter, account_date, planBillId, + planOrderNo, purOrderNo, purBillId + , purBillDate, distrBillId, distrOrderNo, checkBillId, checkOrderNo, + psiInBillId, psiInOrderNo, 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 = "select * from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_QL' order by CREATE_TIME desc LIMIT 1;" % ( + # branch_id, bill_mode) + # # 获取实际值 + # actual = check_mcms_pur_plan_sql(sql) + # print('actual', actual) + # sql = "select id from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_QL' order by CREATE_TIME desc LIMIT 1;" % ( + # branch_id, bill_mode) + # id_out = get_id(sql) + # sql = "select order_no from mcms_psi where target_branch_id='%s' and bill_mode='%s' and stock_kind='CK_QL' order by CREATE_TIME desc LIMIT 1;" % ( + # branch_id, bill_mode) + # order_no_out = get_id(sql) + # target_corp_id = get_hosid() + # target_branch_id = get_branch_id() + # target_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'] + # target_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'] + # stock_name = target_dept_name + "库房" + # target_stock_id = get_stockId_fromdb(stock_name) + # target_area_code = get_stockAreaId_new_fromDb(target_dept_name, 2) + # source_id_out = id + # source_no_out = order_no + # source_repl_id = source_no + # source_corp_id = get_hosid() + # source_dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] + # source_dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1'] + # source_stock_id = get_stockId_fromdb(get_branch_name() + '中心库房') + # accounter = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + # account_date = get_create_time("select account_date from mcms_psi where id='%s';" % id_out) + # + # buyBillId = get_buyBillId(branch_id, bill_mode) + # 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"] + # planBillId = get_planBillId(hos_goods_id) + # planOrderNo = get_planOrderNo(hos_goods_id) + # buyOrderNo = get_buyOrderNo(branch_id, bill_mode) + # purOrderNo = get_purOrderNo(branch_id, bill_mode) + # purBillId = get_purBillId(branch_id, bill_mode) + # bill_relation_json = get_purBillDate2(branch_id, bill_mode) + # purBillDate = reGetString(bill_relation_json, r'purBillDate":"', r'""distrBillId') + # distrBillId = get_distrBillId(branch_id, bill_mode) + # distrOrderNo = get_distrOrderNo(branch_id, bill_mode) + # checkBillId = source_id + # sql = "select order_no from mcms_check where id='%s';" % checkBillId + # checkOrderNo = get_id(sql) + # psiInBillId = id + # psiInOrderNo = order_no + # psiOutBillId = id_out + # psiOutOrderNo = order_no_out + # create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + # create_time = get_create_time("select create_time from mcms_psi where id='%s';" % id_out) + # last_modified = get_create_time("select last_modified from mcms_psi where id='%s';" % id_out) + # last_modified_user = create_user + # source_branch_id = get_branch_id() + # source_area_code = get_stockAreaId_new_fromDb(source_dept_name) + # if type == 1: + # check_mcms_psi_batch_out(id, type, order_no, source_id) + # expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi_out1', + # id_out, + # order_no_out, target_corp_id, target_branch_id, target_dept_id, + # target_dept_name, target_stock_id + # , target_area_code, source_id_out, source_no_out, source_repl_id, + # source_corp_id, source_branch_id, source_dept_id, source_dept_name + # , source_stock_id, source_area_code, buyBillId, planBillId, + # planOrderNo, buyOrderNo, purOrderNo, purBillId + # , purBillDate, distrBillId, distrOrderNo, checkBillId, checkOrderNo, + # psiInBillId, psiInOrderNo, psiOutBillId, psiOutOrderNo, create_user + # , create_time, last_modified, last_modified_user) + # elif type == 2: + # check_mcms_psi_batch_out(id, type, order_no, source_id) + # expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi_out2', + # id_out, + # order_no_out, target_corp_id, target_branch_id, target_dept_id, + # target_dept_name, target_stock_id + # , target_area_code, source_id_out, source_no_out, source_repl_id, + # source_corp_id, source_branch_id, source_dept_id, source_dept_name + # , source_stock_id, source_area_code, buyBillId, planBillId, + # planOrderNo, buyOrderNo, purOrderNo, purBillId + # , purBillDate, distrBillId, distrOrderNo, checkBillId, checkOrderNo, + # psiInBillId, psiInOrderNo, psiOutBillId, psiOutOrderNo, create_user + # , create_time, last_modified, last_modified_user) + # else: + # check_mcms_psi_batch_out(id, type, order_no, source_id) + # expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', 'check_mcms_psi_out3', + # id_out, + # order_no_out, target_corp_id, target_branch_id, target_dept_id, + # target_dept_name, target_stock_id + # , target_area_code, source_id_out, source_no_out, source_repl_id, + # source_corp_id, source_branch_id, source_dept_id, source_dept_name + # , source_stock_id, source_area_code, buyBillId, planBillId, + # planOrderNo, buyOrderNo, purOrderNo, purBillId + # , purBillDate, distrBillId, distrOrderNo, checkBillId, checkOrderNo, + # psiInBillId, psiInOrderNo, psiOutBillId, psiOutOrderNo, 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') + + + + + + +def check_mcms_psi_batch_in(DR_ID, type, order_no, source_id1): + if type == 1: + bill_mode = 16 + elif type == 2: + bill_mode = 20 + else: + bill_mode = 66 + branch_id = get_branch_id() + sql = " select * from mcms_psi_batch where pid='%s' order by create_time desc LIMIT 1;" % ( + DR_ID) + actual = check_mcms_dept_buy_sql(sql) + print('actual', actual) + batch_main_key = get_id("select id from mcms_psi_batch where pid='%s' order by create_time desc LIMIT 1;" % DR_ID) + pid = DR_ID + # order_no = get_id("select order_no from mcms_psi_dept_batch where pid='%s';" % DR_ID) + source_detail_id = get_id("select source_detail_id from mcms_psi_batch where id='%s';" % batch_main_key) + pick_detail_id = None + 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"] + mdm_goods_code = get_mdm_goods_code1(hos_goods_id) + goods_code = get_goods_code1(hos_goods_id) + pkg_def_id = get_pkg_def_id(hos_goods_id) + picker_name = FileUtils().r_info8("b2_herp3_bs", "用户名信息", 'message3')['username1'] + picker = get_login_user_uxid_bydb(picker_name) + source_batch_id = get_id("select source_batch_id from mcms_psi_batch where pid='%s';" % DR_ID) + distrBillId = get_distrBillId(branch_id, bill_mode) + target_batch_id = get_id( + "select id from mcms_hos_batch where hos_goods_id='%s' order by create_time desc LIMIT 1;" % hos_goods_id) + if check_batch_id(source_batch_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('succees', 'succees') + else: + commonFuc().check_text_exist_result_text('error', 'succees') + barcode_id = get_id("select barcode_id from mcms_psi_batch where id='%s';" % batch_main_key) + if check_barcode_id(barcode_id) == True: + print('ok') + commonFuc().check_text_exist_result_text('succees', 'succees') + else: + commonFuc().check_text_exist_result_text('error', 'succees') + dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'] + shelf_code = get_stockAreaId_new_fromDb(get_branch_name(), 1) + create_user = get_login_user_uxid_bydb(FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1']) + create_time = get_create_time("select create_time from mcms_psi_batch where id='%s';" % batch_main_key) + last_modified = get_create_time("select last_modified from mcms_psi_batch where id='%s';" % batch_main_key) + last_modified_user = create_user + if type == 1: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'mcms_psi_batch_in1', batch_main_key, pid, order_no, source_detail_id + , hos_goods_id, mdm_goods_code, goods_code, source_batch_id, + target_batch_id, barcode_id, shelf_code, create_user, create_time, + last_modified, last_modified_user + + ) + elif type == 2: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'mcms_psi_batch_in2', batch_main_key, pid, order_no, source_detail_id + , hos_goods_id, mdm_goods_code, goods_code, source_batch_id, + target_batch_id, barcode_id, shelf_code, create_user, create_time, + last_modified, last_modified_user + + ) + else: + expected = commonFuc().get_business_data('b6_spd3_core_business_flow_database_check', + 'mcms_psi_batch_in3', batch_main_key, pid, order_no, source_detail_id + , hos_goods_id, mdm_goods_code, goods_code, source_batch_id, + target_batch_id, barcode_id, shelf_code, create_user, create_time, + last_modified, last_modified_user + + ) + + print('expected', expected) + print('aaaaaaaaaaaaaaaaa') + actual_value1 = get_process_list2(actual) + expected_value1 = get_process_list2(expected) + actual_value2 = actual_value1.replace(" ", "") + expected_value2 = expected_value1.replace(" ", "") + # print('actual_value2',actual_value2) + print('expected_value2') + print(expected_value2) + print('actual_value2') + print(actual_value2) + print(compare_text_index(actual_value2, expected_value2)) + if actual_value2 == expected_value2: + print('ok') + commonFuc().check_text_exist_result_text('succees', 'succees') + else: + print('error') + commonFuc().check_text_exist_result_text('error', 'succees') + +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'] - print('list_a', list_a) - viewId = "viewId" - settlement = 'settlement' - recTemperature = 'recTemperature' - recHumidity = 'recHumidity' - hosGoodsId='hosGoodsId' - distrQty='distrQty' - distrPkgQty='distrPkgQty' - for i in list_a: - for j in i: - viewId = j["viewId"] - settlement = j["settlement"] - recTemperature = j['recTemperature'] - recHumidity = j['recHumidity'] - hosGoodsId= j['hosGoodsId'] - distrQty= j['distrQty'] - distrPkgQty=j['distrPkgQty'] - - break - # ==============================查看订单详情================== - # ========设置验收全部合格 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "check_barcode_save_url") - print('check_barcode_save_url', url) - sourceBillId = sourceId - request_body = commonFuc().get_business_data(module, "payload2", sourceBillId, viewId) - - print('设置验收全部合格request_body',request_body) - # 发送请求 - time.sleep(6) + 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_1008', 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 + ) - while True: - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - data = commonFuc().analysis_json('data', result) - code= commonFuc().analysis_json('code', result) - print(code) - if code ==0 and data==100: - break - else: - print('设置产品合格出现问题') - time.sleep(6) - continue - - # ========设置验收全部合格 - # =============提交验收单======================== - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "check_submit_url") - deptId = recOrgId - deptName = recOrgName - provId = sourceOrgId - provName = sourceOrgName - createUser = uxid - sourceNo = sourceId - checkQty=distrQty - checkPkgQty=distrPkgQty - time.sleep(6) - request_body = commonFuc().get_business_data(module, "payload3", billMode, branch_id, deptId, deptName, hos_id, - provId, provName, recOrgId, recOrgName, sourceId, sourceVersion, - sourceType, tbStatus, createUser, sourceNo, viewId, hosGoodsId,viewId, settlement, - checkQty,distrPkgQty,checkPkgQty,recTemperature, recHumidity) - - print('request_body', '提交验收单', request_body) - # 发送请求 - while True: - time.sleep(3) - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - CHECK_NO = commonFuc().analysis_json('data', result) - code = commonFuc().analysis_json('code', result) - if code == 0: - break - - info = (CHECK_NO, CHECK_NO) - titlename = ('CHECK_NO1', 'CHECK_NO2') - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '验收单号', titlename, 'message15') - - -# 入库上架 -def putaway(): - # # 登录获取用户id等信息,使用创建的用户登录===========开始 - info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3') - # print(info) - username = info['username1'] - - password = commonFuc().get_business_data("b2_herp3_bs", "password") - # username = '001f90380' - # password='1qaz!QAZ' - print('username,password', username, password) - # # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - # # 获取token和projectCode - token, projectCode, uxid, corpId, info = login_system(username, password).get_token() - # 登录获取用户id等信息,使用创建的用户登录============结束 - # =====================上架入库列表查询========================== - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "stock_in_page_url") - print(url) - branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"] - hosId = branch_id[0:5] - request_body = commonFuc().get_business_data(module, "payload6", branch_id, hosId) - result = commonFuc().http_post(url, request_body, headers) + # 对比预期值和实际值是否一致 + 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) - data = commonFuc().analysis_json('data', result) - total = commonFuc().analysis_json('total', data) - if total >= 1: - # 将上架入库列表数据写入文件 - data = commonFuc().analysis_json('data', result) - data1 = commonFuc().analysis_json('data', data) - list_a = [] - list_b = [] - list_c = [] - list_a.append(data1) - list_b.append(data1) - list_c.append(data1) - # print('list_a', len(list_a), list_a) - info = (list_a, list_b, list_c) - titlename = ('list_a', 'list_b', 'list_c') - # 将验收单详细信息写入到文件中 - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '上架入库列表数据', titlename, 'message16') - # =====================上架入库列表查询========================== - # =============查看验收单详情======================== - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "stock_detail_url") - print('查看验收单详情',url) - deptid1 = FileUtils().r_info8('b2_herp3_bs', '所有科室id', 'message6')["deptid1"] - areaCode = FileUtils().r_info8('b2_herp3_bs', 'shelfinfo', 'message7')["shelfCode"] - branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"] - hosId = branch_id[0:5] - # 从message16文件中获取信息 - info = FileUtils().r_info8('b5_spd3_core_business_flow', "上架入库列表数据", 'message16') + 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'] - print('list_a', list_a) - sourceId = 'sourceId' - for i in list_a: - for j in i: - sourceId = j['sourceId'] - break - # 从message13文件中获取信息 - info = FileUtils().r_info8('b5_spd3_core_business_flow', "验收单信息", 'message13') - # print('info', info) + bar_id = get_id("select bar_id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1;" % ( + pid)) + bar_code = get_id("select bar_code from mcms_out_balance_detail where pid='%s' order by id LIMIT 1;" % ( + pid)) + from_id = get_id( + "select from_id from mcms_out_balance_detail where pid='%s' order by id LIMIT 1;" % (pid)) + 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='RK_YS' 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_1008_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'] - print('list_a', list_a) - sourceType = "sourceType" - for i in list_a: - print('i', i) - for j in i: - sourceType = j["sourceType"] - break - - request_body = commonFuc().get_business_data(module, "payload4", deptid1, areaCode, hosId, sourceId, sourceType) - - print('request_body', 'd', 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_1008_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) - # 将验收单详情写入文件 - data = commonFuc().analysis_json('data', result) - list_a = [] - list_b = [] - list_c = [] - list_a.append(data) - list_b.append(data) - list_c.append(data) - # print('list_a', len(list_a), list_a) - info = (list_a, list_b, list_c) - titlename = ('list_a', 'list_b', 'list_c') - # 将验收单详细信息写入到文件中 - FileUtils().w_info8(info, 'b5_spd3_core_business_flow', '验收单库存详情信息', titlename, 'message17') - time.sleep(6) - # ============= # =============查看验收单详情================================================ - # ================================入库上架=================== - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "stock_detail_submit_url") - print(url) - viewId = 'viewId' - shelfCode = 'shelfCode' - sourceId = 'sourceId' - sourceType = 'PSD' - sourceVersion = '0' - targetDeptId = deptid1 - targetDeptName = 'targetDeptName' - targetAreaCode = 'targetAreaCode' - targetAreaName = 'targetAreaName' - # 从message17文件中获取信息 - info = FileUtils().r_info8('b5_spd3_core_business_flow', "验收单库存详情信息", 'message17') - # print('info', info) + 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'] - print('list_a', list_a) - for i in list_a: - print('i', i) - for j in i: - viewId = j["viewId"] - shelfCode = j['shelfCode'] - sourceId = j['id'] - break - # 从message16文件中获取信息 - info = FileUtils().r_info8('b5_spd3_core_business_flow', "上架入库列表数据", 'message16') + 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_1009', 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'] - print('list_a', list_a) - for i in list_a: - for j in i: - sourceId = j['sourceId'] - targetAreaName = j['areaName'] - targetAreaCode = j['areaCode'] - break - request_body = commonFuc().get_business_data(module, "payload5", viewId, shelfCode, sourceId, sourceType, - sourceVersion, targetDeptId, - targetDeptName, targetAreaCode, targetAreaName) - print('request_body', request_body) - time.sleep(3) - 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)) + # 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)) + from_id = get_id( + "select from_id from mcms_out_balance_detail where id='%s';" % (id)) + from_order_no = get_id( + "select from_order_no from mcms_out_balance_detail 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_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='RK_YS' 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_1009_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) - # ================================入库上架================================ - - -# def settle(): # 结算相关 -# # # 登录获取用户id等信息,使用创建的用户登录===========开始 -# info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3') -# # print(info) -# username = info['username1'] -# password = commonFuc().get_business_data("b2_herp3_bs", "password") -# -# print('username,password', username, password) -# # # print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') -# # # 获取token和projectCode -# token, projectCode, uxid, corpId, info = login_system(username, password).get_token() -# # 登录获取用户id等信息,使用创建的用户登录============结束 -# headers = commonFuc().get_business_data(module, "json_headers2", -# commonFuc().get_business_data(module, "json_contentType"), token, -# projectCode) -# # ================生成结算单列表查询=================== -# url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "mcmsOutUnBalance_listVoPage_url") -# print(url) -# branch_id = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_id"] -# hosId = branch_id[0:5] -# request_body = commonFuc().get_business_data(module, "payload7", hosId, hosId) -# result = commonFuc().http_post(url, request_body, headers) -# print('result', result) -# data = commonFuc().analysis_json('data', result) -# data1 = commonFuc().analysis_json('data', data) -# # 取结算单id -# list_a = [] -# for i in data1: -# id = commonFuc().analysis_json('id', i) -# list_a.append(id) -# print(list_a) -# print(list_a[0], list_a[1], type(list_a[0])) -# # ===================生成结算单列表查询====================== -# # ================== 生成结算单============================== -# url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, -# "mcmsOutUnBalance_genBalanceBill_url") -# print(url) -# request_body = commonFuc().get_business_data(module, "payload8", hosId, list_a[0], list_a[1], hosId) -# print('request_body', request_body) -# result = commonFuc().http_post(url, request_body, headers) -# 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_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'] + 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') +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_a7流程五_中心库入库结算_正结算3_内网验收入库结算.air') +using(pro_path + r'//air_case/b5_spd3_core_business_flow/a_a7流程五_中心库入库结算_正结算3_内网验收入库结算.air') +from a_a7流程五_中心库入库结算_正结算3_内网验收入库结算 import check_accept_order,putaway try: - # 验收 - check_accept_order(1) # 低值 + # # 验收 + check_accept_order(3) # 试剂 + time.sleep(6) + check_mcms_check(3) + time.sleep(3) check_accept_order(2) # 高值 - check_accept_order(3) # 试剂 + time.sleep(6) + check_mcms_check(2) + time.sleep(3) + check_accept_order(1) # 低值 + time.sleep(6) + check_mcms_check(1) # 入库上架 putaway() + time.sleep(6) + check_mcms_psi(1) putaway() + time.sleep(6) + check_mcms_psi(2) putaway() + time.sleep(6) + check_mcms_psi(3) + time.sleep(3) OBD_ID = settle()# 生成结算单 - # 调用审批结算单 + print(OBD_ID) + time.sleep(6) + check_mcms_out_balance(1, OBD_ID) # 检查审批前的结算数据 + # # 调用审批结算单 approval_center(OBD_ID) + time.sleep(6) + check_mcms_out_balance_approve_after(1, OBD_ID) # 检查审批后的结算数据 + commonFuc().check_text_exist_result_text('succees', 'succees') + except Exception as e: print('脚本出现异常,请检查脚本或者数据') print("发生异常:", str(e)) diff --git "a/air_case/b6_spd3_core_business_flow_database_check/a_a8\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\244\226\347\275\221\345\274\200\347\245\250_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a8\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\244\226\347\275\221\345\274\200\347\245\250_\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_a8\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\244\226\347\275\221\345\274\200\347\245\250_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a8\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\244\226\347\275\221\345\274\200\347\245\250_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.py" index 0bc8be6c454a629b9fef1a3ff766563aa65e4978..d293d03a7d774ca7a26efad7aa247853ce708064 100644 --- "a/air_case/b6_spd3_core_business_flow_database_check/a_a8\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\244\226\347\275\221\345\274\200\347\245\250_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a8\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\244\226\347\275\221\345\274\200\347\245\250_\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_a8\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\244\226\347\275\221\345\274\200\347\245\250_\346\225\260\346\215\256\345\272\223\351\252\214\350\257\201.air/a_a8\346\265\201\347\250\213\344\272\224_\344\270\255\345\277\203\345\272\223\345\205\245\345\272\223\347\273\223\347\256\227_\346\255\243\347\273\223\347\256\2273_\345\244\226\347\275\221\345\274\200\347\245\250_\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 @@ -26,365 +27,333 @@ import time module = "b6_spd3_core_business_flow_database_check" -def invoice(): - # # 登录获取用户id等信息,使用创建的用户登录===========开始 - info = FileUtils().r_info8('b5_spd3_core_business_flow', "供货关系申请2", 'message') - # print(info) - username = info['e_username'] - password = commonFuc().get_business_data("b2_herp3_bs", "password1") - token, projectCode, uxid, corpId, info = login(username, password) - # print(token, projectCode, uxid, corpId, info) - # 登录获取用户id等信息,使用创建的用户登录============结束 - module = "a6_mdm3_si" - # 发票录入列表查询================================================= - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listGoodsPage_url") - print('发票录入列表查询url', url) - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - - request_body = commonFuc().get_business_data(module, "payload2_1_1", get_hosid(), get_branch_id()) - - # print('request_body',request_body) - # 发送请求 - i = 1 - while True: - time.sleep(6) - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - try: - data = commonFuc().analysis_json('data', result) - total = commonFuc().analysis_json('total', data) - if total == 0: - print('数据暂时未同步过来,或者内网没有生成结算单') - i = i + 1 - if i >= 100: - print('600秒过去了,数据还未查询出来,调用一下内网结算函数') - settle() - approval_center() - continue - else: - break - except: - continue - - # 将发票信息写入文件 - data = commonFuc().analysis_json('data', result) - data1 = commonFuc().analysis_json('data', data) - list_a = [] - list_b = [] - list_c = [] - list_a.append(data1[0]) - list_b.append(data1[0]) - list_c.append(data1[0]) - # print('list_a', len(list_a), list_a) - info = (list_a, list_b, list_c) - titlename = ('list_a', 'list_b', 'list_c') - # 将发票信息写入文件 - FileUtils().w_info8(info, module, '结算开票信息', titlename, 'message') - # 发票录入列表查询================================================= - # ===========发票暂存======================================= - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "saveCacheBatch_url") - print(url) - # 从文件中获取必要信息 - info = FileUtils().r_info8(module, "结算开票信息", 'message') - # print('info', info) - list_a = info['list_a'] - print('list_a', list_a, type(list_a), len(list_a)) - pid = 'pid' - settleMonth = "settleMonth" - hosGoodsId = 'hosGoodsId' - batchCode = 'batchCode' - distrDetailId = 'distrDetailId' - distrId = 'distrId' - distrOrderNo = 'distrOrderNo' - settlePrice = 'settlePrice' - maxSettleQty = 'maxSettleQty' - maxSettleAmount = 'maxSettleAmount' - curSettleQty = 'curSettleQty' - curSettleAmount = 'curSettleAmount' - leftSettleQty = 'leftSettleQty' - leftSettleAmount = 'leftSettleAmount' - hosId = 'hosId' - provId = 'provId' - branchId = 'branchId' - balanceDetId = 'balanceDetId' - purMode = 'purMode' - barCode = 'barCode' - viewId = 'viewId' - for i in list_a: - pid = i['pid'] - settleMonth = i['settleMonth'] - hosGoodsId = i['hosGoodsId'] - detailList = i['detailList'] - for j in detailList: - batchCode = j['batchCode'] - distrDetailId = j['distrDetailId'] - distrId = j['distrId'] - distrOrderNo = j['distrOrderNo'] - settlePrice = j['settlePrice'] - # maxSettleQty = j['leftSettleQty'] - # maxSettleAmount = j['leftSettleAmount'] - # curSettleQty = j['curSettleQty'] - # curSettleAmount = j['curSettleAmount'] - # leftSettleQty = j['leftSettleQty'] - leftSettleAmount = j['leftSettleAmount'] - hosId = j['hosId'] - provId = j['provId'] - branchId = j['branchId'] - balanceDetId = j['balanceDetId'] - purMode = j['purMode'] - barCode = j['barCode'] - viewId = j['viewId'] - break - list2 = [] - detailList = None - for i in list_a: - detailList = i['detailList'] - list2 = detailList - for k in list2: - maxSettleQty = k['leftSettleQty'] - maxSettleAmount = k['settlePrice'] - curSettleQty = k['curSettleQty'] - curSettleAmount = k['curSettleAmount'] - leftSettleQty = k['leftSettleQty'] - - request_body = commonFuc().get_business_data(module, "payload3_1_1_1", pid, settleMonth, hosGoodsId, batchCode, - distrDetailId, distrId, distrOrderNo, settlePrice, maxSettleQty, - maxSettleAmount, curSettleQty, curSettleAmount, leftSettleQty, - leftSettleAmount, hosId, - provId, - branchId, balanceDetId, purMode, barCode, viewId) - print('request_body', request_body) - - request_body_json = get_process_list(request_body) - result = commonFuc().http_post(url, request_body_json, headers) - print('发票暂存result', result) - # ===========发票暂存=============================================== - # ==============发票缓存提交=========================================== - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitCache_url") - hosVersion = 3 - hosName = commonFuc().get_business_data(module, 'hosName') - invoiceQty = leftSettleQty - invoiceAmount = leftSettleAmount - invoiceDate = timeUtils().get_time_hms(5) - request_body = commonFuc().get_business_data(module, "payload3_2_2_2_1", hosName, invoiceQty, invoiceAmount, - invoiceDate, hosId, provId,hosVersion) - print('发票缓存提交request_body', request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('发票缓存提交result', result) - VI_id = commonFuc().analysis_json('billIds', - commonFuc().analysis_json('data', result)) - VI_id= ' '.join(VI_id) - print('VI_id',VI_id) - # ==============发票缓存提交=========================================== - # ===============预开票列表查询==================================== - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url1") - request_body = commonFuc().get_business_data(module, "payload3_3_1") - print('预开票列表查询request_body', request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('预开票列表查询', 'result', result) - - provName= commonFuc().analysis_json('provName', - commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))) - sumAmount= commonFuc().analysis_json('sumAmount', - commonFuc().analysis_json('data', commonFuc().analysis_json('data', result))) - - # ===============预开票列表查询==================================== - # ===============预开票提交==================================== - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "mcmsOutBalance_submitInvoice_url") - lastModified = timeUtils().get_time_hms(1) - createTime = timeUtils().get_time_hms(1) - invoiceTitle = hosName - settleMonths=settleMonth - request_body = commonFuc().get_business_data(module, "payload3_3_2", VI_id, lastModified, createTime, uxid, - get_hosid(), provId, provName, invoiceAmount, invoiceDate, - settleMonths, invoiceQty, hosName, invoiceTitle, sumAmount) - print('预开票提交request_body', request_body) - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('预开票提交', 'result', result) - # ===============预开票提交==================================== - # ===============发票确认列表查询 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url1") - - request_body = commonFuc().get_business_data(module, "payload3_3") - - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('发票确认列表查询result', result) - data = commonFuc().analysis_json('data', result) - data1 = commonFuc().analysis_json('data', data) - id1 = commonFuc().analysis_json('id', data1[0]) - print(id1) - - # ===============发票确认列表查询 - # ===============发票确认 - url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "invoiceUpdateStatus_url") - - request_body = commonFuc().get_business_data(module, "payload3_4", id1) - - # 发送请求 - result = commonFuc().http_post(url, request_body, headers) - print('发票确认result', result) - # ===============发票确认 - # ==============内网发票核对============ - module = "b5_spd3_core_business_flow" - # # 登录获取用户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等信息,使用创建的用户登录============结束 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "mcmsInvoice_listVoPage_url") - print('url', url) - # 获取请求头信息 - headers = commonFuc().get_business_data(module, "json_headers2", - commonFuc().get_business_data(module, "json_contentType"), token, - projectCode) - request_body = commonFuc().get_business_data(module, "payload9", timeUtils().get_time_hms(5), - timeUtils().get_time_hms(5), get_hosid(), get_hosid()) - print('request_body', request_body) - # 发送请求 - i = 1 - while True: - time.sleep(6) - result = commonFuc().http_post(url, request_body, headers) - print('result', result) - try: - data = commonFuc().analysis_json('data', result) - total = commonFuc().analysis_json('total', data) - if total == 0: - print('数据暂时未同步过来') - i = i + 1 - if i >= 100: - print('600秒过去了,数据还未查询出来,检查一下脚本或者被测软件') - continue - else: - break - except: - continue - - print('result', '内网发票核对', result) - data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)) - VI_id = commonFuc().analysis_json('id', data1[0]) - print('VI_id', VI_id) - # ==============发票列表查询 - # ==============发票核对提交 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, - "mcmsInvoice_invoiceUpdateStatusList_url") - print('url', url) - request_body = commonFuc().get_business_data(module, "payload10", VI_id, get_hosid()) - print('request_body', request_body) - result = commonFuc().http_post(url, request_body, headers) +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_1009', id, + hos_id, prov_id, prov_name, invoice_date, settle_months, 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_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_1009_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) + 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) - # ==============发票核对提交 - # ==============内网发票核对============ - # ==============内网发票提交开始 - # 列表查询 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, - "mcmsInvoice_listVoPage_url") - print('内网发票提交url', url) - request_body = commonFuc().get_business_data(module, "payload11", timeUtils().get_time_hms(5), - timeUtils().get_time_hms(5), get_hosid(), get_hosid()) - print('内网发票提交request_body', request_body) - result = commonFuc().http_post(url, request_body, headers) - print('result', '内网发票提交列表查询结果', result) - data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)) - total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result)) - VI_id2='VI_id2' - if total == 0: - print('检查被测程序,发票提交列表查询数据是否正确') + if actual_value2 == expected_value2: + print('ok') + commonFuc().check_text_exist_result_text('succees', 'succees') else: - for i in range(total): - VI_id2 = commonFuc().analysis_json('id', data1[i]) - if VI_id2 == VI_id: - break - print('VI_id2', VI_id2) - # ==============发票提交,下一步归档 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, - "mcmsInvoice_invoiceUpdateStatusList_url") - print('url', url) - request_body = commonFuc().get_business_data(module, "payload12", VI_id, get_hosid()) - print('request_body', request_body) - result = commonFuc().http_post(url, request_body, headers) - print('result', '发票提交,下一步归档', result) - # ==============发票提交,下一步归档 - # ==============发票归档列表查询 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, - "mcmsInvoice_listVoPage_url") - print('url', url) - request_body = commonFuc().get_business_data(module, "payload13", timeUtils().get_time_hms(5), - timeUtils().get_time_hms(5), get_hosid(), get_hosid()) - print('request_body', request_body) - result = commonFuc().http_post(url, request_body, headers) - print('result', '发票归档列表查询', result) - data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)) - total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result)) - VI_id3='VI_id3' - if total == 0: - print('检查被测程序,发票归档列表查询查询数据是否正确') + 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_1009', 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: - for i in range(total): - VI_id3 = commonFuc().analysis_json('id', data1[i]) - if VI_id3 == VI_id2: - break - print('VI_id3', VI_id3) - # ==============发票归档列表查询 - # ==================发票归档提交 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, - "mcmsInvoice_invoiceUpdateStatusList_url") - print('url', url) - request_body = commonFuc().get_business_data(module, "payload14", VI_id, get_hosid()) - print('request_body', request_body) - result = commonFuc().http_post(url, request_body, headers) - print('result', '发票归档提交,下一步付款', result) - # ==================发票归档提交 - # ==================付款单列表查询 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, - "mcmsInvoice_listVoPage_url") - print('url', url) - request_body = commonFuc().get_business_data(module, "payload15", get_hosid(), get_hosid()) - print('request_body', request_body) - result = commonFuc().http_post(url, request_body, headers) - print('result', '付款单列表查询', result) - data1 = commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)) - total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result)) - VI_id4='VI_id4' - if total == 0: - print('检查被测程序,发票归档列表查询查询数据是否正确') + 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: - for i in range(total): - VI_id4 = commonFuc().analysis_json('id', data1[i]) - if VI_id4 == VI_id3: - break - print('VI_id4', VI_id4) - # ==================付款单列表查询 - # ==================付款提交 - url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, - "mcmsInvoice_genPaymentBills_url") - print('url', url) - request_body = commonFuc().get_business_data(module, "payload16", VI_id, get_hosid()) - print('request_body', request_body) - result = commonFuc().http_post(url, request_body, headers) - print('result', '付款提交', result) - # 断言 - code = commonFuc().analysis_json('code', result) - data = commonFuc().analysis_json('data', result) - if code == 0 and data == 1: - commonFuc().check_text_exist(0, result) + 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: - commonFuc().check_text_exist('error', result) - # ==================付款提交 - # ==============内网发票提交 - # ================发票查询列表页面验证 + print('error') + commonFuc().check_text_exist_result_text('error', 'succees') - # ================发票查询列表页面验证 try: @@ -393,6 +362,12 @@ try: approval_center(OBH_ID) from air_case.public1.public1.public1 import * invoice(2,OBH_ID) + time.sleep(6) + # 检查发票数据 + check_mcms_invoice() + time.sleep(3) + # 检查付款单数据 + check_mcms_invoice_ext() except Exception as e: print('脚本出现异常,请检查脚本或者数据') print("发生异常:", str(e)) diff --git a/common/db/sql/sql_del_branch_info.py b/common/db/sql/sql_del_branch_info.py index 85d024fa02375622f782a93b780749ed8e0a04e1..b27538444268bea77692227b34c7576dab0830e4 100644 --- a/common/db/sql/sql_del_branch_info.py +++ b/common/db/sql/sql_del_branch_info.py @@ -270,12 +270,13 @@ class delData(object): print('内网供应关系删除成功 ') cursor.close() - def Del_reporter_data(self): + def Del_reporter_data(self,type=1,branch_id='branch_id'): connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_report_hospitaltest2", charset="utf8") cursor = connection.cursor() - branch_id = FileUtils().r_info8('b2_herp3_bs', "院区新增", 'message')['branch_id'] + if type==1: + branch_id = FileUtils().r_info8('b2_herp3_bs', "院区新增", 'message')['branch_id'] sql = "delete from mcms_finance_daybook where branch_id= '%s';" % branch_id cursor.execute(sql) cursor.execute("commit;") @@ -299,14 +300,16 @@ class delData(object): print('报表数据删除成功') cursor.close() - def Delete_business_Data(self): + def Delete_business_Data(self,type=1,branch_id='branch_id'): # 删除业务数据,包括采购,出入库,结算等 connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2", charset="utf8") cursor = connection.cursor() - branch_id = FileUtils().r_info8('b2_herp3_bs', "院区新增", 'message')['branch_id'] + if type==1: + branch_id = FileUtils().r_info8('b2_herp3_bs', "院区新增", 'message')['branch_id'] + 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'] @@ -320,9 +323,8 @@ class delData(object): cursor.execute(sql2) cursor.execute(sql3) cursor.execute("commit;") - # 批次 - sql = "delete from mcms_hos_batch where branch_id='%s'" % branch_id + sql = "delete from mcms_hos_batch where branch_id='%s';" % branch_id cursor.execute(sql) cursor.execute("commit;") # 库存 @@ -462,7 +464,170 @@ class delData(object): print('业务数据,包括采购,出入库,结算等数据删除成功') cursor.close() + def Delete_business_Data_current_branch(self,type=1,branch_id='branch_id'): + + # 删除业务数据,包括采购,出入库,结算等 + connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", + database="spd3_herp_test2", + charset="utf8") + cursor = connection.cursor() + if type==1: + branch_id = FileUtils().r_info8('b2_herp3_bs', "院区新增", 'message')['branch_id'] + + 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;") + # 批次 + sql = "delete from mcms_hos_batch where branch_id='%s';" % branch_id + cursor.execute(sql) + cursor.execute("commit;") + # 库存 + sql1 = "delete from mcms_stockpile where branch_id='%s';" % branch_id + sql2 = "delete from mcms_stockpile_taking where hos_goods_id in('%s','%s','%s');" % ( + hosGoodsId1, hosGoodsId2, hosGoodsId3) + sql3 = "delete from mcms_stockpile_flow where branch_id='%s';" % branch_id + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute("commit;") + # 采购 + sql = "delete from mcms_purchase_detail where order_no in(select order_no from mcms_purchase where branch_id='%s');" % branch_id + cursor.execute(sql) + cursor.execute("commit;") + + sql = "delete from mcms_pur_plan_detail where prov_name like '%国药集团公司_____';" + cursor.execute(sql) + cursor.execute("commit;") + + sql = "delete from mcms_pur_plan where branch_id= '%s';" % branch_id + cursor.execute(sql) + cursor.execute("commit;") + + sql = "delete from mcms_purchase where branch_id= '%s';" % branch_id + cursor.execute(sql) + cursor.execute("commit;") + + dept1 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1'] + dept2 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2'] + dept3 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3'] + dept4 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid4'] + + # 拣货单 + sql4 = "delete from mcms_pick_detail where pid in(select id from mcms_pick where branch_id='%s');" % branch_id + sql1 = "delete from mcms_pick where branch_id= '%s';" % branch_id + sql2 = "delete from mcms_pick_gen where dept_id in('%s','%s','%s','%s')" % (dept1, dept2, dept3, dept4) + sql3 = "delete from mcms_pick_batch where hos_goods_id in('%s','%s','%s')" % ( + hosGoodsId1, hosGoodsId2, hosGoodsId3) + cursor.execute(sql4) + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute("commit;") + + # 验收单 + sql1 = "delete from mcms_check where branch_id ='%s';" % branch_id + sql2 = "delete from mcms_check_batch where hos_goods_id in('%s','%s','%s')" % ( + hosGoodsId1, hosGoodsId2, hosGoodsId3) + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute("commit;") + + # 配送单 + sql1 = "delete from hdi_distr_barcode where pid in(select id FROM hdi_distr where branch_id='%s');" % branch_id + sql2 = "delete from hdi_distr where branch_id='%s';" % branch_id + sql3 = "delete from hdi_distr_detail where hos_goods_id in('%s','%s','%s')" % ( + hosGoodsId1, hosGoodsId2, hosGoodsId3) + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute("commit;") + # 单据 + sql1 = "delete from mcms_psi where target_branch_id='%s';" % branch_id + sql6 = "delete from mcms_psi where target_dept_name like '%国药集团公司_____';" + sql2 = "delete from mcms_psi_batch where hos_goods_id in('%s','%s','%s');" % ( + hosGoodsId1, hosGoodsId2, hosGoodsId3) + sql3 = "delete from mcms_psi_dept where target_branch_id='%s';" % branch_id + sql4 = "delete from mcms_psi_dept_batch where hos_goods_id in('%s','%s','%s');" % ( + hosGoodsId1, hosGoodsId2, hosGoodsId3) + sql5 = "delete from his_order where branch_id='%s';" % branch_id + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute(sql4) + cursor.execute(sql5) + cursor.execute(sql6) + cursor.execute("commit;") + + # 手术通知单 + sql1 = "delete from mcms_operation_apply where branch_id='%s';" % branch_id + sql2 = "delete from mcms_operation_apply_list where hos_goods_id in('%s','%s','%s');" % ( + hosGoodsId1, hosGoodsId2, hosGoodsId3) + sql3 = "delete from mcms_operation_notice where branch_id='%s';" % branch_id + sql4 = "delete from mcms_operation_notice_list where hos_goods_id in('%s','%s','%s');" % ( + hosGoodsId1, hosGoodsId2, hosGoodsId3) + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute(sql4) + cursor.execute("commit;") + # 结算 + sql1 = "delete from mcms_out_balance where branch_id='%s';" % branch_id + sql2 = "delete from mcms_out_balance_detail where prov_name like '%国药集团公司_____';" + sql3 = "delete from mcms_out_un_balance where branch_id='%s';" % branch_id + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute("commit;") + # 发票 + sql1 = "delete from mcms_invoice where prov_name like '%国药集团公司_____';" + sql2 = "delete from mcms_invoice_comment where pid in(select invoice_id from mcms_invoice_ext_detail where pid in(select id from mcms_invoice_ext where prov_name like '%国药集团公司_____'));" + sql3 = "delete from mcms_invoice_ext_detail where pid in(select id from mcms_invoice_ext where prov_name like '%国药集团公司_____');" + sql4 = "delete from mcms_invoice_ext where prov_name like '%国药集团公司_____';" + sql5 = "delete from mcms_invoice_detail where branch_id='%s';" % branch_id + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute(sql4) + cursor.execute(sql5) + cursor.execute("commit;") + # 退货 + sql1 = "delete from yb_return_batch where pid in(select id from yb_return where prov_name like '%国药集团公司_____');" + sql2 = "delete from yb_return where prov_name like '%国药集团公司_____';" + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute("commit;") + # 请领单 + sql1 = "delete from mcms_dept_buy_detail where pid in (select id from mcms_dept_buy where branch_id='%s');" % branch_id + sql2 = "delete from mcms_dept_buy where branch_id='%s';" % branch_id + sql3 = "delete from mcms_dept_buy_car where branch_id='%s';" % branch_id + sql4 = "delete from mcms_dept_patient where id ='自动化测试';" + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute(sql4) + cursor.execute("commit;") + # 报表 + sql1 = "delete from portal_card where branch_id='%s';" % branch_id + sql2 = "delete from portal_chart where branch_id='%s';" % branch_id + sql3 = "delete from portal_worklist where branch_id='%s';" % branch_id + cursor.execute(sql1) + cursor.execute(sql2) + cursor.execute(sql3) + cursor.execute("commit;") + + print('业务数据,包括采购,出入库,结算等数据删除成功') + cursor.close() def Delete_yb_logic_stock(self): connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_platform_test2", @@ -818,6 +983,27 @@ class delData(object): cursor.execute("commit;") print('库区人员信息删除成功 ') cursor.close() + def get_branch_id_bydb(self,no_branch_id): + # 内网的 + connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2", + charset="utf8") + cursor = connection.cursor() + # 查询脚本创建的的院区 + sql1 = "select id from mcms_branch_info where name like '%%东土城路院区%%' and id <>'%s';"%no_branch_id + cursor.execute(sql1) + # results = cursor.fetchone() + results = cursor.fetchall() + list_1=[] + for i in results: + str1 = str(i) + new_str1 = str1.replace(',)', '') + new_str1 = new_str1.replace('(', '') + new_str1 = new_str1.replace(',', '') + new_str1 = new_str1.replace("'", '') + list_1.append(new_str1) + # print(new_str1) + cursor.close() + return list_1 # delData().Delete_branch_by_id() # delData().Delete_goods_change_info() diff --git a/data/b6_spd3_core_business_flow_database_check/data b/data/b6_spd3_core_business_flow_database_check/data index 3fd194c1fa0c8940f1c8a8dfa867773ddff85931..13587d08d0afa62e08d5046fc697be64a026406b 100644 --- a/data/b6_spd3_core_business_flow_database_check/data +++ b/data/b6_spd3_core_business_flow_database_check/data @@ -402,8 +402,8 @@ #手工采购计划子表 "mcms_pur_plan_detail_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": %s, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 10, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "plan_pkg_qty": Decimal("100.00"), "plan_qty": Decimal("10000.00"), "pkg_qty": Decimal("0.00"), "price": Decimal("99.999900"), "qty": Decimal("0.00"), "in_settlement": 1, "supply_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "sub_prov_id": "%s", "sub_prov_name": "%s", "contract_id": None, "remark": None, "close_status": 0, "tb_status": 10, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "coding_type": 0}' -"mcms_pur_plan_detail2_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": %s, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 20, "pkg_def_id": None, "pkg_def_name": None, "pkg_def_qty": Decimal("1.00"), "plan_pkg_qty": Decimal("1.00"), "plan_qty": Decimal("100.00"), "pkg_qty": Decimal("0.00"), "price": Decimal("99.999900"), "qty": Decimal("0.00"), "in_settlement": 1, "supply_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "sub_prov_id": "%s", "sub_prov_name": "%s", "contract_id": None, "remark": None, "close_status": 0, "tb_status": 10, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "coding_type": 0}' -"mcms_pur_plan_detail3_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": %s, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 60, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "plan_pkg_qty": Decimal("100.00"), "plan_qty": Decimal("1000.00"), "pkg_qty": Decimal("0.00"), "price": Decimal("99.999900"), "qty": Decimal("0.00"), "in_settlement": 1, "supply_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "sub_prov_id": "%s", "sub_prov_name": "%s", "contract_id": None, "remark": None, "close_status": 0, "tb_status": 10, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "coding_type": 0}' +"mcms_pur_plan_detail2_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": %s, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 20, "pkg_def_id": None, "pkg_def_name": None, "pkg_def_qty": Decimal("1.00"), "plan_pkg_qty": Decimal("100.00"), "plan_qty": Decimal("100.00"), "pkg_qty": Decimal("0.00"), "price": Decimal("99.999900"), "qty": Decimal("0.00"), "in_settlement": 1, "supply_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "sub_prov_id": "%s", "sub_prov_name": "%s", "contract_id": None, "remark": None, "close_status": 0, "tb_status": 10, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "coding_type": 0}' +"mcms_pur_plan_detail3_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": %s, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 60, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "plan_pkg_qty": Decimal("100.00"), "plan_qty": Decimal("10000.00"), "pkg_qty": Decimal("0.00"), "price": Decimal("99.999900"), "qty": Decimal("0.00"), "in_settlement": 1, "supply_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "sub_prov_id": "%s", "sub_prov_name": "%s", "contract_id": None, "remark": None, "close_status": 0, "tb_status": 10, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "coding_type": 0}' #采购计划 "mcms_pur_plan_0927": '{"id": "%s", "order_no": "%s", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "area_code": "%s", "area_name": "%s", "create_type": "SG", "source_id": %s, "source_type": "", "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "%s", "priority": 0, "bill_expdt_date": %s, "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s"}", "remark": "", "close_status": 0, "tb_status": 10, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "last_auditor": None, "last_audit_time": None, "rec_type": "YND", "audit_remark": None}' @@ -412,11 +412,79 @@ #采购订单子表 "mcms_purchase_detail_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 10, "price": Decimal("99.999900"), "supply_id": "%s", "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "pkg_qty": Decimal("100.00"), "qty": Decimal("10000.00"), "con_pkg_qty": Decimal("0.00"), "con_qty": Decimal("0.00"), "up_pkg_qty": Decimal("0.00"), "up_qty": Decimal("0.00"), "check_pkg_qty": Decimal("0.00"), "check_qty": Decimal("0.00"), "distr_pkg_qty": Decimal("0.00"), "distr_qty": Decimal("0.00"), "not_send_qty": Decimal("0.00"), "not_send_pkg_qty": Decimal("0.00"), "in_settlement": 1, "close_type": 1, "detail_relation_json": "{"planBillId":"%s","planDetailId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":10,"goodsName":"%s"}", "remark": None, "tb_status": 10, "detail_up_status":None,"pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}' -"mcms_purchase_detail1_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 20, "price": Decimal("99.999900"), "supply_id": "%s", "pkg_def_id": %s, "pkg_def_name": null, "pkg_def_qty": Decimal("1.00"), "pkg_qty": Decimal("100.00"), "qty": Decimal("100.00"), "con_pkg_qty": Decimal("0.00"), "con_qty": Decimal("0.00"), "up_pkg_qty": Decimal("0.00"), "up_qty": Decimal("0.00"), "check_pkg_qty": Decimal("0.00"), "check_qty": Decimal("0.00"), "distr_pkg_qty": Decimal("0.00"), "distr_qty": Decimal("0.00"), "not_send_qty": Decimal("0.00"), "not_send_pkg_qty": Decimal("0.00"), "in_settlement": 1, "close_type": 1, "detail_relation_json": "{"planBillId":"%s","buyDetailId":"%s","planDetailId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":20,"goodsName":"%s"}", "remark": None, "tb_status": 10, "detail_up_status":None,"pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}' -"mcms_purchase_detail2_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 60, "price": Decimal("99.999900"), "supply_id": "%s", "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "pkg_qty": Decimal("100.00"), "qty": Decimal("10000.00"), "con_pkg_qty": Decimal("0.00"), "con_qty": Decimal("0.00"), "up_pkg_qty": Decimal("0.00"), "up_qty": Decimal("0.00"), "check_pkg_qty": Decimal("0.00"), "check_qty": Decimal("0.00"), "distr_pkg_qty": Decimal("0.00"), "distr_qty": Decimal("0.00"), "not_send_qty": Decimal("0.00"), "not_send_pkg_qty": Decimal("0.00"), "in_settlement": 1, "close_type": 1, "detail_relation_json": "{"planBillId":"%s","buyDetailId":"%s","planDetailId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":60,"goodsName":"%s"}", "remark": None, "tb_status": 10,"detail_up_status":None,"pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}' +"mcms_purchase_detail1_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 20, "price": Decimal("99.999900"), "supply_id": "%s", "pkg_def_id": %s, "pkg_def_name": null, "pkg_def_qty": Decimal("1.00"), "pkg_qty": Decimal("100.00"), "qty": Decimal("100.00"), "con_pkg_qty": Decimal("0.00"), "con_qty": Decimal("0.00"), "up_pkg_qty": Decimal("0.00"), "up_qty": Decimal("0.00"), "check_pkg_qty": Decimal("0.00"), "check_qty": Decimal("0.00"), "distr_pkg_qty": Decimal("0.00"), "distr_qty": Decimal("0.00"), "not_send_qty": Decimal("0.00"), "not_send_pkg_qty": Decimal("0.00"), "in_settlement": 1, "close_type": 1, "detail_relation_json": "{"planBillId":"%s","planDetailId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":20,"goodsName":"%s"}", "remark": None, "tb_status": 10, "detail_up_status":None,"pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}' +"mcms_purchase_detail2_0927": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "pur_mode": 60, "price": Decimal("99.999900"), "supply_id": "%s", "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "pkg_qty": Decimal("100.00"), "qty": Decimal("10000.00"), "con_pkg_qty": Decimal("0.00"), "con_qty": Decimal("0.00"), "up_pkg_qty": Decimal("0.00"), "up_qty": Decimal("0.00"), "check_pkg_qty": Decimal("0.00"), "check_qty": Decimal("0.00"), "distr_pkg_qty": Decimal("0.00"), "distr_qty": Decimal("0.00"), "not_send_qty": Decimal("0.00"), "not_send_pkg_qty": Decimal("0.00"), "in_settlement": 1, "close_type": 1, "detail_relation_json": "{"planBillId":"%s","planDetailId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":60,"goodsName":"%s"}", "remark": None, "tb_status": 10,"detail_up_status":None,"pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}' #采购订单主表 "mcms_purchase_0927": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "rec_type": "YND", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "area_code": "%s", "area_name": "%s", "bill_expdt_date": %s, "source_id": "%s", "source_type": "CGJH", "in_settlement": None, "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s"}", "ext_info": "{"epidemicFlag":0,"purMode":10}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "priority": 0, "close_status": 0, "close_date": %s, "up_status": 0, "tb_status": 30, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": None, "version": 0, "del_flag": 0, "last_auditor": "%s", "last_audit_time": %s}' "mcms_purchase2_0927": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "rec_type": "YND", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "area_code": "%s", "area_name": "%s", "bill_expdt_date": %s, "source_id": "%s", "source_type": "CGJH", "in_settlement": None, "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s"}", "ext_info": "{"epidemicFlag":0,"purMode":20}", "barcode_flag": 1, "pkg_flag": 0, "remark": "", "priority": 0, "close_status": 0, "close_date": %s, "up_status": 0, "tb_status": 30, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": None, "version": 0, "del_flag": 0, "last_auditor": "%s", "last_audit_time": %s}' "mcms_purchase3_0927": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "rec_type": "YND", "hos_id": "%s", "branch_id": "%s", "dept_id": "%s", "dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "area_code": "%s", "area_name": "%s", "bill_expdt_date": %s, "source_id": "%s", "source_type": "CGJH", "in_settlement": None, "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s"}", "ext_info": "{"epidemicFlag":0,"purMode":60}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "priority": 0, "close_status": 0, "close_date": %s, "up_status": 0, "tb_status": 30, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": None, "version": 0, "del_flag": 0, "last_auditor": "%s", "last_audit_time": %s}' + +#手工采购计划_配送单子表 +"hdi_distr_detail_0929": '{"id": "%s", "pid": "%s", "source_id": "%s", "source_detail_id": "%s", "pur_detail_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "goods_name": "%s", "goods_gg": "%s", "pur_mode": "10", "mfrs_id": "%s", "mfrs_name": "德国歌德公司 Geuder AG", "made": "德国", "unit": "支", "pur_price": Decimal("99.999900"), "batch_code": "333", "expdt_date": %s, "product_date": %s, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "supply_id": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "sub_price": Decimal("99.9999"), "distr_price": Decimal("99.9999"), "distr_pkg_qty": Decimal("100.00"), "distr_qty": Decimal("10000.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","planDetailId":"%s","purDetailId":"%s","purBillId":"%s","distrDetailId":"%s","distrBillId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":10,"goodsName":"%s","ygptCode":"","transCond":"","storageCond":"","erpCode":"%s","ybDefId":""}", "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}' +"hdi_distr_detail2_0929": '{"id": "%s", "pid": "%s", "source_id": "%s", "source_detail_id": "%s", "pur_detail_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "goods_name": "%s", "goods_gg": "%s", "pur_mode": "20", "mfrs_id": "%s", "mfrs_name": "德国歌德公司 Geuder AG", "made": "德国", "unit": "支", "pur_price": Decimal("99.999900"), "batch_code": "222", "expdt_date": %s, "product_date": %s, "pkg_def_id": %s, "pkg_def_name": null, "pkg_def_qty": Decimal("1.00"), "supply_id": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "sub_price": Decimal("99.9999"), "distr_price": Decimal("99.9999"), "distr_pkg_qty": Decimal("100.00"), "distr_qty": Decimal("100.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","planDetailId":"%s","purDetailId":"%s","purBillId":"%s","distrDetailId":"%s","distrBillId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":20,"goodsName":"%s","ygptCode":"","transCond":"","storageCond":"","erpCode":"%s","ybDefId":""}", "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}' +"hdi_distr_detail3_0929": '{"id": "%s", "pid": "%s", "source_id": "%s", "source_detail_id": "%s", "pur_detail_id": "%s", "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "goods_name": "%s", "goods_gg": "%s", "pur_mode": "60", "mfrs_id": "%s", "mfrs_name": "德国歌德公司 Geuder AG", "made": "德国", "unit": "支", "pur_price": Decimal("99.999900"), "batch_code": "4444", "expdt_date": %s, "product_date": %s, "pkg_def_id": "%s", "pkg_def_name": "100", "pkg_def_qty": Decimal("100.00"), "supply_id": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "sub_price": Decimal("99.9999"), "distr_price": Decimal("99.9999"), "distr_pkg_qty": Decimal("100.00"), "distr_qty": Decimal("10000.00"), "settlement": 1, "certificate_code": "", "product_cert_code": None, "detail_relation_json": "{"planBillId":"%s","planDetailId":"%s","purDetailId":"%s","purBillId":"%s","distrDetailId":"%s","distrBillId":"%s"}", "ext_info": "{"goodsGg":"%s","goodsCode":"%s","purMode":60,"goodsName":"%s","ygptCode":"","transCond":"","storageCond":"","erpCode":"%s","ybDefId":""}", "tb_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "del_flag": 0}' + + +#手工采购计划_配送单 +"hdi_distr_0929": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "rec_type": "YND", "hos_id": "%s", "hos_name": "%s", "branch_id": "%s", "source_id": "%s", "source_type": "CGD", "pur_bill_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "settlement": None, "pur_dept_id": "%s", "pur_dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "设备科001", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s"}", "ext_info": "{"purMode":10,"confirmTime":"%s","confirmUser":"%s","epidemicFlag":0,"distrUser":"%s"}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "task_id": None, "convert_flag": 1, "convert_time": None, "convert_user_name": None, "reject_status": 0, "tb_status": 20, "create_user": "%s", "create_user_name": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "initial_order": None}' +"hdi_distr1_0929": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "rec_type": "YND", "hos_id": "%s", "hos_name": "%s", "branch_id": "%s", "source_id": "%s", "source_type": "CGD", "pur_bill_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "settlement": None, "pur_dept_id": "%s", "pur_dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "自动化测试", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s"}", "ext_info": "{"purMode":20,"confirmTime":"%s","confirmUser":"%s","epidemicFlag":0,"distrUser":"%s"}", "barcode_flag": 1, "pkg_flag": 0, "remark": "", "task_id": None, "convert_flag": 1, "convert_time": None, "convert_user_name": None, "reject_status": 0, "tb_status": 20, "create_user": "%s", "create_user_name": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "initial_order": None}' +"hdi_distr2_0929": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "rec_type": "YND", "hos_id": "%s", "hos_name": "%s", "branch_id": "%s", "source_id": "%s", "source_type": "CGD", "pur_bill_id": "%s", "prov_id": "%s", "prov_name": "%s", "sub_send_flag": 10, "exe_prov_id": "%s", "exe_prov_name": "%s", "settlement": None, "pur_dept_id": "%s", "pur_dept_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "rec_user": "%s", "rec_phone": "xhs", "rec_addr": "自动化测试", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s"}", "ext_info": "{"purMode":60,"confirmTime":"%s","confirmUser":"%s","epidemicFlag":0,"distrUser":"%s"}", "barcode_flag": 1, "pkg_flag": 1, "remark": "", "task_id": None, "convert_flag": 1, "convert_time": None, "convert_user_name": None, "reject_status": 0, "tb_status": 20, "create_user": "%s", "create_user_name": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "del_flag": 0, "last_auditor": None, "last_audit_time": None, "initial_order": None}' + + +#手工采购计划_验收单主表 +"mcms_check_1008": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "hos_id": "%s", "branch_id": "%s", "source_id": "%s", "source_no": "%s", "source_type": "PSD", "tb_status": 10, "prov_id": "%s", "prov_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "dept_id": "%s", "dept_name": "%s", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "initial_order": None, "remark": ""}' +"mcms_check1_1008": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "hos_id": "%s", "branch_id": "%s", "source_id": "%s", "source_no": "%s", "source_type": "PSD", "tb_status": 10, "prov_id": "%s", "prov_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "dept_id": "%s", "dept_name": "%s", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "initial_order": None, "remark": ""}' +"mcms_check2_1008": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "hos_id": "%s", "branch_id": "%s", "source_id": "%s", "source_no": "%s", "source_type": "PSD", "tb_status": 10, "prov_id": "%s", "prov_name": "%s", "rec_org_id": "%s", "rec_org_name": "%s", "dept_id": "%s", "dept_name": "%s", "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s"}", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "initial_order": None, "remark": ""}' +#手工采购计划_验收单子表 +"mcms_check_batch_1008": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "distr_detail_id": "%s", "pur_mode": 10, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "barcode_id": "%s", "sub_barcode_id": None, "qty": Decimal("100.00"), "reject_qty": Decimal("0.00"), "reject_reason": None, "settlement": 1, "tb_status": 1, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}' +"mcms_check_batch1_1008": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "distr_detail_id": "%s", "pur_mode": 20, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "barcode_id": "%s", "sub_barcode_id": None, "qty": Decimal("1.00"), "reject_qty": Decimal("0.00"), "reject_reason": None, "settlement": 1, "tb_status": 1, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}' +"mcms_check_batch2_1008": '{"id": "%s", "pid": "%s", "order_no": "%s", "source_detail_id": "%s", "distr_detail_id": "%s", "pur_mode": 60, "hos_goods_id": "%s", "mdm_goods_code": "%s", "goods_code": "%s", "barcode_id": "%s", "sub_barcode_id": None, "qty": Decimal("100.00"), "reject_qty": Decimal("0.00"), "reject_reason": None, "settlement": 1, "tb_status": 1, "pur_task_id": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0}' + +#手工采购计划_中心库入库单 +"check_mcms_psi1_1008": '{"id": "%s", "order_no": "%s", "bill_mode": "16", "rec_type": "YND", "psi_flag": 1, "psi_kind": "101", "stock_kind": "RK_YS", "target_corp_id": "%s", "target_branch_id": "%s", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_area_code": "%s", "target_area_name": "自动化测试", "source_id": "%s", "source_no": %s, "source_repl_id": %s, "source_corp_id": "%s", "source_branch_id": None, "source_dept_id": "%s", "source_dept_name": "%s", "source_stock_id": "%s", "source_area_code": None, "source_area_name": None, "remark": None, "tb_status": 30, "accounter": "%s", "account_date": %s, "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s","psiInBillId":"%s","psiInOrderNo":"%s"}", "reject_time": None, "reject_remark": None, "create_user": "%s","create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "last_auditor": None, "last_audit_time": None, "reject_user": None, "initial_order": None, "source_type": "SG", "reject_reason": None, "receipt_status": 0}' +"check_mcms_psi2_1008": '{"id": "%s", "order_no": "%s", "bill_mode": "20", "rec_type": "YND", "psi_flag": 1, "psi_kind": "101", "stock_kind": "RK_YS", "target_corp_id": "%s", "target_branch_id": "%s", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_area_code": "%s", "target_area_name": "自动化测试", "source_id": "%s", "source_no": %s, "source_repl_id": %s, "source_corp_id": "%s", "source_branch_id": None, "source_dept_id": "%s", "source_dept_name": "%s", "source_stock_id": "%s", "source_area_code": None, "source_area_name": None, "remark": None, "tb_status": 30, "accounter": "%s", "account_date": %s, "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s","psiInBillId":"%s","psiInOrderNo":"%s"}", "reject_time": None, "reject_remark": None, "create_user": "%s","create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "last_auditor": None, "last_audit_time": None, "reject_user": None, "initial_order": None, "source_type": "SG", "reject_reason": None, "receipt_status": 0}' +"check_mcms_psi3_1008": '{"id": "%s", "order_no": "%s", "bill_mode": "66", "rec_type": "YND", "psi_flag": 1, "psi_kind": "101", "stock_kind": "RK_YS", "target_corp_id": "%s", "target_branch_id": "%s", "target_dept_id": "%s", "target_dept_name": "%s", "target_stock_id": "%s", "target_area_code": "%s", "target_area_name": "自动化测试", "source_id": "%s", "source_no": %s, "source_repl_id": %s, "source_corp_id": "%s", "source_branch_id": None, "source_dept_id": "%s", "source_dept_name": "%s", "source_stock_id": "%s", "source_area_code": None, "source_area_name": None, "remark": None, "tb_status": 30, "accounter": "%s", "account_date": %s, "bill_relation_json": "{"planBillId":"%s","planOrderNo":"%s","purOrderNo":"%s","purBillId":"%s","purBillDate":"%s","distrBillId":"%s","distrOrderNo":"%s","checkBillId":"%s","checkOrderNo":"%s","psiInBillId":"%s","psiInOrderNo":"%s"}", "reject_time": None, "reject_remark": None, "create_user": "%s","create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "last_auditor": None, "last_audit_time": None, "reject_user": None, "initial_order": None, "source_type": "SG", "reject_reason": None, "receipt_status": 0}' + + +#手工采购计划入库_结算数据主表 +"check_mcms_out_balance_1008": '{"id": "%s", "order_no": "%s", "branch_id": "%s", "hos_id": "%s", "prov_id": "%s", "prov_name": "%s", "settle_dept_id": None, "tb_status": 0, "sum_row": 2, "settle_amount": Decimal("19999.980000"), "settle_way": 0, "settle_month": "%s", "settle_start_time": %s, "settle_end_time": %s, "remark": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "check_msg": None, "settle_qty": Decimal("200.0000"), "check_user": None, "check_time": None}' +#手工采购计划入库_结算数据子表 + +"check_mcms_out_balance_detail_1008_1": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 10, "price": Decimal("99.999900"), "settle_qty": Decimal("100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}' + +"check_mcms_out_balance_detail_1008_2": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 10, "price": Decimal("99.999900"), "settle_qty": Decimal("100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 0, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}' + + +#中心库退货出库_结算数据主表_审批后 +"check_mcms_out_balance_1009": '{"id": "%s", "order_no": "%s", "branch_id": "%s", "hos_id": "%s", "prov_id": "%s", "prov_name": "%s", "settle_dept_id": None, "tb_status": 20, "sum_row": 2, "settle_amount": Decimal("19999.980000"), "settle_way": 0, "settle_month": "%s", "settle_start_time": %s, "settle_end_time": %s, "remark": None, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "check_msg": "22", "settle_qty": Decimal("200.0000"), "check_user": "%s", "check_time": %s}' +#中心库退货出库_结算数据子表_审批后 + +"check_mcms_out_balance_detail_1009_1": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 11, "price": Decimal("99.999900"), "settle_qty": Decimal("100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}' + +"check_mcms_out_balance_detail_1009_2": '{"id": "%s", "pid": "%s", "prov_id": "%s", "prov_name": "%s", "sub_prov_id": "%s", "sub_prov_name": "%s", "out_dept_id": "%s", "out_dept_name": "%s", "account_date": %s, "pur_mode": 10, "from_table": "mcms_psi_batch", "from_id": "%s", "from_order_no": "%s", "hos_goods_id": "%s", "bar_id": "%s", "bar_code": "%s", "distr_detail_id": "%s", "hos_batch_id": "%s", "tb_status": 11, "price": Decimal("99.999900"), "settle_qty": Decimal("100.00"), "invoice_qty": Decimal("0.00"), "settle_amount": Decimal("9999.9900"), "un_settle_id": "%s", "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "settle_type": 1, "contract_id": None, "normal_contract_id": None, "temp_purchase": 0, "hos_id": "%s", "fcat_id": None, "invoice_price": Decimal("99.999900"), "online_kind": "10"}' + +#中心库入库结算_正正结算_开票数据主表 +"check_mcms_invoice_1009": '{"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_1009": '{"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"}' + +#中心库入库结算_正结算_开票数据子表 +"check_mcms_invoice_detail_1009_1": '{"id": "%s", "pid": "%s", "hobd_id": "%s", "branch_id": "%s", "hos_goods_id": "%s", "invoice_qty": Decimal("100.00"), "invoice_amount": Decimal("9999.990000"), "price": Decimal("99.999900"), "invoice_price": Decimal("99.999900"), "filing_time": 1, "settle_month": "%s", "confirm_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "hos_id": "%s", "ext_info": "{"purMode": 10, "oneFcatId": null, "onlineKind": null, "volumeFlag": null, "oneFcatName": null, "purModeText": "低值", "onlineKindText": null, "volumeFlagText": null}"}' +"check_mcms_invoice_detail_1009_2": '{"id": "%s", "pid": "%s", "hobd_id": "%s", "branch_id": "%s", "hos_goods_id": "%s", "invoice_qty": Decimal("100.00"), "invoice_amount": Decimal("9999.990000"), "price": Decimal("99.999900"), "invoice_price": Decimal("99.999900"), "filing_time": 1, "settle_month": "%s", "confirm_status": 0, "create_user": "%s", "create_time": %s, "last_modified": %s, "last_modified_user": "%s", "version": 1, "hos_id": "%s", "ext_info": "{"purMode": 10, "oneFcatId": null, "onlineKind": null, "volumeFlag": null, "oneFcatName": null, "purModeText": "低值", "onlineKindText": null, "volumeFlagText": null}"}' +#中心库入库结算_正结算_付款单主表 +"check_mcms_invoice_ext_1009": '{"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"}' + +#院区数据 +"check_mcms_branch_info": '{"id": "%s", "hos_id": "%s", "name": "%s", "yb_flag": "0", "main_branch": 0, "address": "%s", "province": "11", "city": "1101", "area": "110101", "tb_status": 1, "remark": None, "version": 0, "short_name": None, "create_time": %s, "create_user": "%s", "last_modified": %s, "last_modified_user": "%s"}' +#科室数据 +"check_dept_info0": '{"id": "%s", "pid": "%s", "code": "%s", "self_code": None, "corp_id": "%s", "branch_id": "%s", "corp_kind": "1", "ename": "科室004", "cname": "科室004", "dept_level": 4, "dept_type": "0", "ext1": None, "ext2": None, "ext3": None, "ext4": None, "ext5": None, "dept_cate": 1, "dept_kind": 5, "ordinal": None, "short_pinyin": "ks004", "address": "三级科室004", "contact_way": "三级科室004", "scm_code": None, "erp_code": "004", "remark": None, "node_kind": None, "flag": "1", "last_update_datetime": %s, "version": 0, "create_time": %s, "create_user": "%s", "last_modified_user": "%s", "last_modified": %s, "user_leader_id": None}' +"check_dept_info1": '{"id": "%s", "pid": "%s", "code": "%s", "self_code": None, "corp_id": "%s", "branch_id": "%s", "corp_kind": "1", "ename": "三级检测组003", "cname": "三级检测组003", "dept_level": 3, "dept_type": "0", "ext1": None, "ext2": None, "ext3": None, "ext4": None, "ext5": None, "dept_cate": 1, "dept_kind": 7, "ordinal": None, "short_pinyin": "sjjcz003", "address": "三级检测组003", "contact_way": "12401003250", "scm_code": None, "erp_code": "003", "remark": None, "node_kind": None, "flag": "1", "last_update_datetime": %s, "version": 0, "create_time": %s, "create_user": "%s", "last_modified_user": "%s", "last_modified": %s, "user_leader_id": None}' +"check_dept_info2": '{"id": "%s", "pid": "%s", "code": "%s", "self_code": None, "corp_id": "%s", "branch_id": "%s", "corp_kind": "1", "ename": "二级检验科002", "cname": "二级检验科002", "dept_level": 2, "dept_type": "0", "ext1": None, "ext2": None, "ext3": None, "ext4": None, "ext5": None, "dept_cate": 1, "dept_kind": 7, "ordinal": None, "short_pinyin": "ejjyk002", "address": "二级检验科002", "contact_way": "13401003250", "scm_code": None, "erp_code": "002", "remark": None, "node_kind": None, "flag": "1", "last_update_datetime": %s, "version": 0, "create_time": %s, "create_user": "%s", "last_modified_user": "%s", "last_modified": %s, "user_leader_id": None}' +"check_dept_info3": '{"id": "%s", "pid": "%s", "code": "%s", "self_code": None, "corp_id": "%s", "branch_id": "%s", "corp_kind": "1", "ename": "设备科001", "cname": "设备科001", "dept_level": 1, "dept_type": "1", "ext1": None, "ext2": None, "ext3": None, "ext4": None, "ext5": None, "dept_cate": 1, "dept_kind": 1, "ordinal": None, "short_pinyin": "sbk001", "address": "设备科001", "contact_way": "13401003250", "scm_code": None, "erp_code": "001", "remark": None, "node_kind": None, "flag": "1", "last_update_datetime": %s, "version": 1, "create_time": %s, "create_user": "%s", "last_modified_user": "%s", "last_modified": %s, "user_leader_id": "%s"}' + +#库房数据 +"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}' diff --git a/main1/main_text.py b/main1/main_text.py index 202e3e7c5a31c784c4bdfba362df783c448d6c5f..109474ead5a0cc9f3aad22a19e18f7e6491174c3 100644 --- a/main1/main_text.py +++ b/main1/main_text.py @@ -8,7 +8,7 @@ import traceback from air_case.public1.public1.public1 import approval_center, approval_center_all from common.Logger_Utils import Logger from common.timeUtils import timeUtils - +from common.db.sql.sql_tools import * curPath = os.path.abspath(os.path.dirname(__file__)) # 获取当前文件的所在目录的绝对路径 # print('将路径中的/换成\\', curPath) # C:\Users\Administrator\Desktop\temp\dbshop99\main # # #将当前文件的所在目录的绝对路径进行分离,分离成 ('C:\\Users\\Administrator\\Desktop\\temp\\dbshop99', 'main'),存到元组中 @@ -292,6 +292,8 @@ def main_text(): root = tk.Tk() root.title("删除指定院区数据") + # 设置窗口大小 + root.geometry('200x200') # 计算窗口居中时左上角的坐标 x = (window_width - root.winfo_width()) // 2 y = (window_height - root.winfo_height()) // 2 @@ -299,13 +301,78 @@ def main_text(): root.geometry("+{}+{}".format(x, y)) root.resizable(False, False) combo = ttk.Combobox(root) - combo["values"] = ("选项1", "选项2", "选项3") + branch_id_list=delData().get_branch_id_bydb( FileUtils().r_info8('b2_herp3_bs', "院区新增", 'message')['branch_id']) + for i in branch_id_list: + combo["values"] = (i) + combo.current(0) # 设置默认选项 + combo.bind("<>", dropdown_changed) + combo.pack() + button = tk.Button(root, text="删除此院区数据", command=lambda:button_clicked(i)) + button.pack() + root.mainloop() + + def button_clicked(branch_id): + result = confirm() + if result == True: + result1 = confirm1() + if result1 == True: + print(branch_id) + delData().Delete_goods_change_info() + delData().Delete_probeInfo_other(3, branch_id) + # delData().Del_supply_relation() + delData().Delete_business_Data(2, branch_id) + delData().Del_reporter_data(2, branch_id) + delData().Delete_business_Data_All() + delData().Delete_business_Data_All2() + delData().Delete_branch_by_id(3, branch_id) + print(branch_id, '删除完毕') + + def del_current_brachdata(): + import tkinter as tk + from tkinter import ttk + + def dropdown_changed(event): + value = combo.get() + print(value) + + root = tk.Tk() + root.title("删除当前院区数据") + # 设置窗口大小 + root.geometry('200x200') + # 计算窗口居中时左上角的坐标 + x = (window_width - root.winfo_width()) // 2 + y = (window_height - root.winfo_height()) // 2 + # 设置窗口左上角的坐标 + root.geometry("+{}+{}".format(x, y)) + root.resizable(False, False) + combo = ttk.Combobox(root) + branch_id = FileUtils().r_info8('b2_herp3_bs', "院区新增", 'message')['branch_id'] + + combo["values"] = (branch_id) combo.current(0) # 设置默认选项 combo.bind("<>", dropdown_changed) combo.pack() - + button = tk.Button(root, text="删除此院区数据", command=lambda: button_clicked_del_current_branch(branch_id)) + button.pack() root.mainloop() + + + def button_clicked_del_current_branch(branch_id): + result = confirm() + if result == True: + result1 = confirm1() + if result1 == True: + print(branch_id) + delData().Delete_goods_change_info() + # delData().Delete_probeInfo_other(3, branch_id) + # delData().Del_supply_relation() + delData().Delete_business_Data_current_branch(2, branch_id) + delData().Del_reporter_data(2, branch_id) + # delData().Delete_business_Data_All() + # delData().Delete_business_Data_All2() + #只删除业务数据,不删除当前院区和库房数据 + print(branch_id, '业务数据删除完毕') def get_input(): import tkinter as tk from tkinter import simpledialog @@ -339,12 +406,14 @@ def main_text(): Button(root, text='流程十八\n中心库业务_拆包功能', anchor='center', width=16, height=8, command=flow18).grid(row=4, column=10) Button(root, text='一键执行', anchor='center', width=8, height=2, command=flow0).grid(row=5, column=0) Button(root, text='删除指定\n院区数据', anchor='center', width=8, height=2, command=del_brachdata_from_brachid).grid(row=5, + column=0) + Button(root, text='删除当前\n院区业务\n数据', anchor='center', width=8, height=2, command=del_current_brachdata).grid(row=5, column=2) Button(root, text='流程五开始\n一键执行', anchor='center', width=8, height=2, command=flow5_flow18).grid(row=5, column=4) Button(root, text='删除垃圾\n数据', anchor='center', width=8, height=2, command=del_data).grid(row=5, column=6) Button(root, text='流程十一开始\n一键执行', anchor='center', width=8, height=2, command=flow11_flow18).grid(row=5, column=8) - Button(root, text='从jenkins\n下载data\n数据', anchor='center', width=8, height=2, command=download_data).grid(row=5, - column=10) + # Button(root, text='从jenkins\n下载data\n数据', anchor='center', width=8, height=2, command=download_data).grid(row=5, + # column=10) Button(root, text='退 出', anchor='center', width=8, height=2, command=exit).grid(row=5, column=10) diff --git a/report/summary.html b/report/summary.html index 9bf599599babc3586ddaf01f1265f608f5f931ec..af7b7feb500951123eaac0b3bc1dfd944f128680 100644 --- a/report/summary.html +++ b/report/summary.html @@ -77,7 +77,7 @@ setInterval(updateTime, 1000); // 每秒更新一次时间 1 1 - 0分9秒 + 0分2秒 100.0% @@ -93,9 +93,9 @@ setInterval(updateTime, 1000); // 每秒更新一次时间 - r_d4库房管理_库区设置_货位管理_添加货位 + a2_编辑医院信息 成功 - 8.912 + 1.984 xiaohesheng