實驗室儀器管理系統(tǒng)-計算機畢業(yè)設計_第1頁
實驗室儀器管理系統(tǒng)-計算機畢業(yè)設計_第2頁
實驗室儀器管理系統(tǒng)-計算機畢業(yè)設計_第3頁
實驗室儀器管理系統(tǒng)-計算機畢業(yè)設計_第4頁
實驗室儀器管理系統(tǒng)-計算機畢業(yè)設計_第5頁
已閱讀5頁,還剩77頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、畢業(yè)設計 院系_ 專業(yè)_ 班級_ 姓名_日期 年 月 日中文摘要實驗室儀器管理系統(tǒng)為試驗室儀器管理者管理日常試驗所需要的儀器的編號,出庫,入庫,使用登記等日常工作提供充足方便和快捷的管理手段,其開發(fā)內(nèi)容主要包括后臺數(shù)據(jù)庫的建立和維護以及前端應用程序的開發(fā)兩個方面。利用DELPHI 6.0軟件及其提供的各種面向?qū)ο蟮拈_發(fā)工具,建立完整性強、安全性好的數(shù)據(jù)庫,開發(fā)出功能完備,易使用的應用程序。經(jīng)過調(diào)試、編譯與實現(xiàn),該程序界面友好、程序設計風格樸素,使用起來美觀大方、方便易用。尤其是系統(tǒng)的“查詢模塊”的功能極大的減輕工作人員的工作量,并以快速、準確等優(yōu)點取代人工操作,提高了光盤管理工作效率。關(guān)鍵詞

2、: DELPHI 6.0 信息管理系統(tǒng) 數(shù)據(jù)庫 模塊 實驗室儀器管理系統(tǒng)Laboratory equipment management system for the daily management of laboratory testing equipment managers needed equipment numbers, a bank, put in storage, the use of routine work such as registration and the provision of adequate and efficient management tools to

3、facilitate the development of content, including background of the establishment and maintenance of database and front-end application development two. Delphi 6.0 and the use of object-oriented software development tools, the establishment of strong integrity, good safety database developed function

4、s, easy to use applications. After debugging, Translation and the realization that the process friendly interface, simple programming style, using up aesthetic generous, convenient user-friendly. In particular system enquiries module function greatly reduce the workload of staff, and to the rapid, a

5、ccurate, and other advantages replace manually operated, and enhanced CDs management efficiency. Keyword : Delphi 6.0 Laboratory Information Management System database module Equipment Management System 引 言11 Delphi語言概述21.1 Delphi簡介21.2 數(shù)據(jù)庫系統(tǒng)簡介21.3 本應用軟件的基本介紹32 本應用程序的構(gòu)成和開發(fā)步驟42.1 可行性研究4 經(jīng)濟可行性4 時間可行性4

6、 技術(shù)可行性4 社會可行性52.2 數(shù)據(jù)庫的建立和連接52.3 系統(tǒng)的總體設計53 本程序的技術(shù)實現(xiàn)及具體功能133.1 儀器庫維護界面與程序設計實現(xiàn)133.2 儀器借用庫維護界面與代碼設計實現(xiàn)及功能133.3 通訊錄維護界面與代碼設計實現(xiàn)14,3.4 儀器代碼庫維護界面與代碼設計153.5 主界面設計與代碼設計16總 結(jié) 21致 謝22參 考 文 獻23引 言隨著經(jīng)濟的發(fā)展,社會的進步,計算機越來越深入到我們?nèi)粘5墓ぷ鲗W習及生活中,成為我們?nèi)粘I钪胁豢扇鄙俚妮o助工具。 隨著科學技術(shù)的不斷提高,計算機科學日漸成熟,其強大的功能已為人們深刻認識,它已進入人類社會的各個領(lǐng)域并發(fā)揮著越來越重要的作

7、用。它已經(jīng)深入到日常工作和生活的方方面面,比如文字處理、信息管理、輔助設計、圖形圖像處理、教育培訓以及游戲娛樂等。各行各業(yè)的人們無須經(jīng)過特別的訓練就能夠使用電腦完成許許多多復雜的工作。然而,雖然現(xiàn)在世界上已經(jīng)充滿了多如牛毛的各種軟件,但它們依然不能滿足用戶的各種特殊需要,人們還不得不開發(fā)適合自己特殊需求的軟件。以前開發(fā)Windows應用軟件是專業(yè)人員的工作,需要掌握許多專業(yè)知識和經(jīng)過特殊的培訓才能勝任?,F(xiàn)在不同了,即使你沒有接受過嚴格的程序設計訓練,使用Delphi編程語言也一樣能夠開發(fā)出功能強大、適合自己特殊需求的應用程序了。Delphi編程語言繼承了其他語言易學易用的特點,特別適合于初學者

