Commit 965e13c8 authored by 肖 和生's avatar 肖 和生
Browse files

Merge remote-tracking branch 'remotes/origin/master' into core_flow

parents 71ea8363 c0c6972a
...@@ -17,14 +17,12 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_ ...@@ -17,14 +17,12 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
from airtest.core.api import using from airtest.core.api import using
import sys 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: try:
test1() test1()
commonFuc().check_text_exist_result_text('succees','succees') commonFuc().check_text_exist_result_text('succees','succees')
......
...@@ -13,167 +13,27 @@ from common.common_func import commonFuc ...@@ -13,167 +13,27 @@ from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from airtest.core.api import using from airtest.core.api import using
import sys import sys
module = "b6_spd3_core_business_flow_database_check"
def h_login():
#供货关系申请_客户类型_医院_登录_医院登录获取医院id pro_path = commonFuc().get_pro_path2()
module = "a4_mdm3_cm" print('pro_path', pro_path)
#如果需要h0347医院账号登录,这里就从data文件获取登录医院的用户名 sys.path.append(pro_path + r'/air_case/b5_spd3_core_business_flow/a_a2_流程二供货关系申请提交审批.air')
#username = commonFuc().get_business_data(module, "username") 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: try:
h_login()#医院登录 module = "b5_spd3_core_business_flow"
e_login(1)#企业登录 h_login() # 医院登录
#供应关系申请-客户类型医院 e_login(1) # 企业登录
# 供应关系申请-客户类型医院
FileUtils().w_info1(supply_and_marketing_apply(), module, '供货关系申请') FileUtils().w_info1(supply_and_marketing_apply(), module, '供货关系申请')
submitSupplyRelation_pass() submitSupplyRelation_pass()
#供应关系申请-客户类型厂商 # 供应关系申请-客户类型厂商
FileUtils().w_info1(supply_and_marketing_apply2(), module, '供货关系申请2') FileUtils().w_info1(supply_and_marketing_apply2(), module, '供货关系申请2')
submitSupplyRelation_pass() submitSupplyRelation_pass()
commonFuc().check_text_exist_result_text('succees','succees') commonFuc().check_text_exist_result_text('succees', 'succees')
except: print('=================流程二结束=================')
print('a_a2_流程二供货关系申请提交审批,出现异常,请检查') except Exception as e:
\ No newline at end of file # 打印错误信息
print(f"发生错误: {e}")
print('a_a2_流程二供货关系申请提交审批,出现异常,请检查')
...@@ -16,381 +16,33 @@ from air_case.mdm_login.登录外网系统.登录外网系统 import login_syste ...@@ -16,381 +16,33 @@ from air_case.mdm_login.登录外网系统.登录外网系统 import login_syste
from airtest.core.api import using from airtest.core.api import using
import sys 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: try:
# ==============分割线 暂时注释=============== # ==============分割线 暂时注释===============
add_goods()#直销高值 add_goods() # 直销高值
select1('message1') select1('message1')
apply() apply()
add_goods1()#直销低值 add_goods1() # 直销低值
select1('message2') select1('message2')
apply() apply()
add_goods2()#直销试剂 add_goods2() # 直销试剂
select1('message3') select1('message3')
apply() apply()
add_goods3()#集配 add_goods3() # 集配
select1('message4') select1('message4')
apply() apply()
add_goods4()#定向 "isSubprov": "1" add_goods4() # 定向 "isSubprov": "1"
select1('message5') select1('message5')
apply() apply()
#20240618外网在配送的时候增加了DI验证,加入维护di的脚本 # 20240618外网在配送的时候增加了DI验证,加入维护di的脚本
supplyProvHosGoods_add_DI() supplyProvHosGoods_add_DI()
# ==============分割线 暂时注释=============== # ==============分割线 暂时注释===============
commonFuc().check_text_exist_result_text('succees', 'succees') commonFuc().check_text_exist_result_text('succees', 'succees')
...@@ -399,5 +51,6 @@ except: ...@@ -399,5 +51,6 @@ except:
commonFuc().check_text_exist_result_text('产品新增失败', '产品新增成功') commonFuc().check_text_exist_result_text('产品新增失败', '产品新增成功')
else: else:
# 删除今天之前的产品信息(包含内外网) # 删除今天之前的产品信息(包含内外网)
delData().Del_goods_info_all() # delData().Del_goods_info_all()
commonFuc().check_text_exist_result_text('succees', 'succees') commonFuc().check_text_exist_result_text('succees', 'succees')
print('=================流程三结束=================')
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
import traceback import traceback
from air_case.public1.public1.public1 import updateUserLoginDefaultRange, get_listUserMgrRangePage, call_login, \ 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, \ 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, \ 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.fileUtls import FileUtils
from common.run_cmd_script import execute_command from common.run_cmd_script import execute_command
...@@ -66,7 +66,7 @@ def check_mcms_mcms_pur_plan(type=16): ...@@ -66,7 +66,7 @@ def check_mcms_mcms_pur_plan(type=16):
branch_id) branch_id)
area_name = process_tuple(get_id(sql1)) area_name = process_tuple(get_id(sql1))
source_id = None 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;" % ( sql1 = "select rec_addr from mcms_pur_plan where branch_id='%s' order by create_time desc LIMIT 1;" % (
branch_id) branch_id)
rec_addr = process_tuple(get_id(sql1)) rec_addr = process_tuple(get_id(sql1))
...@@ -160,7 +160,7 @@ def check_mcms_mcms_pur_plan_detail(id, type, planOrderNo): ...@@ -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'] dept_name2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
rec_org_id = process_tuple( rec_org_id = process_tuple(
get_id("select id from sys_org where branch_id='%s' and ename='%s';" % (branch_id, dept_name2))) 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 create_user = rec_user
# last_modified = create_time # last_modified = create_time
last_modified_user = create_user last_modified_user = create_user
...@@ -219,7 +219,9 @@ def check_mcms_mcms_pur_plan_detail(id, type, planOrderNo): ...@@ -219,7 +219,9 @@ def check_mcms_mcms_pur_plan_detail(id, type, planOrderNo):
create_time = get_create_time( create_time = get_create_time(
"select create_time from mcms_pur_plan_detail where id='%s';" % ( "select create_time from mcms_pur_plan_detail where id='%s';" % (
id2)) 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 sub_prov_name = prov_name
source_id = process_tuple( source_id = process_tuple(
get_id("select source_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';" % ( 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): ...@@ -254,7 +256,9 @@ def check_mcms_mcms_pur_plan_detail(id, type, planOrderNo):
create_time = get_create_time( create_time = get_create_time(
"select create_time from mcms_pur_plan_detail where id='%s';" % ( "select create_time from mcms_pur_plan_detail where id='%s';" % (
id2)) 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 sub_prov_name = prov_name
source_id = process_tuple( source_id = process_tuple(
get_id("select source_id from mcms_pur_plan_detail where hos_goods_id='%s' and id='%s';" % ( 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): ...@@ -323,7 +327,7 @@ def check_mcms_purchase(type=16):
branch_id, id1) branch_id, id1)
area_name = process_tuple(get_id(sql1)) area_name = process_tuple(get_id(sql1))
rec_user = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')['username1'] 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;" % ( sql1 = "select rec_addr from mcms_purchase where branch_id='%s' and id='%s' order by create_time desc LIMIT 1;" % (
branch_id, id1) branch_id, id1)
rec_addr = process_tuple(get_id(sql1)) rec_addr = process_tuple(get_id(sql1))
...@@ -332,7 +336,7 @@ def check_mcms_purchase(type=16): ...@@ -332,7 +336,7 @@ def check_mcms_purchase(type=16):
print(sql) print(sql)
bill_expdt_date = get_expdt_date(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( 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;" % ( "select create_time from mcms_purchase where branch_id='%s' and id='%s' order by create_time desc LIMIT 1;" % (
branch_id, id1)) branch_id, id1))
...@@ -411,9 +415,9 @@ def check_mcms_purchase(type=16): ...@@ -411,9 +415,9 @@ def check_mcms_purchase(type=16):
'mcms_purchase2_0927', id1, order_no, hos_id, 'mcms_purchase2_0927', id1, order_no, hos_id,
get_branch_id(), dept_id1, dept_name1, rec_org_id, rec_org_name, get_branch_id(), dept_id1, dept_name1, rec_org_id, rec_org_name,
area_code, area_name, bill_expdt_date, source_id, rec_user, 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, planBillId, planOrderNo,
buyOrderNo, purOrderNo, purBillId, close_date, create_user, purOrderNo, purBillId, close_date, create_user,
create_time, last_modified, last_auditor, last_audit_time create_time, last_modified, last_auditor, last_audit_time
) )
elif type == 66: elif type == 66:
...@@ -446,9 +450,9 @@ def check_mcms_purchase(type=16): ...@@ -446,9 +450,9 @@ def check_mcms_purchase(type=16):
'mcms_purchase3_0927', id1, order_no, hos_id, 'mcms_purchase3_0927', id1, order_no, hos_id,
get_branch_id(), dept_id1, dept_name1, rec_org_id, rec_org_name, get_branch_id(), dept_id1, dept_name1, rec_org_id, rec_org_name,
area_code, area_name, bill_expdt_date, source_id, rec_user, 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, planBillId, planOrderNo,
buyOrderNo, purOrderNo, purBillId, close_date, create_user, purOrderNo, purBillId, close_date, create_user,
create_time, last_modified, last_auditor, last_audit_time create_time, last_modified, last_auditor, last_audit_time
) )
else: else:
...@@ -493,7 +497,7 @@ def check_mcms_purchase_detail(id, type, OrderNo): ...@@ -493,7 +497,7 @@ def check_mcms_purchase_detail(id, type, OrderNo):
dept_name2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2'] dept_name2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
rec_org_id = process_tuple( rec_org_id = process_tuple(
get_id("select id from sys_org where branch_id='%s' and ename='%s';" % (branch_id, dept_name2))) 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 create_user = rec_user
# last_modified = create_time # last_modified = create_time
last_modified_user = create_user last_modified_user = create_user
...@@ -531,7 +535,7 @@ def check_mcms_purchase_detail(id, type, OrderNo): ...@@ -531,7 +535,7 @@ def check_mcms_purchase_detail(id, type, OrderNo):
goodsGg = get_goods_gg(hos_goods_id) goodsGg = get_goods_gg(hos_goods_id)
goodsCode = get_goods_code1(hos_goods_id) goodsCode = get_goods_code1(hos_goods_id)
goodsName = get_goods_name(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) create_time = get_create_time("select create_time from mcms_purchase_detail where id='%s';" % detail_main_key)
last_modified = create_time last_modified = create_time
last_modified_user = create_user last_modified_user = create_user
...@@ -591,27 +595,35 @@ from a_a5流程五_中心库入库结算_正结算1_提交采购计划 import go ...@@ -591,27 +595,35 @@ from a_a5流程五_中心库入库结算_正结算1_提交采购计划 import go
def main(): def main():
try: try:
# token, projectCode1, uxid1, corpId1, info1 = call_login(2) token, projectCode1, uxid1, corpId1, info1 = call_login(2)
# updateUserLoginDefaultRange(get_listUserMgrRangePage(1)) # 设置登录账号默认权限是1级库 updateUserLoginDefaultRange(get_listUserMgrRangePage(1)) # 设置登录账号默认权限是1级库
# goods_move3(token) goods_move3(token)
# # 获取低值的hosGoodsId # 获取低值的hosGoodsId
# hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"] hosGoodsId = FileUtils().r_info8('b5_spd3_core_business_flow', '产品审核信息', 'message2')["hosGoodsId"]
# get_GoodsPkgDef(hosGoodsId,token) # 获取单元包id get_GoodsPkgDef(hosGoodsId,token) # 获取单元包id
# low_vaule_purchase_plan(token,uxid1)#低值采购计划提交 low_vaule_purchase_plan(token,uxid1)#低值采购计划提交
# time.sleep(6) time.sleep(6)
# check_mcms_mcms_pur_plan(16)#低值采购计划数据检查 check_mcms_mcms_pur_plan(16)#低值采购计划数据检查
# #审批 #审批
# approval_center(token) approval_center(token)
# time.sleep(6) time.sleep(6)
check_mcms_purchase(16)#检查采购订单数据 check_mcms_purchase(16)#检查低值采购订单数据
hight_vaule_purchase_plan(token,uxid1)#高值采购计划提交 hight_vaule_purchase_plan(token,uxid1)#高值采购计划提交
time.sleep(6) time.sleep(6)
check_mcms_mcms_pur_plan(20) # 高值采购计划数据检查
approval_center(token) 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) approval_center(token)
time.sleep(6)
check_mcms_purchase(66) # 检查试剂采购订单数据
commonFuc().check_text_exist_result_text('succees', 'succees') commonFuc().check_text_exist_result_text('succees', 'succees')
except Exception as e: except Exception as e:
print('出现错误,请检查脚本或者数据') # print('出现错误,请检查脚本或者数据')
print(f"发生错误: {e}") print(f"发生错误: {e}")
print("发生异常:", str(e)) print("发生异常:", str(e))
......
...@@ -270,12 +270,13 @@ class delData(object): ...@@ -270,12 +270,13 @@ class delData(object):
print('内网供应关系删除成功 ') print('内网供应关系删除成功 ')
cursor.close() 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", connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023",
database="spd3_report_hospitaltest2", database="spd3_report_hospitaltest2",
charset="utf8") charset="utf8")
cursor = connection.cursor() 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 sql = "delete from mcms_finance_daybook where branch_id= '%s';" % branch_id
cursor.execute(sql) cursor.execute(sql)
cursor.execute("commit;") cursor.execute("commit;")
...@@ -299,14 +300,16 @@ class delData(object): ...@@ -299,14 +300,16 @@ class delData(object):
print('报表数据删除成功') print('报表数据删除成功')
cursor.close() 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", connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023",
database="spd3_herp_test2", database="spd3_herp_test2",
charset="utf8") charset="utf8")
cursor = connection.cursor() 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'] hosGoodsId1 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId']
hosGoodsId2 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'] hosGoodsId2 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId']
hosGoodsId3 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'] hosGoodsId3 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId']
...@@ -320,9 +323,8 @@ class delData(object): ...@@ -320,9 +323,8 @@ class delData(object):
cursor.execute(sql2) cursor.execute(sql2)
cursor.execute(sql3) cursor.execute(sql3)
cursor.execute("commit;") 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(sql)
cursor.execute("commit;") cursor.execute("commit;")
# 库存 # 库存
...@@ -462,7 +464,170 @@ class delData(object): ...@@ -462,7 +464,170 @@ class delData(object):
print('业务数据,包括采购,出入库,结算等数据删除成功') print('业务数据,包括采购,出入库,结算等数据删除成功')
cursor.close() 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): def Delete_yb_logic_stock(self):
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023",
database="spd3_platform_test2", database="spd3_platform_test2",
...@@ -818,6 +983,27 @@ class delData(object): ...@@ -818,6 +983,27 @@ class delData(object):
cursor.execute("commit;") cursor.execute("commit;")
print('库区人员信息删除成功 ') print('库区人员信息删除成功 ')
cursor.close() 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_branch_by_id()
# delData().Delete_goods_change_info() # delData().Delete_goods_change_info()
......
...@@ -8,7 +8,7 @@ import traceback ...@@ -8,7 +8,7 @@ import traceback
from air_case.public1.public1.public1 import approval_center, approval_center_all from air_case.public1.public1.public1 import approval_center, approval_center_all
from common.Logger_Utils import Logger from common.Logger_Utils import Logger
from common.timeUtils import timeUtils from common.timeUtils import timeUtils
from common.db.sql.sql_tools import *
curPath = os.path.abspath(os.path.dirname(__file__)) # 获取当前文件的所在目录的绝对路径 curPath = os.path.abspath(os.path.dirname(__file__)) # 获取当前文件的所在目录的绝对路径
# print('将路径中的/换成\\', curPath) # C:\Users\Administrator\Desktop\temp\dbshop99\main # print('将路径中的/换成\\', curPath) # C:\Users\Administrator\Desktop\temp\dbshop99\main
# # #将当前文件的所在目录的绝对路径进行分离,分离成 ('C:\\Users\\Administrator\\Desktop\\temp\\dbshop99', 'main'),存到元组中 # # #将当前文件的所在目录的绝对路径进行分离,分离成 ('C:\\Users\\Administrator\\Desktop\\temp\\dbshop99', 'main'),存到元组中
...@@ -292,6 +292,8 @@ def main_text(): ...@@ -292,6 +292,8 @@ def main_text():
root = tk.Tk() root = tk.Tk()
root.title("删除指定院区数据") root.title("删除指定院区数据")
# 设置窗口大小
root.geometry('200x200')
# 计算窗口居中时左上角的坐标 # 计算窗口居中时左上角的坐标
x = (window_width - root.winfo_width()) // 2 x = (window_width - root.winfo_width()) // 2
y = (window_height - root.winfo_height()) // 2 y = (window_height - root.winfo_height()) // 2
...@@ -299,13 +301,78 @@ def main_text(): ...@@ -299,13 +301,78 @@ def main_text():
root.geometry("+{}+{}".format(x, y)) root.geometry("+{}+{}".format(x, y))
root.resizable(False, False) root.resizable(False, False)
combo = ttk.Combobox(root) 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("<<ComboboxSelected>>", 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.current(0) # 设置默认选项
combo.bind("<<ComboboxSelected>>", dropdown_changed) combo.bind("<<ComboboxSelected>>", dropdown_changed)
combo.pack() combo.pack()
button = tk.Button(root, text="删除此院区数据", command=lambda: button_clicked_del_current_branch(branch_id))
button.pack()
root.mainloop() 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(): def get_input():
import tkinter as tk import tkinter as tk
from tkinter import simpledialog from tkinter import simpledialog
...@@ -339,12 +406,14 @@ def main_text(): ...@@ -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='流程十八\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='一键执行', 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, 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) 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=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=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='流程十一开始\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, # Button(root, text='从jenkins\n下载data\n数据', anchor='center', width=8, height=2, command=download_data).grid(row=5,
column=10) # column=10)
Button(root, text='退 出', anchor='center', width=8, height=2, command=exit).grid(row=5, column=10) Button(root, text='退 出', anchor='center', width=8, height=2, command=exit).grid(row=5, column=10)
......
...@@ -77,7 +77,7 @@ setInterval(updateTime, 1000); // 每秒更新一次时间 ...@@ -77,7 +77,7 @@ setInterval(updateTime, 1000); // 每秒更新一次时间
<tr width="600"> <tr width="600">
<td class='details-col-elapsed'>1</td> <td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>1</td> <td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分9</td> <td class='details-col-elapsed'>0分2</td>
<td class="details-col-elapsed">100.0%</td> <td class="details-col-elapsed">100.0%</td>
</tr> </tr>
</table> </table>
...@@ -93,9 +93,9 @@ setInterval(updateTime, 1000); // 每秒更新一次时间 ...@@ -93,9 +93,9 @@ setInterval(updateTime, 1000); // 每秒更新一次时间
</tr> </tr>
<tr width="600"> <tr width="600">
<td class="details-col-elapsed"><a href='../log/r_d4库房管理_库区设置_货位管理_添加货位/log.html' target='_blank'>r_d4库房管理_库区设置_货位管理_添加货位</a></td> <td class="details-col-elapsed"><a href='../log/a2_编辑医院信息/log.html' target='_blank'>a2_编辑医院信息</a></td>
<td class="success">成功</td> <td class="success">成功</td>
<td class="details-col-elapsed">8.912</td> <td class="details-col-elapsed">1.984</td>
<td class="details-col-elapsed">xiaohesheng</td> <td class="details-col-elapsed">xiaohesheng</td>
</tr> </tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment