轎車管理系統(tǒng)課程設計說明書代碼完整版.doc_第1頁
轎車管理系統(tǒng)課程設計說明書代碼完整版.doc_第2頁
轎車管理系統(tǒng)課程設計說明書代碼完整版.doc_第3頁
轎車管理系統(tǒng)課程設計說明書代碼完整版.doc_第4頁
轎車管理系統(tǒng)課程設計說明書代碼完整版.doc_第5頁
已閱讀5頁,還剩32頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領

文檔簡介

1需求分析隨著近年來我國經(jīng)濟的發(fā)展,國民生活水平的提高,國內(nèi)的轎車產(chǎn)業(yè)開始迅猛發(fā)展,人民群眾對于轎車的需求也是日益增多,也因此產(chǎn)生了很多轎車銷售公司。在這些轎車銷售公司里,由于業(yè)務繁忙,往往需要處理各種品牌型號轎車的銷售查詢工作,銷售員的管理工作等等。這些工作如果光靠人工來實現(xiàn),工作量就很大,而且容易出現(xiàn)錯誤,造成管理上的混亂。因此,制作一套轎車銷售管理系統(tǒng)對于公司管理能夠提高轎車銷售公司的管理水平、工作效率、服務質(zhì)量、降低銷售成本,最終提高公司的市場競爭力。1.1 編寫目的轎車銷售管理系統(tǒng)可以有效的管理轎車信息、員工信息和客戶信息。它主要進行轎車銷售公司的管理工作。本系統(tǒng)以MY SQL 為后臺數(shù)據(jù)庫,利用MY SQL對數(shù)據(jù)庫進行管理和操作。本系統(tǒng)將以轎車銷售公司的管理為背景,介紹如何以JAVA為前臺開發(fā)工具,MY SQL為后臺數(shù)據(jù)庫管理系工具開發(fā)數(shù)據(jù)庫應用系統(tǒng)。本系統(tǒng)具有很強的使用性,用戶只要根據(jù)實際的使用情況稍加修改,就可以把它應用到實際工作中。 1.1.1數(shù)據(jù)庫應用系統(tǒng)的開發(fā)涉及如下內(nèi)容:l 系統(tǒng)功能設計;l 數(shù)據(jù)庫設計;l 界面設計l 程序代碼設計 1.1.2項目內(nèi)容:開發(fā)一個轎車銷售管理系統(tǒng)對于該項目,主要注意以下兩個方面:l 轎車銷售公司的銷售員管理、轎車信息管理和客戶信息管理l 轎車銷售系統(tǒng)中涉及那些數(shù)據(jù)對象,各對象之間以及對象內(nèi)部的關系如何?如何保存?zhèn)€數(shù)據(jù)對象的相關數(shù)據(jù),以便轎車銷售管理系統(tǒng)進行數(shù)據(jù)處理。1.2 分析 1.2.1轎車銷售系統(tǒng)的主要功能有:(1) 系統(tǒng)用戶管理功能。用戶根據(jù)姓名和密碼登錄系統(tǒng)。登錄用戶分為兩個等級:普通用戶和管理員用戶。普通用戶只查看轎車信息、客戶信息、員工信息等功能;管理員用戶(admin)除了以上功能外,同時還有添加用戶、修改用戶密碼和刪除用戶的功能。(2) 轎車信息管理功能。錄入所銷售的轎車編號、型號、品牌、價格、保修期等信息,同時支持對轎車信息的添加、修改、刪除和查詢功能。(3) 客戶信息管理功能。錄入購買轎車的客戶姓名、性別、年齡、聯(lián)系方式、所購車型號、購車價格等信息,同時還支持虧客戶信息的添加、修改、刪除和查詢功能。(4) 員工信息管理功能。錄入員工的員工號、姓名、性別等信息,同時支持對員工信息的添加、修改、刪除和查詢功能。 1.2.2數(shù)據(jù)庫信息經(jīng)過實際的需求分析,確定需要包含以下數(shù)據(jù)庫信息:【轎車庫存信息:】轎車編號(標識列),轎車型號,轎車名稱,轎車品牌,轎車銷量【員工信息:】員工編號,姓名,性別,年齡,電話,業(yè)績【客戶信息:】客戶編號,客戶姓名,客戶性別,客戶年齡,客戶電話【轎車銷售信息:】序號(標識列),轎車型號,銷售員編號,客戶編號,銷售日期2總體設計2.1系統(tǒng)流程圖根據(jù)系統(tǒng)的功能要求,采用模塊化的方法,設計圖書借閱系統(tǒng)的控制流程圖如圖: 登錄修改用戶密碼查詢用戶密碼系統(tǒng)用戶刪除系統(tǒng)用戶管理功能轎車信息管理功能客戶信息管理功能員工信息管理功能轎車信息查詢轎車信息添加轎車信息修改轎車信息刪除客戶信息查詢客戶信息添加客戶信息修改客戶信息刪除員工信息查詢員工信息添加員工信息修改員工信息刪除系統(tǒng)用戶添加 2.2 E-R模型用E-R模型描述系統(tǒng)中的實體集與實體集之間的關系,目的是以E-R圖為工具,設計關系型的數(shù)據(jù)庫,即確定應用系統(tǒng)所使用的數(shù)據(jù)庫應包含哪些表,每個表的結(jié)構(gòu)是怎么樣的。 系統(tǒng)用戶員工信息客戶信息轎車信息管理用戶名密 碼用戶等級類型描述用戶級別轎車型號轎車編號轎車品牌轎車價格轎車保修期轎車具體描述客戶編號客戶年齡客戶職業(yè)身份證號客戶電話客戶住址購車價格購車型號客戶性別客戶姓名員工編號員工性別員工姓名員工電話員工職務員工生日員工地址進入公司時間所在部門 2.3 關系描述的設計 根據(jù)以上各E-R圖,經(jīng)過轉(zhuǎn)換,可以導出各個關系。這些實體涉及的數(shù)據(jù)項有: 系統(tǒng)用戶:(用戶名,密碼,用戶等級) 管理:(用戶等級,類型描述) 轎車信息:(轎車編號,轎車型號,轎車品牌,轎車銷量) 客戶信息:(客戶編號,客戶姓名,客戶性別,客戶年齡,客戶電話) 員工信息:(員工編號,員工姓名,員工性別,員工年齡,員工電話,員工業(yè)績) 轎車銷售信息:(銷售記錄編號,轎車型號,銷售員編號,客戶編號,銷售日期) 2.4數(shù)據(jù)庫物理設計 2.4.1創(chuàng)建數(shù)據(jù)庫 在創(chuàng)建數(shù)據(jù)庫表之前,首先要創(chuàng)建一個數(shù)據(jù)庫,本系統(tǒng)以MY SQL 為后臺數(shù)據(jù)庫。用戶可以在企業(yè)管理器中創(chuàng)建數(shù)據(jù)庫,也可以在MY SQL執(zhí)行SQL語句。需要注意的是,在設計數(shù)據(jù)庫結(jié)構(gòu)時,通常需要考慮主文件,從文件和日志文件的存儲位置和大小。文件大小可以根據(jù)數(shù)據(jù)庫的用途,用戶數(shù)量和存儲數(shù)據(jù)等因素綜合考慮。一般初始大小不宜設置過大,以免浪費存儲空間。而文件最大尺寸需要設置大些,以保證有足夠的存儲空間。日志文件則不需要太多的空間。 2.4.2轎車銷售管理系統(tǒng)庫表結(jié)構(gòu)設計 該系統(tǒng)設計了五個數(shù)據(jù)庫表:用戶信息表Users、用戶類型表UserType、轎車信息表Car、客戶信息表Customer、員工信息表Staff。 具體結(jié)構(gòu)如下圖所示:Users表字段名稱標識名稱數(shù)據(jù)類型空否字段說明User_name用戶名Varchar(10)N主鍵User_pwd密碼Varchar(20)NUser_type用戶等級smallintN限制用戶權(quán)限UserType表字段名稱標識名稱數(shù)據(jù)類型空否字段說明User_type用戶等級SmallintN限制用戶權(quán)限Type_discription類型描述Varchar(50)NCar表字段名稱標識名稱數(shù)據(jù)類型空否字段說明Car_ip轎車編號IntN自增,主鍵Car_name轎車型號Varchar(20)NCar_brand轎車品牌Varchar(10)NCar_cout轎車銷量Int NCustomer表字段名稱標識名稱數(shù)據(jù)類型空否字段說明Customer_id客戶編號IntN自增,主鍵Customer_name客戶姓名Varchar(10)NCustomer_sex客戶性別Varchar(2)NCustomer_age客戶年齡IntYCustomer_tel客戶電話Varchar(10)YStaff表字段名稱標識名稱數(shù)據(jù)類型空否字段說明Staff_id員工編號IntN自增,主鍵Staff_name員工姓名Varchar(10)NStaff_sex員工性別Varchar(2)NStaff_tel員工電話Varchar(10)YStaff_age員工年齡IntY2.4.3 用SQL建立各個表(1)建立Users表:CREATE TABLE dbo.Users( User_name VARCHAR(10) Primary Key User_pwd VARCHAR(20) NOT NULL User_type SMALLINT NOT NULL)(2) 建立UserType表CREATE TABLE dbo.UserType( User_type SMALLINT Primary Key Type_discription VARCHAR(100) NOT NULL)(3)建立Car表CREATE TABLE dbo.Car(Car_id INT Primary Key Car_name VARCHAR(20) NOT NULL Car_brand VARVHAR(20) NOT NULL Car_cout INT )(4) 建立Customer表CREATE TABLE dbo.Customer(Customer_id INT Primary KeyCustomer_name VARCHAR(10) NOT NULLCustomer_sex VARCHAR(2) NULLCustomer_age INT NULLCustomer_tel VARCHAR(10) NULL)(5) 建立Staff表CREATE TABLE dbo.staff( Staff_id INT Primary KeyStaff_name VARCHAR(10) NOT NULLStaff_sex VARCHAR(2) NOT NULL Staff_age INT NULLStaff_tel VARCHAR(10) NULL)3 詳細設計3.1銷售界面的設計及功能描述(1)轎車管理系統(tǒng)啟動時的界面點擊運行按鈕,出現(xiàn)如圖所示的啟動界面,進行轎車銷售處理(2)車輛信息 員工信息 客戶信息 銷售記錄查詢界面點擊界面的車輛信息、員工信息、客戶信息、銷售記錄查看按鈕,運行出對應數(shù)據(jù)庫中已存的車輛、員工、客戶以及銷售記錄信息(3)新建車輛界面點擊界面的新建車輛按鈕,填寫車輛的有關信息,并對應的存儲到相應的數(shù)據(jù)庫中(4)新建員工界面點擊界面的新建員工按鈕,填寫員工的有關信息,并對應的存儲到相應的數(shù)據(jù)庫中(5)新建客戶界面點擊界面的新建客戶按鈕,填寫客戶的有關信息,并對應的存儲到相應的數(shù)據(jù)庫中(6)新建銷售記錄界面點擊界面的新建銷售記錄按鈕,填寫銷售記錄的有關信息,并對應的存儲到相應的數(shù)據(jù)庫中(7)刪除信息界面點擊界面的刪除信息按鈕,填寫車輛、客戶、員工、銷售記錄表的數(shù)據(jù)編號,以及對應的表名,刪除表中對應的信息(8)清空界面點擊界面的晴空控制臺按鈕,清除在界面中顯示的所有銷售信息3.2 源代碼(1) Car.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JTextField;class Car extends JDialog implements ActionListener/* * */private static final long serialVersionUID = -2567952878290133643L;Container context;JTextField id;JTextField brand;JTextField type;JButton ok,cancle;JLabel lbrand,ltype,lid;Car()context=this.getContentPane();context.setLayout(new FlowLayout();this.setSize(500, 90);lid=new JLabel(ID:);lbrand=new JLabel(品牌:);ltype=new JLabel(型號:);id=new JTextField(10);brand=new JTextField(10);type=new JTextField(10);lid.setLabelFor(id);lbrand.setLabelFor(brand);ltype.setLabelFor(type);ok=new JButton(確定);cancle=new JButton(取消);context.add(lid);context.add(id);context.add(lbrand);context.add(brand);context.add(ltype);context.add(type);context.add(ok);context.add(cancle);ok.addActionListener(this);cancle.addActionListener(this);this.pack();this.setVisible(true);public void actionPerformed(ActionEvent e) Object s=e.getSource();if(s=ok)try String _id = id.getText();String _type = type.getText();String _brand = brand.getText();Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = insert into cars(id,brand,type) value(+_id+,+_brand+,+_type+);System.out.print(sql);stmt.execute(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();/需要在此添加過濾代碼過濾非法輸入/manage.insertclass(Integer.parseInt(id.getText(), name.getText();this.setVisible(false);else if(s=cancle)this.setVisible(false);/public static void main(String args) /new Car();/(2) Client.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JTextField;class Client extends JDialog implements ActionListener/* * */private static final long serialVersionUID = -6547959361972952105L;Container context;JTextField id;JTextField name;JTextField sex;JTextField age;JTextField cell;JButton ok,cancle;JLabel lid,lname,lsex,lage,lcell;Client()context=this.getContentPane();context.setLayout(new FlowLayout();this.setSize(500, 90);lid=new JLabel(ID:);lname=new JLabel(名稱:);lsex=new JLabel(性別:);lage=new JLabel(年齡:);lcell=new JLabel(電話:);id=new JTextField(10);name=new JTextField(10);sex=new JTextField(2);age=new JTextField(3);cell=new JTextField(10);lid.setLabelFor(id);lname.setLabelFor(name);lsex.setLabelFor(sex);lage.setLabelFor(age);lcell.setLabelFor(cell);ok=new JButton(確定);cancle=new JButton(取消);context.add(lid);context.add(id);context.add(lname);context.add(name);context.add(lsex);context.add(sex);context.add(lage);context.add(age);context.add(lcell);context.add(cell);context.add(ok);context.add(cancle);ok.addActionListener(this);cancle.addActionListener(this);this.pack();this.setVisible(true);public void actionPerformed(ActionEvent e) Object s=e.getSource();if(s=ok)try String _id = id.getText();String _name = name.getText();String _sex = sex.getText();String _age = age.getText();Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = insert into clinet(id,name,sex,age) value(+_id+,+_name+,+_sex+,+_age+);System.out.print(sql);stmt.execute(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();this.setVisible(false);/(Integer.parseInt(id.getText(), name.getText();else if(s=cancle)this.setVisible(false);/public static void main(String args) /new Client();/(3) Connections.javaimport java.sql.Connection;import java.sql.DriverManager;public class Connections public Connection connect()Connection connection = null;try Class.forName(com.mysql.jdbc.Driver);String url = jdbc:mysql:/localhost:3306/car;String user = root;String password = root;connection = DriverManager.getConnection(url, user, password); catch (Exception e) e.printStackTrace();/ TODO: handle exceptionreturn connection;(4) Del.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JTextField;class del extends JDialog implements ActionListener/* * */private static final long serialVersionUID = 3712830203472566152L;Container context;JTextField id;JTextField target;JButton ok,cancle;JLabel lid,ltarget;del()context=this.getContentPane();context.setLayout(new FlowLayout();this.setSize(500, 90);lid=new JLabel(ID:);ltarget=new JLabel(所在的表:);id=new JTextField(10);target=new JTextField(10);lid.setLabelFor(id);ltarget.setLabelFor(target);ok=new JButton(確定);cancle=new JButton(取消);context.add(lid);context.add(id);context.add(ltarget);context.add(target);context.add(ok);context.add(cancle);ok.addActionListener(this);cancle.addActionListener(this);this.pack();this.setVisible(true);public void actionPerformed(ActionEvent e) Object s=e.getSource();if(s=ok)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = delete from +target.getText()+ where id=+id.getText()+;stmt.execute(sql); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();this.setVisible(false);else if(s=cancle)this.setVisible(false);(5) Mainframe.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.*;import javax.swing.*;public class Mainframe extends JFrame implements ActionListener /* * */private static final long serialVersionUID = -3254015039949474992L;public static void main(String agrv)new Mainframe();private Container cpanel;JTextArea text;JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10;Mainframe()cpanel=this.getContentPane();cpanel.setLayout(new FlowLayout();this.setSize(720, 500);text=new JTextArea(控制臺輸出:+n,20,55);JScrollPane scroll=new JScrollPane(text);/text.add(scroll);b1=new JButton(車輛信息);b2=new JButton(員工信息);b3=new JButton(客戶信息);b10=new JButton(銷售記錄查看);b4=new JButton(新建車輛);b5=new JButton(新建員工);b6=new JButton(新建客戶);b9=new JButton(新建銷售記錄);b7=new JButton(刪除信息);b8=new JButton(清空控制臺);cpanel.add(b1);cpanel.add(b2);cpanel.add(b3);cpanel.add(b10);cpanel.add(b4);cpanel.add(b5);cpanel.add(b6);cpanel.add(b9);cpanel.add(b7);cpanel.add(b8);cpanel.add(text);this.setVisible(true);b1.addActionListener(this);b2.addActionListener(this);b3.addActionListener(this);b10.addActionListener(this);b4.addActionListener(this);b5.addActionListener(this);b6.addActionListener(this);b9.addActionListener(this);b7.addActionListener(this);b8.addActionListener(this);public void actionPerformed(ActionEvent e) Object s=e.getSource();if(s=b1)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = select * from cars;ResultSet r=null;try r= stmt.executeQuery(sql); catch (SQLException e1) e1.printStackTrace();text.append(ID 品牌 型號 銷量+n);for(int i = 0; r.next(); i+)text.append(r.getString(1);text.append( );text.append(r.getString(2);text.append( );text.append(r.getString(3);text.append( );text.append(String.valueOf(r.getInt(4);text.append( n); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();/打印車輛信息else if(s=b2)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = select * from staff;ResultSet r=null;try r= stmt.executeQuery(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();text.append(ID 名字 性別 年齡 業(yè)績+n);for(int i = 0; r.next(); i+)text.append(r.getString(1);text.append( );text.append(r.getString(2);text.append( );text.append(r.getString(3);text.append( );text.append(String.valueOf(r.getInt(4);text.append( );text.append(r.getString(3);text.append( n); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();/打印員工信息else if(s=b3)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = select * from clinet;ResultSet r=null;try r= stmt.executeQuery(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();text.append(ID 名字 性別 年齡+n);for(int i = 0; r.next(); i+)text.append(r.getString(1);text.append( );text.append(r.getString(2);text.append( );text.append(r.getString(3);text.append( );text.append(String.valueOf(r.getInt(4);text.append( n); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();else if(s=b10)try Connection c = new Connections().connect();Statement stmt = c.createStatement();String sql = select * from orders;ResultSet r=null;try r= stmt.executeQuery(sql); catch (SQLException e1) / TODO Auto-generated catch blocke1.printStackTrace();text.append(銷售記錄ID 汽車ID 銷售員ID 客戶ID 日期+n);for(int i = 0; r.next(); i+)text.append(String.valueOf(r.getInt(1);text.append( );text.append(String.valueOf(r.getInt(2);text.append( );text.append(String.valueOf(r.getInt(3);text.append( );text.append(String.valueOf(r.getInt(4);text.append( );text.append(String.valueOf(r.getInt(5);text.append( );text.append( n); catch (SQLException e2) / TODO Auto-generated catch blocke2.printStackTrace();/打印客戶信息else if(s=b4)new Car();else if(s=b5)new Staff();else if(s=b6)new Client();else if(s=b7)new del();else if(s=b9)new Order();else if(s=b8)text.setText(null);(6) Order.javaimport java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JTextField;class Order extends JDialog implements ActionListener/* * */private static final long serialVersionUID = -2567952878290133643L;Container context;JTextField id;JTextField brand;JTextField type;JTextField date;JButton ok,cancle;JLabel lbrand,ltype,lid,ldate;Order()context=this.getContentPane();context.setLayout(new FlowLayout();this.setSize(500, 90);lid=new JLabel(汽車ID:);lbrand=new JLabel(銷售人員ID:);ltype=new JLabel(客戶ID:);ldate=new JLabel(日期:);id=new JTextField(10);brand=new JTextField(10);type=new JTextField(10);date=new JTextField(10);lid.setLabelFor(id);lbrand.setLabelFor(brand);ltype.setLabelFor(type);ldate.

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論