8、學習Windows系統(tǒng)編程。 實驗室儀器管理系統(tǒng)用計算機管理實驗室儀器的出借,歸還,修理編號,等日常使用過程的一種計算機應用技術(shù)的創(chuàng)新,在計算機還未普及之前實驗室儀器管理都是由工作人員人工代勞,記錄的方式試驗室管理都采用計算機智能化管理,采用計算機作為工具的實用的計算機智能化管理程序來幫助前臺管理員進行更有效的試驗儀器管理工作。實驗室儀器管理系統(tǒng)是典型的信息管理系統(tǒng)(MIS),其開發(fā)主要包括后臺數(shù)據(jù)庫的建立和維護以及前端應用程序的開發(fā)兩個方面。對于前者要求建立起數(shù)據(jù)一致性和完整性強、數(shù)據(jù)安全性好的庫。而對于后者則要求應用程序功能完備,易使用等特點。 經(jīng)過分析,我們使用 Delphi編程語言開發(fā)

9、工具,利用其提供的各種面向?qū)ο蟮拈_發(fā)工具,尤其是數(shù)據(jù)窗口這一能方便而簡潔操縱數(shù)據(jù)庫的智能化對象,首先在短時間內(nèi)建立系統(tǒng)應用原型,然后,對初始原型系統(tǒng)進行需求迭代,不斷修正和改進,直到形成用戶滿意的可行系統(tǒng)。因為本人能力有限,加上時間緊迫,所以設計出來的本系統(tǒng)可能功能比較簡單,另外本系統(tǒng)是單機版,不能實現(xiàn)網(wǎng)絡互聯(lián)操作,這些都有待于我在以后的工作學習中進一步改進。Delphi簡介 Delphi簡介 Delphi是Inprise公司出品的一個優(yōu)秀的可視化程序開發(fā)工具軟件,它短小精悍,但功能卻可以與龐大的visual c+媲美。它易學易用,如同VB,因而被稱為“第四代編程語言”。從1995年推出Del

10、phi1.0至今已經(jīng)經(jīng)歷了7個版本,Delphi7.0運行在win9x或winme,win2000,winxp,windowsNT等操作系統(tǒng)下,是一個32位的應用程序開發(fā)工具。這里把“VB”比作是傻瓜相機,Delphi是帶有自動功能的專業(yè)相機。前些年,軟件界流行一句話叫“真正的程序員用VC,聰明的程序員用Delphi”。也有的把Delphi稱作VB殺手。1.2 數(shù)據(jù)庫系統(tǒng)簡介數(shù)據(jù)庫系統(tǒng)是一個實際可運行的存儲、維護和應用系統(tǒng)提供數(shù)據(jù)的軟件系統(tǒng),是存儲介質(zhì)、處理對象和管理系統(tǒng)的集合體。它通常由軟件、數(shù)據(jù)庫和數(shù)據(jù)管理員組成。其軟件主要包括操作系統(tǒng)、各種宿主語言,實用程序以及數(shù)據(jù)庫管理系統(tǒng)。數(shù)據(jù)庫是依

11、照某種數(shù)據(jù)模型組織起來并存放二級存儲器中的數(shù)據(jù)集合。這些數(shù)據(jù)為多個應用服務,獨立于具體的應用程序。數(shù)據(jù)庫由數(shù)據(jù)庫管理系統(tǒng)統(tǒng)一管理,數(shù)據(jù)的插入、修改和檢索均要通過數(shù)據(jù)庫管理系統(tǒng)進行。數(shù)據(jù)庫管理系統(tǒng)是一種系統(tǒng)軟件,它的主要功能是維護數(shù)據(jù)庫并有效地訪問數(shù)據(jù)庫中任意部分數(shù)據(jù)。對數(shù)據(jù)庫的維護包括保持數(shù)據(jù)的完整性、一致性和安全性。數(shù)據(jù)管理員負責創(chuàng)建、監(jiān)控和維護整個數(shù)據(jù)庫,使數(shù)據(jù)能被任何有權(quán)使用的人有效使用。數(shù)據(jù)庫管理員一般是由業(yè)務水平較高、資歷較深的人員擔任。數(shù)據(jù)庫系統(tǒng)的個體含義是指一個具體的數(shù)據(jù)庫管理系統(tǒng)軟件和用它建立起來的數(shù)據(jù)庫;它的學科含義是指研究、開發(fā)、建立、維護和應用數(shù)據(jù)庫系統(tǒng)所涉及的理論、方法

