from tkinter import * #导入tkinter from tkinter import messagebox #引入弹出框 #from typing import Any, Union import pymysql #导入pymysql from pymysql.cursors import Cursor #导入游标 from hashlib import sha1 #导入hashlib,引用函数 import tkinter as tk from PIL import Image #图像缩放 from tkinter import Scrollbar from tkinter import ttk # 导入内部包 from tkinter.ttk import Treeview class HomePage: # 窗口1,我的首页 def __init__(self): self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.window = Tk() # 窗体设计 self.window.title("库存与存货系统") self.window['width'] = 900 self.window['height'] = 400 self.window['bg'] = 'LemonChiffon' self.window.geometry('1200x600-100-100') self.f1 = Frame(self.window); self.f1.pack() self.f2 = Frame(self.window); self.f2.pack() self.f3 = Frame(self.window); self.f3.pack() self.f4 = Frame(self.window); self.f4.pack() self.f5 = Frame(self.window); self.f5.pack() self.f6 = Frame(self.window); self.f6.pack() self.f7 = Frame(self.window); self.f7.pack() # f3是账号的框架 # f4是密码的框架 Label(self.f1, text="欢迎进入!\n \n", font=('Helvetica', 12, 'bold'), bg='LemonChiffon').pack() Label(self.f2, text="\n 库存与存货系统\n \n \n \n", font=('Helvetica', 14, 'bold'), bg='LemonChiffon').pack() Label(self.f3, text="账号", bg='LemonChiffon').pack(side=LEFT) self.account = StringVar() self.password = StringVar() # get()用于返回StringVar变量的值,相当于一个函数 Entry(self.f3, validate='key', textvariable=self.account).pack(side=LEFT) Label(self.f4, text="密码", bg='LemonChiffon').pack(side=LEFT) Entry(self.f4, textvariable=self.password).pack(side=LEFT) Label(self.f5, text="", bg='LemonChiffon').pack() Button(self.f6, text="登录", command=self.login, bg='PaleGoldenrod').pack(side=RIGHT) Button(self.f6, text="注册", command=self.register, bg='PaleGoldenrod').pack(side=RIGHT) Button(self.f6, text="帮助", command=self.help, bg='PaleGoldenrod').pack(side=RIGHT) self.mutex = 0 # mutex的值表示当前是哪个窗体 self.window.mainloop() def help(self): # 帮助按钮事件,弹出信息 str1 = '欢迎进入库存与存货核算中心!\n 你可以直接使用用户名和账号直接登陆。\n 新用户请先注册!' messagebox.showinfo('help', str1) def register(self): # 注册按钮事件 v3 = str(self.account.get()) # 获取文本框输入的内容 v4 = str(self.password.get()) if (v3): # 首页填了账号的话,需要把输入框账号清空才可注册 messagebox.showinfo('error', "请先点击注册进入注册页面\n 再开始注册!") else: self.mutex = 2 # 值设置为2,进入第二个窗口注册页面 self.window.destroy() # 销毁当前窗口 def login(self): # 登录按钮事件,根据不同账户进入不同页面 v3 = str(self.account.get()) v4 = str(self.password.get()) global v3 cursor = self.conn.cursor() # 启动游标 cursor.execute("select * from login where `account`='%s'" % v3) # 注意引号使用 data = cursor.fetchone() # 返回单个元组 self.conn.commit() if data: if data[1] == v4: # 对应密码 if data[2]==1: self.mutex = 3 # 指示值设置为3,指示进入operation1界面 仓储部 elif data[2]==2: self.mutex = 4 # 指示值设置为3,指示进入operation2界面 采购部 elif data[2]==3: self.mutex = 5 # 指示值设置为3,指示进入operation3界面 销售部 elif data[2]==4: self.mutex = 6 # 指示值设置为3,指示进入operation4界面 财务部 else: self.mutex= 7 # 指示值设置为3,指示进入operation5界面 生产部 #self.mutex = 3 # 指示值设置为3,指示进入operation界面 self.account = v3 self.password = v4 cursor.close() # self.conn.close() self.window.destroy() else: messagebox.showinfo('error', "密码错误!") else: messagebox.showinfo('error', "此用户不存在!\n请先注册!") class RegisterPage: # 窗口2注册页面 def __init__(self): self.window = Tk() self.window.title("库存与存货管理系统-注册") self.window['width'] = 900 self.window['height'] = 400 self.window['bg'] = 'Ivory' self.window.geometry('1200x600-100-100') self.f1 = Frame(self.window); self.f1.pack() self.f2 = Frame(self.window); self.f2.pack() self.f3 = Frame(self.window); self.f3.pack() self.f4 = Frame(self.window); self.f4.pack() self.f5 = Frame(self.window); self.f5.pack() self.f6 = Frame(self.window); self.f6.pack() self.f7 = Frame(self.window); self.f7.pack() self.f8 = Frame(self.window); self.f8.pack() self.account = StringVar() self.password = StringVar() self.again_password = StringVar() #self.DepartID = StringVar() self.DepartName = StringVar() self.DepartID = StringVar() Label(self.f1, text="欢迎进入!\n \n", font=('Helvetica', 12, 'bold'), bg='Ivory').pack() Label(self.f2, text="\n 库存与存货系统\n \n \n \n", font=('Helvetica', 14, 'bold'), bg='Ivory').pack() Label(self.f3, text="账号", bg='Ivory').pack(side=LEFT) Entry(self.f3, textvariable=self.account).pack(side=LEFT) Label(self.f4, text="密码", bg='Ivory').pack(side=LEFT) Entry(self.f4, textvariable=self.password).pack(side=LEFT) Label(self.f5, text="确定", bg='Ivory').pack(side=LEFT) Entry(self.f5, textvariable=self.again_password).pack(side=LEFT) Label(self.f6, text="部门", bg='Ivory').pack(side=LEFT) def show_msg(*args): print(dept.get()) if dept.get() == "仓储部": self.DepartID = '1' elif dept.get() == "采购部": self.DepartID = '2' elif dept.get() == "销售部": self.DepartID = '3' elif dept.get() == "财务部": self.DepartID = '4' elif dept.get() == "生产部": self.DepartID = '5' print(self.DepartID) dept = ttk.Combobox(self.f6, textvariable=self.DepartName,width=17) dept["values"] = ("采购部", "销售部", "仓储部", "生产部", "财务部") dept["state"] = "readonly" # players.current(2) dept.set("") # print(dept.get()) dept.bind("<<ComboboxSelected>>", show_msg) dept.pack(side=LEFT) #Entry(self.f6, textvariable=self.DepartID).pack(side=LEFT) Label(self.f7, text="", bg='Ivory').pack(side=LEFT) #Entry(self.f7, textvariable=self.DepartID).pack(side=LEFT) Button(self.f8, text="帮助", command=self.help,bg= 'LemonChiffon').pack(side=RIGHT) Button(self.f8, text="注册", command=self.c1,bg= 'LemonChiffon').pack(side=RIGHT) Button(self.f8, text="退出", command=self.c2,bg= 'LemonChiffon').pack(side=RIGHT) self.window.mainloop() def help(self): #帮助按钮事件,弹出信息 str1 = '欢迎进入库存与存货注册中心!\n 部门的仅可选择(1、仓储、2、采购、3、销售、4、财务、5、生产)。\n 请您填写对应的数字序号,欢迎注册!!' messagebox.showinfo('help', str1) def c2(self): #退出按钮事件,退回首页界面 self.mutex = 1 #值设置为1,进入第1个窗口登陆页面 self.window.destroy() def c1(self): #注册按钮事件(下拉框) v3 = str(self.account.get()) v4 = str(self.password.get()) v5 = str(self.again_password.get()) v6 = str(self.DepartID) if (v5 != v4): messagebox.showinfo(title='error', message='密码不一致!') elif not v3: messagebox.showinfo(title='error', message='账号不能为空!') elif (not v4) or (not v5): messagebox.showinfo(title='error', message='密码不能为空!') else: conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 cursor = conn.cursor() read_sql = "SELECT * FROM login " # 查询已有的数据 print(read_sql) cursor.execute(read_sql) conn.commit() results = cursor.fetchall() # 获取所有数据列表 for row in results: print(row) # 测试 if row[0] == v3: messagebox.showwarning(title='警告!', message='账户已存在,请重新输入') return 0 # sql = "insert into login(account,password) values(%s,%s)on duplicate"(测试) sql1 = "INSERT INTO login(account,password,DepartID) VALUES('%s','%s','%s');" % (v3, v4,v6) # 插入数据 # value = (( v3, v4 )) sql2 = "INSERT INTO employee(account,EmployeeID) VALUES('%s','%s');" % (v3, v3) # 插入数据 cursor.execute(sql1) cursor.execute(sql2) conn.commit() cursor.close() conn.close() messagebox.showinfo(title='connected', message='注册成功!') self.mutex = 1 # 值设置为1,进入第1个窗口登陆页面 self.window.destroy() class OperationPage1: #窗口3operation界面 仓储部 def f_print(self): tk.messagebox.showinfo('天朝理工', '库存与存货管理中心') def set_mutex(self,mutex): self.mutex=mutex self.window.destroy() def __init__(self): self.window=tk.Tk() self.window.title("库存与存货管理系统-仓储部") self.window['width']=900 self.window['height']=400 self.window.geometry('1200x600-100-100') self.window['bg']='gray' f1=Frame(self.window);f1.pack() f2=Frame(self.window);f2.pack() Label(f1,text="\n \n \n\n\n\n同学你好\n\n欢迎进入\n \n",font=('Helvetica',12,'bold'),bg='gray').pack() Label(f2,text="\n库存与存货管理中心-仓储部\n \n!!!!!!\n \n", font=('Helvetica',14,'bold'),bg='gray').pack() menubar=tk.Menu(self.window) menuPerson=tk.Menu(menubar) menuOSM=tk.Menu(menubar,tearoff=0) menuCourse=tk.Menu(menubar,tearoff=0) menuMessage=tk.Menu(menubar,tearoff=0) menuSellect=tk.Menu(menubar,tearoff=0) menuExit=tk.Menu(menubar) menubar.add_cascade(label='个人中心',menu=menuPerson) menubar.add_cascade(label='库存',menu=menuOSM) menubar.add_cascade(label='业务',menu=menuCourse) menubar.add_cascade(label='公告',menu=menuMessage) menubar.add_cascade(label='单据列表',menu=menuSellect) menubar.add_cascade(label='退出',menu=menuExit) menuPerson.add_command(label='信息修改',command=lambda : self.set_mutex(mutex=4.21)) menuPerson.add_command(label='信息查看',command=lambda : self.set_mutex(mutex=4.11)) menuPerson.add_separator() menuOSM.add_command(label='成品',command=lambda : self.set_mutex(mutex=5.1)) menuOSM.add_command(label='原材料',command=lambda : self.set_mutex(mutex=5.2)) menuOSM.add_separator() menuCourse.add_cascade(label='盘点单',command=lambda : self.set_mutex(mutex=6.1)) #(label='所选课程',menu=menusub) #menuCourse.add_cascade(label='盘点单详细',command=lambda : self.set_mutex(mutex=6.2)) #盘点单 menuCourse.add_cascade(label='材料入库单',command=lambda : self.set_mutex(mutex=6.3))# 仓储部原材料入库 menuCourse.add_cascade(label='产成品入库单', command=lambda: self.set_mutex(mutex=6.4))#成品从生产到仓储 menuCourse.add_cascade(label='产品出库单', command=lambda: self.set_mutex(mutex=6.5)) #仓储部产品出库单 menuCourse.add_cascade(label='材料出库单', command=lambda: self.set_mutex(mutex=6.6))#仓储到生产 #menuCourse.add_cascade(label='采购发票', command=lambda: self.set_mutex(mutex=6.7)) #暂无 #menuCourse.add_cascade(label='销售发票', command=lambda: self.set_mutex(mutex=6.8)) #暂无 menuCourse.add_separator() menuMessage.add_command(label='通知',command=lambda : self.set_mutex(mutex=18.1)) menuMessage.add_separator() menuin=tk.Menu(menuSellect) menuout=tk.Menu(menuSellect) menuSellect.add_cascade(label='入库',menu=menuin) menuSellect.add_cascade(label='出库',menu=menuout) # #保存操作中数据变化的视图 menuin.add_command(label='原料入库单',command=lambda : self.set_mutex(mutex=7.11)) #menuin.add_command(label='采购入库单详细',command=lambda : self.set_mutex(mutex=7.12)) menuin.add_command(label='产成品入库单',command=lambda : self.set_mutex(mutex=7.21)) #menuin.add_command(label='产成品入库单详细',command=lambda : self.set_mutex(mutex=7.22)) menuout.add_command(label='成品出库单',command=lambda : self.set_mutex(mutex=7.31)) #menuout.add_command(label='销售出库单详细',command=lambda : self.set_mutex(mutex=7.32)) menuout.add_command(label='材料出库单',command=lambda : self.set_mutex(mutex=7.41)) #menuout.add_command(label='材料出库单详细',command=lambda : self.set_mutex(mutex=7.42)) menuExit.add_command(label='退出系统', command=lambda: self.set_mutex(mutex=1))#回退到首页 self.window['menu']=menubar self.mutex=0 self.window.mainloop() class OperationPage2: #窗口4operation界面 采购部 def f_print(self): tk.messagebox.showinfo('天朝理工', '库存与存货管理中心') def set_mutex(self,mutex): self.mutex=mutex self.window.destroy() def __init__(self): self.window=tk.Tk() self.window.title("库存与存货管理系统-采购部") self.window['width']=900 self.window['height']=400 self.window.geometry('1200x600-100-100') self.window['bg']='gray' f1=Frame(self.window);f1.pack() f2=Frame(self.window);f2.pack() Label(f1,text="\n \n \n\n\n\n同学你好\n\n欢迎进入\n \n",font=('Helvetica',12,'bold'),bg='gray').pack() Label(f2,text="\n库存与存货管理中心-采购部\n \n!!!!!!\n \n", font=('Helvetica',14,'bold'),bg='gray').pack() menubar=tk.Menu(self.window) menuPerson=tk.Menu(menubar) menuOSM=tk.Menu(menubar,tearoff=0) menuCourse=tk.Menu(menubar,tearoff=0) menuMessage=tk.Menu(menubar,tearoff=0) menuSellect=tk.Menu(menubar,tearoff=0) menuExit=tk.Menu(menubar) menubar.add_cascade(label='个人中心',menu=menuPerson) #menubar.add_cascade(label='库存',menu=menuOSM) menubar.add_cascade(label='业务',menu=menuCourse) menubar.add_cascade(label='公告',menu=menuMessage) menubar.add_cascade(label='单据列表',menu=menuSellect) menubar.add_cascade(label='退出',menu=menuExit) menuPerson.add_command(label='信息修改',command=lambda : self.set_mutex(mutex=4.22)) menuPerson.add_command(label='信息查看',command=lambda : self.set_mutex(mutex=4.12)) menuPerson.add_separator() #menuOSM.add_command(label='成品',command=lambda : self.set_mutex(mutex=5.1)) #menuOSM.add_command(label='原材料',command=lambda : self.set_mutex(mutex=5.2)) #menuOSM.add_separator() #menuCourse.add_cascade(label='盘点单',command=lambda : self.set_mutex(mutex=6.1)) #(label='所选课程',menu=menusub) #menuCourse.add_cascade(label='盘点单详细',command=lambda : self.set_mutex(mutex=6.2)) #盘点单 menuCourse.add_cascade(label='原料采购单',command=lambda : self.set_mutex(mutex=8.1))# 采购部原材料入库 #menuCourse.add_cascade(label='产成品入库单', command=lambda: self.set_mutex(mutex=6.4)) #menuCourse.add_cascade(label='销售出库单', command=lambda: self.set_mutex(mutex=6.5)) #仓储部产品出库单 #menuCourse.add_cascade(label='材料出库单', command=lambda: self.set_mutex(mutex=6.6)) #menuCourse.add_cascade(label='采购发票', command=lambda: self.set_mutex(mutex=6.7)) #menuCourse.add_cascade(label='销售发票', command=lambda: self.set_mutex(mutex=6.8)) menuCourse.add_separator() menuMessage.add_command(label='通知',command=lambda : self.set_mutex(mutex=18.2)) menuMessage.add_separator() menuin=tk.Menu(menuSellect) menuout=tk.Menu(menuSellect) menuSellect.add_command(label='原材料采购单',command=lambda : self.set_mutex(mutex=8.2)) #menuSellect.add_cascade(label='出库',menu=menuout) #menuin.add_command(label='原材料采购单',command=lambda : self.set_mutex(mutex=7.11)) #menuin.add_command(label='采购入库单详细',command=lambda : self.set_mutex(mutex=7.12)) #menuin.add_command(label='产成品入库单',command=lambda : self.set_mutex(mutex=7.21)) #menuin.add_command(label='产成品入库单详细',command=lambda : self.set_mutex(mutex=7.22)) #menuout.add_command(label='销售出库单',command=lambda : self.set_mutex(mutex=7.31)) #menuout.add_command(label='销售出库单详细',command=lambda : self.set_mutex(mutex=7.32)) #menuout.add_command(label='材料出库单',command=lambda : self.set_mutex(mutex=7.41)) #menuout.add_command(label='材料出库单详细',command=lambda : self.set_mutex(mutex=7.42)) menuExit.add_command(label='退出系统', command=lambda: self.set_mutex(mutex=1))#回退到首页 self.window['menu']=menubar self.mutex=0 self.window.mainloop() class OperationPage3: #窗口4operation界面 销售部 def f_print(self): tk.messagebox.showinfo('天朝理工', '库存与存货管理中心') def set_mutex(self,mutex): self.mutex=mutex self.window.destroy() def __init__(self): self.window=tk.Tk() self.window.title("库存与存货管理系统-销售部") self.window['width']=900 self.window['height']=400 self.window.geometry('1200x600-100-100') self.window['bg']='gray' f1=Frame(self.window);f1.pack() f2=Frame(self.window);f2.pack() Label(f1,text="\n \n \n\n\n\n同学你好\n\n欢迎进入\n \n",font=('Helvetica',12,'bold'),bg='gray').pack() Label(f2,text="\n库存与存货管理中心-销售部\n \n!!!!!!\n \n", font=('Helvetica',14,'bold'),bg='gray').pack() menubar=tk.Menu(self.window) menuPerson=tk.Menu(menubar) menuOSM=tk.Menu(menubar,tearoff=0) menuCourse=tk.Menu(menubar,tearoff=0) menuMessage=tk.Menu(menubar,tearoff=0) menuSellect=tk.Menu(menubar,tearoff=0) menuExit=tk.Menu(menubar) menubar.add_cascade(label='个人中心',menu=menuPerson) #menubar.add_cascade(label='库存',menu=menuOSM) menubar.add_cascade(label='业务',menu=menuCourse) menubar.add_cascade(label='公告',menu=menuMessage) menubar.add_cascade(label='单据列表',menu=menuSellect) menubar.add_cascade(label='退出',menu=menuExit) menuPerson.add_command(label='信息修改',command=lambda : self.set_mutex(mutex=4.23)) menuPerson.add_command(label='信息查看',command=lambda : self.set_mutex(mutex=4.13)) menuPerson.add_separator() #menuOSM.add_command(label='成品',command=lambda : self.set_mutex(mutex=5.1)) #menuOSM.add_command(label='原材料',command=lambda : self.set_mutex(mutex=5.2)) #menuOSM.add_separator() #menuCourse.add_cascade(label='盘点单',command=lambda : self.set_mutex(mutex=6.1)) #(label='所选课程',menu=menusub) #menuCourse.add_cascade(label='盘点单详细',command=lambda : self.set_mutex(mutex=6.2)) #盘点单 #menuCourse.add_cascade(label='采购入库单',command=lambda : self.set_mutex(mutex=6.3))# 仓储部原材料入库 #menuCourse.add_cascade(label='产成品入库单', command=lambda: self.set_mutex(mutex=6.4)) menuCourse.add_cascade(label='销售产品请求单', command=lambda: self.set_mutex(mutex=9.1)) #销售部部产品请求单 #menuCourse.add_cascade(label='材料出库单', command=lambda: self.set_mutex(mutex=6.6)) #menuCourse.add_cascade(label='采购发票', command=lambda: self.set_mutex(mutex=6.7)) #menuCourse.add_cascade(label='销售发票', command=lambda: self.set_mutex(mutex=6.8)) menuCourse.add_separator() menuMessage.add_command(label='通知',command=lambda : self.set_mutex(mutex=18.3)) menuMessage.add_separator() menuin=tk.Menu(menuSellect) menuout=tk.Menu(menuSellect) menuSellect.add_command(label='销售请求单据',command=lambda : self.set_mutex(mutex=9.2)) #menuSellect.add_cascade(label='出库',menu=menuout) #menuin.add_command(label='采购入库单',command=lambda : self.set_mutex(mutex=7.11)) #menuin.add_command(label='采购入库单详细',command=lambda : self.set_mutex(mutex=7.12)) #menuin.add_command(label='产成品入库单',command=lambda : self.set_mutex(mutex=7.21)) #menuin.add_command(label='产成品入库单详细',command=lambda : self.set_mutex(mutex=7.22)) #menuout.add_command(label='销售出库单',command=lambda : self.set_mutex(mutex=7.31)) #menuout.add_command(label='销售出库单详细',command=lambda : self.set_mutex(mutex=7.32)) #menuout.add_command(label='材料出库单',command=lambda : self.set_mutex(mutex=7.41)) #menuout.add_command(label='材料出库单详细',command=lambda : self.set_mutex(mutex=7.42)) menuExit.add_command(label='退出系统', command=lambda: self.set_mutex(mutex=1))#回退到首页 self.window['menu']=menubar self.mutex=0 self.window.mainloop() class OperationPage5: #窗口4operation界面 生产部 def f_print(self): tk.messagebox.showinfo('天朝理工', '库存与存货管理中心') def set_mutex(self,mutex): self.mutex=mutex self.window.destroy() def __init__(self): self.window=tk.Tk() self.window.title("库存与存货管理系统-生产部") self.window['width']=900 self.window['height']=400 self.window.geometry('1200x600-100-100') self.window['bg']='gray' f1=Frame(self.window);f1.pack() f2=Frame(self.window);f2.pack() Label(f1,text="\n \n \n\n\n\n同学你好\n\n欢迎进入\n \n",font=('Helvetica',12,'bold'),bg='gray').pack() Label(f2,text="\n库存与存货管理中心-生产部\n \n!!!!!!\n \n", font=('Helvetica',14,'bold'),bg='gray').pack() menubar=tk.Menu(self.window) menuPerson=tk.Menu(menubar) menuOSM=tk.Menu(menubar,tearoff=0) menuCourse=tk.Menu(menubar,tearoff=0) menuMessage=tk.Menu(menubar,tearoff=0) menuSellect=tk.Menu(menubar,tearoff=0) menuExit=tk.Menu(menubar) menubar.add_cascade(label='个人中心',menu=menuPerson) #menubar.add_cascade(label='库存',menu=menuOSM) menubar.add_cascade(label='业务',menu=menuCourse) menubar.add_cascade(label='公告',menu=menuMessage) menubar.add_cascade(label='单据列表',menu=menuSellect) menubar.add_cascade(label='退出',menu=menuExit) menuPerson.add_command(label='信息修改',command=lambda : self.set_mutex(mutex=4.25)) menuPerson.add_command(label='信息查看',command=lambda : self.set_mutex(mutex=4.15)) menuPerson.add_separator() #menuOSM.add_command(label='成品',command=lambda : self.set_mutex(mutex=5.1)) #menuOSM.add_command(label='原材料',command=lambda : self.set_mutex(mutex=5.2)) #menuOSM.add_separator() #menuCourse.add_cascade(label='盘点单',command=lambda : self.set_mutex(mutex=6.1)) #(label='所选课程',menu=menusub) #menuCourse.add_cascade(label='盘点单详细',command=lambda : self.set_mutex(mutex=6.2)) #盘点单 #menuCourse.add_cascade(label='采购入库单',command=lambda : self.set_mutex(mutex=6.3))# 仓储部原材料入库 menuCourse.add_cascade(label='生产部原材料请求单', command=lambda: self.set_mutex(mutex=10.1))#生产部原料请求单 #menuCourse.add_cascade(label='销售出库单', command=lambda: self.set_mutex(mutex=6.5)) #仓储部产品出库单 menuCourse.add_cascade(label='生产部产品生产单', command=lambda: self.set_mutex(mutex=10.2))#生产部产品生产单 #menuCourse.add_cascade(label='采购发票', command=lambda: self.set_mutex(mutex=6.7)) #财务开票 #menuCourse.add_cascade(label='销售发票', command=lambda: self.set_mutex(mutex=6.8))#财务开票 menuCourse.add_separator() menuMessage.add_command(label='通知',command=lambda : self.set_mutex(mutex=18.5)) menuMessage.add_separator() menuin=tk.Menu(menuSellect) menuout=tk.Menu(menuSellect) menuSellect.add_cascade(label='入库',menu=menuin) menuSellect.add_cascade(label='出库',menu=menuout) menuin.add_command(label='生产部原材料入库单据',command=lambda : self.set_mutex(mutex=10.3)) #menuin.add_command(label='采购入库单详细',command=lambda : self.set_mutex(mutex=7.12)) #menuin.add_command(label='产成品入库单',command=lambda : self.set_mutex(mutex=7.21)) #menuin.add_command(label='产成品入库单详细',command=lambda : self.set_mutex(mutex=7.22)) menuout.add_command(label='生产部产成品出库单据',command=lambda : self.set_mutex(mutex=10.4)) #menuout.add_command(label='销售出库单详细',command=lambda : self.set_mutex(mutex=7.32)) #menuout.add_command(label='材料出库单',command=lambda : self.set_mutex(mutex=7.41)) #menuout.add_command(label='材料出库单详细',command=lambda : self.set_mutex(mutex=7.42)) menuExit.add_command(label='退出系统', command=lambda: self.set_mutex(mutex=1))#回退到首页 self.window['menu']=menubar self.mutex=0 self.window.mainloop() class OperationPage4: #窗口3operation界面 财务部 def f_print(self): tk.messagebox.showinfo('天朝理工', '库存与存货管理中心') def set_mutex(self,mutex): self.mutex=mutex self.window.destroy() def __init__(self): self.window=tk.Tk() self.window.title("库存与存货管理系统-财务部") self.window['width']=900 self.window['height']=400 self.window.geometry('1200x600-100-100') self.window['bg']='gray' f1=Frame(self.window);f1.pack() f2=Frame(self.window);f2.pack() Label(f1,text="\n \n \n\n\n\n同学你好\n\n欢迎进入\n \n",font=('Helvetica',12,'bold'),bg='gray').pack() Label(f2,text="\n库存与存货管理中心-财务部\n \n!!!!!!\n \n", font=('Helvetica',14,'bold'),bg='gray').pack() menubar=tk.Menu(self.window) menuPerson=tk.Menu(menubar) #menuOSM=tk.Menu(menubar,tearoff=0) menuCourse=tk.Menu(menubar,tearoff=0) menuMessage=tk.Menu(menubar,tearoff=0) menuSellect=tk.Menu(menubar,tearoff=0) menuExit=tk.Menu(menubar) menubar.add_cascade(label='个人中心',menu=menuPerson) #menubar.add_cascade(label='库存',menu=menuOSM) menubar.add_cascade(label='业务',menu=menuCourse) menubar.add_cascade(label='公告',menu=menuMessage) menubar.add_cascade(label='单据列表',menu=menuSellect) menubar.add_cascade(label='退出',menu=menuExit) menuPerson.add_command(label='信息修改',command=lambda : self.set_mutex(mutex=4.24)) menuPerson.add_command(label='信息查看',command=lambda : self.set_mutex(mutex=4.14)) menuPerson.add_separator() #menuOSM.add_command(label='成品',command=lambda : self.set_mutex(mutex=5.1)) #menuOSM.add_command(label='原材料',command=lambda : self.set_mutex(mutex=5.2)) #menuOSM.add_separator() #menuCourse.add_cascade(label='盘点单',command=lambda : self.set_mutex(mutex=6.1)) #(label='所选课程',menu=menusub) #menuCourse.add_cascade(label='盘点单详细',command=lambda : self.set_mutex(mutex=6.2)) #盘点单 #menuCourse.add_cascade(label='采购入库单',command=lambda : self.set_mutex(mutex=6.3))# 仓储部原材料入库 #menuCourse.add_cascade(label='产成品入库单', command=lambda: self.set_mutex(mutex=6.4)) #menuCourse.add_cascade(label='销售出库单', command=lambda: self.set_mutex(mutex=6.5)) #仓储部产品出库单 #menuCourse.add_cascade(label='材料出库单', command=lambda: self.set_mutex(mutex=6.6)) menuCourse.add_cascade(label='采购发票', command=lambda: self.set_mutex(mutex=11.1)) menuCourse.add_cascade(label='销售发票', command=lambda: self.set_mutex(mutex=11.2)) menuCourse.add_separator() menuMessage.add_command(label='通知',command=lambda : self.set_mutex(mutex=18.4)) menuMessage.add_separator() menuin=tk.Menu(menuSellect) menuout=tk.Menu(menuSellect) menuSellect.add_cascade(label='入库',menu=menuin) menuSellect.add_cascade(label='出库',menu=menuout) menuin.add_command(label='采购入库发票',command=lambda : self.set_mutex(mutex=11.1)) #menuin.add_command(label='采购入库单详细',command=lambda : self.set_mutex(mutex=7.12)) #menuin.add_command(label='产成品入库单',command=lambda : self.set_mutex(mutex=7.21)) #menuin.add_command(label='产成品入库单详细',command=lambda : self.set_mutex(mutex=7.22)) menuout.add_command(label='销售出库发票',command=lambda : self.set_mutex(mutex=11.2)) #menuout.add_command(label='销售出库单详细',command=lambda : self.set_mutex(mutex=7.32)) #menuout.add_command(label='材料出库单',command=lambda : self.set_mutex(mutex=7.41)) #menuout.add_command(label='材料出库单详细',command=lambda : self.set_mutex(mutex=7.42)) menuExit.add_command(label='退出系统', command=lambda: self.set_mutex(mutex=1))#回退到首页 self.window['menu']=menubar self.mutex=0 self.window.mainloop() #class G_outStorage(): #if #import 产品出库单 #直接调用出库单文件页面 class Application111(tk.Frame): # 信息查看页面 def __init__(self,master=None): self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) #self.account = account #self.password = password tk.Frame.__init__(self, master) self.grid() self.createWidgets() #self.window['bg'] = 'LemonChiffon' def createWidgets(self): #self.lblPhoto = tk.Label(self, text='员工编号') #进数据库查看,如果为空则按当前显示,不空则按数据库路径显示空 cursor = self.conn.cursor() # 启动游标 cursor.execute("select * from employee where `EmployeeID`='%s'" % v3) # 注意引号使用 data = cursor.fetchone() # 返回单个元组 self.conn.commit() if data[16]: Photo = PhotoImage(file='%s' %data[16]) print(1) else: Photo =PhotoImage(file='11.gif') #Photo = PhotoImage(file='11.gif') self.lblPhoto = Label(image=Photo) self.lblPhoto.image = Photo self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) #控制位置布局 self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏') self.lblaccount = tk.Label(self, text='员工账户') self.lblpassword = tk.Label(self, text='员工密码') self.lblFirstName = tk.Label(self, text='员工名字') self.lblTitle = tk.Label(self, text='员工职务') self.lblTitleofCountry = tk.Label(self, text='员工尊称') self.lblBirthDate = tk.Label(self, text='出生日期') self.lblHireDate = tk.Label(self, text='雇佣日期') self.lblAddress = tk.Label(self, text='家庭地址') self.lblCity = tk.Label(self, text='居住城市') self.lblRegion = tk.Label(self, text='居住地区') self.lblPostalCode = tk.Label(self, text='家庭邮编') self.lblCountry = tk.Label(self, text='国家籍贯') self.lblHomePhone = tk.Label(self, text='家庭电话') self.lblExtension = tk.Label(self, text='电话分机') self.lblNotes = tk.Label(self, text='个人备注') self.lblReportsTo = tk.Label(self, text='职位上级') #self.lblPhotoPath = tk.Label(self, text='照片路径') self.lblPhoto.grid(row=0, column=2, columnspan=2, rowspan=2, sticky=W + E + N + S, padx=5, pady=5) self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 #self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) #self.entryPhotoPath = tk.Entry(self) # 照片路径 #self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnout = tk.Button(self, text='退出', command=self.funcout) self.btnout.grid(row=18, column=101, sticky=W) self.btnok = tk.Button(self, text='确定', command=self.funcok) self.btnok.grid(row=18, column=102, sticky=W) def funcout(self): self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 def funcok(self): cursor = self.conn.cursor() #from HomePage() import login print(v3) # print(v3) # cursor.execute("select * from employee where `EmployeeID`='%s'" % v3 ) print(v3) # self.conn.commit() data = cursor.fetchone() print(data[1]) #获取到数据 #EmployeeID,LastName,FirstName,Title,TitleofCountry, BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,Notes,ReportsTo,PhotoPath,account = data #val = {} #print(val[1]) #print("22") cursor.execute("select * from login where `account`='%s'" % v3) print(v3) # self.conn.commit() data1 = cursor.fetchone() #self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.insert('end',data[0]) self.entryLastName.insert('end', data[1]) self.entryaccount.insert('end', data[0]) self.entrypassword.insert('end', data1[1]) # self.entryFirstName.insert('end', data[2]) self.entryTitle.insert('end', data[3]) self.entryTitleofCountry.insert('end', data[4]) self.entryBirthDate.insert('end', data[5]) self.entryHireDate.insert('end', data[6]) self.entryAddress.insert('end', data[7]) self.entryCity.insert('end', data[8]) self.entryRegion.insert('end', data[9]) self.entryPostalCode.insert('end', data[10]) self.entryCountry.insert('end', data[11]) self.entryHomePhone.insert('end', data[12]) self.entryExtension.insert('end', data[13]) self.entryNotes.insert('end', data[14]) self.entryReportsTo.insert('end', data[15]) #self.entryEmployeeID = tk.Entry(testvariable=val['EmployeeId'] ); #取值 #self.label_account["textvariable"] = val['EmployeeID'] #val['EmployeeID'].set(self.EmployeeID) class Application112(tk.Frame): # 信息查看页面 def __init__(self,master=None): self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) #self.account = account #self.password = password tk.Frame.__init__(self, master) self.grid() self.createWidgets() #self.window['bg'] = 'LemonChiffon' def createWidgets(self): cursor = self.conn.cursor() # 启动游标 cursor.execute("select * from employee where `EmployeeID`='%s'" % v3) # 注意引号使用 data = cursor.fetchone() # 返回单个元组 self.conn.commit() if data[16]: Photo = PhotoImage(file='%s' % data[16]) print(1) else: Photo = PhotoImage(file='22.gif') # Photo = PhotoImage(file='11.gif') self.lblPhoto = Label(image=Photo) self.lblPhoto.image = Photo self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) #控制位置布局 self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏') self.lblaccount = tk.Label(self, text='员工账户') self.lblpassword = tk.Label(self, text='员工密码') self.lblFirstName = tk.Label(self, text='员工名字') self.lblTitle = tk.Label(self, text='员工职务') self.lblTitleofCountry = tk.Label(self, text='员工尊称') self.lblBirthDate = tk.Label(self, text='出生日期') self.lblHireDate = tk.Label(self, text='雇佣日期') self.lblAddress = tk.Label(self, text='家庭地址') self.lblCity = tk.Label(self, text='居住城市') self.lblRegion = tk.Label(self, text='居住地区') self.lblPostalCode = tk.Label(self, text='家庭邮编') self.lblCountry = tk.Label(self, text='国家籍贯') self.lblHomePhone = tk.Label(self, text='家庭电话') self.lblExtension = tk.Label(self, text='电话分机') self.lblNotes = tk.Label(self, text='个人备注') self.lblReportsTo = tk.Label(self, text='职位上级') #self.lblPhotoPath = tk.Label(self, text='照片路径') self.lblPhoto.grid(row=0, column=2, columnspan=2, rowspan=2, sticky=W + E + N + S, padx=5, pady=5) self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 #self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) #self.entryPhotoPath = tk.Entry(self) # 照片路径 #self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnout = tk.Button(self, text='退出', command=self.funcout,bg= 'pink') self.btnout.grid(row=18, column=101, sticky=W) self.btnok = tk.Button(self, text='确定', command=self.funcok,bg= 'pink') self.btnok.grid(row=18, column=102, sticky=W) def funcout(self): self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 def funcok(self): cursor = self.conn.cursor() #from HomePage() import login print(v3) # print(v3) # cursor.execute("select * from employee where `EmployeeID`='%s'" % v3 ) print(v3) # self.conn.commit() data = cursor.fetchone() print(data[1]) #获取到数据 #EmployeeID,LastName,FirstName,Title,TitleofCountry, BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,Notes,ReportsTo,PhotoPath,account = data #val = {} #print(val[1]) #print("22") cursor.execute("select * from login where `account`='%s'" % v3) print(v3) # self.conn.commit() data1 = cursor.fetchone() #self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.insert('end',data[0]) self.entryLastName.insert('end', data[1]) self.entryaccount.insert('end', data[0]) self.entrypassword.insert('end', data1[1]) # self.entryFirstName.insert('end', data[2]) self.entryTitle.insert('end', data[3]) self.entryTitleofCountry.insert('end', data[4]) self.entryBirthDate.insert('end', data[5]) self.entryHireDate.insert('end', data[6]) self.entryAddress.insert('end', data[7]) self.entryCity.insert('end', data[8]) self.entryRegion.insert('end', data[9]) self.entryPostalCode.insert('end', data[10]) self.entryCountry.insert('end', data[11]) self.entryHomePhone.insert('end', data[12]) self.entryExtension.insert('end', data[13]) self.entryNotes.insert('end', data[14]) self.entryReportsTo.insert('end', data[15]) #self.entryEmployeeID = tk.Entry(testvariable=val['EmployeeId'] ); #取值 #self.label_account["textvariable"] = val['EmployeeID'] #val['EmployeeID'].set(self.EmployeeID) class Application113(tk.Frame): # 信息查看页面 def __init__(self,master=None): self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) #self.account = account #self.password = password tk.Frame.__init__(self, master) self.grid() self.createWidgets() #self.window['bg'] = 'LemonChiffon' def createWidgets(self): #self.lblPhoto = tk.Label(self, text='员工编号') cursor = self.conn.cursor() # 启动游标 cursor.execute("select * from employee where `EmployeeID`='%s'" % v3) # 注意引号使用 data = cursor.fetchone() # 返回单个元组 self.conn.commit() if data[16]: Photo = PhotoImage(file='%s' % data[16]) print(1) else: Photo = PhotoImage(file='33.gif') # Photo = PhotoImage(file='11.gif') self.lblPhoto = Label(image=Photo) self.lblPhoto.image = Photo self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) #控制位置布局 self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏') self.lblaccount = tk.Label(self, text='员工账户') self.lblpassword = tk.Label(self, text='员工密码') self.lblFirstName = tk.Label(self, text='员工名字') self.lblTitle = tk.Label(self, text='员工职务') self.lblTitleofCountry = tk.Label(self, text='员工尊称') self.lblBirthDate = tk.Label(self, text='出生日期') self.lblHireDate = tk.Label(self, text='雇佣日期') self.lblAddress = tk.Label(self, text='家庭地址') self.lblCity = tk.Label(self, text='居住城市') self.lblRegion = tk.Label(self, text='居住地区') self.lblPostalCode = tk.Label(self, text='家庭邮编') self.lblCountry = tk.Label(self, text='国家籍贯') self.lblHomePhone = tk.Label(self, text='家庭电话') self.lblExtension = tk.Label(self, text='电话分机') self.lblNotes = tk.Label(self, text='个人备注') self.lblReportsTo = tk.Label(self, text='职位上级') #self.lblPhotoPath = tk.Label(self, text='照片路径') self.lblPhoto.grid(row=0, column=2, columnspan=2, rowspan=2, sticky=W + E + N + S, padx=5, pady=5) self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 #self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) #self.entryPhotoPath = tk.Entry(self) # 照片路径 #self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnout = tk.Button(self, text='退出', command=self.funcout,bg= 'pink') self.btnout.grid(row=18, column=101, sticky=W) self.btnok = tk.Button(self, text='确定', command=self.funcok,bg= 'pink') self.btnok.grid(row=18, column=102, sticky=W) def funcout(self): self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 def funcok(self): cursor = self.conn.cursor() #from HomePage() import login print(v3) # print(v3) # cursor.execute("select * from employee where `EmployeeID`='%s'" % v3 ) print(v3) # self.conn.commit() data = cursor.fetchone() print(data[1]) #获取到数据 #EmployeeID,LastName,FirstName,Title,TitleofCountry, BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,Notes,ReportsTo,PhotoPath,account = data #val = {} #print(val[1]) #print("22") cursor.execute("select * from login where `account`='%s'" % v3) print(v3) # self.conn.commit() data1 = cursor.fetchone() #self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.insert('end',data[0]) self.entryLastName.insert('end', data[1]) self.entryaccount.insert('end', data[0]) self.entrypassword.insert('end', data1[1]) # self.entryFirstName.insert('end', data[2]) self.entryTitle.insert('end', data[3]) self.entryTitleofCountry.insert('end', data[4]) self.entryBirthDate.insert('end', data[5]) self.entryHireDate.insert('end', data[6]) self.entryAddress.insert('end', data[7]) self.entryCity.insert('end', data[8]) self.entryRegion.insert('end', data[9]) self.entryPostalCode.insert('end', data[10]) self.entryCountry.insert('end', data[11]) self.entryHomePhone.insert('end', data[12]) self.entryExtension.insert('end', data[13]) self.entryNotes.insert('end', data[14]) self.entryReportsTo.insert('end', data[15]) #self.entryEmployeeID = tk.Entry(testvariable=val['EmployeeId'] ); #取值 #self.label_account["textvariable"] = val['EmployeeID'] #val['EmployeeID'].set(self.EmployeeID) class Application114(tk.Frame): # 信息查看页面 def __init__(self,master=None): self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) #self.account = account #self.password = password tk.Frame.__init__(self, master) self.grid() self.createWidgets() #self.window['bg'] = 'LemonChiffon' def createWidgets(self): cursor = self.conn.cursor() # 启动游标 cursor.execute("select * from employee where `EmployeeID`='%s'" % v3) # 注意引号使用 data = cursor.fetchone() # 返回单个元组 self.conn.commit() if data[16]: Photo = PhotoImage(file='%s' % data[16]) print(1) else: Photo = PhotoImage(file='44.gif') # Photo = PhotoImage(file='11.gif') self.lblPhoto = Label(image=Photo) self.lblPhoto.image = Photo self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) #控制位置布局 self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏') self.lblaccount = tk.Label(self, text='员工账户') self.lblpassword = tk.Label(self, text='员工密码') self.lblFirstName = tk.Label(self, text='员工名字') self.lblTitle = tk.Label(self, text='员工职务') self.lblTitleofCountry = tk.Label(self, text='员工尊称') self.lblBirthDate = tk.Label(self, text='出生日期') self.lblHireDate = tk.Label(self, text='雇佣日期') self.lblAddress = tk.Label(self, text='家庭地址') self.lblCity = tk.Label(self, text='居住城市') self.lblRegion = tk.Label(self, text='居住地区') self.lblPostalCode = tk.Label(self, text='家庭邮编') self.lblCountry = tk.Label(self, text='国家籍贯') self.lblHomePhone = tk.Label(self, text='家庭电话') self.lblExtension = tk.Label(self, text='电话分机') self.lblNotes = tk.Label(self, text='个人备注') self.lblReportsTo = tk.Label(self, text='职位上级') #self.lblPhotoPath = tk.Label(self, text='照片路径') self.lblPhoto.grid(row=0, column=2, columnspan=2, rowspan=2, sticky=W + E + N + S, padx=5, pady=5) self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 #self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) #self.entryPhotoPath = tk.Entry(self) # 照片路径 #self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnout = tk.Button(self, text='退出', command=self.funcout,bg= 'pink') self.btnout.grid(row=18, column=101, sticky=W) self.btnok = tk.Button(self, text='确定', command=self.funcok,bg= 'pink') self.btnok.grid(row=18, column=102, sticky=W) def funcout(self): self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 def funcok(self): cursor = self.conn.cursor() #from HomePage() import login print(v3) # print(v3) # cursor.execute("select * from employee where `EmployeeID`='%s'" % v3 ) print(v3) # self.conn.commit() data = cursor.fetchone() print(data[1]) #获取到数据 #EmployeeID,LastName,FirstName,Title,TitleofCountry, BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,Notes,ReportsTo,PhotoPath,account = data #val = {} #print(val[1]) #print("22") cursor.execute("select * from login where `account`='%s'" % v3) print(v3) # self.conn.commit() data1 = cursor.fetchone() #self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.insert('end',data[0]) self.entryLastName.insert('end', data[1]) self.entryaccount.insert('end', data[0]) self.entrypassword.insert('end', data1[1]) # self.entryFirstName.insert('end', data[2]) self.entryTitle.insert('end', data[3]) self.entryTitleofCountry.insert('end', data[4]) self.entryBirthDate.insert('end', data[5]) self.entryHireDate.insert('end', data[6]) self.entryAddress.insert('end', data[7]) self.entryCity.insert('end', data[8]) self.entryRegion.insert('end', data[9]) self.entryPostalCode.insert('end', data[10]) self.entryCountry.insert('end', data[11]) self.entryHomePhone.insert('end', data[12]) self.entryExtension.insert('end', data[13]) self.entryNotes.insert('end', data[14]) self.entryReportsTo.insert('end', data[15]) #self.entryEmployeeID = tk.Entry(testvariable=val['EmployeeId'] ); #取值 #self.label_account["textvariable"] = val['EmployeeID'] #val['EmployeeID'].set(self.EmployeeID) class Application115(tk.Frame): # 信息查看页面 def __init__(self,master=None): self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) #self.account = account #self.password = password tk.Frame.__init__(self, master) self.grid() self.createWidgets() #self.window['bg'] = 'LemonChiffon' def createWidgets(self): cursor = self.conn.cursor() # 启动游标 cursor.execute("select * from employee where `EmployeeID`='%s'" % v3) # 注意引号使用 data = cursor.fetchone() # 返回单个元组 self.conn.commit() if data[16]: Photo = PhotoImage(file='%s' % data[16]) print(1) else: Photo = PhotoImage(file='55.gif') # Photo = PhotoImage(file='11.gif') self.lblPhoto = Label(image=Photo) self.lblPhoto.image = Photo self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) #控制位置布局 self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏') self.lblaccount = tk.Label(self, text='员工账户') self.lblpassword = tk.Label(self, text='员工密码') self.lblFirstName = tk.Label(self, text='员工名字') self.lblTitle = tk.Label(self, text='员工职务') self.lblTitleofCountry = tk.Label(self, text='员工尊称') self.lblBirthDate = tk.Label(self, text='出生日期') self.lblHireDate = tk.Label(self, text='雇佣日期') self.lblAddress = tk.Label(self, text='家庭地址') self.lblCity = tk.Label(self, text='居住城市') self.lblRegion = tk.Label(self, text='居住地区') self.lblPostalCode = tk.Label(self, text='家庭邮编') self.lblCountry = tk.Label(self, text='国家籍贯') self.lblHomePhone = tk.Label(self, text='家庭电话') self.lblExtension = tk.Label(self, text='电话分机') self.lblNotes = tk.Label(self, text='个人备注') self.lblReportsTo = tk.Label(self, text='职位上级') #self.lblPhotoPath = tk.Label(self, text='照片路径') self.lblPhoto.grid(row=0, column=2, columnspan=2, rowspan=2, sticky=W + E + N + S, padx=5, pady=5) self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 #self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) #self.entryPhotoPath = tk.Entry(self) # 照片路径 #self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnout = tk.Button(self, text='退出', command=self.funcout,bg= 'pink') self.btnout.grid(row=18, column=101, sticky=W) self.btnok = tk.Button(self, text='确定', command=self.funcok,bg= 'pink') self.btnok.grid(row=18, column=102, sticky=W) def funcout(self): self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 def funcok(self): cursor = self.conn.cursor() #from HomePage() import login print(v3) # print(v3) # cursor.execute("select * from employee where `EmployeeID`='%s'" % v3 ) print(v3) # self.conn.commit() data = cursor.fetchone() print(data[1]) #获取到数据 #EmployeeID,LastName,FirstName,Title,TitleofCountry, BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,Notes,ReportsTo,PhotoPath,account = data #val = {} #print(val[1]) #print("22") cursor.execute("select * from login where `account`='%s'" % v3) print(v3) # self.conn.commit() data1 = cursor.fetchone() #self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.insert('end',data[0]) self.entryLastName.insert('end', data[1]) self.entryaccount.insert('end', data[0]) self.entrypassword.insert('end', data1[1]) # self.entryFirstName.insert('end', data[2]) self.entryTitle.insert('end', data[3]) self.entryTitleofCountry.insert('end', data[4]) self.entryBirthDate.insert('end', data[5]) self.entryHireDate.insert('end', data[6]) self.entryAddress.insert('end', data[7]) self.entryCity.insert('end', data[8]) self.entryRegion.insert('end', data[9]) self.entryPostalCode.insert('end', data[10]) self.entryCountry.insert('end', data[11]) self.entryHomePhone.insert('end', data[12]) self.entryExtension.insert('end', data[13]) self.entryNotes.insert('end', data[14]) self.entryReportsTo.insert('end', data[15]) #self.entryEmployeeID = tk.Entry(testvariable=val['EmployeeId'] ); #取值 #self.label_account["textvariable"] = val['EmployeeID'] #val['EmployeeID'].set(self.EmployeeID) class see_Information_Page1(): #窗口4.21修改信息窗口-仓储部 def __init__(self): root=tk.Tk() root.title("库存与存货管理系统") root['width']=900 root['height']=400 root.geometry('1200x600-100-100') app=Application111(master=root) app.mainloop() self.mutex=3 root.destroy() class see_Information_Page2(): #窗口4.22修改信息窗口-采购部 def __init__(self): root=tk.Tk() root.title("库存与存货管理系统") root['width']=900 root['height']=400 root.geometry('1200x600-100-100') app=Application112(master=root) app.mainloop() self.mutex=4 root.destroy() class see_Information_Page3(): #窗口4.23修改信息窗口-销售部 def __init__(self): root=tk.Tk() root.title("库存与存货管理系统") root['width']=900 root['height']=400 root.geometry('1200x600-100-100') app=Application113(master=root) app.mainloop() self.mutex=5 root.destroy() class see_Information_Page4(): #窗口4.24修改信息窗口 def __init__(self): root=tk.Tk() root.title("库存与存货管理系统") root['width']=900 root['height']=400 root.geometry('1200x600-100-100') app=Application114(master=root) app.mainloop() self.mutex=6 root.destroy() class see_Information_Page5(): #窗口4.25修改信息窗口--生产部 def __init__(self): root=tk.Tk() root.title("库存与存货管理系统") root['width']=900 root['height']=400 root.geometry('1200x600-100-100') app=Application115(master=root) app.mainloop() self.mutex=7 root.destroy() class Application1(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.grid() self.createWidgets() def createWidgets(self): # 信息修改页面 self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏' ) self.lblaccount = tk.Label(self, text='员工账户') self.lblpassword = tk.Label(self, text='员工密码' ) self.lblFirstName = tk.Label(self, text='员工名字') self.lblTitle = tk.Label(self, text='员工职务') self.lblTitleofCountry = tk.Label(self, text='员工尊称' ) self.lblBirthDate = tk.Label(self, text='出生日期') self.lblHireDate = tk.Label(self, text='雇佣日期' ) self.lblAddress = tk.Label(self, text='家庭地址' ) self.lblCity = tk.Label(self, text='居住城市') self.lblRegion = tk.Label(self, text='居住地区' ) self.lblPostalCode = tk.Label(self, text='家庭邮编') self.lblCountry = tk.Label(self, text='国家籍贯' ) self.lblHomePhone = tk.Label(self, text='家庭电话') self.lblExtension = tk.Label(self, text='电话分机' ) self.lblNotes = tk.Label(self, text='个人备注') self.lblReportsTo = tk.Label(self, text='职位上级') self.lblPhotoPath = tk.Label(self, text='照片路径') self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) self.entryPhotoPath = tk.Entry(self) # 照片路径 self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnOk = tk.Button(self, text='确定修改', command=self.funcok) self.btnOk.grid(row=18, column=100, sticky=W) self.btnout = tk.Button(self, text='退出修改', command=self.funcout) self.btnout.grid(row=18, column=101, sticky=W) def funcok(self): str1 = self.entryEmployeeID.get() # 员工编号 str2 = self.entryLastName.get() # 员工姓氏 # str3 = self.entryaccount.get() # 员工账号 str5 = self.entrypassword.get() # 员工密码 str6 = self.entryFirstName.get() # 员工名字 str7 = self.entryTitle.get() # 职务 str8 = self.entryTitleofCountry.get() # 尊称 str9 = self.entryBirthDate.get() # 出生日期 str10 = self.entryHireDate.get() # 雇佣日期 str11 = self.entryAddress.get() # 地址 str12= self.entryCity.get() # 城市 str13= self.entryRegion.get() # 地区 str14= self.entryPostalCode.get() # 邮编 str15= self.entryCountry.get() # 国家 str16= self.entryHomePhone.get() # 家庭电话 str17= self.entryExtension.get() # 分机 str18= self.entryNotes.get() #备注 str19= self.entryReportsTo.get() #上级 str20= self.entryPhotoPath.get() # 照片路径 if __name__ == "__main__": # 输出图像 image_aspect("1.gif", 150, 250).change_aspect_rate().past_background().save_result( "100000.gif") cursor = self.conn.cursor() sql = "select password from login where `account`= '%s'" % str3 # 注意包装 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: messagebox.showwarning(title='警告!', message='账户不存在,请重新输入') elif data[0] != str5: messagebox.showwarning(title='警告!', message='密码错误,请重新输入') else: sql = "select * from employee where `account`= '%s'" % str3 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: sql = "INSERT INTO employee (`EmployeeID`,`LastName`,`account`,``FirstName`,`Title`,`TitleofCountry`,`BirthDate`,`HireDate`,`Address`,`City`,`Region`,`PostalCode`,`Country`,`HomePhone`,`Extension`,`Notes`,`ReportsTo`,`PhotoPath`)" \ "VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');" % (str1, str2, str3,str6, str7, str8, str9, str10, str11, str12, str13, str14, str15, str16, str17, str18, str19, str20) cursor.execute(sql) self.conn.commit() else: sql = "update employee set `EmployeeID`='" + str1 + "' ,`LastName`='" + str2 + "',`FirstName`='" + str6 + "' ,`Title`='" + str7 + "', `TitleofCountry`='" + str8 + "', `BirthDate`='" + str9 +"' ,`HireDate`='" + str10 + "' , `Address`='" + str11 + "' , `City`='" + str12 + "',`Region`='" + str13 +"',`PostalCode`='" + str14 + "',`Country`='" + str15 + "',`HomePhone`='" + str16 +"',`Extension`='" + str17 + "',`Notes`='" + str18 +"',`ReportsTo`='" + str19 + "',`PhotoPath`='" + str20 + "' where `account`='" + str3 + "'" # 对应的登录账号(修改数据) cursor.execute(sql) self.conn.commit() cursor.close() self.conn.close() #执行sql插入语句 self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 #if __name__ == "__main__": # 输出图像 #image_aspect("1.gif", 150, 220).change_aspect_rate().past_background().save_result( "10000.gif") def funcout(self): self.mutex = 3 #直接退回operation界面 self.quit() # 销毁当前窗口 class Application2(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.grid() self.createWidgets() def createWidgets(self): # 信息修改页面 self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏') self.lblaccount = tk.Label(self, text='员工账户') self.lblpassword = tk.Label(self, text='员工密码') self.lblFirstName = tk.Label(self, text='员工名字' ) self.lblTitle = tk.Label(self, text='员工职务') self.lblTitleofCountry = tk.Label(self, text='员工尊称') self.lblBirthDate = tk.Label(self, text='出生日期' ) self.lblHireDate = tk.Label(self, text='雇佣日期') self.lblAddress = tk.Label(self, text='家庭地址') self.lblCity = tk.Label(self, text='居住城市' ) self.lblRegion = tk.Label(self, text='居住地区') self.lblPostalCode = tk.Label(self, text='家庭邮编') self.lblCountry = tk.Label(self, text='国家籍贯' ) self.lblHomePhone = tk.Label(self, text='家庭电话' ) self.lblExtension = tk.Label(self, text='电话分机' ) self.lblNotes = tk.Label(self, text='个人备注' ) self.lblReportsTo = tk.Label(self, text='职位上级' ) self.lblPhotoPath = tk.Label(self, text='照片路径' ) self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) self.entryPhotoPath = tk.Entry(self) # 照片路径 self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnOk = tk.Button(self, text='确定修改', command=self.funcok) self.btnOk.grid(row=18, column=100, sticky=W) self.btnout = tk.Button(self, text='退出修改', command=self.funcout) self.btnout.grid(row=18, column=101, sticky=W) def funcok(self): str1 = self.entryEmployeeID.get() # 员工编号 str2 = self.entryLastName.get() # 员工姓氏 # str3 = self.entryaccount.get() # 员工账号 str5 = self.entrypassword.get() # 员工密码 str6 = self.entryFirstName.get() # 员工名字 str7 = self.entryTitle.get() # 职务 str8 = self.entryTitleofCountry.get() # 尊称 str9 = self.entryBirthDate.get() # 出生日期 str10 = self.entryHireDate.get() # 雇佣日期 str11 = self.entryAddress.get() # 地址 str12= self.entryCity.get() # 城市 str13= self.entryRegion.get() # 地区 str14= self.entryPostalCode.get() # 邮编 str15= self.entryCountry.get() # 国家 str16= self.entryHomePhone.get() # 家庭电话 str17= self.entryExtension.get() # 分机 str18= self.entryNotes.get() #备注 str19= self.entryReportsTo.get() #上级 str20= self.entryPhotoPath.get() # 照片路径 if __name__ == "__main__": # 输出图像 image_aspect("1.gif", 150, 250).change_aspect_rate().past_background().save_result( "100000.gif") cursor = self.conn.cursor() sql = "select password from login where `account`= '%s'" % str3 # 注意包装 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: messagebox.showwarning(title='警告!', message='账户不存在,请重新输入') elif data[0] != str5: messagebox.showwarning(title='警告!', message='密码错误,请重新输入') else: sql = "select * from employee where `account`= '%s'" % str3 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: sql = "INSERT INTO employee (`EmployeeID`,`LastName`,`account`,``FirstName`,`Title`,`TitleofCountry`,`BirthDate`,`HireDate`,`Address`,`City`,`Region`,`PostalCode`,`Country`,`HomePhone`,`Extension`,`Notes`,`ReportsTo`,`PhotoPath`)" \ "VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');" % (str1, str2, str3,str6, str7, str8, str9, str10, str11, str12, str13, str14, str15, str16, str17, str18, str19, str20) cursor.execute(sql) self.conn.commit() else: sql = "update employee set `EmployeeID`='" + str1 + "' ,`LastName`='" + str2 + "',`FirstName`='" + str6 + "' ,`Title`='" + str7 + "', `TitleofCountry`='" + str8 + "', `BirthDate`='" + str9 +"' ,`HireDate`='" + str10 + "' , `Address`='" + str11 + "' , `City`='" + str12 + "',`Region`='" + str13 +"',`PostalCode`='" + str14 + "',`Country`='" + str15 + "',`HomePhone`='" + str16 +"',`Extension`='" + str17 + "',`Notes`='" + str18 +"',`ReportsTo`='" + str19 + "',`PhotoPath`='" + str20 + "' where `account`='" + str3 + "'" # 对应的登录账号(修改数据) cursor.execute(sql) self.conn.commit() cursor.close() self.conn.close() #执行sql插入语句 self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 #if __name__ == "__main__": # 输出图像 #image_aspect("1.gif", 150, 220).change_aspect_rate().past_background().save_result( "10000.gif") def funcout(self): self.mutex = 3 #直接退回operation界面 self.quit() # 销毁当前窗口 class Application3(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.grid() self.createWidgets() def createWidgets(self): # 信息修改页面 self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏' ) self.lblaccount = tk.Label(self, text='员工账户') self.lblpassword = tk.Label(self, text='员工密码') self.lblFirstName = tk.Label(self, text='员工名字') self.lblTitle = tk.Label(self, text='员工职务' ) self.lblTitleofCountry = tk.Label(self, text='员工尊称') self.lblBirthDate = tk.Label(self, text='出生日期' ) self.lblHireDate = tk.Label(self, text='雇佣日期' ) self.lblAddress = tk.Label(self, text='家庭地址' ) self.lblCity = tk.Label(self, text='居住城市') self.lblRegion = tk.Label(self, text='居住地区' ) self.lblPostalCode = tk.Label(self, text='家庭邮编' ) self.lblCountry = tk.Label(self, text='国家籍贯' ) self.lblHomePhone = tk.Label(self, text='家庭电话') self.lblExtension = tk.Label(self, text='电话分机') self.lblNotes = tk.Label(self, text='个人备注') self.lblReportsTo = tk.Label(self, text='职位上级' ) self.lblPhotoPath = tk.Label(self, text='照片路径' ) self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) self.entryPhotoPath = tk.Entry(self) # 照片路径 self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnOk = tk.Button(self, text='确定修改', command=self.funcok) self.btnOk.grid(row=18, column=100, sticky=W) self.btnout = tk.Button(self, text='退出修改', command=self.funcout) self.btnout.grid(row=18, column=101, sticky=W) def funcok(self): str1 = self.entryEmployeeID.get() # 员工编号 str2 = self.entryLastName.get() # 员工姓氏 # str3 = self.entryaccount.get() # 员工账号 str5 = self.entrypassword.get() # 员工密码 str6 = self.entryFirstName.get() # 员工名字 str7 = self.entryTitle.get() # 职务 str8 = self.entryTitleofCountry.get() # 尊称 str9 = self.entryBirthDate.get() # 出生日期 str10 = self.entryHireDate.get() # 雇佣日期 str11 = self.entryAddress.get() # 地址 str12= self.entryCity.get() # 城市 str13= self.entryRegion.get() # 地区 str14= self.entryPostalCode.get() # 邮编 str15= self.entryCountry.get() # 国家 str16= self.entryHomePhone.get() # 家庭电话 str17= self.entryExtension.get() # 分机 str18= self.entryNotes.get() #备注 str19= self.entryReportsTo.get() #上级 str20= self.entryPhotoPath.get() # 照片路径 if __name__ == "__main__": # 输出图像 image_aspect("1.gif", 150, 250).change_aspect_rate().past_background().save_result( "100000.gif") cursor = self.conn.cursor() sql = "select password from login where `account`= '%s'" % str3 # 注意包装 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: messagebox.showwarning(title='警告!', message='账户不存在,请重新输入') elif data[0] != str5: messagebox.showwarning(title='警告!', message='密码错误,请重新输入') else: sql = "select * from employee where `account`= '%s'" % str3 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: sql = "INSERT INTO employee (`EmployeeID`,`LastName`,`account`,``FirstName`,`Title`,`TitleofCountry`,`BirthDate`,`HireDate`,`Address`,`City`,`Region`,`PostalCode`,`Country`,`HomePhone`,`Extension`,`Notes`,`ReportsTo`,`PhotoPath`)" \ "VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');" % (str1, str2, str3,str6, str7, str8, str9, str10, str11, str12, str13, str14, str15, str16, str17, str18, str19, str20) cursor.execute(sql) self.conn.commit() else: sql = "update employee set `EmployeeID`='" + str1 + "' ,`LastName`='" + str2 + "',`FirstName`='" + str6 + "' ,`Title`='" + str7 + "', `TitleofCountry`='" + str8 + "', `BirthDate`='" + str9 +"' ,`HireDate`='" + str10 + "' , `Address`='" + str11 + "' , `City`='" + str12 + "',`Region`='" + str13 +"',`PostalCode`='" + str14 + "',`Country`='" + str15 + "',`HomePhone`='" + str16 +"',`Extension`='" + str17 + "',`Notes`='" + str18 +"',`ReportsTo`='" + str19 + "',`PhotoPath`='" + str20 + "' where `account`='" + str3 + "'" # 对应的登录账号(修改数据) cursor.execute(sql) self.conn.commit() cursor.close() self.conn.close() #执行sql插入语句 self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 #if __name__ == "__main__": # 输出图像 #image_aspect("1.gif", 150, 220).change_aspect_rate().past_background().save_result( "10000.gif") def funcout(self): self.mutex = 3 #直接退回operation界面 self.quit() # 销毁当前窗口 class Application4(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.grid() self.createWidgets() def createWidgets(self): # 信息修改页面 self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏') self.lblaccount = tk.Label(self, text='员工账户' ) self.lblpassword = tk.Label(self, text='员工密码') self.lblFirstName = tk.Label(self, text='员工名字') self.lblTitle = tk.Label(self, text='员工职务' ) self.lblTitleofCountry = tk.Label(self, text='员工尊称' ) self.lblBirthDate = tk.Label(self, text='出生日期' ) self.lblHireDate = tk.Label(self, text='雇佣日期' ) self.lblAddress = tk.Label(self, text='家庭地址') self.lblCity = tk.Label(self, text='居住城市' ) self.lblRegion = tk.Label(self, text='居住地区') self.lblPostalCode = tk.Label(self, text='家庭邮编' ) self.lblCountry = tk.Label(self, text='国家籍贯' ) self.lblHomePhone = tk.Label(self, text='家庭电话' ) self.lblExtension = tk.Label(self, text='电话分机') self.lblNotes = tk.Label(self, text='个人备注') self.lblReportsTo = tk.Label(self, text='职位上级' ) self.lblPhotoPath = tk.Label(self, text='照片路径' ) self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) self.entryPhotoPath = tk.Entry(self) # 照片路径 self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnOk = tk.Button(self, text='确定修改', command=self.funcok) self.btnOk.grid(row=18, column=100, sticky=W) self.btnout = tk.Button(self, text='退出修改', command=self.funcout) self.btnout.grid(row=18, column=101, sticky=W) def funcok(self): str1 = self.entryEmployeeID.get() # 员工编号 str2 = self.entryLastName.get() # 员工姓氏 # str3 = self.entryaccount.get() # 员工账号 str5 = self.entrypassword.get() # 员工密码 str6 = self.entryFirstName.get() # 员工名字 str7 = self.entryTitle.get() # 职务 str8 = self.entryTitleofCountry.get() # 尊称 str9 = self.entryBirthDate.get() # 出生日期 str10 = self.entryHireDate.get() # 雇佣日期 str11 = self.entryAddress.get() # 地址 str12= self.entryCity.get() # 城市 str13= self.entryRegion.get() # 地区 str14= self.entryPostalCode.get() # 邮编 str15= self.entryCountry.get() # 国家 str16= self.entryHomePhone.get() # 家庭电话 str17= self.entryExtension.get() # 分机 str18= self.entryNotes.get() #备注 str19= self.entryReportsTo.get() #上级 str20= self.entryPhotoPath.get() # 照片路径 if __name__ == "__main__": # 输出图像 image_aspect("1.gif", 150, 250).change_aspect_rate().past_background().save_result( "100000.gif") cursor = self.conn.cursor() sql = "select password from login where `account`= '%s'" % str3 # 注意包装 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: messagebox.showwarning(title='警告!', message='账户不存在,请重新输入') elif data[0] != str5: messagebox.showwarning(title='警告!', message='密码错误,请重新输入') else: sql = "select * from employee where `account`= '%s'" % str3 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: sql = "INSERT INTO employee (`EmployeeID`,`LastName`,`account`,``FirstName`,`Title`,`TitleofCountry`,`BirthDate`,`HireDate`,`Address`,`City`,`Region`,`PostalCode`,`Country`,`HomePhone`,`Extension`,`Notes`,`ReportsTo`,`PhotoPath`)" \ "VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');" % (str1, str2, str3,str6, str7, str8, str9, str10, str11, str12, str13, str14, str15, str16, str17, str18, str19, str20) cursor.execute(sql) self.conn.commit() else: sql = "update employee set `EmployeeID`='" + str1 + "' ,`LastName`='" + str2 + "',`FirstName`='" + str6 + "' ,`Title`='" + str7 + "', `TitleofCountry`='" + str8 + "', `BirthDate`='" + str9 +"' ,`HireDate`='" + str10 + "' , `Address`='" + str11 + "' , `City`='" + str12 + "',`Region`='" + str13 +"',`PostalCode`='" + str14 + "',`Country`='" + str15 + "',`HomePhone`='" + str16 +"',`Extension`='" + str17 + "',`Notes`='" + str18 +"',`ReportsTo`='" + str19 + "',`PhotoPath`='" + str20 + "' where `account`='" + str3 + "'" # 对应的登录账号(修改数据) cursor.execute(sql) self.conn.commit() cursor.close() self.conn.close() #执行sql插入语句 self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 #if __name__ == "__main__": # 输出图像 #image_aspect("1.gif", 150, 220).change_aspect_rate().past_background().save_result( "10000.gif") def funcout(self): self.mutex = 3 #直接退回operation界面 self.quit() # 销毁当前窗口 class Application5(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.grid() self.createWidgets() def createWidgets(self): # 信息修改页面 self.lblHello = tk.Label(self, text='\n\n\n\n ' ' ', font=('Helvetica', 12, 'bold')) self.lblEmployeeID = tk.Label(self, text='员工编号') self.lblLastName = tk.Label(self, text='员工姓氏' ) self.lblaccount = tk.Label(self, text='员工账户' ) self.lblpassword = tk.Label(self, text='员工密码' ) self.lblFirstName = tk.Label(self, text='员工名字') self.lblTitle = tk.Label(self, text='员工职务' ) self.lblTitleofCountry = tk.Label(self, text='员工尊称' ) self.lblBirthDate = tk.Label(self, text='出生日期' ) self.lblHireDate = tk.Label(self, text='雇佣日期') self.lblAddress = tk.Label(self, text='家庭地址') self.lblCity = tk.Label(self, text='居住城市') self.lblRegion = tk.Label(self, text='居住地区' ) self.lblPostalCode = tk.Label(self, text='家庭邮编') self.lblCountry = tk.Label(self, text='国家籍贯' ) self.lblHomePhone = tk.Label(self, text='家庭电话' ) self.lblExtension = tk.Label(self, text='电话分机' ) self.lblNotes = tk.Label(self, text='个人备注') self.lblReportsTo = tk.Label(self, text='职位上级') self.lblPhotoPath = tk.Label(self, text='照片路径' ) self.lblHello.grid(row=2, column=80, sticky=tk.E) # hello语句 self.lblEmployeeID.grid(row=3, column=85, sticky=tk.E) # 员工编号 self.lblLastName.grid(row=3, column=105, sticky=tk.E) # 员工姓氏 self.lblaccount.grid(row=4, column=85, sticky=tk.E) # 账号 self.lblpassword.grid(row=4, column=105, sticky=tk.E) # 密码 self.lblFirstName.grid(row=5, column=85, sticky=tk.E) # 名字 self.lblTitle.grid(row=5, column=105, sticky=tk.E) # 头衔职务 self.lblTitleofCountry.grid(row=6, column=85, sticky=tk.E) # 尊称 self.lblBirthDate.grid(row=6, column=105, sticky=tk.E) # 出生日期 self.lblHireDate.grid(row=7, column=85, sticky=tk.E) # 雇用日期 self.lblAddress.grid(row=7, column=105, sticky=tk.E) # 地址 self.lblCity.grid(row=8, column=85, sticky=tk.E) # 城市 self.lblRegion.grid(row=8, column=105, sticky=tk.E) # 地区 self.lblPostalCode.grid(row=9, column=85, sticky=tk.E) # 邮编 self.lblCountry.grid(row=9, column=105, sticky=tk.E) # 国家 self.lblHomePhone.grid(row=10, column=85, sticky=tk.E) # 家庭电话 self.lblExtension.grid(row=10, column=105, sticky=tk.E) # 分机 self.lblNotes.grid(row=11, column=85, sticky=tk.E) # 备注 self.lblReportsTo.grid(row=11, column=105, sticky=tk.E) # 上级 self.lblPhotoPath.grid(row=12, column=85, sticky=tk.E) # 照片路径 self.entryEmployeeID = tk.Entry(self) # 员工编号 self.entryEmployeeID.grid(row=3, column=86, columnspan=9) self.entryLastName = tk.Entry(self) # 员工姓氏 self.entryLastName.grid(row=3, column=106, columnspan=9) self.entryaccount = tk.Entry(self) # 账号 self.entryaccount.grid(row=4, column=86, columnspan=9) self.entrypassword = tk.Entry(self) # 密码 self.entrypassword.grid(row=4, column=106, columnspan=9) self.entryFirstName = tk.Entry(self) # 名字 self.entryFirstName.grid(row=5, column=86, columnspan=9) self.entryTitle = tk.Entry(self) # 职位 self.entryTitle.grid(row=5, column=106, columnspan=9) self.entryTitleofCountry = tk.Entry(self) # 尊称 self.entryTitleofCountry.grid(row=6, column=86, columnspan=9) self.entryBirthDate = tk.Entry(self) # 出生日期 self.entryBirthDate.grid(row=6, column=106, columnspan=9) self.entryHireDate = tk.Entry(self) # 雇佣日期 self.entryHireDate.grid(row=7, column=86, columnspan=9) self.entryAddress = tk.Entry(self) # 地址 self.entryAddress.grid(row=7, column=106, columnspan=9) self.entryCity = tk.Entry(self) # 城市 self.entryCity.grid(row=8, column=86, columnspan=9) self.entryRegion = tk.Entry(self) # 地区 self.entryRegion.grid(row=8, column=106, columnspan=9) self.entryPostalCode = tk.Entry(self) # 邮编 self.entryPostalCode.grid(row=9, column=86, columnspan=9) self.entryCountry = tk.Entry(self) # 国家 self.entryCountry.grid(row=9, column=106, columnspan=9) self.entryHomePhone = tk.Entry(self) # 家庭电话 self.entryHomePhone.grid(row=10, column=86, columnspan=9) self.entryExtension = tk.Entry(self) # 分机 self.entryExtension.grid(row=10, column=106, columnspan=9) self.entryNotes = tk.Entry(self) # 备注 self.entryNotes.grid(row=11, column=86, columnspan=9) self.entryReportsTo = tk.Entry(self) # 上级 self.entryReportsTo.grid(row=11, column=106, columnspan=9) self.entryPhotoPath = tk.Entry(self) # 照片路径 self.entryPhotoPath.grid(row=12, column=86, columnspan=9) self.conn = pymysql.Connect( host='localhost', port=3306, user='root', passwd='12345', db='库存与存货系统', charset="utf8" ) # 连接数据库 self.btnOk = tk.Button(self, text='确定修改', command=self.funcok) self.btnOk.grid(row=18, column=100, sticky=W) self.btnout = tk.Button(self, text='退出修改', command=self.funcout) self.btnout.grid(row=18, column=101, sticky=W) def funcok(self): str1 = self.entryEmployeeID.get() # 员工编号 str2 = self.entryLastName.get() # 员工姓氏 # str3 = self.entryaccount.get() # 员工账号 str5 = self.entrypassword.get() # 员工密码 str6 = self.entryFirstName.get() # 员工名字 str7 = self.entryTitle.get() # 职务 str8 = self.entryTitleofCountry.get() # 尊称 str9 = self.entryBirthDate.get() # 出生日期 str10 = self.entryHireDate.get() # 雇佣日期 str11 = self.entryAddress.get() # 地址 str12= self.entryCity.get() # 城市 str13= self.entryRegion.get() # 地区 str14= self.entryPostalCode.get() # 邮编 str15= self.entryCountry.get() # 国家 str16= self.entryHomePhone.get() # 家庭电话 str17= self.entryExtension.get() # 分机 str18= self.entryNotes.get() #备注 str19= self.entryReportsTo.get() #上级 str20= self.entryPhotoPath.get() # 照片路径 if __name__ == "__main__": # 输出图像 image_aspect("1.gif", 150, 250).change_aspect_rate().past_background().save_result( "100000.gif") cursor = self.conn.cursor() sql = "select password from login where `account`= '%s'" % str3 # 注意包装 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: messagebox.showwarning(title='警告!', message='账户不存在,请重新输入') elif data[0] != str5: messagebox.showwarning(title='警告!', message='密码错误,请重新输入') else: sql = "select * from employee where `account`= '%s'" % str3 cursor.execute(sql) data = cursor.fetchone() self.conn.commit() if not data: sql = "INSERT INTO employee (`EmployeeID`,`LastName`,`account`,``FirstName`,`Title`,`TitleofCountry`,`BirthDate`,`HireDate`,`Address`,`City`,`Region`,`PostalCode`,`Country`,`HomePhone`,`Extension`,`Notes`,`ReportsTo`,`PhotoPath`)" \ "VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');" % (str1, str2, str3,str6, str7, str8, str9, str10, str11, str12, str13, str14, str15, str16, str17, str18, str19, str20) cursor.execute(sql) self.conn.commit() else: sql = "update employee set `EmployeeID`='" + str1 + "' ,`LastName`='" + str2 + "',`FirstName`='" + str6 + "' ,`Title`='" + str7 + "', `TitleofCountry`='" + str8 + "', `BirthDate`='" + str9 +"' ,`HireDate`='" + str10 + "' , `Address`='" + str11 + "' , `City`='" + str12 + "',`Region`='" + str13 +"',`PostalCode`='" + str14 + "',`Country`='" + str15 + "',`HomePhone`='" + str16 +"',`Extension`='" + str17 + "',`Notes`='" + str18 +"',`ReportsTo`='" + str19 + "',`PhotoPath`='" + str20 + "' where `account`='" + str3 + "'" # 对应的登录账号(修改数据) cursor.execute(sql) self.conn.commit() cursor.close() self.conn.close() #执行sql插入语句 self.mutex = 3 # 直接退回operation界面 self.quit() # 销毁当前窗口 #if __name__ == "__main__": # 输出图像 #image_aspect("1.gif", 150, 220).change_aspect_rate().past_background().save_result( "10000.gif") def funcout(self): self.mutex = 3 #直接退回operation界面 self.quit() # 销毁当前窗口 class Modify_Information_Page1(): #窗口4.2修改信息窗口 (美工有误) def __init__(self): root=tk.Tk() root.title("库存与存货管理系统") root['width']=900 root['height']=400 root.geometry('1200x600-100-100') app=Application1(master=root) app.mainloop() #root['bg'] = 'LightYellow' self.mutex=3 root.destroy() class Modify_Information_Page2(): # 窗口4.2修改信息窗口 (美工有误) def __init__(self): root = tk.Tk() root.title("库存与存货管理系统") root['width'] = 900 root['height'] = 400 root.geometry('1200x600-100-100') app = Application2(master=root) app.mainloop() # root['bg'] = 'LightYellow' self.mutex = 4 root.destroy() class Modify_Information_Page3(): # 窗口4.2修改信息窗口 (美工有误) def __init__(self): root = tk.Tk() root.title("库存与存货管理系统") root['width'] = 900 root['height'] = 400 root.geometry('1200x600-100-100') app = Application3(master=root) app.mainloop() # root['bg'] = 'LightYellow' self.mutex = 5 root.destroy() class Modify_Information_Page4(): # 窗口4.2修改信息窗口 (美工有误) def __init__(self): root = tk.Tk() root.title("库存与存货管理系统") root['width'] = 900 root['height'] = 400 root.geometry('1200x600-100-100') app = Application4(master=root) app.mainloop() # root['bg'] = 'LightYellow' self.mutex = 6 root.destroy() class Modify_Information_Page5(): # 窗口4.2修改信息窗口 (美工有误) def __init__(self): root = tk.Tk() root.title("库存与存货管理系统") root['width'] = 900 root['height'] = 400 root.geometry('1200x600-100-100') app = Application5(master=root) app.mainloop() # root['bg'] = 'LightYellow' self.mutex =7 root.destroy() class image_aspect(): #图像转换 def __init__(self, image_file, aspect_width, aspect_height): self.img = Image.open(image_file) self.aspect_width = aspect_width self.aspect_height = aspect_height self.result_image = None def change_aspect_rate(self): img_width = self.img.size[0] img_height = self.img.size[1] if (img_width / img_height) > (self.aspect_width / self.aspect_height): rate = self.aspect_width / img_width else: rate = self.aspect_height / img_height rate = round(rate, 1) print(rate) self.img = self.img.resize((int(img_width * rate), int(img_height * rate))) return self def past_background(self): self.result_image = Image.new("RGB", [self.aspect_width, self.aspect_height], (0, 0, 0, 255)) self.result_image.paste(self.img, ( int((self.aspect_width - self.img.size[0]) / 2), int((self.aspect_height - self.img.size[1]) / 2))) return self def save_result(self, file_name): self.result_image.save(file_name) #if __name__ == "__main__": #输出图像 #image_aspect("1.gif", 150, 250).change_aspect_rate().past_background().save_result( #"10000.gif") if __name__ == '__main__': #分窗口程序 mutex=1 while(1): if mutex==1: #窗口1为首页 homepage=HomePage() mutex=homepage.mutex continue elif mutex==2: #窗口2为注册页面 registerPage=RegisterPage() mutex=registerPage.mutex continue elif mutex==3: #窗口3为operation1界面 mutex=OperationPage1().mutex continue elif mutex==4: #窗口4为operation2界面 mutex=OperationPage2().mutex continue elif mutex==5: #窗口5为operation3界面 mutex=OperationPage3().mutex continue elif mutex==6: #窗口3为operation4界面 mutex=OperationPage4().mutex continue elif mutex==7: #窗口3为operation5界面 mutex=OperationPage5().mutex continue elif mutex== 18.1: # 窗口18为通告界面--仓储部 import 公告111 # 引入公告文件 mutex = 3 continue elif mutex== 18.2: # 窗口18为通告界面--采购部 import 公告111 # 引入公告文件 mutex = 4 continue elif mutex== 18.3: # 窗口18为通告界面--销售部 import 公告111 # 引入公告文件 mutex = 5 continue elif mutex== 18.4: # 窗口18为通告界面--财务部 import 公告111 # 引入公告文件 mutex = 6 continue elif mutex== 18.5: # 窗口18为通告界面--生产部 import 公告111 # 引入公告文件 mutex = 7 continue elif mutex == 4.11: # 窗口4.11为个人信息查看窗口-仓储部 mutex =see_Information_Page1().mutex continue elif mutex == 4.21: # 窗口4.21为修改信息窗口--仓储部 mutex = Modify_Information_Page1().mutex continue elif mutex == 4.12: # 窗口4.12为个人信息查看窗口-采购部 mutex =see_Information_Page2().mutex continue elif mutex == 4.22: # 窗口4.22为修改信息窗口--采购部 mutex = Modify_Information_Page2().mutex continue elif mutex == 4.13: # 窗口4.13为个人信息查看窗口-销售部 mutex =see_Information_Page3().mutex continue elif mutex == 4.23: # 窗口4.23为修改信息窗口--销售部 mutex = Modify_Information_Page3().mutex continue elif mutex == 4.14: # 窗口4.14为个人信息查看窗口-财务部 mutex =see_Information_Page4().mutex continue elif mutex == 4.24: # 窗口4.24为修改信息窗口--财务部 mutex = Modify_Information_Page4().mutex continue elif mutex == 4.15: # 窗口4.15为个人信息查看窗口-生产部 mutex =see_Information_Page5().mutex continue elif mutex == 4.25: # 窗口4.25为修改信息窗口--生产部 mutex = Modify_Information_Page5().mutex continue elif mutex == 7.31: # 窗口7.31为产品出库单窗口 import 仓储部产品出库单 # 直接调用出库单文件页面 mutex = 3 continue elif mutex == 6.1: # 窗口6.1为产品出库单窗口 import 盘点单 # 直接调用盘点单文件页面 mutex = 3 continue elif mutex == 5.1: # 窗口5.1为成品情况窗口 import 成品 # 直接调用成品文件页面 mutex = 3 continue elif mutex == 5.2: # 窗口5.2为原材料情况窗口 import 原材料 # 直接调用原材料文件页面 mutex = 3 continue elif mutex == 6.1: # 窗口6.1为盘点单 import 盘点单 # 直接调用盘点单 mutex = 3 continue elif mutex == 6.3: # 窗口6.5为仓储部原材料入库 import 仓储部原材料入库 # 直接调用仓储部原材料入库 mutex = 3 continue elif mutex == 6.4: # 窗口6.5为产成品入库 import 仓储部产品入库单 # 直接调用仓储部原材料入库 mutex = 3 continue elif mutex == 6.5: # 窗口6.5仓储部产品出库单 import 仓储部产品出库单 # 直接调用仓储部产品出库单 mutex = 3 continue elif mutex == 6.6: # 窗口6.6仓储部原料出库单窗口 import 仓储部原料出库单 # 直接调用仓储部原料出库单 mutex = 3 continue elif mutex == 8.1: # 窗口8.1原材料采购单 import 原料采购单 # 直接调用原材料采购单 mutex = 4 continue elif mutex == 8.2: # 窗口8.2采购部原材料采购视图单 import 原材料采购视图单 # 采购部原材料采购视图单 mutex = 4 continue elif mutex == 9.1: # 窗口9.1销售部产品请求单 import 销售部产品请求单 # 销售部产品请求单 mutex = 5 continue elif mutex == 9.2: # 窗口9.2销售请求单据视图 import 销售请求单据视图 # 销售请求单据视图 mutex = 5 continue elif mutex == 10.1: # 窗口10.1生产部原材料请求单 import 生产部原材料请求单 # 生产部原材料请求单 mutex = 7 continue elif mutex == 10.2: # 窗口10.2生产部产品生产单 import 生产部产品生产单 # 生产部产品生产单 mutex =7 continue elif mutex == 10.3: # 窗口10.3原材料入生产单据 import 原材料入生产单据 # 原材料入生产单据 mutex = 7 continue elif mutex == 10.4: # 窗口10.4产成品生成单据 import 产成品生成单据 # 产成品生成单据 mutex =7 continue elif mutex == 11.1: # 窗口11.1采购发票 import 采购发票 # 采购发票 mutex = 6 continue elif mutex == 11.2: # 窗口11.2销售发票 import 销售发票 # 销售发票 mutex = 6 continue elif mutex == 11.3: # 窗口11.3采购入库发票单据 import 采购入库发票单据 # 采购入库发票单据 mutex =6 continue elif mutex == 11.4: # 窗口11.4采购入库发票单据 import 销售出库发票单据 # 采购入库发票单据 mutex = 6 continue else: # 结束 break
ERP-库存与存货-库存与存货
最新推荐文章于 2022-11-23 16:11:23 发布