高校固定資產(chǎn)管理系統(tǒng)方案_第1頁
高校固定資產(chǎn)管理系統(tǒng)方案_第2頁
高校固定資產(chǎn)管理系統(tǒng)方案_第3頁
高校固定資產(chǎn)管理系統(tǒng)方案_第4頁
高校固定資產(chǎn)管理系統(tǒng)方案_第5頁
已閱讀5頁,還剩37頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、郵電大學理學院信息與計算科學專業(yè)集中實踐報告題 目:高校固定資產(chǎn)管理系統(tǒng)指導老師:永紅專 業(yè):數(shù)理科學與信息技術班 級:1121302、1121301學 號: 2013213055、 2013213058姓 名: 何銳、周海渝成 績:206年06月16日1、 需求分析隨著社會的發(fā)展,人們的生活節(jié)奏不斷加快。為了節(jié)約寶貴的時間,高校固定資產(chǎn)管理系統(tǒng)應運而生。在管理固定資產(chǎn)的過程中,需要修改、更新大量的表單。如果使用計算機來輔助填寫及保存相應的記錄,則能大大提高固定資產(chǎn)管理的效率。因此,需要開發(fā)一個固定資產(chǎn)管理系統(tǒng)。該系統(tǒng)應該支持快速錄入關鍵信息,例如, 固定資產(chǎn)的借出、歸還等。這些信息需要被保存

2、在數(shù)據(jù)庫中以便以后查看。通過對程序需要實現(xiàn)的功能進行分析,完成數(shù)據(jù)庫和程序界面的設計。通過 對高校固定資產(chǎn)管理系統(tǒng)的了解,要求其具備如下功能。1. 登錄系統(tǒng)登錄系統(tǒng)可以有效地保障系統(tǒng)的安全性,防止非法用戶使用系統(tǒng)。只有輸入合法的用戶名和密碼才能夠正常登錄,否則不能進行登錄。2. 添加信息用戶進入系統(tǒng)后,通過對“資產(chǎn)信息管理”菜單中的“類別管理”菜單項, 可以進行大類(總的分類)的添加。同樣,在其他幾個菜單中也可進行信息添加。3. 刪除信息用戶進入系統(tǒng)后,通過對“賬戶管理”菜單中的“刪除”菜單項,可以進行的刪除。同樣,在其他幾個菜單中也可進行信息刪除。4. 修改信息考慮到操作人員錄入的失誤,需要

3、提供信息的修改功能。通過“職員管理”菜單中的“修改職員”菜單項,可以對職員信息進行修改。同樣,在其他幾個菜單中也可進行信息修改。5. 查詢信息用戶進入系統(tǒng)后,可以通過“按編號查”、“按類別查”、“按使用者查” 的不同類別進行信息查詢。6. 添加用戶進入系統(tǒng)后,可以通過“賬戶管理”菜單的“添加用戶”菜單項添加新的用戶,并為其指定密碼。一旦新用戶添加成功,以后就可以通過該用戶進入系統(tǒng)進行操作。7. 修改密碼為了提高系統(tǒng)的安全性,通常建議管理員定期修改密碼。使用“賬戶管理”菜單的“修改密碼”菜單項可以進行密碼的修改。2、 總體設計1. 通過對系統(tǒng)進行深入的分析得知,本系統(tǒng)需要實現(xiàn)以下目標。系統(tǒng)管理資

4、產(chǎn)信息管理賬戶管理職員管理資產(chǎn)還借管理幫助查詢按編號查詢:按類別查詢:按使用者查詢:資產(chǎn)信息分類顯示顯示當前時間2. 構建開發(fā)環(huán)境操作系統(tǒng):windows7JDK版本:jdk1.8.0_31 IDE 版本: Eclipse開發(fā)語言:Java后臺數(shù)據(jù)庫:SQL Server 20083、 控制類設計(部分類代碼)在 cn.tsc.asset.contrl 包中1. ConnectionManager 控制類作用:數(shù)據(jù)庫連接代碼: package.tsc.asset.contrl;import java.sql.DriverManager;import java.sql.Connection;im

5、port java.sql.CallableStatement;import java.sql.ResultSet;import java.sql.SQLException;import javax.swing.JOptionPane;/* * 控制類 - 數(shù)據(jù)庫連接管理*/ /* * author pengwenfu*/public final class ConnectionManager / 驅動類DRIVER_CLASS =DATABASE_URL = = Assets"privatestatic final String".microsoft.jdbc.sqlse