12、、技術(shù)所構(gòu)成的學科。在這一含義下,數(shù)據(jù)庫系統(tǒng)是軟件研究領(lǐng)域的一個重要分支,常稱為數(shù)據(jù)庫領(lǐng)域。 數(shù)據(jù)庫研究跨越于計算機應用、系統(tǒng)軟件和理論三個領(lǐng)域,其中應用促進新系統(tǒng)的研制開發(fā),新系統(tǒng)帶來新的理論研究,而理論研究又對前兩個領(lǐng)域起著指導作用。數(shù)據(jù)庫系統(tǒng)的出現(xiàn)是計算機應用的一個里程碑,它使得計算機應用從以科學計算為主轉(zhuǎn)向以數(shù)據(jù)處理為主,并從而使計算機得以在各行各業(yè)乃至家庭普遍使用。在它之前的文件系統(tǒng)雖然也能處理持久數(shù)據(jù),但是文件系統(tǒng)不提供對任意部分數(shù)據(jù)的快速訪問,而這對數(shù)據(jù)量不斷增大的應用來說是至關(guān)重要的。為了實現(xiàn)對任意部分數(shù)據(jù)的快速訪問,就要研究許多優(yōu)化技術(shù)。這些優(yōu)化技術(shù)往往很復雜,是普通用戶難以

13、實現(xiàn)的,所以就由系統(tǒng)軟件(數(shù)據(jù)庫管理系統(tǒng))來完成,而提供給用戶的是簡單易用的數(shù)據(jù)庫語言。由于對數(shù)據(jù)庫的操作都由數(shù)據(jù)庫管理系統(tǒng)完成,所以數(shù)據(jù)庫就可以獨立于具體的應用程序而存在,從而數(shù)據(jù)庫又可以為多個用戶所共享。因此,數(shù)據(jù)的獨立性和共享性是數(shù)據(jù)庫系統(tǒng)的重要特征。數(shù)據(jù)共享節(jié)省了大量人力物力,為數(shù)據(jù)庫系統(tǒng)的廣泛應用奠定了基礎。數(shù)據(jù)庫系統(tǒng)的出現(xiàn)使得普通用戶能夠方便地將日常數(shù)據(jù)存入計算機并在需要的時候快速訪問它們,從而使的計算機走出科研機構(gòu)進入各行各業(yè)、進入家庭。 本應用軟件的基本介紹本應用軟件先是打開一個啟動窗口,就可以進入應用程序的主窗口了。主界面是一個圖型界面窗口,整個平臺顯示采用人性化方式,可以非

14、常方便的儀器出借維護、儀器庫維護、通訊錄維護,儀器代碼庫維護,管理日常經(jīng)營的基本情況,通過各種儀器狀況條件查詢出各類儀器的基本信息,以及打印出查詢出的基本信息,總之一切實驗室儀器管理的基本信息都會顯示在系統(tǒng)平臺上,大大提高了管理人員的工作效率。本應用程序的構(gòu)成和開發(fā)步驟下面從軟件工程的角度介紹本程序的基本開發(fā)步驟。Delphi 應用程序一般包含以下三個基本部分: 應用程序運行的接口:負責系統(tǒng)整體環(huán)境的設置,運行狀態(tài)的監(jiān)視,應用程序的啟動等。 應用程序的主體:主要完成用戶的業(yè)務邏輯功能,如儀器庫維護,儀器借用庫維護,通訊錄維護儀器代碼庫維護,等信息.應用程序的輔助部分:協(xié)助程序主體完成的一些工作

