News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

2024-11(8)

Based on python+mysql supermarket information management system (with complete source code)

posted on 2023-06-06 11:11     read(130)     comment(0)     like(19)     collect(4)


(The reference is this article (5 messages) Database Course Design - Supermarket Retail Information Management System (Python Implementation)_Xiaotao's Blog Correcting Bugs-CSDN Blog_Supermarket Management System Database Design But there is no complete code in this article , so I completed the ui interface and related codes by myself, and made a second creation, and the framework has also been changed. The more important thing is to write down some mistakes I made during the writing process, hoping to help demining)

Put some renderings first

login interface:

e5fa4e9d21844bc4b3bcdec126c18898.png

Main interface:

99bcb2e818964225801d8e4ecc744f2c.png

Add information interface:

 518abc6b0eba4452bbc62589d946b7ea.png

Add employee information interface:

92fb0323b3b84e09a49d20a365dbe7c6.png

Enter a sample data and add:

5b5cde8fc1c94f019f53dcf5a3ff8cda.png

First of all, we need to analyze the needs. What we want to do is an information management system of a mall (similar to a large supermarket), which can help manage purchases, sales, personnel, and inventory information. Then there must be purchases, sales, employees, warehouses, Considering safety issues and other aspects, the following framework is obtained based on the above analysis (due to limited space, this is a partial framework diagram)

12f5d2308f7742de9f6b6ec0ff72b7ea.png

Draw the ER diagram according to the above analysis. Due to the limitation of the number of graphics in each drawing, the ER diagram is divided into three parts, and the two ER diagrams are connected by colored

13036135ccad4de38d3473b51b0954db.png

4cb8e78e5bef4d87bdc69bd6cb4b504b.png

855158e959b54e848214c7442167d12a.png According to the above ER diagram, logical structure design eliminates dependencies:

1. Employees (employee number, employee name, employee gender, employee age, employee length of service, employee phone number, ID number, salary, nucleic acid status);

2. Commodity (commodity number, commodity name, commodity category, commodity unit price, commodity cost, supplier);

3. Membership (membership card number, member name, phone number, registration date, accumulated amount, balance);

4. Supplier (supplier number, supplier name, supplier phone number, supplier address);

5.仓库(仓库编号,仓库管理员编号,仓库名称,仓库地址);

6.退货信息(交易流水号,商品编号,退货数量,退款金额,退货日期);

7.销售(员工编号,商品编号,销售日期,销售数量,销售金额);

8.购买(会员卡卡号,商品编号,购买日期,购买数量);

9.供货(供货商编号,商品编号,供货日期,供货数量);

10.库存(仓库编号,商品编号,库存量);

11.安全问题(健康码,灭火器,自动灭火喷淋装置,检察人员编号);

形成如下表:

员工表Staff

属性名

含义

类型

说明

Snum

员工编号

varchar

主键

Sname

员工姓名

varchar

Ssex

员工性别

varchar

‘男’或‘女’

Sage

员工年龄

int

>=18

Sseniority

员工工龄

int

>=0

Sphone

员工电话

varchar

Sid

身份证号

varchar

Ssalary

工资

int

>=0

Syard

健康码

varchar

‘红码’‘绿码’‘黄码’

商品表Goods

属性名

含义

类型

说明

Gnum

商品编号

varchar

主键

Gname

商品名称

varchar

Gtype

商品类别

varchar

Gprice

商品售价

int

>=0

Gbid

商品进价

int

>=0

Gstock

库存量

int

>=0

Galarm

告警量

int

>=0

Gplan

计划库存量

int

>=0

Vnum

供货商编号

varchar

是表Vecdor的外键

会员表Member

属性名

含义

类型

说明

Mnum

会员卡号

varchar

主键

Mname

会员姓名

varchar

Mphone

会员电话

varchar

Mdate

注册日期

datetime

Mtotal

累计金额

int

>=0

Mbalance

卡内余额

int

>=0

Mpassword

会员密码

varchar

供货商Vendor

属性名

含义

类型

说明

Vnum

供货商编号

varchar

主键

Vname

供货商名称

varchar

Vphone

供货商电话

varchar

Vplace

供货商地址

varchar

仓库Ware

属性名

含义

类型

说明

Wnum

仓库编号

varchar

主键

Wname

仓库名称

varchar

Wplace

仓库地址

varchar

Snum

仓库管理员编号

varchar

是表Staff的外键

退货信息Infer

属性名

含义

类型

说明

Tnum

交易流水号

varchar

是表Trade的外键

Gnum

商品编号

varchar

是表Goods的外键

Iamount

退货数量

int

>=0

Imoney

退款金额

int

>=0

Idate

退货日期

datetime

商品交易表Trade

属性名

含义

类型

说明

Tnum

交易流水号

varchar

主键

Tdate

交易日期

datetime

Snum

员工编号

varchar

是表Staff的外键

Gnum

商品编号

varchar

是表Goods的外键

Tamount

交易数量

int

>=0

Tmoney

交易金额

int

>=0

Mnum

会员卡号

varchar

是表Member的外键

入库信息表Entry

属性名

含义

类型

说明

Enum

入库单编号

varchar

主键

Gnum

商品编号

varchar

是表Goods的外键

Eamount

入库量

int

>=0

Emoney

总金额

int

>=0

Vnum

供货商编号

varchar

是表Ventor的外键

Edate

入库日期

datetime

Snum

入库员编号

varchar

是表Staff的外键

出库信息表Exits

属性名

含义

类型

说明

Xnum

出库单编号

varchar

主键

Gnum

商品编号

varchar

是表Goods的外键

Xamount

出库量

int

>=0

Xmoney

总金额

int

>=0

Xdate

出库日期

datetime

Snum

出库员编号

varchar

是表Staff的外键

Security Question Check1

attribute name

meaning

type

illustrate

Cdate

check date

date

primary key

Cyard

Customer Health Code

varchar

'Red Code', 'Green Code', 'Yellow Code'

Cfire

fire extinguisher

varchar

'whether'

Cspary

automatic fire sprinkler

varchar

'whether'

Attached below is the version I use python3.6+mysql8.0

1. You need to manually create a database sqlwork in mysql (any name is fine)

2. Execute init.py to perform initialization operations , that is, create tables, insert initial data, create triggers, and add cascading constraints (the reason for this order is because cascading constraints and foreign key constraints are added when creating tables It will cause the insertion of data to fail) The following is the code of init.py

  1. import pymysql
  2. #数据库初始化
  3. #创建表
  4. connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立连接
  5. if connect:
  6. print("连接成功!")
  7. cursor = connect.cursor() # 创建一个游标对象,python里的sql语句都要通过cursor来执行
  8. #创建表及其约束
  9. 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('红码','黄码','绿码')) )")
  10. 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)")
  11. # on delete cascade
  12. 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)")
  13. 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)")
  14. # on delete set null
  15. 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)")
  16. 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)")
  17. 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)")
  18. # on delete cascade
  19. 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)")
  20. 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)")
  21. 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('是','否')))")
  22. connect.commit() #提交
  23. cursor.close() # 关闭游标
  24. connect.close()
  25. #初始化数据(两条数据或一条数据,为了后续增加约束)
  26. connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立连接
  27. cursor = connect.cursor() # 创建一个游标对象,python里的sql语句都要通过cursor来执行
  28. cursor.execute("insert into Goods values ('200001','薯片','零食',8,5,500,100,600,'100002')")
  29. cursor.execute("insert into Goods values ('200002','可乐','饮料',3,2,1000,100,1200,'100001')")
  30. cursor.execute("insert into Vendor values ('100001','可口','123456','杭州')")
  31. cursor.execute("insert into Vendor values ('100002','乐事','135790','西安')")
  32. cursor.execute("insert into Vendor values ('100003','牧场','246800','武汉')")
  33. cursor.execute("insert into Staff values ('0001','张三','男',30,5,'139820117','411481320301',5000,'绿码')")
  34. cursor.execute("insert into Staff values ('0002','熊大','女',32,3,'178883132','411481310302',3000,'绿码')")
  35. cursor.execute("insert into Member values ('300001','迪迦','179320118',20220830194422,1050,300,'321336')")
  36. cursor.execute("insert into Ware values('400001','一号','上海','0001')")
  37. cursor.execute("insert into Check1 values(20220620,'绿码','是','是')")
  38. connect.commit() # 提交
  39. cursor.close()
  40. connect.close()
  41. #创建触发器 满足顾客买商品的一个场景
  42. connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立连接
  43. # 创建光标
  44. cursor = connect.cursor()
  45. #购买的商品数量要在库存里减去
  46. cursor.execute("create trigger update_Goods before insert on Trade for each row update Goods set Gstock=Gstock-new.Tamount where Gnum=new.Gnum;")
  47. #要在会员卡的总消费和余额里改变相应的数值
  48. 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;")
  49. connect.commit()
  50. cursor.close()
  51. connect.close()
  52. connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立连接
  53. cursor = connect.cursor()
  54. cursor.execute("alter table Goods add foreign key(Vnum) references Vendor(Vnum) on delete cascade")
  55. cursor.execute("alter table Ware add foreign key(Snum) references Staff(Snum)")
  56. cursor.execute("alter table Trade add foreign key(Snum) references Staff(Snum)")
  57. cursor.execute("alter table Trade add foreign key(Gnum) references Goods(Gnum)")
  58. cursor.execute("alter table Trade add foreign key(Mnum) references Member(Mnum)")
  59. cursor.execute("alter table Infer add foreign key(Tnum) references Trade(Tnum)")
  60. cursor.execute("alter table Infer add foreign key(Gnum) references Goods(Gnum)")
  61. cursor.execute("alter table Entry add foreign key(Snum) references Staff(Snum)")
  62. cursor.execute("alter table Entry add foreign key(Gnum) references Goods(Gnum)")
  63. cursor.execute("alter table Entry add foreign key(Vnum) references Vendor(Vnum)")
  64. cursor.execute("alter table Exits add foreign key(Snum) references Staff(Snum)")
  65. cursor.execute("alter table Exits add foreign key(Gnum) references Goods(Gnum)")
  66. connect.commit()
  67. # 关闭数据库连接,防止泄露
  68. connect.close()

3. Next is the main part (ui interface, sql query) main.py code is as follows (the code has about 1700 lines)

The pymysql library is used to realize the connection to the database and the execution of related SQL statements

The Tkinter library is used to implement the ui interface, and the PIL library is used to place the picture background

