diff --git a/carrepairsystem/.idea/.gitignore b/carrepairsystem/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/carrepairsystem/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/carrepairsystem/.idea/.name b/carrepairsystem/.idea/.name new file mode 100644 index 0000000..3a018c9 --- /dev/null +++ b/carrepairsystem/.idea/.name @@ -0,0 +1 @@ +python课程设计 \ No newline at end of file diff --git a/carrepairsystem/.idea/inspectionProfiles/profiles_settings.xml b/carrepairsystem/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/carrepairsystem/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/carrepairsystem/.idea/misc.xml b/carrepairsystem/.idea/misc.xml new file mode 100644 index 0000000..a6218fe --- /dev/null +++ b/carrepairsystem/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/carrepairsystem/.idea/modules.xml b/carrepairsystem/.idea/modules.xml new file mode 100644 index 0000000..16f2563 --- /dev/null +++ b/carrepairsystem/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/carrepairsystem/.idea/python课程设计.iml b/carrepairsystem/.idea/python课程设计.iml new file mode 100644 index 0000000..909438d --- /dev/null +++ b/carrepairsystem/.idea/python课程设计.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/carrepairsystem/Administration_pack/Administration_information.py b/carrepairsystem/Administration_pack/Administration_information.py new file mode 100644 index 0000000..eda8a6c --- /dev/null +++ b/carrepairsystem/Administration_pack/Administration_information.py @@ -0,0 +1,125 @@ +from tkinter import * +from tkinter import ttk +from tkinter import messagebox +from PIL import Image, ImageTk +from main_pack.Save_excel import save_execel +from image import try_dun as bt + +def check(a): + if type(a)==type(None): + return 'Null' + else: + return a + +def fan_check(a): + if a=='Null' or a=='': + return None + else: + return int(a) + +def change(cur,num,name,money,password,fix_num): + print([name,fan_check(money),password,fan_check(fix_num),int(num)]) + sql='UPDATE administration SET Administration_name=%s ,Administration_money=%s,Administration_password=%s,Administration_fix_num=%s where Administration_num=%s' + cur.execute(sql,[name,fan_check(money),password,fan_check(fix_num),int(num)]) + messagebox.showwarning(title="成功", message='信息更新成功!') + +def input_name(name,cur,treeview): + if name=="": + messagebox.showwarning(title="错误", message='请输入信息!') + else: + sql="select * from administration where Administration_name like '%"+name+"%'" + cur.execute(sql) + n = cur.fetchall() + print(n) + messagebox.showwarning(title="正确", message='信息查询成功!') + for i in range(len(n)): + treeview.insert("",i,values=(n[i][0],n[i][1],n[i][2],n[i][3],n[i][4])) + +def treeview_sort_column(tv, col, reverse): + l = [(tv.set(k, col), k) for k in tv.get_children('')] + print(tv.get_children('')) + l.sort(reverse=reverse) + for index, (val, k) in enumerate(l): + tv.move(k, '', index) + print(k) + tv.heading(col, command=lambda: treeview_sort_column(tv, col, not reverse)) + +def administration(Main,cur): + root, ft, ft1, ft2 = Main.yemian(None) + frame_new, label_tk = Main.getframe(None, root) + global photo + img = Image.open('D:\carrepairsystem\image\左贴图.jpg') + photo = ImageTk.PhotoImage(img) + Label(frame_new, image=photo).place(x=0, y=0) + bt.button_fun(root, frame_new,cur,Main) + def delete(cur, num, frame): + print(num) + sql = "delete from administration where Administration_num=%s" + cur.execute(sql, [int(num)]) + messagebox.showwarning(title="成功", message='信息删除成功!') + frame.destroy() + win() + def win(): + frame=Main.Frame_fun(None,root) + root.title('汽车修理系统——人员信息') + n=cur.execute("select * from Administration") + n=cur.fetchall() + print(n) + num=len(n) + LabelList=[] + ButtonList=[[i for j in range(2)] for i in range(num)] + EntryList=[[i for j in range(4)] for i in range(num)] + for i in range(num): + LabelList.append(i) + Label(frame, text="用户编号 ",font=ft1,bg='#d3d7d4').grid(row=0,column=1) + Label(frame, text="用户名称 ",font=ft1,bg='#d3d7d4').grid(row=0,column=2) + Label(frame, text="用户工资 ",font=ft1,bg='#d3d7d4').grid(row=0,column=3) + Label(frame, text="用户密码 ",font=ft1,bg='#d3d7d4').grid(row=0,column=4) + Label(frame, text="修理数量 ",font=ft1,bg='#d3d7d4').grid(row=0,column=5) + Label(frame, text="具体",font=ft1,bg='#d3d7d4').grid(row=0,column=6) + Label(frame, text="操作 ", font=ft1, bg='#d3d7d4').grid(row=0, column=7) + for i in range(num): + LabelList[i]=Label(frame,text=n[i][0],font=ft1,anchor="nw") + LabelList[i].grid(row=i+1, column=1) + for j in range(4): + EntryList[i][j]=Entry(frame, font=ft1, width=11) + EntryList[i][j].grid(row=1 + i, column=2+j) + EntryList[i][j].delete(0, "end") + EntryList[i][j].insert(0,check(n[i][j+1])) + if j==3: + ButtonList[i][0]=Button(frame, text="删除",font=ft2,background="#90d7ec",relief=FLAT,command=lambda f=LabelList[i].cget("text"):delete(cur,f,frame))#删除按钮 + ButtonList[i][1]=Button(frame, text="修改", font=ft2,background="#90d7ec",relief=FLAT,\ + command=lambda f=LabelList[i].cget("text"),fname=EntryList[i][0].get(),fmoney=EntryList[i][1].get(),fpasword=EntryList[i][2].get(),fnum=EntryList[i][3].get()\ + :change(cur,f,fname,fmoney,fpasword,fnum)) # 修改按钮 + ButtonList[i][0].grid(row=1 + i, column=6) + ButtonList[i][1].grid(row=1 + i, column=7) + win() + frame1 = Main.Frame_fun2(None, root) + colums = ("用户编号", "用户名称", "用户工资", "用户密码", "修理数量") + treeview = ttk.Treeview(frame1, height=190, show="headings", columns=colums) + treeview.column("用户编号", width=100, anchor='center') + treeview.column("用户名称", width=100, anchor='center') + treeview.column("用户工资", width=100, anchor='center') + treeview.column("用户密码", width=100, anchor='center') + treeview.column("修理数量", width=100, anchor='center') + treeview.heading('用户编号', text='用户编号') + treeview.heading('用户名称', text='用户名称') + treeview.heading('用户工资', text='用户工资') + treeview.heading('用户密码', text='用户密码') + treeview.heading('修理数量', text='修理数量') + treeview.place(x=0, y=0) + labe1=Label(frame1,text="用户姓名:",font=ft1) + labe1.place(x=525,y=50) + entry_next=Entry(frame1,font=ft1) + entry_next.place(x=640,y=50,width=130) + button_next=Button(frame1,text="查 询",font=ft2,command=lambda :input_name(entry_next.get(),cur,treeview)) + button_next.place(x=535,y=90,width=230) + button_next_1=Button(frame1,text="导出数据",font=ft2,command=lambda :save_execel(cur,"administration")) + button_next_1.place(x=535,y=130,width=230) + button_next_2=Button(frame1,text="回到主页",font=ft2) + #button_next_2.place(x=535,y=170,width=230) + for col in colums: + if col!="用户名称" and col!="用户密码": + treeview.heading(col, text=col, command=lambda _col=col: treeview_sort_column(treeview, _col, False)) + + root.mainloop() \ No newline at end of file diff --git a/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-311.pyc b/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-311.pyc new file mode 100644 index 0000000..0915007 Binary files /dev/null and b/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-311.pyc differ diff --git a/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-38(1).pyc b/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-38(1).pyc new file mode 100644 index 0000000..3778f0e Binary files /dev/null and b/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-38(1).pyc differ diff --git a/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-38(2).pyc b/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-38(2).pyc new file mode 100644 index 0000000..3778f0e Binary files /dev/null and b/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-38(2).pyc differ diff --git a/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-38.pyc b/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-38.pyc new file mode 100644 index 0000000..3778f0e Binary files /dev/null and b/carrepairsystem/Administration_pack/__pycache__/Administration_information.cpython-38.pyc differ diff --git a/carrepairsystem/Car_pack/Car_fun.py b/carrepairsystem/Car_pack/Car_fun.py new file mode 100644 index 0000000..6079755 --- /dev/null +++ b/carrepairsystem/Car_pack/Car_fun.py @@ -0,0 +1,165 @@ +from tkinter import * +from tkinter import ttk +from tkinter import messagebox + +from PIL import Image, ImageTk + +from main_pack.Save_excel import save_execel +from image import try_dun as bt + + +def check(a): + if type(a)==type(None): + return 'Null' + else: + return a + +def fan_check(a): + if a=='Null' or a=='': + return None + else: + return int(a) + +def change(cur,num,name,money,password,fix_num): + sql='UPDATE car_master SET car_master_name=%s ,car_master_phnum=%s,car_master_cartype=%s,car_master_user=%s where car_master_num=%s' + cur.execute(sql,[name,money,password,fix_num,int(num)]) + messagebox.showwarning(title="成功", message='信息更新成功!') + +def input_name(name,cur,treeview): + if name=="": + messagebox.showwarning(title="错误", message='请输入信息!') + else: + sql="select * from car_master where car_master_user like '%"+name+"%'" + cur.execute(sql) + n = cur.fetchall() + print(n) + messagebox.showwarning(title="正确", message='信息查询成功!') + for i in range(len(n)): + treeview.insert("",i,values=(n[i][0],n[i][1],n[i][2],n[i][3],n[i][4])) + + +def car_master(Main,cur): + root, ft, ft1, ft2 = Main.yemian(None) + frame_new, label_tk = Main.getframe(None, root) + global photo + img = Image.open('D:\carrepairsystem\image\左贴图.jpg') # 打开图片 + photo = ImageTk.PhotoImage(img) + Label(frame_new, image=photo).place(x=0, y=0) + bt.button_fun(root, frame_new,cur,Main)#按钮 + # 弹窗插入数据页面——新建一个页面 + def win_new(): + root_new = Tk() + root_new.title("车主信息表——插入数据") + width = 400 + height = 300 + screen_width = root.winfo_screenwidth() + screen_height = root.winfo_screenheight() + x = int(screen_width / 2 - width / 2) + y = int(screen_height / 2 - height / 2) + size = '{}x{}+{}+{}'.format(width, height, x, y) + #输入框 + labe1_new=Label(root_new,text="车主名称:",font=ft1) + labe2_new=Label(root_new,text='手机号码:',font=ft1) + labe3_new=Label(root_new,text="车主车型:",font=ft1) + labe1_new.place(x=30,y=40) + labe2_new.place(x=30,y=80) + labe3_new.place(x=30,y=120) + entry1_new=Entry(root_new,width=30) + entry2_new=Entry(root_new,width=30) + entry3_new=Entry(root_new,width=30) + entry1_new.place(x=120,y=40) + entry2_new.place(x=120,y=80) + entry3_new.place(x=120,y=120) + button1_new=Button(root_new,text="确定",font=ft2,width=15,command=lambda :insert_fun(cur,entry1_new.get(),entry2_new.get(),entry3_new.get(),root_new)) + button2_new=Button(root_new,text="取消",font=ft2,width=15,command=root_new.destroy) + button1_new.place(x=40,y=160) + button2_new.place(x=180,y=160) + root_new.geometry(size) + # 输入框设置 + + root_new.mainloop() + def delete(cur, num, frame): # 删除函数 + print(num) + sql = "delete from car_master where car_master_num=%s" + cur.execute(sql, [int(num)]) + messagebox.showwarning(title="成功", message='信息删除成功!') + frame.destroy() + win() + + def insert_fun(cur, name, phnum, cartype, root): + + if name == "" or phnum == "" or cartype == "": + messagebox.showwarning(title="失败", message='请输入完整信息') + else: + + sql = "insert into car_master(car_master_name,car_master_phnum,car_master_cartype,car_master_user)values(%s,%s,%s,%s)" + cur.execute(sql, [name, phnum, cartype, "SONG"]) + messagebox.showwarning(title="成功", message='信息插入成功!') + root.destroy() + win() + + + def win(): + frame=Main.Frame_fun(None,root) + root.title('汽车修理系统——车主信息') + cur.execute("select * from car_master") + n=cur.fetchall() + print(n) + num=len(n) + LabelList=[] + ButtonList=[[i for j in range(2)] for i in range(num)] + EntryList=[[i for j in range(4)] for i in range(num)] + for i in range(num): + LabelList.append(i) + Label(frame, text="车主编号 ",font=ft1,bg='#d3d7d4').grid(row=0,column=1) + Label(frame, text="车主名称 ",font=ft1,bg='#d3d7d4').grid(row=0,column=2) + Label(frame, text="手机号码 ",font=ft1,bg='#d3d7d4').grid(row=0,column=3) + Label(frame, text="车主车型 ",font=ft1,bg='#d3d7d4').grid(row=0,column=4) + Label(frame, text="负责人员 ",font=ft1,bg='#d3d7d4').grid(row=0,column=5) + Label(frame, text="具体",font=ft1,bg='#d3d7d4').grid(row=0,column=6) + Label(frame, text="操作 ", font=ft1, bg='#d3d7d4').grid(row=0, column=7) + for i in range(num): + + LabelList[i]=Label(frame,text=n[i][0],font=ft1,anchor="nw") + LabelList[i].grid(row=i+1, column=1) + for j in range(4): + EntryList[i][j]=Entry(frame, font=ft1, width=11) + EntryList[i][j].grid(row=1 + i, column=2+j) + EntryList[i][j].delete(0, "end") + EntryList[i][j].insert(0,check(n[i][j+1])) + if j==3: + ButtonList[i][0]=Button(frame, text="删除",font=ft2,background="#90d7ec",relief=FLAT,command=lambda f=LabelList[i].cget("text"):delete(cur,f,frame))#删除按钮 + ButtonList[i][1]=Button(frame, text="修改", font=ft2,background="#90d7ec",relief=FLAT,\ + command=lambda f=LabelList[i].cget("text"),fname=EntryList[i][0].get(), + fmoney=EntryList[i][1].get(),fpasword=EntryList[i][2].get(),fnum=EntryList[i][3].get()\ + :change(cur,f,fname,fmoney,fpasword,fnum)) # 修改按钮 + ButtonList[i][0].grid(row=1 + i, column=6) + ButtonList[i][1].grid(row=1 + i, column=7) + win() + frame1 = Main.Frame_fun2(None, root) + colums = ("车主编号", "车主名称", "手机号码", "车主车型", "负责人员") + treeview = ttk.Treeview(frame1, height=190, show="headings", columns=colums) + treeview.column("车主编号", width=100, anchor='center') + treeview.column("车主名称", width=100, anchor='center') + treeview.column("手机号码", width=100, anchor='center') + treeview.column("车主车型", width=100, anchor='center') + treeview.column("负责人员", width=100, anchor='center') + treeview.heading('车主编号', text='车主编号') + treeview.heading('车主名称', text='车主名称') + treeview.heading('手机号码', text='手机号码') + treeview.heading('车主车型', text='车主车型') + treeview.heading('负责人员', text='负责人员') + treeview.place(x=0, y=0) + labe1=Label(frame1,text="用户姓名:",font=ft1) + labe1.place(x=525,y=50) + entry_next=Entry(frame1,font=ft1) + entry_next.place(x=640,y=50,width=130) + button_next=Button(frame1,text="查 询",font=ft2,command=lambda :input_name(entry_next.get(),cur,treeview)) + button_next.place(x=535,y=90,width=230) + button_next_1=Button(frame1,text="导出数据",font=ft2,command=lambda :save_execel(cur,"car_master")) + button_next_1.place(x=535,y=130,width=230) + button_next_2=Button(frame1,text="插入数据",font=ft2,command=win_new) + button_next_2.place(x=535,y=170,width=230) + + + root.mainloop() \ No newline at end of file diff --git a/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-311.pyc b/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-311.pyc new file mode 100644 index 0000000..96b292c Binary files /dev/null and b/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-311.pyc differ diff --git a/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-38(1).pyc b/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-38(1).pyc new file mode 100644 index 0000000..7f48de1 Binary files /dev/null and b/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-38(1).pyc differ diff --git a/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-38(2).pyc b/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-38(2).pyc new file mode 100644 index 0000000..7f48de1 Binary files /dev/null and b/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-38(2).pyc differ diff --git a/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-38.pyc b/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-38.pyc new file mode 100644 index 0000000..7f48de1 Binary files /dev/null and b/carrepairsystem/Car_pack/__pycache__/Car_fun.cpython-38.pyc differ diff --git a/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-311.pyc b/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-311.pyc new file mode 100644 index 0000000..ad37d14 Binary files /dev/null and b/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-311.pyc differ diff --git a/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-38(1).pyc b/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-38(1).pyc new file mode 100644 index 0000000..a3366fe Binary files /dev/null and b/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-38(1).pyc differ diff --git a/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-38(2).pyc b/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-38(2).pyc new file mode 100644 index 0000000..a3366fe Binary files /dev/null and b/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-38(2).pyc differ diff --git a/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-38.pyc b/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-38.pyc new file mode 100644 index 0000000..a3366fe Binary files /dev/null and b/carrepairsystem/Staff_pack/__pycache__/fix_fun.cpython-38.pyc differ diff --git a/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-311.pyc b/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-311.pyc new file mode 100644 index 0000000..d6b870b Binary files /dev/null and b/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-311.pyc differ diff --git a/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-38(1).pyc b/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-38(1).pyc new file mode 100644 index 0000000..4994788 Binary files /dev/null and b/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-38(1).pyc differ diff --git a/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-38(2).pyc b/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-38(2).pyc new file mode 100644 index 0000000..4994788 Binary files /dev/null and b/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-38(2).pyc differ diff --git a/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-38.pyc b/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-38.pyc new file mode 100644 index 0000000..4994788 Binary files /dev/null and b/carrepairsystem/Staff_pack/__pycache__/staff_fun.cpython-38.pyc differ diff --git a/carrepairsystem/Staff_pack/fix_fun.py b/carrepairsystem/Staff_pack/fix_fun.py new file mode 100644 index 0000000..546eab5 --- /dev/null +++ b/carrepairsystem/Staff_pack/fix_fun.py @@ -0,0 +1,191 @@ +from tkinter import * +from tkinter import ttk +from tkinter import messagebox + +from PIL import Image, ImageTk + +from main_pack.Save_excel import save_execel +from image import try_dun as bt + + +def treeview_sort_column(tv, col, reverse):#Treeview、列名、排列方式 + l = [(tv.set(k, col), k) for k in tv.get_children('')] + print(tv.get_children('')) + l.sort(reverse=reverse)#排序方式 + for index, (val, k) in enumerate(l):#根据排序后索引移动 + tv.move(k, '', index) + print(k) + tv.heading(col, command=lambda: treeview_sort_column(tv, col, not reverse))#重写标题,使之成为再点倒序的标题 + +def delButton(tree):#删除条目 + x=tree.get_children() + for item in x: + tree.delete(item) + +def check(a): + if type(a)==type(None): + return 'Null' + else: + return a + +def fan_check(a): + if a=='Null' or a=='': + return None + else: + return int(a) + +def change(cur,num,name,money,password,fix_num): + sql='UPDATE fix SET car_master_name=%s ,fix_money=%s,fix_user=%s,fix_part=%s where fix_num=%s' + cur.execute(sql,[name,int(money),password,fix_num,int(num)]) + messagebox.showwarning(title="成功", message='信息更新成功!') + +def input_name(name,cur,treeview): + if name=="": + messagebox.showwarning(title="错误", message='请输入信息!') + else: + sql="select * from fix where fix_user like '%"+name+"%'" + cur.execute(sql) + n = cur.fetchall() + print(n) + messagebox.showwarning(title="正确", message='信息查询成功!') + for i in range(len(n)): + treeview.insert("",i,values=(n[i][0],n[i][1],n[i][2],n[i][3],n[i][4])) + + +def Fix_fun(Main,cur): + root, ft, ft1, ft2 = Main.yemian(None) + frame_new, label_tk = Main.getframe(None, root) + global photo + img = Image.open('D:\carrepairsystem\image\左贴图.jpg') # 打开图片 + photo = ImageTk.PhotoImage(img) + Label(frame_new, image=photo).place(x=0, y=0) + bt.button_fun(root, frame_new,cur,Main)#按钮 + # 弹窗插入数据页面——新建一个页面 + def win_new(): + root_new = Tk() + root_new.title("零件信息表——插入数据") + # frame_new=Frame(root_new,width=300,height=250,bg='#BEE7E9') + # frame_new.place(x=20) + # 屏幕参数设置 + width = 400 + height = 300 + screen_width = root.winfo_screenwidth() + screen_height = root.winfo_screenheight() + x = int(screen_width / 2 - width / 2) + y = int(screen_height / 2 - height / 2) + size = '{}x{}+{}+{}'.format(width, height, x, y) + #输入框 + labe1_new=Label(root_new,text="车主名字:",font=ft1) + labe2_new=Label(root_new,text='修理费用:',font=ft1) + labe3_new=Label(root_new,text="所用零件:",font=ft1) + #labe4_new = Label(root_new, text="生产地区:", font=ft1) + labe1_new.place(x=30,y=40) + labe2_new.place(x=30,y=80) + labe3_new.place(x=30,y=120) + #labe4_new.place(x=30,y=160) + entry1_new=Entry(root_new,width=30) + entry2_new=Entry(root_new,width=30) + entry3_new=Entry(root_new,width=30) + #entry4_new=Entry(root_new,width=30) + entry1_new.place(x=120,y=40) + entry2_new.place(x=120,y=80) + entry3_new.place(x=120,y=120) + # entry4_new.place(x=120,y=160) + button1_new=Button(root_new,text="确定",font=ft2,width=15,command=lambda :insert_fun(cur,entry1_new.get(),entry2_new.get(),entry3_new.get(),root_new)) + button2_new=Button(root_new,text="取消",font=ft2,width=15,command=root_new.destroy) + button1_new.place(x=40,y=160) + button2_new.place(x=180,y=160) + root_new.geometry(size) + # 输入框设置 + + root_new.mainloop() + def delete(cur, num, frame): # 删除函数 + print(num) + sql = "delete from part where part_num=%s" + cur.execute(sql, [int(num)]) + messagebox.showwarning(title="成功", message='信息删除成功!') + frame.destroy() + win() + + def insert_fun(cur, name, phnum, cartype,root): + + if name == "" or phnum == "" or cartype == "": + messagebox.showwarning(title="失败", message='请输入完整信息') + else: + + sql = "insert into fix(car_master_name,fix_money,fix_user,fix_part)values(%s,%s,%s,%s)" + cur.execute(sql, [name, phnum, "SONG",cartype]) + messagebox.showwarning(title="成功", message='信息插入成功!') + root.destroy() + win() + + + def win(): + frame=Main.Frame_fun(None,root) + root.title('汽车修理系统——修理信息') + cur.execute("select * from fix") + n=cur.fetchall() + num=len(n)#数据量 + LabelList=[]#用户编号列表 + ButtonList=[[i for j in range(2)] for i in range(num)]#按钮列表——二维 + EntryList=[[i for j in range(4)] for i in range(num)]#输入框列表——num行4列 + for i in range(num): + LabelList.append(i) + #ButtonList.append(i) + #创建标题行 + Label(frame, text="事件编号 ",font=ft1,bg='#d3d7d4').grid(row=0,column=1) + Label(frame, text="车主姓名 ",font=ft1,bg='#d3d7d4').grid(row=0,column=2) + Label(frame, text="修理价格 ",font=ft1,bg='#d3d7d4').grid(row=0,column=3) + Label(frame, text="经手员工 ",font=ft1,bg='#d3d7d4').grid(row=0,column=4) + Label(frame, text="所用零件 ",font=ft1,bg='#d3d7d4').grid(row=0,column=5) + Label(frame, text="具体",font=ft1,bg='#d3d7d4').grid(row=0,column=6) + Label(frame, text="操作 ", font=ft1, bg='#d3d7d4').grid(row=0, column=7) + for i in range(num): + #编号 + LabelList[i]=Label(frame,text=n[i][0],font=ft1,anchor="nw") + LabelList[i].grid(row=i+1, column=1) + #输入框 + for j in range(4): + EntryList[i][j]=Entry(frame, font=ft1, width=11) + EntryList[i][j].grid(row=1 + i, column=2+j) + EntryList[i][j].delete(0, "end") + EntryList[i][j].insert(0,check(n[i][j+1])) + if j==3: + ButtonList[i][0]=Button(frame, text="删除",font=ft2,background="#90d7ec",relief=FLAT,command=lambda f=LabelList[i].cget("text"):delete(cur,f,frame))#删除按钮 + ButtonList[i][1]=Button(frame, text="修改", font=ft2,background="#90d7ec",relief=FLAT,\ + command=lambda f=LabelList[i].cget("text"),fname=EntryList[i][0].get(), + fmoney=EntryList[i][1].get(),fpasword=EntryList[i][2].get(),fnum=EntryList[i][3].get()\ + :change(cur,f,fname,fmoney,fpasword,fnum)) # 修改按钮 + ButtonList[i][0].grid(row=1 + i, column=6) + ButtonList[i][1].grid(row=1 + i, column=7) + win() + frame1 = Main.Frame_fun2(None, root) + colums = ("事件编号", "车主姓名", "修理价格", "经手员工", "所用零件") + treeview = ttk.Treeview(frame1, height=190, show="headings", columns=colums) + treeview.column("事件编号", width=100, anchor='center') + treeview.column("车主姓名", width=100, anchor='center') + treeview.column("修理价格", width=100, anchor='center') + treeview.column("经手员工", width=100, anchor='center') + treeview.column("所用零件", width=100, anchor='center') + treeview.heading('事件编号', text='事件编号') + treeview.heading('车主姓名', text='车主姓名') + treeview.heading('修理价格', text='修理价格') + treeview.heading('经手员工', text='经手员工') + treeview.heading('所用零件', text='所用零件') + treeview.place(x=0, y=0) + labe1=Label(frame1,text="经手员工:",font=ft1) + labe1.place(x=525,y=50) + entry_next=Entry(frame1,font=ft1) + entry_next.place(x=640,y=50,width=130) + button_next=Button(frame1,text="查 询",font=ft2,command=lambda :[delButton(treeview),input_name(entry_next.get(),cur,treeview)]) + button_next.place(x=535,y=90,width=230) + button_next_1=Button(frame1,text="导出数据",font=ft2,command=lambda :save_execel(cur,"fix")) + button_next_1.place(x=535,y=130,width=230) + button_next_2=Button(frame1,text="插入数据",font=ft2,command=win_new) + button_next_2.place(x=535,y=170,width=230) + for col in colums: # 给所有标题加(循环上边的“手工”) + if col!="车主姓名" and col!="经手员工" and col!="所用零件": + treeview.heading(col, text=col, command=lambda _col=col: treeview_sort_column(treeview, _col, False)) + + + root.mainloop() \ No newline at end of file diff --git a/carrepairsystem/Staff_pack/staff_fun.py b/carrepairsystem/Staff_pack/staff_fun.py new file mode 100644 index 0000000..ee3e1b9 --- /dev/null +++ b/carrepairsystem/Staff_pack/staff_fun.py @@ -0,0 +1,186 @@ +from tkinter import * +from tkinter import ttk +from tkinter import messagebox + +from PIL import Image, ImageTk + +from main_pack.Save_excel import save_execel +from image import try_dun as bt + + +def treeview_sort_column(tv, col, reverse):#Treeview、列名、排列方式 + l = [(tv.set(k, col), k) for k in tv.get_children('')] + print(tv.get_children('')) + l.sort(reverse=reverse)#排序方式 + for index, (val, k) in enumerate(l):#根据排序后索引移动 + tv.move(k, '', index) + print(k) + tv.heading(col, command=lambda: treeview_sort_column(tv, col, not reverse))#重写标题,使之成为再点倒序的标题 + +def check(a): + if type(a)==type(None): + return 'Null' + else: + return a + +def fan_check(a): + if a=='Null' or a=='': + return None + else: + return int(a) + +def change(cur,num,name,money,password,fix_num): + sql='UPDATE part SET part_name=%s ,part_money=%s,part_left_num=%s,part_start=%s where part_num=%s' + cur.execute(sql,[name,int(money),int(password),fix_num,int(num)]) + messagebox.showwarning(title="成功", message='信息更新成功!') + +def input_name(name,cur,treeview): + if name=="": + messagebox.showwarning(title="错误", message='请输入信息!') + else: + sql="select * from part where part_name like '%"+name+"%'" + cur.execute(sql) + n = cur.fetchall() + print(n) + messagebox.showwarning(title="正确", message='信息查询成功!') + for i in range(len(n)): + treeview.insert("",i,values=(n[i][0],n[i][1],n[i][2],n[i][3],n[i][4])) + + +def Staff(Main,cur): + root, ft, ft1, ft2 = Main.yemian(None) + frame_new, label_tk = Main.getframe(None, root) + global photo + img = Image.open('D:\carrepairsystem\image\左贴图.jpg') # 打开图片 + photo = ImageTk.PhotoImage(img) + Label(frame_new, image=photo).place(x=0, y=0) + bt.button_fun(root, frame_new,cur,Main)#按钮 + # 弹窗插入数据页面——新建一个页面 + def win_new(): + root_new = Tk() + root_new.title("零件信息表——插入数据") + # frame_new=Frame(root_new,width=300,height=250,bg='#BEE7E9') + # frame_new.place(x=20) + # 屏幕参数设置 + width = 400 + height = 300 + screen_width = root.winfo_screenwidth() + screen_height = root.winfo_screenheight() + x = int(screen_width / 2 - width / 2) + y = int(screen_height / 2 - height / 2) + size = '{}x{}+{}+{}'.format(width, height, x, y) + #输入框 + labe1_new=Label(root_new,text="零件名称:",font=ft1) + labe2_new=Label(root_new,text='零件价格:',font=ft1) + labe3_new=Label(root_new,text="零件数量:",font=ft1) + labe4_new = Label(root_new, text="生产地区:", font=ft1) + labe1_new.place(x=30,y=40) + labe2_new.place(x=30,y=80) + labe3_new.place(x=30,y=120) + labe4_new.place(x=30,y=160) + entry1_new=Entry(root_new,width=30) + entry2_new=Entry(root_new,width=30) + entry3_new=Entry(root_new,width=30) + entry4_new=Entry(root_new,width=30) + entry1_new.place(x=120,y=40) + entry2_new.place(x=120,y=80) + entry3_new.place(x=120,y=120) + entry4_new.place(x=120,y=160) + button1_new=Button(root_new,text="确定",font=ft2,width=15,command=lambda :insert_fun(cur,entry1_new.get(),entry2_new.get(),entry3_new.get(),entry4_new.get(),root_new)) + button2_new=Button(root_new,text="取消",font=ft2,width=15,command=root_new.destroy) + button1_new.place(x=40,y=200) + button2_new.place(x=180,y=200) + root_new.geometry(size) + # 输入框设置 + + root_new.mainloop() + def delete(cur, num, frame): # 删除函数 + print(num) + sql = "delete from part where part_num=%s" + cur.execute(sql, [int(num)]) + messagebox.showwarning(title="成功", message='信息删除成功!') + frame.destroy() + win() + + def insert_fun(cur, name, phnum, cartype, satrt,root): + + if name == "" or phnum == "" or cartype == "": + messagebox.showwarning(title="失败", message='请输入完整信息') + else: + + sql = "insert into part(part_name,part_money,part_left_num,part_start)values(%s,%s,%s,%s)" + cur.execute(sql, [name, phnum, cartype,satrt]) + messagebox.showwarning(title="成功", message='信息插入成功!') + root.destroy() + win() + + + def win(): + frame=Main.Frame_fun(None,root) + root.title('汽车修理系统——零件信息') + cur.execute("select * from part") + n=cur.fetchall() + num=len(n)#数据量 + LabelList=[]#用户编号列表 + ButtonList=[[i for j in range(2)] for i in range(num)]#按钮列表——二维 + EntryList=[[i for j in range(4)] for i in range(num)]#输入框列表——num行4列 + for i in range(num): + LabelList.append(i) + #ButtonList.append(i) + #创建标题行 + Label(frame, text="零件编号 ",font=ft1,bg='#d3d7d4').grid(row=0,column=1) + Label(frame, text="零件名称 ",font=ft1,bg='#d3d7d4').grid(row=0,column=2) + Label(frame, text="零件价格 ",font=ft1,bg='#d3d7d4').grid(row=0,column=3) + Label(frame, text="剩余数量 ",font=ft1,bg='#d3d7d4').grid(row=0,column=4) + Label(frame, text="生产地区 ",font=ft1,bg='#d3d7d4').grid(row=0,column=5) + Label(frame, text="具体",font=ft1,bg='#d3d7d4').grid(row=0,column=6) + Label(frame, text="操作 ", font=ft1, bg='#d3d7d4').grid(row=0, column=7) + for i in range(num): + #编号 + LabelList[i]=Label(frame,text=n[i][0],font=ft1,anchor="nw") + LabelList[i].grid(row=i+1, column=1) + #输入框 + for j in range(4): + EntryList[i][j]=Entry(frame, font=ft1, width=11) + EntryList[i][j].grid(row=1 + i, column=2+j) + EntryList[i][j].delete(0, "end") + EntryList[i][j].insert(0,check(n[i][j+1])) + if j==3: + ButtonList[i][0]=Button(frame, text="删除",font=ft2,background="#90d7ec",relief=FLAT,command=lambda f=LabelList[i].cget("text"):delete(cur,f,frame))#删除按钮 + ButtonList[i][1]=Button(frame, text="修改", font=ft2,background="#90d7ec",relief=FLAT,\ + command=lambda f=LabelList[i].cget("text"),fname=EntryList[i][0].get(), + fmoney=EntryList[i][1].get(),fpasword=EntryList[i][2].get(),fnum=EntryList[i][3].get()\ + :change(cur,f,fname,fmoney,fpasword,fnum)) # 修改按钮 + ButtonList[i][0].grid(row=1 + i, column=6) + ButtonList[i][1].grid(row=1 + i, column=7) + win() + frame1 = Main.Frame_fun2(None, root) + colums = ("零件编号", "零件名称", "零件价格", "剩余数量", "生产地区") + treeview = ttk.Treeview(frame1, height=190, show="headings", columns=colums) + treeview.column("零件编号", width=100, anchor='center') + treeview.column("零件名称", width=100, anchor='center') + treeview.column("零件价格", width=100, anchor='center') + treeview.column("剩余数量", width=100, anchor='center') + treeview.column("生产地区", width=100, anchor='center') + treeview.heading('零件编号', text='零件编号') + treeview.heading('零件名称', text='零件名称') + treeview.heading('零件价格', text='零件价格') + treeview.heading('剩余数量', text='剩余数量') + treeview.heading('生产地区', text='生产地区') + treeview.place(x=0, y=0) + labe1=Label(frame1,text="零件名称:",font=ft1) + labe1.place(x=525,y=50) + entry_next=Entry(frame1,font=ft1) + entry_next.place(x=640,y=50,width=130) + button_next=Button(frame1,text="查 询",font=ft2,command=lambda :input_name(entry_next.get(),cur,treeview)) + button_next.place(x=535,y=90,width=230) + button_next_1=Button(frame1,text="导出数据",font=ft2,command=lambda :save_execel(cur,"part")) + button_next_1.place(x=535,y=130,width=230) + button_next_2=Button(frame1,text="插入数据",font=ft2,command=win_new) + button_next_2.place(x=535,y=170,width=230) + for col in colums: # 给所有标题加(循环上边的“手工”) + if col!="零件名称" and col!="生产地区": + treeview.heading(col, text=col, command=lambda _col=col: treeview_sort_column(treeview, _col, False)) + + + root.mainloop() \ No newline at end of file diff --git a/carrepairsystem/image/Boss.png b/carrepairsystem/image/Boss.png new file mode 100644 index 0000000..d6ea4f1 Binary files /dev/null and b/carrepairsystem/image/Boss.png differ diff --git a/carrepairsystem/image/__pycache__/try_dun.cpython-311.pyc b/carrepairsystem/image/__pycache__/try_dun.cpython-311.pyc new file mode 100644 index 0000000..f13783d Binary files /dev/null and b/carrepairsystem/image/__pycache__/try_dun.cpython-311.pyc differ diff --git a/carrepairsystem/image/__pycache__/try_dun.cpython-38(1).pyc b/carrepairsystem/image/__pycache__/try_dun.cpython-38(1).pyc new file mode 100644 index 0000000..463f281 Binary files /dev/null and b/carrepairsystem/image/__pycache__/try_dun.cpython-38(1).pyc differ diff --git a/carrepairsystem/image/__pycache__/try_dun.cpython-38(2).pyc b/carrepairsystem/image/__pycache__/try_dun.cpython-38(2).pyc new file mode 100644 index 0000000..463f281 Binary files /dev/null and b/carrepairsystem/image/__pycache__/try_dun.cpython-38(2).pyc differ diff --git a/carrepairsystem/image/__pycache__/try_dun.cpython-38.pyc b/carrepairsystem/image/__pycache__/try_dun.cpython-38.pyc new file mode 100644 index 0000000..463f281 Binary files /dev/null and b/carrepairsystem/image/__pycache__/try_dun.cpython-38.pyc differ diff --git a/carrepairsystem/image/imformation.png b/carrepairsystem/image/imformation.png new file mode 100644 index 0000000..20e1091 Binary files /dev/null and b/carrepairsystem/image/imformation.png differ diff --git a/carrepairsystem/image/log.png b/carrepairsystem/image/log.png new file mode 100644 index 0000000..61f4b3a Binary files /dev/null and b/carrepairsystem/image/log.png differ diff --git a/carrepairsystem/image/tk_user.png b/carrepairsystem/image/tk_user.png new file mode 100644 index 0000000..ae262a5 Binary files /dev/null and b/carrepairsystem/image/tk_user.png differ diff --git a/carrepairsystem/image/try_dun.py b/carrepairsystem/image/try_dun.py new file mode 100644 index 0000000..a6b57e3 --- /dev/null +++ b/carrepairsystem/image/try_dun.py @@ -0,0 +1,63 @@ +import Car_pack.Car_fun as cf +import Staff_pack.staff_fun as stf +import Staff_pack.fix_fun as fi +import Administration_pack.Administration_information as ad +import main_pack.main_python as ma +from tkinter import * +from PIL import Image, ImageTk + +from main_pack.main_python import main2 + + +def button_fun(root,frame,cur,Main): + # 按钮重绘过程---------------------------------------------------------------------------------- + # ---------------------------------------------------------- + img_log = Image.open("D:\carrepairsystem\image\log.png") + global img_log_tk + img_log_tk = ImageTk.PhotoImage(img_log) + Button_log = Button(frame, image=img_log_tk, compound=TOP, width=78, + height=80, text="系统主页", bd=1, bg="#3fcefe", relief=GROOVE, + command=lambda: [root.destroy(), main2(cur)]) + Button_log.place(x=0, y=80) + img_staff_information = Image.open("D:\carrepairsystem\image\imformation.png") + global img_staff_information_tk + img_staff_information_tk = ImageTk.PhotoImage(img_staff_information) + + img_carmain_information = Image.open("D:\carrepairsystem\image\Boss.png") + global img_carmain_information_tk + img_carmain_information_tk = ImageTk.PhotoImage(img_carmain_information) + + img_carlinjian_information = Image.open("D:\carrepairsystem\image\零件.png") + global img_carlinjian_information_tk + img_carlinjian_information_tk = ImageTk.PhotoImage(img_carlinjian_information) + + img_fix_information = Image.open("D:\carrepairsystem\image\修理信息.png") + global img_fix_information_tk + img_fix_information_tk = ImageTk.PhotoImage(img_fix_information) + + img_tui = Image.open("D:\carrepairsystem\image\退出.png") + global img_tui_tk + img_tui_tk = ImageTk.PhotoImage(img_tui) + + Button_staff_information = Button(frame, image=img_staff_information_tk, compound=TOP, width=78, + height=80, text="人员信息", bd=1, bg="#3fcefe", relief=GROOVE, + command=lambda: [root.destroy(), ad.administration(Main, cur)]) + Button_carmain_information = Button(frame, image=img_carmain_information_tk, compound=TOP, width=78, + height=80, text="车主信息", bd=1, bg="#3fcefe", relief=GROOVE, + command=lambda: [root.destroy(), cf.car_master(Main, cur)]) + Button_carlinjian_information = Button(frame, image=img_carlinjian_information_tk, compound=TOP, width=78, + height=80, text="零件信息", bd=1, bg="#3fcefe", relief=GROOVE + , command=lambda: [root.destroy(), stf.Staff(Main, cur)]) + Button_fix_information = Button(frame, image=img_fix_information_tk, compound=TOP, width=78, + height=80, text="修理信息", bd=1, bg="#3fcefe", relief=GROOVE, + command=lambda: [root.destroy(), fi.Fix_fun(Main, cur)]) + Button_tui = Button(frame, image=img_tui_tk, compound=TOP, width=78, + height=80, text="退出登录", bd=1, bg="#3fcefe", relief=GROOVE, + command=lambda: [root.destroy(), ma.main_pace(cur)]) + Button_staff_information.place(x=0, y=170) + Button_carmain_information.place(x=0, y=260) + Button_carlinjian_information.place(x=0, y=350) + Button_fix_information.place(x=0, y=440) + Button_tui.place(x=0, y=530) + # ---------------------------------------------------------- + # 按钮重绘过程---------------------------------------------------------------------------------- \ No newline at end of file diff --git a/carrepairsystem/image/修理信息.png b/carrepairsystem/image/修理信息.png new file mode 100644 index 0000000..63d9dea Binary files /dev/null and b/carrepairsystem/image/修理信息.png differ diff --git a/carrepairsystem/image/左贴图.jpg b/carrepairsystem/image/左贴图.jpg new file mode 100644 index 0000000..c57a7a7 Binary files /dev/null and b/carrepairsystem/image/左贴图.jpg differ diff --git a/carrepairsystem/image/未标题-2.jpg b/carrepairsystem/image/未标题-2.jpg new file mode 100644 index 0000000..6666b64 Binary files /dev/null and b/carrepairsystem/image/未标题-2.jpg differ diff --git a/carrepairsystem/image/退出.png b/carrepairsystem/image/退出.png new file mode 100644 index 0000000..da42f46 Binary files /dev/null and b/carrepairsystem/image/退出.png differ diff --git a/carrepairsystem/image/零件.png b/carrepairsystem/image/零件.png new file mode 100644 index 0000000..241435f Binary files /dev/null and b/carrepairsystem/image/零件.png differ diff --git a/carrepairsystem/main_pack/Save_excel.py b/carrepairsystem/main_pack/Save_excel.py new file mode 100644 index 0000000..31756de --- /dev/null +++ b/carrepairsystem/main_pack/Save_excel.py @@ -0,0 +1,40 @@ +import xlwt +from tkinter import messagebox +def save_execel(curs,tablename): + sql='select * from '+tablename + curs.execute(sql) + rows = curs.fetchall() # 获取所有数据 +#二、初始化excel文件 + w=xlwt.Workbook(encoding='utf-8') + style=xlwt.XFStyle() + font=xlwt.Font() + font.name="微软雅黑" + style.font=font + if tablename=="administration": + ws = w.add_sheet("用户信息", cell_overwrite_ok=True) + title = "用户ID,用户名,用户工资,密码,修理数量" + title = title.split(",") + elif tablename=="car_master": + ws = w.add_sheet("车主信息", cell_overwrite_ok=True) + title = "车主ID,车主名,手机号码,车辆类型,负责人员" + title = title.split(",") + elif tablename=="part": + ws = w.add_sheet("零件信息", cell_overwrite_ok=True) + title = "零件编号,零件名称,零件价格,剩余数量,生产地区" + title = title.split(",") + else: + ws = w.add_sheet("修理信息", cell_overwrite_ok=True) + title = "事件编号,车主姓名,修理价格,经手员工,所用零件" + title = title.split(",") + + for i in range(len(title)): + ws.write(0, i, title[i], style) + for i in range(len(rows)): + row = rows[i] + for j in range(len(row)): + if row[j]: + item = row[j] + ws.write(i + 1, j, item, style) + path='./'+tablename+".xls" + w.save(path) + messagebox.showwarning(title="成功", message='信息保存成功,请到本地目录查看!') diff --git a/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-311.pyc b/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-311.pyc new file mode 100644 index 0000000..0fd380f Binary files /dev/null and b/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-311.pyc differ diff --git a/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-38(1).pyc b/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-38(1).pyc new file mode 100644 index 0000000..91917e3 Binary files /dev/null and b/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-38(1).pyc differ diff --git a/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-38(2).pyc b/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-38(2).pyc new file mode 100644 index 0000000..91917e3 Binary files /dev/null and b/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-38(2).pyc differ diff --git a/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-38.pyc b/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-38.pyc new file mode 100644 index 0000000..91917e3 Binary files /dev/null and b/carrepairsystem/main_pack/__pycache__/Save_excel.cpython-38.pyc differ diff --git a/carrepairsystem/main_pack/__pycache__/main_python.cpython-311.pyc b/carrepairsystem/main_pack/__pycache__/main_python.cpython-311.pyc new file mode 100644 index 0000000..cdde8a8 Binary files /dev/null and b/carrepairsystem/main_pack/__pycache__/main_python.cpython-311.pyc differ diff --git a/carrepairsystem/main_pack/__pycache__/main_python.cpython-38(1).pyc b/carrepairsystem/main_pack/__pycache__/main_python.cpython-38(1).pyc new file mode 100644 index 0000000..6da1931 Binary files /dev/null and b/carrepairsystem/main_pack/__pycache__/main_python.cpython-38(1).pyc differ diff --git a/carrepairsystem/main_pack/__pycache__/main_python.cpython-38(2).pyc b/carrepairsystem/main_pack/__pycache__/main_python.cpython-38(2).pyc new file mode 100644 index 0000000..6da1931 Binary files /dev/null and b/carrepairsystem/main_pack/__pycache__/main_python.cpython-38(2).pyc differ diff --git a/carrepairsystem/main_pack/__pycache__/main_python.cpython-38.pyc b/carrepairsystem/main_pack/__pycache__/main_python.cpython-38.pyc new file mode 100644 index 0000000..6da1931 Binary files /dev/null and b/carrepairsystem/main_pack/__pycache__/main_python.cpython-38.pyc differ diff --git a/carrepairsystem/main_pack/administration.xls b/carrepairsystem/main_pack/administration.xls new file mode 100644 index 0000000..c4ed58c Binary files /dev/null and b/carrepairsystem/main_pack/administration.xls differ diff --git a/carrepairsystem/main_pack/car_master.xls b/carrepairsystem/main_pack/car_master.xls new file mode 100644 index 0000000..795c497 Binary files /dev/null and b/carrepairsystem/main_pack/car_master.xls differ diff --git a/carrepairsystem/main_pack/clear_frame.py b/carrepairsystem/main_pack/clear_frame.py new file mode 100644 index 0000000..1990678 --- /dev/null +++ b/carrepairsystem/main_pack/clear_frame.py @@ -0,0 +1,25 @@ +from tkinter import * +def clear_fun(frame): + for widget in frame.winfo_children(): + print(widget) +def say_hi(): + print("hello ~ !") + + +root = Tk() + +frame1 = Frame(root) +frame2 = Frame(root) +root.title("tkinter frame") + +label = Label(frame1, text="Label", justify=LEFT) +label.pack(side=LEFT) + +hi_there = Button(frame2, text="say hi~", command=say_hi) +hi_there.pack() + +frame1.pack(padx=1, pady=1) +frame2.pack(padx=10, pady=10) +clear_fun(frame1) +clear_fun(frame2) +root.mainloop() \ No newline at end of file diff --git a/carrepairsystem/main_pack/main_python.py b/carrepairsystem/main_pack/main_python.py new file mode 100644 index 0000000..e62131b --- /dev/null +++ b/carrepairsystem/main_pack/main_python.py @@ -0,0 +1,203 @@ +import pymysql as sql +import tkinter.font as tf +from tkinter import messagebox +from image import try_dun as bt +from tkinter import * +from PIL import Image, ImageTk +class Main(object): + username="dasd " + @staticmethod + def setname(self,name): + self.username=name + @staticmethod + def getname(self): + return self.username + + def yemian(self): + + root = Tk() # 创建主窗口 + #root.config(background='#BEE7E9') + root.resizable(width=False, height=False) + # 屏幕参数设置 + width = 880 + height = 620 + screen_width = root.winfo_screenwidth() + screen_height = root.winfo_screenheight() + x = int(screen_width / 2 - width / 2) + y = int(screen_height / 2 - height / 2) + size = '{}x{}+{}+{}'.format(width, height, x, y) + root.geometry(size) + + ft = tf.Font(family='Fixdsys', size=30, weight=tf.BOLD) # 定义字体 + ft1 = tf.Font(family='Fixdsys', size=15, weight=tf.BOLD) # 定义字体 + ft2 = tf.Font(family='Fixdsys', size=10, weight=tf.NORMAL) # 定义字体 + return root,ft,ft1,ft2 + + # 主框架 + def getframe(self,root): + frame = Frame(root, width=850, height=620) + frame.place(x=0, y=0) + global photo + img = Image.open('D:\carrepairsystem\image\左贴图.jpg') # 打开图片 + photo = ImageTk.PhotoImage(img) + return frame, Label(frame, image=photo).place(x=0, y=0) + + def Frame_fun(self,root):#使用滚动条 + #规定窗口内的画布 + def _on_mousewheel( event):#鼠标事件 + canvas.yview_scroll(-1 * (event.delta / 120), "units")#移动距离 + def myfunction(event):#内部函数,更新滚动区域 + canvas.configure(scrollregion=canvas.bbox("all"), width=200, height=200) + + canvas = Canvas(root)#创建一个画布 + canvas.place(x=85, y=0, height=400, width=800) + + myscrollbar = Scrollbar(root, orient="vertical", command=canvas.yview) # 创建滚动条 + myscrollbar.place(x=865, y=0, height=400) + canvas.configure(yscrollcommand=myscrollbar.set) + + rollFrame = Frame(canvas) + canvas.create_window((0, 0), window=rollFrame, anchor='nw') + rollFrame.bind("", myfunction) + + + return rollFrame + + def Frame_fun2(self,root): + frame=Frame(root,height=200,width=800) + frame.place(x=85,y=400) + return frame + def mysql(self): + cn=sql.connect( + host='localhost', + port=3306, + user='root', + password='123456', + db='Car_fix_sys', + charset='utf8' + ) + cur=cn.cursor() + return cn,cur + +def main2(cur): + root,ft,ft1,ft2=Main.yemian(None) + frame,label_tk=Main.getframe(None,root) + global photo + img = Image.open('D:\carrepairsystem\image\左贴图.jpg') # 打开图片 + photo = ImageTk.PhotoImage(img) + Label(frame, image=photo).place(x=0, y=0) + + root.title('汽车修理系统——') + lab1 = Label(frame, text='汽车修理系统欢迎您!', font=ft, height=5, width=30) + #-------------- + lab1.place(x=130,y=10) + lab2=Label(frame,text="当前用户:SONG",font=ft1,height=3,width=20) + lab3=Label(frame,text="制作:魏涛",font=ft1,height=2,width=20) + lab4 = Label(frame, text="*进入系统则代表所有操作均由账号本人负责", font=ft2, height=2, width=40) + lab2.place(x=325,y=280) + lab3.place(x=325,y=240) + lab4.place(x=300,y=340) + bt.button_fun(root,frame,cur,Main) + root.mainloop() + + + +def checklog(username,password,cur):#登录 + sql_1='select Administration_name from Administration' + cur.execute(sql_1) + n=cur.fetchall() + name=[] + for i in n: + name.append(i[0]) + print(name) + sql_2='select * from Administration' + cur.execute(sql_2) + n=cur.fetchall() + name_password=[] + for i in n: + if username==i[1]: + name_password.append(i) + print(name_password) + if username not in name: + return '用户信息不存在,请重新输入' + elif username in name and password !=name_password[0][3]: + return '密码错误' + else : + return True + +def log_in(username,password,cur,root):#登录 + if username=="" and password=="": + messagebox.showwarning(title="错误提示",message='请输入完整信息!') + elif checklog(username,password,cur)=='用户信息不存在,请重新输入': + messagebox.showwarning(title="错误提示", message='用户信息不存在,请重新输入') + elif checklog(username,password,cur)=='密码错误': + messagebox.showwarning(title="错误提示", message='密码错误,请重新输入') + else: + root.destroy() + main2(cur) + +def checksregister(username,password,cur):#注册 + sql_1='select Administration_name from Administration' + n=cur.execute(sql_1) + n=cur.fetchall() + print(n) + name=[] + for i in n: + name.append(i[0]) + if username in name: + return False + else: + sql_2='insert into Administration(Administration_name,Administration_password)values(%s,%s)' + cur.execute(sql_2,(username,password)) + return True + +def register_in(username,password,cur,root):#注册 + if username == "" or password == "": + messagebox.showwarning(title="错误提示", message='请输入完整信息!') + elif checksregister(username,password,cur)==False: + messagebox.showwarning(title="错误提示", message='已存在该用户,请重新输入!') + else: + root.destroy() + main2(cur) + +def main_pace(cur): + root,ft,ft1,ft2=Main.yemian(None) + root.title('汽车修理系统——') + frame, label_tk = Main.getframe(None,root) + lab1 = Label(frame, text='汽车修理系统', font=ft, height=5,width=30) + Label_username = Label(frame, text="用户名:",font=ft1) + Entry_username = Entry(frame,width=30,relief=RIDGE,bd=1) + Entry_username.place(x=370,y=302) + Label_username.place(x=290,y=300) + Label_password = Label(frame, text="密 码:",font=ft1) + Entry_password = Entry(frame,width=30,relief=RIDGE,bd=1) + Label_password.place(x=290,y=350) + Entry_password.place(x=370,y=352) + lab1.place(x=130,y=10) + Button_login = Button(frame, text="登录",font=ft2,width=8,background="#90d7ec",relief=FLAT, + command=lambda :[log_in(Entry_username.get(),Entry_password.get(),cur,root)]) + Button_login.place(x=330,y=390) + Button_cancer = Button(frame, text="注册",font=ft2,width=8,background="#90d7ec",relief=FLAT, + command=lambda :[register_in(Entry_username.get(),Entry_password.get(),cur,root)]) + Button_cancer.place(x=480,y=390) + img_log=Image.open("D:\carrepairsystem\image\log.png") + global img_log_tk + img_log_tk=ImageTk.PhotoImage(img_log) + Button_log = Button(frame,image=img_log_tk,compound=TOP,width=78,height=80,text="进入系统",bd=1,bg="#3fcefe",relief=GROOVE) + Button_log.place(x=0,y=80) + #用户图片 + img_user=Image.open(r"D:\carrepairsystem\image\tk_user.png") + global img_user_tk + img_user_tk=ImageTk.PhotoImage(img_user) + Label(frame, image=img_user_tk).place(x=180, y=280) + root.mainloop() + +if __name__ == '__main__': + cn,cur=Main.mysql(None) + n=cur.execute("select * from Administration") + n=cur.fetchall() + main_pace(cur) + #关闭数据库 + cn.commit() + cur.close() + cn.close() \ No newline at end of file diff --git a/carrepairsystem/main_pack/part.xls b/carrepairsystem/main_pack/part.xls new file mode 100644 index 0000000..4172094 Binary files /dev/null and b/carrepairsystem/main_pack/part.xls differ