15、。 下面從軟件工程的角度描述本程序的開發(fā)生命周期,開發(fā)過程和組織過程。 可行性研究任何一個系統(tǒng)或一項工程,在建立之前,必須首選進行可行性分析,可行性分析包括兩層含義,一是可能性,二是必要性??赡苄灾搁_發(fā)信息系統(tǒng)的條件是否具備,必要性是指客觀上是否真正需要,通過可行性研究,可避免盲目投資,減少政治性要的損失。下面從四方面來討論: 經(jīng)濟可行性主要是只指算一個新的系統(tǒng)開發(fā)所需要的投資費用和運算費用,并與估計的新系統(tǒng)收益進行比較,看是否有利。本系統(tǒng)所需的軟硬件成本比較低,投資小,具有一定的通過性,因此 ,在經(jīng)濟上是可行的。 時間可行性主要包括系統(tǒng)在目前環(huán)境下能否正常運行,運行后所引起的各方面,以及這些

16、變化對社會或人的因素所產(chǎn)生的影響。本系統(tǒng)對人事的管理比較全面,可長期使用。 技術(shù)可行性利用現(xiàn)有的設備,軟件及技術(shù)人員,新系統(tǒng)的目標能否達到,這也是可行性研究中需要考慮的一個問題。關(guān)系型數(shù)據(jù)庫的高速發(fā)展使管理信息系統(tǒng)具備了良好的開發(fā)環(huán)境。本系統(tǒng)使用的Delphi 普及性好,操作簡單,用戶可以很快掌握使用方法,因此,在技術(shù)上是完全可行的。 社會可行性人類社會文明的發(fā)展已進入信息化的高速發(fā)展時期,傳統(tǒng)的手工方式支持下的管理模式,已經(jīng)不能滿足各方面的需要。開發(fā)本系統(tǒng)的目標不僅是提高工作效率,減輕勞動強度,而且減少出錯率,具有很好的社會意義。2.2 數(shù)據(jù)庫的建立和連接這個程序采用的數(shù)據(jù)庫是Microso

17、ft Access2000,Delphi作為數(shù)據(jù)庫的前臺開發(fā)工具,必須與后臺數(shù)據(jù)庫進行連接,這樣才能控制和進行操作數(shù)據(jù)庫,數(shù)據(jù)庫的連接方式有兩種,ODBC和ADO。ODBC是數(shù)據(jù)庫的通用接口,其缺點是效率低;專用接口調(diào)用直接速度快,但是通用性差,如果用ODBC連接數(shù)據(jù)庫一般要兩個步驟:1.要創(chuàng)建數(shù)據(jù)源;2.創(chuàng)建描述文件。數(shù)據(jù)庫的建立則時在access2000中建立的,在這里你可以設置數(shù)據(jù)庫的密碼,對數(shù)據(jù)庫進行保護。在創(chuàng)建數(shù)據(jù)源時可以通過BDE administrator進行創(chuàng)建,也可以通過系統(tǒng)控制面板中的ODBC數(shù)據(jù)源進行建立。而描述文件則可以在Delphi的主程序中用Database Pro

18、file中進行建立,之后進行數(shù)據(jù)庫的連接。接下來的工作是建表。同樣建表的過程也不是唯一的,但是最終實現(xiàn)的結(jié)果是唯一的。你可以通過Access進行建表,也可以通過在 Visual Basic 主程序中建表,也可以通過powerdesigner進行可視化的建立,不過用這種方法,在導入的時候要把數(shù)據(jù)庫要先斷開,否則數(shù)據(jù)庫的數(shù)據(jù)容易丟失。建表的過程注意規(guī)范化命名規(guī)則,如表的字段名等等。同時也要注意表的字段長度和可否為空。因為以后要設計到主鍵,外鍵的問題。如果字段名不同,同一字段長度不同則主鍵和外鍵將會連接不上??梢娊ū頃r應做好全局的打算。我在程序開發(fā)的初期,同樣犯了這個錯誤,導致數(shù)據(jù)庫出錯,有時還要向

19、表中新加入字段。導致數(shù)據(jù)窗口不好用的連鎖反映。2.3 系統(tǒng)的總體設計這個管理系統(tǒng)從4月1日開始著手設計開發(fā),經(jīng)過一段時間的分析,并根據(jù)對影音店光盤管理的具體要求及需要本軟件實現(xiàn)的功能,將本軟件分為5個大的模塊,分別是:第一部分:儀器庫維護;第二部分:儀器借用庫維護;第三部分:通訊錄維護; 第四部分:儀器代碼庫維護。程序流程圖如下:主界面儀器庫維護儀器借用庫維護通訊錄維護儀器代碼庫維護3 本程序的技術(shù)實現(xiàn)及具體功能儀器庫維護界面與程序設計實現(xiàn)代碼設計:unit child_lab;interfaceuses Windows, Messages, SysUtils, Classes, Graphi

