量具管理系统-首页
传统量具管理问题:量具编号重复,编码没有按要求,频繁领用登记麻烦,,忘记校验,使用过期量具,手写标签不易辨认。
本人使用Python编制量具管理系统解决以上问题:
主要使用模块:tkinter
首先编制首页五大功能:
1)量具生成(编号自动生成,打印二维码标签),
2.量具查询(过期清单,量具更新,报告查询)
3.量具分析(数量分析,状态分析)
4.量具分发
5.量具报废
from tkinter import *
import os
from datetime import datetime
import createclass
import analysisclass
import queryclass
class base:
def __init__(self, master,user):
self.root = master
self.user=user
width = 800
height =600
screenwidth = self.root .winfo_screenwidth()
screenheight = self.root .winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth-width)/2, (screenheight-height)/2)
self.root.geometry(alignstr)
self.root.title("量具管理"+self.user)
self.root.iconbitmap(".\\pic\\smart.ico")
self.root.wm_attributes("-topmost", 1)
self.photo0 = PhotoImage(file=os.getcwd()+".\\pic\\we1.png")
self.photo_create = PhotoImage(file=os.getcwd()+".\\pic\\create.png")
self.photor_search= PhotoImage(file=os.getcwd()+".\\pic\\search.png")
self.photo_analysis=PhotoImage(file=os.getcwd()+".\\pic\\analysis.png")
self.create_ui()
def create_ui(self):
self.one = Label(self.root, text="© Powered by Will Wu "+"2020-"+str(datetime.now().year), width=30, height=2, font=("Arial", 10))
self.one.pack(side=BOTTOM)
self.fx=LabelFrame(self.root)
self.fx.place(relx=0.1,rely=0.88,relwidth=0.2,relheight=0.12)
self.theLabel = Label(self.fx,image=self.photo0,fg="white")
self.theLabel.pack()
self.button_create=Button(self.root,image=self.photo_create,command=self.create_mi)
self.button_create.place(relx=0.05,rely=0.01)
self.button_search=Button(self.root,image=self.photor_search,command=self.search_mi)
self.button_search.place(relx=0.35,rely=0.01)
self.button_analysis=Button(self.root,image=self.photo_analysis,command=self.analysis_mi)
self.button_analysis.place(relx=0.65,rely=0.01)
def create_mi(self):
#self.root.destroy()
self.root.withdraw()
#root1=Tk()
root1=Toplevel()
createclass.create(root1,self.user,"量具生成_")
def search_mi(self):
self.root.withdraw()
root1=Toplevel()
queryclass.query(root1,self.user,"量具查询_")
def analysis_mi(self):
self.root.withdraw()
#root1=Tk()
root1=Toplevel()
analysisclass.analysis(root1,self.user,"量具分析_")
if __name__ == '__main__':
root = Tk()
base(root,"usertest")
root.mainloop()
编写常数模块,便于以后扩展修改
YEAR=["2018","2019","2020","2021","2022","2023"]
DEPT=["PRD","QUA","TEC"]
LOCATION=["CNC_QC","IQC","ASSEMBLY_QC","CNC_PRD","ASSEMBLY_PRD","TEC","QCROOM_BACKUP","QCROOM_UNUSED","QCROOM_SCRAP"]
STATUS=["Available","Unused","Backup","Scrap"]
SUPPLIER=["A","B","C"]
TYPE={"FWPRO":[ 'CM-4030', 'CM-3020'],
"FWELM":[ 'CSE001', 'CSP002'],
"FWMZH":[ '10mm', '1mm'],
"FWCMM":['Zeiss COUNTURA G2'],
"FWDCA": ['0-200x0.01mm','0-150x0.01mm'],
"FWDDG" :['0-20x0.01mm','20-30x0.01mm'],
"FWMIC":['D10-20x0.01mm','D20-30x0.01mm'],
"FWDTH": ["TESO001","TESO002"],
"FWEBG":["EBGO001","EBGO002"],
"FWSGN":["10mm","20mm"],
"FWTGN":['M8x1.25 ', 'M10X1.5-6H', 'M8-6H', 'M14*2-6H','7/8-14UNF 2B', 'G 1','M14*1.5-6H', 'M4 6H', 'M16X1.5', 'M12*1.75 6H'],
"FWMZH":["10mm","20mm"],
"FWMZR" :['64mm', '72mm'],
"FWTOG" :['10-20Nm', '30-100Nm'],
"FWSUP":['Non-Magnetic']}
文件结构