The overall framework is as follows:

  1. login interface login()
  2. Main interface (add, delete, modify, check) mainpage()
  3. Selection interface (the interface for adding, deleting, modifying and checking which table, 4) such as all_add()
  4. Interface to operate on a certain table (about 40, because there are 10 tables, almost every table needs to be added, deleted, modified and checked) such as Staff_add()
  5. 40 functions executed by specific sql statements such as add_Staff()
  1. import tkinter as tk
  2. import tkinter.messagebox
  3. from tkinter import *
  4. import pymysql
  5. from PIL import Image, ImageTk
  6. #增删改查之后进去每个都可以对员工信息 商品信息 安全信息 仓库信息 供货信息 退货信息 会员信息进行操作
  7. ################################################################################################################
  8. #数据库添加操作
  9. def add_Goods():
  10. # 连接数据库
  11. connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立连接
  12. # 创建光标
  13. cursor = connect.cursor()
  14. # 编写SQL语句
  15. sql = "insert into Goods(Gnum,Gname,Gtype,Gprice,Gbid,Gstock,Galarm,Gplan,Vnum) values(%s,%s,%s,%s,%s,%s,%s,%s,%s)"
  16. # 执行SQL语句,并且输出完成提示信息,否则回滚
  17. try:
  18. cursor.execute(sql,(g1.get(), g2.get(), g3.get(), g4.get(), g5.get(), g6.get(), g7.get(), g8.get(), g9.get()))
  19. connect.commit()
  20. tkinter.messagebox.showinfo("提示", "数据添加成功")
  21. except:
  22. connect.rollback()
  23. # 关闭数据库连接,防止泄露
  24. connect.close()
  25. def add_Staff():
  26. # 连接数据库
  27. connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立连接
  28. # 创建光标
  29. cursor = connect.cursor()
  30. # 编写SQL语句
  31. sql = "insert into Staff(Snum,Sname,Ssex,Sage,Sseniority,Sphone,Sid,Ssalary,Syard) values(%s,%s,%s,%s,%s,%s,%s,%s,%s)"
  32. # 执行SQL语句,并且输出完成提示信息,否则回滚
  33. try:
  34. cursor.execute(sql,(s1.get(), s2.get(), s3.get(), s4.get(), s5.get(), s6.get(), s7.get(), s8.get(), s9.get()))
  35. connect.commit()
  36. tkinter.messagebox.showinfo("提示", "数据添加成功")
  37. except:
  38. connect.rollback()
  39. # 关闭数据库连接,防止泄露
  40. connect.close()
  41. def add_Check1():
  42. # 连接数据库
  43. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  44. # 创建光标
  45. cursor = connect.cursor()
  46. # 编写SQL语句
  47. sql = "insert into Check(Cdate,Cyard,Cfire,Cspary) values(%s,%s,%s,%s)"
  48. # 执行SQL语句,并且输出完成提示信息,否则回滚
  49. try:
  50. cursor.execute(sql, (c1.get(), c2.get(), c3.get(), c4.get()))
  51. connect.commit()
  52. tkinter.messagebox.showinfo("提示", "数据添加成功")
  53. except:
  54. connect.rollback()
  55. # 关闭数据库连接,防止泄露
  56. connect.close()
  57. def add_Ware():
  58. # 连接数据库
  59. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  60. # 创建光标
  61. cursor = connect.cursor()
  62. # 编写SQL语句
  63. sql = "insert into Ware(Wnum,Wname,Wplace,Snum) values(%s,%s,%s,%s)"
  64. # 执行SQL语句,并且输出完成提示信息,否则回滚
  65. try:
  66. cursor.execute(sql, (w1.get(), w2.get(), w3.get(), w4.get()))
  67. connect.commit()
  68. tkinter.messagebox.showinfo("提示", "数据添加成功")
  69. except:
  70. connect.rollback()
  71. # 关闭数据库连接,防止泄露
  72. connect.close()
  73. def add_Vendor():
  74. # 连接数据库
  75. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  76. # 创建光标
  77. cursor = connect.cursor()
  78. # 编写SQL语句
  79. sql = "insert into Vendor(Vnum,Vname,Vphone,Vplace) values(%s,%s,%s,%s)"
  80. # 执行SQL语句,并且输出完成提示信息,否则回滚
  81. try:
  82. cursor.execute(sql, (v1.get(), v2.get(), v3.get(), v4.get()))
  83. connect.commit()
  84. tkinter.messagebox.showinfo("提示", "数据添加成功")
  85. except:
  86. connect.rollback()
  87. # 关闭数据库连接,防止泄露
  88. connect.close()
  89. def add_Infer():
  90. # 连接数据库
  91. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  92. # 创建光标
  93. cursor = connect.cursor()
  94. # 编写SQL语句
  95. sql = "insert into Infer(Tnum,Gnum,Iamount,Imoney,Idate) values(%s,%s,%s,%s,%s)"
  96. # 执行SQL语句,并且输出完成提示信息,否则回滚
  97. try:
  98. cursor.execute(sql, (i1.get(), i2.get(), i3.get(), i4.get(), i5.get()))
  99. connect.commit()
  100. tkinter.messagebox.showinfo("提示", "数据添加成功")
  101. except:
  102. connect.rollback()
  103. # 关闭数据库连接,防止泄露
  104. connect.close()
  105. def add_Member():
  106. # 连接数据库
  107. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  108. # 创建光标
  109. cursor = connect.cursor()
  110. # 编写SQL语句
  111. sql = "insert into Member(Mnum,Mname,Mphone,Mdate,Mtotal,Mbalance,Mpassword) values(%s,%s,%s,%s,%s,%s,%s)"
  112. # 执行SQL语句,并且输出完成提示信息,否则回滚
  113. try:
  114. cursor.execute(sql, (m1.get(), m2.get(), m3.get(), m4.get(), m5.get(),m6.get(),m7.get()))
  115. connect.commit()
  116. tkinter.messagebox.showinfo("提示", "数据添加成功")
  117. except:
  118. connect.rollback()
  119. # 关闭数据库连接,防止泄露
  120. connect.close()
  121. def add_Trade():
  122. # 连接数据库
  123. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  124. # 创建光标
  125. cursor = connect.cursor()
  126. # 编写SQL语句
  127. sql = "insert into Trade(Tnum,Tdate,Snum,Gnum,Tamount,Tmoney,Mnum) values(%s,%s,%s,%s,%s,%s,%s)"
  128. # 执行SQL语句,并且输出完成提示信息,否则回滚
  129. try:
  130. cursor.execute(sql, (t1.get(), t2.get(), t3.get(), t4.get(), t5.get(),t6.get(),t7.get()))
  131. connect.commit()
  132. tkinter.messagebox.showinfo("提示", "数据添加成功")
  133. sql = "select Gstock from Goods where Gnum=%s"
  134. cursor.execute(sql, (t4.get()))
  135. result1=cursor.fetchall()
  136. sql = "select Galarm from Goods where Gnum=%s"
  137. cursor.execute(sql, (t4.get()))
  138. result2 = cursor.fetchall()
  139. if(result1<result2):
  140. tkinter.messagebox.showinfo(title='提示', message='该商品较少,需要补货')
  141. except:
  142. connect.rollback()
  143. # 关闭数据库连接,防止泄露
  144. connect.close()
  145. def add_Entry():
  146. # 连接数据库
  147. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  148. # 创建光标
  149. cursor = connect.cursor()
  150. # 编写SQL语句
  151. sql = "insert into Entry(Enum,Gnum,Eamount,Emoney,Vnum,Edate,Snum) values(%s,%s,%s,%s,%s,%s,%s)"
  152. # 执行SQL语句,并且输出完成提示信息,否则回滚
  153. try:
  154. cursor.execute(sql, (e1.get(), e2.get(), e3.get(), e4.get(), e5.get(),e6.get(),e7.get()))
  155. connect.commit()
  156. tkinter.messagebox.showinfo("提示", "数据添加成功")
  157. except:
  158. connect.rollback()
  159. # 关闭数据库连接,防止泄露
  160. connect.close()
  161. def add_Exits():
  162. # 连接数据库
  163. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  164. # 创建光标
  165. cursor = connect.cursor()
  166. # 编写SQL语句
  167. sql = "insert into Exits(Xnum,Gnum,Xamount,Xmoney,Xdate,Snum) values(%s,%s,%s,%s,%s,%s)"
  168. # 执行SQL语句,并且输出完成提示信息,否则回滚
  169. try:
  170. cursor.execute(sql, (x1.get(), x2.get(), x3.get(), x4.get(), x5.get(),x6.get()))
  171. connect.commit()
  172. tkinter.messagebox.showinfo("提示", "数据添加成功")
  173. except:
  174. connect.rollback()
  175. # 关闭数据库连接,防止泄露
  176. connect.close()
  177. ########################################################################################################################
  178. #数据库删除操作
  179. def delete_Goods():
  180. connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立连接
  181. cursor=connect.cursor()
  182. sql = "delete from Goods where Gnum=%s"
  183. try:
  184. cursor.execute(sql,(g10.get()))
  185. connect.commit()
  186. tkinter.messagebox.showinfo("提示","数据删除成功")
  187. except:
  188. connect.rollback()
  189. connect.close()
  190. def delete_Staff():
  191. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  192. cursor = connect.cursor()
  193. sql = "delete from Staff where Snum=%s"
  194. try:
  195. cursor.execute(sql, (s10.get()))
  196. connect.commit()
  197. tkinter.messagebox.showinfo("提示", "数据删除成功")
  198. except:
  199. connect.rollback()
  200. connect.close()
  201. def delete_Check1():
  202. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  203. cursor = connect.cursor()
  204. sql = "delete from Check where Cdate=%s"
  205. try:
  206. cursor.execute(sql, (c6.get()))
  207. connect.commit()
  208. tkinter.messagebox.showinfo("提示", "数据删除成功")
  209. except:
  210. connect.rollback()
  211. connect.close()
  212. def delete_Ware():
  213. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  214. cursor = connect.cursor()
  215. sql = "delete from Ware where Wnum=%s"
  216. try:
  217. cursor.execute(sql, (w5.get()))
  218. connect.commit()
  219. tkinter.messagebox.showinfo("提示", "数据删除成功")
  220. except:
  221. connect.rollback()
  222. connect.close()
  223. def delete_Vendor():
  224. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  225. cursor = connect.cursor()
  226. sql = "delete from Vendor where Vnum=%s"
  227. try:
  228. cursor.execute(sql, (v5.get()))
  229. connect.commit()
  230. tkinter.messagebox.showinfo("提示", "数据删除成功")
  231. except:
  232. connect.rollback()
  233. connect.close()
  234. def delete_Infer():
  235. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  236. cursor = connect.cursor()
  237. sql = "delete from Infer where Tnum=%s"
  238. try:
  239. cursor.execute(sql, (i6.get()))
  240. connect.commit()
  241. tkinter.messagebox.showinfo("提示", "数据删除成功")
  242. except:
  243. connect.rollback()
  244. connect.close()
  245. def delete_Member():
  246. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  247. cursor = connect.cursor()
  248. sql = "delete from Member where Mnum=%s"
  249. try:
  250. cursor.execute(sql, (m8.get()))
  251. connect.commit()
  252. tkinter.messagebox.showinfo("提示", "数据删除成功")
  253. except:
  254. connect.rollback()
  255. connect.close()
  256. def delete_Trade():
  257. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  258. cursor = connect.cursor()
  259. sql = "delete from Trade where Tnum=%s"
  260. try:
  261. cursor.execute(sql, (t8.get()))
  262. connect.commit()
  263. tkinter.messagebox.showinfo("提示", "数据删除成功")
  264. except:
  265. connect.rollback()
  266. connect.close()
  267. def delete_Entry():
  268. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  269. cursor = connect.cursor()
  270. sql = "delete from Entry where Enum=%s"
  271. try:
  272. cursor.execute(sql, (e8.get()))
  273. connect.commit()
  274. tkinter.messagebox.showinfo("提示", "数据删除成功")
  275. except:
  276. connect.rollback()
  277. connect.close()
  278. def delete_Exits():
  279. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  280. cursor = connect.cursor()
  281. sql = "delete from Exits where Xnum=%s"
  282. try:
  283. cursor.execute(sql, (x7.get()))
  284. connect.commit()
  285. tkinter.messagebox.showinfo("提示", "数据删除成功")
  286. except:
  287. connect.rollback()
  288. connect.close()
  289. #################################################################################################################################
  290. #数据库更新操作
  291. def update_Goods():
  292. connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立连接
  293. cursor = connect.cursor()
  294. sql="update Goods set Gbid=%s,Gprice=%s where Gnum=%s"
  295. try:
  296. cursor.execute(sql,(g11.get(),g12.get(),g13.get()))
  297. connect.commit()
  298. tkinter.messagebox.showinfo("提示","数据更新成功!")
  299. except:
  300. connect.rollback()
  301. connect.close()
  302. def update_Staff():
  303. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  304. cursor = connect.cursor()
  305. sql = "update Staff set Sphone=%s,Ssalary=%s where Snum=%s"
  306. try:
  307. cursor.execute(sql, (s11.get(), s12.get(), s13.get()))
  308. connect.commit()
  309. tkinter.messagebox.showinfo("提示", "数据更新成功!")
  310. except:
  311. connect.rollback()
  312. connect.close()
  313. def update_Ware():
  314. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  315. cursor = connect.cursor()
  316. sql = "update Ware set Wname=%s,Snum=%s where Wnum=%s"
  317. try:
  318. cursor.execute(sql, (w6.get(), w7.get(), w8.get()))
  319. connect.commit()
  320. tkinter.messagebox.showinfo("提示", "数据更新成功!")
  321. except:
  322. connect.rollback()
  323. connect.close()
  324. def update_Vendor():
  325. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  326. cursor = connect.cursor()
  327. sql = "update Vendor set Vphone=%s,Vplace=%s where Vnum=%s"
  328. try:
  329. cursor.execute(sql, (v6.get(), v7.get(), v8.get()))
  330. connect.commit()
  331. tkinter.messagebox.showinfo("提示", "数据更新成功!")
  332. except:
  333. connect.rollback()
  334. connect.close()
  335. def update_Infer():
  336. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  337. cursor = connect.cursor()
  338. sql = "update Infer set Iamount=%s,Imoney=%s where Tnum=%s"
  339. try:
  340. cursor.execute(sql, (i7.get(), i8.get(), i9.get()))
  341. connect.commit()
  342. tkinter.messagebox.showinfo("提示", "数据更新成功!")
  343. except:
  344. connect.rollback()
  345. connect.close()
  346. def update_Member():
  347. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  348. cursor = connect.cursor()
  349. sql = "update Member set Mphone=%s,Mpassword=%s where Mnum=%s"
  350. try:
  351. cursor.execute(sql, (m9.get(), m10.get(), m11.get()))
  352. connect.commit()
  353. tkinter.messagebox.showinfo("提示", "数据更新成功!")
  354. except:
  355. connect.rollback()
  356. connect.close()
  357. def update_Trade():
  358. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  359. cursor = connect.cursor()
  360. sql = "update Trade set Tmoney=%s,Tamount=%s where Tnum=%s"
  361. try:
  362. cursor.execute(sql, (t9.get(), t10.get(), t11.get()))
  363. connect.commit()
  364. tkinter.messagebox.showinfo("提示", "数据更新成功!")
  365. except:
  366. connect.rollback()
  367. connect.close()
  368. def update_Entry():
  369. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  370. cursor = connect.cursor()
  371. sql = "update Entry set Emoney=%s,Eamount=%s where Enum=%s"
  372. try:
  373. cursor.execute(sql, (e9.get(), e10.get(), e11.get()))
  374. connect.commit()
  375. tkinter.messagebox.showinfo("提示", "数据更新成功!")
  376. except:
  377. connect.rollback()
  378. connect.close()
  379. def update_Exits():
  380. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  381. cursor = connect.cursor()
  382. sql = "update Exits set Xmoney=%s,Xamount=%s where Xnum=%s"
  383. try:
  384. cursor.execute(sql, (x8.get(), x9.get(), x10.get()))
  385. connect.commit()
  386. tkinter.messagebox.showinfo("提示", "数据更新成功!")
  387. except:
  388. connect.rollback()
  389. connect.close()
  390. ################################################################################################################################
  391. #数据库条件查询
  392. def select_Goods():
  393. connect = pymysql.connect(host="localhost", user="root",password="mysql", database="sqlwork") # 建立连接
  394. cursor = connect.cursor()
  395. sql = "select * from Goods where Gnum=%s"
  396. try:
  397. cursor.execute(sql,(g14.get()))
  398. results = cursor.fetchall()
  399. tkinter.messagebox.showinfo(title='output',message=results)
  400. except:
  401. return
  402. connect.close()
  403. def select_Staff():
  404. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  405. cursor = connect.cursor()
  406. sql = "select * from Staff where Snum=%s"
  407. try:
  408. cursor.execute(sql, (s14.get()))
  409. results = cursor.fetchall()
  410. tkinter.messagebox.showinfo(title='output', message=results)
  411. except:
  412. return
  413. connect.close()
  414. def select_Check1():
  415. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  416. cursor = connect.cursor()
  417. sql = "select * from Check where Cdate=%s"
  418. try:
  419. cursor.execute(sql, (c7.get()))
  420. results = cursor.fetchall()
  421. tkinter.messagebox.showinfo(title='output', message=results)
  422. except:
  423. return
  424. connect.close()
  425. def select_Ware():
  426. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  427. cursor = connect.cursor()
  428. sql = "select * from Ware where Wnum=%s"
  429. try:
  430. cursor.execute(sql, (w9.get()))
  431. results = cursor.fetchall()
  432. tkinter.messagebox.showinfo(title='output', message=results)
  433. except:
  434. return
  435. connect.close()
  436. def select_Vendor():
  437. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  438. cursor = connect.cursor()
  439. sql = "select * from Vendor where Vnum=%s"
  440. try:
  441. cursor.execute(sql, (v9.get()))
  442. results = cursor.fetchall()
  443. tkinter.messagebox.showinfo(title='output', message=results)
  444. except:
  445. return
  446. connect.close()
  447. def select_Infer():
  448. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  449. cursor = connect.cursor()
  450. sql = "select * from Infer where Tnum=%s"
  451. try:
  452. cursor.execute(sql, (i10.get()))
  453. results = cursor.fetchall()
  454. tkinter.messagebox.showinfo(title='output', message=results)
  455. except:
  456. return
  457. connect.close()
  458. def select_Member():
  459. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  460. cursor = connect.cursor()
  461. sql = "select * from Member where Mnum=%s"
  462. try:
  463. cursor.execute(sql, (m12.get()))
  464. results = cursor.fetchall()
  465. tkinter.messagebox.showinfo(title='output', message=results)
  466. except:
  467. return
  468. connect.close()
  469. def select_Trade():
  470. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  471. cursor = connect.cursor()
  472. sql = "select * from Trade where Tnum=%s"
  473. try:
  474. cursor.execute(sql, (t12.get()))
  475. results = cursor.fetchall()
  476. tkinter.messagebox.showinfo(title='output', message=results)
  477. except:
  478. return
  479. connect.close()
  480. def select_Entry():
  481. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  482. cursor = connect.cursor()
  483. sql = "select * from Entry where Enum=%s"
  484. try:
  485. cursor.execute(sql, (e12.get()))
  486. results = cursor.fetchall()
  487. tkinter.messagebox.showinfo(title='output', message=results)
  488. except:
  489. return
  490. connect.close()
  491. def select_Exits():
  492. connect = pymysql.connect(host="localhost", user="root", password="mysql", database="sqlwork") # 建立连接
  493. cursor = connect.cursor()
  494. sql = "select * from Exits where Xnum=%s"
  495. try:
  496. cursor.execute(sql, (x11.get()))
  497. results = cursor.fetchall()
  498. tkinter.messagebox.showinfo(title='output', message=results)
  499. except:
  500. return
  501. connect.close()
  502. ######################################################################################################
  503. #添加商品界面
  504. def Goods_add():
  505. window_choice.destroy()
  506. #构建全集变量,方便上面的函数调用
  507. global window_function
  508. global g1,g2,g3,g4,g5,g6,g7,g8,g9
  509. #生成窗口
  510. window_function=tk.Tk()
  511. #窗口标题
  512. window_function.title("商城信息管理系统")
  513. #窗口大小
  514. window_function.geometry('400x700')
  515. #生成标签
  516. tk.Label(window_function, text="添加新商品", font=("黑体", 20)).grid(row=0,column=1,pady=10)
  517. tk.Label(window_function, text="请输入商品编号:").grid(row=1, column=0, padx=20, pady=20)
  518. tk.Label(window_function,text="请输入商品名称:").grid(row = 2,column =0,padx=20,pady=20)
  519. tk.Label(window_function,text="请输入商品类别:").grid(row = 3,column =0,padx=20,pady=20)
  520. tk.Label(window_function,text="请输入商品售价:").grid(row = 4,column =0,padx=20,pady=20)
  521. tk.Label(window_function, text="请输入商品成本:").grid(row=5, column=0, padx=20, pady=20)
  522. tk.Label(window_function, text="请输入库存量:").grid(row=6, column=0, padx=20, pady=20)
  523. tk.Label(window_function, text="请输入告警量:").grid(row=7, column=0, padx=20, pady=20)
  524. tk.Label(window_function, text="请输入计划库存量:").grid(row=8, column=0, padx=20, pady=20)
  525. tk.Label(window_function, text="请输入供货商编号:").grid(row=9, column=0, padx=20, pady=20)
  526. #定义变量记录输入信息
  527. g1 = tk.StringVar()
  528. g2 = tk.StringVar()
  529. g3 = tk.StringVar()
  530. g4 = tk.StringVar()
  531. g5 = tk.StringVar()
  532. g6 = tk.StringVar()
  533. g7 = tk.StringVar()
  534. g8 = tk.StringVar()
  535. g9 = tk.StringVar()
  536. #生成输入框
  537. entry1 = tk.Entry(window_function,show=None,textvariable=g1).grid(row = 1,column =1)
  538. entry2 = tk.Entry(window_function,show=None,textvariable=g2).grid(row = 2,column =1)
  539. entry3 = tk.Entry(window_function,show=None,textvariable=g3).grid(row = 3,column =1)
  540. entry4 = tk.Entry(window_function, show=None, textvariable=g4).grid(row=4, column=1)
  541. entry5 = tk.Entry(window_function, show=None, textvariable=g5).grid(row=5, column=1)
  542. entry6 = tk.Entry(window_function, show=None, textvariable=g6).grid(row=6, column=1)
  543. entry7 = tk.Entry(window_function, show=None, textvariable=g7).grid(row=7, column=1)
  544. entry8 = tk.Entry(window_function, show=None, textvariable=g8).grid(row=8, column=1)
  545. entry9 = tk.Entry(window_function, show=None, textvariable=g9).grid(row=9, column=1)
  546. #生成按钮
  547. button = tk.Button(window_function, text="添加", command=add_Goods).place(relx=0.3,rely=0.9)
  548. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5,rely=0.9)
  549. #显示窗口
  550. window_function.mainloop()
  551. #添加员工界面
  552. def Staff_add():
  553. window_choice.destroy()
  554. # 构建全集变量,方便上面的函数调用
  555. global window_function
  556. global s1, s2, s3, s4, s5, s6, s7, s8, s9
  557. # 生成窗口
  558. window_function = tk.Tk()
  559. # 窗口标题
  560. window_function.title("商城信息管理系统")
  561. # 窗口大小
  562. window_function.geometry('400x700')
  563. # 生成标签
  564. tk.Label(window_function, text="添加新员工", font=("黑体", 20)).grid(row=0, column=1, pady=10)
  565. tk.Label(window_function, text="请输入员工编号:").grid(row=1, column=0, padx=20, pady=20)
  566. tk.Label(window_function, text="请输入员工姓名:").grid(row=2, column=0, padx=20, pady=20)
  567. tk.Label(window_function, text="请输入员工性别:").grid(row=3, column=0, padx=20, pady=20)
  568. tk.Label(window_function, text="请输入员工年龄:").grid(row=4, column=0, padx=20, pady=20)
  569. tk.Label(window_function, text="请输入员工工龄:").grid(row=5, column=0, padx=20, pady=20)
  570. tk.Label(window_function, text="请输入员工电话:").grid(row=6, column=0, padx=20, pady=20)
  571. tk.Label(window_function, text="请输入身份证号:").grid(row=7, column=0, padx=20, pady=20)
  572. tk.Label(window_function, text="请输入员工工资:").grid(row=8, column=0, padx=20, pady=20)
  573. tk.Label(window_function, text="请输入健康码情况:").grid(row=9, column=0, padx=20, pady=20)
  574. # 定义变量记录输入信息
  575. s1 = tk.StringVar()
  576. s2 = tk.StringVar()
  577. s3 = tk.StringVar()
  578. s4 = tk.StringVar()
  579. s5 = tk.StringVar()
  580. s6 = tk.StringVar()
  581. s7 = tk.StringVar()
  582. s8 = tk.StringVar()
  583. s9 = tk.StringVar()
  584. # 生成输入框
  585. entry1 = tk.Entry(window_function, show=None, textvariable=s1).grid(row=1, column=1)
  586. entry2 = tk.Entry(window_function, show=None, textvariable=s2).grid(row=2, column=1)
  587. entry3 = tk.Entry(window_function, show=None, textvariable=s3).grid(row=3, column=1)
  588. entry4 = tk.Entry(window_function, show=None, textvariable=s4).grid(row=4, column=1)
  589. entry5 = tk.Entry(window_function, show=None, textvariable=s5).grid(row=5, column=1)
  590. entry6 = tk.Entry(window_function, show=None, textvariable=s6).grid(row=6, column=1)
  591. entry7 = tk.Entry(window_function, show=None, textvariable=s7).grid(row=7, column=1)
  592. entry8 = tk.Entry(window_function, show=None, textvariable=s8).grid(row=8, column=1)
  593. entry9 = tk.Entry(window_function, show=None, textvariable=s9).grid(row=9, column=1)
  594. # 生成按钮
  595. button = tk.Button(window_function, text="添加", command=add_Staff).place(relx=0.3, rely=0.9)
  596. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
  597. # 显示窗口
  598. window_function.mainloop()
  599. #添加安全问题界面
  600. def Check1_add():
  601. window_choice.destroy()
  602. # 构建全集变量,方便上面的函数调用
  603. global window_function
  604. global c1, c2, c3, c4
  605. # 生成窗口
  606. window_function = tk.Tk()
  607. # 窗口标题
  608. window_function.title("商城信息管理系统")
  609. # 窗口大小
  610. window_function.geometry('400x700')
  611. # 生成标签
  612. tk.Label(window_function, text="添加安全问题检查情况", font=("黑体", 20)).grid(row=0, column=0, pady=10)
  613. tk.Label(window_function, text="请输入检查日期:").grid(row=1, column=0, padx=20, pady=20)
  614. tk.Label(window_function, text="请输入顾客健康码情况:").grid(row=2, column=0, padx=20, pady=20)
  615. tk.Label(window_function, text="请输入灭火器情况:").grid(row=3, column=0, padx=20, pady=20)
  616. tk.Label(window_function, text="请输入灭火喷洒装置情况:").grid(row=4, column=0, padx=20, pady=20)
  617. # 定义变量记录输入信息
  618. c1 = tk.StringVar()
  619. c2 = tk.StringVar()
  620. c3 = tk.StringVar()
  621. c4 = tk.StringVar()
  622. # 生成输入框
  623. entry1 = tk.Entry(window_function, show=None, textvariable=c1).grid(row=1, column=1)
  624. entry2 = tk.Entry(window_function, show=None, textvariable=c2).grid(row=2, column=1)
  625. entry3 = tk.Entry(window_function, show=None, textvariable=c3).grid(row=3, column=1)
  626. entry4 = tk.Entry(window_function, show=None, textvariable=c4).grid(row=4, column=1)
  627. # 生成按钮
  628. button = tk.Button(window_function, text="添加", command=add_Check1).place(relx=0.3, rely=0.9)
  629. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
  630. # 显示窗口
  631. window_function.mainloop()
  632. #添加仓库界面
  633. def Ware_add():
  634. window_choice.destroy()
  635. # 构建全集变量,方便上面的函数调用
  636. global window_function
  637. global w1, w2, w3, w4
  638. # 生成窗口
  639. window_function = tk.Tk()
  640. # 窗口标题
  641. window_function.title("商城信息管理系统")
  642. # 窗口大小
  643. window_function.geometry('400x700')
  644. # 生成标签
  645. tk.Label(window_function, text="添加仓库信息", font=("黑体", 20)).grid(row=0, column=1, pady=10)
  646. tk.Label(window_function, text="请输入仓库编号:").grid(row=1, column=0, padx=20, pady=20)
  647. tk.Label(window_function, text="请输入仓库名称:").grid(row=2, column=0, padx=20, pady=20)
  648. tk.Label(window_function, text="请输入仓库地址:").grid(row=3, column=0, padx=20, pady=20)
  649. tk.Label(window_function, text="请输入仓库管理员编号:").grid(row=4, column=0, padx=20, pady=20)
  650. # 定义变量记录输入信息
  651. w1 = tk.StringVar()
  652. w2 = tk.StringVar()
  653. w3 = tk.StringVar()
  654. w4 = tk.StringVar()
  655. # 生成输入框
  656. entry1 = tk.Entry(window_function, show=None, textvariable=w1).grid(row=1, column=1)
  657. entry2 = tk.Entry(window_function, show=None, textvariable=w2).grid(row=2, column=1)
  658. entry3 = tk.Entry(window_function, show=None, textvariable=w3).grid(row=3, column=1)
  659. entry4 = tk.Entry(window_function, show=None, textvariable=w4).grid(row=4, column=1)
  660. # 生成按钮
  661. button = tk.Button(window_function, text="添加", command=add_Ware).place(relx=0.3, rely=0.9)
  662. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
  663. # 显示窗口
  664. window_function.mainloop()
  665. #添加供货商界面
  666. def Vendor_add():
  667. window_choice.destroy()
  668. # 构建全集变量,方便上面的函数调用
  669. global window_function
  670. global v1, v2, v3, v4
  671. # 生成窗口
  672. window_function = tk.Tk()
  673. # 窗口标题
  674. window_function.title("商城信息管理系统")
  675. # 窗口大小
  676. window_function.geometry('400x700')
  677. # 生成标签
  678. tk.Label(window_function, text="添加供货商信息", font=("黑体", 20)).grid(row=0, column=1, pady=10)
  679. tk.Label(window_function, text="请输入供货商编号:").grid(row=1, column=0, padx=20, pady=20)
  680. tk.Label(window_function, text="请输入供货商名称:").grid(row=2, column=0, padx=20, pady=20)
  681. tk.Label(window_function, text="请输入供货商电话:").grid(row=3, column=0, padx=20, pady=20)
  682. tk.Label(window_function, text="请输入供货商地址:").grid(row=4, column=0, padx=20, pady=20)
  683. # 定义变量记录输入信息
  684. v1 = tk.StringVar()
  685. v2 = tk.StringVar()
  686. v3 = tk.StringVar()
  687. v4 = tk.StringVar()
  688. # 生成输入框
  689. entry1 = tk.Entry(window_function, show=None, textvariable=v1).grid(row=1, column=1)
  690. entry2 = tk.Entry(window_function, show=None, textvariable=v2).grid(row=2, column=1)
  691. entry3 = tk.Entry(window_function, show=None, textvariable=v3).grid(row=3, column=1)
  692. entry4 = tk.Entry(window_function, show=None, textvariable=v4).grid(row=4, column=1)
  693. # 生成按钮
  694. button = tk.Button(window_function, text="添加", command=add_Vendor).place(relx=0.3, rely=0.9)
  695. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
  696. # 显示窗口
  697. window_function.mainloop()
  698. #添加退货信息界面
  699. def Infer_add():
  700. window_choice.destroy()
  701. # 构建全集变量,方便上面的函数调用
  702. global window_function
  703. global i1, i2, i3, i4,i5
  704. # 生成窗口
  705. window_function = tk.Tk()
  706. # 窗口标题
  707. window_function.title("商城信息管理系统")
  708. # 窗口大小
  709. window_function.geometry('400x700')
  710. # 生成标签
  711. tk.Label(window_function, text="添加退货信息", font=("黑体", 20)).grid(row=0, column=1, pady=10)
  712. tk.Label(window_function, text="请输入交易流水号:").grid(row=1, column=0, padx=20, pady=20)
  713. tk.Label(window_function, text="请输入商品编号:").grid(row=2, column=0, padx=20, pady=20)
  714. tk.Label(window_function, text="请输入退货数量:").grid(row=3, column=0, padx=20, pady=20)
  715. tk.Label(window_function, text="请输入退款金额:").grid(row=4, column=0, padx=20, pady=20)
  716. tk.Label(window_function, text="请输入退货日期:").grid(row=5, column=0, padx=20, pady=20)
  717. # 定义变量记录输入信息
  718. i1 = tk.StringVar()
  719. i2 = tk.StringVar()
  720. i3 = tk.StringVar()
  721. i4 = tk.StringVar()
  722. i5 = tk.StringVar()
  723. # 生成输入框
  724. entry1 = tk.Entry(window_function, show=None, textvariable=i1).grid(row=1, column=1)
  725. entry2 = tk.Entry(window_function, show=None, textvariable=i2).grid(row=2, column=1)
  726. entry3 = tk.Entry(window_function, show=None, textvariable=i3).grid(row=3, column=1)
  727. entry4 = tk.Entry(window_function, show=None, textvariable=i4).grid(row=4, column=1)
  728. entry5 = tk.Entry(window_function, show=None, textvariable=i5).grid(row=5, column=1)
  729. # 生成按钮
  730. button = tk.Button(window_function, text="添加", command=add_Infer).place(relx=0.3, rely=0.9)
  731. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
  732. # 显示窗口
  733. window_function.mainloop()
  734. #添加会员表界面
  735. def Member_add():
  736. window_choice.destroy()
  737. # 构建全集变量,方便上面的函数调用
  738. global window_function
  739. global m1, m2, m3, m4, m5, m6, m7
  740. # 生成窗口
  741. window_function = tk.Tk()
  742. # 窗口标题
  743. window_function.title("商城信息管理系统")
  744. # 窗口大小
  745. window_function.geometry('400x700')
  746. # 生成标签
  747. tk.Label(window_function, text="添加新会员", font=("黑体", 20)).grid(row=0, column=1, pady=10)
  748. tk.Label(window_function, text="请输入会员卡号:").grid(row=1, column=0, padx=20, pady=20)
  749. tk.Label(window_function, text="请输入会员姓名:").grid(row=2, column=0, padx=20, pady=20)
  750. tk.Label(window_function, text="请输入会员电话:").grid(row=3, column=0, padx=20, pady=20)
  751. tk.Label(window_function, text="请输入注册日期:").grid(row=4, column=0, padx=20, pady=20)
  752. tk.Label(window_function, text="请输入累计金额:").grid(row=5, column=0, padx=20, pady=20)
  753. tk.Label(window_function, text="请输入卡内余额:").grid(row=6, column=0, padx=20, pady=20)
  754. tk.Label(window_function, text="请输入会员密码:").grid(row=7, column=0, padx=20, pady=20)
  755. # 定义变量记录输入信息
  756. m1 = tk.StringVar()
  757. m2 = tk.StringVar()
  758. m3 = tk.StringVar()
  759. m4 = tk.StringVar()
  760. m5 = tk.StringVar()
  761. m6 = tk.StringVar()
  762. m7 = tk.StringVar()
  763. # 生成输入框
  764. entry1 = tk.Entry(window_function, show=None, textvariable=m1).grid(row=1, column=1)
  765. entry2 = tk.Entry(window_function, show=None, textvariable=m2).grid(row=2, column=1)
  766. entry3 = tk.Entry(window_function, show=None, textvariable=m3).grid(row=3, column=1)
  767. entry4 = tk.Entry(window_function, show=None, textvariable=m4).grid(row=4, column=1)
  768. entry5 = tk.Entry(window_function, show=None, textvariable=m5).grid(row=5, column=1)
  769. entry6 = tk.Entry(window_function, show=None, textvariable=m6).grid(row=6, column=1)
  770. entry7 = tk.Entry(window_function, show=None, textvariable=m7).grid(row=7, column=1)
  771. # 生成按钮
  772. button = tk.Button(window_function, text="添加", command=add_Member).place(relx=0.3, rely=0.9)
  773. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
  774. # 显示窗口
  775. window_function.mainloop()
  776. #添加商品交易界面
  777. def Trade_add():
  778. window_choice.destroy()
  779. # 构建全集变量,方便上面的函数调用
  780. global window_function
  781. global t1, t2, t3, t4, t5, t6, t7
  782. # 生成窗口
  783. window_function = tk.Tk()
  784. # 窗口标题
  785. window_function.title("商城信息管理系统")
  786. # 窗口大小
  787. window_function.geometry('400x700')
  788. # 生成标签
  789. tk.Label(window_function, text="添加商品交易信息", font=("黑体", 20)).grid(row=0, column=1, pady=10)
  790. tk.Label(window_function, text="请输入交易流水号:").grid(row=1, column=0, padx=20, pady=20)
  791. tk.Label(window_function, text="请输入交易日期:").grid(row=2, column=0, padx=20, pady=20)
  792. tk.Label(window_function, text="请输入员工编号:").grid(row=3, column=0, padx=20, pady=20)
  793. tk.Label(window_function, text="请输入商品编号:").grid(row=4, column=0, padx=20, pady=20)
  794. tk.Label(window_function, text="请输入交易数量:").grid(row=5, column=0, padx=20, pady=20)
  795. tk.Label(window_function, text="请输入交易金额:").grid(row=6, column=0, padx=20, pady=20)
  796. tk.Label(window_function, text="请输入会员卡号:").grid(row=7, column=0, padx=20, pady=20)
  797. # 定义变量记录输入信息
  798. t1 = tk.StringVar()
  799. t2 = tk.StringVar()
  800. t3 = tk.StringVar()
  801. t4 = tk.StringVar()
  802. t5 = tk.StringVar()
  803. t6 = tk.StringVar()
  804. t7 = tk.StringVar()
  805. # 生成输入框
  806. entry1 = tk.Entry(window_function, show=None, textvariable=t1).grid(row=1, column=1)
  807. entry2 = tk.Entry(window_function, show=None, textvariable=t2).grid(row=2, column=1)
  808. entry3 = tk.Entry(window_function, show=None, textvariable=t3).grid(row=3, column=1)
  809. entry4 = tk.Entry(window_function, show=None, textvariable=t4).grid(row=4, column=1)
  810. entry5 = tk.Entry(window_function, show=None, textvariable=t5).grid(row=5, column=1)
  811. entry6 = tk.Entry(window_function, show=None, textvariable=t6).grid(row=6, column=1)
  812. entry7 = tk.Entry(window_function, show=None, textvariable=t7).grid(row=7, column=1)
  813. # 生成按钮
  814. button = tk.Button(window_function, text="添加", command=add_Trade).place(relx=0.3, rely=0.9)
  815. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
  816. # 显示窗口
  817. window_function.mainloop()
  818. #添加入库信息界面
  819. def Entry_add():
  820. window_choice.destroy()
  821. # 构建全集变量,方便上面的函数调用
  822. global window_function
  823. global e1, e2, e3, e4, e5, e6, e7
  824. # 生成窗口
  825. window_function = tk.Tk()
  826. # 窗口标题
  827. window_function.title("商城信息管理系统")
  828. # 窗口大小
  829. window_function.geometry('400x700')
  830. # 生成标签
  831. tk.Label(window_function, text="添加入库信息", font=("黑体", 20)).grid(row=0, column=1, pady=10)
  832. tk.Label(window_function, text="请输入入库单编号:").grid(row=1, column=0, padx=20, pady=20)
  833. tk.Label(window_function, text="请输入商品编号:").grid(row=2, column=0, padx=20, pady=20)
  834. tk.Label(window_function, text="请输入入库量:").grid(row=3, column=0, padx=20, pady=20)
  835. tk.Label(window_function, text="请输入总金额:").grid(row=4, column=0, padx=20, pady=20)
  836. tk.Label(window_function, text="请输入供货商编号:").grid(row=5, column=0, padx=20, pady=20)
  837. tk.Label(window_function, text="请输入入库日期:").grid(row=6, column=0, padx=20, pady=20)
  838. tk.Label(window_function, text="请输入入库员编号:").grid(row=7, column=0, padx=20, pady=20)
  839. # 定义变量记录输入信息
  840. e1 = tk.StringVar()
  841. e2 = tk.StringVar()
  842. e3 = tk.StringVar()
  843. e4 = tk.StringVar()
  844. e5 = tk.StringVar()
  845. e6 = tk.StringVar()
  846. e7 = tk.StringVar()
  847. # 生成输入框
  848. entry1 = tk.Entry(window_function, show=None, textvariable=e1).grid(row=1, column=1)
  849. entry2 = tk.Entry(window_function, show=None, textvariable=e2).grid(row=2, column=1)
  850. entry3 = tk.Entry(window_function, show=None, textvariable=e3).grid(row=3, column=1)
  851. entry4 = tk.Entry(window_function, show=None, textvariable=e4).grid(row=4, column=1)
  852. entry5 = tk.Entry(window_function, show=None, textvariable=e5).grid(row=5, column=1)
  853. entry6 = tk.Entry(window_function, show=None, textvariable=e6).grid(row=6, column=1)
  854. entry7 = tk.Entry(window_function, show=None, textvariable=e7).grid(row=7, column=1)
  855. # 生成按钮
  856. button = tk.Button(window_function, text="添加", command=add_Entry).place(relx=0.3, rely=0.9)
  857. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
  858. # 显示窗口
  859. window_function.mainloop()
  860. #添加出库信息界面
  861. def Exits_add():
  862. window_choice.destroy()
  863. # 构建全集变量,方便上面的函数调用
  864. global window_function
  865. global x1, x2, x3, x4, x5, x6
  866. # 生成窗口
  867. window_function = tk.Tk()
  868. # 窗口标题
  869. window_function.title("商城信息管理系统")
  870. # 窗口大小
  871. window_function.geometry('400x700')
  872. # 生成标签
  873. tk.Label(window_function, text="添加出库信息", font=("黑体", 20)).grid(row=0, column=1, pady=10)
  874. tk.Label(window_function, text="请输入出库单编号:").grid(row=1, column=0, padx=20, pady=20)
  875. tk.Label(window_function, text="请输入商品编号:").grid(row=2, column=0, padx=20, pady=20)
  876. tk.Label(window_function, text="请输入出库量:").grid(row=3, column=0, padx=20, pady=20)
  877. tk.Label(window_function, text="请输入总金额:").grid(row=4, column=0, padx=20, pady=20)
  878. tk.Label(window_function, text="请输入出库日期:").grid(row=5, column=0, padx=20, pady=20)
  879. tk.Label(window_function, text="请输入出库员编号:").grid(row=6, column=0, padx=20, pady=20)
  880. # 定义变量记录输入信息
  881. x1 = tk.StringVar()
  882. x2 = tk.StringVar()
  883. x3 = tk.StringVar()
  884. x4 = tk.StringVar()
  885. x5 = tk.StringVar()
  886. x6 = tk.StringVar()
  887. # 生成输入框
  888. entry1 = tk.Entry(window_function, show=None, textvariable=x1).grid(row=1, column=1)
  889. entry2 = tk.Entry(window_function, show=None, textvariable=x2).grid(row=2, column=1)
  890. entry3 = tk.Entry(window_function, show=None, textvariable=x3).grid(row=3, column=1)
  891. entry4 = tk.Entry(window_function, show=None, textvariable=x4).grid(row=4, column=1)
  892. entry5 = tk.Entry(window_function, show=None, textvariable=x5).grid(row=5, column=1)
  893. entry6 = tk.Entry(window_function, show=None, textvariable=x6).grid(row=6, column=1)
  894. # 生成按钮
  895. button = tk.Button(window_function, text="添加", command=add_Exits).place(relx=0.3, rely=0.9)
  896. button2 = tk.Button(window_function, text="返回", command=change_add).place(relx=0.5, rely=0.9)
  897. # 显示窗口
  898. window_function.mainloop()
  899. ############################################################################################
  900. #删除商品界面
  901. def Goods_delete():
  902. window_choice.destroy()
  903. global window_function
  904. global g10
  905. window_function=tk.Tk()
  906. window_function.title("商城信息管理系统")
  907. window_function.geometry('500x400')
  908. tk.Label(window_function, text="删除商品", font=("黑体", 20)).grid(row=0,column=1,pady=20)
  909. tk.Label(window_function,text="请输入商品编号:").grid(row = 1,column =0,padx=20)
  910. g10 =tk.StringVar()
  911. entry1=tk.Entry(window_function,show=None,textvariable=g10).grid(row = 1,column =1,pady=40)
  912. button = tk.Button(window_function, text="删除", command=delete_Goods,anchor = 's').place(relx=0.2,rely=0.5)
  913. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4,rely=0.5)
  914. window_function.mainloop()
  915. # 删除员工界面
  916. def Staff_delete():
  917. window_choice.destroy()
  918. global window_function
  919. global s10
  920. window_function = tk.Tk()
  921. window_function.title("商城信息管理系统")
  922. window_function.geometry('500x400')
  923. tk.Label(window_function, text="删除员工", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  924. tk.Label(window_function, text="请输入员工编号:").grid(row=1, column=0, padx=20)
  925. s10 = tk.StringVar()
  926. entry1 = tk.Entry(window_function, show=None, textvariable=s10).grid(row=1, column=1, pady=40)
  927. button = tk.Button(window_function, text="删除", command=delete_Staff, anchor='s').place(relx=0.2, rely=0.5)
  928. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
  929. window_function.mainloop()
  930. # 删除安全问题界面
  931. def Check1_delete():
  932. window_choice.destroy()
  933. global window_function
  934. global c6
  935. window_function = tk.Tk()
  936. window_function.title("商城信息管理系统")
  937. window_function.geometry('500x400')
  938. tk.Label(window_function, text="删除检查安全记录", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  939. tk.Label(window_function, text="请输入检查日期:").grid(row=1, column=0, padx=20)
  940. c6 = tk.StringVar()
  941. entry1 = tk.Entry(window_function, show=None, textvariable=c6).grid(row=1, column=1, pady=40)
  942. button = tk.Button(window_function, text="删除", command=delete_Check1, anchor='s').place(relx=0.2, rely=0.5)
  943. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
  944. window_function.mainloop()
  945. # 删除仓库界面
  946. def Ware_delete():
  947. window_choice.destroy()
  948. global window_function
  949. global w5
  950. window_function = tk.Tk()
  951. window_function.title("商城信息管理系统")
  952. window_function.geometry('500x400')
  953. tk.Label(window_function, text="删除仓库", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  954. tk.Label(window_function, text="请输入仓库编号:").grid(row=1, column=0, padx=20)
  955. w5 = tk.StringVar()
  956. entry1 = tk.Entry(window_function, show=None, textvariable=w5).grid(row=1, column=1, pady=40)
  957. button = tk.Button(window_function, text="删除", command=delete_Ware, anchor='s').place(relx=0.2, rely=0.5)
  958. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
  959. window_function.mainloop()
  960. # 删除供货商界面
  961. def Vendor_delete():
  962. window_choice.destroy()
  963. global window_function
  964. global v5
  965. window_function = tk.Tk()
  966. window_function.title("商城信息管理系统")
  967. window_function.geometry('500x400')
  968. tk.Label(window_function, text="删除供货商", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  969. tk.Label(window_function, text="请输入供货商编号:").grid(row=1, column=0, padx=20)
  970. v5 = tk.StringVar()
  971. entry1 = tk.Entry(window_function, show=None, textvariable=v5).grid(row=1, column=1, pady=40)
  972. button = tk.Button(window_function, text="删除", command=delete_Vendor, anchor='s').place(relx=0.2, rely=0.5)
  973. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
  974. window_function.mainloop()
  975. # 删除退货信息界面
  976. def Infer_delete():
  977. window_choice.destroy()
  978. global window_function
  979. global i6
  980. window_function = tk.Tk()
  981. window_function.title("商城信息管理系统")
  982. window_function.geometry('500x400')
  983. tk.Label(window_function, text="删除退货信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  984. tk.Label(window_function, text="请输入交易流水号:").grid(row=1, column=0, padx=20)
  985. i6 = tk.StringVar()
  986. entry1 = tk.Entry(window_function, show=None, textvariable=i6).grid(row=1, column=1, pady=40)
  987. button = tk.Button(window_function, text="删除", command=delete_Infer, anchor='s').place(relx=0.2, rely=0.5)
  988. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
  989. window_function.mainloop()
  990. # 删除会员表界面
  991. def Member_delete():
  992. window_choice.destroy()
  993. global window_function
  994. global m8
  995. window_function = tk.Tk()
  996. window_function.title("商城信息管理系统")
  997. window_function.geometry('500x400')
  998. tk.Label(window_function, text="删除会员信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  999. tk.Label(window_function, text="请输入会员卡号:").grid(row=1, column=0, padx=20)
  1000. m8 = tk.StringVar()
  1001. entry1 = tk.Entry(window_function, show=None, textvariable=m8).grid(row=1, column=1, pady=40)
  1002. button = tk.Button(window_function, text="删除", command=delete_Member, anchor='s').place(relx=0.2, rely=0.5)
  1003. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
  1004. window_function.mainloop()
  1005. #删除商品交易记录界面
  1006. def Trade_delete():
  1007. window_choice.destroy()
  1008. global window_function
  1009. global t8
  1010. window_function = tk.Tk()
  1011. window_function.title("商城信息管理系统")
  1012. window_function.geometry('500x400')
  1013. tk.Label(window_function, text="删除商品交易记录", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1014. tk.Label(window_function, text="请输入交易流水号:").grid(row=1, column=0, padx=20)
  1015. t8 = tk.StringVar()
  1016. entry1 = tk.Entry(window_function, show=None, textvariable=t8).grid(row=1, column=1, pady=40)
  1017. button = tk.Button(window_function, text="删除", command=delete_Trade, anchor='s').place(relx=0.2, rely=0.5)
  1018. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
  1019. window_function.mainloop()
  1020. #删除入库信息界面
  1021. def Entry_delete():
  1022. window_choice.destroy()
  1023. global window_function
  1024. global e8
  1025. window_function = tk.Tk()
  1026. window_function.title("商城信息管理系统")
  1027. window_function.geometry('500x400')
  1028. tk.Label(window_function, text="删除入库信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1029. tk.Label(window_function, text="请输入入库单编号:").grid(row=1, column=0, padx=20)
  1030. e8 = tk.StringVar()
  1031. entry1 = tk.Entry(window_function, show=None, textvariable=e8).grid(row=1, column=1, pady=40)
  1032. button = tk.Button(window_function, text="删除", command=delete_Entry, anchor='s').place(relx=0.2, rely=0.5)
  1033. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
  1034. window_function.mainloop()
  1035. #删除出库信息界面
  1036. def Exits_delete():
  1037. window_choice.destroy()
  1038. global window_function
  1039. global x7
  1040. window_function = tk.Tk()
  1041. window_function.title("商城信息管理系统")
  1042. window_function.geometry('500x400')
  1043. tk.Label(window_function, text="删除出库信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1044. tk.Label(window_function, text="请输入出库单编号:").grid(row=1, column=0, padx=20)
  1045. x7 = tk.StringVar()
  1046. entry1 = tk.Entry(window_function, show=None, textvariable=x7).grid(row=1, column=1, pady=40)
  1047. button = tk.Button(window_function, text="删除", command=delete_Exits, anchor='s').place(relx=0.2, rely=0.5)
  1048. button2 = tk.Button(window_function, text="返回", command=change_delete).place(relx=0.4, rely=0.5)
  1049. window_function.mainloop()
  1050. #####################################################################################
  1051. #更新商品信息界面
  1052. def Goods_update():
  1053. window_choice.destroy()
  1054. global window_function
  1055. global g11,g12,g13
  1056. window_function=tk.Tk()
  1057. window_function.title("商城信息管理系统")
  1058. window_function.geometry('500x400')
  1059. tk.Label(window_function, text="更新商品信息", font=("黑体", 20)).grid(row=0,column=1,pady=20)
  1060. tk.Label(window_function,text="请输入商品进价:").grid(row=1,column =0,padx=20,pady=20)
  1061. tk.Label(window_function,text="请输入商品售价:").grid(row=2, column=0, padx=20, pady=20)
  1062. tk.Label(window_function,text="请输入商品编号:").grid(row=3,column =0,padx=20,pady=20)
  1063. g11=tk.StringVar()
  1064. g12=tk.StringVar()
  1065. g13=tk.StringVar()
  1066. entry1=tk.Entry(window_function,show=None,textvariable=g11).grid(row=1,column =1)
  1067. entry2=tk.Entry(window_function,show=None,textvariable=g12).grid(row=2,column =1)
  1068. entry3 = tk.Entry(window_function, show=None, textvariable=g13).grid(row=3, column=1)
  1069. button = tk.Button(window_function, text="更新", command=update_Goods).place(relx=0.3,rely=0.7)
  1070. button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5,rely=0.7)
  1071. window_function.mainloop()
  1072. # 更新员工界面
  1073. def Staff_update():
  1074. window_choice.destroy()
  1075. global window_function
  1076. global s11, s12, s13
  1077. window_function = tk.Tk()
  1078. window_function.title("商城信息管理系统")
  1079. window_function.geometry('500x400')
  1080. tk.Label(window_function, text="更新员工信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1081. tk.Label(window_function, text="请输入员工电话:").grid(row=1, column=0, padx=20, pady=20)
  1082. tk.Label(window_function, text="请输入员工工资:").grid(row=2, column=0, padx=20, pady=20)
  1083. tk.Label(window_function, text="请输入员工编号:").grid(row=3, column=0, padx=20, pady=20)
  1084. s11 = tk.StringVar()
  1085. s12 = tk.StringVar()
  1086. s13 = tk.StringVar()
  1087. entry1 = tk.Entry(window_function, show=None, textvariable=s11).grid(row=1, column=1)
  1088. entry2 = tk.Entry(window_function, show=None, textvariable=s12).grid(row=2, column=1)
  1089. entry3 = tk.Entry(window_function, show=None, textvariable=s13).grid(row=3, column=1)
  1090. button = tk.Button(window_function, text="更新", command=update_Staff).place(relx=0.3, rely=0.7)
  1091. button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
  1092. window_function.mainloop()
  1093. # 更新仓库界面
  1094. def Ware_update():
  1095. window_choice.destroy()
  1096. global window_function
  1097. global w6,w7,w8
  1098. window_function = tk.Tk()
  1099. window_function.title("商城信息管理系统")
  1100. window_function.geometry('500x400')
  1101. tk.Label(window_function, text="更新仓库信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1102. tk.Label(window_function, text="请输入仓库名称:").grid(row=1, column=0, padx=20, pady=20)
  1103. tk.Label(window_function, text="请输入仓库管理员编号:").grid(row=2, column=0, padx=20, pady=20)
  1104. tk.Label(window_function, text="请输入仓库编号:").grid(row=3, column=0, padx=20, pady=20)
  1105. w6 = tk.StringVar()
  1106. w7 = tk.StringVar()
  1107. w8 = tk.StringVar()
  1108. entry1 = tk.Entry(window_function, show=None, textvariable=w6).grid(row=1, column=1)
  1109. entry2 = tk.Entry(window_function, show=None, textvariable=w7).grid(row=2, column=1)
  1110. entry3 = tk.Entry(window_function, show=None, textvariable=w8).grid(row=3, column=1)
  1111. button = tk.Button(window_function, text="更新", command=update_Ware).place(relx=0.3, rely=0.7)
  1112. button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
  1113. window_function.mainloop()
  1114. # 更新供货商界面
  1115. def Vendor_update():
  1116. window_choice.destroy()
  1117. global window_function
  1118. global v6, v7, v8
  1119. window_function = tk.Tk()
  1120. window_function.title("商城信息管理系统")
  1121. window_function.geometry('500x400')
  1122. tk.Label(window_function, text="更新供货商信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1123. tk.Label(window_function, text="请输入供货商电话:").grid(row=1, column=0, padx=20, pady=20)
  1124. tk.Label(window_function, text="请输入供货商地址:").grid(row=2, column=0, padx=20, pady=20)
  1125. tk.Label(window_function, text="请输入供货商编号:").grid(row=3, column=0, padx=20, pady=20)
  1126. v6 = tk.StringVar()
  1127. v7 = tk.StringVar()
  1128. v8 = tk.StringVar()
  1129. entry1 = tk.Entry(window_function, show=None, textvariable=v6).grid(row=1, column=1)
  1130. entry2 = tk.Entry(window_function, show=None, textvariable=v7).grid(row=2, column=1)
  1131. entry3 = tk.Entry(window_function, show=None, textvariable=v8).grid(row=3, column=1)
  1132. button = tk.Button(window_function, text="更新", command=update_Vendor).place(relx=0.3, rely=0.7)
  1133. button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
  1134. window_function.mainloop()
  1135. # 更新退货信息界面
  1136. def Infer_update():
  1137. window_choice.destroy()
  1138. global window_function
  1139. global i7,i8,i9
  1140. window_function = tk.Tk()
  1141. window_function.title("商城信息管理系统")
  1142. window_function.geometry('500x400')
  1143. tk.Label(window_function, text="更新供货商信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1144. tk.Label(window_function, text="请输入退货数量:").grid(row=1, column=0, padx=20, pady=20)
  1145. tk.Label(window_function, text="请输入退款金额:").grid(row=2, column=0, padx=20, pady=20)
  1146. tk.Label(window_function, text="请输入交易流水号编号:").grid(row=3, column=0, padx=20, pady=20)
  1147. i7 = tk.StringVar()
  1148. i8 = tk.StringVar()
  1149. i9 = tk.StringVar()
  1150. entry1 = tk.Entry(window_function, show=None, textvariable=i7).grid(row=1, column=1)
  1151. entry2 = tk.Entry(window_function, show=None, textvariable=i8).grid(row=2, column=1)
  1152. entry3 = tk.Entry(window_function, show=None, textvariable=i9).grid(row=3, column=1)
  1153. button = tk.Button(window_function, text="更新", command=update_Infer).place(relx=0.3, rely=0.7)
  1154. button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
  1155. window_function.mainloop()
  1156. # 更新会员表界面
  1157. def Member_update():
  1158. window_choice.destroy()
  1159. global window_function
  1160. global m9,m10,m11
  1161. window_function = tk.Tk()
  1162. window_function.title("商城信息管理系统")
  1163. window_function.geometry('500x400')
  1164. tk.Label(window_function, text="更新供货商信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1165. tk.Label(window_function, text="请输入会员电话:").grid(row=1, column=0, padx=20, pady=20)
  1166. tk.Label(window_function, text="请输入会员密码:").grid(row=2, column=0, padx=20, pady=20)
  1167. tk.Label(window_function, text="请输入会员卡号编号:").grid(row=3, column=0, padx=20, pady=20)
  1168. m9 = tk.StringVar()
  1169. m10 = tk.StringVar()
  1170. m11 = tk.StringVar()
  1171. entry1 = tk.Entry(window_function, show=None, textvariable=m9).grid(row=1, column=1)
  1172. entry2 = tk.Entry(window_function, show=None, textvariable=m10).grid(row=2, column=1)
  1173. entry3 = tk.Entry(window_function, show=None, textvariable=m11).grid(row=3, column=1)
  1174. button = tk.Button(window_function, text="更新", command=update_Member).place(relx=0.3, rely=0.7)
  1175. button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
  1176. window_function.mainloop()
  1177. #更新商品交易记录界面
  1178. def Trade_update():
  1179. window_choice.destroy()
  1180. global window_function
  1181. global t9,t10,t11
  1182. window_function = tk.Tk()
  1183. window_function.title("商城信息管理系统")
  1184. window_function.geometry('500x400')
  1185. tk.Label(window_function, text="更新商品交易信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1186. tk.Label(window_function, text="请输入交易金额:").grid(row=1, column=0, padx=20, pady=20)
  1187. tk.Label(window_function, text="请输入交易数量:").grid(row=2, column=0, padx=20, pady=20)
  1188. tk.Label(window_function, text="请输入交易流水号:").grid(row=3, column=0, padx=20, pady=20)
  1189. t9 = tk.StringVar()
  1190. t10 = tk.StringVar()
  1191. t11 = tk.StringVar()
  1192. entry1 = tk.Entry(window_function, show=None, textvariable=t9).grid(row=1, column=1)
  1193. entry2 = tk.Entry(window_function, show=None, textvariable=t10).grid(row=2, column=1)
  1194. entry3 = tk.Entry(window_function, show=None, textvariable=t11).grid(row=3, column=1)
  1195. button = tk.Button(window_function, text="更新", command=update_Trade).place(relx=0.3, rely=0.7)
  1196. button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
  1197. window_function.mainloop()
  1198. #更新入库信息界面
  1199. def Entry_update():
  1200. window_choice.destroy()
  1201. global window_function
  1202. global e9,e10,e11
  1203. window_function = tk.Tk()
  1204. window_function.title("商城信息管理系统")
  1205. window_function.geometry('500x400')
  1206. tk.Label(window_function, text="更新供货商信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1207. tk.Label(window_function, text="请输入总金额:").grid(row=1, column=0, padx=20, pady=20)
  1208. tk.Label(window_function, text="请输入入库量:").grid(row=2, column=0, padx=20, pady=20)
  1209. tk.Label(window_function, text="请输入入库单编号:").grid(row=3, column=0, padx=20, pady=20)
  1210. e9 = tk.StringVar()
  1211. e10 = tk.StringVar()
  1212. e11= tk.StringVar()
  1213. entry1 = tk.Entry(window_function, show=None, textvariable=e9).grid(row=1, column=1)
  1214. entry2 = tk.Entry(window_function, show=None, textvariable=e10).grid(row=2, column=1)
  1215. entry3 = tk.Entry(window_function, show=None, textvariable=e11).grid(row=3, column=1)
  1216. button = tk.Button(window_function, text="更新", command=update_Entry).place(relx=0.3, rely=0.7)
  1217. button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
  1218. window_function.mainloop()
  1219. #更新出库信息界面
  1220. def Exits_update():
  1221. window_choice.destroy()
  1222. global window_function
  1223. global x8,x9,x10
  1224. window_function = tk.Tk()
  1225. window_function.title("商城信息管理系统")
  1226. window_function.geometry('500x400')
  1227. tk.Label(window_function, text="更新供货商信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1228. tk.Label(window_function, text="请输入总金额:").grid(row=1, column=0, padx=20, pady=20)
  1229. tk.Label(window_function, text="请输入出库量:").grid(row=2, column=0, padx=20, pady=20)
  1230. tk.Label(window_function, text="请输入出库单编号:").grid(row=3, column=0, padx=20, pady=20)
  1231. x8 = tk.StringVar()
  1232. x9 = tk.StringVar()
  1233. x10 = tk.StringVar()
  1234. entry1 = tk.Entry(window_function, show=None, textvariable=x8).grid(row=1, column=1)
  1235. entry2 = tk.Entry(window_function, show=None, textvariable=x9).grid(row=2, column=1)
  1236. entry3 = tk.Entry(window_function, show=None, textvariable=x10).grid(row=3, column=1)
  1237. button = tk.Button(window_function, text="更新", command=update_Exits).place(relx=0.3, rely=0.7)
  1238. button2 = tk.Button(window_function, text="返回", command=change_update).place(relx=0.5, rely=0.7)
  1239. window_function.mainloop()
  1240. #############################################################################################################################
  1241. #条件查找商品界面
  1242. def Goods_select():
  1243. window_choice.destroy()
  1244. global window_function
  1245. global g14
  1246. window_function=tk.Tk()
  1247. window_function.title("商城信息管理系统")
  1248. window_function.geometry('500x400')
  1249. tk.Label(window_function, text="查找商品信息", font=("黑体", 20)).grid(row=0,column=1,pady=20)
  1250. tk.Label(window_function,text="请输入商品编号:").grid(row = 1,column =0,padx=20)
  1251. g14 =tk.StringVar()
  1252. entry1=tk.Entry(window_function,show=None,textvariable=g14).grid(row = 1,column =1,pady=40)
  1253. button = tk.Button(window_function, text="查找", command=select_Goods).place(relx=0.3,rely=0.5)
  1254. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5,rely=0.5)
  1255. window_function.mainloop()
  1256. # 查找员工界面
  1257. def Staff_select():
  1258. window_choice.destroy()
  1259. global window_function
  1260. global s14
  1261. window_function = tk.Tk()
  1262. window_function.title("商城信息管理系统")
  1263. window_function.geometry('500x400')
  1264. tk.Label(window_function, text="查找员工信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1265. tk.Label(window_function, text="请输入员工编号:").grid(row=1, column=0, padx=20)
  1266. s14 = tk.StringVar()
  1267. entry1 = tk.Entry(window_function, show=None, textvariable=s14).grid(row=1, column=1, pady=40)
  1268. button = tk.Button(window_function, text="查找", command=select_Staff).place(relx=0.3, rely=0.5)
  1269. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
  1270. window_function.mainloop()
  1271. # 查找安全问题界面
  1272. def Check1_select():
  1273. window_choice.destroy()
  1274. global window_function
  1275. global c7
  1276. window_function = tk.Tk()
  1277. window_function.title("商城信息管理系统")
  1278. window_function.geometry('500x400')
  1279. tk.Label(window_function, text="查找安全检查信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1280. tk.Label(window_function, text="请输入检查日期:").grid(row=1, column=0, padx=20)
  1281. c7 = tk.StringVar()
  1282. entry1 = tk.Entry(window_function, show=None, textvariable=c7).grid(row=1, column=1, pady=40)
  1283. button = tk.Button(window_function, text="查找", command=select_Check1).place(relx=0.3, rely=0.5)
  1284. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
  1285. window_function.mainloop()
  1286. # 查找仓库界面
  1287. def Ware_select():
  1288. window_choice.destroy()
  1289. global window_function
  1290. global w9
  1291. window_function = tk.Tk()
  1292. window_function.title("商城信息管理系统")
  1293. window_function.geometry('500x400')
  1294. tk.Label(window_function, text="查找仓库信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1295. tk.Label(window_function, text="请输入仓库编号:").grid(row=1, column=0, padx=20)
  1296. w9 = tk.StringVar()
  1297. entry1 = tk.Entry(window_function, show=None, textvariable=w9).grid(row=1, column=1, pady=40)
  1298. button = tk.Button(window_function, text="查找", command=select_Ware).place(relx=0.3, rely=0.5)
  1299. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
  1300. window_function.mainloop()
  1301. # 查找供货商界面
  1302. def Vendor_select():
  1303. window_choice.destroy()
  1304. global window_function
  1305. global v9
  1306. window_function = tk.Tk()
  1307. window_function.title("商城信息管理系统")
  1308. window_function.geometry('500x400')
  1309. tk.Label(window_function, text="查找供货商信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1310. tk.Label(window_function, text="请输入供货商编号:").grid(row=1, column=0, padx=20)
  1311. v9 = tk.StringVar()
  1312. entry1 = tk.Entry(window_function, show=None, textvariable=v9).grid(row=1, column=1, pady=40)
  1313. button = tk.Button(window_function, text="查找", command=select_Vendor).place(relx=0.3, rely=0.5)
  1314. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
  1315. window_function.mainloop()
  1316. # 查找退货信息界面
  1317. def Infer_select():
  1318. window_choice.destroy()
  1319. global window_function
  1320. global i10
  1321. window_function = tk.Tk()
  1322. window_function.title("商城信息管理系统")
  1323. window_function.geometry('500x400')
  1324. tk.Label(window_function, text="查找退货信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1325. tk.Label(window_function, text="请输入交易流水号:").grid(row=1, column=0, padx=20)
  1326. i10 = tk.StringVar()
  1327. entry1 = tk.Entry(window_function, show=None, textvariable=i10).grid(row=1, column=1, pady=40)
  1328. button = tk.Button(window_function, text="查找", command=select_Infer).place(relx=0.3, rely=0.5)
  1329. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
  1330. window_function.mainloop()
  1331. # 查找会员表界面
  1332. def Member_select():
  1333. window_choice.destroy()
  1334. global window_function
  1335. global m12
  1336. window_function = tk.Tk()
  1337. window_function.title("商城信息管理系统")
  1338. window_function.geometry('500x400')
  1339. tk.Label(window_function, text="查找会员信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1340. tk.Label(window_function, text="请输入会员卡号:").grid(row=1, column=0, padx=20)
  1341. m12 = tk.StringVar()
  1342. entry1 = tk.Entry(window_function, show=None, textvariable=m12).grid(row=1, column=1, pady=40)
  1343. button = tk.Button(window_function, text="查找", command=select_Member).place(relx=0.3, rely=0.5)
  1344. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
  1345. window_function.mainloop()
  1346. #查找商品交易记录界面
  1347. def Trade_select():
  1348. window_choice.destroy()
  1349. global window_function
  1350. global t12
  1351. window_function = tk.Tk()
  1352. window_function.title("商城信息管理系统")
  1353. window_function.geometry('500x400')
  1354. tk.Label(window_function, text="查找商品交易信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1355. tk.Label(window_function, text="请输入交易流水号:").grid(row=1, column=0, padx=20)
  1356. t12 = tk.StringVar()
  1357. entry1 = tk.Entry(window_function, show=None, textvariable=t12).grid(row=1, column=1, pady=40)
  1358. button = tk.Button(window_function, text="查找", command=select_Trade).place(relx=0.3, rely=0.5)
  1359. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
  1360. window_function.mainloop()
  1361. #查找入库信息界面
  1362. def Entry_select():
  1363. window_choice.destroy()
  1364. global window_function
  1365. global e12
  1366. window_function = tk.Tk()
  1367. window_function.title("商城信息管理系统")
  1368. window_function.geometry('500x400')
  1369. tk.Label(window_function, text="查找入库信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1370. tk.Label(window_function, text="请输入入库单编号:").grid(row=1, column=0, padx=20)
  1371. e12 = tk.StringVar()
  1372. entry1 = tk.Entry(window_function, show=None, textvariable=e12).grid(row=1, column=1, pady=40)
  1373. button = tk.Button(window_function, text="查找", command=select_Entry).place(relx=0.3, rely=0.5)
  1374. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
  1375. window_function.mainloop()
  1376. #查找出库信息界面
  1377. def Exits_select():
  1378. window_choice.destroy()
  1379. global window_function
  1380. global x11
  1381. window_function = tk.Tk()
  1382. window_function.title("商城信息管理系统")
  1383. window_function.geometry('500x400')
  1384. tk.Label(window_function, text="查找出库信息", font=("黑体", 20)).grid(row=0, column=1, pady=20)
  1385. tk.Label(window_function, text="请输入出库单编号:").grid(row=1, column=0, padx=20)
  1386. x11 = tk.StringVar()
  1387. entry1 = tk.Entry(window_function, show=None, textvariable=x11).grid(row=1, column=1, pady=40)
  1388. button = tk.Button(window_function, text="查找", command=select_Exits).place(relx=0.3, rely=0.5)
  1389. button2 = tk.Button(window_function, text="返回", command=change_select).place(relx=0.5, rely=0.5)
  1390. window_function.mainloop()
  1391. ########################################################################################################
  1392. #增删改查之后进去每个都可以对员工信息 商品信息 安全信息 仓库信息 供货信息 退货信息 会员信息等等进行操作
  1393. def all_add():
  1394. #window.destroy()
  1395. global window_choice
  1396. window_choice = tk.Tk()
  1397. window_choice.title("商城信息管理系统")
  1398. window_choice.geometry('400x900')
  1399. # 生成画布,销毁后生成新的画布实现跳转
  1400. page = tk.Frame(window_choice)
  1401. page.pack()
  1402. tk.Label(window_choice, text="欢迎使用商城信息管理系统", font=("黑体", 20)).pack(pady=10)
  1403. button1 = tk.Button(window_choice, text="添加员工信息", command=Staff_add).pack(pady=10)
  1404. button2 = tk.Button(window_choice, text="添加商品信息", command=Goods_add).pack(pady=10)
  1405. button3 = tk.Button(window_choice, text="添加安全信息", command=Check1_add).pack(pady=10)
  1406. button4 = tk.Button(window_choice, text="添加仓库信息", command=Ware_add).pack(pady=10)
  1407. button5 = tk.Button(window_choice, text="添加供货商信息", command=Vendor_add).pack(pady=10)
  1408. button6 = tk.Button(window_choice, text="添加退货信息", command=Infer_add).pack(pady=10)
  1409. button7 = tk.Button(window_choice, text="添加会员信息", command=Member_add).pack(pady=10)
  1410. button8 = tk.Button(window_choice, text="添加交易信息", command=Trade_add).pack(pady=10)
  1411. button9 = tk.Button(window_choice, text="添加入库信息", command=Entry_add).pack(pady=10)
  1412. button10 = tk.Button(window_choice, text="添加出库信息", command=Exits_add).pack(pady=10)
  1413. button11 = tk.Button(window_choice, text="返回", command=change_main).place(relx=0.5, rely=0.8)
  1414. window_choice.mainloop()
  1415. def all_delete():
  1416. #window.destroy()
  1417. global window_choice
  1418. window_choice = tk.Tk()
  1419. window_choice.title("商城信息管理系统")
  1420. window_choice.geometry('400x900')
  1421. # 生成画布,销毁后生成新的画布实现跳转
  1422. page = tk.Frame(window_choice)
  1423. page.pack()
  1424. tk.Label(window_choice, text="欢迎使用商城信息管理系统", font=("黑体", 20)).pack(pady=10)
  1425. button1 = tk.Button(window_choice, text="删除员工信息", command=Staff_delete).pack(pady=10)
  1426. button2 = tk.Button(window_choice, text="删除商品信息", command=Goods_delete).pack(pady=10)
  1427. button3 = tk.Button(window_choice, text="删除安全信息", command=Check1_delete).pack(pady=10)
  1428. button4 = tk.Button(window_choice, text="删除仓库信息", command=Ware_delete).pack(pady=10)
  1429. button5 = tk.Button(window_choice, text="删除供货商信息", command=Vendor_delete).pack(pady=10)
  1430. button6 = tk.Button(window_choice, text="删除退货信息", command=Infer_delete).pack(pady=10)
  1431. button7 = tk.Button(window_choice, text="删除会员信息", command=Member_delete).pack(pady=10)
  1432. button8 = tk.Button(window_choice, text="删除交易信息", command=Trade_delete).pack(pady=10)
  1433. button9 = tk.Button(window_choice, text="删除入库信息", command=Entry_delete).pack(pady=10)
  1434. button10 = tk.Button(window_choice, text="删除出库信息", command=Exits_delete).pack(pady=10)
  1435. button11 = tk.Button(window_choice, text="返回", command=change_main).place(relx=0.5, rely=0.8)
  1436. window_choice.mainloop()
  1437. def all_update():
  1438. #window.destroy()
  1439. global window_choice
  1440. window_choice = tk.Tk()
  1441. window_choice.title("商城信息管理系统")
  1442. window_choice.geometry('400x900')
  1443. # 生成画布,销毁后生成新的画布实现跳转
  1444. page = tk.Frame(window_choice)
  1445. page.pack()
  1446. tk.Label(window_choice, text="欢迎使用商城信息管理系统", font=("黑体", 20)).pack(pady=10)
  1447. button1 = tk.Button(window_choice, text="更新员工信息", command=Staff_update).pack(pady=10)
  1448. button2 = tk.Button(window_choice, text="更新商品信息", command=Goods_update).pack(pady=10)
  1449. button3 = tk.Button(window_choice, text="更新仓库信息", command=Ware_update).pack(pady=10)
  1450. button4 = tk.Button(window_choice, text="更新供货商信息", command=Vendor_update).pack(pady=10)
  1451. button5 = tk.Button(window_choice, text="更新退货信息", command=Infer_update).pack(pady=10)
  1452. button6 = tk.Button(window_choice, text="更新会员信息", command=Member_update).pack(pady=10)
  1453. button7 = tk.Button(window_choice, text="更新交易信息", command=Trade_update).pack(pady=10)
  1454. button8 = tk.Button(window_choice, text="更新入库信息", command=Entry_update).pack(pady=10)
  1455. button9 = tk.Button(window_choice, text="更新出库信息", command=Exits_update).pack(pady=10)
  1456. button10 = tk.Button(window_choice, text="返回", command=change_main).place(relx=0.5, rely=0.8)
  1457. window_choice.mainloop()
  1458. def all_select():
  1459. #window.destroy()
  1460. global window_choice
  1461. window_choice = tk.Tk()
  1462. window_choice.title("商城信息管理系统")
  1463. window_choice.geometry('400x900')
  1464. # 生成画布,销毁后生成新的画布实现跳转
  1465. page = tk.Frame(window_choice)
  1466. page.pack()
  1467. tk.Label(window_choice, text="欢迎使用商城信息管理系统", font=("黑体", 20)).pack(pady=10)
  1468. button1 = tk.Button(window_choice, text="查询员工信息", command=Staff_select).pack(pady=10)
  1469. button2 = tk.Button(window_choice, text="查询商品信息", command=Goods_select).pack(pady=10)
  1470. button3 = tk.Button(window_choice, text="查询安全信息", command=Check1_select).pack(pady=10)
  1471. button4 = tk.Button(window_choice, text="查询仓库信息", command=Ware_select).pack(pady=10)
  1472. button5 = tk.Button(window_choice, text="查询供货商信息", command=Vendor_select).pack(pady=10)
  1473. button6 = tk.Button(window_choice, text="查询退货信息", command=Infer_select).pack(pady=10)
  1474. button7 = tk.Button(window_choice, text="查询会员信息", command=Member_select).pack(pady=10)
  1475. button8 = tk.Button(window_choice, text="查询交易信息", command=Trade_select).pack(pady=10)
  1476. button9 = tk.Button(window_choice, text="查询入库信息", command=Entry_select).pack(pady=10)
  1477. button10 = tk.Button(window_choice, text="查询出库信息", command=Exits_select).pack(pady=10)
  1478. button11 = tk.Button(window_choice, text="返回", command=change_main).place(relx=0.5, rely=0.8)
  1479. window_choice.mainloop()
  1480. ####################################################################################################
  1481. #添加商品界面跳转
  1482. def change_add():
  1483. window_function.destroy()
  1484. all_add()
  1485. def change1_add():
  1486. window.destroy()
  1487. all_add()
  1488. #删除商品界面跳转
  1489. def change_delete():
  1490. window_function.destroy()
  1491. all_delete()
  1492. def change1_delete():
  1493. window.destroy()
  1494. all_delete()
  1495. #更新商品界面跳转
  1496. def change_update():
  1497. window_function.destroy()
  1498. all_update()
  1499. def change1_update():
  1500. window.destroy()
  1501. all_update()
  1502. #条件查询商品界面跳转
  1503. def change_select():
  1504. window_function.destroy()
  1505. all_select()
  1506. def change1_select():
  1507. window.destroy()
  1508. all_select()
  1509. #主界面跳转
  1510. def change_main():
  1511. window_choice.destroy()
  1512. mainpage()
  1513. def change_login():
  1514. login1.destroy()
  1515. mainpage()
  1516. ###################################################################################################
  1517. #主界面
  1518. def mainpage():
  1519. global window
  1520. window = tk.Tk()
  1521. window.title("商城信息管理系统")
  1522. # window.geometry('500x400')
  1523. #生成画布,销毁后生成新的画布实现跳转
  1524. #page = tk.Frame(window)
  1525. #page.pack()
  1526. tk.Label(window, text="欢迎使用商城信息管理系统", font=("黑体", 20)).pack(pady=10)
  1527. button1 = tk.Button(window, text="添加信息", command=change1_add).pack(pady=10)
  1528. button2 = tk.Button(window, text="删除信息", command=change1_delete).pack(pady=10)
  1529. button3 = tk.Button(window, text="修改信息", command=change1_update).pack(pady=10)
  1530. button4 = tk.Button(window, text="信息查询", command=change1_select).pack(pady=10)
  1531. #信息查询 员工信息 商品信息 安全信息 仓库信息 供货信息 退货信息 会员信息
  1532. # 插入图片背景
  1533. image = Image.open("BACK.jpg").resize((400, 400))
  1534. pyt = ImageTk.PhotoImage(image)
  1535. canvas_window = tkinter.Canvas(window, width=500, height=400)
  1536. canvas_window.create_image(250, 200, image=pyt)
  1537. canvas_window.pack()
  1538. window.mainloop()
  1539. ####################################################################################
  1540. #登录界面
  1541. def login():
  1542. global login1,username,password
  1543. login1=tk.Tk()
  1544. login1.title("登录界面")
  1545. login1.geometry('300x200')
  1546. tk.Label(login1, text="请输入账号:").grid(row=1, column=0, padx=20, pady=20)
  1547. tk.Label(login1, text="请输入密码:").grid(row=2, column=0, padx=20, pady=20)
  1548. # 定义变量记录输入信息
  1549. username = tk.StringVar()
  1550. password = tk.StringVar()
  1551. # 生成输入框
  1552. entry1 = tk.Entry(login1, show=None, textvariable=username).grid(row=1, column=1)
  1553. entry2 = tk.Entry(login1, show='*', textvariable=password).grid(row=2, column=1)
  1554. # 生成按钮
  1555. button = tk.Button(login1, text="login", command=login_l).place(relx=0.3, rely=0.8)
  1556. # else:
  1557. # tkinter.messagebox.showinfo(title='提示', message='账号或密码错误')
  1558. login1.mainloop()
  1559. def login_l():
  1560. name=username.get()
  1561. pwd=password.get()
  1562. if name=='mysql' and pwd =='123456':
  1563. change_login()
  1564. else:
  1565. tkinter.messagebox.showinfo(title='提示', message='账号或密码错误')
  1566. #调用登录界面
  1567. if __name__ == '__main__':
  1568. login()



Category of website: technical article > Blog

Author:Abstract

link:http://www.pythonblackhole.com/blog/article/79999/dc1d414b5a5daafa165f/

source:python black hole net

Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.

19 0
collect article
collected

Comment content: (supports up to 255 characters)