20、cs, Controls, Forms, Dialogs, ComCtrls, DBTables, DBCtrls, ExtCtrls, Db, StdCtrls, Mask, Buttons, Grids, DBGrids;type Tfrm_YQ_Lab = class(TForm) Table1: TTable; Table1_YQBH: TStringField; Table1StringField2: TStringField; Table1StringField3: TStringField; Table1DateField: TDateField; Table1CurrencyF

21、ield: TCurrencyField; Table1StringField4: TStringField; Table1StringField5: TStringField; Table1SmallintField: TSmallintField; Table1SmallintField2: TSmallintField; Table1StringField6: TStringField; DataSource1: TDataSource; Table2: TTable; Query1: TQuery; Table3: TTable; Panel1: TPanel; DBNavigator

22、: TDBNavigator; Panel3: TPanel; PageControl1: TPageControl; TabSheet1: TTabSheet; Label10: TLabel; Label9: TLabel; Label8: TLabel; Label7: TLabel; Label6: TLabel; Label5: TLabel; Label1: TLabel; Label2: TLabel; Label4: TLabel; Label3: TLabel; EditDBEdit10: TDBEdit; EditDBEdit5: TDBEdit; EditDBEdit7:

23、 TDBEdit; EditDBEdit8: TDBEdit; EditDBEdit9: TDBEdit; EditDBEdit: TDBEdit; EditDBEdit2: TDBEdit; EditDBEdit3: TDBEdit; EditDBEdit4: TDBEdit; DBEdit2: TDBEdit; DBComboBox1: TDBComboBox; DBEdit1: TDBEdit; DBComboBox2: TDBComboBox; TabSheet2: TTabSheet; DBGrid1: TDBGrid; Panel2: TPanel; Label22: TLabel

24、; Label21: TLabel; Label20: TLabel; Label23: TLabel; SpeedButton1: TSpeedButton; SpeedButton2: TSpeedButton; Label11: TLabel; Label12: TLabel; Edit_No: TEdit; Edit_name: TEdit; Edit_date: TEdit; Edit_address: TEdit; RadioGroup1: TRadioGroup; ComboBox1: TComboBox; Edit_experi: TEdit; TabSheet3: TTabS

25、heet; SpeedButton3: TSpeedButton; RadioGroup2: TRadioGroup; RadioGroup3: TRadioGroup; Table4: TTable; DBCheckBox1: TDBCheckBox; Table2BDEDesigner: TSmallintField; Table2BDEDesigner2: TStringField; Table3BDEDesigner: TSmallintField; Table3BDEDesigner2: TStringField; Table4BDEDesigner: TFloatField; Ta

26、ble4_UserName: TStringField; Table4_YQBH: TStringField; Table4BDEDesigner4: TStringField; Table4BDEDesigner5: TStringField; Table4_GHRQ: TStringField; Table4BDEDesigner7: TStringField; Table4BDEDesigner8: TStringField; DataSource4: TDataSource; DataSource2: TDataSource; DataSource3: TDataSource; DBE

27、dit3: TDBEdit; Label13: TLabel; Table1Field_OutUserName: TStringField; Table1Field_BeOut: TBooleanField; Query1_YQBH: TStringField; Query1BDEDesigner2: TStringField; Query1BDEDesigner3: TStringField; Query1BDEDesigner4: TDateField; Query1BDEDesigner5: TCurrencyField; Query1BDEDesigner6: TStringField

28、; Query1BDEDesigner7: TStringField; Query1BDEDesigner8: TSmallintField; Query1BDEDesigner9: TSmallintField; Query1BDEDesigner10: TStringField; Query1Field_OutUserName: TStringField; Query1Field_BeOut: TStringField; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Actio

29、n: TCloseAction); procedure PageControl1Change(Sender: TObject); procedure SpeedButton2Click(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); procedure SpeedButton3Click(Sender: TObject); procedure DataSource1DataChange(Sender: TObject; Field: TField); procedure FormActivate(Sender: T

30、Object); procedure Table1CalcFields(DataSet: TDataSet); procedure Query1CalcFields(DataSet: TDataSet); private procedure AllRec; Private declarations public Public declarations end;var frm_YQ_Lab: Tfrm_YQ_Lab;implementationuses Main, prt_lab;$R *.DFMprocedure Tfrm_YQ_Lab.AllRec;begin with Query1 do

