From 119f6b9106c06d2c6a4635405f38d95fe89defbd Mon Sep 17 00:00:00 2001 From: xiao-hesheng Date: Mon, 30 Sep 2024 10:14:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E4=BA=94=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- air_case/public1/public1/public1.py | 2 +- common/db/sql/sql_del_branch_info.py | 28 ++++++++++++++++++++++++---- main1/main_text.py | 25 +++++++++++++++++++++++-- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/air_case/public1/public1/public1.py b/air_case/public1/public1/public1.py index 5a3fd5cc..3984a384 100644 --- a/air_case/public1/public1/public1.py +++ b/air_case/public1/public1/public1.py @@ -5,7 +5,7 @@ from airtest.core.helper import using from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system from common.common_func import commonFuc from common.db.sql.sql_del_branch_info import delData -from common.db.sql.sql_tools import * + from common.fileUtls import FileUtils import json import time diff --git a/common/db/sql/sql_del_branch_info.py b/common/db/sql/sql_del_branch_info.py index 85d024fa..56250799 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'] @@ -818,6 +821,23 @@ 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() + str1 = str(results) + new_str1 = str1.replace(',)', '') + new_str1 = new_str1.replace('(', '') + new_str1 = new_str1.replace(',', '') + new_str1 = new_str1.replace("'", '') + # print(new_str1) + cursor.close() + return new_str1 # delData().Delete_branch_by_id() # delData().Delete_goods_change_info() diff --git a/main1/main_text.py b/main1/main_text.py index 202e3e7c..599383a3 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,32 @@ def main_text(): root.geometry("+{}+{}".format(x, y)) root.resizable(False, False) combo = ttk.Combobox(root) - combo["values"] = ("选项1", "选项2", "选项3") + branch_id=delData().get_branch_id_bydb( 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(branch_id)) + 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 get_input(): import tkinter as tk from tkinter import simpledialog -- GitLab