6、rver.SQLServerDriver"/ 數(shù)據(jù)庫地址private static final String "jdbc:microsoft:sqlserver:/:1433;databaseName/ 數(shù)據(jù)庫登錄名private static final String USER_NAME = "sa"/ 密碼 private static final String PASSWORD = "1234"* 構造方法禁止實例化* /private ConnectionManager() /* 取得數(shù)據(jù)庫連接* retu

7、rn* /public static Connection getConnection() try Class.forName(DRIVER_CLASS);ConnectionconDriverManager.getConnection(DATABASE_URL,USER_NAME, PASSWORD);return con; catch (ClassNotFoundException e) e.printStackTrace();"沒 有 找 到 連JOptionPane.showMessageDialog(null,接數(shù)據(jù)庫所需的驅動類!", " 錯誤 &qu

8、ot;,JOptionPane.ERROR_MESSAGE);return null; catch (SQLException e) e.printStackTrace();JOptionPane.showMessageDialog(null, " 數(shù) 據(jù) 庫 連 接 錯誤 ! 請核實配置文件是否有誤!", " 錯誤 ",JOptionPane.ERROR_MESSAGE);return null;/* 關閉數(shù)據(jù)庫連接 * param conn*/public static void closeConnection(Connection con) try

9、 if (con != null && !con.isClosed() con.close(); catch (SQLException e) e.printStackTrace();/* * 關閉數(shù)據(jù)庫操作對象* param cst */ public static void closeStatement(CallableStatement cst) try if (cst != null) cst.close(); catch (SQLException e) e.printStackTrace();/*關閉記錄集* param rs */ public static vo

10、id closeResultSet(ResultSet rs) try if (rs != null) rs.close(); rs = null; catch (SQLException e) e.printStackTrace();2. DBWorker控制類作用:數(shù)據(jù)庫操作代碼:package.tsc.asset.contrl;import java.sql.CallableStatement;import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQLException;import java.util

11、.ArrayList;import java.util.Collection;import.tsc.asset.entity.Asset;import.tsc.asset.entity.Category;import.tsc.asset.entity.Employee;import.tsc.asset.entity.Lent;import.tsc.asset.entity.Operator;import.tsc.asset.entity.Returned;try import.tsc.asset.entity.Subcate;/* * 控制類 - 數(shù)據(jù)庫操作*/ /* * author pen

12、gwenfu*/ public class DBWorker /* * 查找管理員信息* param name名稱* param pwd密碼* return */public static Collection selOperator(String name, String pwd,OperatorSelType inNamePwd) / 連接數(shù)據(jù)庫Connection con = ConnectionManager.getConnection();CallableStatement cst = null;ResultSet rs = null;/ 建一個操作員列表Collection<

13、Operator> opc = new ArrayList<Operator>();String proc = "call proc_selOperator '" + name + "','"+ pwd+ "','" + inNamePwd + "'"/ 取得操作員表數(shù)據(jù)cst = con.prepareCall(proc);rs = cst.executeQuery();while (rs.next() Operator op = new Oper

14、ator();op.setName(rs.getString("Oname");op.setPwd(rs.getString("Opwd");opc.add(op); catch (SQLException ex) ex.printStackTrace(); finally ConnectionManager.closeResultSet(rs);ConnectionManager.closeStatement(cst);ConnectionManager.closeConnection(con);return opc;/ param param或職務

15、* param selType查找類型查找職員信息* return*/public static Collection selEmp(String param, EmployeeSelType selType) / 連接數(shù)據(jù)庫Connection con = ConnectionManager.getConnection();CallableStatement cst = null;ResultSet rs = null;/ 建一個職員列表Collection<Employee> empc = new ArrayList<Employee>();try String p

16、roc = "call proc_selEmp '" + param + "','" + selType+ "'"/ 取得職員表數(shù)據(jù)cst = con.prepareCall(proc);rs = cst.executeQuery();while (rs.next() Employee emp = new Employee();emp.setId(rs.getInt("Eid");emp.setName(rs.getString("Ename");emp.setS

17、ex(rs.getString("Esex");emp.setAge(rs.getInt("Eage");emp.setPosition(rs.getString("Eposition");emp.setRemark(rs.getString("Eremark"); empc.add(emp); catch (SQLException ex) ex.printStackTrace(); finally ConnectionManager.closeResultSet(rs);ConnectionManager.cl

18、oseStatement(cst);ConnectionManager.closeConnection(con);return empc;/*查找大類信息* param name大類名* param selType查找類型* return */public static Collection selCate(String name, CateSelType selType) / 連接數(shù)據(jù)庫Connection con = ConnectionManager.getConnection();CallableStatement cst = null;ResultSet rs = null;/ 建一

19、個類別列表Collection<Category> cc = new ArrayList<Category>();try / 取得類別表數(shù)據(jù)cst = con.prepareCall("call proc_selCate '" + name +III III+ selType + "'");rs = cst.executeQuery();while (rs.next() Category c = new Category();c.setId(rs.getInt("Cid");c.setName(

20、rs.getString("Cname");cc.add(c); catch (SQLException ex) ex.printStackTrace(); finally ConnectionManager.closeResultSet(rs);ConnectionManager.closeStatement(cst);ConnectionManager.closeConnection(con);return cc;/ param param*存儲過程參數(shù)* param selType*查找類型* return */public static Collection sel

21、Subcate(String param, SubcateSelType selType) 查找子類信息/ 連接數(shù)據(jù)庫Connection con = ConnectionManager.getConnection();CallableStatement cst = null;ResultSet rs = null;/ 建一個子類列表Collection<Subcate> scc = new ArrayList<Subcate>();try / 取得子類表數(shù)據(jù)cst = con.prepareCall("call proc_selSubcate '&q

22、uot; + paramIll III+ selType + "'");rs = cst.executeQuery();while (rs.next() Subcate sc = new Subcate();sc.setId(rs.getInt("Sid");sc.setName(rs.getString("Sname");sc.setCateId(rs.getInt("SCid");scc.add(sc); catch (SQLException ex) ex.printStackTrace(); fin

23、ally ConnectionManager.closeResultSet(rs);ConnectionManager.closeStatement(cst);ConnectionManager.closeConnection(con);return scc;/* * 查找資產(chǎn)信息* param procName* 存儲過程名* param param* 存儲過程參數(shù)* return* /public static Collection selAsset(String proc, String param) / 連接數(shù)據(jù)庫Connection con = ConnectionManager.g

24、etConnection();CallableStatement cst = null;ResultSet rs = null;/ 建一個資產(chǎn)信息列表Collection<Asset> ac = new ArrayList<Asset>();try / 取得資產(chǎn)信息表數(shù)據(jù)cst = con.prepareCall("call " + proc + " '" + paramIII");rs = cst.executeQuery();while (rs.next() Asset a = new Asset();a.s

25、etId(rs.getInt(1);a.setName(rs.getString(2);a.setCateName(rs.getString(3);a.setSubcateName(rs.getString(4);a.setModel(rs.getString(5);a.setPrice(rs.getDouble(6);a.setPurDate(rs.getString(7);a.setStatus(rs.getString(8);a.setUseBy(rs.getString(9);a.setRemark(rs.getString(10);ac.add(a); catch (SQLExcep

26、tion ex) ex.printStackTrace(); finally ConnectionManager.closeResultSet(rs);ConnectionManager.closeStatement(cst);ConnectionManager.closeConnection(con);return ac;/* * 查找借出資產(chǎn)信息* param param存儲過程參數(shù)* param selType查找類型* return */ public static Collection selLent(String param, LentSelType selType)/ 連接數(shù)據(jù)庫

27、Connection con = ConnectionManager.getConnection();CallableStatement cst = null;ResultSet rs = null;/ 建一個借出記錄列表Collection<Lent> lc = new ArrayList<Lent>();try / 取得借出記錄表數(shù)據(jù)cst = con.prepareCall("call proc_selLent '" + param + "''"+ selType + "'"

28、;);rs = cst.executeQuery();while (rs.next() Lent l = new Lent();l.setId(rs.getInt("Lid");l.setAssetId(rs.getInt("LAid");l.setEmpId(rs.getInt("LEid");l.setOperatorName(rs.getString("LOname");l.setDate(rs.getString("Ldate");l.setPurpose(rs.getString(&q

29、uot;Lpurpose");l.setRemark(rs.getString("Lremark");l.setAssetName(rs.getString("Aname");l.setModel(rs.getString("Amodel");l.setSubcateName(rs.getString("Sname");l.setUseBy(rs.getString("Ause_by");lc.add(l); catch (SQLException ex) ex.printStackT

30、race(); finally ConnectionManager.closeResultSet(rs);ConnectionManager.closeStatement(cst);ConnectionManager.closeConnection(con);return lc;/*查找歸還記錄* return*/public static Collection selReturned() / 連接數(shù)據(jù)庫Connection con = ConnectionManager.getConnection();CallableStatement cst = null;ResultSet rs = n

31、ull;/ 建一個歸還記錄列表Collection<Returned> rc = new ArrayList<Returned>();try / 取得歸還記錄表數(shù)據(jù)cst = con.prepareCall("call proc_selReturned");rs = cst.executeQuery();while (rs.next() Returned r = new Returned();r.setId(rs.getInt("Rid");r.setAssetId(rs.getInt("RAid");r.se

32、tAssetName(rs.getString("RAname");r.setUser(rs.getString("Ruse_by");r.setLentDate(rs.getString("RLdate");r.setReturnDate(rs.getString("Rdate");r.setLentOname(rs.getString("RLOname");r.setReturnOname(rs.getString("RROname");r.setRemark(rs.ge

33、tString("Rremark");rc.add(r); catch (SQLException ex) ex.printStackTrace(); finally ConnectionManager.closeResultSet(rs);ConnectionManager.closeStatement(cst);ConnectionManager.closeConnection(con);return rc;* 修改記錄: 包括添加、刪除、修改* param strProcInvoke* 調用存儲過程的字符串* return* /public static int mo

34、difyRecord(String strProcInvoke) Connection con = ConnectionManager.getConnection();try return con.prepareCall("call " + strProcInvoke + "") .executeUpdate(); catch (SQLException e) e.printStackTrace();return 0; finally ConnectionManager.closeConnection(con);/*子類別查找類型* author Tom

35、 */ public enum SubcateSelType BY_NAME, BY_CATE_NAME/* * 大類別查找類型* author Tom */ public enum CateSelType BY_NAME, BY_HAVE_SUBCATE, ALL/* * 管理員名查找類型 author Tom*/ public enum OperatorSelType IN_NAME, IN_NAME_PWD/* * 借出記錄查找類型* author Tom*/ public enum LentSelType BY_OPERATOR_NAME, BY_EMPLOYEE_ID, BY_ASS

36、ET_ID, ALL/* * 職員查找類型* author Tom*/ public enum EmployeeSelType BY_NAME, BY_POSITION, ALL實體類設計(部分類代碼)四、包中在 cn.tsc.asset.entity1 Asset 實體類作用:定義資產(chǎn)信息代碼 :package .tsc.asset.entity;/* 實體類- 資產(chǎn)信息*/public class Asset private int id ;private String name;private String cateName;private String subcateName;priv

37、ate double price ;private String model;private String purDate ;private String status ;private String useBy;private String remark;public String getCateName() return cateName;public void setCateName(String cateName) this . cateName = cateName;public int getId() return id ;public void setId( int id) th

38、is . id = id; public String getModel() return model;public void setModel(String model) this . model = model;public String getName() return name;public void setName(String name) this . name= name;public double getPrice() return price ;public void setPrice( double price) this . price = price;public St

39、ring getPurDate() return purDate ;public void setPurDate(String purDate) this . purDate = purDate;public String getRemark() return remark ;public void setRemark(String remark) this . remark = remark;public String getStatus() return status ;public void setStatus(String status) this . status = status;

40、 public String getSubcateName() return subcateName;public void setSubcateName(String subcateName) this . subcateName = subcateName;public String getUseBy() return useBy;public void setUseBy(String useBy) this . useBy = useBy;2. Employee 實體類作用:定義職員信息代碼:package .tsc.asset.entity;/* 實體類 - 職員信息*/public

41、class Employee privateint id ;privateStringname;privateStringsex;privateint age;privateStringposition ;privateStringremark;public int getId() return id ;public void setId( int id) this . id = id;public String getName() return name;public void setName(String name) this . name= name;public String getP

42、osition() return position ;public void setPosition(String position) this . position = position;public String getRemark() return remark ;public void setRemark(String remark) this . remark = remark;public String getSex() return sex;public void setSex(String sex) this . sex = sex;public int getAge() re

43、turn age;public void setAge( int age) this . age = age;五、 用戶界面類設計(部分類代碼)在 cn.tsc.asset.userinterface 包中1.MMffl戶界面類作用:生成主界面代碼:package.tsc.asset.userinterface;/ download by import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.Compone

44、ntAdapter;import java.awt.event.ComponentEvent;import java.io.File;import java.util.Collection;import java.util.Timer;import javax.swing.BorderFactory;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.event.TreeSelectionEv

45、ent;import javax.swing.event.TreeSelectionListener;import javax.swing.tree.DefaultMutableTreeNode;import.tsc.asset.contrl.DBWorker;import.tsc.asset.contrl.DateTimeView;import.tsc.asset.contrl.ImageGetter;import.tsc.asset.contrl.MenuFactory;import.tsc.asset.contrl.WindowCenter;/*用戶界面類- 主界面*/public cl

46、ass MM extends JFrame private static final long serialVersionUID = 1L;/ 樹的要根結點public DefaultMutableTreeNode root = null;/ 樹面板public CategoryTreeView trp = null;/ 表格面板public AssetTableView tap = null;/ 表頭public String head = " 資產(chǎn)編號", " 資產(chǎn)名稱", " 大類名稱", " 子類名稱 ",

47、 " 資產(chǎn)型號", " 價格 "," 購入日期", " 狀態(tài) ", " 使用者 ", " 備注 " ;/ 查詢面板private QueryView qp = null;/ 左上面板: 放查詢面板private JPanel pnlCTop = null;/ 左下面板: 放樹面板private JPanel pnlCBottom = null;/ 右面板 : 放表格面板private JPanel pnlCRight = null;/ 高度偏移量( 和菜單欄和狀態(tài)欄的高度之和

48、有關) private final int HEIGHT_OFFSET = 80;/ 顯示當前時間private DateTimeView dtv = null;/ throws Exception */ * 構造方法* param title窗口標題*/ public MM(String title) super(title);try setDefaultCloseOperation(EXIT_ON_CLOSE);init(); catch (Exception e) e.printStackTrace();/*初始化窗口/ 添加大類結點private void init() throws

49、Exception JPanel pnlCenter = new JPanel();JLabel lblStatusBar = new JLabel(" ");dtv = new DateTimeView(lblStatusBar);Timer timer = new Timer();qp = new QueryView(220, 220);tap = new AssetTableView(570, 520);root = new DefaultMutableTreeNode(" 高校固定資產(chǎn)管理系統(tǒng)- 類別);pnlCTop = new JPanel();pnl

50、CBottom = new JPanel();pnlCRight = new JPanel();trp = new CategoryTreeView(220, 300);pnlCenter.setLayout(null);pnlCBottom.setLayout(null);pnlCRight.setLayout(null);pnlCTop.setBounds(0, 0, qp.getWidth(), qp.getHeight();pnlCBottom.setBounds(0, qp.getWidth(), trp.getWidth(),trp.getHeight();pnlCRight.se

51、tBounds(qp.getWidth(), 0, tap.getWidth(),tap.getHeight();/ 設置 trp 面板的寬高等于pnlCBottom 面板的寬高trp.setBounds(0, 0, pnlCBottom.getWidth(),pnlCBottom.getHeight();/ 設置 tap 面板的寬高等于pnlCRight 面板的寬高tap.setBounds(0, 0, pnlCRight.getWidth(),pnlCRight.getHeight();trp.addNodes(trp.tree, root, trp.getNodes();/ 設置樹模型t

52、rp.setTreeModel(trp.tree, root);/ 設置表模型tap.setTableModel(tap.table, DBWorker.selAsset("proc_selAsset", "all"),head);setIconImage(ImageGetter.getImage("AMSConfiguration" + File.separator+ "img" + File.separator + "mainlogo.gif");pnlCTop.add(qp);pnlCBo

53、ttom.add(trp);pnlCRight.add(tap);pnlCenter.add(pnlCTop);pnlCenter.add(pnlCBottom);pnlCenter.add(pnlCRight);setJMenuBar(new MenuFactory(this).buildMenuBar();lblStatusBar.setBorder(BorderFactory.createEtchedBorder();lblStatusBar.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN,12);/ 開

54、始每隔一秒顯示時間一次timer.scheduleAtFixedRate(dtv, 0, 1000);getContentPane().add(pnlCenter, BorderLayout.CENTER);getContentPane().add(lblStatusBar, BorderLayout.SOUTH);setSize(800, 600);/ 居中顯示窗口WindowCenter.showCenter(this);/* 樹事件處理*/trp.tree.addTreeSelectionListener(new TreeSelectionListener() public void v

55、alueChanged(TreeSelectionEvent e) DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getPath().getLastPathComponent();if (node.isRoot() / 如果用戶單擊根結點, 顯示所有資產(chǎn)信息tap.setTableModel(tap.table,DBWorker.selAsset("proc_selAsset", "all"), head); else if (node.isLeaf() && node.

56、getParent() = node.getRoot() / 如果用戶單擊了根結點下的葉了結點( 大類結點 ), 顯示指定子類別的資產(chǎn)信息, 并且給其添加子結點/ 給 node 添加子結點trp.addNodes(trp.tree, node, trp.getSubNodes(node.toString();/ 顯示指定大類別的資產(chǎn)信息tap.setTableModel(tap.table,DBWorker.selAsset("proc_selAssetInCate", node.toString(), head); else / 如果用戶單擊子類結點tap.setTableModel(tap.table,DBWorker.selAsset("proc_selAssetInCate", node.toString(), head););/* 窗口寬高改變事件處理*/addComponentListener(new ComponentAdapter() / 窗口改變大小時public void componentResized(ComponentEvent e) / pnlCTop

溫馨提示

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

最新文檔

評論

0/150

提交評論