Python库存管理系统
一个可以直接使用的出入库管理系统,个人觉得相对来说也是比较完善了吧!!!(手动狗头)import randomfrom tkinter import *import tkinter.messageboximport sqlite3import osimport os.pathimport sysimport csvfrom tkinter import filedialogimport timef
·
一个可以直接使用的出入库管理系统,个人觉得相对来说也是比较完善了吧!!!(手动狗头)
这东西就是一个工厂的治工具管理,有些地方并没有完善,比如在线分布图,原本打算和库存联动的。
现在无聊被我写的很多涉及到出入库的差不多都可以直接拿来使用。
代码篇幅较大,大部分是‘在线分布图’功能部分,可以直接删除,不影响使用
然后包涵两张图片,图片请自己添加icon.ico和ico.png
此库存管理系统包涵,出库,入库,和一些其他的功能
包涵导入导出成csv文件,以及对软件的操作记录
最下面还有一个console.py文件用来管理
别提醒我,我知道很多地方可以优化,我不想改
如果是直接想复制下来使用不修改的兄弟,记得先运行console.py创建数据库的地址
废话不多说,上代码
main.py
import random
from tkinter import *
import tkinter.messagebox
import sqlite3
import os
import os.path
import sys
import csv
from tkinter import filedialog
import time
from time import strftime
from PIL import Image,ImageTk
class Main:
USER = ''
kc_list=[]
def __init__(self):
self.get()
self.kc_list=[]
self.capacity= False
self.password_MM = False
self.CW_number=0
self.Cw_jz()
self.M_ss=0
if os.path.exists("path.db"):
self.path_r()
else:
tkinter.messagebox.showerror("涛:","请管理员使用console工具建立数据库存放路径")
os._exit(0)
try:
self.root.destroy()
except:
pass
try:
self.A()
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
def destroy(self):
try:
self.root.destroy()
except:
pass
def destroy_win(self):
try:
self.win.destroy()
except:
pass
def get_image(self,filename,width,height):
im = Image.open(filename).resize((width,height))
return ImageTk.PhotoImage(im)
def A(self):
self.root=Tk()
self.root.iconbitmap('.\\icon.ico')
self.root.title("Funtion Box管理系统")
self.root.geometry('540x160+320+250')
self.root.resizable(False,False)
#self.root.minsize(540,160)
#self.root.maxsize(540,160)
#self.root.overrideredirect(True)
self.canvas_root = tkinter.Canvas(self.root,width=540,height=160)
self.im_root= self.get_image('ico.png',540,160)
self.canvas_root.create_image(540,160,image=self.im_root)
self.canvas_root.place(x=0,y=0)
we = Label(self.root,text='欢迎使用',font=("微软雅黑",18),fg="grey")
we.grid(row=0,column=0 )
if self.USER != '':
self.entry10=Entry(self.root,font=("微软雅黑",12),width=10,bd=0,bg= 'grey')
self.entry10.insert(0,'用户:'+self.USER)
self.entry10.config(state='readonly')
self.entry10.place(x=400,y=0)
button2=Button(self.root,text = "注销",command=self.zx)
button2.place(x=500,y=0)
else:
we = Label(self.root,text='未登录',font=("微软雅黑",12),fg="grey")
we.place(x=400,y=0)
button3=Button(self.root,text = "登录",command=self.G)
button3.place(x=460,y=0)
button4=Button(self.root,text = "注册",command=self.F)
button4.place(x=500,y=0)
welcome = Label(self.root,text='"Funtion Box管理系统"',font=("微软雅黑",20),fg="grey")
welcome.grid(row=2 ,column=5)
Text = Label(self.root,text="版本:1.03",font=("微软雅黑",11),fg="red")
Text.grid(row=2,column=7)
Text1 = Label(self.root,text="",font=("微软雅黑",11))
Text1.grid(row=3,column=0)
button1=Button(self.root,text = "入库",command=self.B)
button1.grid(row=4,column =0)
button1=Button(self.root,text = "出库",command=self.C)
button1.grid(row=4,column =5)
button1=Button(self.root,text = "高级",command=self.D)
button1.grid(row=4,column =7)
mainmenu = Menu(self.root)
mainmenu.add_command(label="退出",command=self.tuichu)
mainmenu.add_command(label="帮助",command=self.bangzhu)
mainmenu.add_command(label="历史版本信息",command=self.KK)
mainmenu.add_command(label="在线分布图",command=self.II)
mainmenu.add_command(label="console",command=self.console)
self.root.config(menu = mainmenu)
self.root.mainloop()
def B(self):
if self.USER == '':
tkinter.messagebox.showerror("涛:","请先登录")
else:
self.destroy()
self.root=Tk()
self.root.iconbitmap('.\\icon.ico')
self.root.title("Funtion Box管理系统-入库")
self.root.geometry('650x210+320+250')
self.root.resizable(False,False)
self.canvas_root = tkinter.Canvas(self.root,width=650,height=440)
self.im_root= self.get_image('ico.png',540,160)
self.canvas_root.create_image(325,-10,image=self.im_root)
self.canvas_root.place(x=0,y=0)
#self.root.minsize(650,200)
#self.root.maxsize(650,200)
#self.root.overrideredirect(True)
menu = Menu(self.root)
menu.add_command(label="返回主页面",command=self.__init__)
menu.add_command(label="帮助",command=self.bangzhu)
menu.add_command(label="退出",command=self.tuichu)
self.root.config(menu = menu)
we = Label(self.root,text='欢迎使用',font=("微软雅黑",18),fg="grey")
we.grid(row=0,column=0)
label1 = Label(self.root,text="请输入要入库的机种:")
label1.grid(row=1,column=1)
self.entry1=Entry(self.root,font=("微软雅黑",20))
self.entry1.grid(row=1,column=2)
label2 = Label(self.root,text="请输入入库的储位:")
label2.grid(row=2,column=1)
self.entry2=Entry(self.root,font=("微软雅黑",20))
self.entry2.grid(row=2,column=2)
button2=Button(self.root,text="确认入库",command=self.rk)
button2.grid(row=2,column=3)
label3 = Label(self.root,text="机种数量:")
label3.grid(row=3,column=1)
self.entry3=Entry(self.root,font=("微软雅黑",20))
self.entry3.grid(row=3,column=2)
self.CheckVar1 = IntVar()
C1 = Checkbutton(self.root, text = "这个储位是架子", variable = self.CheckVar1,onvalue = 1,offvalue=1,command=self.Cw_jz)
C1.grid(row=4,column=1)
C2 = Checkbutton(self.root, text = "这个储位是箱子", variable = self.CheckVar1,onvalue = 2,offvalue=2,command=self.Cw_xz)
C2.grid(row=4,column=2)
self.CheckVar1.set(1)
self.root.mainloop()
def C(self):
if self.USER == '':
tkinter.messagebox.showerror("涛:","请先登录")
else:
self.destroy()
self.root=Tk()
self.root.iconbitmap('.\\icon.ico')
self.root.title("Funtion Box管理系统-出库")
self.root.geometry('700x440+320+150')
self.root.resizable(False,False)
self.canvas_root = tkinter.Canvas(self.root,width=700,height=440)
self.im_root= self.get_image('ico.png',540,160)
self.canvas_root.create_image(700,160,image=self.im_root)
self.canvas_root.place(x=0,y=0)
#self.root.overrideredirect(True)
#self.root.minsize(700,430)
#self.root.maxsize(700,430)
menu = Menu(self.root)
menu.add_command(label="返回主页面",command=self.__init__)
menu.add_command(label="帮助",command=self.bangzhu)
menu.add_command(label="退出",command=self.tuichu)
self.root.config(menu = menu)
we = Label(self.root,text='欢迎使用',font=("微软雅黑",20),fg="grey")
we.grid(row=0,column=0)
label1 = Label(self.root,text="请输入要搜索的机种:")
label1.grid(row=1,column=1)
self.entry3=Entry(self.root,font=("微软雅黑",20))
self.entry3.grid(row=1,column=2)
CheckVar1 = IntVar()
C1 = Checkbutton(self.root, text = "单个读取", variable = CheckVar1,onvalue = 1,offvalue=1,command=self.dq1)
C1.grid(row=2,column=1)
C2 = Checkbutton(self.root, text = "全部读取", variable = CheckVar1,onvalue = 2,offvalue=2,command=self.dq2)
C2.grid(row=2,column=2)
CheckVar2 = IntVar()
C3 = Checkbutton(self.root, text = "启用模糊搜索机种名", variable = CheckVar2,onvalue = 1,offvalue=0,command=self.Mh)
C3.place(x=250,y=80)
label2 = Label(self.root,text="请输入要出库机种的储位:")
label2.grid(row=3,column=1)
self.entry4=Entry(self.root,font=("微软雅黑",20))
self.entry4.grid(row=3,column=2)
button1=Button(self.root,text="搜索储位",command=self.sscw)
button1.grid(row=1,column=3)
button2=Button(self.root,text="确认出库",command=self.ck)
button2.grid(row=3,column=3)
label5 = Label(self.root,text="请输入出库机种数量:")
label5.grid(row=4,column=1)
self.entry5=Entry(self.root,font=("微软雅黑",20))
self.entry5.grid(row=4,column=2)
self.text = Listbox(self.root,font = ("微软雅黑",12),width = 60,height = 10)
self.text.grid(row=5 ,columnspan = 100)
button3=Button(self.root,text="刷新",command=self.Sx)
button3.place(x=600,y=220)
self.var=StringVar()
la= Label(self.root,textvariable=self.var,fg='blue',font=("黑体",18))
la.place(x=150,y=10)
self.hq_get()
self.root.mainloop()
def Mh(self):
if self.M_ss==0:
self.M_ss=1
elif self.M_ss==1:
self.M_ss=0
def get(self):
try:
global list_ts
conn = sqlite3.connect("Funtion.db")
cu=conn.cursor()
cu.execute('select * from JZ')
list_ts=cu.fetchall()
conn.commit()
cu.close
print('get加载完毕')
except:
print('get加载失败')
def hq_get(self):
list=[]
J=self.entry3.get()
try:
if J!='':
for i in range(len(list_ts)):
if str(J) in str(list_ts[i][0]):
list.append(list_ts[i][0])
if list==[]:
self.var.set('你输入的没有授权')
self.root.after(1500,self.hq_get)
else:
Q=list[random.choice(range(len(list)))]
self.var.set('提示机种名称:'+Q)
self.root.after(1500,self.hq_get)
else:
self.root.after(1000,self.hq_get)
except:
self.root.after(1000,self.hq_get)
def D(self):
if self.USER == '':
tkinter.messagebox.showerror("涛:","请先登录")
else:
self.destroy()
self.root=Tk()
self.root.iconbitmap('.\\icon.ico')
self.root.title("Funtion Box管理系统-高级")
self.root.geometry('810x710+200+0')
self.root.resizable(False,False)
#self.root.minsize(810,700)
#self.root.maxsize(810,700)
#self.root.overrideredirect(True)
self.canvas_root = tkinter.Canvas(self.root,width=810,height=710)
self.im_root= self.get_image('ico.png',810,710)
self.canvas_root.create_image(900,710,image=self.im_root)
self.canvas_root.place(x=0,y=0)
menu = Menu(self.root)
menu.add_command(label="返回主页面",command=self.__init__)
menu.add_command(label="共用机种关系",command=self.H)
menu.add_command(label="退出",command=self.tuichu)
self.root.config(menu = menu)
self.text1 = Listbox(self.root,font = ("微软雅黑",12),width = 80,height = 28)
self.text1.grid(row=1 ,columnspan = 100)
label5 = Label(self.root,text="请输入:")
label5.grid(row=2,column=1)
self.entry5=Entry(self.root,font=(" 微软雅黑",20))
self.entry5.grid(row=2,column=2)
button1=Button(self.root,text="读取数据库",command=self.dqsjk)
button1.grid(row=1,column=101)
button2=Button(self.root,text="导出数据库",command=self.dccsv)
button2.grid(row=2,column=101)
button3=Button(self.root,text="授权机种入库",command=self.xzjz)
button3.grid(row=3,column=1)
button4=Button(self.root,text="取消入库权限",command=self.qxjz)
button4.grid(row=3,column=2)
button3=Button(self.root,text="授权储位可用",command=self.xzcw)
button3.grid(row=3,column=3)
button4=Button(self.root,text="取消储位可用",command=self.qxcw)
button4.grid(row=3,column=55)
button4=Button(self.root,text="导出授权信息",command=self.dcsq)
button4.grid(row=3,column=101)
button5=Button(self.root,text="空储位信息",command=self.nulcw)
button5.place(x=730,y=50)
button5=Button(self.root,text="导入授权机种",command=self.A_liulan)
button5.place(x=725,y=170)
button5=Button(self.root,text="导入授权储位",command=self.B_liulan)
button5.place(x=725,y=450)
button6=Button(self.root,text="刷新",command=self.sx)
button6.place(x=725,y=540)
button6=Button(self.root,text="导出操作记录",command=self.dcczjl)
button6.place(x=725,y=590)
button7=Button(self.root,text="读取储位机种",command=self.Dqcw)
button7.grid(row=2,column=3)
button8=Button(self.root,text="读取机种共用关系",command=self.dq_gx)
button8.grid(row=2,column=55)
self.root.mainloop()
def E(self):
self.win=Tk()
self.win.iconbitmap('.\\icon.ico')
self.win.title("Funtion Box管理系统-密码验证")
self.win.geometry('480x150+320+250')
self.win.resizable(False,False)
#self.win.minsize(480,150)
#self.win.maxsize(480,150)
label1 = Label(self.win,text="请输入管理密码:",font = ("微软雅黑",12))
label1.place(x=0,y=20)
self.entry01=Entry(self.win,font=("微软雅黑",20),show='*')
self.entry01.place(x=80,y=50)
button1=Button(self.win,text="确认",command=self.password)
button1.place(x=420,y=100)
self.win.mainloop()
def F(self):
self.destroy()
self.root=Tk()
self.root.iconbitmap('.\\icon.ico')
self.root.title("Funtion Box管理系统-用户注册")
self.root.geometry('650x170+320+250')
self.canvas_root = tkinter.Canvas(self.root,width=650,height=170)
self.im_root= self.get_image('ico.png',650,170)
self.canvas_root.create_image(680,170,image=self.im_root)
self.canvas_root.place(x=0,y=0)
#self.root.minsize(650,150)
#self.root.maxsize(650,150)
self.root.resizable(False,False)
#self.root.overrideredirect(True)
menu = Menu(self.root)
menu.add_command(label="返回主页面",command=self.__init__)
menu.add_command(label="帮助",command=self.bangzhu)
menu.add_command(label="退出",command=self.tuichu)
self.root.config(menu = menu)
we = Label(self.root,text='欢迎使用',font=("微软雅黑",18),fg="grey")
we.grid(row=0,column=0)
label1 = Label(self.root,text="请输入用户名:")
label1.grid(row=1,column=1)
self.entry11=Entry(self.root,font=("微软雅黑",20))
self.entry11.grid(row=1,column=2)
label2 = Label(self.root,text="请输入密码:")
label2.grid(row=2,column=1)
self.entry12=Entry(self.root,font=("微软雅黑",20),show='*')
self.entry12.grid(row=2,column=2)
button2=Button(self.root,text="注册",command=self.zc)
button2.grid(row=3,column=2)
self.root.mainloop()
def G(self):
self.destroy()
self.root=Tk()
self.root.iconbitmap('.\\icon.ico')
self.root.title("Funtion Box管理系统-登录")
self.root.geometry('650x170+320+250')
self.canvas_root = tkinter.Canvas(self.root,width=650,height=170)
self.im_root= self.get_image('ico.png',650,170)
self.canvas_root.create_image(680,170,image=self.im_root)
self.canvas_root.place(x=0,y=0)
#self.root.minsize(650,150)
#self.root.maxsize(650,150)
self.root.resizable(False,False)
#self.root.overrideredirect(True)
menu = Menu(self.root)
menu.add_command(label="返回主页面",command=self.__init__)
menu.add_command(label="帮助",command=self.bangzhu)
menu.add_command(label="退出",command=self.tuichu)
self.root.config(menu = menu)
we = Label(self.root,text='欢迎使用',font=("微软雅黑",18),fg="grey")
we.grid(row=0,column=0)
label1 = Label(self.root,text="请输入用户名:")
label1.grid(row=1,column=1)
self.entry13=Entry(self.root,font=("微软雅黑",20))
self.entry13.grid(row=1,column=2)
label2 = Label(self.root,text="请输入密码:")
label2.grid(row=2,column=1)
self.entry14=Entry(self.root,font=("微软雅黑",20),show='*')
self.entry14.grid(row=2,column=2)
button2=Button(self.root,text="登录",command=self.login)
button2.grid(row=3,column=2)
self.root.mainloop()
def H(self):
if self.USER == '':
tkinter.messagebox.showerror("涛:","请先登录")
else:
self.destroy()
self.root=Tk()
self.root.iconbitmap('.\\icon.ico')
self.root.title("Funtion Box管理系统-共用机种关系")
self.root.geometry('650x180+700+250')
self.canvas_root = tkinter.Canvas(self.root,width=650,height=180)
self.im_root= self.get_image('ico.png',650,180)
self.canvas_root.create_image(680,180,image=self.im_root)
self.canvas_root.place(x=0,y=0)
#self.root.minsize(650,180)
#self.root.maxsize(650,180)
#self.root.overrideredirect(True)
self.root.resizable(False,False)
menu = Menu(self.root)
menu.add_command(label="返回主页面",command=self.__init__)
menu.add_command(label="返回上级页面",command=self.shangji)
menu.add_command(label="帮助",command=self.bangzhu)
menu.add_command(label="退出",command=self.tuichu)
self.root.config(menu = menu)
we = Label(self.root,text='欢迎使用',font=("微软雅黑",18),fg="grey")
we.grid(row=0,column=0)
label1 = Label(self.root,text="请输入主机种:")
label1.grid(row=1,column=1)
self.entry1=Entry(self.root,font=("微软雅黑",20))
self.entry1.grid(row=1,column=2)
label2 = Label(self.root,text="请输入共用机种:")
label2.grid(row=2,column=1)
self.entry2=Entry(self.root,font=("微软雅黑",20))
self.entry2.grid(row=2,column=2)
button1=Button(self.root,text="建立共用关系",command=self.add_gx)
button1.place(x=125,y=125)
button3=Button(self.root,text="变更为主机种",command=self.main_gx)
button3.place(x=300,y=125)
button3=Button(self.root,text="删除共用关系",command=self.del_gx)
button3.place(x=480,y=125)
self.root.mainloop()
def II(self):
if self.USER == '':
tkinter.messagebox.showerror("涛:","请先登录")
else:
self.destroy()
self.root=Tk()
self.root.iconbitmap('.\\icon.ico')
self.root.title("Funtion Box管理系统-在线分布图")
self.root.geometry('1230x370+200+0')
self.root.resizable(False,False)
#self.root.minsize(810,700)
#self.root.maxsize(810,700)
#self.root.overrideredirect(True)
self.canvas_root = tkinter.Canvas(self.root,width=1390,height=710)
self.im_root= self.get_image('ico.png',1390,710)
self.canvas_root.create_image(700,500,image=self.im_root)
self.canvas_root.place(x=0,y=0)
menu = Menu(self.root)
menu.add_command(label="返回主页面",command=self.__init__)
menu.add_command(label="退出",command=self.tuichu)
self.root.config(menu = menu)
label1 = Label(self.root,text="线体",font=("微软雅黑",18))
label1.grid(row=0,column=5)
label11 = Label(self.root,text="内一")
label11.grid(row=1,column=0)
self.entry11=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry11.grid(row=1,column=1)
self.entry12=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry12.grid(row=1,column=2)
self.entry13=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry13.grid(row=1,column=3)
self.entry14=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry14.grid(row=1,column=4)
label12 = Label(self.root,text="内二")
label12.grid(row=2,column=0)
self.entry21=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry21.grid(row=2,column=1)
self.entry22=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry22.grid(row=2,column=2)
self.entry23=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry23.grid(row=2,column=3)
self.entry24=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry24.grid(row=2,column=4)
label13 = Label(self.root,text="内三")
label13.grid(row=3,column=0)
self.entry31=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry31.grid(row=3,column=1)
self.entry32=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry32.grid(row=3,column=2)
self.entry33=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry33.grid(row=3,column=3)
self.entry34=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry34.grid(row=3,column=4)
label1 = Label(self.root,text="流",font=("微软雅黑",12))
label1.grid(row=3,column=5)
label14 = Label(self.root,text="内四")
label14.grid(row=4,column=0)
self.entry41=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry41.grid(row=4,column=1)
self.entry42=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry42.grid(row=4,column=2)
self.entry43=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry43.grid(row=4,column=3)
self.entry44=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry44.grid(row=4,column=4)
label15 = Label(self.root,text="内五")
label15.grid(row=5,column=0)
self.entry51=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry51.grid(row=5,column=1)
self.entry52=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry52.grid(row=5,column=2)
self.entry53=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry53.grid(row=5,column=3)
self.entry54=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry54.grid(row=5,column=4)
label1 = Label(self.root,text="水",font=("微软雅黑",12))
label1.grid(row=5,column=5)
label16 = Label(self.root,text="内六")
label16.grid(row=6,column=0)
self.entry61=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry61.grid(row=6,column=1)
self.entry62=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry62.grid(row=6,column=2)
self.entry63=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry63.grid(row=6,column=3)
self.entry64=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry64.grid(row=6,column=4)
label17 = Label(self.root,text="内七")
label17.grid(row=7,column=0)
self.entry71=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry71.grid(row=7,column=1)
self.entry72=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry72.grid(row=7,column=2)
self.entry73=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry73.grid(row=7,column=3)
self.entry74=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry74.grid(row=7,column=4)
label1 = Label(self.root,text="线",font=("微软雅黑",12))
label1.grid(row=7,column=5)
label18 = Label(self.root,text="内八")
label18.grid(row=8,column=0)
self.entry81=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry81.grid(row=8,column=1)
self.entry82=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry82.grid(row=8,column=2)
self.entry83=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry83.grid(row=8,column=3)
self.entry84=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry84.grid(row=8,column=4)
label21 = Label(self.root,text="外一")
label21.grid(row=1,column=10)
self.entry15=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry15.grid(row=1,column=6)
self.entry16=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry16.grid(row=1,column=7)
self.entry17=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry17.grid(row=1,column=8)
self.entry18=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry18.grid(row=1,column=9)
label22 = Label(self.root,text="外二")
label22.grid(row=2,column=10)
self.entry25=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry25.grid(row=2,column=6)
self.entry26=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry26.grid(row=2,column=7)
self.entry27=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry27.grid(row=2,column=8)
self.entry28=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry28.grid(row=2,column=9)
label23 = Label(self.root,text="外三")
label23.grid(row=3,column=10)
self.entry35=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry35.grid(row=3,column=6)
self.entry36=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry36.grid(row=3,column=7)
self.entry37=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry37.grid(row=3,column=8)
self.entry38=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry38.grid(row=3,column=9)
label24 = Label(self.root,text="外四")
label24.grid(row=4,column=10)
self.entry45=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry45.grid(row=4,column=6)
self.entry46=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry46.grid(row=4,column=7)
self.entry47=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry47.grid(row=4,column=8)
self.entry48=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry48.grid(row=4,column=9)
label25 = Label(self.root,text="外五")
label25.grid(row=5,column=10)
self.entry55=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry55.grid(row=5,column=6)
self.entry56=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry56.grid(row=5,column=7)
self.entry57=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry57.grid(row=5,column=8)
self.entry58=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry58.grid(row=5,column=9)
label26 = Label(self.root,text="外六")
label26.grid(row=6,column=10)
self.entry65=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry65.grid(row=6,column=6)
self.entry66=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry66.grid(row=6,column=7)
self.entry67=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry67.grid(row=6,column=8)
self.entry68=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry68.grid(row=6,column=9)
label27 = Label(self.root,text="外七")
label27.grid(row=7,column=10)
self.entry75=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry75.grid(row=7,column=6)
self.entry76=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry76.grid(row=7,column=7)
self.entry77=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry77.grid(row=7,column=8)
self.entry78=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry78.grid(row=7,column=9)
label28 = Label(self.root,text="外八")
label28.grid(row=8,column=10)
self.entry85=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry85.grid(row=8,column=6)
self.entry86=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry86.grid(row=8,column=7)
self.entry87=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry87.grid(row=8,column=8)
self.entry88=Entry(self.root,font=("微软雅黑",12),width=15,justify='center',state = "disabled")
self.entry88.grid(row=8,column=9)
self.CheckVar1 = IntVar()
C1 = Checkbutton(self.root, text = "一线压床编号", variable = self.CheckVar1,onvalue = 1,offvalue=1,command=self.XZ1_1)
C1.place(x=120,y=250)
C2 = Checkbutton(self.root, text = "一线机种名称", variable = self.CheckVar1,onvalue = 2,offvalue=2,command=self.XZ1_2)
C2.place(x=220,y=250)
C3 = Checkbutton(self.root, text = "二线压床编号", variable = self.CheckVar1,onvalue = 3,offvalue=3,command=self.XZ2_1)
C3.place(x=120,y=280)
C4 = Checkbutton(self.root, text = "二线机种名称", variable = self.CheckVar1,onvalue = 4,offvalue=4,command=self.XZ2_2)
C4.place(x=220,y=280)
C5 = Checkbutton(self.root, text = "三线压床编号", variable = self.CheckVar1,onvalue = 5,offvalue=5,command=self.XZ3_1)
C5.place(x=120,y=310)
C6 = Checkbutton(self.root, text = "三线机种名称", variable = self.CheckVar1,onvalue = 6,offvalue=6,command=self.XZ3_2)
C6.place(x=220,y=310)
C7 = Checkbutton(self.root, text = "四线压床编号", variable = self.CheckVar1,onvalue = 7,offvalue=7,command=self.XZ4_1)
C7.place(x=550,y=250)
C8 = Checkbutton(self.root, text = "四线机种名称", variable = self.CheckVar1,onvalue = 8,offvalue=8,command=self.XZ4_2)
C8.place(x=720,y=250)
C9 = Checkbutton(self.root, text = "五线压床编号", variable = self.CheckVar1,onvalue = 9,offvalue=9,command=self.XZ5_1)
C9.place(x=1020,y=250)
C10 = Checkbutton(self.root, text = "五线机种名称", variable = self.CheckVar1,onvalue = 10,offvalue=10,command=self.XZ5_2)
C10.place(x=1120,y=250)
C11 = Checkbutton(self.root, text = "六线压床编号", variable = self.CheckVar1,onvalue = 11,offvalue=11,command=self.XZ6_1)
C11.place(x=1020,y=280)
C12 = Checkbutton(self.root, text = "六线机种名称", variable = self.CheckVar1,onvalue = 12,offvalue=12,command=self.XZ6_2)
C12.place(x=1120,y=280)
C13 = Checkbutton(self.root, text = "七线压床编号", variable = self.CheckVar1,onvalue = 13,offvalue=13,command=self.XZ7_1)
C13.place(x=1020,y=310)
C14 = Checkbutton(self.root, text = "七线机种名称", variable = self.CheckVar1,onvalue = 14,offvalue=14,command=self.XZ7_2)
C14.place(x=1120,y=310)
button1=Button(self.root,text = "修改",command=self.update_FB)
button1.place(x=580,y=280)
button1=Button(self.root,text = "解锁",command=self.JS_FB)
button1.place(x=750,y=280)
self.root.mainloop()
def KK(self):
self.win=Tk()
self.win.iconbitmap('.\\icon.ico')
self.win.title("Funtion Box管理系统-版本")
self.win.geometry('540x190+320+250')
self.win.resizable(False,False)
#self.win.minsize(540,160)
#self.win.maxsize(540,160)
#self.win.overrideredirect(True)
we = Label(self.win,text='欢迎使用',font=("微软雅黑",18),fg="grey")
we.grid(row=0,column =0)
we = Label(self.win,text='版本1.00',font=("微软雅黑",12))
we.grid(row=1,column =0)
we = Label(self.win,text='正式使用版本',font=("微软雅黑",8),fg="red")
we.grid(row=1,column =1)
we = Label(self.win,text='版本1.01',font=("微软雅黑",12))
we.grid(row=2,column =0)
we = Label(self.win,text='增加线上压床分布图,联机功能(读取线上数据库)',font=("微软雅黑",8),fg="red")
we.grid(row=2,column =1)
we = Label(self.win,text='版本1.02',font=("微软雅黑",12))
we.grid(row=3,column =0)
we = Label(self.win,text='移除程序修改线上数据库路径功能,此功能如需使用可以用console工具',font=("微软雅黑",8),fg="red")
we.grid(row=3,column =1)
we = Label(self.win,text='版本1.03',font=("微软雅黑",12))
we.grid(row=4,column =0)
we = Label(self.win,text='出库页面新增机种名称提醒',font=("微软雅黑",8),fg="red")
we.grid(row=4,column =1)
button1=Button(self.win,text = "确认",command=self.destroy_win)
button1.place(x=250,y=155)
self.win.mainloop()
def path_r(self):
if os.path.exists("path.db"):
conn = sqlite3.connect("path.db")
cu=conn.cursor()
cu.execute('select * from Path')
E=cu.fetchall()
conn.commit()
cu.close
self.path_L=E[0][0]
def console(self):
os.system("start console.exe")
def add_FB(self):
if os.path.exists(str(self.path_L)+'/'+"FB.db"):
pass
else:
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
sql = 'CREATE TABLE FB1(id TEXT PRIMARY KEY UNIQUE NOT NULL, Bh TEXT NOT NULL,Jz TEXT NOT NULL)'
cursor.execute(sql)
conn.commit()
cursor.close
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
sql = 'CREATE TABLE FB2(id TEXT PRIMARY KEY UNIQUE NOT NULL, Bh TEXT NOT NULL,Jz TEXT NOT NULL)'
cursor.execute(sql)
conn.commit()
cursor.close
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
sql = 'CREATE TABLE FB3(id TEXT PRIMARY KEY UNIQUE NOT NULL, Bh TEXT NOT NULL,Jz TEXT NOT NULL)'
cursor.execute(sql)
conn.commit()
cursor.close
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
sql = 'CREATE TABLE FB4(id TEXT PRIMARY KEY UNIQUE NOT NULL, Bh TEXT NOT NULL,Jz TEXT NOT NULL)'
cursor.execute(sql)
conn.commit()
cursor.close
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
sql = 'CREATE TABLE FB5(id TEXT PRIMARY KEY UNIQUE NOT NULL, Bh TEXT NOT NULL,Jz TEXT NOT NULL)'
cursor.execute(sql)
conn.commit()
cursor.close
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
sql = 'CREATE TABLE FB6(id TEXT PRIMARY KEY UNIQUE NOT NULL, Bh TEXT NOT NULL,Jz TEXT NOT NULL)'
cursor.execute(sql)
conn.commit()
cursor.close
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
sql = 'CREATE TABLE FB7(id TEXT PRIMARY KEY UNIQUE NOT NULL, Bh TEXT NOT NULL,Jz TEXT NOT NULL)'
cursor.execute(sql)
conn.commit()
cursor.close
I=11
for item in range(64):
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
r='INSERT INTO FB1 (id,Bh,Jz) VALUES (\"%s\","空","空")'%(I)
cursor.execute(r)
conn.commit()
cursor.close
if int(str(I)[0]) <= 8:
if int(str(I)[1]) < 8:
I=I+1
elif int(str(I)[1]) >= 8:
I=I+3
I=11
for item in range(64):
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
r='INSERT INTO FB2 (id,Bh,Jz) VALUES (\"%s\","空","空")'%(I)
cursor.execute(r)
conn.commit()
cursor.close
if int(str(I)[0]) <= 8:
if int(str(I)[1]) < 8:
I=I+1
elif int(str(I)[1]) >= 8:
I=I+3
I=11
for item in range(64):
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
r='INSERT INTO FB3 (id,Bh,Jz) VALUES (\"%s\","空","空")'%(I)
cursor.execute(r)
conn.commit()
cursor.close
if int(str(I)[0]) <= 8:
if int(str(I)[1]) < 8:
I=I+1
elif int(str(I)[1]) >= 8:
I=I+3
I=11
for item in range(64):
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
r='INSERT INTO FB4 (id,Bh,Jz) VALUES (\"%s\","空","空")'%(I)
cursor.execute(r)
conn.commit()
cursor.close
if int(str(I)[0]) <= 8:
if int(str(I)[1]) < 8:
I=I+1
elif int(str(I)[1]) >= 8:
I=I+3
I=11
for item in range(64):
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
r='INSERT INTO FB5 (id,Bh,Jz) VALUES (\"%s\","空","空")'%(I)
cursor.execute(r)
conn.commit()
cursor.close
if int(str(I)[0]) <= 8:
if int(str(I)[1]) < 8:
I=I+1
elif int(str(I)[1]) >= 8:
I=I+3
I=11
for item in range(64):
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
r='INSERT INTO FB6 (id,Bh,Jz) VALUES (\"%s\","空","空")'%(I)
cursor.execute(r)
conn.commit()
cursor.close
if int(str(I)[0]) <= 8:
if int(str(I)[1]) < 8:
I=I+1
elif int(str(I)[1]) >= 8:
I=I+3
I=11
for item in range(64):
conn = sqlite3.connect(str(self.path_L)+'/'+'FB.db')
cursor = conn.cursor()
r='INSERT INTO FB7 (id,Bh,Jz) VALUES (\"%s\","空","空")'%(I)
cursor.execute(r)
conn.commit()
cursor.close
if int(str(I)[0]) <= 8:
if int(str(I)[1]) < 8:
I=I+1
elif int(str(I)[1]) >= 8:
I=I+3
def XZ1_1(self):
self.add_FB()
self.update=11
self.Dq_PB(1,0)
def XZ1_2(self):
self.add_FB()
self.update=12
self.Dq_PB(1,1)
def XZ2_1(self):
self.add_FB()
self.update=21
self.Dq_PB(2,0)
def XZ2_2(self):
self.add_FB()
self.update=22
self.Dq_PB(2,1)
def XZ3_1(self):
self.add_FB()
self.update=31
self.Dq_PB(3,0)
def XZ3_2(self):
self.add_FB()
self.update=32
self.Dq_PB(3,1)
def XZ4_1(self):
self.add_FB()
self.update=41
self.Dq_PB(4,0)
def XZ4_2(self):
self.add_FB()
self.update=42
self.Dq_PB(4,1)
def XZ5_1(self):
self.add_FB()
self.update=51
self.Dq_PB(5,0)
def XZ5_2(self):
self.add_FB()
self.update=52
self.Dq_PB(5,1)
def XZ6_1(self):
self.add_FB()
self.update=61
self.Dq_PB(6,0)
def XZ6_2(self):
self.add_FB()
self.update=62
self.Dq_PB(6,1)
def XZ7_1(self):
self.add_FB()
self.update=71
self.Dq_PB(7,0)
def XZ7_2(self):
self.add_FB()
self.update=72
self.Dq_PB(7,1)
def update_FB(self):
if self.password_MM:
pass
else:
self.E()
self.FB_list=[]
if int(str(self.update)[1])==2:
self.FB_list.append(self.entry11.get())
self.FB_list.append(self.entry12.get())
self.FB_list.append(self.entry13.get())
self.FB_list.append(self.entry14.get())
self.FB_list.append(self.entry15.get())
self.FB_list.append(self.entry16.get())
self.FB_list.append(self.entry17.get())
self.FB_list.append(self.entry18.get())
self.FB_list.append(self.entry21.get())
self.FB_list.append(self.entry22.get())
self.FB_list.append(self.entry23.get())
self.FB_list.append(self.entry24.get())
self.FB_list.append(self.entry25.get())
self.FB_list.append(self.entry26.get())
self.FB_list.append(self.entry27.get())
self.FB_list.append(self.entry28.get())
self.FB_list.append(self.entry31.get())
self.FB_list.append(self.entry32.get())
self.FB_list.append(self.entry33.get())
self.FB_list.append(self.entry34.get())
self.FB_list.append(self.entry35.get())
self.FB_list.append(self.entry36.get())
self.FB_list.append(self.entry37.get())
self.FB_list.append(self.entry38.get())
self.FB_list.append(self.entry41.get())
self.FB_list.append(self.entry42.get())
self.FB_list.append(self.entry43.get())
self.FB_list.append(self.entry44.get())
self.FB_list.append(self.entry45.get())
self.FB_list.append(self.entry46.get())
self.FB_list.append(self.entry47.get())
self.FB_list.append(self.entry48.get())
self.FB_list.append(self.entry51.get())
self.FB_list.append(self.entry52.get())
self.FB_list.append(self.entry53.get())
self.FB_list.append(self.entry54.get())
self.FB_list.append(self.entry55.get())
self.FB_list.append(self.entry56.get())
self.FB_list.append(self.entry57.get())
self.FB_list.append(self.entry58.get())
self.FB_list.append(self.entry61.get())
self.FB_list.append(self.entry62.get())
self.FB_list.append(self.entry63.get())
self.FB_list.append(self.entry64.get())
self.FB_list.append(self.entry65.get())
self.FB_list.append(self.entry66.get())
self.FB_list.append(self.entry67.get())
self.FB_list.append(self.entry68.get())
self.FB_list.append(self.entry71.get())
self.FB_list.append(self.entry72.get())
self.FB_list.append(self.entry73.get())
self.FB_list.append(self.entry74.get())
self.FB_list.append(self.entry75.get())
self.FB_list.append(self.entry76.get())
self.FB_list.append(self.entry77.get())
self.FB_list.append(self.entry78.get())
self.FB_list.append(self.entry81.get())
self.FB_list.append(self.entry82.get())
self.FB_list.append(self.entry83.get())
self.FB_list.append(self.entry84.get())
self.FB_list.append(self.entry85.get())
self.FB_list.append(self.entry86.get())
self.FB_list.append(self.entry87.get())
self.FB_list.append(self.entry88.get())
i=[]
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
cur=conn.cursor()
cur.execute('select * from JZ')
J=cur.fetchall()
conn.commit()
cur.close
for l in range(len(self.FB_list)):
for item in range(len(J)):
i.append(J[item][0])
i.append('空')
if self.FB_list[l] not in i:
L=l+1
countion=L/8
pai=int(countion)+1
lie=float(countion)-int(countion)
if lie==float(0.125):
pai='内'+str(pai)
lie='左边数第一台'
elif lie==float(0.25):
pai='内'+str(pai)
lie='左边数第二台'
elif lie==float(0.375):
pai='内'+str(pai)
lie='左边数第三台'
elif lie==float(0.5):
pai='内'+str(pai)
lie='左边数第四台'
elif lie==float(0.628):
pai='外'+str(pai)
lie='右边数第四台'
elif lie==float(0.75):
pai='外'+str(pai)
lie='右边数第三台'
elif lie==float(0.875):
pai='外'+str(pai)
lie='右边数第二台'
elif lie==float(0):
pai='外'+str(int(pai)-1)
lie='右边数第一台'
self.W_JL('分布图-错误-输入机种没有授权或者输入错误,位置在%s,%s'%(pai,lie))
tkinter.messagebox.showerror("涛:","机种:"+self.FB_list[l]+"未授权或者输入错误!,位置在"+pai+lie)
return
if self.update==11:
Q='FB1'
T='Bh'
elif self.update==12:
Q='FB1'
T='Jz'
elif self.update==21:
Q='FB2'
T='Bh'
elif self.update==22:
Q='FB2'
T='Jz'
elif self.update==31:
Q='FB3'
T='Bh'
elif self.update==32:
Q='FB3'
T='Jz'
elif self.update==41:
Q='FB4'
T='Bh'
elif self.update==42:
Q='FB4'
T='Jz'
elif self.update==51:
Q='FB5'
T='Bh'
elif self.update==52:
Q='FB5'
T='Jz'
elif self.update==61:
Q='FB6'
T='Bh'
elif self.update==62:
Q='FB6'
T='Jz'
elif self.update==71:
Q='FB7'
T='Bh'
elif self.update==72:
Q='FB7'
T='Jz'
conn = sqlite3.connect(str(self.path_L)+'/'+"FB.db")
cu=conn.cursor()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry11.get(),11)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry12.get(),12)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry13.get(),13)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry14.get(),14)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry15.get(),15)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry16.get(),16)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry17.get(),18)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry18.get(),18)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry21.get(),21)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry22.get(),22)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry23.get(),23)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry24.get(),24)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry25.get(),25)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry26.get(),26)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry27.get(),27)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry28.get(),28)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry31.get(),31)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry32.get(),32)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry33.get(),33)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry34.get(),34)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry35.get(),35)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry36.get(),36)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry37.get(),37)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry38.get(),38)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry41.get(),41)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry42.get(),42)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry43.get(),43)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry44.get(),44)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry45.get(),45)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry46.get(),46)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry47.get(),47)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry48.get(),48)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry51.get(),51)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry52.get(),52)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry53.get(),53)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry54.get(),54)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry55.get(),55)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry56.get(),56)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry57.get(),57)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry58.get(),58)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry61.get(),61)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry62.get(),62)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry63.get(),63)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry64.get(),64)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry65.get(),65)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry66.get(),66)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry67.get(),67)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry68.get(),68)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry71.get(),71)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry72.get(),72)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry73.get(),73)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry74.get(),74)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry75.get(),75)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry76.get(),76)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry77.get(),77)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry78.get(),78)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry81.get(),81)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry82.get(),82)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry83.get(),83)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry84.get(),84)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry85.get(),85)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry86.get(),86)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry87.get(),87)
cu.execute(r)
conn.commit()
r='update \"%s\" set \"%s\"=\"%s\" where id=\"%s\"'%(Q,T,self.entry88.get(),88)
cu.execute(r)
conn.commit()
cu.close
if self.update==11:
self.Dq_PB(1,0)
elif self.update==12:
self.Dq_PB(1,1)
elif self.update==21:
self.Dq_PB(2,0)
elif self.update==22:
self.Dq_PB(2,1)
elif self.update==31:
self.Dq_PB(3,0)
elif self.update==32:
self.Dq_PB(3,1)
elif self.update==41:
self.Dq_PB(4,0)
elif self.update==42:
self.Dq_PB(4,1)
elif self.update==51:
self.Dq_PB(5,0)
elif self.update==52:
self.Dq_PB(5,1)
elif self.update==61:
self.Dq_PB(6,0)
elif self.update==62:
self.Dq_PB(6,1)
elif self.update==71:
self.Dq_PB(7,0)
elif self.update==72:
self.Dq_PB(7,1)
def JS_FB(self):
if self.password_MM:
pass
else:
self.E()
self.entry11['state'] = 'normal'
self.entry12['state'] = 'normal'
self.entry13['state'] = 'normal'
self.entry14['state'] = 'normal'
self.entry15['state'] = 'normal'
self.entry16['state'] = 'normal'
self.entry17['state'] = 'normal'
self.entry18['state'] = 'normal'
self.entry21['state'] = 'normal'
self.entry22['state'] = 'normal'
self.entry23['state'] = 'normal'
self.entry24['state'] = 'normal'
self.entry25['state'] = 'normal'
self.entry26['state'] = 'normal'
self.entry27['state'] = 'normal'
self.entry28['state'] = 'normal'
self.entry31['state'] = 'normal'
self.entry32['state'] = 'normal'
self.entry33['state'] = 'normal'
self.entry34['state'] = 'normal'
self.entry35['state'] = 'normal'
self.entry36['state'] = 'normal'
self.entry37['state'] = 'normal'
self.entry38['state'] = 'normal'
self.entry41['state'] = 'normal'
self.entry42['state'] = 'normal'
self.entry43['state'] = 'normal'
self.entry44['state'] = 'normal'
self.entry45['state'] = 'normal'
self.entry46['state'] = 'normal'
self.entry47['state'] = 'normal'
self.entry48['state'] = 'normal'
self.entry51['state'] = 'normal'
self.entry52['state'] = 'normal'
self.entry53['state'] = 'normal'
self.entry54['state'] = 'normal'
self.entry55['state'] = 'normal'
self.entry56['state'] = 'normal'
self.entry57['state'] = 'normal'
self.entry58['state'] = 'normal'
self.entry61['state'] = 'normal'
self.entry62['state'] = 'normal'
self.entry63['state'] = 'normal'
self.entry64['state'] = 'normal'
self.entry65['state'] = 'normal'
self.entry66['state'] = 'normal'
self.entry67['state'] = 'normal'
self.entry68['state'] = 'normal'
self.entry71['state'] = 'normal'
self.entry72['state'] = 'normal'
self.entry73['state'] = 'normal'
self.entry74['state'] = 'normal'
self.entry75['state'] = 'normal'
self.entry76['state'] = 'normal'
self.entry77['state'] = 'normal'
self.entry78['state'] = 'normal'
self.entry81['state'] = 'normal'
self.entry82['state'] = 'normal'
self.entry83['state'] = 'normal'
self.entry84['state'] = 'normal'
self.entry85['state'] = 'normal'
self.entry86['state'] = 'normal'
self.entry87['state'] = 'normal'
self.entry88['state'] = 'normal'
def Dq_PB(self,xian,FS):
conn = sqlite3.connect(str(self.path_L)+'/'+"FB.db")
cu=conn.cursor()
if xian==1:
cu.execute('select * from FB1')
elif xian==2:
cu.execute('select * from FB2')
elif xian==3:
cu.execute('select * from FB3')
elif xian==4:
cu.execute('select * from FB4')
elif xian==5:
cu.execute('select * from FB5')
elif xian==6:
cu.execute('select * from FB6')
elif xian==7:
cu.execute('select * from FB7')
E=cu.fetchall()
cu.close
I=11
if FS==0:
for i in range(64):
Q='self.entry'+E[i][0]
if Q=='self.entry11':
self.entry11['state'] = 'normal'
self.entry11.delete(0,END)
self.entry11.insert(0,'%s'%E[i][1])
self.entry11['state'] = 'disabled'
elif Q=='self.entry12':
self.entry12['state'] = 'normal'
self.entry12.delete(0,END)
self.entry12.insert(0,'%s'%E[i][1])
self.entry12['state'] = 'disabled'
elif Q=='self.entry13':
self.entry13['state'] = 'normal'
self.entry13.delete(0,END)
self.entry13.insert(0,'%s'%E[i][1])
self.entry13['state'] = 'disabled'
elif Q=='self.entry14':
self.entry14['state'] = 'normal'
self.entry14.delete(0,END)
self.entry14.insert(0,'%s'%E[i][1])
self.entry14['state'] = 'disabled'
elif Q=='self.entry15':
self.entry15['state'] = 'normal'
self.entry15.delete(0,END)
self.entry15.insert(0,'%s'%E[i][1])
self.entry15['state'] = 'disabled'
elif Q=='self.entry16':
self.entry16['state'] = 'normal'
self.entry16.delete(0,END)
self.entry16.insert(0,'%s'%E[i][1])
self.entry16['state'] = 'disabled'
elif Q=='self.entry17':
self.entry17['state'] = 'normal'
self.entry17.delete(0,END)
self.entry17.insert(0,'%s'%E[i][1])
self.entry17['state'] = 'disabled'
elif Q=='self.entry18':
self.entry18['state'] = 'normal'
self.entry18.delete(0,END)
self.entry18.insert(0,'%s'%E[i][1])
self.entry18['state'] = 'disabled'
elif Q=='self.entry21':
self.entry21['state'] = 'normal'
self.entry21.delete(0,END)
self.entry21.insert(0,'%s'%E[i][1])
self.entry21['state'] = 'disabled'
elif Q=='self.entry22':
self.entry22['state'] = 'normal'
self.entry22.delete(0,END)
self.entry22.insert(0,'%s'%E[i][1])
self.entry22['state'] = 'disabled'
elif Q=='self.entry23':
self.entry23['state'] = 'normal'
self.entry23.delete(0,END)
self.entry23.insert(0,'%s'%E[i][1])
self.entry23['state'] = 'disabled'
elif Q=='self.entry24':
self.entry24['state'] = 'normal'
self.entry24.delete(0,END)
self.entry24.insert(0,'%s'%E[i][1])
self.entry24['state'] = 'disabled'
elif Q=='self.entry25':
self.entry25['state'] = 'normal'
self.entry25.delete(0,END)
self.entry25.insert(0,'%s'%E[i][1])
self.entry25['state'] = 'disabled'
elif Q=='self.entry26':
self.entry26['state'] = 'normal'
self.entry26.delete(0,END)
self.entry26.insert(0,'%s'%E[i][1])
self.entry26['state'] = 'disabled'
elif Q=='self.entry27':
self.entry27['state'] = 'normal'
self.entry27.delete(0,END)
self.entry27.insert(0,'%s'%E[i][1])
self.entry27['state'] = 'disabled'
elif Q=='self.entry28':
self.entry28['state'] = 'normal'
self.entry28.delete(0,END)
self.entry28.insert(0,'%s'%E[i][1])
self.entry28['state'] = 'disabled'
elif Q=='self.entry31':
self.entry31['state'] = 'normal'
self.entry31.delete(0,END)
self.entry31.insert(0,'%s'%E[i][1])
self.entry31['state'] = 'disabled'
elif Q=='self.entry32':
self.entry32['state'] = 'normal'
self.entry32.delete(0,END)
self.entry32.insert(0,'%s'%E[i][1])
self.entry32['state'] = 'disabled'
elif Q=='self.entry33':
self.entry33['state'] = 'normal'
self.entry33.delete(0,END)
self.entry33.insert(0,'%s'%E[i][1])
self.entry33['state'] = 'disabled'
elif Q=='self.entry34':
self.entry34['state'] = 'normal'
self.entry34.delete(0,END)
self.entry34.insert(0,'%s'%E[i][1])
self.entry34['state'] = 'disabled'
elif Q=='self.entry35':
self.entry35['state'] = 'normal'
self.entry35.delete(0,END)
self.entry35.insert(0,'%s'%E[i][1])
self.entry35['state'] = 'disabled'
elif Q=='self.entry36':
self.entry36['state'] = 'normal'
self.entry36.delete(0,END)
self.entry36.insert(0,'%s'%E[i][1])
self.entry36['state'] = 'disabled'
elif Q=='self.entry37':
self.entry37['state'] = 'normal'
self.entry37.delete(0,END)
self.entry37.insert(0,'%s'%E[i][1])
self.entry37['state'] = 'disabled'
elif Q=='self.entry38':
self.entry38['state'] = 'normal'
self.entry38.delete(0,END)
self.entry38.insert(0,'%s'%E[i][1])
self.entry38['state'] = 'disabled'
elif Q=='self.entry41':
self.entry41['state'] = 'normal'
self.entry41.delete(0,END)
self.entry41.insert(0,'%s'%E[i][1])
self.entry41['state'] = 'disabled'
elif Q=='self.entry42':
self.entry42['state'] = 'normal'
self.entry42.delete(0,END)
self.entry42.insert(0,'%s'%E[i][1])
self.entry42['state'] = 'disabled'
elif Q=='self.entry43':
self.entry43['state'] = 'normal'
self.entry43.delete(0,END)
self.entry43.insert(0,'%s'%E[i][1])
self.entry43['state'] = 'disabled'
elif Q=='self.entry44':
self.entry44['state'] = 'normal'
self.entry44.delete(0,END)
self.entry44.insert(0,'%s'%E[i][1])
self.entry44['state'] = 'disabled'
elif Q=='self.entry45':
self.entry45['state'] = 'normal'
self.entry45.delete(0,END)
self.entry45.insert(0,'%s'%E[i][1])
self.entry45['state'] = 'disabled'
elif Q=='self.entry46':
self.entry46['state'] = 'normal'
self.entry46.delete(0,END)
self.entry46.insert(0,'%s'%E[i][1])
self.entry46['state'] = 'disabled'
elif Q=='self.entry47':
self.entry47['state'] = 'normal'
self.entry47.delete(0,END)
self.entry47.insert(0,'%s'%E[i][1])
self.entry47['state'] = 'disabled'
elif Q=='self.entry48':
self.entry48['state'] = 'normal'
self.entry48.delete(0,END)
self.entry48.insert(0,'%s'%E[i][1])
self.entry48['state'] = 'disabled'
elif Q=='self.entry51':
self.entry51['state'] = 'normal'
self.entry51.delete(0,END)
self.entry51.insert(0,'%s'%E[i][1])
self.entry51['state'] = 'disabled'
elif Q=='self.entry52':
self.entry52['state'] = 'normal'
self.entry52.delete(0,END)
self.entry52.insert(0,'%s'%E[i][1])
self.entry52['state'] = 'disabled'
elif Q=='self.entry53':
self.entry53['state'] = 'normal'
self.entry53.delete(0,END)
self.entry53.insert(0,'%s'%E[i][1])
self.entry53['state'] = 'disabled'
elif Q=='self.entry54':
self.entry54['state'] = 'normal'
self.entry54.delete(0,END)
self.entry54.insert(0,'%s'%E[i][1])
self.entry54['state'] = 'disabled'
elif Q=='self.entry55':
self.entry55['state'] = 'normal'
self.entry55.delete(0,END)
self.entry55.insert(0,'%s'%E[i][1])
self.entry55['state'] = 'disabled'
elif Q=='self.entry56':
self.entry56['state'] = 'normal'
self.entry56.delete(0,END)
self.entry56.insert(0,'%s'%E[i][1])
self.entry56['state'] = 'disabled'
elif Q=='self.entry57':
self.entry57['state'] = 'normal'
self.entry57.delete(0,END)
self.entry57.insert(0,'%s'%E[i][1])
self.entry57['state'] = 'disabled'
elif Q=='self.entry58':
self.entry58['state'] = 'normal'
self.entry58.delete(0,END)
self.entry58.insert(0,'%s'%E[i][1])
self.entry58['state'] = 'disabled'
elif Q=='self.entry61':
self.entry61['state'] = 'normal'
self.entry61.delete(0,END)
self.entry61.insert(0,'%s'%E[i][1])
self.entry61['state'] = 'disabled'
elif Q=='self.entry62':
self.entry62['state'] = 'normal'
self.entry62.delete(0,END)
self.entry62.insert(0,'%s'%E[i][1])
self.entry62['state'] = 'disabled'
elif Q=='self.entry63':
self.entry63['state'] = 'normal'
self.entry63.delete(0,END)
self.entry63.insert(0,'%s'%E[i][1])
self.entry63['state'] = 'disabled'
elif Q=='self.entry64':
self.entry64['state'] = 'normal'
self.entry64.delete(0,END)
self.entry64.insert(0,'%s'%E[i][1])
self.entry64['state'] = 'disabled'
elif Q=='self.entry65':
self.entry65['state'] = 'normal'
self.entry65.delete(0,END)
self.entry65.insert(0,'%s'%E[i][1])
self.entry65['state'] = 'disabled'
elif Q=='self.entry66':
self.entry66['state'] = 'normal'
self.entry66.delete(0,END)
self.entry66.insert(0,'%s'%E[i][1])
self.entry66['state'] = 'disabled'
elif Q=='self.entry67':
self.entry67['state'] = 'normal'
self.entry67.delete(0,END)
self.entry67.insert(0,'%s'%E[i][1])
self.entry67['state'] = 'disabled'
elif Q=='self.entry68':
self.entry68['state'] = 'normal'
self.entry68.delete(0,END)
self.entry68.insert(0,'%s'%E[i][1])
self.entry68['state'] = 'disabled'
elif Q=='self.entry71':
self.entry71['state'] = 'normal'
self.entry71.delete(0,END)
self.entry71.insert(0,'%s'%E[i][1])
self.entry71['state'] = 'disabled'
elif Q=='self.entry72':
self.entry72['state'] = 'normal'
self.entry72.delete(0,END)
self.entry72.insert(0,'%s'%E[i][1])
self.entry72['state'] = 'disabled'
elif Q=='self.entry73':
self.entry73['state'] = 'normal'
self.entry73.delete(0,END)
self.entry73.insert(0,'%s'%E[i][1])
self.entry73['state'] = 'disabled'
elif Q=='self.entry74':
self.entry74['state'] = 'normal'
self.entry74.delete(0,END)
self.entry74.insert(0,'%s'%E[i][1])
self.entry74['state'] = 'disabled'
elif Q=='self.entry75':
self.entry75['state'] = 'normal'
self.entry75.delete(0,END)
self.entry75.insert(0,'%s'%E[i][1])
self.entry75['state'] = 'disabled'
elif Q=='self.entry76':
self.entry76['state'] = 'normal'
self.entry76.delete(0,END)
self.entry76.insert(0,'%s'%E[i][1])
self.entry76['state'] = 'disabled'
elif Q=='self.entry77':
self.entry77['state'] = 'normal'
self.entry77.delete(0,END)
self.entry77.insert(0,'%s'%E[i][1])
self.entry77['state'] = 'disabled'
elif Q=='self.entry78':
self.entry78['state'] = 'normal'
self.entry78.delete(0,END)
self.entry78.insert(0,'%s'%E[i][1])
self.entry78['state'] = 'disabled'
elif Q=='self.entry81':
self.entry81['state'] = 'normal'
self.entry81.delete(0,END)
self.entry81.insert(0,'%s'%E[i][1])
self.entry81['state'] = 'disabled'
elif Q=='self.entry82':
self.entry82['state'] = 'normal'
self.entry82.delete(0,END)
self.entry82.insert(0,'%s'%E[i][1])
self.entry82['state'] = 'disabled'
elif Q=='self.entry83':
self.entry83['state'] = 'normal'
self.entry83.delete(0,END)
self.entry83.insert(0,'%s'%E[i][1])
self.entry83['state'] = 'disabled'
elif Q=='self.entry84':
self.entry84['state'] = 'normal'
self.entry84.delete(0,END)
self.entry84.insert(0,'%s'%E[i][1])
self.entry84['state'] = 'disabled'
elif Q=='self.entry85':
self.entry85['state'] = 'normal'
self.entry85.delete(0,END)
self.entry85.insert(0,'%s'%E[i][1])
self.entry85['state'] = 'disabled'
elif Q=='self.entry86':
self.entry86['state'] = 'normal'
self.entry86.delete(0,END)
self.entry86.insert(0,'%s'%E[i][1])
self.entry86['state'] = 'disabled'
elif Q=='self.entry87':
self.entry87['state'] = 'normal'
self.entry87.delete(0,END)
self.entry87.insert(0,'%s'%E[i][1])
self.entry87['state'] = 'disabled'
elif Q=='self.entry88':
self.entry88['state'] = 'normal'
self.entry88.delete(0,END)
self.entry88.insert(0,'%s'%E[i][1])
self.entry88['state'] = 'disabled'
elif FS==1:
for i in range(64):
Q='self.entry'+E[i][0]
if Q=='self.entry11':
self.entry11['state'] = 'normal'
self.entry11.delete(0,END)
self.entry11.insert(0,'%s'%E[i][2])
self.entry11['state'] = 'disabled'
elif Q=='self.entry12':
self.entry12['state'] = 'normal'
self.entry12.delete(0,END)
self.entry12.insert(0,'%s'%E[i][2])
self.entry12['state'] = 'disabled'
elif Q=='self.entry13':
self.entry13['state'] = 'normal'
self.entry13.delete(0,END)
self.entry13.insert(0,'%s'%E[i][2])
self.entry13['state'] = 'disabled'
elif Q=='self.entry14':
self.entry14['state'] = 'normal'
self.entry14.delete(0,END)
self.entry14.insert(0,'%s'%E[i][2])
self.entry14['state'] = 'disabled'
elif Q=='self.entry15':
self.entry15['state'] = 'normal'
self.entry15.delete(0,END)
self.entry15.insert(0,'%s'%E[i][2])
self.entry15['state'] = 'disabled'
elif Q=='self.entry16':
self.entry16['state'] = 'normal'
self.entry16.delete(0,END)
self.entry16.insert(0,'%s'%E[i][2])
self.entry16['state'] = 'disabled'
elif Q=='self.entry17':
self.entry17['state'] = 'normal'
self.entry17.delete(0,END)
self.entry17.insert(0,'%s'%E[i][2])
self.entry17['state'] = 'disabled'
elif Q=='self.entry18':
self.entry18['state'] = 'normal'
self.entry18.delete(0,END)
self.entry18.insert(0,'%s'%E[i][2])
self.entry18['state'] = 'disabled'
elif Q=='self.entry21':
self.entry21['state'] = 'normal'
self.entry21.delete(0,END)
self.entry21.insert(0,'%s'%E[i][2])
self.entry21['state'] = 'disabled'
elif Q=='self.entry22':
self.entry22['state'] = 'normal'
self.entry22.delete(0,END)
self.entry22.insert(0,'%s'%E[i][2])
self.entry22['state'] = 'disabled'
elif Q=='self.entry23':
self.entry23['state'] = 'normal'
self.entry23.delete(0,END)
self.entry23.insert(0,'%s'%E[i][2])
self.entry23['state'] = 'disabled'
elif Q=='self.entry24':
self.entry24['state'] = 'normal'
self.entry24.delete(0,END)
self.entry24.insert(0,'%s'%E[i][2])
self.entry24['state'] = 'disabled'
elif Q=='self.entry25':
self.entry25['state'] = 'normal'
self.entry25.delete(0,END)
self.entry25.insert(0,'%s'%E[i][2])
self.entry25['state'] = 'disabled'
elif Q=='self.entry26':
self.entry26['state'] = 'normal'
self.entry26.delete(0,END)
self.entry26.insert(0,'%s'%E[i][2])
self.entry26['state'] = 'disabled'
elif Q=='self.entry27':
self.entry27['state'] = 'normal'
self.entry27.delete(0,END)
self.entry27.insert(0,'%s'%E[i][2])
self.entry27['state'] = 'disabled'
elif Q=='self.entry28':
self.entry28['state'] = 'normal'
self.entry28.delete(0,END)
self.entry28.insert(0,'%s'%E[i][2])
self.entry28['state'] = 'disabled'
elif Q=='self.entry31':
self.entry31['state'] = 'normal'
self.entry31.delete(0,END)
self.entry31.insert(0,'%s'%E[i][2])
self.entry31['state'] = 'disabled'
elif Q=='self.entry32':
self.entry32['state'] = 'normal'
self.entry32.delete(0,END)
self.entry32.insert(0,'%s'%E[i][2])
self.entry32['state'] = 'disabled'
elif Q=='self.entry33':
self.entry33['state'] = 'normal'
self.entry33.delete(0,END)
self.entry33.insert(0,'%s'%E[i][2])
self.entry33['state'] = 'disabled'
elif Q=='self.entry34':
self.entry34['state'] = 'normal'
self.entry34.delete(0,END)
self.entry34.insert(0,'%s'%E[i][2])
self.entry34['state'] = 'disabled'
elif Q=='self.entry35':
self.entry35['state'] = 'normal'
self.entry35.delete(0,END)
self.entry35.insert(0,'%s'%E[i][2])
self.entry35['state'] = 'disabled'
elif Q=='self.entry36':
self.entry36['state'] = 'normal'
self.entry36.delete(0,END)
self.entry36.insert(0,'%s'%E[i][2])
self.entry36['state'] = 'disabled'
elif Q=='self.entry37':
self.entry37['state'] = 'normal'
self.entry37.delete(0,END)
self.entry37.insert(0,'%s'%E[i][2])
self.entry37['state'] = 'disabled'
elif Q=='self.entry38':
self.entry38['state'] = 'normal'
self.entry38.delete(0,END)
self.entry38.insert(0,'%s'%E[i][2])
self.entry38['state'] = 'disabled'
elif Q=='self.entry41':
self.entry41['state'] = 'normal'
self.entry41.delete(0,END)
self.entry41.insert(0,'%s'%E[i][2])
self.entry41['state'] = 'disabled'
elif Q=='self.entry42':
self.entry42['state'] = 'normal'
self.entry42.delete(0,END)
self.entry42.insert(0,'%s'%E[i][2])
self.entry42['state'] = 'disabled'
elif Q=='self.entry43':
self.entry43['state'] = 'normal'
self.entry43.delete(0,END)
self.entry43.insert(0,'%s'%E[i][2])
self.entry43['state'] = 'disabled'
elif Q=='self.entry44':
self.entry44['state'] = 'normal'
self.entry44.delete(0,END)
self.entry44.insert(0,'%s'%E[i][2])
self.entry44['state'] = 'disabled'
elif Q=='self.entry45':
self.entry45['state'] = 'normal'
self.entry45.delete(0,END)
self.entry45.insert(0,'%s'%E[i][2])
self.entry45['state'] = 'disabled'
elif Q=='self.entry46':
self.entry46['state'] = 'normal'
self.entry46.delete(0,END)
self.entry46.insert(0,'%s'%E[i][2])
self.entry46['state'] = 'disabled'
elif Q=='self.entry47':
self.entry47['state'] = 'normal'
self.entry47.delete(0,END)
self.entry47.insert(0,'%s'%E[i][2])
self.entry47['state'] = 'disabled'
elif Q=='self.entry48':
self.entry48['state'] = 'normal'
self.entry48.delete(0,END)
self.entry48.insert(0,'%s'%E[i][2])
self.entry48['state'] = 'disabled'
elif Q=='self.entry51':
self.entry51['state'] = 'normal'
self.entry51.delete(0,END)
self.entry51.insert(0,'%s'%E[i][2])
self.entry51['state'] = 'disabled'
elif Q=='self.entry52':
self.entry52['state'] = 'normal'
self.entry52.delete(0,END)
self.entry52.insert(0,'%s'%E[i][2])
self.entry52['state'] = 'disabled'
elif Q=='self.entry53':
self.entry53['state'] = 'normal'
self.entry53.delete(0,END)
self.entry53.insert(0,'%s'%E[i][2])
self.entry53['state'] = 'disabled'
elif Q=='self.entry54':
self.entry54['state'] = 'normal'
self.entry54.delete(0,END)
self.entry54.insert(0,'%s'%E[i][2])
self.entry54['state'] = 'disabled'
elif Q=='self.entry55':
self.entry55['state'] = 'normal'
self.entry55.delete(0,END)
self.entry55.insert(0,'%s'%E[i][2])
self.entry55['state'] = 'disabled'
elif Q=='self.entry56':
self.entry56['state'] = 'normal'
self.entry56.delete(0,END)
self.entry56.insert(0,'%s'%E[i][2])
self.entry56['state'] = 'disabled'
elif Q=='self.entry57':
self.entry57['state'] = 'normal'
self.entry57.delete(0,END)
self.entry57.insert(0,'%s'%E[i][2])
self.entry57['state'] = 'disabled'
elif Q=='self.entry58':
self.entry58['state'] = 'normal'
self.entry58.delete(0,END)
self.entry58.insert(0,'%s'%E[i][2])
self.entry58['state'] = 'disabled'
elif Q=='self.entry61':
self.entry61['state'] = 'normal'
self.entry61.delete(0,END)
self.entry61.insert(0,'%s'%E[i][2])
self.entry61['state'] = 'disabled'
elif Q=='self.entry62':
self.entry62['state'] = 'normal'
self.entry62.delete(0,END)
self.entry62.insert(0,'%s'%E[i][2])
self.entry62['state'] = 'disabled'
elif Q=='self.entry63':
self.entry63['state'] = 'normal'
self.entry63.delete(0,END)
self.entry63.insert(0,'%s'%E[i][2])
self.entry63['state'] = 'disabled'
elif Q=='self.entry64':
self.entry64['state'] = 'normal'
self.entry64.delete(0,END)
self.entry64.insert(0,'%s'%E[i][2])
self.entry64['state'] = 'disabled'
elif Q=='self.entry65':
self.entry65['state'] = 'normal'
self.entry65.delete(0,END)
self.entry65.insert(0,'%s'%E[i][2])
self.entry65['state'] = 'disabled'
elif Q=='self.entry66':
self.entry66['state'] = 'normal'
self.entry66.delete(0,END)
self.entry66.insert(0,'%s'%E[i][2])
self.entry66['state'] = 'disabled'
elif Q=='self.entry67':
self.entry67['state'] = 'normal'
self.entry67.delete(0,END)
self.entry67.insert(0,'%s'%E[i][2])
self.entry67['state'] = 'disabled'
elif Q=='self.entry68':
self.entry68['state'] = 'normal'
self.entry68.delete(0,END)
self.entry68.insert(0,'%s'%E[i][2])
self.entry68['state'] = 'disabled'
elif Q=='self.entry71':
self.entry71['state'] = 'normal'
self.entry71.delete(0,END)
self.entry71.insert(0,'%s'%E[i][2])
self.entry71['state'] = 'disabled'
elif Q=='self.entry72':
self.entry72['state'] = 'normal'
self.entry72.delete(0,END)
self.entry72.insert(0,'%s'%E[i][2])
self.entry72['state'] = 'disabled'
elif Q=='self.entry73':
self.entry73['state'] = 'normal'
self.entry73.delete(0,END)
self.entry73.insert(0,'%s'%E[i][2])
self.entry73['state'] = 'disabled'
elif Q=='self.entry74':
self.entry74['state'] = 'normal'
self.entry74.delete(0,END)
self.entry74.insert(0,'%s'%E[i][2])
self.entry74['state'] = 'disabled'
elif Q=='self.entry75':
self.entry75['state'] = 'normal'
self.entry75.delete(0,END)
self.entry75.insert(0,'%s'%E[i][2])
self.entry75['state'] = 'disabled'
elif Q=='self.entry76':
self.entry76['state'] = 'normal'
self.entry76.delete(0,END)
self.entry76.insert(0,'%s'%E[i][2])
self.entry76['state'] = 'disabled'
elif Q=='self.entry77':
self.entry77['state'] = 'normal'
self.entry77.delete(0,END)
self.entry77.insert(0,'%s'%E[i][2])
self.entry77['state'] = 'disabled'
elif Q=='self.entry78':
self.entry78['state'] = 'normal'
self.entry78.delete(0,END)
self.entry78.insert(0,'%s'%E[i][2])
self.entry78['state'] = 'disabled'
elif Q=='self.entry81':
self.entry81['state'] = 'normal'
self.entry81.delete(0,END)
self.entry81.insert(0,'%s'%E[i][2])
self.entry81['state'] = 'disabled'
elif Q=='self.entry82':
self.entry82['state'] = 'normal'
self.entry82.delete(0,END)
self.entry82.insert(0,'%s'%E[i][2])
self.entry82['state'] = 'disabled'
elif Q=='self.entry83':
self.entry83['state'] = 'normal'
self.entry83.delete(0,END)
self.entry83.insert(0,'%s'%E[i][2])
self.entry83['state'] = 'disabled'
elif Q=='self.entry84':
self.entry84['state'] = 'normal'
self.entry84.delete(0,END)
self.entry84.insert(0,'%s'%E[i][2])
self.entry84['state'] = 'disabled'
elif Q=='self.entry85':
self.entry85['state'] = 'normal'
self.entry85.delete(0,END)
self.entry85.insert(0,'%s'%E[i][2])
self.entry85['state'] = 'disabled'
elif Q=='self.entry86':
self.entry86['state'] = 'normal'
self.entry86.delete(0,END)
self.entry86.insert(0,'%s'%E[i][2])
self.entry86['state'] = 'disabled'
elif Q=='self.entry87':
self.entry87['state'] = 'normal'
self.entry87.delete(0,END)
self.entry87.insert(0,'%s'%E[i][2])
self.entry87['state'] = 'disabled'
elif Q=='self.entry88':
self.entry88['state'] = 'normal'
self.entry88.delete(0,END)
self.entry88.insert(0,'%s'%E[i][2])
self.entry88['state'] = 'disabled'
def dq_gx(self):
try:
J=self.entry5.get()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where name=\"%s\"'%J)
E=cu.fetchall()
conn.commit()
cu.close
if J!=[]:
if '*' not in E[0][0]:
T=E[0][0]
i='*'+str(E[0][0])
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%i)
E=cu.fetchall()
conn.commit()
cu.close
J=E[0][1]
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%T)
E=cu.fetchall()
conn.commit()
cu.close
self.text1.insert(END,"主机种:%s"%J)
P=[]
for item in range(len(E)):
P.append(E[item][1])
self.text1.insert(END,"共用:%s"%P)
self.text1.see(END)
self.text1.update()
else:
J=E[0][1]
T=E[0][0].strip('*')
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%T)
E=cu.fetchall()
conn.commit()
cu.close
self.text1.insert(END,"主机种:%s"%J)
P=[]
for item in range(len(E)):
P.append(E[item][1])
self.text1.insert(END,"共用:%s"%P)
self.text1.see(END)
self.text1.update()
except(IndexError):
self.text1.insert(END,"没有相关记录")
self.text1.see(END)
return
def main_gx(self):
self.sql
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
J1=self.entry1.get()
cu.execute('select * from JZ where name=\"%s\"'%J1)
E=cu.fetchall()
conn.commit()
cu.close
if E==[]:
self.W_JL('共用关系-错误-主机种输入错误,未查询到机种')
tkinter.messagebox.showerror("涛:","主机种输入错误,未查询到机种")
else:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
J1=self.entry1.get()
cu.execute('select * from JZ where id=\"%s\" and name=\"%s\"'%(E[0][0],J1))
Y=cu.fetchall()
conn.commit()
cu.close
if str(Y[0][0])[0]=='*':
self.W_JL('共用关系-错误-此机种的共用系列'+J1+',已经有主机种:'+Y[0][1])
tkinter.messagebox.showerror("涛:","此机种的共用系列,已经有主机种:"+Y[0][1]+"操作中断")
return
else:
F='*'+str(E[0][0])
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
J1=self.entry1.get()
cu.execute('select * from JZ where id=\"%s\"'%F)
Y=cu.fetchall()
conn.commit()
cu.close
if Y==[]:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
J1=self.entry1.get()
r='update JZ set id=\"%s\" where name=\"%s\"'%(F,J1)
cu.execute(r)
conn.commit()
cu.close
self.W_JL('共用关系-建立此机种的共用系列主机种:'+J1)
tkinter.messagebox.showinfo("涛:","主机种("+J1+")已经建立")
return
elif str(Y[0][0])[0]=='*':
self.W_JL('共用关系-错误-此机种的共用系列'+J1+',已经有主机种:'+Y[0][1])
tkinter.messagebox.showerror("涛:","此机种的共用系列,已经有主机种:"+Y[0][1]+"操作中断")
return
else:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
def del_gx(self):
self.sql()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
J1=self.entry1.get()
J2=self.entry2.get()
cu.execute('select * from JZ where name=\"%s\"'%J1)
E=cu.fetchall()
conn.commit()
cu.close
if E==[]:
self.W_JL('共用关系-错误-主机种输入错误,未查询到机种')
tkinter.messagebox.showerror("涛:","主机种输入错误,未查询到机种")
else:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('DELETE FROM JZ WHERE name=\"%s\"'%J1)
conn.commit()
cu.close
self.W_JL('共用关系-删除-已经删除机种:'+J1+'的共用关系')
tkinter.messagebox.showinfo("涛:","已经删除机种:"+J1+"的共用关系")
def add_gx(self):
self.sql()
self.see_gx()
J1=self.entry1.get()
J2=self.entry2.get()
if J1=='':
self.W_JL('共用关系-错误-没有输入主机种')
tkinter.messagebox.showerror("涛:","请输入主机种")
return
if J2=='':
self.W_JL('共用关系-错误-没有输入共用机种')
tkinter.messagebox.showerror("涛:","请输入共用机种")
return
i=[]
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
cur=conn.cursor()
cur.execute('select * from JZ')
J=cur.fetchall()
conn.commit()
cur.close
for item in range(len(J)):
i.append(J[item][0])
if J1 not in i:
self.W_JL('共用关系-错误-输入机种没有授权或者输入错误',Jz=J1)
tkinter.messagebox.showerror("涛:","机种:"+J1+"未授权或者输入错误!")
return
if J2 not in i:
self.W_JL('共用关系-错误-输入机种没有授权或者输入错误',Jz=J2)
tkinter.messagebox.showerror("涛:","机种:"+J2+"未授权或者输入错误!")
return
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where name=\"%s\"'%J1)
E=cu.fetchall()
conn.commit()
cu.close
if E==[]:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
r='INSERT INTO JZ (id,name) VALUES (\"%s\",\"%s\")'%(self.see_id,J1)
cu.execute(r)
r='INSERT INTO JZ (id,name) VALUES (\"%s\",\"%s\")'%(self.see_id,J2)
cu.execute(r)
conn.commit()
cu.close
self.W_JL('共用关系-建立-机种:'+J1+'已经和机种:'+J2+'建立共用关系')
tkinter.messagebox.showinfo("涛:","关系建立成功,机种:"+J1+"和机种:"+J2+"已经共用")
try:
self.main_gx()
except:
pass
else:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\" and name=\"%s\"'%(E[0][0],J1))
F=cu.fetchall()
conn.commit()
cu.close
if F==[]:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
r='INSERT INTO JZ (id,name) VALUES (\"%s\",\"%s\")'%(self.see_id,J2)
cu.execute(r)
conn.commit()
cu.close
self.W_JL('共用关系-建立-机种:'+J1+'已经和机种:'+J2+'建立共用关系')
tkinter.messagebox.showinfo("涛:","关系建立成功,机种:"+J1+"和机种:"+J2+"已经共用")
else:
try:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
i=F[0][0]
if '*' in F[0][0]:
i=F[0][0].strip('*')
#for item in range(len(str(F[0][0]))):
#if str(F[0][0])[item]!='*':
#i=str(i)+str(F[0][0])[item]
r='INSERT INTO JZ (id,name) VALUES (\"%s\",\"%s\")'%(i,J2)
cu.execute(r)
conn.commit()
cu.close
self.W_JL('共用关系-建立-机种:'+J1+'已经和机种:'+J2+'建立共用关系')
tkinter.messagebox.showinfo("涛:","关系建立成功,机种:"+J1+"和机种:"+J2+"已经共用")
except(sqlite3.IntegrityError):
self.W_JL('共用关系-错误-输入的机种:'+J1+'已经建立过共用关系')
tkinter.messagebox.showerror("涛:","输入的共用机种"+J1+"已经建立过共用关系!")
def see_gx(self):
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id order by id desc')
E=cu.fetchall()
conn.commit()
cu.close
if E==[]:
self.see_id=1
return self.see_id
else:
Q=[]
for i in range(len(E)):
Q.append(int(E[i][0]))
L=max(Q)
self.see_id=L+1
return self.see_id
def shangji(self):
self.destroy()
self.D()
def Cw_jz(self):
self.capacity= False
def Cw_xz(self):
self.capacity= True
try:
if self.entry3.get()=='':
self.W_JL('入库-错误-箱子-没有输入箱子内机种数量')
tkinter.messagebox.showerror("涛:","请输入箱子内机种数量")
self.CheckVar1.set(1)
elif int(self.entry3.get()) > 3 or int(self.entry3.get())<1:
self.W_JL('入库-错误-箱子-输入箱子内机种数量不合理')
tkinter.messagebox.showerror("涛:","输入的机种数量不对,范围为1-3,谢谢")
self.CheckVar1.set(1)
else:
pass
except:
self.W_JL('入库-错误-箱子-输入箱子内机种数量不合理')
tkinter.messagebox.showerror("涛:","输入的机种数量不对,范围为1-3,谢谢")
self.CheckVar1.set(1)
def dq1(self):
self.Duqv = True
def dq2(self):
self.Duqv = False
def A_liulan(self):
if self.password_MM:
pass
else:
self.E()
if self.password_MM:
self.root1 = Tk()
self.root1.title("涛涛正在选取文件,别打扰")
self.root1.withdraw()
self.path = filedialog.askopenfilename()
self.text1.insert(END,"正在处理")
self.text1.insert(END,"看到‘导入完成’才是导入成功,否则为失败")
self.text1.see(END)
self.text1.update()
f1=open(self.path,'r',encoding='UTF-8')
line=f1.readlines()
try:
for itme in line:
L=itme.strip('\n')
i=L.strip('\ufeff')
if i != '':
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
QWE='INSERT INTO JZ (id) VALUES (\"%s\")'%i
cursor.execute(QWE)
conn.commit()
cursor.close
self.text1.insert(END,'导入机种:'+i)
self.text1.see(END)
self.text1.update()
self.W_JL('导入机种授权成功')
self.text1.insert(END,"导入完成")
self.text1.see(END)
self.text1.update()
except(sqlite3.IntegrityError):
self.W_JL('导入储位授权失败',Jz=i)
tkinter.messagebox.showerror("涛:","机种:"+i+"导入失败,中断导入,原因:可能已经授权")
def B_liulan(self):
if self.password_MM:
pass
else:
self.E()
if self.password_MM:
self.root1 = Tk()
self.root1.title("涛涛正在选取文件,别打扰")
self.root1.withdraw()
self.path = filedialog.askopenfilename()
self.text1.insert(END,"正在处理")
self.text1.insert(END,"看到‘导入完成’才是导入成功,否则为失败")
self.text1.see(END)
self.text1.update()
f1=open(self.path,'r',encoding='UTF-8')
line=f1.readlines()
try:
for itme in line:
L=itme.strip('\n')
i=L.strip('\ufeff')
if i != '':
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
rk='INSERT INTO CW (id) VALUES (\"%s\")'%i
cursor.execute(rk)
conn.commit()
cursor.close
self.text1.insert(END,'导入储位:'+i)
self.text1.see(END)
self.text1.update()
self.W_JL('导入储位授权成功')
self.text1.insert(END,"导入完成")
self.text1.see(END)
self.text1.update()
except(sqlite3.IntegrityError):
self.W_JL('导入储位授权失败',Cw=i)
tkinter.messagebox.showerror("涛:","储位:"+i+"导入失败,中断导入,原因:可能已经授权")
def bangzhu(self):
tkinter.messagebox.showinfo("涛","已经基本实现出库、入库、搜索(出库可以进行)")
tkinter.messagebox.showinfo("涛","储位格式为'??/??-??',问号代表一个字符,每个位置最多两个字符,例如'1/大E-15'")
def tuichu(self):
if tkinter.messagebox.askokcancel("涛:","确定退出?"):
os._exit(0)
def Sx(self):
self.text.delete(0,END)
def sx(self):
self.text1.delete(0,END)
def qingkong(self):
self.entry2.delete(0,END)
def qingkong1(self):
self.CheckVar1.set(1)
self.entry2.delete(0,END)
self.entry3.delete(0,END)
def sql(self):
#创建数据库,存在则连接
if os.path.exists(str(self.path_L)+'/'+"Funtion.db"):
pass
else:
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
sql = 'CREATE TABLE Student(id TEXT PRIMARY KEY UNIQUE NOT NULL, Name TEXT)'
#main表,储位机种关系对应表
cursor.execute(sql)
conn.commit()
sql = 'CREATE TABLE JZ(id TEXT PRIMARY KEY UNIQUE NOT NULL)'
#JZ表,机种授权查询表
cursor.execute(sql)
conn.commit()
sql = 'CREATE TABLE CW(id TEXT PRIMARY KEY UNIQUE NOT NULL)'
#CW表,储位授权查询表
cursor.execute(sql)
conn.commit()
cursor.close
if os.path.exists(str(self.path_L)+'/'+"User.db"):
pass
else:
conn = sqlite3.connect(str(self.path_L)+'/'+'User.db')
cursor = conn.cursor()
sql = 'CREATE TABLE user(name TEXT PRIMARY KEY UNIQUE NOT NULL, passwork TEXT)'
#用户登录管理表
cursor.execute(sql)
conn.commit()
cursor.close
if os.path.exists(str(self.path_L)+'/'+"Debug.db"):
pass
else:
conn = sqlite3.connect(str(self.path_L)+'/'+'Debug.db')
cursor = conn.cursor()
sql = 'CREATE TABLE JL(date TEXT,time TEXT,class TEXT,CW TEXT,JZ TEXT,NAME TEXT)'
#软件操作记录复查表
cursor.execute(sql)
conn.commit()
cursor.close
self.sql_F()
def sql_F(self):
if os.path.exists(str(self.path_L)+'/'+"Funtion_CZ.db"):
pass
else:
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion_CZ.db')
cursor = conn.cursor()
sql1 = 'CREATE TABLE JZ(id TEXT ,name TEXT UNIQUE)'
cursor.execute(sql1)
conn.commit()
sql2 = 'CREATE TABLE CW(name TEXT UNIQUE,number TEXT)'
cursor.execute(sql2)
conn.commit()
cursor.close
def password(self):
#高级管理员登录
if os.path.exists("password.db"):
conn = sqlite3.connect('password.db')
cursor = conn.cursor()
cur=conn.cursor()
cur.execute('select * from password')
E=cur.fetchall()
if E[0][0] == self.entry01.get():
try:
self.W_JL('密码验证成功')
except(AttributeError):
pass
tkinter.messagebox.showinfo("涛:","密码验证成功")
self.password_MM = True
self.win.destroy()
return self.password_MM
else:
try:
self.W_JL('密码验证失败,密码错误')
except(AttributeError):
pass
tkinter.messagebox.showerror("涛:","密码错误")
else:
conn = sqlite3.connect('password.db')
cursor = conn.cursor()
sql = 'CREATE TABLE password(id TEXT PRIMARY KEY UNIQUE NOT NULL)'
cursor.execute(sql)
conn.commit()
I=self.entry01.get()
r='INSERT INTO password (id) VALUES (\"%s\")'%(I)
cursor.execute(r)
conn.commit()
cursor.close
try:
self.W_JL('设置密码,获取权限')
except(AttributeError):
pass
tkinter.messagebox.showinfo("涛:","密码已经设置成功,已经获取权限")
self.password_MM = True
return self.password_MM
def rk(self):
if '*' not in self.entry2.get():
self.qrrk(self.entry2.get(),self.entry1.get())
elif '*' in self.entry2.get():
self.plsc(self.entry2.get())
number=0
for i in range(len(self.kc_list)):
self.qrrk(self.kc_list[number],self.entry1.get())
number=number+1
def ck(self):
if '*' not in self.entry4.get():
self.qrck(self.entry3.get(),self.entry4.get())
elif '*' in self.entry4.get():
self.plsc(self.entry4.get())
number=0
for i in range(len(self.kc_list)):
try:
int(self.kc_list[number][2])
self.qrck(self.entry3.get(),self.kc_list[number])
number=number+1
except:
self.W_JL('出库错误-不支持多储位出库',Cw=self.kc_list[number],Jz=self.entry3.get())
tkinter.messagebox.showerror("涛:","箱子不支持多储位出入库")
return
def plsc(self,P):
if self.capacity == False:
N=str(P)
self.kc_list=[]
if N[1]=='/':
if N[3]=='-':
if N[5]=='*':
T=int(N[6])
Q=int(N[4])
for w in range(T):
I='%s/%s-%s'%(N[0],N[2],Q)
Q=Q+1
self.kc_list.append(I)
return self.kc_list
elif N[6]=='*':
T=int(N[7])
Q=int(str(N[4])+str(N[5]))
for w in range(T):
I='%s/%s-%s'%(N[0],N[2],Q)
Q=Q+1
self.kc_list.append(I)
return self.kc_list
elif N[4]=='-':
if N[6]=='*':
T=int(N[7])
Q=int(N[5])
E=str(N[2])+str(N[3])
for w in range(T):
I='%s/%s-%s'%(N[0],E,Q)
Q=Q+1
self.kc_list.append(I)
return self.kc_list
elif N[7]=='*':
T=int(N[8])
Q=int(str(N[5])+str(N[6]))
E=str(N[2])+str(N[3])
for w in range(T):
I='%s/%s-%s'%(N[0],E,Q)
Q=Q+1
self.kc_list.append(I)
return self.kc_list
elif N[2]=='/':
if N[4]=='-':
if N[6]=='*':
T=int(N[7])
Q=int(N[5])
R=str(N[0])+str(N[1])
for w in range(T):
I='%s/%s-%s'%(R,N[3],Q)
Q=Q+1
self.kc_list.append(I)
return self.kc_list
elif N[7]=='*':
T=int(N[8])
Q=int(str(N[5])+str(N[6]))
R=str(N[0])+str(N[1])
for w in range(T):
I='%s/%s-%s'%(R,N[3],Q)
Q=Q+1
self.kc_list.append(I)
return self.kc_list
elif N[5]=='-':
if N[7]=='*':
T=int(N[8])
Q=int(N[6])
E=str(N[3])+str(N[4])
R=str(N[0])+str(N[1])
for w in range(T):
I='%s/%s-%s'%(R,E,Q)
Q=Q+1
self.kc_list.append(I)
return self.kc_list
elif N[8]=='*':
T=int(N[9])
Q=int(str(N[6])+str(N[7]))
E=str(N[3])+str(N[4])
R=str(N[0])+str(N[1])
for w in range(T):
I='%s/%s-%s'%(R,E,Q)
Q=Q+1
self.kc_list.append(I)
return self.kc_list
else:
tkinter.messagebox.showerror("涛:","箱子不支持多储位出入库")
def qrrk(self,chuwei,jizhong):
self.sql()
I=chuwei
N=jizhong
if N=="":
self.W_JL('入库-错误-没有输入机种!',Cw=I)
tkinter.messagebox.showerror("涛:","机种都不输,你入个der")
return
if I=="":
self.W_JL('入库-错误-没有输入储位',Jz=N)
tkinter.messagebox.showerror("涛:","储位在哪里啊,储位在哪里,储位在那.....")
return
i=[]
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
cur=conn.cursor()
cur.execute('select * from JZ')
J=cur.fetchall()
conn.commit()
cur.close
for item in range(len(J)):
i.append(J[item][0])
if N not in i:
self.W_JL('入库-错误-输入机种没有授权或者输入错误',Cw=I,Jz=N)
tkinter.messagebox.showerror("涛:","机种:"+N+"未授权或者输入错误!")
return
i=[]
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
cur=conn.cursor()
cur.execute('select * from CW')
C=cur.fetchall()
conn.commit()
cur.close
for item in range(len(C)):
i.append(str(C[item][0]))
if I not in i:
self.W_JL('入库-错误-储位未授权或者输入错误!',Cw=I,Jz=N)
tkinter.messagebox.showerror("涛:","储位:"+I+"未授权或者输入错误!")
return
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where name=\"%s\"'%N)
E=cu.fetchall()
conn.commit()
cu.close
if E!=[]:
if '*' not in E[0][0]:
i='*'+str(E[0][0])
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%i)
E=cu.fetchall()
conn.commit()
cu.close
if E==[]:
self.W_JL("入库-错误-输入机种:"+N+"未建立主机种")
tkinter.messagebox.showerror("涛:","提示:请为输入机种:"+N+"建立主机种")
return
else:
tkinter.messagebox.showinfo("涛:","提示:输入机种:"+N+"为共用机种,主机种为:"+E[0][1])
N=E[0][1]
else:
N=E[0][1]
tkinter.messagebox.showinfo("涛:","提示:输入机种:"+N+"为共用机种,主机种为:"+E[0][1])
try:
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
rk='INSERT INTO Student (id,Name) VALUES (\"%s\",\"%s\")'%(I,N)
cursor.execute(rk)
conn.commit()
cursor.close
except(sqlite3.IntegrityError):
try:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from CW where name=\"%s\"'%I)
F=cu.fetchall()
conn.commit()
cu.close
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
else:
if F==[]:
self.W_JL('入库-错误-储位上有机种',Cw=I,Jz=N)
tkinter.messagebox.showerror("涛:","储位:"+I+"上面已经有机种了,此次操作不做登记")
return
elif self.capacity == True:
C=self.entry2.get()
D=self.entry3.get()
if self.entry3.get() == '':
self.W_JL('入库-错误-箱子-没有输入箱子内机种数量')
tkinter.messagebox.showerror("涛:","请输入箱子内机种数量")
return
K=int(F[0][1])+int(D)
if K > 3:
self.W_JL('入库-错误-箱子入库后数量('+str(K)+')异常',Cw=I,Jz=N)
tkinter.messagebox.showerror("涛:","出错了,箱子入库后数据异常,中断操作")
self.Cw_jz()
return
else:
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
cur=conn.cursor()
cur.execute('select * from Student where id=\"%s\"'%I)
B=cur.fetchall()
conn.commit()
cur.close
if B[0][1] == N:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cursor=conn.cursor()
r='update CW set number=\"%s\" where name=\"%s\"'%(K,I)
cursor.execute(r)
conn.commit()
cursor.close
self.W_JL('入库-箱子现在数量为:'+str(K),Cw=I,Jz=N)
tkinter.messagebox.showinfo("涛:","机种:"+N+",已经在箱子:"+I+"上登记成功,现在数量为:"+str(K))
self.qingkong1()
self.Cw_jz()
return
else:
self.W_JL('入库-错误-箱子入库机种('+N+')和实际('+F[0][0]+')不一致',Cw=I,Jz=N)
tkinter.messagebox.showerror("涛:","同个箱子,不支持不同机种入库,中断操作")
self.Cw_jz()
return
else:
self.W_JL("入库-错误-库存为箱子,未勾选'这个储位是箱子'",Cw=I,Jz=N)
tkinter.messagebox.showerror("涛:","这个地方是箱子哦,已经有库存,请勾选'这个储位是箱子'")
self.Cw_jz()
return
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
else:
if self.capacity == True:
if self.entry3.get() == '':
self.W_JL('入库-错误-箱子-没有输入箱子内机种数量')
print('1111')
tkinter.messagebox.showerror("涛:","请输入箱子内机种数量")
return
C=self.entry2.get()
D=self.entry3.get()
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion_CZ.db')
cursor = conn.cursor()
r='INSERT INTO CW (name,number) VALUES (\"%s\",\"%s\")'%(C,D)
cursor.execute(r)
conn.commit()
cursor.close
self.W_JL('入库-箱子-入库数量为:'+D,Cw=I,Jz=N)
tkinter.messagebox.showinfo("涛:","机种:"+N+",已经在箱子:"+I+"上登记成功数量为:"+D)
self.qingkong1()
self.Cw_jz()
return
elif self.capacity == False:
self.W_JL('入库',Cw=I,Jz=N)
tkinter.messagebox.showinfo("涛:","机种:"+N+",已经在储位:"+I+"上登记成功")
self.qingkong()
return
def xzjz(self):
self.sql()
if self.password_MM:
pass
else:
self.E()
if self.password_MM:
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
J=self.entry5.get()
if J=="":
self.W_JL('新增机种权限-没有输入机种')
tkinter.messagebox.showerror("涛:","没有输入机种啊!!")
else:
try:
rk='INSERT INTO JZ (id) VALUES (\"%s\")'%J
cursor.execute(rk)
conn.commit()
cursor.close
except(sqlite3.IntegrityError):
self.W_JL('新增机种权限-机种已经有权限,无需重复添加')
self.text1.insert(END,"机种:%s的入库授权早已经开通,无需再次开通"%J)
self.text1.see(END)
self.text1.update()
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
else:
self.W_JL('授予机种入库权限',Jz=J)
self.text1.insert(END,"已经开放机种:%s的入库授权"%J)
self.text1.see(END)
self.text1.update()
def qxjz(self):
self.sql()
if self.password_MM:
pass
else:
self.E()
if self.password_MM:
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
J=self.entry5.get()
if J=="":
self.W_JL('取消机种权限-没有输入机种')
tkinter.messagebox.showerror("涛:","没有输入机种啊!!")
else:
cursor.execute('select * from JZ where id=\"%s\"'%J)
E=cursor.fetchall()
try:
if E[0][0] == J:
cursor.execute('DELETE FROM jz WHERE id=\"%s\"'%J)
conn.commit()
cursor.close
self.W_JL('取消机种入库权限',Jz=J)
self.text1.insert(END,"已经取消机种:%s的入库授权"%J)
self.text1.see(END)
self.text1.update()
except:
self.W_JL('取消机种权限-查询不到权限',Jz=J)
self.text1.insert(END,"查询不到机种:%s的入库授权"%J)
self.text1.see(END)
self.text1.update()
def xzcw(self):
self.sql()
if self.password_MM:
pass
else:
self.E()
if self.password_MM:
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
C=self.entry5.get()
if C=="":
self.W_JL('新增储位权限-没有输入储位')
tkinter.messagebox.showerror("涛:","没有输入储位啊!!")
else:
try:
rk='INSERT INTO CW (id) VALUES (\"%s\")'%C
cursor.execute(rk)
conn.commit()
cursor.close
except(sqlite3.IntegrityError):
self.W_JL('新增储位权限-储位已经有权限,无需重复添加')
self.text1.insert(END,"储位:%s的入库授权早已经开通,无需再次开通"%C)
self.text1.see(END)
self.text1.update()
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
else:
self.W_JL('授予储位入库权限',Cw=C)
self.text1.insert(END,"已经开放储位:%s的入库授权"%C)
self.text1.see(END)
self.text1.update()
def qxcw(self):
self.sql()
if self.password_MM:
pass
else:
self.E()
if self.password_MM:
conn = sqlite3.connect(str(self.path_L)+'/'+'Funtion.db')
cursor = conn.cursor()
C=self.entry5.get()
if C=="":
self.W_JL('取消储位权限-没有输入储位')
tkinter.messagebox.showerror("涛:","没有输入储位啊!!")
else:
cursor.execute('select * from CW where id=\"%s\"'%C)
E=cursor.fetchall()
try:
if E[0][0] == C:
cursor.execute('DELETE FROM CW WHERE id=\"%s\"'%C)
conn.commit()
cursor.close
self.W_JL('取消储位入库权限',Cw=C)
self.text1.insert(END,"已经取消储位:%s的可入库授权"%C)
self.text1.see(END)
self.text1.update()
except:
self.W_JL('取消储位权限-查询不到权限',Cw=C)
self.text1.insert(END,"查询不到储位:%s的可入库授权"%C)
self.text1.see(END)
self.text1.update()
def dqsjk(self):
if os.path.exists(str(self.path_L)+'/'+"Funtion.db"):
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student')
Q=cu.fetchall()
conn.commit()
U=0
try:
T=range(len(Q))[-1]+1
while True:
if U < T:
W=Q[U]
self.text1.insert(END,"储位,机种")
self.text1.insert(END,W)
self.text1.see(END)
self.text1.update()
U=U+1
elif U >= T:
self.W_JL('读取数据库内容')
self.text1.insert(END,"搜索完成")
self.text1.see(END)
self.text1.update()
break
except(IndexError):
self.W_JL('读取数据库内容,数据库为空')
self.text1.insert(END,"没有相关记录")
self.text1.see(END)
self.text1.update()
else:
tkinter.messagebox.showerror("涛:","你都没有入过库!!!")
def dccsv(self):
self.sql()
if tkinter.messagebox.askokcancel("涛:","是否导出为UTF-8编码文件"):
f = open(r'数据库.csv','w',encoding='UTF-8',newline='' "")
wt=csv.writer(f)
wt.writerow(["儲位","機種"])
if os.path.exists(str(self.path_L)+'/'+"Debug.db"):
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student')
Q=cu.fetchall()
conn.commit()
U=0
try:
T=range(len(Q))[-1]+1
while True:
if U < T:
W=Q[U]
wt.writerow([[W[0]],W[1]])
U=U+1
elif U >= T:
self.W_JL('导出数据库内容')
tkinter.messagebox.showinfo("涛:","已经导出文件'数据库.csv',在软件根目录下")
f.close()
os.system('start 数据库.csv')
break
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
else:
f = open(r'数据库.csv','w',encoding='GBK',newline='' "")
wt=csv.writer(f)
wt.writerow(["儲位","機種"])
if os.path.exists(str(self.path_L)+'/'+"Debug.db"):
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student')
Q=cu.fetchall()
conn.commit()
U=0
try:
T=range(len(Q))[-1]+1
while True:
if U < T:
W=Q[U]
wt.writerow([[W[0]],W[1]])
U=U+1
elif U >= T:
self.W_JL('导出数据库内容')
tkinter.messagebox.showinfo("涛:","已经导出文件'数据库.csv',在软件根目录下")
f.close()
os.system('start 数据库.csv')
break
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
def dcsq(self):
self.sql()
if tkinter.messagebox.askokcancel("涛:","是否导出为UTF-8编码文件"):
f = open(r'授权信息.csv','w',encoding='UTF-8',newline='' "")
wt=csv.writer(f)
wt.writerow(["已經授權信息"])
if os.path.exists(str(self.path_L)+'/'+"Debug.db"):
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from CW')
Q=cu.fetchall()
conn.commit()
cu.execute('select * from JZ')
R=cu.fetchall()
conn.commit()
U=0
I=0
try:
f = open(r'授权信息.csv','a',encoding='UTF-8',newline='' "")
wt=csv.writer(f)
T=range(len(Q))[-1]+1
Y=range(len(R))[-1]+1
while True:
if U < T:
W=Q[U]
wt.writerow([""])
wt.writerow(['儲位'])
wt.writerow([[W[0]]])
U=U+1
elif U >= T:
if I < Y:
E=R[I]
wt.writerow([""])
wt.writerow(['機種'])
wt.writerow([E[0]])
I=I+1
elif I >= Y:
self.W_JL('导出已授权信息')
tkinter.messagebox.showinfo("涛:","已经导出文件'授权信息.csv',在软件根目录下")
f.close()
os.system('start 授权信息.csv')
break
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
else:
f = open(r'授权信息.csv','w',encoding='GBK',newline='' "")
wt=csv.writer(f)
wt.writerow(["已經授權信息"])
if os.path.exists(str(self.path_L)+'/'+"Debug.db"):
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from CW')
Q=cu.fetchall()
conn.commit()
cu.execute('select * from JZ')
R=cu.fetchall()
conn.commit()
U=0
I=0
try:
f = open(r'授权信息.csv','a',encoding='GBK',newline='' "")
wt=csv.writer(f)
T=range(len(Q))[-1]+1
Y=range(len(R))[-1]+1
while True:
if U < T:
W=Q[U]
wt.writerow([""])
wt.writerow(['儲位'])
wt.writerow([[W[0]]])
U=U+1
elif U >= T:
if I < Y:
E=R[I]
wt.writerow([""])
wt.writerow(['機種'])
wt.writerow([E[0]])
I=I+1
elif I >= Y:
self.W_JL('导出已授权信息')
tkinter.messagebox.showinfo("涛:","已经导出文件'授权信息.csv',在软件根目录下")
f.close()
os.system('start 授权信息.csv')
break
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
def dcczjl(self):
if tkinter.messagebox.askokcancel("涛:","是否导出为UTF-8编码文件"):
conn = sqlite3.connect(str(self.path_L)+'/'+"Debug.db")
cu=conn.cursor()
cu.execute('select * from JL')
Q=cu.fetchall()
conn.commit()
U=0
try:
f = open(r'完整操作记录.csv','w',encoding='UTF-8',newline='' "")
wt=csv.writer(f)
T=range(len(Q))[-1]+1
while True:
if U < T:
if U == 0:
wt.writerow(['日期','时间','操作类型','储位','机种','操作者'])
wt.writerow([Q[U][0],Q[U][1],Q[U][2],[Q[U][3]],[Q[U][4]],Q[U][5]])
else:
wt.writerow([Q[U][0],Q[U][1],Q[U][2],[Q[U][3]],[Q[U][4]],Q[U][5]])
U=U+1
elif U >= T:
tkinter.messagebox.showinfo("涛:","已经导出文件'完整操作记录.csv',在软件根目录下")
f.close()
os.system("start 完整操作记录.csv")
break
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
else:
conn = sqlite3.connect(str(self.path_L)+'/'+"Debug.db")
cu=conn.cursor()
cu.execute('select * from JL')
Q=cu.fetchall()
conn.commit()
U=0
try:
f = open(r'完整操作记录.csv','w',encoding='GBK',newline='' "")
wt=csv.writer(f)
T=range(len(Q))[-1]+1
while True:
if U < T:
if U == 0:
wt.writerow(['日期','时间','操作类型','储位','机种','操作者'])
wt.writerow([Q[U][0],Q[U][1],Q[U][2],[Q[U][3]],[Q[U][4]],Q[U][5]])
else:
wt.writerow([Q[U][0],Q[U][1],Q[U][2],[Q[U][3]],[Q[U][4]],Q[U][5]])
U=U+1
elif U >= T:
tkinter.messagebox.showinfo("涛:","已经导出文件'完整操作记录.csv',在软件根目录下")
f.close()
os.system("start 完整操作记录.csv")
break
except:
tkinter.messagebox.showerror("涛:","出错了,请联系制作者,即将提示错误信息,请谨记!")
tkinter.messagebox.showerror("涛:",sys.exc_info())
def sscw(self):
self.sql()
if self.M_ss==0:
try:
if self.Duqv == False:
#多个搜索
S=self.entry3.get()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student where Name=\"%s\"'%S)
Q=cu.fetchall()
conn.commit()
try:
J=Q[0][1]
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where name=\"%s\"'%J)
E=cu.fetchall()
conn.commit()
cu.close
if E!=[]:
if '*' in E[0][0]:
J=E[0][1]
T=E[0][0].strip('*')
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%T)
E=cu.fetchall()
conn.commit()
cu.close
self.text.insert(END,"搜索机种为共用机种")
self.text.insert(END,"主机种:%s"%J)
P=[]
for item in range(len(E)):
P.append(E[item][1])
self.text.insert(END,"共用:%s"%P)
self.text.see(END)
self.text.update()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student where Name=\"%s\"'%J)
Q=cu.fetchall()
conn.commit()
except(IndexError):
try:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where name=\"%s\"'%S)
E=cu.fetchall()
conn.commit()
cu.close
if E!=[]:
if '*' not in E[0][0]:
T=E[0][0]
i='*'+str(E[0][0])
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%i)
E=cu.fetchall()
conn.commit()
cu.close
J=E[0][1]
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%T)
E=cu.fetchall()
conn.commit()
cu.close
self.text.insert(END,"搜索机种为共用机种")
self.text.insert(END,"主机种:%s"%J)
P=[]
for item in range(len(E)):
P.append(E[item][1])
self.text.insert(END,"共用:%s"%P)
self.text.see(END)
self.text.update()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student where Name=\"%s\"'%J)
Q=cu.fetchall()
conn.commit()
except(IndexError):
self.text.insert(END,"没有相关记录")
self.text.see(END)
return
U=0
try:
T=range(len(Q))[-1]+1
while True:
if U < T:
W=Q[U]
try:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from CW where name=\"%s\"'%W[0])
F=cu.fetchall()
conn.commit()
cu.close
self.text.insert(END,'储位:'+W[0]+' '+' '+' '+' '+' '+'机种:'+W[1]+' '+' '+' '+' '+' '+'数量:'+F[0][1])
self.text.see(END)
self.text.update()
U=U+1
except(IndexError):
self.text.insert(END,'储位:'+W[0]+' '+' '+' '+' '+' '+'机种:'+W[1])
self.text.see(END)
self.text.update()
U=U+1
elif U >= T:
self.text.insert(END,"搜索完成")
self.text.see(END)
self.text.update()
break
except(IndexError):
self.text.insert(END,"没有相关记录")
self.text.see(END)
self.text.update()
elif self.Duqv == True:
#单个搜索
S=self.entry3.get()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student where Name=\"%s\"'%S)
Q=cu.fetchall()
conn.commit()
try:
J=Q[0][1]
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where name=\"%s\"'%J)
E=cu.fetchall()
conn.commit()
cu.close
if E!=[]:
if '*' in E[0][0]:
J=E[0][1]
T=E[0][0].strip('*')
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%T)
E=cu.fetchall()
conn.commit()
cu.close
self.text.insert(END,"搜索机种为共用机种")
self.text.insert(END,"主机种:%s"%J)
P=[]
for item in range(len(E)):
P.append(E[item][1])
self.text.insert(END,"共用:%s"%P)
self.text.see(END)
self.text.update()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student where Name=\"%s\"'%J)
Q=cu.fetchall()
conn.commit()
except(IndexError):
try:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where name=\"%s\"'%S)
E=cu.fetchall()
conn.commit()
cu.close
if E!=[]:
if '*' not in E[0][0]:
T=E[0][0]
i='*'+str(E[0][0])
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%i)
E=cu.fetchall()
conn.commit()
cu.close
J=E[0][1]
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%T)
E=cu.fetchall()
conn.commit()
cu.close
self.text.insert(END,"搜索机种为共用机种")
self.text.insert(END,"主机种:%s"%J)
P=[]
for item in range(len(E)):
P.append(E[item][1])
self.text.insert(END,"共用:%s"%P)
self.text.see(END)
self.text.update()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student where Name=\"%s\"'%J)
Q=cu.fetchall()
conn.commit()
except(IndexError):
tkinter.messagebox.showerror("涛:",sys.exc_info())
self.text.insert(END,"没有相关记录")
self.text.see(END)
return
try:
W=Q[0]
try:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from CW where name=\"%s\"'%W[0])
F=cu.fetchall()
conn.commit()
cu.close
self.text.insert(END,'储位:'+W[0]+' '+' '+' '+' '+' '+'机种:'+W[1]+' '+' '+' '+' '+' '+'数量:'+F[0][1])
self.text.see(END)
self.text.update()
except(IndexError):
self.text.insert(END,'储位:'+W[0]+' '+' '+' '+' '+' '+'机种:'+W[1])
self.text.see(END)
self.text.update()
except(IndexError):
self.text.insert(END,"没有相关记录")
self.text.see(END)
else:
self.text.insert(END,"搜索完成")
self.text.see(END)
self.text.update()
except(AttributeError):
self.W_JL('出库-搜索-错误,没有选择读取方式')
tkinter.messagebox.showerror("涛:","请选择读取方式,'单个读取'或者'全部读取'")
elif self.M_ss==1:
S=self.entry3.get()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from JZ where id like \"%s\"'%('%'+S+'%'))
Q=cu.fetchall()
conn.commit()
try:
for i in range(len(Q)):
if i==0:
T='机种名:'+str(Q[0][0])
else:
T=str(T)+','+'机种名:'+str(Q[i][0])
tkinter.messagebox.showinfo("涛:","以下是已经授权和你输入匹配的机种名称(⊙o⊙)"+'\n'+str(T))
tkinter.messagebox.showinfo("涛:","需要搜索库存明细,请根据刚刚显示的机种名称输入查询,注意:请取消勾选模糊搜索机种名")
except(UnboundLocalError):
tkinter.messagebox.showinfo("涛:","没有查询到,数据库无记录")
def qrck(self,jizhong,chuwei):
C=chuwei
J=jizhong
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where name=\"%s\"'%J)
E=cu.fetchall()
conn.commit()
cu.close
if C=='':
self.W_JL('出库-错误,没有输入储位')
tkinter.messagebox.showerror("涛:","请输入出库机种的储位啊!!")
return
if J=='':
self.W_JL('出库-错误,没有输入机种')
tkinter.messagebox.showerror("涛:","请输入出库机种!!")
return
if E!=[]:
if '*' not in E[0][0]:
T=E[0][0]
i='*'+str(E[0][0])
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%i)
E=cu.fetchall()
conn.commit()
cu.close
try:
J=E[0][1]
except(IndexError):
self.W_JL("入库-错误-输入机种:"+J+"未建立主机种")
tkinter.messagebox.showerror("涛:","提示:请为输入机种:"+J+"建立主机种")
return
J=E[0][1]
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%T)
E=cu.fetchall()
conn.commit()
cu.close
#self.text.insert(END,"你输入的机种为共用机种")
#self.text.insert(END,"主机种:%s"%J)
P=[]
for item in range(len(E)):
P.append(E[item][1])
#self.text.insert(END,"共用:%s"%P)
self.text.see(END)
self.text.update()
else:
J=E[0][1]
T=E[0][0].strip('*')
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ where id=\"%s\"'%T)
E=cu.fetchall()
conn.commit()
cu.close
#self.text.insert(END,"你输入的机种为共用机种")
#self.text.insert(END,"主机种:%s"%J)
P=[]
for item in range(len(E)):
P.append(E[item][1])
#self.text.insert(END,"共用:%s"%P)
self.text.see(END)
self.text.update()
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
X=str(C)
cu.execute('select Name from Student where id=\"%s\"'%(X))
Q=cu.fetchall()
conn.commit()
try:
if J == Q[0][0]:
if os.path.exists(str(self.path_L)+'/'+"Funtion.db"):
if C == '':
self.W_JL('出库-错误,没有输入储位')
tkinter.messagebox.showerror("涛:","请输入出库机种的储位啊!!")
else:
F=self.entry5.get()
try:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cursor=conn.cursor()
cursor.execute('select * from CW where name=\"%s\"'%C)
E=cursor.fetchall()
conn.commit()
cursor.close
if E[0][0]==C and F == '':
self.W_JL('出库-错误-这个地方是箱子,没有输入数量',Cw=C,Jz=J)
tkinter.messagebox.showerror("涛:","这个地方是箱子,请输入出库数量")
return
elif int(F) <=0 or int(F) > 3:
self.W_JL('出库-错误-箱子数量输入不合理,输入数量为:'+F,Cw=C,Jz=J)
tkinter.messagebox.showerror("涛:","输入机种数量不合理,任务中断,不记录数据")
return
elif int(E[0][1]) < int(F):
self.W_JL('出库-错误-箱子数量('+E[0][1]+')小于输入数量('+F+')',Cw=C,Jz=J)
tkinter.messagebox.showerror("涛:","这个地方没有这么多机种,任务中断,不记录数据")
return
elif int(E[0][1]) == int(F):
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('DELETE FROM Student WHERE id=\"%s\"'%C)
conn.commit()
cu.close
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cursor=conn.cursor()
cursor.execute('DELETE FROM CW where name=\"%s\"'%C)
conn.commit()
cursor.close
self.W_JL('出库成功-箱子清空',Cw=C,Jz=J)
self.text.insert(END,"储位:%s,机种:%s,出库成功"%(C,J))
self.text.see(END)
self.text.update()
return
elif int(E[0][1]) > int(F):
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion_CZ.db")
cursor=conn.cursor()
cursor.execute('DELETE FROM CW where name=\"%s\"'%C)
conn.commit()
G=int(E[0][1])-int(F)
r='INSERT INTO CW (name,number) VALUES (\"%s\",\"%s\")'%(E[0][0],G)
cursor.execute(r)
conn.commit()
cursor.close
self.W_JL('出库成功-出库数量('+F+')'+',剩余数量为:'+str(G),Cw=C,Jz=J)
self.text.insert(END,"储位:%s,机种:%s,出库成功,剩余数量为:%s"%(C,J,G))
self.text.see(END)
self.text.update()
return
except:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('DELETE FROM Student WHERE id=\"%s\"'%C)
conn.commit()
cu.close
self.W_JL('出库',C,J)
self.text.insert(END,"储位:%s,机种:%s,出库成功"%(C,J))
self.text.see(END)
self.text.update()
else:
self.W_JL('出库-没有连接到数据库')
tkinter.messagebox.showerror("涛:","暂时没有连接到数据库,请先入库机种")
else:
self.W_JL('出库-错误,储位所记录机种(%s)和现在出库机种(%s)不一致'%(Q[0][0],J),Jz=J,Cw=C)
tkinter.messagebox.showerror("涛:","现在登记中的储位("+C+")上的实际机种和你输入机种("+J+")的不一样哦,请确认在出库!!")
except(IndexError):
tkinter.messagebox.showerror("涛:",sys.exc_info())
self.W_JL('出库-错误,储位上没有机种',Jz=J,Cw=C)
tkinter.messagebox.showerror("涛:","储位:"+C+"上没有机种,麻烦先搜索看清楚!!谢谢Thanks♪")
def nulcw(self):
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from CW')
conn.commit()
Q=cu.fetchall()
cu.close
A=[]
B=[]
L=10
if Q == []:
self.W_JL('读取空置储位,没有空储位信息')
self.text1.insert(END,'储位数据库为空')
self.text1.see(END)
self.text1.update()
else:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
cu.execute('select * from Student')
conn.commit()
E=cu.fetchall()
cu.close
for i in range(len(Q)):
A.append(Q[i][0])
for i in range(len(E)):
B.append(E[i][0])
for imte in A:
if imte not in B:
L=1010
self.text1.insert(END,"空置储位")
self.text1.insert(END,imte)
self.text1.see(END)
self.text1.update()
self.W_JL('读取空置储位')
if L != 1010:
self.W_JL('读取空置储位,储位满了')
self.text1.insert(END,"储位都满了")
self.text1.see(END)
self.text1.update()
def W_JL(self,Cl,Cw='空',Jz='空',User='未登录'):
self.sql()
CS=Cl
Time1=strftime('%y-%m-%d')
Time2=strftime('%H:%M:%S')
conn = sqlite3.connect(str(self.path_L)+'/'+"Debug.db")
cu=conn.cursor()
if self.USER != '':
User=self.USER
R='INSERT INTO JL (date,time,class,CW,JZ,NAME) VALUES (\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\")'%(Time1,Time2,CS,Cw,Jz,User)
cu.execute(R)
conn.commit()
cu.close
if os.path.exists("记录.csv"):
f = open(r'记录.csv','a',encoding='GBK',newline='' "")
wt=csv.writer(f)
wt.writerow([''])
wt.writerow(['日期','时间','操作类型','储位','机种','操作者'])
wt.writerow([Time1,Time2,CS,[Cw],[Jz],User])
else:
f = open(r'记录.csv','a',encoding='GBK',newline='' "")
wt=csv.writer(f)
wt.writerow(['日期','时间','操作类型','储位','机种','操作者'])
wt.writerow([Time1,Time2,CS,[Cw],[Jz],User])
def Dqcw(self):
self.sql()
try:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
C=self.entry5.get()
cu.execute('select Name from Student where id=\"%s\"'%C)
Q=cu.fetchall()
conn.commit()
self.W_JL('读取%s储位上的机种(%s)'%(C,Q[0][0]))
self.text1.insert(END,'%s储位上的机种是:'%C+Q[0][0])
self.text1.see(END)
self.text1.update()
except(IndexError):
try:
conn = sqlite3.connect(str(self.path_L)+'/'+"Funtion.db")
cu=conn.cursor()
C=self.entry5.get()
cu.execute('select * from CW where id=\"%s\"'%C)
Q=cu.fetchall()
if C == Q[0][0]:
self.W_JL('读取-储位:%s上没有机种,为空置状态'%C)
self.text1.insert(END,'储位:%s上没有机种,为空置状态'%C)
self.text1.see(END)
self.text1.update()
except(IndexError):
self.W_JL('读取-错误-储位:%s,没有授权或者输入错误'%C)
self.text1.insert(END,'储位:%s,没有授权或者输入错误'%C)
self.text1.see(END)
self.text1.update()
def Path(self):
self.root1 = Tk()
self.root1.title("涛涛正在选取文件,别打扰")
self.root1.withdraw()
self.path = filedialog.askopenfilename()
return self.path
def zc(self):
if self.password_MM:
pass
else:
self.E()
self.sql()
conn = sqlite3.connect(str(self.path_L)+'/'+'User.db')
cursor = conn.cursor()
N=self.entry11.get()
P=self.entry12.get()
try:
r='INSERT INTO user (name,passwork) VALUES (\"%s\",\"%s\")'%(N,P)
cursor.execute(r)
conn.commit()
cursor.close
tkinter.messagebox.showinfo("涛:","注册成功")
self.__init__()
except:
tkinter.messagebox.showerror("涛:","注册失败,可能用户已经存在")
def login(self):
self.sql()
conn = sqlite3.connect(str(self.path_L)+'/'+'User.db')
cur=conn.cursor()
cur.execute('select * from user')
E=cur.fetchall()
cur.close
W=0
try:
Q=range(len(E))[-1]+1
for i in range(Q):
if E[i][0] == self.entry13.get():
if E[i][1] == self.entry14.get():
tkinter.messagebox.showinfo("涛:","登录成功,欢迎用户:"+E[i][0])
self.USER=E[i][0]
self.__init__()
else:
tkinter.messagebox.showerror("涛:","密码错误")
else:
W=W+1
if W>=Q:
tkinter.messagebox.showerror("涛:","账号不存在")
except(IndexError):
tkinter.messagebox.showerror("涛:","账号不存在")
def zx(self):
self.USER = ''
self.__init__()
main=Main()
上面是软件的主体功能
还附带一个console管理工具
如果上面的那个你不改代码,请使用下面的这个工具先确认管理密码,然后手动确认数据库生成的地址,以保证上面程序的正常运行
console管理工具包涵删除用户,查看密码,强行修改密码和删除3个月之前的软件记录
console.py
from tkinter import *
import sqlite3
import os
import os.path
import sys
import csv
import time
def help():
if os.path.exists("password.db"):
conn = sqlite3.connect('password.db')
cursor = conn.cursor()
cur=conn.cursor()
cur.execute('select * from password')
E=cur.fetchall()
Q=input('请输入高级密码:')
if E[0][0] == Q:
print("涛:","密码验证成功")
time.sleep(1)
for i in range(500):
print('\n')
else:
print("涛:","密码错误,此密码与FuntionBox管理系统密码一致,程序即将关闭")
time.sleep(5)
os._exit(0)
else:
Q=input('请输入高级密码:')
conn = sqlite3.connect('password.db')
cursor = conn.cursor()
sql = 'CREATE TABLE password(id TEXT PRIMARY KEY UNIQUE NOT NULL)'
cursor.execute(sql)
conn.commit()
r='INSERT INTO password (id) VALUES (\"%s\")'%(Q)
cursor.execute(r)
conn.commit()
cursor.close
print("涛:","密码不存在,已经保存密码")
time.sleep(1)
for i in range(500):
print('\n')
while True:
time.sleep(3)
for i in range(5):
print('\n')
print('指令1:Dq_CZ_JZ,读取共用机种详细信息')
print('指令2:Dq_CZ_CW,读取箱子数量信息')
print('指令3:User_update,强行修改用户密码')
print('指令4:User_del,删除指定用户')
print('指令5:Del_JL,删除3个月前的软件记录详细')
print('指令6:path_r,修改数据库路径')
W=input("请输入指令:")
if W=='1' or W=='Dq_CZ_JZ':
Dq_CZ_JZ()
elif W=='2' or W=='Dq_CZ_CW':
Dq_CZ_CW()
elif W=='3' or W=='User_update':
User_update()
elif W=='4' or W=='User_del':
User_del()
elif W=='5' or W=='Del_JL':
Del_JL()
elif W=='6' or W=='path_r':
path_r()
else:
print('请输入数字或者指令')
def Dq_CZ_JZ():
try:
conn = sqlite3.connect("Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from JZ')
E=cu.fetchall()
conn.commit()
cu.close
for i in range(len(E)):
print(E[i][0],E[i][1])
except:
print(sys.exc_info())
def Dq_CZ_CW():
try:
conn = sqlite3.connect("Funtion_CZ.db")
cu=conn.cursor()
cu.execute('select * from CW')
E=cu.fetchall()
conn.commit()
cu.close
for i in range(len(E)):
print(E[i][0],E[i][1])
except:
print(sys.exc_info())
def User_update():
try:
conn = sqlite3.connect("User.db")
cursor=conn.cursor()
r='select * from user'
cursor.execute(r)
E=cursor.fetchall()
for i in range(len(E)):
print('序号:'+str(i)+',用户名:'+str(E[i][0]),'密码:'+str(E[i][1]))
N=input('请输入用户名序号:')
P=input('请输入新密码:')
O=E[int(N)][0]
r='delete from user where name=\"%s\"'%O
cursor.execute(r)
conn.commit()
r='insert into user (name,passwork) values(\"%s\",\"%s\")'%(O,P)
cursor.execute(r)
conn.commit()
cursor.close
print('执行成功')
except:
print(sys.exc_info())
def User_del():
try:
conn = sqlite3.connect("User.db")
cursor=conn.cursor()
r='select * from user'
cursor.execute(r)
E=cursor.fetchall()
for i in range(len(E)):
print('序号:'+str(i)+',用户名:'+str(E[i][0]))
N=input('请输入用户名序号:')
O=E[int(N)][0]
r='delete from user where name=\"%s\"'%O
cursor.execute(r)
conn.commit()
print('已经删除用户%s'%O)
cursor.close
except:
print(sys.exc_info())
def Del_JL():
try:
conn = sqlite3.connect("Debug.db")
cursor=conn.cursor()
r='select * from JL'
cursor.execute(r)
E=cursor.fetchall()
conn.commit()
cursor.close
for i in range(len(E)):
S1=time.strptime(E[i][0],'%y-%m-%d')
s2=time.strftime('%y-%m-%d')
S2=time.strptime(s2,'%y-%m-%d')
if S1[0]==S2[0]:
S3=S2[1]-S1[1]
if S3 >= 3:
conn = sqlite3.connect("Debug.db")
cursor=conn.cursor()
r='delete from JL where date=\"%s\" and time=\"%s\"'%(E[i][0],E[i][1])
cursor.execute(r)
conn.commit()
cursor.close
print("删除数据:"+str(E[i]))
time.sleep(1)
elif S1[0]<S2[0]:
S3=12-S1[1]+S2[1]
if S3 >= 3:
conn = sqlite3.connect("Debug.db")
cursor=conn.cursor()
r='delete from JL where date=\"%s\" and time=\"%s\"'%(E[i][0],E[i][1])
cursor.execute(r)
conn.commit()
cursor.close
print("删除数据:"+str(E[i]))
time.sleep(1)
except:
print(sys.exc_info())
def path_r():
if os.path.exists("path.db"):
conn = sqlite3.connect("path.db")
cu=conn.cursor()
cu.execute('delete from Path')
conn.commit()
N=input('请输入新路径:')
r='insert into Path (path) values(\"%s\")'%(N)
cu.execute(r)
conn.commit()
cu.close
print('命令执行完成')
else:
conn = sqlite3.connect("path.db")
cu=conn.cursor()
N=input('请输入新路径:')
sql = 'CREATE TABLE Path(path TEXT)'
cu.execute(sql)
r='insert into Path (path) values(\"%s\")'%(N)
cu.execute(r)
conn.commit()
cu.close
print('命令执行完成')
help()
更多推荐
已为社区贡献1条内容
所有评论(0)