




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、海运管理系统-赵腾园目录海运集装箱管理需求说明书- 1 -项目开发内容:- 1 -要求:- 2 -总体设计- 4 -运行设计- 4 -运行控制- 4 -源代码- 5 -main包- 5 -start程序运行入口- 5 -gui程序主界面- 5 -file包- 9 -data提单数据- 9 -parse解析提单- 10 -count统计- 14 -newfile新建提单- 16 -net包- 21 -server服务器- 21 -client客户端- 22 -海运集装箱管理需求说明书项目开发内容:=读取预配报文文件(参见06062313、06062314),将报文重新格式化,并进行统计分析,然后
2、将结果写入文件。文件体格式如下:船名:航次:提单号:目的港#尺寸:箱型:数量:经营人#尺寸:箱型:数量:经营人#titanic:603e:snl 018576:sigapore#20:gp:4:hub#40:rf:5:snl#单船多票文件结构: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#提单类型的数据结构:英文名称中文名称shipname船名voyage航次blno提单号destination目的港cnttype箱型cntsize集装箱尺寸cntqnt箱量cntoperator箱经营人remark备注要求:1、 从文件中读取数据,进行解析,并展示。形式如下:显示在jtable中 。每一条数据,要显示箱子的信息和箱子所在船的信息。2、 对解析后数据要提供保存功能,保存到数据库中(现阶段利用文件替代数据,将数据保存在文件中)。3、 完成新建提单的功能。4、 完成统计功能。对解析后的内容进行统
4、计。 统计如下功能: 1). 总共有多少个航次 3). 总共有多少票业务(按提单号统计) 6). 所有业务的箱型尺寸汇总(每个尺寸的箱子的个数) 7). 所有业务中有多少个箱子8). 计算总共有多少个teu(twentyfoot equivalent unit) 统计出尺寸是20的箱子的个数。 9)统计每个经营人的数量。5、 将统计结果存入文件,同时显示在界面上。6、 socket 数据传递,要在局域网中的不同计算机之间测试通过。(要求完成聊天和传送文件)7、 如果提单头 是snl,hub 要在记录的最后(备注)加上soc8、 实现翻译,根据下表,翻译对应的箱型,和尺寸。代码/原代号箱 型箱型
5、群组代码主 要 特 征箱型代码原代号g/0通用集装箱 (无通风装置)gpg0-g9 00-11 v/1通风式通用集装箱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 空/陆/水联运集
6、装箱 as a0 90 尺寸箱型对应类型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、 不得在程序中出现业务数据或者业务文件名称等硬编码(配置文件可以),把所有需要硬编码的内容写入文件总体设计如果文件格式有误应提示:文件有误并从新进行选择文件的操作对文件解析并显示结果统计后的结果可以保存到文件中对解析结果进行统计将解析结果存入文件中保存文件类型:.txt .slx .dat 运行设计 运行控制双击该软件即可直接运行,点击界面当中的菜单即可进行相应的操作。菜单选项共分为:文件,统计,网络,工具,帮助(下图是表示菜单中的子菜单结构)新建提单 文件 打开提单 保存文件 统计 统计提单信息 启动服务器网络 关闭服务器 计算机工具 画图程序帮助 帮助文档源代码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(海运管理系统 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(统计);bar.add(count);countinfo = new jmenuitem(统计信息);count.add(countinfo);count
12、info.addactionlistener(this);net = new jmenu(网络);bar.add(net);chat = new jmenuitem(聊天);server = new jmenuitem(服务器);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; / 用于显示打开内容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();/ 如果文件符合要求,则调用解析程序分解文件内容if (isnot) bufferedreader bufreader = new bufferedreader(new filereader(file);while (bufreader.ready() string str = bufreader.readline();/ 每读一句,调用一次解析方法ps.reader_parse(str);bu
18、freader.close(); catch (exception e1) e1.printstacktrace();objstr = ps.getobjstr();/ 取得显示内容headerstr = ps.getheader();/ 取得表头jtable = new jtable(objstr,headerstr);jtable.updateui();/当第二次打开文件时实现文件的更新jtable.clearselection();jtable.setautoresizemode(jtable.auto_resize_all_columns );jtable.setrowheight(3
19、0);/设置表格的高度jtable.getcolumnmodel().getcolumn(0).setpreferredwidth(150);/设置表格宽度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中的内容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, 无法进行统计);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提单数据package file;/海运提
24、单数据项目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; / 箱经营人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 + 经营人: + cntoperator+ 备注: + remark;parse解析提单package file;import java.util.*;/代码解析public class parse string shipname;string voyage;string blno;str
29、ing destination;int sizecount = 0;/ 尺寸数量boolean isnot = false; / 标记以前list是否有值data hdata = new data();private final static list list = new vector();/ 返回表头public string getheader() isnot = true;string header = 船名, 航次, 提单号, 目的港, 集装箱尺寸, 箱型, 箱量,箱经营人, 备注 ;/ 设置显示表头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 / 去解析提单内容this.bodyparse(str);/ 折分提单头,把相应内容存于数组中public void headerparse(string str) string str1 = str.replace(#, );string str2
31、 = str1.split(:);shipname = str20;voyage = str21;blno = str22;destination = str23;/ 折分提单内容public void bodyparse(string str) data hdata = new data();string str1 = str.replace(#, );string str2 = str1.split(:);string perator = str23;/ 判断经营人是否为snl或是hubstring remark = ;if (perator.equals(snl) | perator.e
32、quals(hub) remark = soc;hdata.setcntsize(this.parseup(str20);/ 调用解释方法取出对应的值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);/ 将得到的每一条提单存入集合中/ 从配置文件中解释出对应的文字内容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;/ 返回表单内容public object getobjstr() int length = list.size();object obj = new objectlength9
35、;/ 从集合中取出数据转存到二维数组中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;/ 统计当前提单内容,并将结果返回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() / 取出不要统计的不同项目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);/ 调用统计后取得连接字符串cblno = strsplit(cblno, 2);csize = strsplit(csize, 3);perator = strsplit(perator, 4);iterator iters = list.iterator();/ 统计尺寸为20英尺的数量while (
40、iters.hasnext() if (iters.next().getcntsize().equals(20英尺) sizecount+;countobj00 = cname;countobj01 = cblno;countobj02 = csize;countobj03 = 箱子总数: + count;countobj04 = teu数量: + sizecount;sizecount = 0;countobj05 = perator;return countobj;/返回提单表头public string getcount_header() string countheader = 航次,
41、 业务, 尺寸(英尺), 箱子, teu, 经营人 ;return countheader;/ map字符串分解方法并统计数量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+) / 统计每个值在集合中的数量iterator iter = list.iterator();int pos = 0;switch (x) case 1: while
42、 (iter.hasnext() if (stri.equals(iter.next().getshipname() pos+;strlist += 船名: + stri + 数量: + pos + ;break;case 2: while (iter.hasnext() if (stri.equals(iter.next().getblno() pos+;strlist = 业务数量: + pos + ;break;case 3: while (iter.hasnext() string s3 = iter.next().getcntsize();if (stri.equals(s3) po
43、s+;strlist += 尺寸: + stri + 数量: + pos + ;break;case 4: while (iter.hasnext() if (stri.equals(iter.next().getcntoperator() pos+;strlist += 经营人: + stri + 数量: + pos + ;break;return strlist;count统计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(统计信息 zhao tengyuan);jbutton b1 = new jbutton(导出);jbutton b2 = new jbutton(关闭);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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 设备保管使用协议书
- 共同成立子公司协议书
- 保洁员签到合同协议书
- app商城代理协议书
- 花草修剪合同协议书
- 门市出租调价协议书
- 船舶买卖交接协议书
- 门市租房安全协议书
- 南宁房地产合作协议书
- csc公派留学协议书
- 医院病历的管理制度
- 糖尿病动画健康指导
- 南京理工大学泰州科技学院《DSP原理及应用》2022-2023学年第一学期期末试卷
- 《SQL优化策略》课件
- 剪映专业版教学课件
- 智能咖啡机行业营销策略方案
- 航空与航天学习通超星期末考试答案章节答案2024年
- 工行个人房屋贷款协议模板
- 担任学生干部证明
- 《国家电网有限公司电力建设安全工作规程第4部分:分布式光伏》知识培训
- 2024年《13464电脑动画》自考复习题库(含答案)
评论
0/150
提交评论