java代码查京东库存 京东库存数量查询( 二 )


3.点选“盘盈亏”,可依据盘盈亏单创立时间、所属仓库、盘盈亏单号、SKU编码、商品称号停止挑选 , 然后点选“查询” , 能够查看到该单创立日期、盘盈亏单号、SKUID、商品称号、所属仓库、SKU数量、结算单价、结算金额信息 。
求java编写的仓库管理系统源代码或详细设计import java.util.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
class 商品 extends Panel
{String 代号,名称;int 库存;float 单价;
商品(String 代号,String 名称,int 库存,float 单价)
{this.代号=代号;this.名称=名称;this.库存=库存;this.单价=单价;
}
}
class ShowWin extends JFrame implements ActionListener
{ Hashtable hashtable=null;
JTextField 代号文本框=new JTextField(),
名称文本框=new JTextField(),
库存文本框=new JTextField(),
单价文本框=new JTextField(),
查询文本框=new JTextField(),
查询信息文本框=new JTextField(),
删除文本框=new JTextField();
JButton b_add=new JButton("添加商品"),
b_del=new JButton("删除商品"),
b_xun=new JButton("查询商品"),
b_xiu=new JButton("修改商品"),
b_show=new JButton("显示商品清单");
JTextArea 显示区=new JTextArea(25,10);
ShowWin()
{super("仓库管理窗口");
hashtable=new Hashtable();
Container con=getContentPane();
JScrollPane pane=new JScrollPane(显示区);
显示区.setEditable(false);
JPanel save=new JPanel();
save.setLayout(new GridLayout(8,2));
save.add(new Label("输入代号:"));
save.add(代号文本框);
save.add(new Label("输入名称:"));
save.add(名称文本框);
save.add(new Label("输入库存:"));
save.add(库存文本框);
save.add(new Label("输入单价:"));
save.add(单价文本框);
save.add(new Label("单击添加:"));
save.add(b_add);
save.add(new Label("单击修改:"));
save.add(b_xiu);
save.add(new Label("输入查询代号:"));
save.add(查询文本框);
save.add(new Label("单击查询:"));
save.add(b_xun);
JPanel del=new JPanel();
del.setLayout(new GridLayout(2,2));
del.add(new Label("输入删除的代号:"));
del.add(删除文本框);
del.add(new Label("单击删除:"));
del.add(b_del);
JPanel show=new JPanel();
show.setLayout(new BorderLayout());
show.add(pane,BorderLayout.CENTER);
show.add(b_show,BorderLayout.SOUTH);
JSplitPane split_one,split_two;
split_one=new JSplitPane(JSplitPane.VERTICAL_SPLIT,save,del);
split_two=new
JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,split_one,show);
con.add(split_two,BorderLayout.CENTER);
JPanel xun=new JPanel();
xun.add(new Label("所得信息:"));
xun.add(查询信息文本框);
xun.setLayout(new GridLayout(2,1));
con.add(xun,BorderLayout.SOUTH);
b_add.addActionListener(this);
b_del.addActionListener(this);
b_xun.addActionListener(this);
b_xiu.addActionListener(this);
b_show.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{if(e.getSource()==b_add)
{String daihao=null,mingcheng=null;int kucun=0;float danjia=0.0f;
daihao=代号文本框.getText();mingcheng=名称文本框.getText();
kucun=Integer.parseInt(库存文本框.getText());
danjia=Float.valueOf(单价文本框.getText()).floatValue();
商品 goods=new 商品(daihao,mingcheng,kucun,danjia);
hashtable.put(daihao,goods);
try{FileOutputStream file=new FileOutputStream("goods.txt");
ObjectOutputStream out=new ObjectOutputStream(file);
out.writeObject(hashtable); out.close();
}
catch(IOException event){}
}
else if(e.getSource()==b_del)

推荐阅读