海運集裝箱管理需求說明書_第1頁
海運集裝箱管理需求說明書_第2頁
海運集裝箱管理需求說明書_第3頁
海運集裝箱管理需求說明書_第4頁
海運集裝箱管理需求說明書_第5頁
已閱讀5頁,還剩21頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、海運管理系統(tǒng)-趙騰園目錄海運集裝箱管理需求說明書- 1 -項目開發(fā)內(nèi)容:- 1 -要求:- 2 -總體設(shè)計- 4 -運行設(shè)計- 4 -運行控制- 4 -源代碼- 5 -main包- 5 -start程序運行入口- 5 -gui程序主界面- 5 -file包- 9 -data提單數(shù)據(jù)- 9 -parse解析提單- 10 -count統(tǒng)計- 14 -newfile新建提單- 16 -net包- 21 -server服務(wù)器- 21 -client客戶端- 22 -海運集裝箱管理需求說明書項目開發(fā)內(nèi)容:=讀取預(yù)配報文文件(參見06062313、06062314),將報文重新格式化,并進(jìn)行統(tǒng)計分析,然后

2、將結(jié)果寫入文件。文件體格式如下:船名:航次:提單號:目的港#尺寸:箱型:數(shù)量:經(jīng)營人#尺寸:箱型:數(shù)量:經(jīng)營人#titanic:603e:snl 018576:sigapore#20:gp:4:hub#40:rf:5:snl#單船多票文件結(jié)構(gòu):yunfeng:603e:snl 0185762:sigapore#20:gp:4:hub#40:rf:5:snl#yunfeng:603e:jl 4547357:pusan#20:gp:4:hub#40:rt:5:jl#hanyang:603e:hub 8576276:sigapore#20:rh:4:hub#40:rf:5:snl#yunfeng:6

3、03e:snl 4195325:cnsha#20:rf:4:hub#40:gp:5:jl#提單類型的數(shù)據(jù)結(jié)構(gòu):英文名稱中文名稱shipname船名voyage航次blno提單號destination目的港cnttype箱型cntsize集裝箱尺寸cntqnt箱量cntoperator箱經(jīng)營人remark備注要求:1、 從文件中讀取數(shù)據(jù),進(jìn)行解析,并展示。形式如下:顯示在jtable中 。每一條數(shù)據(jù),要顯示箱子的信息和箱子所在船的信息。2、 對解析后數(shù)據(jù)要提供保存功能,保存到數(shù)據(jù)庫中(現(xiàn)階段利用文件替代數(shù)據(jù),將數(shù)據(jù)保存在文件中)。3、 完成新建提單的功能。4、 完成統(tǒng)計功能。對解析后的內(nèi)容進(jìn)行統(tǒng)

4、計。 統(tǒng)計如下功能: 1). 總共有多少個航次 3). 總共有多少票業(yè)務(wù)(按提單號統(tǒng)計) 6). 所有業(yè)務(wù)的箱型尺寸匯總(每個尺寸的箱子的個數(shù)) 7). 所有業(yè)務(wù)中有多少個箱子8). 計算總共有多少個teu(twentyfoot equivalent unit) 統(tǒng)計出尺寸是20的箱子的個數(shù)。 9)統(tǒng)計每個經(jīng)營人的數(shù)量。5、 將統(tǒng)計結(jié)果存入文件,同時顯示在界面上。6、 socket 數(shù)據(jù)傳遞,要在局域網(wǎng)中的不同計算機(jī)之間測試通過。(要求完成聊天和傳送文件)7、 如果提單頭 是snl,hub 要在記錄的最后(備注)加上soc8、 實現(xiàn)翻譯,根據(jù)下表,翻譯對應(yīng)的箱型,和尺寸。代碼/原代號箱 型箱型

5、群組代碼主 要 特 征箱型代碼原代號g/0通用集裝箱 (無通風(fēng)裝置)gpg0-g9 00-11 v/1通風(fēng)式通用集裝箱vhv1-v913-19b/2干散貨集裝箱bu, bkb0-b920-24s/2以貨物種類命名的集裝箱sn汽車集裝箱,活魚集裝箱s0-s825-29r/3保溫集裝箱re,rf,rt,rs,rh制冷/加熱r0-r931-39h/4保溫集裝箱hr,hi外置式掛裝制冷/加熱裝h0-h940-49u/5敞頂式集裝箱ut -端或兩端開口u0-u650-56p/6平臺(和臺架式)集裝箱pl平臺集裝箱p0-p960-69t/7罐式集裝箱tn最低試驗壓力t0-t970-79a 空/陸/水聯(lián)運集

