Database Course Design-Digital Company Management System

1. Demand analysis

1. Background

In the information age with ever-changing technology, people's demand for digital electronic products is increasing day by day, which is undoubtedly a huge business opportunity, but the sales of digital electronic products is a tedious, complicated and meticulous work. It is not conducive to companies and enterprises with large orders and large daily sales. In order to reduce or even avoid errors caused by manual operations, and to save time and labor costs, computers are used for management.
The use of computers can not only ensure the accuracy of account accounting, but also make statistics on digital electronic product information, serve digital business operators, make digital company management more convenient, and account accounting is faster and more accurate. Therefore, this project develops a suitable for Systems managed by various digital companies.
The task proposer and developer of this project is the management system software development team of Zhenanxin Digital Company, that is, the two chairman of the company. The users are major digital wholesalers, retailers and ordinary users.

2. Purpose

a. In order to improve the management information of digital electronic products.
b. In order to make the sales of digital electronic products more convenient for major digital operators, they have a complete understanding of the entire process of digital electronic products flowing to consumers.
c. In order to reduce the workload of the staff.
d. In order to allow the staff to calculate accounts faster and more accurately.

3. System advantages

1. Using the digital company management system can clearly understand the storage of digital product information in warehouses and counters, and allow corresponding staff to make replenishment operations in a timely manner.
2. Through this system, managers can clearly see the digital company's digital product sales and profit for a corresponding period of time, so that they can control the type and quantity of digital products based on this information.
3. Through this system, relevant staff can add, modify, delete and query related operations on digital product information.
4. Through the information delivered by the sales slip, the managers of the digital company can summarize the information of the digital products, and then make corresponding adjustments to the digital products according to the sales information of the digital products. Such as adjusting the quantity of the most popular digital products, thereby increasing the profits of digital companies.
5. This system can also provide digital products to wholesalers and automatic vending machines, and the automatic vending machines sell digital products to customers.
6. The staff can print out the customer's purchase list of digital products through this system.

insert image description here

2. Conceptual structure design (ER diagram)

insert image description here

3. Logical structure design

  1. Electronic product (product number, product category, product brand, product model, product purchase price, product selling price, product production date, product warranty period, product manufacturer) This is the relationship model corresponding to the entity "electronic product", and the primary key is
    product serial number.
  2. Supplier (supplier name, supplier contact number, supplier address)
    This is the relationship model corresponding to the supplier entity. The relationship model includes the relationship model corresponding to "supply", and the main key is the name of the supplier. According to this attribute, the corresponding supplier can be directly confirmed.
  3. Wholesaler (wholesaler name, wholesaler address, wholesaler phone number)
    This is the relationship model corresponding to the entity "wholesaler", and the main key is the name of the wholesaler. According to this attribute, the wholesaler in the shipping object can be directly confirmed, which conforms to BCNF paradigm.
  4. Counter (responsible labor number, counter type, counter brand, person in charge name)
    This is the relationship model corresponding to the entity "counter", and the main key is the counter number. According to this attribute, the counter in the shipping object can be directly confirmed, which conforms to the BCNF paradigm.
  5. Online sales (personnel number in charge, name of person in charge, phone number of person in charge)
    This is the relationship model corresponding to the entity "vending machine", and the main key is the machine number. According to this attribute, the vending machine in the shipping object can be directly confirmed.
  6. Employee (employee number, employee name, employee password, employee phone number, employee address, employee gender, employee age, employee bank card number, employee education, employee position, employee ID number) This is the relationship model corresponding to the employee entity
    . The relationship model includes the relationship models corresponding to "warehousing", "delivery", "purchase", "return", and "sales". The master key is the employee's job number, and the information of the relevant employee can be confirmed directly according to this attribute.
  7. The main code of the storage slip (product number, employee ID, purchase time, and product quantity)
    is the product number, employee ID, and purchase time. The relevant information of a storage order is confirmed by the product number, employee ID, and purchase time. The product information can be obtained through the product ID, and the relevant information of the relevant personnel can be confirmed through the employee ID, which eliminates some dependencies and Transitive dependencies, and there is no dependency between the main code.
  8. The main code of the delivery order (product number, employee ID, delivery time, and product quantity)
    is the product number, employee ID, and delivery time. The relevant information of a delivery order can be specifically confirmed by the product number, employee ID, and delivery time. The product information can be obtained through the product number, and the relevant information of the relevant personnel can be confirmed through the employee ID, eliminating some dependencies. and transitive dependencies, and there is no dependency between the main codes.

  9. The main key of the sales slip (product number, sales time, and product quantity) is the product number and sales time. The relevant information of a sales order is confirmed by the product number and sales time, and the product information can be known through the product number, which eliminates partial dependencies and transitive dependencies, and there is no dependency between the main codes, which conforms to the BCNF paradigm.
  10. Purchase order (employee number, supplier name, product number, purchase time, product quantity,)
    master key is employee number, product number, purchase time, supplier name, employee number. The relevant information of a certain purchase order is specifically confirmed by the product number, purchase time, supplier name, and employee ID, and the product information can be obtained through the product number, which eliminates partial dependencies and transitive dependencies. There are no dependencies.
  11. Return form (employee ID, supplier name, product number, purchase time, product quantity)
    master key is employee ID, product number, purchase time, supplier name. The relevant information of a certain return order is specifically confirmed by the employee's job number, product number, purchase time, and supplier name. The product information can be obtained through the product number, which eliminates partial dependence and transitive dependence, and between the main codes There is no dependency.
  12. The main key of the account table (username, password)
    is the username. The user name is used to confirm the relevant information of each person who logs into the system, and the digital company management system can be logged in through the user name and password, which eliminates partial dependence and transitive dependence, and there is no dependence between the main codes.

  13. The main key of the warehouse table (product number, inventory) is the product number, and the inventory of each product can be queried by the product number.

