仓库管理系统实训报告_第1页
仓库管理系统实训报告_第2页
仓库管理系统实训报告_第3页
仓库管理系统实训报告_第4页
仓库管理系统实训报告_第5页
已阅读5页,还剩48页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

郑州轻工业学院实训报告实训名称:仓库管理系统姓名:院(系):专业班级:学号:指导教师:成绩:时间:任务书课题名称仓库管理系统设计目的1、提高自己编写代码的能力,理解整个工程的编写流程。2、熟悉仓库管理系统的工作原理,提高动手能力,提高分析问题和解决问题的能力。实验环境 1、操作系统为WindowsXP。 2、数据库管理系统为MYSQL标准版。 3、高级程序设计语言为JAVA开发环境。任务要求 1、通过需求分析和系统设计的模板,理解系统分析和设计报告。 2、理解数据库的定义和各数据处理流程。 5、实现应用程序的设计、编程、及模块间处理并针对具体课题问题提出解决方法。 6、对系统的各个模块进行集成和调试,进一步优化系统性能,改善系统用户界面。工作进度计划序号起止日期工作内容12011.07.06~2011.07.07理解系统开发文档,熟悉开发环境22011.07.07~2011.07.09基础模块面板设计32011.07.09~2011.07.10各模块间完成接口对接并联入数据库处理数据42011.07.10~2011.07.11系统调试验收及完成实训报告目录1系统简介 11.1需求说明 21.2系统说明 32系统设计 42.1思路 52.2框架 63功能模块的实现思路 73.1产品管理 53.2供应商管理 53.3产品视图 53.4系统管理 53.5显示当前时间 54系统设计结果 75实训感想 76附件 71系统简介1.1需求说明随着社会经济的迅速发展和科学技术的全面进步,计算机事业的飞速发展,以计算机与通信技术为基础的信息系统正处于蓬勃发展的时期。随着经济文化水平的显著提高,人们对生活质量及工作环境的要求也越来越高。如何通过计算机为我们完成更多的事情,进而达到办公自动化和优化日常工作的目的,也就成了一个大众化课题。仓库管理是与我们日常生活息息相关的问题。大到公司、超市的仓库管理,小到图书馆的藏书管理,都可以认为是各种各样的仓库管理需求。随着我国改革开放的不断深入,经济飞速发展,企业要想生存、发展,要想在激烈的市场竞争中立于不败之地,没有现代化的管理是万万不行的,仓库管理的全面自动化、信息化则是其中极其重要的部分。为了加快仓库管理自动化的步伐,提高仓库的管理业务处理效率,建立仓库管理系统,尽可能地减少仓库管理的重复性和低效性,一边的十分重要。通过对部分超市仓库管理进行调研、分析开发本系统的目的在于代替手工管理、统计报表等工作,具体要求包括添加、修改和删除供应商,添加、修改和删除商品,进货单,销售单,商品信息管理,供应商查询,操作员管理,更改密码等。1.2系统说明整体界面美观,有清晰的层次感,布局简洁合理,同时保证后台的管理页面和前台的服务保持。系统采用大型数据库系统,能够满足五年以内的数据增长需求,并且保证大容量数据库的可操作性。由于各业务的数据量非常大,并且数据记录的增长速度非常快,需要有高性能服务器的支撑,并设计出合理的数据库结构和查询算法,以保证查询的响应速度,且响应速度不随记录数的增长急速下降。一般情况下,信息栏查询响应不超过三秒,并发五十个用户数下信息栏目查询响应不超过五秒。应用系统保证稳定、可靠、实用满足业务处理流程的要求,人机界面友好,输入输出方便!2系统设计2.1思路产品管理:由于本公司所需产品众多,靠传统的手工管理方式很不方便,需要一个信息系统进行管理。目前,产品的信息有产品编号,名称,价格,库存量,类别等。每个产品对应一个供应商,供应商的信息有供应商编号,名称,城市等。产品通过供应商编号得知该产品由哪个供应商提供,用户可以添加产品、删除产品、产品进货、产品出货。供应商管理:供应商的信息有供应商编号,名称,城市等,用户可以添加供应商、删除供应商、修改供应商。产品视图:用户可以根据条件查询产品、导出查询结果集、导入文件数据。系统管理:提供密码修改功能,提供系统参数设置功能,如界面风格改变成Windows风格,背景颜色,背景画面,字体等设定。显示当前时间:这个功能不需提供菜单,在主界面的右下角(也可以是其它位置),利用多线程技术,提供一个时钟的功能。时钟以字符串形式实时显示当前时间,即体现时、分、秒的变化。2.2框架登入管理登入管理系统管理进货出货管理视图查询基本管理系统管理进货出货管理视图查询基本管理修改密码操作员管理供应商信息查询商品信息查询销售单进货单商品信息管理供应商信息管理修改密码操作员管理供应商信息查询商品信息查询销售单进货单商品信息管理供应商信息管理3功能模块的实现思路3.1产品管理publicAddProductPanel(){setLayout(newGridBagLayout());setBounds(10,10,600,400);setupComponent(newJLabel("Id"),0,0,1,1,false);this.fieldProductId=newJTextField();this.fieldProductId.addKeyListener(newInputKeyListener());setupComponent(this.fieldProductId,1,0,3,1,true);setupComponent(newJLabel("名称:"),0,1,1,1,false);this.fieldProductName=newJTextField();setupComponent(this.fieldProductName,1,1,3,10,true);setupComponent(newJLabel("价格:"),0,2,1,1,false);this.fieldPrice=newJTextField();this.fieldPrice.addKeyListener(newInputKeyListener());setupComponent(this.fieldPrice,1,2,3,350,true);setupComponent(newJLabel("种类:"),0,3,1,1,false);this.fieldType=newJTextField();setupComponent(this.fieldType,1,3,3,350,true);setupComponent(newJLabel("数量:"),0,4,1,1,false);this.fieldQuantity=newJTextField();this.fieldQuantity.addKeyListener(newInputKeyListener());setupComponent(this.fieldQuantity,1,4,3,1,true);setupComponent(newJLabel("供应商:"),0,5,1,1,false);this.box=newJComboBox();this.box.setMaximumRowCount(5);setupComponent(this.box,1,5,3,1,true);ductHandler=newProductDao();this.mapSuppliers=ductHandler.getSuppliers();SetsetKey=this.mapSuppliers.keySet();Iteratorit=setKey.iterator();while(it.hasNext()){Stringname=(String)it.next();this.box.addItem(name);}JButtonbuttonOk=newJButton("添加");setupComponent(buttonOk,1,6,1,1,false);ProductListenerproductListener=newProductListener();buttonOk.addActionListener(productListener);GridBagConstraintsgridBagConstraints_20=newGridBagConstraints();gridBagConstraints_20.weighty=1.0D;gridBagConstraints_20.insets=newInsets(0,65,0,15);gridBagConstraints_20.gridy=8;gridBagConstraints_20.gridx=1;this.resetButton=newJButton("重置");setupComponent(this.resetButton,3,6,1,1,false);this.resetButton.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){AddProductPanel.this.fieldProductId.setText("");AddProductPanel.this.fieldProductName.setText("");AddProductPanel.this.fieldPrice.setText("");AddProductPanel.this.fieldType.setText("");AddProductPanel.this.fieldQuantity.setText("");}});}建立产品管理界面,从而可以实现人机交互。publicclassProductListenerimplementsActionListener{publicProductListener(){}publicvoidactionPerformed(ActionEvente){SupplierDaosupplierHandler=newSupplierDao();booleanflagZero=supplierHandler.isExistSupplierData();if(!flagZero){JOptionPane.showMessageDialog(null,"没有相应的供应商","结果",2);return;}if("".equals(AddProductPanel.this.fieldProductId.getText().trim()))AddProductPanel.this.flagProId=false;else{AddProductPanel.this.flagProId=true;}if("".equals(AddProductPanel.this.fieldProductName.getText().trim()))AddProductPanel.this.flagProName=false;else{AddProductPanel.this.flagProName=true;}if("".equals(AddProductPanel.this.fieldPrice.getText().trim()))AddProductPanel.this.flagProPrice=false;else{AddProductPanel.this.flagProPrice=true;}if("".equals(AddProductPanel.this.fieldType.getText().trim()))AddProductPanel.this.flagProType=false;else{AddProductPanel.this.flagProType=true;}if("".equals(AddProductPanel.this.fieldQuantity.getText().trim()))AddProductPanel.this.flagProQuantity=false;else{AddProductPanel.this.flagProQuantity=true;}if((AddProductPanel.this.flagProId)&&(AddProductPanel.this.flagProName)&&(AddProductPanel.this.flagProPrice)&&(AddProductPanel.this.flagProType)&&(AddProductPanel.this.flagProQuantity)){if(!AddProductPanel.this.fieldProductId.getText().trim().matches("\\d*")){JOptionPane.showMessageDialog(null,"请输入正确的id!","结果",2);AddProductPanel.this.fieldProductId.setText("");}elseif(AddProductPductHandler.isExistProductById(Integer.parseInt(AddProductPanel.this.fieldProductId.getText()))){JOptionPane.showMessageDialog(null,"No."+AddProductPanel.this.fieldProductId.getText()+"商品id已经存在","结果",2);AddProductPanel.this.fieldProductId.setText("");}elseif(!AddProductPanel.this.fieldPrice.getText().trim().matches("\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"请输入正确的价格","结果",2);AddProductPanel.this.fieldPrice.setText("");}elseif(!AddProductPanel.this.fieldQuantity.getText().trim().matches("[-]?\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"请输入正确的数量","结果",2);AddProductPanel.this.fieldQuantity.setText("");}elseif(!AddProductPanel.this.fieldQuantity.getText().trim().matches("\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"请输入正确的数量","结果",2);AddProductPanel.this.fieldQuantity.setText("");}else{StringstrId=AddProductPanel.this.fieldProductId.getText();StringstrName=AddProductPanel.this.fieldProductName.getText();StringstrPrice=AddProductPanel.this.fieldPrice.getText();StringstrType=AddProductPanel.this.fieldType.getText();Stringstrqutity=AddProductPanel.this.fieldQuantity.getText();StringstrSupName=(String)AddProductPanel.this.box.getSelectedItem();intintId=Integer.parseInt(strId);floatfltPrice=Float.parseFloat(strPrice);floatfltqutity=Float.parseFloat(strqutity);intintSupid=((Integer)AddProductPanel.this.mapSuppliers.get(strSupName)).intValue();ProductDatap=newProductData(intId,strName,fltPrice,strType,fltqutity,intSupid);booleanflag=AddProductPductHandler.addProduct(p);JOptionPane.showMessageDialog(AddProductPanel.this,"添加商品成功","添加商品",1);AddProductPanel.this.resetButton.doClick();}}elseJOptionPane.showMessageDialog(AddProductPanel.this,"请填写所有信息","结果",2);}}}制作添加商品信息面板并通过数据库添加商品信息publicModifyProductPanel()//构造方法{setLayout(newGridBagLayout());setBounds(10,10,600,350);setupComponent(newJLabel("商品id:"),0,0,1,1,true);boProdBox=newJComboBox();setupComponent(boProdBox,1,0,3,1,true);addItemToBox();//执行一个加载数据库相应数据的方法-->和数据库进行交互ComboBoxListenercomboBoxListener=newComboBoxListener();boProdBox.addActionListener(comboBoxListener);//如果组合框可编辑,则在编辑停止时将触发ActionEventsetupComponent(newJLabel("名称:"),0,1,1,1,false);this.labelProNameView=newJTextField();this.labelProNameView.setEditable(false);setupComponent(this.labelProNameView,1,1,3,10,true);setupComponent(newJLabel("价格:"),0,2,1,1,false);this.labelProPriceView=newJTextField();this.labelProPriceView.setEditable(false);//开始时,设置JTextField为不可编辑setupComponent(this.labelProPriceView,1,2,3,350,true);setupComponent(newJLabel("种类:"),0,3,1,1,false);this.labelProTypeView=newJTextField();this.labelProTypeView.setEditable(false);setupComponent(this.labelProTypeView,1,3,3,350,true);setupComponent(newJLabel("数量:"),0,4,1,1,false);this.labelProQuentityView=newJTextField();this.labelProQuentityView.setEditable(false);setupComponent(this.labelProQuentityView,1,4,3,1,true);setupComponent(newJLabel("供应商:"),0,5,1,1,false);this.box=newJComboBox();this.box.setEditable(false);this.box.setEnabled(false);setupComponent(this.box,1,5,3,1,true);//以下为四个Button的设置this.modifycheckButton=newJButton("核实");//核实按钮-->actionthis.modifycheckButton.setEnabled(false);setupComponent(this.modifycheckButton,1,6,1,1,false);checkModifyActionListenercheckModifyActionListener=newcheckModifyActionListener();this.modifycheckButton.addActionListener(checkModifyActionListener);this.resetButton=newJButton("重置");setupComponent(this.resetButton,2,6,1,1,false);this.resetButton.setEnabled(false);ResetmodifyActionListenerresetmodifyActionListener=newResetmodifyActionListener();this.resetButton.addActionListener(resetmodifyActionListener);this.modifyButton=newJButton("修改");setupComponent(this.modifyButton,1,7,1,1,false);this.modifyButton.setEnabled(false);ModifyActionListenermodifyActionListener=newModifyActionListener();//修改按钮-->actionthis.modifyButton.addActionListener(modifyActionListener);this.removeButton=newJButton("删除");//删除按钮-->actionsetupComponent(this.removeButton,2,7,1,1,false);this.removeButton.setEnabled(false);RemoveActionlistenerremoveActionlistener=newRemoveActionlistener();this.removeButton.addActionListener(removeActionlistener);setVisible(true);}制作修改与删除商品信息面板privatevoidsetupComponent(JComponentcomponent,intgridx,intgridy,intgridwidth,intipadx,booleanfill){GridBagConstraintsgridBagConstrains=newGridBagConstraints();gridBagConstrains.gridx=gridx;gridBagConstrains.gridy=gridy;gridBagConstrains.insets=newInsets(5,1,3,1);if(gridwidth>1)gridBagConstrains.gridwidth=gridwidth;if(ipadx>0)gridBagConstrains.ipadx=ipadx;if(fill)gridBagConstrains.fill=2;add(component,gridBagConstrains);}publicvoidaddItemToBox(){boProdBox.removeAllItems();boProdBox.addItem("请选择");ductHandler=newProductDao();ListlistAllProd=ductHandler.getFindAllProductId();Iteratorit=listAllProd.iterator();while(it.hasNext())boProdBox.addItem(it.next());}publicclassComboBoxListenerimplementsActionListener{publicComboBoxListener(){}publicvoidactionPerformed(ActionEvente){if(ModifyProductPboProdBox.getSelectedIndex()==0){ModifyProductPanel.this.modifycheckButton.setEnabled(false);ModifyProductPanel.this.labelProNameView.setText("");ModifyProductPanel.this.labelProPriceView.setText("");ModifyProductPanel.this.labelProTypeView.setText("");ModifyProductPanel.this.labelProQuentityView.setText("");ModifyProductPanel.this.box.removeAllItems();ModifyProductPanel.this.box.setEnabled(false);ModifyProductPanel.this.resetButton.setEnabled(false);ModifyProductPanel.this.removeButton.setEnabled(false);ModifyProductPanel.this.modifyButton.setEnabled(false);ModifyProductPanel.this.labelProNameView.setEditable(false);ModifyProductPanel.this.labelProPriceView.setEditable(false);ModifyProductPanel.this.labelProTypeView.setEditable(false);ModifyProductPanel.this.labelProQuentityView.setEditable(false);}else{ModifyProductPanel.this.box.removeAllItems();ModifyProductPanel.this.box.setEnabled(false);ModifyProductPanel.this.modifycheckButton.setEnabled(true);ModifyProductPanel.this.labelProNameView.setText("");ModifyProductPanel.this.labelProPriceView.setText("");ModifyProductPanel.this.labelProTypeView.setText("");ModifyProductPanel.this.labelProQuentityView.setText("");ModifyProductPanel.this.labelProNameView.setEditable(false);ModifyProductPanel.this.labelProPriceView.setEditable(false);ModifyProductPanel.this.labelProTypeView.setEditable(false);ModifyProductPanel.this.labelProQuentityView.setEditable(false);ModifyProductPanel.this.resetButton.setEnabled(false);ModifyProductPanel.this.removeButton.setEnabled(false);ModifyProductPanel.this.modifyButton.setEnabled(false);}}}publicclassModifyActionListenerimplementsActionListener{publicModifyActionListener(){}publicvoidactionPerformed(ActionEvente){SupplierDaosupplierHandler=newSupplierDao();booleanflagZero=supplierHandler.isExistSupplierData();if(!flagZero){JOptionPane.showMessageDialog(null,"没有相应的供应商","结果",2);return;}if((ModifyProductPanel.this.labelProNameView.getText().equals(""))||(ModifyProductPanel.this.labelProPriceView.getText().equals(""))||(ModifyProductPanel.this.labelProTypeView.getText().equals(""))||(ModifyProductPanel.this.labelProQuentityView.getText().equals(""))){JOptionPane.showMessageDialog(ModifyProductPanel.this,"请输入所有信息","结果",2);return;}if(!ModifyProductPanel.this.labelProPriceView.getText().trim().matches("\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"请输入正确的价格","结果",2);ModifyProductPanel.this.labelProPriceView.setText("");return;}if(!ModifyProductPanel.this.labelProQuentityView.getText().trim().matches("[-]?\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"请输入正确的数量","结果",2);ModifyProductPanel.this.labelProQuentityView.setText("");return;}if(!ModifyProductPanel.this.labelProQuentityView.getText().trim().matches("\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"请输入正确的数量","结果",2);ModifyProductPanel.this.labelProQuentityView.setText("");return;}StringstrProId=String.valueOf(ModifyProductPboProdBox.getSelectedItem());ModifyProductPductHandler=newProductDao();ProductDataproductData=ModifyProductPductHandler.getProductByNumber(Integer.parseInt(strProId));productData.setPodName(ModifyProductPanel.this.labelProNameView.getText());productData.setPrice(Float.parseFloat(ModifyProductPanel.this.labelProPriceView.getText()));productData.setType(ModifyProductPanel.this.labelProTypeView.getText());SupplierDatasupplier=supplierHandler.getSupplierbySupplierName(String.valueOf(ModifyProductPanel.this.box.getSelectedItem()));//System.out.println(String.valueOf(ModifyProductPanel.this.box.getSelectedItem()));///////////////////////////////System.out.println(supplier);productData.setSupId(supplier.getSupplierId());/////////////////////////////ModifyProductPductHandler.updateProductById(productData);//执行更新操作JOptionPane.showMessageDialog(ModifyProductPanel.this,"修改商品成功","结果",1);ModifyProductPanel.this.resetButton.doClick();}}通过与数据库交互实现商品修改功能publicclassRemoveActionlistenerimplementsActionListener{publicRemoveActionlistener(){}publicvoidactionPerformed(ActionEvente){ModifyProductPductHandler=newProductDao();StringstrProOkId=String.valueOf(ModifyProductPboProdBox.getSelectedItem());intintProOkId=Integer.parseInt(strProOkId);floatfloatProQuentity=ModifyProductPductHandler.getProductByNumber(intProOkId).getQuantity();if(floatProQuentity>0.0F){JOptionPane.showMessageDialog(null,"仓库中还有该商品的库存,不能删除","结果",1);ModifyProductPanel.this.resetButton.doClick();}else{ModifyProductPductHandler.deleteProductById(intProOkId);JOptionPane.showMessageDialog(null,"删除成功","结果",1);ModifyProductPanel.this.resetButton.doClick();}}}通过与数据库交互实现商品删除功能3.2供应商管理publicclassSupplierManagePanelextendsJInternalFrame{privatestaticfinallongserialVersionUID=1L;publicSupplierManagePanel(){setIconifiable(true);setClosable(true);setTitle("供应商管理");JTabbedPanetabPane=newJTabbedPane();AddSupplierPaneladdSupplierPanel=newAddSupplierPanel();ModifySupplierPanelmodifySupplierPanel=newModifySupplierPanel();tabPane.addTab("添加供应商",null,addSupplierPanel,"添加供应商");tabPane.addTab("修改与删除供应商",null,modifySupplierPanel,"修改与删除供应商");getContentPane().add(tabPane);pack();setVisible(true);}}制作供应商管理面板publicAddSupplierPanel(){setLayout(null);setBounds(10,10,600,350);this.addPanel=newJPanel();this.addPanel.setLayout(null);this.addPanel.setBounds(40,30,520,260);this.addPanel.setBorder(BorderFactory.createTitledBorder("添加供应商信息"));JLabellblId=newJLabel("Id:");lblId.setBounds(20,20,100,30);this.addSupplierId=newJTextField();this.addSupplierId.setBounds(100,20,160,20);this.addSupplierId.addKeyListener(newInputKeyListener());JLabellblCode=newJLabel("邮编:");lblCode.setBounds(270,20,100,30);this.addSupplierPostcode=newJTextField();this.addSupplierPostcode.setBounds(340,20,160,20);this.addSupplierPostcode.addKeyListener(newInputKeyListener());JLabellblSupName=newJLabel("名称:");lblSupName.setBounds(20,50,100,30);this.addSupplierName=newJTextField();this.addSupplierName.setBounds(100,50,400,20);JLabellblAddress=newJLabel("地址:");lblAddress.setBounds(20,80,100,30);this.addSupplierAddress=newJTextField();this.addSupplierAddress.setBounds(100,80,400,20);JLabellblTel=newJLabel("电话:");lblTel.setBounds(20,110,100,30);this.addSupplierTelephone=newJTextField();this.addSupplierTelephone.setBounds(100,110,160,20);this.addSupplierTelephone.addKeyListener(newInputKeyListener());JLabellblFax=newJLabel("传真:");lblFax.setBounds(270,110,100,30);this.addSupplierFax=newJTextField();this.addSupplierFax.setBounds(340,110,160,20);this.addSupplierFax.addKeyListener(newInputKeyListener());JLabellblConnec=newJLabel("联系人:");lblConnec.setBounds(20,140,100,30);this.addSupplierRelationer=newJTextField();this.addSupplierRelationer.setBounds(100,140,160,20);JLabellblEmail=newJLabel("E-Mail:");lblEmail.setBounds(270,140,100,30);this.addSupplierEmail=newJTextField();this.addSupplierEmail.setBounds(340,140,160,20);JButtonaddSupplierButton=newJButton("添加");addSupplierButton.setBounds(100,200,100,20);addSupplierButton.addActionListener(newAddSupplierActionListener());this.resetButton=newJButton("重置");this.resetButton.setBounds(270,200,100,20);this.resetButton.addActionListener(newResetActionListener());this.addPanel.add(lblId);this.addPanel.add(this.addSupplierId);this.addPanel.add(lblCode);this.addPanel.add(this.addSupplierPostcode);this.addPanel.add(lblSupName);this.addPanel.add(this.addSupplierName);this.addPanel.add(lblAddress);this.addPanel.add(this.addSupplierAddress);this.addPanel.add(lblTel);this.addPanel.add(this.addSupplierTelephone);this.addPanel.add(lblFax);this.addPanel.add(this.addSupplierFax);this.addPanel.add(lblConnec);this.addPanel.add(this.addSupplierRelationer);this.addPanel.add(lblEmail);this.addPanel.add(this.addSupplierEmail);this.addPanel.add(addSupplierButton);this.addPanel.add(this.resetButton);add(this.addPanel);setVisible(true);}classAddSupplierActionListenerimplementsActionListener{AddSupplierActionListener(){}publicvoidactionPerformed(ActionEvente){if((AddSupplierPanel.this.addSupplierId.getText().equals(""))||(AddSupplierPanel.this.addSupplierPostcode.getText().equals(""))||(AddSupplierPanel.this.addSupplierName.getText().equals(""))||(AddSupplierPanel.this.addSupplierAddress.getText().equals(""))||(AddSupplierPanel.this.addSupplierTelephone.getText().equals(""))||(AddSupplierPanel.this.addSupplierFax.getText().equals(""))||(AddSupplierPanel.this.addSupplierRelationer.getText().equals(""))||(AddSupplierPanel.this.addSupplierEmail.getText().equals(""))){JOptionPane.showMessageDialog(AddSupplierPanel.this,"请输入所有信息","结果",2);return;}if(!AddSupplierPanel.this.addSupplierEmail.getText().matches("\\w+[@]\\w+\\.\\S+")){JOptionPane.showMessageDialog(AddSupplierPanel.this,"请核实您的E-mail地址","结果",2);return;}SupplierDaosupplierHandler=newSupplierDao();StringstrSupId=AddSupplierPanel.this.addSupplierId.getText();intintSupId=Integer.parseInt(strSupId);if(supplierHandler.isExistSupplierById(intSupId)){JOptionPane.showMessageDialog(AddSupplierPanel.this,"No."+intSupId+"供应商已经存在,请重新输入","Results!",2);AddSupplierPanel.this.resetButton.doClick();}else{StringstrSupplierPostcode=AddSupplierPanel.this.addSupplierPostcode.getText().trim();StringstrSupplierName=AddSupplierPanel.this.addSupplierName.getText().trim();StringstrSupplierAddress=AddSupplierPanel.this.addSupplierAddress.getText().trim();StringstrSupplierTelephone=AddSupplierPanel.this.addSupplierTelephone.getText().trim();StringstrSupplierFax=AddSupplierPanel.this.addSupplierFax.getText().trim();StringstrSupplierRelationer=AddSupplierPanel.this.addSupplierRelationer.getText().trim();StringstrSupplierEmail=AddSupplierPanel.this.addSupplierEmail.getText().trim();intSupId=Integer.parseInt(strSupId);SupplierDatas=newSupplierData(intSupId,strSupplierName,strSupplierAddress,strSupplierPostcode,strSupplierTelephone,strSupplierFax,strSupplierRelationer,strSupplierEmail);booleanflag=supplierHandler.addSupplier(s);if(flag){JOptionPane.showMessageDialog(AddSupplierPanel.this,"供应商成功添加,请继续添加","结果",1);AddSupplierPanel.this.resetButton.doClick();}else{JOptionPane.showMessageDialog(AddSupplierPanel.this,"系统错误!");}}}}制作添加供应商面板并通过与数据库交互实现添加供应商功能publicModifySupplierPanel(){setLayout(null);setBounds(10,10,600,350);this.removePanel=newJPanel();this.removePanel.setLayout(null);this.removePanel.setBounds(40,30,520,260);this.removePanel.setBorder(BorderFactory.createTitledBorder("修改与删除供应商信息"));JLabellblId=newJLabel("Id:");lblId.setBounds(20,20,100,30);boBox=newJComboBox();boBox.setBounds(100,20,160,20);addItemToBox();ComboBoxListenercomboBoxListener=newComboBoxListener();boBox.addActionListener(comboBoxListener);JLabellblCode=newJLabel("邮编:");lblCode.setBounds(270,20,100,30);this.modifySupplierPostcode=newJTextField();this.modifySupplierPostcode.setBounds(340,20,160,20);this.modifySupplierPostcode.setEditable(false);this.modifySupplierPostcode.addKeyListener(newInputKeyListener());JLabellblSupName=newJLabel("姓名:");lblSupName.setBounds(20,50,100,30);this.modifySupplierName=newJTextField();this.modifySupplierName.setBounds(100,50,400,20);this.modifySupplierName.setEditable(false);JLabellblAddress=newJLabel("地址:");lblAddress.setBounds(20,80,100,30);this.modifySupplierAddress=newJTextField();this.modifySupplierAddress.setBounds(100,80,400,20);this.modifySupplierAddress.setEditable(false);JLabellblTel=newJLabel("电话:");lblTel.setBounds(20,110,100,30);this.modifySupplierTelephone=newJTextField();this.modifySupplierTelephone.setBounds(100,110,160,20);this.modifySupplierTelephone.setEditable(false);this.modifySupplierTelephone.addKeyListener(newInputKeyListener());JLabellblFax=newJLabel("传真:");lblFax.setBounds(270,110,100,30);this.modifySupplierFax=newJTextField();this.modifySupplierFax.setBounds(340,110,160,

温馨提示

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

评论

0/150

提交评论