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

上传人:无*** 文档编号:45531815 上传时间:2021-12-07 格式:DOC 页数:26 大小:319.50KB
收藏 版权申诉 举报 下载
海运集装箱管理需求说明书_第1页
第1页 / 共26页
海运集装箱管理需求说明书_第2页
第2页 / 共26页
海运集装箱管理需求说明书_第3页
第3页 / 共26页
资源描述:

《海运集装箱管理需求说明书》由会员分享,可在线阅读,更多相关《海运集装箱管理需求说明书(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: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);J

46、Table countJTable = new JTable(countObj, countHeader);countJTable.setEnabled(false);JScrollPane countJsp = new JScrollPane(countJTable);countFrame.add(countJsp);countFrame.setVisible(true);class Export implements ActionListenerpublic void actionPerformed(ActionEvent e) / 将统计结果输出存到文件PrintStream p;try

47、 JFileChooser j=new JFileChooser(e:);int value = j.showSaveDialog(null);if(value=0)File file=j.getSelectedFile();p = new PrintStream(file);p.println(file+统计信息);for (int i = 0; i 6; i+) p.print(countObj0i + ); catch (FileNotFoundException e1) e1.printStackTrace();class Close implements ActionListener

48、public void actionPerformed(ActionEvent e)countFrame.dispose();NewFile新建提单package file;import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.io.File;import java.io.FileWrit

49、er;import java.util.ArrayList;import javax.swing.JButton;import javax.swing.JFileChooser;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTextField;SuppressWarnings(serial)public class NewFile extends JFrameJFrame f = ne

50、w JFrame(新建提单 Zhao Tengyuan);/JPanel 是一般轻量级容器。JPanel p = new JPanel();JPanel p1 = new JPanel();JLabel l = new JLabel(船信息);JLabel l1 = new JLabel(船名:);JLabel l2 = new JLabel(航次:);JLabel l3 = new JLabel(提单号:);JLabel l4 = new JLabel(目的港:);JTextField jtf1 = new JTextField(5);JTextField jtf2 = new JTextField(5);JTextField jtf3 = new JTextField(5);JTextField jtf4= new JTextField(5);JButton addShip = new JButton(添加船信息);JButton addBox = new JButton(添加箱信息);JButton add = new JButton(添加);JButton save = new JButton(保存);StringBuffe

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!