海运集装箱管理需求说明书.doc

上传人:哈尼dd 文档编号:5025192 上传时间:2020-01-29 格式:DOC 页数:26 大小:319.50KB
返回 下载 相关 举报
海运集装箱管理需求说明书.doc_第1页
第1页 / 共26页
海运集装箱管理需求说明书.doc_第2页
第2页 / 共26页
海运集装箱管理需求说明书.doc_第3页
第3页 / 共26页
海运集装箱管理需求说明书.doc_第4页
第4页 / 共26页
海运集装箱管理需求说明书.doc_第5页
第5页 / 共26页
点击查看更多>>
资源描述

《海运集装箱管理需求说明书.doc》由会员分享,可在线阅读,更多相关《海运集装箱管理需求说明书.doc(26页珍藏版)》请在三一文库上搜索。

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:);file包Data提单数据package file;/海运提单数据项目pub

24、lic 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 getShipname

25、() 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 getDestination()

26、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 = cntsize;pub

27、lic 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 = remark

28、;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;String dest

29、ination;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_Parse(Str

30、ing 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 = str1.

31、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.equals(HU

32、B) 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.setDestinatio

33、n(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 = Resour

34、ceBundle.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 = hData.g

36、etCntoperator();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();Iterator iter

37、 = 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.iterator();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.iter

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 研究报告 > 商业贸易


经营许可证编号:宁ICP备18001539号-1