4. Physical structure design (flow chart)

insert image description here

insert image description here

5. Database implementation stage

1.SQL statement

Create table:

import pymssql
class DataBase:
    # 初始化
    def __init__(self,host,port,user,pwd,db): #服务器名,端口,账户,密码,数据库名
        self.host=host
        self.port=port
        self.user=user
        self.pwd=pwd
        self.db=db
    # 与数据库建立连接
    def GetConnect(self):
        self.connect=pymssql.connect(host=self.host,port=self.port,user=self.user, password=self.pwd, database=self.db, charset='utf8')
        self.cur=self.connect.cursor()
        if self.connect:
            print("连接成功")
        else:
            print("连接失败")
    def initDataBase(self):
        #1.创建产品表
        create_Product_table_sql="""CREATE TABLE Product(
                                    Pno nvarchar(10) primary key,
                                    Ptype nvarchar(10) not null,
                                    Pbrand nvarchar(5) not null ,
                                    Pmodelnumber nvarchar(10) not null,
                                    PinPrice int not null,
                                    PoutPrice int not null,
                                    ProDate nvarchar(10) not null,
                                    PassureDate nvarchar(10) not null,
                                    Pfactory nvarchar(10) not null
                                    
                                )
                                """
                                
        #2.创建供货商表
        create_Supplier_table_sql="""CREATE TABLE Supplier(
                                    Sname nvarchar(10) primary key,
                                    Sphone nvarchar(12) not null,
                                    Saddress nvarchar(10) not null
                                  )
                                  """
                                  
        #3.创建批发商表
        create_Wholeseler_table_sql="""CREATE TABLE Wholeseler(
                                       Wname nvarchar(10) primary key,
                                       Wphone nvarchar(12) not null,
                                       Waddress nvarchar(10) not null
                                    )
                                    """
                                    
        #4.创建柜台表
        create_Guitai_table_sql="""CREATE TABLE Guitai(
                                   Eno  nvarchar(15) primary key,
                                   Ptype nvarchar(10) not null,
                                   Pbrand nvarchar(5) not null,
                                   Gname nvarchar(8) not null
                                )
                                """
                                
        #5.创建线上售货平台表
        create_Online_vending_platform_sql="""CREATE TABLE Online_vending_platform(
                                              Eno nvarchar(10) primary key,
                                              Fname nvarchar(8) not null,
                                              Fphone nvarchar(12) not null
                                           )
                                           """
                                           
        #6.创建员工表
        create_Employee_table_sql="""CREATE TABlE Employee(
                                    Eno nvarchar(15) primary key,
                                    Ename nvarchar(8) not null,
                                    Ephone nvarchar(12) not null,
                                    Eaddress nvarchar(20) not null,
                                    Esex nvarchar(2) not null,
                                    Eage int not null,
                                    Edegree nvarchar(8) not null,
                                    Ecard nvarchar(20) not null,
                                    Eposition nvarchar(20) not null,
                                    Eidcard nvarchar(20) not null,
                                    check(Esex='女'or Esex='男'),
                                    check(Eage>0)
                                )
                                """
         
        #7.创建入库表
        create_Ruku_table_sql="""CREATE TABLE RuKu(
                                Eno nvarchar(15),
                                Pno nvarchar(10),
                                Rdate nvarchar(15),
                                Pnum int not null,
                                primary key(Eno,Pno,Rdate),
                                foreign key(Eno)references Employee(Eno),
                                ON DELETE CASCADE
                                ON UPDATE CASCADE
                                foreign key(Pno)references Product(Pno),
                                ON DELETE CASCADE
                                ON UPDATE CASCADE
                                check(Pnum>0)
                            )"""
        
        #8.创建出库表
        create_ChuKu_table_sql="""CREATE TABlE ChuKu(
                                Eno nvarchar(15),
                                Pno nvarchar(10),
                                Cdate nvarchar(15),
                                Pnum int not null,
                                primary key(Eno,Pno,Cdate),
                                foreign key(Eno)references Employee(Eno),
                                ON DELETE CASCADE
                                ON UPDATE CASCADE
                                foreign key(Pno)references Product(Pno),
                                ON DELETE CASCADE
                                ON UPDATE CASCADE
                                check(Pnum>0)
                             )"""
        #9.创建销售单
        create_Sale_table_sql="""CREATE TABLE Sale(
                                Pno nvarchar(10),
                                Sdate nvarchar(20),
                                Pnum int not null,
                                primary key(Pno,Sdate),
                                foreign key(Pno)references Product(Pno),
                                ON DELETE CASCADE
                                ON UPDATE CASCADE
                                check(Pnum>0)
                             )"""
        #10.创建采购单
        create_MaiProduct_table_sql="""CREATE TABLE MaiProduct(
                                       Eno nvarchar(15),
                                       Sname nvarchar(10),
                                       Pno nvarchar(10),
                                       Mdate nvarchar(20),
                                       Pnum int not null,
                                       primary key(Eno,Sname,Pno,Mdate),
                                       foreign key(Eno)references Employee(Eno),   
                                       ON DELETE CASCADE
                                       ON UPDATE CASCADE                                                                  
                                       foreign key(Sname)references Supplier(Sname),
                                       ON DELETE CASCADE
                                       ON UPDATE CASCADE
                                       foreign key(Pno)references Product(Pno),
                                       ON DELETE CASCADE
                                       ON UPDATE CASCADE
                                       check(Pnum>0)                             
                                    )
                                    """
        #11.创建退货单
        create_TuiProduct_table_sql="""CREATE TABLE TuiProduct(
                                       Eno nvarchar(15),
                                       Sname nvarchar(10),
                                       Pno nvarchar(10),
                                       Tdate nvarchar(20),
                                       Pnum int not null,
                                       primary key(Eno,Sname,Pno,Tdate),
                                       foreign key(Eno)references Employee(Eno),
                                       ON DELETE CASCADE
                                       ON UPDATE CASCADE
                                       foreign key(Sname)references Supplier(Sname),
                                       ON DELETE CASCADE
                                       ON UPDATE CASCADE
                                       foreign key(Pno)references Product(Pno),
                                       ON DELETE CASCADE
                                       ON UPDATE CASCADE
                                       check(Pnum>0)   
                                    )
                                    """
        #12.创建仓库表
        create_CangKu_table_sql="""CREATE TABLE CangKu(
                                   Pno nvarchar(15) primary key,
                                   Pnum int,
                                )
                                """
        #13.创建账户表
        create_Account_table_sql="""CREATE TABLE Account(
                                       Eno nvarchar(15),
                                       Apassword nvarchar(15)
                                    )
                                 """
        self.cur.execute(create_Product_table_sql)
        self.cur.execute(create_Wholeseler_table_sql)
        self.cur.execute(create_Supplier_table_sql)
        self.cur.execute(create_Guitai_table_sql)
        self.cur.execute(create_Online_vending_platform_sql)
        self.cur.execute(create_Employee_table_sql)
        self.cur.execute(create_Ruku_table_sql)
        self.cur.execute(create_ChuKu_table_sql)
        self.cur.execute(create_Sale_table_sql)
        self.cur.execute(create_MaiProduct_table_sql)
        self.cur.execute(create_TuiProduct_table_sql)
        self.cur.execute(create_Account_table_sql)
        self.connect.commit()
        print("创建成功!")