31、begin SQL.Clear; SQL.Add(SELECT * FROM 儀器庫.db); Prepare; ExecSQL; Open; end;end;procedure Tfrm_YQ_Lab.FormCreate(Sender: TObject);begin Height:=Constraints.MinHeight; Width:=Constraints.MinWidth; Panel1.Align:=alTop; Panel3.Align:=alClient; PageControl1.Align:=alClient; PageControl1.ActivePageIndex:

32、=0; DBGrid1.Align:=alClient; Table1.DatabaseName:=MainForm.GetExePath+mdb; Table1.TableName:=儀器庫.db; Table2.DatabaseName:=MainForm.GetExePath+mdb; Table2.TableName:=儀器類型代碼庫.db; Table3.DatabaseName:=MainForm.GetExePath+mdb; Table3.TableName:=所屬試驗代碼庫.db; Table4.DatabaseName:=MainForm.GetExePath+mdb; T

33、able4.TableName:=儀器借出信息庫.DB; table4.Open; Query1.DatabaseName:=MainForm.GetExePath+mdb; AllRec; table1.Open; table2.Open; table3.Open;end;procedure Tfrm_YQ_Lab.FormClose(Sender: TObject; var Action: TCloseAction);begin table4.Close; table1.Close; table2.Close; table3.Close; with Mainform do begin/ S

34、tatusBar.Panels1.Text:=儀器庫已關(guān)閉; if MDIChildCount=1 then StatusBar.Panels1.Text:=; end; Action := caFree;end;procedure Tfrm_YQ_Lab.PageControl1Change(Sender: TObject);begin case PageControl1.ActivePageIndex of 0:begin DataSource1.DataSet:=Table1; Table1.Open; end; 1:begin DataSource1.DataSet:=Query1;/

35、 AllRec; end; end;end;procedure Tfrm_YQ_Lab.SpeedButton2Click(Sender: TObject);begin AllRec;end;procedure Tfrm_YQ_Lab.SpeedButton1Click(Sender: TObject);var SQLStr,SQLAll,Log:String; SQLTemp:Pchar; arrstr:array1.7of String; i,l:integer; function getsth(CurrEdit:TEdit):boolean; begin result:=false; i

36、f CurrEdit.Text then result:=true; end;begin SQLAll:=; SQLStr:=SELECT * FROM 儀器庫.db WHERE ; if RadioGroup1.ItemIndex=1 then Log:=OR else Log:=AND; if Getsth(Edit_name) then arrstr1:=(儀器名稱=+Edit_name.Text+); arrstr2:=ComboBox1.text; if arrstr2 then arrstr2:=(狀況=+arrstr2+); if Getsth(Edit_No) then arr

37、str3:=(型號=+Edit_No.Text+); if Getsth(Edit_date) then arrstr4:=(啟用日期=+Edit_date.Text+); if GetSth(Edit_address) then arrstr5:=(放置位置=+Edit_address.Text+); if GetSth(Edit_experi) then arrstr6:=(所屬實驗=+Edit_experi.Text+); arrstr7:=; for i:=1 to 6 do begin arrstr7:=arrstr7+arrstri; if arrstri then SQLAll:

