欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    超市商品管理系统源代码(共23页).docx

    • 资源ID:16790404       资源大小:22.18KB        全文页数:23页
    • 资源格式: DOCX        下载积分:20金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要20金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    超市商品管理系统源代码(共23页).docx

    精选优质文档-倾情为你奉上超市商品管理系统源代码 import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class sale2 extends JFrame implements ActionListener /销售界面private JPanel sM=new JPanel();/supermarket面板JLabel label1,label2;JTextField field1,field2;JButton button1,button2;String num=null,name=null,time=null,add=null,t1=null,t2=null,t3=null;int price=0,countBG,n1;/ 价格/商品的卖出数量private JTextArea goodsShow=new JTextArea();/文本区private JScrollPane jsp=new JScrollPane(goodsShow); /滚动区域 设定内容为 商品显示的文本区private JButton pS=new JButton("销售界面"),new JButton("销售管理"),new JButton("商品管理"),new JButton("用户管理");/personty 按钮private JLabel CD=new JLabel("清单号",JLabel.CENTER),new JLabel("编号",JLabel.CENTER),new JLabel("名称",JLabel.CENTER),new JLabel("价格",JLabel.CENTER),new JLabel("生产日期",JLabel.CENTER),new JLabel("产地",JLabel.CENTER),new JLabel("数量",JLabel.CENTER);/帐单查询时的商品显示标签public sale2()label1=new JLabel("按编号查询",JLabel.CENTER);label2=new JLabel("按帐单查询",JLabel.CENTER);field1=new JTextField(30);field2=new JTextField(30);button1=new JButton("查询1");button2=new JButton("查询2");sM.setLayout(null);field1.setBounds(100,120,150,22);field2.setBounds(600,120,150,22);label1.setBounds(100,90,150,30);label2.setBounds(600,90,150,30);button1.setBounds(260,120,80,22);button2.setBounds(760,120,80,22);button1.addActionListener(this);button2.addActionListener(this);sM.add(label1);sM.add(label2);sM.add(field1);sM.add(field2);sM.add(button1);sM.add(button2);for(int i=0;i<4;i+)pSi.setBounds(550+i*110,50,100,22);sM.add(pSi);pSi.addActionListener(this);for(int i=0;i<7;i+)/6个标签的绘制CDi.setBounds(100+i*115,160,115,20);sM.add(CDi);jsp.setBounds(100,180,800,500);goodsShow.setLineWrap(true);addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) System.exit(0););sM.add(jsp);this.add(sM);this.setTitle("销售窗口");this.setResizable(false);this.setBounds(0,0,1024,768);this.setVisible(true);public void actionPerformed(ActionEvent p)Connection con,con1;Statement sql,sql1;String url = "jdbc:odbc:driver=Microsoft Access Driver (*.mdb);DBQ=D:supermarket.mdb"ResultSet rs,rs1;if (p.getSource()=button1)String num=field1.getText();try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");catch (ClassNotFoundException f)System.out.println(""+f);try con=DriverManager.getConnection(url);sql=con.createStatement();rs=sql.executeQuery("SELECT count(goodsnum) FROM information where goodsnum='"+num+"'");while(rs.next()countBG=rs.getInt(1);System.out.println(countBG);rs=sql.executeQuery("SELECT * FROM goods where num='"+num+"'");while(rs.next()name=rs.getString(2);price=rs.getInt(3);time=rs.getString(4);add=rs.getString(5);n1=1;con.close();catch (SQLException g)System.out.println(g);if (n1=1) goodsShow.append(" (物品销售量查询) "+num+" "+name+" "+price+" "+time+" "+add+" "+countBG+"n");n1=0;else /goodsShow.setText(" ");num=null;name=null;price=0;time=null;add=null;JOptionPane.showMessageDialog(this," 输入错误n 请重新输入","提示",JOptionPane.WARNING_MESSAGE);if(p.getSource()=pS0)View2 frame=new View2();dispose();if(p.getSource()=pS2)Frm_Main frame=new Frm_Main();dispose();if(p.getSource()=pS3)View3 frame=new View3();dispose();if (p.getSource()=button2)String numb=field2.getText();int num=Integer.parseInt(numb);try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");catch (ClassNotFoundException f)System.out.println(""+f);trycon=DriverManager.getConnection(url);sql=con.createStatement();rs=sql.executeQuery("SELECT goodsnum,count(goodsnum) FROM information where listnum="+num+" group by goodsnum");while(rs.next() con1=DriverManager.getConnection(url);sql1=con1.createStatement();String number=rs.getString(1); countBG=rs.getInt(2);System.out.println(countBG+number+name+time+price+add);rs1=sql1.executeQuery("SELECT * FROM goods where num='"+number+"'");while (rs1.next()name=rs1.getString(2);price=rs1.getint(3);time=rs1.getString(4);add=rs1.getString(5);goodsShow.append(" "+num+" "+number+" "+name+" "+price+" "+time+" "+add+" "+countBG+"n"); con1.close();con.close();catch (SQLException g)System.out.println(g);/ goodsShow.setText(" ");/ num=null;name=null;price=0;time=null;add=null;/ JOptionPane.showMessageDialog(this," 输入错误n 请重新输入","提示",JOptionPane.WARNING_MESSAGE);/ public class View2 extends JFrame implements ActionListener /销售界面String num=null,name=null,time=null,add=null,t1=null,t2=null,t3=null;int price=0;int n1,n2,ap,n3;private JPanel sM=new JPanel(); /supermarket面板private JButton pS=new JButton("销售界面"),new JButton("销售管理"),new JButton("商品管理"),new JButton("权限管理");/personty 按钮private JTextArea goodsShow=new JTextArea(), searchShow=new JTextArea(); /文本区private JScrollPane jsp=new JScrollPane(goodsShow); /滚动区域 设定内容为 商品显示的文本区private JTextField numSearch=new JTextField(),showGoods=new JTextField(); /商品查询/显示商品private JButton searchGoods=new JButton("搜索"),buyGoods=new JButton("购买"), clean=new JButton("清空"), ok=new JButton("提交"),print=new JButton("打印并提交"); /查询按钮private JLabel goodsInformation=new JLabel("商品编码",JLabel.CENTER),new JLabel("商品名称",JLabel.CENTER),new JLabel("商品价格",JLabel.CENTER),new JLabel("生产日期",JLabel.CENTER),new JLabel("生产地",JLabel.CENTER) ;private JLabel goodsI=new JLabel("商品编码",JLabel.CENTER),new JLabel("商品名称",JLabel.CENTER),new JLabel("商品价格",JLabel.CENTER),new JLabel("生产日期",JLabel.CENTER),new JLabel("生产地",JLabel.CENTER) ; private JLabel allPrice=new JLabel("商品总价:n ",JLabel.LEFT),label1=new JLabel("商品信息 ",JLabel.RIGHT),label2=new JLabel("购物信息 ",JLabel.RIGHT);public View2()sM.setLayout(null);for(int i=0;i<4;i+)pSi.setBounds(550+i*110,50,100,22);sM.add(pSi);pSi.addActionListener(this);jsp.setBounds(100,180,800,500);goodsShow.setLineWrap(true);numSearch.setBounds(100,50,150,22);searchGoods.setBounds(260,50,60,22);searchGoods.addActionListener(this);buyGoods.setBounds(330,50,60,22);buyGoods.addActionListener(this);showGoods.setBounds(100,120,800,22);for (int b=0;b<5 ;b+ )goodsInformationb.setBounds(100+160*b,87,160,30);sM.add(goodsInformationb);for (int b=0;b<5 ;b+ )goodsIb.setBounds(100+160*b,150,160,30);sM.add(goodsIb);clean.setBounds(100,690,100,22);clean.addActionListener(this);ok.setBounds(690,690,100,22);ok.addActionListener(this);print.setBounds(800,690,100,22);print.addActionListener(this);allPrice.setBounds(900,480,100,50);label1.setBounds(20,120,80,22);label2.setBounds(20,180,80,22);sM.add(label1);sM.add(label2);sM.add(allPrice);sM.add(print);sM.add(ok);sM.add(showGoods);sM.add(clean);sM.add(numSearch );sM.add(searchGoods);sM.add(buyGoods);sM.add(jsp);addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) Connection con;Statement sql;ResultSet rs;tryif (n3!=0)int a1=0;con=DriverManager.getConnection("jdbc:odbc:q","","");sql=con.createStatement();rs=sql.executeQuery("SELECT MAX(编号) from information");while(rs.next()a1=rs.getInt(1);for (int i=0;i<n3 ;i+ )sql.executeUpdate("delete from information where 编号="+(a1-i);con.close();ap=0;num=null;name=null;price=0;time=null;add=null;n3=0;goodsShow.setText(null);catch (SQLException g)System.out.println(g);System.exit(0););this.add(sM);this.setTitle("销售窗口");this.setResizable(false);this.setBounds(0,0,1024,768);this.setVisible(true);validate();if(p.getSource()=buyGoods) /购买按键 tryif (num!=null)con=DriverManager.getConnection("jdbc:odbc:q","","");sql=con.createStatement();sql.executeUpdate("insert into information(listnum,goodsnum) values('"+n2+"','"+num+"')");rs=sql.executeQuery("SELECT * FROM information where listnum="+n2);n3+;/记录购买商品个数con.close();goodsShow.append(" "+num+" "+name+" "+price+" "+time+" "+add+"n"); elseJOptionPane.showMessageDialog(this,"请选择商品","提示",JOptionPane.WARNING_MESSAGE);ap=ap+price;/总价allPrice.setText("商品总价:n"+ap);catch (SQLException g)System.out.println(g);if(p.getSource()=ok)tryif (n3!=0)con=DriverManager.getConnection("jdbc:odbc:q","","");sql=con.createStatement();sql.executeUpdate("insert into information(listnum,allprice) values('"+n2+"','"+ap+"')");rs=sql.executeQuery("SELECT * FROM information where listnum="+n2);con.close();ap=0;num=null;name=null;price=0;time=null;add=null;n3=0;goodsShow.setText(null);n2+;/帐单号elseJOptionPane.showMessageDialog(this,"请购买商品","提示",JOptionPane.WARNING_MESSAGE);catch (SQLException g)System.out.println(g);if(p.getSource()=print)tryif (n3!=0)con=DriverManager.getConnection("jdbc:odbc:q","","");sql=con.createStatement();sql.executeUpdate("insert into information(listnum,allprice) values('"+n2+"','"+ap+"')");rs=sql.executeQuery("SELECT * FROM information where listnum="+n2);con.close();ap=0;num=null;name=null;price=0;time=null;add=null;n3=0;goodsShow.setText(null);n2+;/帐单号elseJOptionPane.showMessageDialog(this,"请购买商品","提示",JOptionPane.WARNING_MESSAGE);catch (SQLException g)System.out.println(g);if(p.getSource()=clean) try if (n3!=0) int a1=0;con=DriverManager.getConnection("jdbc:odbc:q","","");sql=con.createStatement();rs=sql.executeQuery("SELECT MAX(编号) from information");while(rs.next() a1=rs.getInt(1);for (int i=0;i<n3 ;i+ ) sql.executeUpdate("delete from information where 编号="+(a1-i); con.close();ap=0;num=null;name=null;price=0;time=null;add=null;n3=0;goodsShow.setText(null);catch (SQLException g)System.out.println(g); public class Login extends Frame implements ActionListener,WindowListener /登陆界面public int screanWidth,screanHeight;String idin=null;String keyin=null;String passwordD=null;public static String persontyD=null;MenuBar menubar;Menu menu;MenuItem quet,help;Label id,key;TextField idtf,keytf;Box boxV1,boxV2,boxV3,baseBox,boxx;Button enterB;Login() setTitle("超市管理系统登陆界面");Toolkit tool=getToolkit();Dimension dim=tool.getScreenSize();screanWidth=dim.width;screanHeight=dim.height;setBounds(dim.width/3,dim.height/3,320,215);menubar=new MenuBar();menu=new Menu("功能");help=new MenuItem("帮助");quet=new MenuItem("退出");quet.setShortcut(new MenuShortcut(KeyEvent.VK_E);quet.addActionListener(new ActionListener() /匿名类实例控制public void actionPerformed(ActionEvent p)System.exit(0); );menu.add(help);menu.add(quet);menubar.add(menu);setMenuBar(menubar);id=new Label("请输入帐号:",Label.RIGHT);key=new Label("请输入密码:",Label.RIGHT);idtf=new TextField(10);keytf=new TextField(10);keytf.setEchoChar('*');enterB=new Button("登陆");boxV1=Box.createVerticalBox();boxV1.add(Box.createVerticalStrut(35);boxV1.add(id);boxV1.add(Box.createVerticalStrut(15);boxV1.add(key);boxV1.add(Box.createVerticalStrut(15);boxV2=Box.createVerticalBox();boxV2.add(Box.createVerticalStrut(35);boxV2.add(idtf);boxV2.add(Box.createVerticalStrut(15);boxV2.add(keytf);boxV2.add(Box.createVerticalStrut(15);baseBox=Box.createHorizontalBox();baseBox.add(Box.createHorizontalStrut(25);baseBox.add(boxV1);baseBox.add(Box.createHorizontalStrut(5);baseBox.add(boxV2);baseBox.add(Box.createHorizontalStrut(70);boxV3=Box.createHorizontalBox();boxV3.add(Box.createHorizontalStrut(125);boxV3.add(enterB);boxV3.add(Box.createHorizontalStrut(125);boxx=Box.createVerticalBox();boxx.add(baseBox);boxx.add(Box .createVerticalStrut(15);boxx.add(boxV3);boxx.add(Box.createVerticalStrut(70);add(boxx);enterB.addActionListener(this);addWindowListener(this);setResizable(false);setVisible(true);public void actionPerformed(ActionEvent e)Connection con;Statement sql;ResultSet rs;if (e.getSource()=enterB)idin=idtf.getText();keyin=keytf.getText();try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");catch (ClassNotFoundException f)System.out.println(""+f);trycon=DriverManager.getConnection("jdbc:odbc:q","","");sql=con.createStatement();rs=sql.executeQuery("SELECT * FROM pass

    注意事项

    本文(超市商品管理系统源代码(共23页).docx)为本站会员(飞****2)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

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

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开