insert image description here
Partial table display:
insert image description here
insert image description here

Authorization:
insert image description here
insert image description here

2. Procedure

import pymssql
import os
class mainSystem:
    def __init__(self):
        print("欢迎使用真安心数码公司管理系统!");
        print("请输入您的用户名和密码:")
        while(1):
            try:
                self.userName=input("用户名:")
                self.password=input("密码:")
                self.connect=pymssql.connect(host='localhost',port=1433,user=self.userName,password=self.password,database='test',charset='utf8')
                self.cur=self.connect.cursor()
                os.system("cls")
                self.Menu()
                while(1):
                    try:           
                        option=int(input("请输入选项:"));
                        if option==1:
                            self.Accounts()
                        elif option==2:
                           self.Query()
                        elif option==3:
                           self.Add()
                        elif option==4:
                           self.Modify()
                        elif option==5:
                           self.Delete()
                        elif option==6:
                           self.GetSale()
                        elif option==7:
                           self.getCangKu()
                        elif option==8:
                           print("欢迎下次使用!")
                           return
                        else:
                            print("输入错误!")
                    except:
                        print("输入错误")
            except:
                print("用户名或密码错误,是否重新输入? Y/N")
                option=input();
                if option=="N":
                    return;
    def Menu(self):
        print("loading...")
        print("***********欢迎进入真安心数码公司管理系统!*****")
        print("***************下面是功能选项:*****************")
        print("*****************1.管理账户********************")
        print("*****************2.查询信息********************")
        print("*****************3.增添信息********************")
        print("*****************4.修改信息********************")
        print("*****************5.删除信息********************")
        print("*****************6.查看销售情况****************")
        print("*****************7.查看库存情况******************")
        print("*****************8.退出系统********************")
    def Accounts(self):
        try:
            sql="SELECT * FROM Account"
            self.cur.execute(sql)
            list=self.cur.fetchall()
            des=self.cur.description
            for item in des:
               print(item[0],"   ",end="")
            print()
            for row in list:
               print(row)
        except:
            print("您没有权限!")
            return
    def Query(self):
        try:
            table=input("请输入要查询的表的名称:")
            sql="SELECT * FROM %s"%(table)
            self.cur.execute(sql)
            list=self.cur.fetchall()
            des=self.cur.description
            for item in des:
               print(item[0],"   ",end="")
            print()
            for row in list:
               print(row)
        except:
           print("查询失败,不存在该表或者您没有权限!")
           return

    def Add(self):
        try:
            table=input("请输入您要增添信息的表:")
            sql="select * from %s"%(table)
            self.cur.execute(sql)
            insert_sql=''
            if table=='Product':
                Pno=input("Pno:")
                Ptype=input("Ptype:")
                Pbrand=input("Pbrand:")
                Pmodelnumber=input("Pmodelnumber:")
                PinPrice=int(input("PinPrice:"))
                PoutPrice=int(input("PoutPrice:"))
                ProDate=input("ProDate:")
                PassureDate=input("PassureDate:")
                Pfactory=input("Pfactory:")
                insert_sql="""INSERT INTO %s 
                          VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s')
                          """%(table,Pno,Ptype,Pbrand,Pmodelnumber,PinPrice,PoutPrice,ProDate,PassureDate,Pfactory)
                insert_CangKu_sql="""INSERT INTO CangKu
                              VALUES('%s','%s')
                              """%(Pno,0)
                self.cur.execute(insert_CangKu_sql)
                self.connect.commit()
            elif table=='Employee':
                Eno=input("Eno:")
                Ename=input("Ename:")
                Ephone=input("Ephone:")
                Eaddress=input("Eaddress:")
                Esex=input("Esex:")
                Eage=int(input("Eage:"))
                Edegree=input("Edegree:")
                Ecard=input("Ecard:")
                Eposition=input("Eposition:")
                Eidcard=input("Eidcard:")
                insert_sql="""INSERT INTO %s 
                          VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')
                          """%(table,Eno,Ename,Ephone,Eaddress,Esex,Eage,Edegree,Ecard,Eposition,Eidcard)
            elif table=='ChuKu':
                Eno=input("Eno:")
                Pno=input("Pno:")
                Cdate=input("Cdate:")
                Pnum=int(input("Pnum:"))
                insert_sql="""INSERT INTO %s
                           VALUES('%s','%s','%s','%s')
                           """%(table,Eno,Pno,Cdate,Pnum)
                update_sql="""UPDATE CangKu
                              set Pnum=Pnum-'%s'
                              where Pno='%s'
                           """%(Pnum,Pno)
                self.cur.execute(update_sql)
                self.connect.commit()
            elif table=='Guitai':
                Eno=input("Gno:")
                Ptype=input("Ptype:")
                Pbrand=input('Pbrand:')
                Gname=input("Gname:")
                insert_sql="""INSERT INTO %s
                           VALUES('%s','%s','%s','%s')
                           """%(table,Eno,Ptype,Pbrand,Gname)
            elif table=="MaiProduct":
                Eno=input("Eno:")
                Sname=input("Sname:")
                Pno=input("Pno:")
                Mdate=input("Mdate:")
                Pnum=int(input("Pnum:"))
                insert_sql="""INSERT INTO %s
                           VALUES('%s','%s','%s','%s','%s')
                           """%(table,Eno,Sname,Pno,Mdate,Pnum)
                update_sql="""UPDATE CangKu
                              set Pnum=Pnum+'%s'
                              where Pno='%s'
                           """%(Pnum,Pno)
                self.cur.execute(update_sql)
                self.connect.commit()
            elif table=="Online_vending_platform":
                Eno=input("Fno:")
                Fname=input("Fname:")
                Fphone=input("Fphone:")
                insert_sql="""INSERT INTO %s
                           VALUES('%s','%s','%s')
                           """%(table,Eno,Fname,Fphone)
            elif table=="RuKu":
                Eno=input("Eno:")
                Pno=input("Pno:")
                Rdate=input("Cdate:")
                Pnum=int(input("Pnum:"))
                insert_sql="""INSERT INTO %s
                           VALUES('%s','%s','%s','%s')
                           """%(table,Eno,Pno,Rdate,Pnum)
                update_sql="""UPDATE CangKu
                              set Pnum=Pnum+'%s'
                              where Pno='%s'
                           """%(Pnum,Pno)
                self.cur.execute(update_sql)
                self.connect.commit()
            elif table=="Sale":
                Pno=input("Pno:")
                Sdate=input("Sdate:")
                Pnum=int(input("Pnum:"))
                insert_sql="""INSERT INTO %s
                           VALUES('%s','%s','%s')
                           """%(table,Pno,Sdate,Pnum)
                update_sql="""UPDATE CangKu
                              set Pnum=Pnum-'%s'
                              where Pno='%s'
                           """%(Pnum,Pno)
                self.cur.execute(update_sql)
                self.connect.commit()
            elif table=="Supplier":
                Sname=input("Pno:")
                Sphone=input("Sdate:")
                Saddress=(input("Pnum:"))
                insert_sql="""INSERT INTO %s
                           VALUES('%s','%s','%s')
                           """%(table,Sname,Sphone,Saddress)
            elif table=="TuiProduct":
                Eno=input("Eno:")
                Sname=input("Sname:")
                Pno=input("Pno:")
                Tdate=input("Mdate:")
                Pnum=int(input("Pnum:"))
                insert_sql="""INSERT INTO %s
                           VALUES('%s','%s','%s','%s','%s')
                           """%(table,Eno,Sname,Pno,Tdate,Pnum)
                update_sql="""UPDATE CangKu
                              set Pnum=Pnum-'%s'
                              where Pno='%s'
                           """%(Pnum,Pno)
                self.cur.execute(update_sql)
                self.connect.commit()
            elif table=="Wholeseler":
                Wname=input("Pno:")
                Wphone=input("Sdate:")
                Waddress=(input("Pnum:"))
                insert_sql="""INSERT INTO %s
                           VALUES('%s','%s','%s')
                           """%(table,Wname,Wphone,Waddress)
            self.cur.execute(insert_sql)
            self.connect.commit()
            print("增添成功!")
        except:
            self.connect.rollback()
            print("增添失败,输入错误或者您没有权限!")
            return
    def Modify(self):
        try:
            table=input("请输入您要修改信息的表的名称:")
            update_sql=''
            if table=='Product':
                Pno=input("请输入您要修改的产品编号:")
                nPtype=input("Ptype:")
                nPbrand=input("Pbrand:")
                nPmodelnumber=input("Pmodelnumber:")
                nPinPrice=int(input("PinPrice:"))
                nPoutPrice=int(input("PoutPrice:"))
                nProDate=input("ProDate:")
                nPassureDate=input("PassureDate:")
                nPfactory=input("Pfactory:")
                update_sql="""UPDATE %s
                              set Ptype='%s',Pbrand='%s',Pmodelnumber='%s',PinPrice='%s',PoutPrice='%s',Pnum='%s',ProDate='%s',PassureDate='%s',Pfactory='%s'
                              where Pno='%s'
                            """%(table,nPtype,nPbrand,nPmodelnumber,nPinPrice,nPoutPrice,nProDate,nPassureDate,nPfactory,Pno)
            elif table=='Employee':
                Eno=input("请输入您要修改员工的编号:")
                nEname=input("Ename:")
                nEphone=input("Ephone:")
                nEaddress=input("Eaddress:")
                nEsex=input("Esex:")
                nEage=int(input("Eage:"))
                nEdegree=input("Edegree:")
                nEcard=input("Ecard:")
                nEposition=input("Eposition:")
                nEidcard=input("Eidcard:")
                update_sql="""UPDATE %s
                              set Ename='%s',Ephone='%s',Eaddress='%s',Esex='%s',Eage='%s',Edegree='%s',Ecard='%s',Eposition='%s',Eidcard='%s'
                              where Eno='%s'
                           """%(table,nEname,nEphone,nEaddress,nEsex,nEage,nEdegree,nEcard,nEposition,nEidcard,Eno)
            self.cur.execute(update_sql)
            self.connect.commit()
            print("修改成功!")      
        except:
            self.connect.rollback()
            print("修改失败,存在约束或输入错误或者您没有权限!")
            return;
    def Delete(self):
        try:
            table=input("请输入您要删除信息的表的名称:")
            sql="SELECT * FROM %s"%(table)
            self.cur.execute(sql)
            list=self.cur.fetchall()
            des=self.cur.description
            print("删除前:")
            for item in des:
                print(item[0],"  ",end="")
            print() 
            for row in list:
                print(row)
                
            if table=="Product":
                Pno=input("请输入您要删除的产品的编号:")
                delete_sql="""DELETE FROM %s
                              where Pno='%s'
                            """%(table,Pno)
            if table=="Employee":
                Eno=input("请输入您要删除的员工的编号:")
                delete_sql="""DELETE FROM %s
                              where Eno='%s'
                           """%(table,Eno)
            if table=="Account":
                Aname=input("请输入您要删除的账户名:")
                delete_sql="""DELETE FROM %s
                              where Aname='%s'
                           """%(table,Aname)
            self.cur.execute(delete_sql)
            self.connect.commit()
            print("删除成功!")
            print("删除后:")
            self.cur.execute(sql)
            list=self.cur.fetchall()
            for item in des:
                print(item[0],"  ",end="")
            print()
            for row in list:
                print(row)
        except:
            self.connect.rollback()
            print("删除失败,存在约束或不存在满足要求的信息或者您没有权限!")
            return;
    def GetSale(self):
        try:
            sql="""select Pno,SUM(Pnum) SumNum
               from Sale
               group by Pno
               order by SumNum DESC
               """
            self.cur.execute(sql)
            list=self.cur.fetchall()
            des=self.cur.description
            for item in des:
               print(item[0],"        ",end="")
            print() 
            for row in list:
               print(row)
            print("编号"+list[0][0]+"产品销量最好,建议加大进货量!")
            print("编号"+list[len(list)-1][0]+"产品销量最差,建议控制进货量!")
        except:
            print("您没有权限!")
            return
    def getCangKu(self):
        try:
            sql="""select *
               from CangKu
               """
            self.cur.execute(sql)
            list=self.cur.fetchall()
            des=self.cur.description
            for item in des:
               print(item[0],"        ",end="")
            print() 
            for row in list:
               print(row)
            sql="""select Pno
                   from CangKu
                   where Pnum=0
                """
            self.cur.execute(sql)
            list=self.cur.fetchall()
            print("以下产品库存为0!!!,请尽快进货!")
            for row in list:
                print(row[0],end=' ')
            print()
        except:
            print("您没有权限!")
            return
    #('2021008', '投影仪', '极米', 'NEW-Z6X', 3800, 4399, 580, '2021-06-13', '5年', '极米有限公司')