38、=SQLAll+Log+arrstri; end; if arrstr7= then begin showmessage(沒有查詢項目?); exit; end; l:=strlen(Pchar(SQLAll); GetMem(SQLTemp,l); SQLTemp := Chr(0); if SQLAll1=O then StrCat(SQLTemp,Pchar(SQLAll)+2); if SQLAll1=A then StrCat(SQLTemp,Pchar(SQLAll)+3); SQLStr:=SQLStr+SQLTemp+ ORDER BY 儀器名稱,型號,啟用日期,狀況,放置位置

39、,所屬實驗; FreeMem(SQLTemp);/ Application.MessageBox(Pchar(SQLStr),預查詢的SQL語句,MB_OK); with Query1 do begin SQL.Clear; SQL.Add(SQLStr); Prepare; ExecSQL; Open; end;end;procedure Tfrm_YQ_Lab.SpeedButton3Click(Sender: TObject);begin Application.CreateForm(Tfrm_prt_Lab, frm_prt_Lab); Case RadioGroup2.ItemInd

40、ex of 0:begin DataSource1.DataSet:=Table1; frm_Prt_Lab.QuickRep1.DataSet:=Table1; end; 1:begin ShowMessage(*_ 沒編完); exit; end; end; frm_Prt_Lab.QuickRep1.Preview; frm_Prt_Lab.Close;end;procedure Tfrm_YQ_Lab.DataSource1DataChange(Sender: TObject; Field: TField);begin FormActivate(Sender);end;procedur

41、e Tfrm_YQ_Lab.FormActivate(Sender: TObject);begin MainForm.StatusBar.Panels1.Text:=儀器庫紀錄導航信息:第+inttostr(DataSource1.DataSet.RecNo)+筆紀錄-總共+inttostr(DataSource1.DataSet.RecordCount)+筆紀錄;end;procedure Tfrm_YQ_Lab.Table1CalcFields(DataSet: TDataSet);begin Table1Field_BeOut.Value:=false; Table4.First; wh

42、ile not Table4.Eof do begin if (Table4_YQBH.Value=Table1_YQBH.Value)and(Table4_GHRQ.Value=) then begin Table1Field_BeOut.Value:=True; Table1Field_OutUserName.Value:=Table4_UserName.Value; end; Table4.Next; end;end;procedure Tfrm_YQ_Lab.Query1CalcFields(DataSet: TDataSet);begin Query1Field_BeOut.Valu

43、e:=否; Table4.First; while not Table4.Eof do begin if (Table4_YQBH.Value=Query1_YQBH.Value)and(Table4_GHRQ.Value=) then begin Query1Field_BeOut.AsString :=是; Query1Field_OutUserName.Value:=Table4_UserName.Value; end; Table4.Next; end;end;end.儀器借用庫維護界面與代碼設計實現(xiàn)及功能代碼設計:unit Child_Borrow;interfaceuses Win

44、dows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, DBCtrls, ComCtrls, Db, DBTables, ExtCtrls, Grids, DBGrids, Buttons;type Tfrm_Borrow = class(TForm) Panel1: TPanel; DBNavigator: TDBNavigator; DataSource1: TDataSource; Query1: TQuery; DataSource2: TDataSource; Tab

45、le2: TTable; Table1: TTable; Panel3: TPanel; PageControl1: TPageControl; TabSheet1: TTabSheet; Label8: TLabel; Label7: TLabel; Label6: TLabel; Label5: TLabel; Label2: TLabel; Label1: TLabel; Label3: TLabel; Label4: TLabel; Label9: TLabel; EditDBEdit8: TDBEdit; EditDBEdit5: TDBEdit; EditDBEdit6: TDBE

46、dit; EditDBEdit7: TDBEdit; EditDBEdit: TDBEdit; EditDBEdit2: TDBEdit; EditDBEdit3: TDBEdit; EditDBEdit4: TDBEdit; DBEdit1: TDBEdit; TabSheet2: TTabSheet; Panel2: TPanel; Label22: TLabel; Label21: TLabel; Label20: TLabel; Label23: TLabel; SpeedButton1: TSpeedButton; SpeedButton2: TSpeedButton; Edit_N

47、o: TEdit; Edit_name: TEdit; Edit_DateIn: TEdit; RadioGroup1: TRadioGroup; Edit_DateOut: TEdit; DBGrid1: TDBGrid; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure PageControl1Change(Sender: TObject); procedure SpeedButton1Click(Sender: T

48、Object); procedure DataSource1DataChange(Sender: TObject; Field: TField); procedure FormActivate(Sender: TObject); private procedure AllRec; Private declarations public Public declarations end;var frm_Borrow: Tfrm_Borrow;implementationuses Main;$R *.DFMprocedure Tfrm_Borrow.AllRec;begin with Query1

49、do begin SQL.Clear; SQL.Add(SELECT * FROM 儀器借出信息庫.db); Prepare; ExecSQL; Open; end;end;procedure Tfrm_Borrow.FormCreate(Sender: TObject);beginght; Width:=Constraints.MinWidth; Panel1.Align:=alTop; Panel3.Align:=alClient; PageControl1.Align:=alClient; PageControl1.ActivePageIndex:=0; DBGrid1.Align:=a

50、lClient; Table1.DatabaseName:=MainForm.GetExePath+mdb; Table1.TableName:=儀器借出信息庫.db; Table2.DatabaseName:=MainForm.GetExePath+mdb; Table2.TableName:=儀器庫.db; Query1.DatabaseName:=MainForm.GetExePath+mdb; table1.Open; table2.Open;end;procedure Tfrm_Borrow.FormClose(Sender: TObject; var Action: TCloseA

51、ction);begin table1.Close; table2.Close; Query1.Close; with Mainform do begin/ StatusBar.Panels1.Text:=儀器借用庫已關(guān)閉; if MDIChildCount=1 then StatusBar.Panels1.Text:=; end; Action:=caFree;end;procedure Tfrm_Borrow.PageControl1Change(Sender: TObject);begin case PageControl1.ActivePageIndex of 0:begin Data

52、Source1.DataSet:=Table1; Table1.Open; end; 1:begin DataSource1.DataSet:=Query1; AllRec; end; end;end;procedure Tfrm_Borrow.SpeedButton1Click(Sender: TObject);var SQLStr,SQLAll,Log:String; SQLTemp:Pchar; arrstr:array1.5of String; i,l:integer; function getsth(CurrEdit:TEdit):boolean; begin result:=fal

53、se; if CurrEdit.Text then result:=true; end;begin SQLAll:=; SQLStr:=SELECT * FROM 儀器借出信息庫.db WHERE ; if RadioGroup1.ItemIndex=1 then Log:=OR else Log:=AND; if Getsth(Edit_name) then arrstr1:=(借用人=+Edit_name.Text+); if Getsth(Edit_No) then arrstr2:=(儀器編號=+Edit_No.Text+); if Getsth(Edit_DateOut) then

54、arrstr3:=(借用日期=+Edit_DateOut.Text+); if Getsth(Edit_DateIn) then arrstr4:=(歸還日期=+Edit_DateIn.Text+); arrstr5:=; for i:=1 to 4 do begin arrstr5:=arrstr5+arrstri; if arrstri then SQLAll:=SQLAll+Log+arrstri; end; if arrstr5= then begin showmessage(沒有查詢項目?); exit; end; l:=strlen(Pchar(SQLAll); GetMem(SQ

55、LTemp,l); SQLTemp := Chr(0); if SQLAll1=O then StrCat(SQLTemp,Pchar(SQLAll)+2); if SQLAll1=A then StrCat(SQLTemp,Pchar(SQLAll)+3); SQLStr:=SQLStr+SQLTemp+ ORDER BY 借用人,儀器編號,借用日期,歸還日期; FreeMem(SQLTemp);/ Application.MessageBox(Pchar(SQLStr),預查詢的SQL語句,MB_OK); with Query1 do begin SQL.Clear; SQL.Add(SQ

56、LStr); Prepare; ExecSQL; Open; end;end;procedure Tfrm_Borrow.DataSource1DataChange(Sender: TObject; Field: TField);begin FormActivate(Sender);end;procedure Tfrm_Borrow.FormActivate(Sender: TObject);begin MainForm.StatusBar.Panels1.Text:=儀器借用庫紀錄導航信息:第+inttostr(DataSource1.DataSet.RecNo)+筆紀錄-總共+inttos

57、tr(DataSource1.DataSet.RecordCount)+筆紀錄;end;end.通訊錄維護界面與代碼設計實現(xiàn)代碼設計:unit Child_Code;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, Grids, DBGrids, Db, DBTables, StdCtrls, DBCtrls;type Tfrm_Code = class(TForm) Panel1: TPanel; Label1: TLabel; ComboBox1

58、: TComboBox; DataSource1: TDataSource; Table1: TTable; DBNavigator: TDBNavigator; DBGrid1: TDBGrid; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure ComboBox1Change(Sender: TObject); procedure DataSource1DataChange(Sender: TObject; Fiel

59、d: TField); procedure FormActivate(Sender: TObject); private function GetDBName: String; Private declarations public Public declarations end;var frm_Code: Tfrm_Code;implementationuses Main;$R *.DFMfunction Tfrm_Code.GetDBName:String;begin case ComboBox1.ItemIndex of 0:begin Result:=儀器類型代碼庫.db; end;

60、1:begin Result:=所屬試驗代碼庫.db; end; end;end;procedure Tfrm_Code.FormCreate(Sender: TObject);begin Height:=Constraints.MinHeight; Width:=Constraints.MinWidth; Panel1.Align:=alTop; DBGrid1.Align:=alClient; ComboBox1.ItemIndex:=0; Table1.DatabaseName:=MainForm.GetExePath+mdb; Table1.TableName:=GetDBName;

溫馨提示

  • 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

提交評論