(參考的是這篇文章(5條消息) 數(shù)據(jù)庫(kù)課程設(shè)計(jì)—超市零售信息管理系統(tǒng)(Python實(shí)現(xiàn))_小桃在改bug的博客-CSDN博客_超市管理系統(tǒng)數(shù)據(jù)庫(kù)設(shè)計(jì)但是這篇文章里沒(méi)有完整的代碼,所以我自己補(bǔ)全了ui界面和相關(guān)的代碼,并進(jìn)行了二創(chuàng),框架也有改動(dòng),更主要的是寫(xiě)出來(lái)自己在編寫(xiě)過(guò)程中的一些錯(cuò)誤,希望可以幫助排雷)
先放幾張效果圖
登錄界面:
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-778632.html
主界面:
?文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-778632.html
添加信息界面:
?
?
添加員工信息界面:
?
輸入一個(gè)示例數(shù)據(jù)并添加:
?
首先進(jìn)行需求分析,想要做的是一個(gè)商城的信息管理系統(tǒng)(是一個(gè)類(lèi)似大型的超市),可以幫助管理進(jìn)貨、銷(xiāo)售、人員、庫(kù)存信息,那么就要有進(jìn)貨,售貨,員工,倉(cāng)庫(kù),安全問(wèn)題等方面的考慮,根據(jù)上述分析出下面的框架(由于空間有限,這是部分的框架圖)
?
?
根據(jù)上面的分析繪制ER圖,由于每次繪制時(shí)圖形數(shù)量的限制,E-R圖分三部分,通過(guò)帶顏色的連接兩個(gè)ER圖
?根據(jù)上面的ER圖進(jìn)行邏輯結(jié)構(gòu)設(shè)計(jì)消除依賴(lài):
?
?
?
1.員工(員工編號(hào),員工姓名,員工性別,員工年齡,員工工齡,員工電話(huà),身份證號(hào),工資,核酸情況);
2.商品(商品編號(hào),商品名稱(chēng),商品類(lèi)別,商品單價(jià),商品成本,供貨商);
3.會(huì)員(會(huì)員卡卡號(hào),會(huì)員姓名,電話(huà),注冊(cè)日期,累計(jì)金額,余額);
4.供貨商(供貨商編號(hào),供貨商名稱(chēng),供貨商電話(huà),供貨商地址);
5.倉(cāng)庫(kù)(倉(cāng)庫(kù)編號(hào),倉(cāng)庫(kù)管理員編號(hào),倉(cāng)庫(kù)名稱(chēng),倉(cāng)庫(kù)地址);
6.退貨信息(交易流水號(hào),商品編號(hào),退貨數(shù)量,退款金額,退貨日期);
7.銷(xiāo)售(員工編號(hào),商品編號(hào),銷(xiāo)售日期,銷(xiāo)售數(shù)量,銷(xiāo)售金額);
8.購(gòu)買(mǎi)(會(huì)員卡卡號(hào),商品編號(hào),購(gòu)買(mǎi)日期,購(gòu)買(mǎi)數(shù)量);
9.供貨(供貨商編號(hào),商品編號(hào),供貨日期,供貨數(shù)量);
10.庫(kù)存(倉(cāng)庫(kù)編號(hào),商品編號(hào),庫(kù)存量);
11.安全問(wèn)題(健康碼,滅火器,自動(dòng)滅火噴淋裝置,檢察人員編號(hào));
形成如下表:
員工表Staff
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Snum |
員工編號(hào) |
varchar |
主鍵 |
Sname |
員工姓名 |
varchar |
? |
Ssex |
員工性別 |
varchar |
‘男’或‘女’ |
Sage |
員工年齡 |
int |
>=18 |
Sseniority |
員工工齡 |
int |
>=0 |
Sphone |
員工電話(huà) |
varchar |
? |
Sid |
身份證號(hào) |
varchar |
? |
Ssalary |
工資 |
int |
>=0 |
Syard |
健康碼 |
varchar |
‘紅碼’‘綠碼’‘黃碼’ |
?
商品表Goods
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Gnum |
商品編號(hào) |
varchar |
主鍵 |
Gname |
商品名稱(chēng) |
varchar |
? |
Gtype |
商品類(lèi)別 |
varchar |
? |
Gprice |
商品售價(jià) |
int |
>=0 |
Gbid |
商品進(jìn)價(jià) |
int |
>=0 |
Gstock |
庫(kù)存量 |
int |
>=0 |
Galarm |
告警量 |
int |
>=0 |
Gplan |
計(jì)劃庫(kù)存量 |
int |
>=0 |
Vnum |
供貨商編號(hào) |
varchar |
是表Vecdor的外鍵 |
?
會(huì)員表Member
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Mnum |
會(huì)員卡號(hào) |
varchar |
主鍵 |
Mname |
會(huì)員姓名 |
varchar |
? |
Mphone |
會(huì)員電話(huà) |
varchar |
? |
Mdate |
注冊(cè)日期 |
datetime |
? |
Mtotal |
累計(jì)金額 |
int |
>=0 |
Mbalance |
卡內(nèi)余額 |
int |
>=0 |
Mpassword |
會(huì)員密碼 |
varchar |
? |
?
供貨商Vendor
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Vnum |
供貨商編號(hào) |
varchar |
主鍵 |
Vname |
供貨商名稱(chēng) |
varchar |
? |
Vphone |
供貨商電話(huà) |
varchar |
? |
Vplace |
供貨商地址 |
varchar |
? |
倉(cāng)庫(kù)Ware
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Wnum |
倉(cāng)庫(kù)編號(hào) |
varchar |
主鍵 |
Wname |
倉(cāng)庫(kù)名稱(chēng) |
varchar |
? |
Wplace |
倉(cāng)庫(kù)地址 |
varchar |
? |
Snum |
倉(cāng)庫(kù)管理員編號(hào) |
varchar |
是表Staff的外鍵 |
?
退貨信息Infer
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Tnum |
交易流水號(hào) |
varchar |
是表Trade的外鍵 |
Gnum |
商品編號(hào) |
varchar |
是表Goods的外鍵 |
Iamount |
退貨數(shù)量 |
int |
>=0 |
Imoney |
退款金額 |
int |
>=0 |
Idate |
退貨日期 |
datetime |
? |
?
商品交易表Trade
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Tnum |
交易流水號(hào) |
varchar |
主鍵 |
Tdate |
交易日期 |
datetime |
? |
Snum |
員工編號(hào) |
varchar |
是表Staff的外鍵 |
Gnum |
商品編號(hào) |
varchar |
是表Goods的外鍵 |
Tamount |
交易數(shù)量 |
int |
>=0 |
Tmoney |
交易金額 |
int |
>=0 |
Mnum |
會(huì)員卡號(hào) |
varchar |
是表Member的外鍵 |
?
入庫(kù)信息表Entry
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Enum |
入庫(kù)單編號(hào) |
varchar |
主鍵 |
Gnum |
商品編號(hào) |
varchar |
是表Goods的外鍵 |
Eamount |
入庫(kù)量 |
int |
>=0 |
Emoney |
總金額 |
int |
>=0 |
Vnum |
供貨商編號(hào) |
varchar |
是表Ventor的外鍵 |
Edate |
入庫(kù)日期 |
datetime |
? |
Snum |
入庫(kù)員編號(hào) |
varchar |
是表Staff的外鍵 |
?
出庫(kù)信息表Exits
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Xnum |
出庫(kù)單編號(hào) |
varchar |
主鍵 |
Gnum |
商品編號(hào) |
varchar |
是表Goods的外鍵 |
Xamount |
出庫(kù)量 |
int |
>=0 |
Xmoney |
總金額 |
int |
>=0 |
Xdate |
出庫(kù)日期 |
datetime |
? |
Snum |
出庫(kù)員編號(hào) |
varchar |
是表Staff的外鍵 |
?
安全問(wèn)題Check1
屬性名 |
含義 |
類(lèi)型 |
說(shuō)明 |
Cdate |
檢查日期 |
date |
主鍵 |
Cyard |
顧客健康碼 |
varchar |
‘紅碼’‘綠碼’‘黃碼’ |
Cfire |
滅火器 |
varchar |
‘是’‘否’ |
Cspary |
自動(dòng)滅火噴灑裝置 |
varchar |
‘是’‘否’ |
下面附上我使用的版本python3.6+mysql8.0
1.需要手動(dòng)在mysql 里創(chuàng)建一個(gè)數(shù)據(jù)庫(kù) sqlwork(什么名稱(chēng)都可以)
2.執(zhí)行init.py進(jìn)行初始化操作,也就是建表,插入初始數(shù)據(jù),建立觸發(fā)器,增加級(jí)聯(lián)約束(之所以是這個(gè)順序,是因?yàn)槿绻ū淼臅r(shí)候就加入級(jí)聯(lián)約束,外鍵約束就會(huì)導(dǎo)致插入數(shù)據(jù)失?。┫旅媸莍nit.py的代碼
import pymysql
#數(shù)據(jù)庫(kù)初始化
#創(chuàng)建表
connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立連接
if connect:
print("連接成功!")
cursor = connect.cursor() # 創(chuàng)建一個(gè)游標(biāo)對(duì)象,python里的sql語(yǔ)句都要通過(guò)cursor來(lái)執(zhí)行
#創(chuàng)建表及其約束
cursor.execute("create table Staff(Snum varchar(10) primary key,Sname varchar(20) not null,Ssex varchar(5) check(Ssex in('男','女')),Sage int not null check(Sage>=18),Sseniority int not null check(Sseniority>=0),Sphone varchar(20) not null,Sid varchar(25) not null,Ssalary int check(Ssalary>=0),Syard varchar(20) check(Syard in('紅碼','黃碼','綠碼')) )")
cursor.execute("create table Vendor(Vnum varchar(10) primary key,Vname varchar(10) not null,Vphone varchar(20) not null,Vpalce varchar(10) not null)")
# on delete cascade
cursor.execute("create table Goods(Gnum varchar(10) primary key,Gname varchar(10) not null,Gtype varchar(10) not null,Gprice int check(Gprice>=0),Gbid int check(Gbid>=0),Gstock int check(Gstock>=0),Galarm int check(Galarm>=0), Gplan int check(Gplan>=0),Vnum varchar(10) not null)")
cursor.execute("create table Member(Mnum varchar(10) primary key,Mname varchar(10) not null,Mphone varchar(20) not null,Mdate datetime,Mtotal int check(Mtotal>=0),Mbalance int check(Mbalance>=0),Mpassword varchar(25) not null)")
# on delete set null
cursor.execute("create table Ware(Wnum varchar(10) primary key,Wname varchar(10) not null,Wplace varchar(10) not null,Snum varchar(10) not null)")
cursor.execute("create table Trade(Tnum varchar(10) primary key,Tdate datetime not null,Snum varchar(10) not null,Gnum varchar(10) not null,Tamount int check(Tamount>=0),Tmoney int check(Tmoney>=0),Mnum varchar(10) not null)")
cursor.execute("create table Infer(Tnum varchar(10) not null,Gnum varchar(10) not null,Iamount int check(Iamount>=0),Imoney int check(Imoney>=0),Idate datetime not null)")
# on delete cascade
cursor.execute("create table Entry(Enum varchar(10) primary key,Gnum varchar(10) not null,Eamount int check(Eamount>=0),Emoney int check(Emoney>=0),Vnum varchar(10) not null,Edate datetime not null,Snum varchar(10) not null)")
cursor.execute("create table Exits(Xnum varchar(10) primary key,Gnum varchar(10) not null,Xamount int check(Xamount>=0),Xmoney int check(Xmoney>=0),Xdate datetime not null,Snum varchar(10) not null)")
cursor.execute("create table Check1(Cdate date primary key,Cyard varchar(10) check(Cyard in('紅碼','黃碼','綠碼')),Cfire varchar(10) check(Cfire in('是','否')),Cspary varchar(10) check(Cspary in('是','否')))")
connect.commit() #提交
cursor.close() # 關(guān)閉游標(biāo)
connect.close()
#初始化數(shù)據(jù)(兩條數(shù)據(jù)或一條數(shù)據(jù),為了后續(xù)增加約束)
connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor() # 創(chuàng)建一個(gè)游標(biāo)對(duì)象,python里的sql語(yǔ)句都要通過(guò)cursor來(lái)執(zhí)行
cursor.execute("insert into Goods values ('200001','薯片','零食',8,5,500,100,600,'100002')")
cursor.execute("insert into Goods values ('200002','可樂(lè)','飲料',3,2,1000,100,1200,'100001')")
cursor.execute("insert into Vendor values ('100001','可口','123456','杭州')")
cursor.execute("insert into Vendor values ('100002','樂(lè)事','135790','西安')")
cursor.execute("insert into Vendor values ('100003','牧場(chǎng)','246800','武漢')")
cursor.execute("insert into Staff values ('0001','張三','男',30,5,'139820117','411481320301',5000,'綠碼')")
cursor.execute("insert into Staff values ('0002','熊大','女',32,3,'178883132','411481310302',3000,'綠碼')")
cursor.execute("insert into Member values ('300001','迪迦','179320118',20220830194422,1050,300,'321336')")
cursor.execute("insert into Ware values('400001','一號(hào)','上海','0001')")
cursor.execute("insert into Check1 values(20220620,'綠碼','是','是')")
connect.commit() # 提交
cursor.close()
connect.close()
#創(chuàng)建觸發(fā)器 滿(mǎn)足顧客買(mǎi)商品的一個(gè)場(chǎng)景
connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
#購(gòu)買(mǎi)的商品數(shù)量要在庫(kù)存里減去
cursor.execute("create trigger update_Goods before insert on Trade for each row update Goods set Gstock=Gstock-new.Tamount where Gnum=new.Gnum;")
#要在會(huì)員卡的總消費(fèi)和余額里改變相應(yīng)的數(shù)值
cursor.execute("create trigger update_Member before insert on Trade for each row update Member set Mtotal=Mtotal+new.Tmoney,Mbalance=Mbalance-new.Tmoney where Mnum=new.Mnum;")
connect.commit()
cursor.close()
connect.close()
connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
cursor.execute("alter table Goods add foreign key(Vnum) references Vendor(Vnum) on delete cascade")
cursor.execute("alter table Ware add foreign key(Snum) references Staff(Snum)")
cursor.execute("alter table Trade add foreign key(Snum) references Staff(Snum)")
cursor.execute("alter table Trade add foreign key(Gnum) references Goods(Gnum)")
cursor.execute("alter table Trade add foreign key(Mnum) references Member(Mnum)")
cursor.execute("alter table Infer add foreign key(Tnum) references Trade(Tnum)")
cursor.execute("alter table Infer add foreign key(Gnum) references Goods(Gnum)")
cursor.execute("alter table Entry add foreign key(Snum) references Staff(Snum)")
cursor.execute("alter table Entry add foreign key(Gnum) references Goods(Gnum)")
cursor.execute("alter table Entry add foreign key(Vnum) references Vendor(Vnum)")
cursor.execute("alter table Exits add foreign key(Snum) references Staff(Snum)")
cursor.execute("alter table Exits add foreign key(Gnum) references Goods(Gnum)")
connect.commit()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
3.接下來(lái)是主體部分(ui界面,sql查詢(xún))main.py代碼如下(代碼有1700行左右)
使用的是pymysql庫(kù)實(shí)現(xiàn)數(shù)據(jù)庫(kù)的連接以及相關(guān)sql語(yǔ)句執(zhí)行操作
Tkinter庫(kù)是用來(lái)實(shí)現(xiàn)ui界面,PIL庫(kù)是用來(lái)放置圖片背景使用
總體框架如下:
- 登錄界面 ?????login()
- 主界面(增刪改查) ???mainpage()
- 選擇界面(對(duì)哪個(gè)表進(jìn)行增刪改查的界面,4個(gè)) ???如all_add()
- 對(duì)某個(gè)表進(jìn)行操作的界面(40個(gè)左右,因?yàn)橛?0個(gè)表,每個(gè)表幾乎都要增刪改查) ???如Staff_add()
- 40個(gè)具體的sql語(yǔ)句執(zhí)行的函數(shù) ???如add_Staff()
import tkinter as tk
import tkinter.messagebox
from tkinter import *
import pymysql
from PIL import Image, ImageTk
#增刪改查之后進(jìn)去每個(gè)都可以對(duì)員工信息 商品信息 安全信息 倉(cāng)庫(kù)信息 供貨信息 退貨信息 會(huì)員信息進(jìn)行操作
################################################################################################################
#數(shù)據(jù)庫(kù)添加操作
def add_Goods():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Goods(Gnum,Gname,Gtype,Gprice,Gbid,Gstock,Galarm,Gplan,Vnum) values(%s,%s,%s,%s,%s,%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql,(g1.get(), g2.get(), g3.get(), g4.get(), g5.get(), g6.get(), g7.get(), g8.get(), g9.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
def add_Staff():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Staff(Snum,Sname,Ssex,Sage,Sseniority,Sphone,Sid,Ssalary,Syard) values(%s,%s,%s,%s,%s,%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql,(s1.get(), s2.get(), s3.get(), s4.get(), s5.get(), s6.get(), s7.get(), s8.get(), s9.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
def add_Check1():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Check(Cdate,Cyard,Cfire,Cspary) values(%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql, (c1.get(), c2.get(), c3.get(), c4.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
def add_Ware():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Ware(Wnum,Wname,Wplace,Snum) values(%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql, (w1.get(), w2.get(), w3.get(), w4.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
def add_Vendor():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Vendor(Vnum,Vname,Vphone,Vplace) values(%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql, (v1.get(), v2.get(), v3.get(), v4.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
def add_Infer():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Infer(Tnum,Gnum,Iamount,Imoney,Idate) values(%s,%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql, (i1.get(), i2.get(), i3.get(), i4.get(), i5.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
def add_Member():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Member(Mnum,Mname,Mphone,Mdate,Mtotal,Mbalance,Mpassword) values(%s,%s,%s,%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql, (m1.get(), m2.get(), m3.get(), m4.get(), m5.get(),m6.get(),m7.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
def add_Trade():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Trade(Tnum,Tdate,Snum,Gnum,Tamount,Tmoney,Mnum) values(%s,%s,%s,%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql, (t1.get(), t2.get(), t3.get(), t4.get(), t5.get(),t6.get(),t7.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
sql = "select Gstock from Goods where Gnum=%s"
cursor.execute(sql, (t4.get()))
result1=cursor.fetchall()
sql = "select Galarm from Goods where Gnum=%s"
cursor.execute(sql, (t4.get()))
result2 = cursor.fetchall()
if(result1<result2):
tkinter.messagebox.showinfo(title='提示', message='該商品較少,需要補(bǔ)貨')
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
def add_Entry():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Entry(Enum,Gnum,Eamount,Emoney,Vnum,Edate,Snum) values(%s,%s,%s,%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql, (e1.get(), e2.get(), e3.get(), e4.get(), e5.get(),e6.get(),e7.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
def add_Exits():
# 連接數(shù)據(jù)庫(kù)
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
# 創(chuàng)建光標(biāo)
cursor = connect.cursor()
# 編寫(xiě)SQL語(yǔ)句
sql = "insert into Exits(Xnum,Gnum,Xamount,Xmoney,Xdate,Snum) values(%s,%s,%s,%s,%s,%s)"
# 執(zhí)行SQL語(yǔ)句,并且輸出完成提示信息,否則回滾
try:
cursor.execute(sql, (x1.get(), x2.get(), x3.get(), x4.get(), x5.get(),x6.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)添加成功")
except:
connect.rollback()
# 關(guān)閉數(shù)據(jù)庫(kù)連接,防止泄露
connect.close()
########################################################################################################################
#數(shù)據(jù)庫(kù)刪除操作
def delete_Goods():
connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立連接
cursor=connect.cursor()
sql = "delete from Goods where Gnum=%s"
try:
cursor.execute(sql,(g10.get()))
connect.commit()
tkinter.messagebox.showinfo("提示","數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
def delete_Staff():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "delete from Staff where Snum=%s"
try:
cursor.execute(sql, (s10.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
def delete_Check1():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "delete from Check where Cdate=%s"
try:
cursor.execute(sql, (c6.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
def delete_Ware():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "delete from Ware where Wnum=%s"
try:
cursor.execute(sql, (w5.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
def delete_Vendor():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "delete from Vendor where Vnum=%s"
try:
cursor.execute(sql, (v5.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
def delete_Infer():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "delete from Infer where Tnum=%s"
try:
cursor.execute(sql, (i6.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
def delete_Member():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "delete from Member where Mnum=%s"
try:
cursor.execute(sql, (m8.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
def delete_Trade():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "delete from Trade where Tnum=%s"
try:
cursor.execute(sql, (t8.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
def delete_Entry():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "delete from Entry where Enum=%s"
try:
cursor.execute(sql, (e8.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
def delete_Exits():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "delete from Exits where Xnum=%s"
try:
cursor.execute(sql, (x7.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)刪除成功")
except:
connect.rollback()
connect.close()
#################################################################################################################################
#數(shù)據(jù)庫(kù)更新操作
def update_Goods():
connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql="update Goods set Gbid=%s,Gprice=%s where Gnum=%s"
try:
cursor.execute(sql,(g11.get(),g12.get(),g13.get()))
connect.commit()
tkinter.messagebox.showinfo("提示","數(shù)據(jù)更新成功!")
except:
connect.rollback()
connect.close()
def update_Staff():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "update Staff set Sphone=%s,Ssalary=%s where Snum=%s"
try:
cursor.execute(sql, (s11.get(), s12.get(), s13.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)更新成功!")
except:
connect.rollback()
connect.close()
def update_Ware():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "update Ware set Wname=%s,Snum=%s where Wnum=%s"
try:
cursor.execute(sql, (w6.get(), w7.get(), w8.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)更新成功!")
except:
connect.rollback()
connect.close()
def update_Vendor():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "update Vendor set Vphone=%s,Vplace=%s where Vnum=%s"
try:
cursor.execute(sql, (v6.get(), v7.get(), v8.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)更新成功!")
except:
connect.rollback()
connect.close()
def update_Infer():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "update Infer set Iamount=%s,Imoney=%s where Tnum=%s"
try:
cursor.execute(sql, (i7.get(), i8.get(), i9.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)更新成功!")
except:
connect.rollback()
connect.close()
def update_Member():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "update Member set Mphone=%s,Mpassword=%s where Mnum=%s"
try:
cursor.execute(sql, (m9.get(), m10.get(), m11.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)更新成功!")
except:
connect.rollback()
connect.close()
def update_Trade():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "update Trade set Tmoney=%s,Tamount=%s where Tnum=%s"
try:
cursor.execute(sql, (t9.get(), t10.get(), t11.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)更新成功!")
except:
connect.rollback()
connect.close()
def update_Entry():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "update Entry set Emoney=%s,Eamount=%s where Enum=%s"
try:
cursor.execute(sql, (e9.get(), e10.get(), e11.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)更新成功!")
except:
connect.rollback()
connect.close()
def update_Exits():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "update Exits set Xmoney=%s,Xamount=%s where Xnum=%s"
try:
cursor.execute(sql, (x8.get(), x9.get(), x10.get()))
connect.commit()
tkinter.messagebox.showinfo("提示", "數(shù)據(jù)更新成功!")
except:
connect.rollback()
connect.close()
################################################################################################################################
#數(shù)據(jù)庫(kù)條件查詢(xún)
def select_Goods():
connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Goods where Gnum=%s"
try:
cursor.execute(sql,(g14.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output',message=results)
except:
return
connect.close()
def select_Staff():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Staff where Snum=%s"
try:
cursor.execute(sql, (s14.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output', message=results)
except:
return
connect.close()
def select_Check1():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Check where Cdate=%s"
try:
cursor.execute(sql, (c7.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output', message=results)
except:
return
connect.close()
def select_Ware():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Ware where Wnum=%s"
try:
cursor.execute(sql, (w9.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output', message=results)
except:
return
connect.close()
def select_Vendor():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Vendor where Vnum=%s"
try:
cursor.execute(sql, (v9.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output', message=results)
except:
return
connect.close()
def select_Infer():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Infer where Tnum=%s"
try:
cursor.execute(sql, (i10.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output', message=results)
except:
return
connect.close()
def select_Member():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Member where Mnum=%s"
try:
cursor.execute(sql, (m12.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output', message=results)
except:
return
connect.close()
def select_Trade():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Trade where Tnum=%s"
try:
cursor.execute(sql, (t12.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output', message=results)
except:
return
connect.close()
def select_Entry():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Entry where Enum=%s"
try:
cursor.execute(sql, (e12.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output', message=results)
except:
return
connect.close()
def select_Exits():
connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立連接
cursor = connect.cursor()
sql = "select * from Exits where Xnum=%s"
try:
cursor.execute(sql, (x11.get()))
results = cursor.fetchall()
tkinter.messagebox.showinfo(title='output', message=results)
except:
return
connect.close()
######################################################################################################
#添加商品界面
def Goods_add():
window_choice.destroy()
#構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global g1,g2,g3,g4,g5,g6,g7,g8,g9
#生成窗口
window_function=tk.Tk()
#窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
#窗口大小
window_function.geometry('400x700')
#生成標(biāo)簽
tk.Label(window_function, text="添加新商品", font=("黑體", 20)).grid(row=0,column=1,pady=10)
tk.Label(window_function, text="請(qǐng)輸入商品編號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function,text="請(qǐng)輸入商品名稱(chēng):").grid(row = 2,column =0,padx=20,pady=20)
tk.Label(window_function,text="請(qǐng)輸入商品類(lèi)別:").grid(row = 3,column =0,padx=20,pady=20)
tk.Label(window_function,text="請(qǐng)輸入商品售價(jià):").grid(row = 4,column =0,padx=20,pady=20)
tk.Label(window_function, text="請(qǐng)輸入商品成本:").grid(row=5, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入庫(kù)存量:").grid(row=6, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入告警量:").grid(row=7, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入計(jì)劃庫(kù)存量:").grid(row=8, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商編號(hào):").grid(row=9, column=0, padx=20, pady=20)
#定義變量記錄輸入信息
g1 = tk.StringVar()
g2 = tk.StringVar()
g3 = tk.StringVar()
g4 = tk.StringVar()
g5 = tk.StringVar()
g6 = tk.StringVar()
g7 = tk.StringVar()
g8 = tk.StringVar()
g9 = tk.StringVar()
#生成輸入框
entry1 = tk.Entry(window_function,show=None,textvariable=g1).grid(row = 1,column =1)
entry2 = tk.Entry(window_function,show=None,textvariable=g2).grid(row = 2,column =1)
entry3 = tk.Entry(window_function,show=None,textvariable=g3).grid(row = 3,column =1)
entry4 = tk.Entry(window_function, show=None, textvariable=g4).grid(row=4, column=1)
entry5 = tk.Entry(window_function, show=None, textvariable=g5).grid(row=5, column=1)
entry6 = tk.Entry(window_function, show=None, textvariable=g6).grid(row=6, column=1)
entry7 = tk.Entry(window_function, show=None, textvariable=g7).grid(row=7, column=1)
entry8 = tk.Entry(window_function, show=None, textvariable=g8).grid(row=8, column=1)
entry9 = tk.Entry(window_function, show=None, textvariable=g9).grid(row=9, column=1)
#生成按鈕
button = tk.Button(window_function, text="添加", command=add_Goods).place(relx=0.3,rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5,rely=0.9)
#顯示窗口
window_function.mainloop()
#添加員工界面
def Staff_add():
window_choice.destroy()
# 構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global s1, s2, s3, s4, s5, s6, s7, s8, s9
# 生成窗口
window_function = tk.Tk()
# 窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
# 窗口大小
window_function.geometry('400x700')
# 生成標(biāo)簽
tk.Label(window_function, text="添加新員工", font=("黑體", 20)).grid(row=0, column=1, pady=10)
tk.Label(window_function, text="請(qǐng)輸入員工編號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工姓名:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工性別:").grid(row=3, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工年齡:").grid(row=4, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工工齡:").grid(row=5, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工電話(huà):").grid(row=6, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入身份證號(hào):").grid(row=7, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工工資:").grid(row=8, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入健康碼情況:").grid(row=9, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
s1 = tk.StringVar()
s2 = tk.StringVar()
s3 = tk.StringVar()
s4 = tk.StringVar()
s5 = tk.StringVar()
s6 = tk.StringVar()
s7 = tk.StringVar()
s8 = tk.StringVar()
s9 = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(window_function, show=None, textvariable=s1).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=s2).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=s3).grid(row=3, column=1)
entry4 = tk.Entry(window_function, show=None, textvariable=s4).grid(row=4, column=1)
entry5 = tk.Entry(window_function, show=None, textvariable=s5).grid(row=5, column=1)
entry6 = tk.Entry(window_function, show=None, textvariable=s6).grid(row=6, column=1)
entry7 = tk.Entry(window_function, show=None, textvariable=s7).grid(row=7, column=1)
entry8 = tk.Entry(window_function, show=None, textvariable=s8).grid(row=8, column=1)
entry9 = tk.Entry(window_function, show=None, textvariable=s9).grid(row=9, column=1)
# 生成按鈕
button = tk.Button(window_function, text="添加", command=add_Staff).place(relx=0.3, rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
# 顯示窗口
window_function.mainloop()
#添加安全問(wèn)題界面
def Check1_add():
window_choice.destroy()
# 構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global c1, c2, c3, c4
# 生成窗口
window_function = tk.Tk()
# 窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
# 窗口大小
window_function.geometry('400x700')
# 生成標(biāo)簽
tk.Label(window_function, text="添加安全問(wèn)題檢查情況", font=("黑體", 20)).grid(row=0, column=0, pady=10)
tk.Label(window_function, text="請(qǐng)輸入檢查日期:").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入顧客健康碼情況:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入滅火器情況:").grid(row=3, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入滅火噴灑裝置情況:").grid(row=4, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
c1 = tk.StringVar()
c2 = tk.StringVar()
c3 = tk.StringVar()
c4 = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(window_function, show=None, textvariable=c1).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=c2).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=c3).grid(row=3, column=1)
entry4 = tk.Entry(window_function, show=None, textvariable=c4).grid(row=4, column=1)
# 生成按鈕
button = tk.Button(window_function, text="添加", command=add_Check1).place(relx=0.3, rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
# 顯示窗口
window_function.mainloop()
#添加倉(cāng)庫(kù)界面
def Ware_add():
window_choice.destroy()
# 構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global w1, w2, w3, w4
# 生成窗口
window_function = tk.Tk()
# 窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
# 窗口大小
window_function.geometry('400x700')
# 生成標(biāo)簽
tk.Label(window_function, text="添加倉(cāng)庫(kù)信息", font=("黑體", 20)).grid(row=0, column=1, pady=10)
tk.Label(window_function, text="請(qǐng)輸入倉(cāng)庫(kù)編號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入倉(cāng)庫(kù)名稱(chēng):").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入倉(cāng)庫(kù)地址:").grid(row=3, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入倉(cāng)庫(kù)管理員編號(hào):").grid(row=4, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
w1 = tk.StringVar()
w2 = tk.StringVar()
w3 = tk.StringVar()
w4 = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(window_function, show=None, textvariable=w1).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=w2).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=w3).grid(row=3, column=1)
entry4 = tk.Entry(window_function, show=None, textvariable=w4).grid(row=4, column=1)
# 生成按鈕
button = tk.Button(window_function, text="添加", command=add_Ware).place(relx=0.3, rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
# 顯示窗口
window_function.mainloop()
#添加供貨商界面
def Vendor_add():
window_choice.destroy()
# 構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global v1, v2, v3, v4
# 生成窗口
window_function = tk.Tk()
# 窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
# 窗口大小
window_function.geometry('400x700')
# 生成標(biāo)簽
tk.Label(window_function, text="添加供貨商信息", font=("黑體", 20)).grid(row=0, column=1, pady=10)
tk.Label(window_function, text="請(qǐng)輸入供貨商編號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商名稱(chēng):").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商電話(huà):").grid(row=3, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商地址:").grid(row=4, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
v1 = tk.StringVar()
v2 = tk.StringVar()
v3 = tk.StringVar()
v4 = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(window_function, show=None, textvariable=v1).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=v2).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=v3).grid(row=3, column=1)
entry4 = tk.Entry(window_function, show=None, textvariable=v4).grid(row=4, column=1)
# 生成按鈕
button = tk.Button(window_function, text="添加", command=add_Vendor).place(relx=0.3, rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
# 顯示窗口
window_function.mainloop()
#添加退貨信息界面
def Infer_add():
window_choice.destroy()
# 構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global i1, i2, i3, i4,i5
# 生成窗口
window_function = tk.Tk()
# 窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
# 窗口大小
window_function.geometry('400x700')
# 生成標(biāo)簽
tk.Label(window_function, text="添加退貨信息", font=("黑體", 20)).grid(row=0, column=1, pady=10)
tk.Label(window_function, text="請(qǐng)輸入交易流水號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入商品編號(hào):").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入退貨數(shù)量:").grid(row=3, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入退款金額:").grid(row=4, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入退貨日期:").grid(row=5, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
i1 = tk.StringVar()
i2 = tk.StringVar()
i3 = tk.StringVar()
i4 = tk.StringVar()
i5 = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(window_function, show=None, textvariable=i1).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=i2).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=i3).grid(row=3, column=1)
entry4 = tk.Entry(window_function, show=None, textvariable=i4).grid(row=4, column=1)
entry5 = tk.Entry(window_function, show=None, textvariable=i5).grid(row=5, column=1)
# 生成按鈕
button = tk.Button(window_function, text="添加", command=add_Infer).place(relx=0.3, rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
# 顯示窗口
window_function.mainloop()
#添加會(huì)員表界面
def Member_add():
window_choice.destroy()
# 構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global m1, m2, m3, m4, m5, m6, m7
# 生成窗口
window_function = tk.Tk()
# 窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
# 窗口大小
window_function.geometry('400x700')
# 生成標(biāo)簽
tk.Label(window_function, text="添加新會(huì)員", font=("黑體", 20)).grid(row=0, column=1, pady=10)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員卡號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員姓名:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員電話(huà):").grid(row=3, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入注冊(cè)日期:").grid(row=4, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入累計(jì)金額:").grid(row=5, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入卡內(nèi)余額:").grid(row=6, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員密碼:").grid(row=7, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
m1 = tk.StringVar()
m2 = tk.StringVar()
m3 = tk.StringVar()
m4 = tk.StringVar()
m5 = tk.StringVar()
m6 = tk.StringVar()
m7 = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(window_function, show=None, textvariable=m1).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=m2).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=m3).grid(row=3, column=1)
entry4 = tk.Entry(window_function, show=None, textvariable=m4).grid(row=4, column=1)
entry5 = tk.Entry(window_function, show=None, textvariable=m5).grid(row=5, column=1)
entry6 = tk.Entry(window_function, show=None, textvariable=m6).grid(row=6, column=1)
entry7 = tk.Entry(window_function, show=None, textvariable=m7).grid(row=7, column=1)
# 生成按鈕
button = tk.Button(window_function, text="添加", command=add_Member).place(relx=0.3, rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
# 顯示窗口
window_function.mainloop()
#添加商品交易界面
def Trade_add():
window_choice.destroy()
# 構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global t1, t2, t3, t4, t5, t6, t7
# 生成窗口
window_function = tk.Tk()
# 窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
# 窗口大小
window_function.geometry('400x700')
# 生成標(biāo)簽
tk.Label(window_function, text="添加商品交易信息", font=("黑體", 20)).grid(row=0, column=1, pady=10)
tk.Label(window_function, text="請(qǐng)輸入交易流水號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易日期:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工編號(hào):").grid(row=3, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入商品編號(hào):").grid(row=4, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易數(shù)量:").grid(row=5, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易金額:").grid(row=6, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員卡號(hào):").grid(row=7, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
t1 = tk.StringVar()
t2 = tk.StringVar()
t3 = tk.StringVar()
t4 = tk.StringVar()
t5 = tk.StringVar()
t6 = tk.StringVar()
t7 = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(window_function, show=None, textvariable=t1).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=t2).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=t3).grid(row=3, column=1)
entry4 = tk.Entry(window_function, show=None, textvariable=t4).grid(row=4, column=1)
entry5 = tk.Entry(window_function, show=None, textvariable=t5).grid(row=5, column=1)
entry6 = tk.Entry(window_function, show=None, textvariable=t6).grid(row=6, column=1)
entry7 = tk.Entry(window_function, show=None, textvariable=t7).grid(row=7, column=1)
# 生成按鈕
button = tk.Button(window_function, text="添加", command=add_Trade).place(relx=0.3, rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
# 顯示窗口
window_function.mainloop()
#添加入庫(kù)信息界面
def Entry_add():
window_choice.destroy()
# 構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global e1, e2, e3, e4, e5, e6, e7
# 生成窗口
window_function = tk.Tk()
# 窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
# 窗口大小
window_function.geometry('400x700')
# 生成標(biāo)簽
tk.Label(window_function, text="添加入庫(kù)信息", font=("黑體", 20)).grid(row=0, column=1, pady=10)
tk.Label(window_function, text="請(qǐng)輸入入庫(kù)單編號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入商品編號(hào):").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入入庫(kù)量:").grid(row=3, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入總金額:").grid(row=4, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商編號(hào):").grid(row=5, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入入庫(kù)日期:").grid(row=6, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入入庫(kù)員編號(hào):").grid(row=7, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
e1 = tk.StringVar()
e2 = tk.StringVar()
e3 = tk.StringVar()
e4 = tk.StringVar()
e5 = tk.StringVar()
e6 = tk.StringVar()
e7 = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(window_function, show=None, textvariable=e1).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=e2).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=e3).grid(row=3, column=1)
entry4 = tk.Entry(window_function, show=None, textvariable=e4).grid(row=4, column=1)
entry5 = tk.Entry(window_function, show=None, textvariable=e5).grid(row=5, column=1)
entry6 = tk.Entry(window_function, show=None, textvariable=e6).grid(row=6, column=1)
entry7 = tk.Entry(window_function, show=None, textvariable=e7).grid(row=7, column=1)
# 生成按鈕
button = tk.Button(window_function, text="添加", command=add_Entry).place(relx=0.3, rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
# 顯示窗口
window_function.mainloop()
#添加出庫(kù)信息界面
def Exits_add():
window_choice.destroy()
# 構(gòu)建全集變量,方便上面的函數(shù)調(diào)用
global window_function
global x1, x2, x3, x4, x5, x6
# 生成窗口
window_function = tk.Tk()
# 窗口標(biāo)題
window_function.title("商城信息管理系統(tǒng)")
# 窗口大小
window_function.geometry('400x700')
# 生成標(biāo)簽
tk.Label(window_function, text="添加出庫(kù)信息", font=("黑體", 20)).grid(row=0, column=1, pady=10)
tk.Label(window_function, text="請(qǐng)輸入出庫(kù)單編號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入商品編號(hào):").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入出庫(kù)量:").grid(row=3, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入總金額:").grid(row=4, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入出庫(kù)日期:").grid(row=5, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入出庫(kù)員編號(hào):").grid(row=6, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
x1 = tk.StringVar()
x2 = tk.StringVar()
x3 = tk.StringVar()
x4 = tk.StringVar()
x5 = tk.StringVar()
x6 = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(window_function, show=None, textvariable=x1).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=x2).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=x3).grid(row=3, column=1)
entry4 = tk.Entry(window_function, show=None, textvariable=x4).grid(row=4, column=1)
entry5 = tk.Entry(window_function, show=None, textvariable=x5).grid(row=5, column=1)
entry6 = tk.Entry(window_function, show=None, textvariable=x6).grid(row=6, column=1)
# 生成按鈕
button = tk.Button(window_function, text="添加", command=add_Exits).place(relx=0.3, rely=0.9)
button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
# 顯示窗口
window_function.mainloop()
############################################################################################
#刪除商品界面
def Goods_delete():
window_choice.destroy()
global window_function
global g10
window_function=tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除商品", font=("黑體", 20)).grid(row=0,column=1,pady=20)
tk.Label(window_function,text="請(qǐng)輸入商品編號(hào):").grid(row = 1,column =0,padx=20)
g10 =tk.StringVar()
entry1=tk.Entry(window_function,show=None,textvariable=g10).grid(row = 1,column =1,pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Goods,anchor = 's').place(relx=0.2,rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4,rely=0.5)
window_function.mainloop()
# 刪除員工界面
def Staff_delete():
window_choice.destroy()
global window_function
global s10
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除員工", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工編號(hào):").grid(row=1, column=0, padx=20)
s10 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=s10).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Staff, anchor='s').place(relx=0.2, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
window_function.mainloop()
# 刪除安全問(wèn)題界面
def Check1_delete():
window_choice.destroy()
global window_function
global c6
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除檢查安全記錄", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入檢查日期:").grid(row=1, column=0, padx=20)
c6 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=c6).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Check1, anchor='s').place(relx=0.2, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
window_function.mainloop()
# 刪除倉(cāng)庫(kù)界面
def Ware_delete():
window_choice.destroy()
global window_function
global w5
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除倉(cāng)庫(kù)", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入倉(cāng)庫(kù)編號(hào):").grid(row=1, column=0, padx=20)
w5 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=w5).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Ware, anchor='s').place(relx=0.2, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
window_function.mainloop()
# 刪除供貨商界面
def Vendor_delete():
window_choice.destroy()
global window_function
global v5
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除供貨商", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商編號(hào):").grid(row=1, column=0, padx=20)
v5 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=v5).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Vendor, anchor='s').place(relx=0.2, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
window_function.mainloop()
# 刪除退貨信息界面
def Infer_delete():
window_choice.destroy()
global window_function
global i6
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除退貨信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易流水號(hào):").grid(row=1, column=0, padx=20)
i6 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=i6).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Infer, anchor='s').place(relx=0.2, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
window_function.mainloop()
# 刪除會(huì)員表界面
def Member_delete():
window_choice.destroy()
global window_function
global m8
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除會(huì)員信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員卡號(hào):").grid(row=1, column=0, padx=20)
m8 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=m8).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Member, anchor='s').place(relx=0.2, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
window_function.mainloop()
#刪除商品交易記錄界面
def Trade_delete():
window_choice.destroy()
global window_function
global t8
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除商品交易記錄", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易流水號(hào):").grid(row=1, column=0, padx=20)
t8 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=t8).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Trade, anchor='s').place(relx=0.2, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
window_function.mainloop()
#刪除入庫(kù)信息界面
def Entry_delete():
window_choice.destroy()
global window_function
global e8
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除入庫(kù)信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入入庫(kù)單編號(hào):").grid(row=1, column=0, padx=20)
e8 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=e8).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Entry, anchor='s').place(relx=0.2, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
window_function.mainloop()
#刪除出庫(kù)信息界面
def Exits_delete():
window_choice.destroy()
global window_function
global x7
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="刪除出庫(kù)信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入出庫(kù)單編號(hào):").grid(row=1, column=0, padx=20)
x7 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=x7).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="刪除", command=delete_Exits, anchor='s').place(relx=0.2, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
window_function.mainloop()
#####################################################################################
#更新商品信息界面
def Goods_update():
window_choice.destroy()
global window_function
global g11,g12,g13
window_function=tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="更新商品信息", font=("黑體", 20)).grid(row=0,column=1,pady=20)
tk.Label(window_function,text="請(qǐng)輸入商品進(jìn)價(jià):").grid(row=1,column =0,padx=20,pady=20)
tk.Label(window_function,text="請(qǐng)輸入商品售價(jià):").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function,text="請(qǐng)輸入商品編號(hào):").grid(row=3,column =0,padx=20,pady=20)
g11=tk.StringVar()
g12=tk.StringVar()
g13=tk.StringVar()
entry1=tk.Entry(window_function,show=None,textvariable=g11).grid(row=1,column =1)
entry2=tk.Entry(window_function,show=None,textvariable=g12).grid(row=2,column =1)
entry3 = tk.Entry(window_function, show=None, textvariable=g13).grid(row=3, column=1)
button = tk.Button(window_function, text="更新", command=update_Goods).place(relx=0.3,rely=0.7)
button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5,rely=0.7)
window_function.mainloop()
# 更新員工界面
def Staff_update():
window_choice.destroy()
global window_function
global s11, s12, s13
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="更新員工信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工電話(huà):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工工資:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工編號(hào):").grid(row=3, column=0, padx=20, pady=20)
s11 = tk.StringVar()
s12 = tk.StringVar()
s13 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=s11).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=s12).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=s13).grid(row=3, column=1)
button = tk.Button(window_function, text="更新", command=update_Staff).place(relx=0.3, rely=0.7)
button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
window_function.mainloop()
# 更新倉(cāng)庫(kù)界面
def Ware_update():
window_choice.destroy()
global window_function
global w6,w7,w8
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="更新倉(cāng)庫(kù)信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入倉(cāng)庫(kù)名稱(chēng):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入倉(cāng)庫(kù)管理員編號(hào):").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入倉(cāng)庫(kù)編號(hào):").grid(row=3, column=0, padx=20, pady=20)
w6 = tk.StringVar()
w7 = tk.StringVar()
w8 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=w6).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=w7).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=w8).grid(row=3, column=1)
button = tk.Button(window_function, text="更新", command=update_Ware).place(relx=0.3, rely=0.7)
button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
window_function.mainloop()
# 更新供貨商界面
def Vendor_update():
window_choice.destroy()
global window_function
global v6, v7, v8
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="更新供貨商信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商電話(huà):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商地址:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商編號(hào):").grid(row=3, column=0, padx=20, pady=20)
v6 = tk.StringVar()
v7 = tk.StringVar()
v8 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=v6).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=v7).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=v8).grid(row=3, column=1)
button = tk.Button(window_function, text="更新", command=update_Vendor).place(relx=0.3, rely=0.7)
button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
window_function.mainloop()
# 更新退貨信息界面
def Infer_update():
window_choice.destroy()
global window_function
global i7,i8,i9
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="更新供貨商信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入退貨數(shù)量:").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入退款金額:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易流水號(hào)編號(hào):").grid(row=3, column=0, padx=20, pady=20)
i7 = tk.StringVar()
i8 = tk.StringVar()
i9 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=i7).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=i8).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=i9).grid(row=3, column=1)
button = tk.Button(window_function, text="更新", command=update_Infer).place(relx=0.3, rely=0.7)
button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
window_function.mainloop()
# 更新會(huì)員表界面
def Member_update():
window_choice.destroy()
global window_function
global m9,m10,m11
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="更新供貨商信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員電話(huà):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員密碼:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員卡號(hào)編號(hào):").grid(row=3, column=0, padx=20, pady=20)
m9 = tk.StringVar()
m10 = tk.StringVar()
m11 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=m9).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=m10).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=m11).grid(row=3, column=1)
button = tk.Button(window_function, text="更新", command=update_Member).place(relx=0.3, rely=0.7)
button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
window_function.mainloop()
#更新商品交易記錄界面
def Trade_update():
window_choice.destroy()
global window_function
global t9,t10,t11
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="更新商品交易信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易金額:").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易數(shù)量:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易流水號(hào):").grid(row=3, column=0, padx=20, pady=20)
t9 = tk.StringVar()
t10 = tk.StringVar()
t11 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=t9).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=t10).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=t11).grid(row=3, column=1)
button = tk.Button(window_function, text="更新", command=update_Trade).place(relx=0.3, rely=0.7)
button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
window_function.mainloop()
#更新入庫(kù)信息界面
def Entry_update():
window_choice.destroy()
global window_function
global e9,e10,e11
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="更新供貨商信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入總金額:").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入入庫(kù)量:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入入庫(kù)單編號(hào):").grid(row=3, column=0, padx=20, pady=20)
e9 = tk.StringVar()
e10 = tk.StringVar()
e11= tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=e9).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=e10).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=e11).grid(row=3, column=1)
button = tk.Button(window_function, text="更新", command=update_Entry).place(relx=0.3, rely=0.7)
button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
window_function.mainloop()
#更新出庫(kù)信息界面
def Exits_update():
window_choice.destroy()
global window_function
global x8,x9,x10
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="更新供貨商信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入總金額:").grid(row=1, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入出庫(kù)量:").grid(row=2, column=0, padx=20, pady=20)
tk.Label(window_function, text="請(qǐng)輸入出庫(kù)單編號(hào):").grid(row=3, column=0, padx=20, pady=20)
x8 = tk.StringVar()
x9 = tk.StringVar()
x10 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=x8).grid(row=1, column=1)
entry2 = tk.Entry(window_function, show=None, textvariable=x9).grid(row=2, column=1)
entry3 = tk.Entry(window_function, show=None, textvariable=x10).grid(row=3, column=1)
button = tk.Button(window_function, text="更新", command=update_Exits).place(relx=0.3, rely=0.7)
button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
window_function.mainloop()
#############################################################################################################################
#條件查找商品界面
def Goods_select():
window_choice.destroy()
global window_function
global g14
window_function=tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找商品信息", font=("黑體", 20)).grid(row=0,column=1,pady=20)
tk.Label(window_function,text="請(qǐng)輸入商品編號(hào):").grid(row = 1,column =0,padx=20)
g14 =tk.StringVar()
entry1=tk.Entry(window_function,show=None,textvariable=g14).grid(row = 1,column =1,pady=40)
button = tk.Button(window_function, text="查找", command=select_Goods).place(relx=0.3,rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5,rely=0.5)
window_function.mainloop()
# 查找員工界面
def Staff_select():
window_choice.destroy()
global window_function
global s14
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找員工信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入員工編號(hào):").grid(row=1, column=0, padx=20)
s14 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=s14).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="查找", command=select_Staff).place(relx=0.3, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
window_function.mainloop()
# 查找安全問(wèn)題界面
def Check1_select():
window_choice.destroy()
global window_function
global c7
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找安全檢查信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入檢查日期:").grid(row=1, column=0, padx=20)
c7 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=c7).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="查找", command=select_Check1).place(relx=0.3, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
window_function.mainloop()
# 查找倉(cāng)庫(kù)界面
def Ware_select():
window_choice.destroy()
global window_function
global w9
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找倉(cāng)庫(kù)信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入倉(cāng)庫(kù)編號(hào):").grid(row=1, column=0, padx=20)
w9 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=w9).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="查找", command=select_Ware).place(relx=0.3, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
window_function.mainloop()
# 查找供貨商界面
def Vendor_select():
window_choice.destroy()
global window_function
global v9
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找供貨商信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入供貨商編號(hào):").grid(row=1, column=0, padx=20)
v9 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=v9).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="查找", command=select_Vendor).place(relx=0.3, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
window_function.mainloop()
# 查找退貨信息界面
def Infer_select():
window_choice.destroy()
global window_function
global i10
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找退貨信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易流水號(hào):").grid(row=1, column=0, padx=20)
i10 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=i10).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="查找", command=select_Infer).place(relx=0.3, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
window_function.mainloop()
# 查找會(huì)員表界面
def Member_select():
window_choice.destroy()
global window_function
global m12
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找會(huì)員信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入會(huì)員卡號(hào):").grid(row=1, column=0, padx=20)
m12 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=m12).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="查找", command=select_Member).place(relx=0.3, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
window_function.mainloop()
#查找商品交易記錄界面
def Trade_select():
window_choice.destroy()
global window_function
global t12
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找商品交易信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入交易流水號(hào):").grid(row=1, column=0, padx=20)
t12 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=t12).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="查找", command=select_Trade).place(relx=0.3, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
window_function.mainloop()
#查找入庫(kù)信息界面
def Entry_select():
window_choice.destroy()
global window_function
global e12
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找入庫(kù)信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入入庫(kù)單編號(hào):").grid(row=1, column=0, padx=20)
e12 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=e12).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="查找", command=select_Entry).place(relx=0.3, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
window_function.mainloop()
#查找出庫(kù)信息界面
def Exits_select():
window_choice.destroy()
global window_function
global x11
window_function = tk.Tk()
window_function.title("商城信息管理系統(tǒng)")
window_function.geometry('500x400')
tk.Label(window_function, text="查找出庫(kù)信息", font=("黑體", 20)).grid(row=0, column=1, pady=20)
tk.Label(window_function, text="請(qǐng)輸入出庫(kù)單編號(hào):").grid(row=1, column=0, padx=20)
x11 = tk.StringVar()
entry1 = tk.Entry(window_function, show=None, textvariable=x11).grid(row=1, column=1, pady=40)
button = tk.Button(window_function, text="查找", command=select_Exits).place(relx=0.3, rely=0.5)
button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
window_function.mainloop()
########################################################################################################
#增刪改查之后進(jìn)去每個(gè)都可以對(duì)員工信息 商品信息 安全信息 倉(cāng)庫(kù)信息 供貨信息 退貨信息 會(huì)員信息等等進(jìn)行操作
def all_add():
#window.destroy()
global window_choice
window_choice = tk.Tk()
window_choice.title("商城信息管理系統(tǒng)")
window_choice.geometry('400x900')
# 生成畫(huà)布,銷(xiāo)毀后生成新的畫(huà)布實(shí)現(xiàn)跳轉(zhuǎn)
page = tk.Frame(window_choice)
page.pack()
tk.Label(window_choice, text="歡迎使用商城信息管理系統(tǒng)", font=("黑體", 20)).pack(pady=10)
button1 = tk.Button(window_choice, text="添加員工信息", command=Staff_add).pack(pady=10)
button2 = tk.Button(window_choice, text="添加商品信息", command=Goods_add).pack(pady=10)
button3 = tk.Button(window_choice, text="添加安全信息", command=Check1_add).pack(pady=10)
button4 = tk.Button(window_choice, text="添加倉(cāng)庫(kù)信息", command=Ware_add).pack(pady=10)
button5 = tk.Button(window_choice, text="添加供貨商信息", command=Vendor_add).pack(pady=10)
button6 = tk.Button(window_choice, text="添加退貨信息", command=Infer_add).pack(pady=10)
button7 = tk.Button(window_choice, text="添加會(huì)員信息", command=Member_add).pack(pady=10)
button8 = tk.Button(window_choice, text="添加交易信息", command=Trade_add).pack(pady=10)
button9 = tk.Button(window_choice, text="添加入庫(kù)信息", command=Entry_add).pack(pady=10)
button10 = tk.Button(window_choice, text="添加出庫(kù)信息", command=Exits_add).pack(pady=10)
button11 = tk.Button(window_choice, text="返回", command=change_main).place(relx=0.5, rely=0.8)
window_choice.mainloop()
def all_delete():
#window.destroy()
global window_choice
window_choice = tk.Tk()
window_choice.title("商城信息管理系統(tǒng)")
window_choice.geometry('400x900')
# 生成畫(huà)布,銷(xiāo)毀后生成新的畫(huà)布實(shí)現(xiàn)跳轉(zhuǎn)
page = tk.Frame(window_choice)
page.pack()
tk.Label(window_choice, text="歡迎使用商城信息管理系統(tǒng)", font=("黑體", 20)).pack(pady=10)
button1 = tk.Button(window_choice, text="刪除員工信息", command=Staff_delete).pack(pady=10)
button2 = tk.Button(window_choice, text="刪除商品信息", command=Goods_delete).pack(pady=10)
button3 = tk.Button(window_choice, text="刪除安全信息", command=Check1_delete).pack(pady=10)
button4 = tk.Button(window_choice, text="刪除倉(cāng)庫(kù)信息", command=Ware_delete).pack(pady=10)
button5 = tk.Button(window_choice, text="刪除供貨商信息", command=Vendor_delete).pack(pady=10)
button6 = tk.Button(window_choice, text="刪除退貨信息", command=Infer_delete).pack(pady=10)
button7 = tk.Button(window_choice, text="刪除會(huì)員信息", command=Member_delete).pack(pady=10)
button8 = tk.Button(window_choice, text="刪除交易信息", command=Trade_delete).pack(pady=10)
button9 = tk.Button(window_choice, text="刪除入庫(kù)信息", command=Entry_delete).pack(pady=10)
button10 = tk.Button(window_choice, text="刪除出庫(kù)信息", command=Exits_delete).pack(pady=10)
button11 = tk.Button(window_choice, text="返回", command=change_main).place(relx=0.5, rely=0.8)
window_choice.mainloop()
def all_update():
#window.destroy()
global window_choice
window_choice = tk.Tk()
window_choice.title("商城信息管理系統(tǒng)")
window_choice.geometry('400x900')
# 生成畫(huà)布,銷(xiāo)毀后生成新的畫(huà)布實(shí)現(xiàn)跳轉(zhuǎn)
page = tk.Frame(window_choice)
page.pack()
tk.Label(window_choice, text="歡迎使用商城信息管理系統(tǒng)", font=("黑體", 20)).pack(pady=10)
button1 = tk.Button(window_choice, text="更新員工信息", command=Staff_update).pack(pady=10)
button2 = tk.Button(window_choice, text="更新商品信息", command=Goods_update).pack(pady=10)
button3 = tk.Button(window_choice, text="更新倉(cāng)庫(kù)信息", command=Ware_update).pack(pady=10)
button4 = tk.Button(window_choice, text="更新供貨商信息", command=Vendor_update).pack(pady=10)
button5 = tk.Button(window_choice, text="更新退貨信息", command=Infer_update).pack(pady=10)
button6 = tk.Button(window_choice, text="更新會(huì)員信息", command=Member_update).pack(pady=10)
button7 = tk.Button(window_choice, text="更新交易信息", command=Trade_update).pack(pady=10)
button8 = tk.Button(window_choice, text="更新入庫(kù)信息", command=Entry_update).pack(pady=10)
button9 = tk.Button(window_choice, text="更新出庫(kù)信息", command=Exits_update).pack(pady=10)
button10 = tk.Button(window_choice, text="返回", command=change_main).place(relx=0.5, rely=0.8)
window_choice.mainloop()
def all_select():
#window.destroy()
global window_choice
window_choice = tk.Tk()
window_choice.title("商城信息管理系統(tǒng)")
window_choice.geometry('400x900')
# 生成畫(huà)布,銷(xiāo)毀后生成新的畫(huà)布實(shí)現(xiàn)跳轉(zhuǎn)
page = tk.Frame(window_choice)
page.pack()
tk.Label(window_choice, text="歡迎使用商城信息管理系統(tǒng)", font=("黑體", 20)).pack(pady=10)
button1 = tk.Button(window_choice, text="查詢(xún)員工信息", command=Staff_select).pack(pady=10)
button2 = tk.Button(window_choice, text="查詢(xún)商品信息", command=Goods_select).pack(pady=10)
button3 = tk.Button(window_choice, text="查詢(xún)安全信息", command=Check1_select).pack(pady=10)
button4 = tk.Button(window_choice, text="查詢(xún)倉(cāng)庫(kù)信息", command=Ware_select).pack(pady=10)
button5 = tk.Button(window_choice, text="查詢(xún)供貨商信息", command=Vendor_select).pack(pady=10)
button6 = tk.Button(window_choice, text="查詢(xún)退貨信息", command=Infer_select).pack(pady=10)
button7 = tk.Button(window_choice, text="查詢(xún)會(huì)員信息", command=Member_select).pack(pady=10)
button8 = tk.Button(window_choice, text="查詢(xún)交易信息", command=Trade_select).pack(pady=10)
button9 = tk.Button(window_choice, text="查詢(xún)?nèi)霂?kù)信息", command=Entry_select).pack(pady=10)
button10 = tk.Button(window_choice, text="查詢(xún)出庫(kù)信息", command=Exits_select).pack(pady=10)
button11 = tk.Button(window_choice, text="返回", command=change_main).place(relx=0.5, rely=0.8)
window_choice.mainloop()
####################################################################################################
#添加商品界面跳轉(zhuǎn)
def change_add():
window_function.destroy()
all_add()
def change1_add():
window.destroy()
all_add()
#刪除商品界面跳轉(zhuǎn)
def change_delete():
window_function.destroy()
all_delete()
def change1_delete():
window.destroy()
all_delete()
#更新商品界面跳轉(zhuǎn)
def change_update():
window_function.destroy()
all_update()
def change1_update():
window.destroy()
all_update()
#條件查詢(xún)商品界面跳轉(zhuǎn)
def change_select():
window_function.destroy()
all_select()
def change1_select():
window.destroy()
all_select()
#主界面跳轉(zhuǎn)
def change_main():
window_choice.destroy()
mainpage()
def change_login():
login1.destroy()
mainpage()
###################################################################################################
#主界面
def mainpage():
global window
window = tk.Tk()
window.title("商城信息管理系統(tǒng)")
# window.geometry('500x400')
#生成畫(huà)布,銷(xiāo)毀后生成新的畫(huà)布實(shí)現(xiàn)跳轉(zhuǎn)
#page = tk.Frame(window)
#page.pack()
tk.Label(window, text="歡迎使用商城信息管理系統(tǒng)", font=("黑體", 20)).pack(pady=10)
button1 = tk.Button(window, text="添加信息", command=change1_add).pack(pady=10)
button2 = tk.Button(window, text="刪除信息", command=change1_delete).pack(pady=10)
button3 = tk.Button(window, text="修改信息", command=change1_update).pack(pady=10)
button4 = tk.Button(window, text="信息查詢(xún)", command=change1_select).pack(pady=10)
#信息查詢(xún) 員工信息 商品信息 安全信息 倉(cāng)庫(kù)信息 供貨信息 退貨信息 會(huì)員信息
# 插入圖片背景
image = Image.open("BACK.jpg").resize((400, 400))
pyt = ImageTk.PhotoImage(image)
canvas_window = tkinter.Canvas(window, width=500, height=400)
canvas_window.create_image(250, 200, image=pyt)
canvas_window.pack()
window.mainloop()
####################################################################################
#登錄界面
def login():
global login1,username,password
login1=tk.Tk()
login1.title("登錄界面")
login1.geometry('300x200')
tk.Label(login1, text="請(qǐng)輸入賬號(hào):").grid(row=1, column=0, padx=20, pady=20)
tk.Label(login1, text="請(qǐng)輸入密碼:").grid(row=2, column=0, padx=20, pady=20)
# 定義變量記錄輸入信息
username = tk.StringVar()
password = tk.StringVar()
# 生成輸入框
entry1 = tk.Entry(login1, show=None, textvariable=username).grid(row=1, column=1)
entry2 = tk.Entry(login1, show='*', textvariable=password).grid(row=2, column=1)
# 生成按鈕
button = tk.Button(login1, text="login", command=login_l).place(relx=0.3, rely=0.8)
# else:
# tkinter.messagebox.showinfo(title='提示', message='賬號(hào)或密碼錯(cuò)誤')
login1.mainloop()
def login_l():
name=username.get()
pwd=password.get()
if name=='mysql' and pwd =='123456':
change_login()
else:
tkinter.messagebox.showinfo(title='提示', message='賬號(hào)或密碼錯(cuò)誤')
#調(diào)用登錄界面
if __name__ == '__main__':
login()
?
PS:想要源代碼以及源文件的私信我,給出你的郵箱地址,最近比較忙,如果沒(méi)有發(fā)你再提醒我一下
?
?
?
?
?
?
?
到了這里,關(guān)于基于python+mysql超市信息管理系統(tǒng)(附完整源代碼)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!