s=mainSystem()


    
        

6. Database operation and maintenance phase

login interface

insert image description here

insert image description here

Function menu

insert image description here

manage account

insert image description here

search information

insert image description here

add information

insert image description here

Modify information

insert image description here

delete message

insert image description here

Check sales

insert image description here

check availability

insert image description here

7. Experience

After several weeks of study and discussion, our team finally completed the production of the database system of Zhenanxin Digital Company, and we are very proud. In this process, we deeply realized the joy of applying what we have learned and the tacit understanding of unity and cooperation. Although I have learned a lot of theoretical knowledge in the classroom, when the theory is used for the first time in a large-scale project, there will still be many problems, and many details and flaws will be exposed. won.
This database experiment project is still a great harvest for us. During this process, we have experienced the overall process and detailed implementation of the database system design process. From the reading of various documents to the initial requirements analysis, conceptual structure design, logical structure design, and physical structure design. Experienced the design and development process of the system for a while. Many things are clearly written in the book, and it seems to be very simple, and the thinking is very clear. But when you really need to find a way to design a system by yourself, you will find out the difficulty. I often find that there is a problem with my initial design, and then go back to rework, and constantly improve my ideas through various iterations. Since it is a topic for implementation, we must pay attention to the requirements, because our team did not clearly propose the requirements at the beginning, which led to the initial stage of always reinventing the wheel, so we must first clarify the requirements when designing the database. The overall design direction and the connection between each module design must be clear, and the opinions must be unified, so as not to do useless work and start over. Communication between teams is very important, especially when the modules of the database are merged, communication must be strengthened, which can greatly improve efficiency and complete tasks.
Thanks to the teacher for giving us this opportunity to practice. In this process, we have learned a lot of practical knowledge that is not in the textbooks, and we have also thoroughly understood the previous ambiguous knowledge points, and found some previous misunderstandings and corrected them in time. In order to make corrections, encourage each other, continue to carry out a lot of practice, through continuous self-study, constantly discover problems, think about problems, and then solve problems.
We also like Mr. Liu's class very much. The two of us will always remember Mr. Liu's "do whatever you want and do whatever you want". Not only can we have a little discussion in the classroom to rest as we please, but also the teacher's amiable and good listening nature allows us to talk freely, and it is also possible to "do whatever we want and do whatever we want" after learning the theoretical knowledge of database and using it in practice. "Hard core capability.
Teacher Liu's class is different from the traditional textbook-based class. Every important and difficult point has vivid examples and explanations from the teacher, which not only makes us understand this important and difficult point, but also impresses us deeply. Mr. Liu's amiability is his signature. Every time we see Mr. Liu's amiable smile, our enthusiasm for learning can be ignited. It can be said that Mr. Liu is a magical person, an excellent teacher who can make us really like to study independently!

Guess you like

Origin blog.csdn.net/weixin_55085530/article/details/122199862