6、裝箱 as a0 90 尺寸箱型對應(yīng)類型95碼12 英尺干貨箱gp12g1干貨高箱gh(hc,hq)15g120英尺干貨箱gp22g1干貨高箱gh(hc,hq)25g1掛衣ht22v1開頂箱ot22u1冷凍箱rf22r1冷高箱rh25r1油罐箱tk22t1框架箱fr22p140英尺干貨箱gp42g1干貨高箱gh(,hq)45g1掛衣箱ht42v1開頂箱ot42u1冷凍箱rf42r1冷高箱rh45r1油罐箱tk42t1框架箱fr42p145英尺干貨箱gpl2g干貨高箱gh(hc,hq)l5g1掛衣箱htl2v1開頂箱otl2u1冷凍箱rfl2r1冷高箱rhl5r1油罐箱tkl2t1框架箱frl2

7、p19、 不得在程序中出現(xiàn)業(yè)務(wù)數(shù)據(jù)或者業(yè)務(wù)文件名稱等硬編碼(配置文件可以),把所有需要硬編碼的內(nèi)容寫入文件總體設(shè)計如果文件格式有誤應(yīng)提示:文件有誤并從新進(jìn)行選擇文件的操作對文件解析并顯示結(jié)果統(tǒng)計后的結(jié)果可以保存到文件中對解析結(jié)果進(jìn)行統(tǒng)計將解析結(jié)果存入文件中保存文件類型:.txt .slx .dat 運行設(shè)計 運行控制雙擊該軟件即可直接運行,點擊界面當(dāng)中的菜單即可進(jìn)行相應(yīng)的操作。菜單選項共分為:文件,統(tǒng)計,網(wǎng)絡(luò),工具,幫助(下圖是表示菜單中的子菜單結(jié)構(gòu))新建提單 文件 打開提單 保存文件 統(tǒng)計 統(tǒng)計提單信息 啟動服務(wù)器網(wǎng)絡(luò) 關(guān)閉服務(wù)器 計算機(jī)工具 畫圖程序幫助 幫助文檔源代碼main包start

8、程序運行入口package main;public class start public static void main(string args) gui g = new gui();g.setvisible(true);gui程序主界面package main;import file.*;import java.awt.container;import java.awt.event.actionevent;import java.awt.event.actionlistener;import java.io.*;import javax.swing.*;import net.*;suppr

9、esswarnings(serial)public class gui extends jframe implements actionlistenerjmenu file;jmenuitem newfile;jmenuitem openfile;jmenuitem savefile;jmenu count;jmenuitem countinfo;jmenu net;jmenuitem chat;jmenuitem server;jmenuitem client;jmenu tools;jmenuitem computer;jmenuitem draw;jmenu game;jmenuitem

10、 saolei;jmenu help;jmenuitem version;public gui()suppresswarnings(unused)container con=this.getcontentpane();this.settitle(海運管理系統(tǒng) zhao tengyuan);this.setbounds(200, 200, 500, 500);jmenubar bar = new jmenubar();this.setjmenubar(bar);file =new jmenu(文件);bar.add(file);newfile =new jmenuitem(新建);openfil

11、e = new jmenuitem(打開);savefile = new jmenuitem(保存);file.add(newfile);file.add(openfile);file.add(savefile);newfile.addactionlistener(this);openfile.addactionlistener(this);savefile.addactionlistener(this);count = new jmenu(統(tǒng)計);bar.add(count);countinfo = new jmenuitem(統(tǒng)計信息);count.add(countinfo);count

12、info.addactionlistener(this);net = new jmenu(網(wǎng)絡(luò));bar.add(net);chat = new jmenuitem(聊天);server = new jmenuitem(服務(wù)器);client = new jmenuitem(客戶端);net.add(chat);net.add(server);net.add(client);chat.addactionlistener(this);server.addactionlistener(this);client.addactionlistener(this);tools = new jmenu(工具

13、);bar.add(tools);computer = new jmenuitem(計算器);draw = new jmenuitem(畫圖);tools.add(computer);tools.add(draw);computer.addactionlistener(this);draw.addactionlistener(this);game = new jmenu(游戲);bar.add(game);saolei = new jmenuitem(掃雷);game.add(saolei);saolei.addactionlistener(this);help = new jmenu(幫助)

