


版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、使用 java 倉庫管理系統(tǒng)設(shè)計畢業(yè)設(shè)計目錄系統(tǒng)開發(fā)的必要性及介紹 系統(tǒng)概要設(shè)計 系統(tǒng)詳細(xì)設(shè)計 系統(tǒng)源代碼 調(diào)試分析和測試結(jié)果 系統(tǒng)使用說明書 心得體會 參考文獻課程設(shè)計題目:倉庫貨品信息管理系統(tǒng)一、系統(tǒng)開發(fā)的必要性及介紹1. 必要性倉庫管理是現(xiàn)代物流管理的一個重要組成部分,倉庫貨物管理信 息系統(tǒng)的設(shè)計,可以實現(xiàn)對存儲貨物信息及統(tǒng)計單據(jù)的計算機管 理,簡化作業(yè)程序,提高作業(yè)效率,為企業(yè)創(chuàng)造更高的利潤。2. 主要功能介紹本系統(tǒng)有對庫存貨品信息的輸入、插入、刪除、查找等功能,并 能將建立和更新的庫存信息保存于文件供輸出或打印。 對于查找、 刪除等功能要求能按貨品名、貨品號分別進行。每個貨品的相關(guān)
2、信息包括:貨品號、貨品名、貨品庫存量、進貨日期、貨品生產(chǎn) 廠家及供應(yīng)商等。二、系統(tǒng)概要設(shè)計1. 系統(tǒng)設(shè)計任務(wù) 要求系統(tǒng)能實現(xiàn)庫存貨品信息的輸入、插入、刪除、查找等 功能,并能將建立和更新的庫存信息保存于文件供輸出或打印。 對于查找、刪除等功能能夠按貨品名、貨品號分別進行。每個貨 品的相關(guān)信息包括:貨品號、貨品名、貨品庫存量、進貨日期、 貨品生產(chǎn)廠家及供應(yīng)商等。2. 方案確定庫存貨品信息管理系統(tǒng)要求實現(xiàn)許多功能,可遵循結(jié)構(gòu)化程序設(shè) 計思想來進行本系統(tǒng)的設(shè)計自頂向下,逐步細(xì)化,也就是將 軟件設(shè)計任務(wù)劃分成許多容易解決的小的子任務(wù),即分解出許多 子功能模塊進行設(shè)計。本程序經(jīng)過分析可劃分出 6 個子任
3、務(wù):輸 入、輸出、插入、刪除、查找和保存。3. 模塊劃分(1)程序設(shè)計模塊連接圖庫存貨品信息管理系統(tǒng)的模塊連接結(jié)構(gòu)如下圖:辛載入模塊4. 環(huán)境要求硬件:PC機軟件:電腦安裝有TC集成環(huán)境三、系統(tǒng)詳細(xì)設(shè)計1 數(shù)據(jù)結(jié)構(gòu)設(shè)計(1) 數(shù)據(jù)結(jié)構(gòu)的選擇選取動態(tài)數(shù)據(jù)結(jié)構(gòu),本系統(tǒng)是通過雙向鏈表來完成的 動態(tài)存儲分配與釋放:申請存儲空間函數(shù)malloc()函數(shù)首部原型為void * malloc( un sig ned int size) 釋放存儲空間函數(shù)free()函數(shù)首部原型為void free(void*p)動態(tài)數(shù)據(jù)結(jié)構(gòu)雙向鏈表/* 定義雙向鏈表結(jié)構(gòu)體 */ /* 貨物編號 */*貨物名稱 */* 貨物數(shù)
4、量 */*next; /* 定義兩指針,分別指向其(2) 數(shù)據(jù)類型的選擇 struct commodity int number; char namemax; int counter;struct commodity *piror, 前驅(qū)和后繼 */ ;(3) 變量函數(shù)說明: COM *input( ) 操作結(jié)果:輸入貨品信息 COM *insert_perf( ) 操作結(jié)果:插入某貨品 COM *del_perf( ) 操作結(jié)果:刪除某貨品 serch( ) 操作結(jié)果:查找某貨品 print_perf( ) 操作結(jié)果:輸出某貨品 save(COM*head) 操作結(jié)果:保存COM *open
5、file( ) 操作結(jié)果:載入2.流程框圖查找模塊和載入模塊的算法框圖在此略。結(jié)束(2 )插入模塊(4 )輸出模塊對以上各模塊的文字解釋說明:(1)輸入模塊:其實就是一個建立鏈表的操作模塊。建立鏈表的具體操作就是逐一輸入各結(jié)點數(shù)據(jù),并建立其前后相鏈的關(guān)系。 首先設(shè)三個指針變量:head,ptr1,ptr2 。它們都是指向結(jié)構(gòu)體類 型數(shù)據(jù)的。先使head的值為NULL這是鏈表為空的情況。用malloc 函數(shù)開辟一個結(jié)點,并使ptr1,ptr2都指向它,之后從鍵盤讀入一個貨品的數(shù)據(jù)給ptrl所指向的結(jié)點。當(dāng)輸入的ptr1->num不為 0 時,令 head= ptrl ; ptr2=ptr1
6、,即把 ptrl 的值賦給 head,使 ptr2,ptr1,head都指向這一新開辟的結(jié)點,此結(jié)點就成為鏈表中的第一個結(jié)點。再開辟一個新結(jié)點并使ptrl指向它,讀入該結(jié)點 的數(shù)據(jù),如果輸入的ptr1->num不為0,則應(yīng)鏈入這第二個結(jié)點, 這時和上一個結(jié)點的處理不同,是將ptrl的值賦給ptr2->next, 也就是使第一個結(jié)點的next成員指向第二個結(jié)點,接著將 ptr2 也指向結(jié)點2。再開辟一個新結(jié)點并使ptr1指向它,讀入該結(jié)點 的數(shù)據(jù),同樣將 ptr1 的值賦給 ptr2->next ,也就是使第三個結(jié) 點鏈接到第二個結(jié)點之后, 并接著將 ptr1 的值賦給 ptr
7、2 ,使 ptr2 指向結(jié)點 3。再開辟一個新結(jié)點,并使 ptr1 指向它,輸入該結(jié)點 的數(shù)據(jù),如果輸入 ptr1->num 為 0, 則是輸入結(jié)束標(biāo)志,此結(jié)點不 被鏈接到鏈表中,就將 NULL賦給ptr2->next。建立鏈表過程至 此結(jié)束, ptr1 最后所指結(jié)點并未鏈入鏈表中。( 2)插入模塊: 要完成的是鏈表的插入操作, 即將一個新結(jié)點插 入到一個已有的鏈表中,對剛剛建立的鏈表,首先新設(shè)一個指針 變量 ptr0 ,并開辟一個結(jié)點使 ptr3 指向它,輸入該結(jié)點的數(shù)據(jù), 即新貨的有關(guān)數(shù)據(jù),接下來查找要插入位置結(jié)點,找到后只需修 改此結(jié)點和 ptr0 指向結(jié)點指針域的值即可 ,
8、鏈表中所有元素位置 均不需移動,這就體現(xiàn)了鏈表的優(yōu)點。(3)刪除模塊: 要完成的是鏈表的刪除操作, 只需修改鏈表中要 刪除結(jié)點的前一個結(jié)點的鏈指針。使之指向被刪除結(jié)點的后面一 個結(jié)點即可。(4)保存模塊:將最終想要保留的數(shù)據(jù)信息保存于文件中。(5)輸出模塊:要完成的是依次輸出鏈表中各結(jié)點的數(shù)據(jù)的操作。 首先找到鏈表頭結(jié)點的地址, 也就是 head 的值,然后設(shè)一個指針變量 ptr1 ,先指向第一個結(jié)點,輸出 ptr1 所指的結(jié)點,然后使 ptr1 后移一個結(jié)點,再輸入直至鏈表的尾結(jié)點結(jié)束。四、系統(tǒng)源代碼#include<stdio.h>/*標(biāo)準(zhǔn)輸入 / 輸出頭文件 */#inclu
9、de<conio.h>/*包含繪制圖形函數(shù)等頭文件*/#include<string.h>/*包含字符串處理函數(shù)頭文件*/#include<stdlib.h>/*包含動態(tài)存儲與釋放函數(shù)頭文件 */#include<graphics.h>#define LEN sizeof(COM)#definePRINT "%-15ld%-15s%-15dn",ptr1->num,ptr1->name,ptr1->count#define CHECK_COUNT ptr1->count<0#define CHEC
10、K_COUNT2 ptr3->count<0#define NULL 0typedef struct comlong int num;char name10;int count;struct com *prior, *next; COM; /* COM *input();/*COM *insert( );/*COM *delet( );/*void search( );/*void save(COM *head);/*COM *openfile( );/*void print( ); /* FILE *fp; /* COM *head=NULL;定義結(jié)構(gòu)體 */輸入貨品信息 */插
11、入貨品信息 */刪除貨品信息 */ 查找貨品信息 */保存貨品信息 */ 從文件將貨品信息載入鏈表 */ 輸出貨品信息 */ 定義指向文件的指針變量 */COM *ptr1=NULL,*ptr2=NULL; char filename110; /* char filename2 =".dat" /* /* 輸入模塊 */COM *input( )char string1 ="number" char string2 ="name" char string3 ="count"定義字符數(shù)組,用來存放文件名 */ 文件擴
12、展名 .dat*/int n=1;if(ptr1=(COM*)malloc(LEN)=NULL) /*申請空間函數(shù) */printf("No enough memory,fail to creat linklist!"); getch( ); /*任意一個字符 */clrscr( );printf("Please input depend on the無回顯的從鍵盤讀取emply(goodsnumber=0over):n");doprintf("Please input the No.%d goods'%s:n",n,stri
13、ng1); scanf("%ld",&ptr1->num);flushall();if(ptr1->num=0)printf("Please press any key to back to last Menu:"); getch( );free(ptr1);return(0);printf("Pleaseinputthegoods'%s:n",n,string2);scanf("%s",&ptr1->name);flushall( );/*刷新緩沖區(qū)函數(shù)printf(&q
14、uot;Pleaseinputthegoods'%s:n",n,string3);scanf("%d",&ptr1->count);No.%d*/No.%dflushall( );if(CHECK_COUNT)printf("Please input the right goodscount!n");while(CHECK_COUNT);while(ptr1->num!=NULL) if(n=1)head=ptr1;else ptr2->next=ptr1;ptr1->prior=ptr2;n=n+1;p
15、tr2=ptr1;if(ptr1=(COM* )malloc(LEN)=NULL) printf("No enough memory,fail to creat linklist!");getch( );doprintf("Please input the No.%d goods'%s:n",n,string1); scanf("%ld",&ptr1->num);flushall( );if(ptr1->num=0)ptr1->num=NULL;break;No.%dprintf("Plea
16、se input the goods'%s:n",n,string2);scanf("%s",&ptr1->name);flushall( );No.%dprintf("Please input the goods'%s:n",n,string3);scanf("%d",&ptr1->count);flushall( );if(CHECK_COUNT)printf("Please input the right goodscount!n");while(CHEC
17、K_COUNT);ptr2->next=NULL;gotoxy(1,24);printf("Finish the inputting of goods'message,press any key to back to last Menu,please save:");getch(); return(head);/* 插入模塊 */COM * insert( )COM * ptr3;char string1 ="goodsnumber"char string2 ="goodsname"char string3 ="
18、;goodscount"char judge10; clrscr( );gotoxy(18,10);printf("Please input inserted goods'fliename:"); head=openfile( );if(head=NULL) return(NULL);elsedoclrscr( );printf("Please input inserted goods'goodsmessage:n"); if(ptr3=(COM*)malloc(LEN)=NULL) printf("No enough
19、 memory,fail to creat node!"); getch();doinputprintf("Please goods'%s(>0):n",string1);scanf("%ld",&ptr3->num);flushall( );if(ptr3->num<=0)printf("Error inputting!please choose the inserted goods againn");getch( );return;inputinputprintf("Pl
20、ease goods'%s:n",string2);scanf("%s",&ptr3->name);flushall( );printf("Please goods'%s:n",string3);scanf("%d",&(ptr3->count); flushall( );if(CHECK_COUNT2)printf("Please input the right goodscount(>0)!n");while(CHECK_COUNT2);ptr1=he
21、ad;while(ptr1!=NULL)ptr2=ptr1;ptr1=ptr1->next;ptr1->prior=ptr2;ptr2->next=ptr3; ptr3->prior=ptr2;ptr3->next=NULL;printf("nInserting success!Cotinue to insert?(yes or no):"); scanf("%s",judge);clrscr( );while(! strcmp(judge,"yes");gotoxy(20,10);printf(&quo
22、t;Inserting success!n");gotoxy(18,11);printf("Press any key to back to last Menun");gotoxy(16,12);printf("And make sure to Save(6) them or you will lose them!n"); getch( );return(head);/* 刪除模塊 */COM *delet( )char name10;char judge10;int sel;int del_num;clrscr( ); gotoxy(20,1
23、0);printf("Please input delected goods'fliename:"); head=openfile( );clrscr( );if(head=NULL)return(NULL);elsedodoclrscr( );gotoxy(3,4);printf("Please input delected goods'message:");gotoxy(1,9);printf(" *1.Del depend on goodsnumbern");gotoxy(1,10);printf("
24、*2.Del depend on goodsnamen");gotoxy(10,22);printf("please choose a number between 1 and 2:"); scanf("%d",&sel);switch(sel)case 1:clrscr( );gotoxy(6,6); printf("Please input goodsnumber:"); scanf("%d",&del_num);break;case 2:clrscr( );gotoxy(6,6);
25、printf("Please input goodsname:"); scanf("%s",&name);break;while(sel!=1&&sel!=2); ptr1=head;if(ptr1->num=del_num|(strcmp(ptr1->name,name)=0) head=ptr1->next; printf("Success to delect goodsmessage!n");else /* 判斷是否是目標(biāo)結(jié)點 */ while(ptr1!=NULL&&p
26、tr1->num!=del_num&&strcmp(ptr1->name,name)!=0)ptr2=ptr1; ptr1=ptr1->next;ptr1->prior=ptr2; if(ptr1->num=del_num|(strcmp(ptr1->name,name)=0) ptr2->next=ptr1->next;ptr1->next->prior=ptr1->prior;free(ptr1); printf("nSuccess to delect goodsmessage!nn");
27、else printf("nCan't find this goodsmessage!nn");printf("Cotinue to delect?(yes or no):"); scanf("%s",judge);while(!strcmp(judge,"yes");clrscr( ); gotoxy(20,10);printf("Delecting success!n"); gotoxy(18,11);printf("Press any key to back to las
28、t Menun");gotoxy(16,12);printf("And make sure to Save(6) them or you will lose them!n"); getch( );return(head);/* 查找模塊 */ void search( ) char name10; char judge10;int sel;long int sel_num;clrscr( );gotoxy(18,10);printf("Please press searched goods'fliename:"); head=openf
29、ile( );if(head=NULL)return;elsedodoclrscr( );gotoxy(5,4);printf("Please choose the way to search:");gotoxy(1,9);printf("*1.Search depend ongoodsnumbern");printf("*1.Search depend ongoodsnamen");gotoxy(10,22);printf("please choose a number between 1 and 2:"); s
30、canf("%d",&sel);switch(sel)case 1:clrscr( );printf("Please input goodsnumber:"); scanf("%ld",&sel_num);break;case 2:clrscr( );printf("Please input goodsname:"); scanf("%s",name); break;while(sel!=1&&sel!=2);ptr1=head;while(ptr1!=NULL&
31、amp;&ptr1->num!=sel_num&&strcmp(ptr1->name,name)!=0 )ptr1=ptr1->next;if (ptr1->num=sel_num)|(strcmp(ptr1->name,name)=0) printf("n Success to search goodsmessage!n");printf("goodsnumbergoodscountnn"); printf(PRINT);elseprintf("nCan't find this g
32、oodsmessage!nn"); printf("Cotinue to search?(yes or no):"); scanf("%s",judge);while(!strcmp(judge,"yes"); gotoxy(10,24);printf("Please press any key to back to last Menu:"); getch( );/* 輸出模塊 */void print( )int i=1;clrscr( ); gotoxy(18,10);printf("Ple
33、ase input printed goods'filename:"); head=openfile( );if(head=NULL)return;elseclrscr( );printf("The printed result as follows:n");printf("goodsnumbergoodscountnn");ptr1=head;doprintf(PRINT);ptr1=ptr1->next;if(i/10=1) /* 超過十行換頁 */ i=0;printf("Press any key to chan
34、ge page:"); getch( );goodsnamegoodsnameclrscr( ); gotoxy(0,6);printf("goodsnumber goodsname goodscountnn");i=i+1;while(ptr1!=NULL);gotoxy(10,24);printf("Please press any key to back to last Menu:");getch( );/* 保存模塊 */void save(COM *head) clrscr();gotoxy(8,13);or以printf("
35、;Please input saved goods'filename(limit to letter number):");scanf("%s",filename1); if(fp=fopen(strcat(filename1,filename2),"wb")=NULL) /* 二進制只寫方式打開一個流 */printf("Fail to creat FILE!");getch( ); return;ptr1=ptr2=head;while(ptr1!=NULL) if(fwrite(ptr1,sizeof(COM)
36、,1,fp)!=1)printf("Fail to print message to FILE!");getch( );return;ptr1=ptr1->next;fclose(fp);gotoxy(10,24);printf("Saving success!Press any key to back to last Menu:"); getch();/* 載入模塊 */ COM * openfile( )int n=1;scanf("%s",filename1); if(fp=fopen(strcat(filename1,f
37、ilename2),"rb")=NULL)gotoxy(15,13);printf("This filename isn't exist,please check if exist.npress any key back to Menu");getch( );return(NULL); if(ptr1=ptr2=(COM*)malloc(LEN)=NULL) printf("No enough memory,fail to creat linklist!nPlease press any key back to Menun")
38、;getch( ); return(NULL);if(fread(ptr1,sizeof(COM),1,fp)!=1) /* 從 fp 指向的流 中讀取1個字段,每個字段為COM勺字符長,并把它們放到ptrl指向的字 符數(shù)組中,文件的位置指示器隨著所讀取的字符數(shù)而下移 */printf("Fail to print message from FILE!nPlease press any key back to Menun");getch( ); return(NULL); if(ptr1->next=NULL) head=ptr1;else doif(n=1)head
39、=ptr1;else ptr2->next=ptr1;n=n+1;ptr2=ptr1;if(ptr1=(COM*)malloc(LEN)=NULL)printf("No enough memory,fail to creat linklist!nPlease press any key to back to Menun");getch( );return(NULL);if(fread(ptr1,sizeof(COM),1,fp)!=1)printf("Fail to print message from FILE!nPlease press any key
40、to back to Menun");getch( );return(NULL);while(ptr1->next!=NULL);ptr2->next=ptr1;return(head);fclose(fp); /* 關(guān)閉文件函數(shù) */void main( )char message ="*The instruction of GOODS SYSTEM* nn"" You can input many kinds of messages,and you can use n" goodname as FILEnamen"&q
41、uot; This SYSTEMcan do operation like insert or delect to the n" "goodsmessage that have saved,then saved again.while you n"can search message depend on the goodsnub or goodsname. nnn" "-*Welcome to enter the GOODS SYSTEM!*-n"Charmenu=MENU*nnn"" *1.Inputn"
42、;" *2.Outputn"" *3.Insertn"" *4.Deleten"" *5.Searchn"" *6.Saven"" *0.Exitn"int sel;delay(10);背景為銀灰色, 字textbackground(LIGHTGRAY); textcolor(BLUE); /* 為藍色 */ clrscr( );gotoxy(4,8);printf("%s",message); gotoxy(10,22);printf(" Pl
43、ease press any key into the Menu!"); getch( );doclrscr( ); gotoxy(1,7); printf("%s",menu);gotoxy(10,20);printf("please choose a number from 0 to 6:");scanf("%d",&sel);輸入模塊 */輸出模塊 */插入模塊 */ 刪除模塊 */查找模塊 */ 保存模塊 */switch(sel)case 1:head=input( );/*break;case 2:pri
44、nt( );/*break;case 3:head=insert( );/*break;case 4:head=delet( );/*break;case 5:search( );/*break;case 6:save(head);/*break;case 0:break;while(sel!=0);五、調(diào)試分析和測試結(jié)果各模塊功能測試:用戶逐一輸入的數(shù)據(jù)不斷添加就形成了一個列表。前面已經(jīng)表明 本系統(tǒng)的數(shù)據(jù)結(jié)構(gòu)選取動態(tài)數(shù)據(jù)結(jié)構(gòu)雙向鏈表,因此此列表 在內(nèi)存中是以鏈表的形式存儲的。那么輸入模塊實際上就是一個 建立鏈表的操作模塊。通過模塊 save( )將內(nèi)存中的已輸入的數(shù)據(jù) 存入到指定路徑的某*.
45、dat 文件中去 .特別指出: * 為用戶自己規(guī)定的貨品名。 輸入條件: goodsnumb ld 型,且 0. 當(dāng)=0 時退出goodsname s 型goodscount d 型 ,且0. 當(dāng)0 時顯示輸入錯誤,重 輸字樣。調(diào)用 save( )時 goos'filename:d:pllfu輸出結(jié)果: 貨品保存在用戶指定路徑的 *.dat 文件中以免丟失。 2Print( ) 輸出模塊可將指定文件中的內(nèi)容顯示在屏幕上。 輸出條件:調(diào)用載入模塊時, goos'filename:d:pllfu 輸出結(jié)果:如輸出條件正確,則可在屏幕上顯示如下:goodsnumbgoodsnamegoodscount0001a1250002b2300003c1803. insert( ) 插入模塊插入模塊要完成的是鏈表的插入操作,即將一個新結(jié)點插入一個 已有的鏈表中。輸入條件:調(diào)用載入模塊。 goos'filename:d:pllfu 按貨品名的 number, name, count 分別輸入,如輸錯則有信息提
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 保潔公司 員工 合同標(biāo)準(zhǔn)文本
- 中介地皮廠房合同標(biāo)準(zhǔn)文本
- 2025年跨境電商物流空運合同
- 五座汽車租賃合同樣本
- 公司向政府借款合同樣本
- 體育館維修合同標(biāo)準(zhǔn)文本
- 農(nóng)村改建建筑合同樣本
- 修路合伙合同樣本
- 乙方廣告銷售合同樣本
- bot水務(wù)合同樣本
- 冰雪之都冰城哈爾濱旅游宣傳風(fēng)土人情城市介紹PPT圖文課件
- 祭奠白事活動清明節(jié)掃墓祭祖內(nèi)容完整動態(tài)PPT
- (完整版)鋼琴五線譜(A4打印)
- 量子力學(xué)完整版課件
- 生態(tài)修復(fù)地質(zhì)勘察報告
- 廣東廣州市海珠區(qū)官洲街道辦事處政府雇員公開招聘5人(必考題)模擬卷含答案
- 結(jié)構(gòu)膠msdslord第一部分化學(xué)產(chǎn)品和公司名稱
- 低血糖昏迷搶救預(yù)案及流程
- 新教材教科版四年級下冊科學(xué)全冊課時練(同步練習(xí))(共24課)
- 從專業(yè)走向管理
- 2022年中國礦業(yè)權(quán)評估新準(zhǔn)則
評論
0/150
提交評論