From 7204bc4bd9b73ea15fe2067963ab1d4fba105901 Mon Sep 17 00:00:00 2001 From: xiao-hesheng Date: Fri, 2 Aug 2024 09:42:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B0=83=E6=95=B4=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1\347\250\213_\345\210\240\351\231\244.py" | 18 ++++++++----- common/db/sql/sql_del_branch_info.py | 14 +++++++--- data/b2_herp3_bs/data | 2 +- main1/main_text.py | 26 ++++++++++++++++++- 4 files changed, 49 insertions(+), 11 deletions(-) diff --git "a/air_case/b2_herp3_bs/r_g7\346\265\201\347\250\213\350\256\276\347\275\256_\345\256\241\346\211\271\346\265\201\347\250\213\350\256\276\347\275\256_\350\207\252\345\256\232\344\271\211\346\265\201\347\250\213_\345\210\240\351\231\244.air/r_g7\346\265\201\347\250\213\350\256\276\347\275\256_\345\256\241\346\211\271\346\265\201\347\250\213\350\256\276\347\275\256_\350\207\252\345\256\232\344\271\211\346\265\201\347\250\213_\345\210\240\351\231\244.py" "b/air_case/b2_herp3_bs/r_g7\346\265\201\347\250\213\350\256\276\347\275\256_\345\256\241\346\211\271\346\265\201\347\250\213\350\256\276\347\275\256_\350\207\252\345\256\232\344\271\211\346\265\201\347\250\213_\345\210\240\351\231\244.air/r_g7\346\265\201\347\250\213\350\256\276\347\275\256_\345\256\241\346\211\271\346\265\201\347\250\213\350\256\276\347\275\256_\350\207\252\345\256\232\344\271\211\346\265\201\347\250\213_\345\210\240\351\231\244.py" index 1c297e2f..a48f62c9 100644 --- "a/air_case/b2_herp3_bs/r_g7\346\265\201\347\250\213\350\256\276\347\275\256_\345\256\241\346\211\271\346\265\201\347\250\213\350\256\276\347\275\256_\350\207\252\345\256\232\344\271\211\346\265\201\347\250\213_\345\210\240\351\231\244.air/r_g7\346\265\201\347\250\213\350\256\276\347\275\256_\345\256\241\346\211\271\346\265\201\347\250\213\350\256\276\347\275\256_\350\207\252\345\256\232\344\271\211\346\265\201\347\250\213_\345\210\240\351\231\244.py" +++ "b/air_case/b2_herp3_bs/r_g7\346\265\201\347\250\213\350\256\276\347\275\256_\345\256\241\346\211\271\346\265\201\347\250\213\350\256\276\347\275\256_\350\207\252\345\256\232\344\271\211\346\265\201\347\250\213_\345\210\240\351\231\244.air/r_g7\346\265\201\347\250\213\350\256\276\347\275\256_\345\256\241\346\211\271\346\265\201\347\250\213\350\256\276\347\275\256_\350\207\252\345\256\232\344\271\211\346\265\201\347\250\213_\345\210\240\351\231\244.py" @@ -3,7 +3,7 @@ import sys from airtest.core.helper import using -from air_case.public1.public1.public1 import dept_query_all +from air_case.public1.public1.public1 import dept_query_all, get_process_list from common.db.sql.sql_del_branch_info import delData from common.db.sql.sql_del_kind_goodsinfo import delKindGoodsinfo from common.db.sql.sql_del_notices_info import delByNoticeName @@ -52,12 +52,13 @@ def test1(): # # 请求体 request_body = commonFuc().get_business_data(module, "payload65") print('request_body', request_body) - new_request_body = request_body.replace("'", '"') + request_body_json = get_process_list(request_body) + # new_request_body = request_body.replace("'", '"') # new_request_body = new_request_body.replace("None", 'null') # print(new_request_body) import json - request_body_json = json.loads(new_request_body) - print('request_body_json', request_body_json) + # request_body_json = json.loads(new_request_body) + # print('request_body_json', request_body_json) # # # # 发送请求 result = commonFuc().http_post(url, request_body_json, headers) print('resultaaaaaaaaaaaaaaaaaaa', result) @@ -70,5 +71,10 @@ def test1(): else: commonFuc().check_text_exist('error', result) - -test1() +try: + test1() +except: + print('出现异常') +finally: + branch_id = FileUtils().r_info(module, '院区新增')["branch_id"] + delData().Delete_branch_by_id(3,branch_id) \ No newline at end of file diff --git a/common/db/sql/sql_del_branch_info.py b/common/db/sql/sql_del_branch_info.py index 9a7b8866..00130dcc 100644 --- a/common/db/sql/sql_del_branch_info.py +++ b/common/db/sql/sql_del_branch_info.py @@ -9,7 +9,7 @@ from common.fileUtls import FileUtils class delData(object): - def Delete_branch_by_id(self,type=1): + def Delete_branch_by_id(self,type=1,id='id'): connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2", charset="utf8") cursor = connection.cursor() @@ -17,8 +17,12 @@ class delData(object): # sql = "DELETE from mcms_branch_info where id = '%s';" % id if type==1: sql = "DELETE from mcms_branch_info where name like '%东土城路院区_____';" - else: + elif type==2: sql = "DELETE from mcms_branch_info where name like '%东土城路院区______';" + elif type==3: + sql = "DELETE from mcms_branch_info where id = '%s';" % id + else: + sql='sql' print(sql) cursor.execute(sql) cursor.execute("commit;") @@ -33,8 +37,12 @@ class delData(object): # sql = "DELETE from mcms_branch_info where id = '%s';" % id if type == 1: sql = "DELETE from mcms_branch_info where name like '%东土城路院区_____';" - else: + elif type == 2: sql = "DELETE from mcms_branch_info where name like '%东土城路院区______';" + elif type == 3: + sql = "DELETE from mcms_branch_info where id = '%s';" % id + else: + sql='sql' print(sql) cursor.execute(sql) cursor.execute("commit;") diff --git a/data/b2_herp3_bs/data b/data/b2_herp3_bs/data index f655691e..35e8d905 100644 --- a/data/b2_herp3_bs/data +++ b/data/b2_herp3_bs/data @@ -493,7 +493,7 @@ json_headers2: { "payload64_2": {"pageNum":1,"pageSize":200,"queryObject":{"methodCode":"%s","operType":"restful","startTime":"2024-02-28 00:00:00","endTime":"2024-02-29 23:59:59"}} "payload64_3": {"pageNum":1,"pageSize":200,"queryObject":{"methodCode":"%s","operType":"restful","startTime":"","endTime":""}} "payload64_4": {"pageNum":1,"pageSize":"%s","queryObject":{"methodCode":"","operType":"restful","startTime":"","endTime":""}} -"payload65": '[{"id":"3a8395c5578745a6a7cf6b48ae166ce6","lastModified":"2024-01-22 09:09:29","version":0,"createTime":"2024-01-22 09:09:29","createUser":"UID-050151","lastModifiedUser":"UID-050151","businessType":0,"procType":0,"modelName":"默认审批流","judgeType":"111","rangeType":0,"rangeData":null,"modelJson":"[{\"no\":0,\"nodeName\":\"运营主管\",\"assigneeType\":2}]","nodeQty":1,"sortNo":0,"modelList":[{"no":0,"nodeName":"运营主管","assigneeType":2,"assignee":null}],"rangeDataFirst":null,"rangeDataSecond":null}]' +"payload65": {"id":"3a8395c5578745a6a7cf6b48ae166ce6","lastModified":"2024-01-22 09:09:29","version":0,"createTime":"2024-01-22 09:09:29","createUser":"UID-050151","lastModifiedUser":"UID-050151","businessType":0,"procType":0,"modelName":"默认审批流","judgeType":"111","rangeType":0,"rangeData":null,"modelJson":"[{\"no\":0,\"nodeName\":\"运营主管\",\"assigneeType\":2}]","nodeQty":1,"sortNo":0,"modelList":[{"no":0,"nodeName":"运营主管","assigneeType":2,"assignee":null}],"rangeDataFirst":null,"rangeDataSecond":null} "payload65_1": '[{"id":"3a8395c5578745a6a7cf6b48ae166ce6","lastModified":"2024-03-07 08:44:05","version":0,"createTime":"2024-03-07 08:44:05","createUser":"h0347:UID-042066","lastModifiedUser":"h0347:UID-042066","businessType":0,"procType":0,"modelName":"默认审批流","judgeType":"111","rangeType":0,"rangeData":null,"modelJson":"[{\"no\":0,\"nodeName\":\"运营主管\",\"assigneeType\":2}]","nodeQty":1,"sortNo":0,"modelList":[{"no":0,"nodeName":"运营主管","assigneeType":2,"assignee":null}],"rangeDataFirst":null,"rangeDataSecond":null},{"businessType":0,"judgeType":"","modelList":[{"assigneeType":0,"nodeName":"test","assignee":"UID-048618"}],"modelName":"test","rangeDataFirst":999999,"rangeDataSecond":null,"rangeType":3}]' "payload65_2": '[{"id":"3a8395c5578745a6a7cf6b48ae166ce6","lastModified":"2024-03-07 09:32:20","version":0,"createTime":"2024-03-07 09:32:20","createUser":"h0347:UID-042066","lastModifiedUser":"h0347:UID-042066","businessType":0,"procType":0,"modelName":"默认审批流","judgeType":"111","rangeType":0,"rangeData":null,"modelJson":"[{\"no\":0,\"nodeName\":\"运营主管\",\"assigneeType\":2}]","nodeQty":1,"sortNo":0,"modelList":[{"no":0,"nodeName":"运营主管","assigneeType":2,"assignee":null}],"rangeDataFirst":null,"rangeDataSecond":null},{"businessType":0,"judgeType":"","modelList":[{"assigneeType":0,"nodeName":"zzzz","assignee":"UID-050151"}],"modelName":"zzzz","rangeDataFirst":2222,"rangeDataSecond":44444,"rangeType":2}]' "payload65_3": {"queryObject":{"deptId":"%s","stockAreaId":"%s","hosId":"%s"},"pageNum":1,"pageSize":50} diff --git a/main1/main_text.py b/main1/main_text.py index ac211753..63848e20 100644 --- a/main1/main_text.py +++ b/main1/main_text.py @@ -245,6 +245,29 @@ def main_text(): return result def download_data(): print('从Jenkins服务器下载data数据') + def del_brachdata_from_brachid(): + import tkinter as tk + from tkinter import ttk + + def dropdown_changed(event): + value = combo.get() + print(value) + + root = tk.Tk() + root.title("删除指定院区数据") + # 计算窗口居中时左上角的坐标 + 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) + combo["values"] = ("选项1", "选项2", "选项3") + combo.current(0) # 设置默认选项 + combo.bind("<>", dropdown_changed) + combo.pack() + + root.mainloop() # 文本显示的位置。 Button(root, text='流程一\n外网企业注册审批', width=16, height=8,command=flow1).grid(row=2,column=0) Button(root, text='流程二\n供货关系申请审批', anchor='center', width=16, height=8,command=flow2).grid(row=2,column=2) @@ -264,7 +287,8 @@ def main_text(): Button(root, text='流程十六\n退库业务_二级库向\n一级库退库', anchor='center', width=16, height=8,command=flow16).grid(row=4,column=6) Button(root, text='流程十七\n退库业务_中心库退\n供应商', anchor='center', width=16, height=8,command=flow17).grid(row=4,column=8) 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=2) + 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=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) -- GitLab