import pymysql
import PySimpleGUI as sg
import pandas as pd
import os
import time
import threading
import datetime
conn = pymysql.connect(host="localhost",
user="root",
password="123456",
db="user_information",
charset="utf8")
cursor = conn.cursor()
sql ="select * from custome_information"
cursor.execute(sql)
result = cursor.fetchall()
all = list(result)
cursor.close()
conn.close()
layout = [[sg.Text("客户名 订单名 时间 材料 尺寸 数量 单价 金额")],
[sg.Listbox(all, key='-TEXT-', select_mode='single',size=(80, 6))],
[sg.Button('返回'),sg.Button('修改'),sg.Button('查找'),sg.Button('退出')]]
window = sg.Window('修改客户账单', layout)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED or event == '退出':
break
if event == '返回':
time.sleep(0.5)
window.close()
os.system('python menu.py')
break
if event == '修改':
values = pd.DataFrame.from_dict(values,orient='index')
str1 = str(values.iat[0,0])
custome_name = str1.split("\'")[1]
order_name = str1.split("\'")[3]
material = str1.split("\'")[5]
size = str1.split("\'")[7]
quantity = str1.split(",")[9]
price = str1.split(",")[10]
amount = str1.split(",")[11].strip(')')
time.sleep(0.5)
window.close()
layout = [[sg.Text("请输入要修改的序号:")],
[sg.Text("1.客户名 2.订单名 3.时间 4.材料 ")],
[sg.Text("5.尺寸 6.数量 7.单价 8.金额 ")],
[sg.Input(key='-INPUT-')],
[sg.Button('确定'),sg.Button('返回')]]
window = sg.Window('修改', layout)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED :
break
if event == '返回':
time.sleep(0.5)
window.close()
os.system('python revise.py')
break
if event == '确定':
values = pd.DataFrame([values])
if values.iat[0,0] == '':
window.close()
layout = [[sg.Text("填写为空!")],
[sg.Button('返回')]]
window = sg.Window('错误', layout)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
break
if event == '返回':
time.sleep(0.5)
window.close()
os.system('python revise.py')
break
choice = int(values.iat[0,0])
time.sleep(0.5)
window.close()
if choice == 1:
layout = [[sg.Text("请输入要修改的内容:")],
[sg.Input(key='-INPUT-')],
[sg.Button('确定'),sg.Button('返回')]]
window = sg.Window('修改', layout)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED :
break
if event == '返回':
time.sleep(0.5)
window.close()
os.system('python revise.py')
break
if event == '确定':
values = pd.DataFrame([values])
content = str(values.iat[0,0])
cursor = conn.cursor()
conn.ping(reconnect=True)
thread_lock = threading.Lock()
thread_lock.acquire()
sql ="update custome_information set custome_name = '%s' where order_name = '%s' and material = '%s' and size = '%s' and quantity = '%s' and price = '%s' and amount = '%s'" %(content,order_name,material,size,quantity,price,amount)
cursor.execute(sql)
conn.commit()
conn.close()
thread_lock.release()
time.sleep(0.5)
window.close()
os.system('python revise.py')
break
if choice == 2:
layout = [[sg.Text("请输入要修改的内容:")],
[sg.Input(key='-INPUT-')],
[sg.Button('确定'),sg.Button('返回')]]
window = sg.Window('修改', layout)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED :
break
if event == '返回':
time.sleep(0.5)
window.close()
os.system('python revise.py')
break
if event == '确定':
values = pd.DataFrame([values])
content = str(values.iat[0,0])
cursor = conn.cursor()
conn.ping(reconnect=True)
thread_lock = threading.Lock()
thread_lock.acquire()
sql ="update custome_information set order_name = '%s' where custome_name = '%s' and material = '%s' and size = '%s' and quantity = '%s' and price = '%s' and amount = '%s'" %(content,custome_name,material,size,quantity,price,amount)
cursor.execute(sql)
conn.commit()
conn.close()
thread_lock.release()
time.sleep(0.5)
window.close()
os.system('python revise.py')
break
if choice == 3:
layout = [[sg.Text("请输入要修改的内容:(年.月.日)")],
[sg.Input(key='-INPUT-')],
[sg.Button('确定'),sg.Button('返回')]]
window = sg.Window('修改', layout)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED :
break
if event == '返回':
time.sleep(0.5)
window.close()
os.system('python revise.py')
break
if event == '确定':
values = pd.DataFrame([values])
content = str(values.iat[0,0])
format_str = '%Y.%m.%d'
content = datetime.datetime.strptime(content, format_str)
cursor = conn.cursor()
conn.ping(reconnect=True)
thread_lock = threading.Lock()
thread_lock.acquire()
sql ="update custome_information set time = '%s' where custome_name = '%s'and order_name = '%s' and material = '%s' and size = '%s' and quantity = '%s' and price
没有合适的资源?快使用搜索试试~ 我知道了~
基于PysimpleGUI+pymysql建立的简单管理系统.zip
共13个文件
py:9个
png:3个
lnk:1个
需积分: 0 5 下载量 120 浏览量
2023-03-23
15:50:09
上传
评论 1
收藏 64KB ZIP 举报
温馨提示
该资源是一个基于PysimpleGUI和pymysql开发的简单管理系统。该系统具有以下特点: 1.用户友好的界面:采用PysimpleGUI库进行界面设计,界面简洁美观,操作简单易懂。 2. 数据库支持:使用pymysql库进行与MySQL数据库的交互,实现数据的存储和读取,方便管理系统的数据管理和查询。 3. 功能完善:该管理系统包含了常见的管理功能,如用户管理、数据录入、数据查询等功能,可以满足一般管理需求。 4. 可扩展性强:开发者可以根据自己的需求,对系统进行定制和扩展,添加更多的功能和模块。 该资源提供了一个基础的管理系统框架,对于初学者来说,可以作为学习和实践的练习项目,对于有经验的开发者来说,可以作为基础框架进行二次开发。 注意:该资源为.zip文件,需要解压后使用。
资源推荐
资源详情
资源评论
收起资源包目录
基于PysimpleGUI+pymysql建立的简单管理系统.zip (13个子文件)
test
管理系统入口.py.lnk 839B
code
picture
星期汇总.png 20KB
年份汇总.png 19KB
月份汇总.png 20KB
delete.py 7KB
menu.py 2KB
stats.py 5KB
revise.py 38KB
glance.py 1KB
clearing.py 7KB
insert.py 6KB
login.py 2KB
search.py 4KB
共 13 条
- 1
资源评论
lwgwl
- 粉丝: 173
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功