14、;bar.add(help);version = new jmenuitem(幫助信息);help.add(version);version.addactionlistener(this);jframe jframe;/ 用于主窗體jtable jtable; / 用于顯示打開內(nèi)容jscrollpane jsp;/ 用于添中jtablestring headerstr;/ 用于存儲表頭object objstr;/ 用于存儲表單parse ps = new parse();public void actionperformed(actionevent e) if(e.getsource().e

15、quals(newfile)new newfile();if(e.getsource().equals(openfile)jfilechooser jfc = new jfilechooser(e:);int i = jfc.showopendialog(null);if (i = jfilechooser.approve_option) file file = jfc.getselectedfile();boolean isnot = true;string regex1 = a-za-z+:0-9a-za-z+:a-za-zs0-9+:a-za-z+#;string regex2 = 0-

16、9+:a-za-z+:0-9+:a-za-z+#;try bufferedreader buf = new bufferedreader(new filereader(file);/ 判斷這個文件是否符合要求if (!buf.ready() / 判斷是否為空joptionpane.showmessagedialog(null, 打開的文件格式錯誤!);isnot = false;return; else do string str = buf.readline();/ 判斷讀入的每一句是否為指定格式if (!str.matches(regex1)& (!str.matches(regex2)

17、joptionpane.showmessagedialog(null, 打開的文件格式錯誤!);isnot = false;return; while (buf.ready();buf.close();/ 如果文件符合要求,則調(diào)用解析程序分解文件內(nèi)容if (isnot) bufferedreader bufreader = new bufferedreader(new filereader(file);while (bufreader.ready() string str = bufreader.readline();/ 每讀一句,調(diào)用一次解析方法ps.reader_parse(str);bu

18、freader.close(); catch (exception e1) e1.printstacktrace();objstr = ps.getobjstr();/ 取得顯示內(nèi)容headerstr = ps.getheader();/ 取得表頭jtable = new jtable(objstr,headerstr);jtable.updateui();/當(dāng)?shù)诙未蜷_文件時實現(xiàn)文件的更新jtable.clearselection();jtable.setautoresizemode(jtable.auto_resize_all_columns );jtable.setrowheight(3

19、0);/設(shè)置表格的高度jtable.getcolumnmodel().getcolumn(0).setpreferredwidth(150);/設(shè)置表格寬度jscrollpane scrollpane = new jscrollpane(jtable); this.add(scrollpane); this.setvisible(true);if(e.getsource().equals(savefile)jfilechooser jfc = new jfilechooser(e:);int jin = jfc.showsavedialog(null);file file = jfc.gets

20、electedfile();if (jin = jfilechooser.approve_option) try / 保存jtable中的內(nèi)容printstream p = new printstream(file);for (int i = 0; i ps.getlist().size(); i+) p.println(ps.getlist().get(i); catch (exception e1) joptionpane.showmessagedialog(null, 無法保存!);if(e.getsource().equals(countinfo)trycount count = ne

21、w count();count.cframe();catch(exception e1)joptionpane.showmessagedialog(null, 無法進(jìn)行統(tǒng)計);if(e.getsource().equals(chat)mytcp mtcp = new mytcp();mtcp.setvisible(true);if(e.getsource().equals(server)server s = new server();s.serv();if(e.getsource().equals(client)client c = new client();c.clientframe();i

22、f(e.getsource().equals(computer)try runtime.getruntime().exec(calc); catch (ioexception e1) joptionpane.showmessagedialog(null, no found the order!);if(e.getsource().equals(draw)try runtime.getruntime().exec(mspaint); catch (ioexception e1) joptionpane.showmessagedialog(null, no found the order!);if

23、(e.getsource().equals(saolei)try runtime.getruntime().exec(winmine); catch (ioexception e1) joptionpane.showmessagedialog(null, no found the order!);if(e.getsource().equals(version)joptionpane.showmessagedialog(null, version: v 1.1nauthor: zhao tengyuannemail:zhty2007);file包data提單數(shù)據(jù)package file;/海運提

24、單數(shù)據(jù)項目public class data private string shipname; / 船名private string voyage; / 航次private string blno; / 提單號private string destination; / 目的港private string cnnttype; / 箱型private string cntsize; / 集裝箱尺寸private int cntqnt; / 箱量private string cntoperator; / 箱經(jīng)營人private string remark; / 備注public string get

25、shipname() return shipname;public void setshipname(string shipname) this.shipname = shipname;public string getvoyage() return voyage;public void setvoyage(string voyage) this.voyage = voyage;public string getblno() return blno;public void setblno(string blno) this.blno = blno;public string getdestin

26、ation() return destination;public void setdestination(string destination) this.destination = destination;public string getcnnttype() return cnnttype;public void setcnnttype(string cnnttype) nttype = cnnttype;public string getcntsize() return cntsize;public void setcntsize(string cntsize) tsize = cnt

27、size;public int getcntqnt() return cntqnt;public void setcntqnt(int cntqnt) tqnt = cntqnt;public string getcntoperator() return cntoperator;public void setcntoperator(string cntoperator) toperator = cntoperator;public string getremark() return remark;public void setremark(string remark) this.remark

28、= remark;public string tostring() return 船 名: + shipname + 航 次: + voyage + 提單號: + blno+ 目的港: + destination + 尺寸: + cntsize + 箱型: + cnnttype + 箱量: + cntqnt + 經(jīng)營人: + cntoperator+ 備注: + remark;parse解析提單package file;import java.util.*;/代碼解析public class parse string shipname;string voyage;string blno;str

29、ing destination;int sizecount = 0;/ 尺寸數(shù)量boolean isnot = false; / 標(biāo)記以前l(fā)ist是否有值data hdata = new data();private final static list list = new vector();/ 返回表頭public string getheader() isnot = true;string header = 船名, 航次, 提單號, 目的港, 集裝箱尺寸, 箱型, 箱量,箱經(jīng)營人, 備注 ;/ 設(shè)置顯示表頭return header;/ 解析程序入口public void reader_p

30、arse(string str) if (isnot) list.clear();isnot = false;string regex1 = a-za-z+:0-9a-za-z+:a-za-zs0-9+:a-za-z+#;if (str.matches(regex1) / 判斷此句是否為提單頭this.headerparse(str); else / 去解析提單內(nèi)容this.bodyparse(str);/ 折分提單頭,把相應(yīng)內(nèi)容存于數(shù)組中public void headerparse(string str) string str1 = str.replace(#, );string str2

31、 = str1.split(:);shipname = str20;voyage = str21;blno = str22;destination = str23;/ 折分提單內(nèi)容public void bodyparse(string str) data hdata = new data();string str1 = str.replace(#, );string str2 = str1.split(:);string perator = str23;/ 判斷經(jīng)營人是否為snl或是hubstring remark = ;if (perator.equals(snl) | perator.e

32、quals(hub) remark = soc;hdata.setcntsize(this.parseup(str20);/ 調(diào)用解釋方法取出對應(yīng)的值hdata.setcnnttype(this.parseup(str21);hdata.setcntqnt(integer.valueof(str22);hdata.setcntoperator(this.parseup(str23);hdata.setremark(remark);hdata.setshipname(shipname);hdata.setvoyage(voyage);hdata.setblno(blno);hdata.setde

33、stination(destination);hdata.getshipname();hdata.getvoyage();hdata.getblno();hdata.getdestination();hdata.getcnnttype();hdata.getcntsize();hdata.getcntqnt();hdata.getcntoperator();hdata.getremark();list.add(hdata);/ 將得到的每一條提單存入集合中/ 從配置文件中解釋出對應(yīng)的文字內(nèi)容public string parseup(string str) resourcebundle re

34、= resourcebundle.getbundle(config.haiyun);set set = re.keyset();/ 將配置文件鍵值的set視圖iterator iter = set.iterator();while (iter.hasnext() / 在配置文件中查找鍵值對變的值if (iter.next().equals(str) str = re.getstring(str);return str;/ 返回表單內(nèi)容public object getobjstr() int length = list.size();object obj = new objectlength9

35、;/ 從集合中取出數(shù)據(jù)轉(zhuǎn)存到二維數(shù)組中iterator iter = list.iterator();int i = 0;while (iter.hasnext() hdata = iter.next();obji0 = hdata.getshipname();obji1 = hdata.getvoyage();obji2 = hdata.getblno();obji3 = hdata.getdestination();obji4 = hdata.getcntsize();obji5 = hdata.getcnnttype();obji6 = hdata.getcntqnt();obji7 =

36、 hdata.getcntoperator();obji8 = hdata.getremark();i+;return obj;/ 返回list值public list getlist() return list;/ 統(tǒng)計當(dāng)前提單內(nèi)容,并將結(jié)果返回public object get_count() object countobj = new object16;int count = 0;map map1 = new hashmap();map map2 = new hashmap();map map3 = new hashmap();map map4 = new hashmap();itera

37、tor iter = list.iterator();while (iter.hasnext() / 取出不要統(tǒng)計的不同項目hdata = iter.next();map1.put(hdata.getshipname(), );map2.put(hdata.getblno(), );map3.put(hdata.getcntsize(), );map4.put(hdata.getcntoperator(), );count += hdata.getcntqnt();set set1 = map1.keyset();/ 依次取出map中的鍵值iterator it1 = set1.iterato

38、r();string cname = ;while (it1.hasnext() cname += it1.next() + #;set set2 = map2.keyset();iterator it2 = set2.iterator();string cblno = ;while (it2.hasnext() cblno += it2.next() + #;set set3 = map3.keyset();iterator it3 = set3.iterator();string csize = ;while (it3.hasnext() csize += it3.next() + #;s

39、et set4 = map4.keyset();iterator it4 = set4.iterator();string perator = ;while (it4.hasnext() perator += it4.next() + #;cname = strsplit(cname, 1);/ 調(diào)用統(tǒng)計后取得連接字符串cblno = strsplit(cblno, 2);csize = strsplit(csize, 3);perator = strsplit(perator, 4);iterator iters = list.iterator();/ 統(tǒng)計尺寸為20英尺的數(shù)量while (

40、iters.hasnext() if (iters.next().getcntsize().equals(20英尺) sizecount+;countobj00 = cname;countobj01 = cblno;countobj02 = csize;countobj03 = 箱子總數(shù): + count;countobj04 = teu數(shù)量: + sizecount;sizecount = 0;countobj05 = perator;return countobj;/返回提單表頭public string getcount_header() string countheader = 航次,

41、 業(yè)務(wù), 尺寸(英尺), 箱子, teu, 經(jīng)營人 ;return countheader;/ map字符串分解方法并統(tǒng)計數(shù)量public string strsplit(string s, int x) string str;s = s.substring(0, s.length() - 1);str = s.split(#);string strlist = ;for (int i = 0; i str.length; i+) / 統(tǒng)計每個值在集合中的數(shù)量iterator iter = list.iterator();int pos = 0;switch (x) case 1: while

42、 (iter.hasnext() if (stri.equals(iter.next().getshipname() pos+;strlist += 船名: + stri + 數(shù)量: + pos + ;break;case 2: while (iter.hasnext() if (stri.equals(iter.next().getblno() pos+;strlist = 業(yè)務(wù)數(shù)量: + pos + ;break;case 3: while (iter.hasnext() string s3 = iter.next().getcntsize();if (stri.equals(s3) po

43、s+;strlist += 尺寸: + stri + 數(shù)量: + pos + ;break;case 4: while (iter.hasnext() if (stri.equals(iter.next().getcntoperator() pos+;strlist += 經(jīng)營人: + stri + 數(shù)量: + pos + ;break;return strlist;count統(tǒng)計package file;import java.awt.*;import java.awt.event.actionevent;import java.awt.event.actionlistener;import

44、 java.io.file;import java.io.filenotfoundexception;import java.io.printstream;import javax.swing.*;public class count parse ps = new parse();object countobj = ps.get_count();jframe countframe;public void cframe() string countheader = ps.getcount_header();countframe = new jframe();countframe.setlocat

45、ion(200, 200);countframe.setsize(600, 150);countframe.settitle(統(tǒng)計信息 zhao tengyuan);jbutton b1 = new jbutton(導(dǎo)出);jbutton b2 = new jbutton(關(guān)閉);jpanel jtab=new jpanel();jtab.add(b1);jtab.add(b2);b1.addactionlistener(new export();b2.addactionlistener(new close();countframe.add(jtab,borderlayout.south);jtable countjtable = new jtable(countobj, countheader);countjtable.setenabled(false);jscrollpane countjsp = new jscrollpane(countjtable);countframe.add(countjsp);countframe.setvisible(true);class export

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論