倉庫管理系統(tǒng)實(shí)訓(xùn)報(bào)告_第1頁
倉庫管理系統(tǒng)實(shí)訓(xùn)報(bào)告_第2頁
倉庫管理系統(tǒng)實(shí)訓(xùn)報(bào)告_第3頁
倉庫管理系統(tǒng)實(shí)訓(xùn)報(bào)告_第4頁
倉庫管理系統(tǒng)實(shí)訓(xùn)報(bào)告_第5頁
已閱讀5頁,還剩48頁未讀, 繼續(xù)免費(fèi)閱讀

付費(fèi)下載

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

鄭州輕工業(yè)學(xué)院實(shí)訓(xùn)報(bào)告實(shí)訓(xùn)名稱:倉庫管理系統(tǒng)姓名:院(系):專業(yè)班級:學(xué)號:指導(dǎo)教師:成績:時(shí)間:任務(wù)書課題名稱倉庫管理系統(tǒng)設(shè)計(jì)目的1、提高自己編寫代碼的能力,理解整個(gè)工程的編寫流程。2、熟悉倉庫管理系統(tǒng)的工作原理,提高動(dòng)手能力,提高分析問題和解決問題的能力。實(shí)驗(yàn)環(huán)境 1、操作系統(tǒng)為WindowsXP。 2、數(shù)據(jù)庫管理系統(tǒng)為MYSQL標(biāo)準(zhǔn)版。 3、高級程序設(shè)計(jì)語言為JAVA開發(fā)環(huán)境。任務(wù)要求 1、通過需求分析和系統(tǒng)設(shè)計(jì)的模板,理解系統(tǒng)分析和設(shè)計(jì)報(bào)告。 2、理解數(shù)據(jù)庫的定義和各數(shù)據(jù)處理流程。 5、實(shí)現(xiàn)應(yīng)用程序的設(shè)計(jì)、編程、及模塊間處理并針對具體課題問題提出解決方法。 6、對系統(tǒng)的各個(gè)模塊進(jìn)行集成和調(diào)試,進(jìn)一步優(yōu)化系統(tǒng)性能,改善系統(tǒng)用戶界面。工作進(jìn)度計(jì)劃序號起止日期工作內(nèi)容12011.07.06~2011.07.07理解系統(tǒng)開發(fā)文檔,熟悉開發(fā)環(huán)境22011.07.07~2011.07.09基礎(chǔ)模塊面板設(shè)計(jì)32011.07.09~2011.07.10各模塊間完成接口對接并聯(lián)入數(shù)據(jù)庫處理數(shù)據(jù)42011.07.10~2011.07.11系統(tǒng)調(diào)試驗(yàn)收及完成實(shí)訓(xùn)報(bào)告目錄1系統(tǒng)簡介 11.1需求說明 21.2系統(tǒng)說明 32系統(tǒng)設(shè)計(jì) 42.1思路 52.2框架 63功能模塊的實(shí)現(xiàn)思路 73.1產(chǎn)品管理 53.2供應(yīng)商管理 53.3產(chǎn)品視圖 53.4系統(tǒng)管理 53.5顯示當(dāng)前時(shí)間 54系統(tǒng)設(shè)計(jì)結(jié)果 75實(shí)訓(xùn)感想 76附件 71系統(tǒng)簡介1.1需求說明隨著社會(huì)經(jīng)濟(jì)的迅速發(fā)展和科學(xué)技術(shù)的全面進(jìn)步,計(jì)算機(jī)事業(yè)的飛速發(fā)展,以計(jì)算機(jī)與通信技術(shù)為基礎(chǔ)的信息系統(tǒng)正處于蓬勃發(fā)展的時(shí)期。隨著經(jīng)濟(jì)文化水平的顯著提高,人們對生活質(zhì)量及工作環(huán)境的要求也越來越高。如何通過計(jì)算機(jī)為我們完成更多的事情,進(jìn)而達(dá)到辦公自動(dòng)化和優(yōu)化日常工作的目的,也就成了一個(gè)大眾化課題。倉庫管理是與我們?nèi)粘I钕⑾⑾嚓P(guān)的問題。大到公司、超市的倉庫管理,小到圖書館的藏書管理,都可以認(rèn)為是各種各樣的倉庫管理需求。隨著我國改革開放的不斷深入,經(jīng)濟(jì)飛速發(fā)展,企業(yè)要想生存、發(fā)展,要想在激烈的市場競爭中立于不敗之地,沒有現(xiàn)代化的管理是萬萬不行的,倉庫管理的全面自動(dòng)化、信息化則是其中極其重要的部分。為了加快倉庫管理自動(dòng)化的步伐,提高倉庫的管理業(yè)務(wù)處理效率,建立倉庫管理系統(tǒng),盡可能地減少倉庫管理的重復(fù)性和低效性,一邊的十分重要。通過對部分超市倉庫管理進(jìn)行調(diào)研、分析開發(fā)本系統(tǒng)的目的在于代替手工管理、統(tǒng)計(jì)報(bào)表等工作,具體要求包括添加、修改和刪除供應(yīng)商,添加、修改和刪除商品,進(jìn)貨單,銷售單,商品信息管理,供應(yīng)商查詢,操作員管理,更改密碼等。1.2系統(tǒng)說明整體界面美觀,有清晰的層次感,布局簡潔合理,同時(shí)保證后臺(tái)的管理頁面和前臺(tái)的服務(wù)保持。系統(tǒng)采用大型數(shù)據(jù)庫系統(tǒng),能夠滿足五年以內(nèi)的數(shù)據(jù)增長需求,并且保證大容量數(shù)據(jù)庫的可操作性。由于各業(yè)務(wù)的數(shù)據(jù)量非常大,并且數(shù)據(jù)記錄的增長速度非???,需要有高性能服務(wù)器的支撐,并設(shè)計(jì)出合理的數(shù)據(jù)庫結(jié)構(gòu)和查詢算法,以保證查詢的響應(yīng)速度,且響應(yīng)速度不隨記錄數(shù)的增長急速下降。一般情況下,信息欄查詢響應(yīng)不超過三秒,并發(fā)五十個(gè)用戶數(shù)下信息欄目查詢響應(yīng)不超過五秒。應(yīng)用系統(tǒng)保證穩(wěn)定、可靠、實(shí)用滿足業(yè)務(wù)處理流程的要求,人機(jī)界面友好,輸入輸出方便!2系統(tǒng)設(shè)計(jì)2.1思路產(chǎn)品管理:由于本公司所需產(chǎn)品眾多,靠傳統(tǒng)的手工管理方式很不方便,需要一個(gè)信息系統(tǒng)進(jìn)行管理。目前,產(chǎn)品的信息有產(chǎn)品編號,名稱,價(jià)格,庫存量,類別等。每個(gè)產(chǎn)品對應(yīng)一個(gè)供應(yīng)商,供應(yīng)商的信息有供應(yīng)商編號,名稱,城市等。產(chǎn)品通過供應(yīng)商編號得知該產(chǎn)品由哪個(gè)供應(yīng)商提供,用戶可以添加產(chǎn)品、刪除產(chǎn)品、產(chǎn)品進(jìn)貨、產(chǎn)品出貨。供應(yīng)商管理:供應(yīng)商的信息有供應(yīng)商編號,名稱,城市等,用戶可以添加供應(yīng)商、刪除供應(yīng)商、修改供應(yīng)商。產(chǎn)品視圖:用戶可以根據(jù)條件查詢產(chǎn)品、導(dǎo)出查詢結(jié)果集、導(dǎo)入文件數(shù)據(jù)。系統(tǒng)管理:提供密碼修改功能,提供系統(tǒng)參數(shù)設(shè)置功能,如界面風(fēng)格改變成Windows風(fēng)格,背景顏色,背景畫面,字體等設(shè)定。顯示當(dāng)前時(shí)間:這個(gè)功能不需提供菜單,在主界面的右下角(也可以是其它位置),利用多線程技術(shù),提供一個(gè)時(shí)鐘的功能。時(shí)鐘以字符串形式實(shí)時(shí)顯示當(dāng)前時(shí)間,即體現(xiàn)時(shí)、分、秒的變化。2.2框架登入管理登入管理系統(tǒng)管理進(jìn)貨出貨管理視圖查詢基本管理系統(tǒng)管理進(jìn)貨出貨管理視圖查詢基本管理修改密碼操作員管理供應(yīng)商信息查詢商品信息查詢銷售單進(jìn)貨單商品信息管理供應(yīng)商信息管理修改密碼操作員管理供應(yīng)商信息查詢商品信息查詢銷售單進(jìn)貨單商品信息管理供應(yīng)商信息管理3功能模塊的實(shí)現(xiàn)思路3.1產(chǎn)品管理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("價(jià)格:"),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("數(shù)量:"),0,4,1,1,false);this.fieldQuantity=newJTextField();this.fieldQuantity.addKeyListener(newInputKeyListener());setupComponent(this.fieldQuantity,1,4,3,1,true);setupComponent(newJLabel("供應(yīng)商:"),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("");}});}建立產(chǎn)品管理界面,從而可以實(shí)現(xiàn)人機(jī)交互。publicclassProductListenerimplementsActionListener{publicProductListener(){}publicvoidactionPerformed(ActionEvente){SupplierDaosupplierHandler=newSupplierDao();booleanflagZero=supplierHandler.isExistSupplierData();if(!flagZero){JOptionPane.showMessageDialog(null,"沒有相應(yīng)的供應(yīng)商","結(jié)果",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!","結(jié)果",2);AddProductPanel.this.fieldProductId.setText("");}elseif(AddProductPductHandler.isExistProductById(Integer.parseInt(AddProductPanel.this.fieldProductId.getText()))){JOptionPane.showMessageDialog(null,"No."+AddProductPanel.this.fieldProductId.getText()+"商品id已經(jīng)存在","結(jié)果",2);AddProductPanel.this.fieldProductId.setText("");}elseif(!AddProductPanel.this.fieldPrice.getText().trim().matches("\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"請輸入正確的價(jià)格","結(jié)果",2);AddProductPanel.this.fieldPrice.setText("");}elseif(!AddProductPanel.this.fieldQuantity.getText().trim().matches("[-]?\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"請輸入正確的數(shù)量","結(jié)果",2);AddProductPanel.this.fieldQuantity.setText("");}elseif(!AddProductPanel.this.fieldQuantity.getText().trim().matches("\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"請輸入正確的數(shù)量","結(jié)果",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,"請?zhí)顚懰行畔?,"結(jié)果",2);}}}制作添加商品信息面板并通過數(shù)據(jù)庫添加商品信息publicModifyProductPanel()//構(gòu)造方法{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();//執(zhí)行一個(gè)加載數(shù)據(jù)庫相應(yīng)數(shù)據(jù)的方法-->和數(shù)據(jù)庫進(jìn)行交互ComboBoxListenercomboBoxListener=newComboBoxListener();boProdBox.addActionListener(comboBoxListener);//如果組合框可編輯,則在編輯停止時(shí)將觸發(fā)ActionEventsetupComponent(newJLabel("名稱:"),0,1,1,1,false);this.labelProNameView=newJTextField();this.labelProNameView.setEditable(false);setupComponent(this.labelProNameView,1,1,3,10,true);setupComponent(newJLabel("價(jià)格:"),0,2,1,1,false);this.labelProPriceView=newJTextField();this.labelProPriceView.setEditable(false);//開始時(shí),設(shè)置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("數(shù)量:"),0,4,1,1,false);this.labelProQuentityView=newJTextField();this.labelProQuentityView.setEditable(false);setupComponent(this.labelProQuentityView,1,4,3,1,true);setupComponent(newJLabel("供應(yīng)商:"),0,5,1,1,false);this.box=newJComboBox();this.box.setEditable(false);this.box.setEnabled(false);setupComponent(this.box,1,5,3,1,true);//以下為四個(gè)Button的設(shè)置this.modifycheckButton=newJButton("核實(shí)");//核實(shí)按鈕-->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,"沒有相應(yīng)的供應(yīng)商","結(jié)果",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,"請輸入所有信息","結(jié)果",2);return;}if(!ModifyProductPanel.this.labelProPriceView.getText().trim().matches("\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"請輸入正確的價(jià)格","結(jié)果",2);ModifyProductPanel.this.labelProPriceView.setText("");return;}if(!ModifyProductPanel.this.labelProQuentityView.getText().trim().matches("[-]?\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"請輸入正確的數(shù)量","結(jié)果",2);ModifyProductPanel.this.labelProQuentityView.setText("");return;}if(!ModifyProductPanel.this.labelProQuentityView.getText().trim().matches("\\d*[.]?\\d*")){JOptionPane.showMessageDialog(null,"請輸入正確的數(shù)量","結(jié)果",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);//執(zhí)行更新操作JOptionPane.showMessageDialog(ModifyProductPanel.this,"修改商品成功","結(jié)果",1);ModifyProductPanel.this.resetButton.doClick();}}通過與數(shù)據(jù)庫交互實(shí)現(xiàn)商品修改功能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,"倉庫中還有該商品的庫存,不能刪除","結(jié)果",1);ModifyProductPanel.this.resetButton.doClick();}else{ModifyProductPductHandler.deleteProductById(intProOkId);JOptionPane.showMessageDialog(null,"刪除成功","結(jié)果",1);ModifyProductPanel.this.resetButton.doClick();}}}通過與數(shù)據(jù)庫交互實(shí)現(xiàn)商品刪除功能3.2供應(yīng)商管理publicclassSupplierManagePanelextendsJInternalFrame{privatestaticfinallongserialVersionUID=1L;publicSupplierManagePanel(){setIconifiable(true);setClosable(true);setTitle("供應(yīng)商管理");JTabbedPanetabPane=newJTabbedPane();AddSupplierPaneladdSupplierPanel=newAddSupplierPanel();ModifySupplierPanelmodifySupplierPanel=newModifySupplierPanel();tabPane.addTab("添加供應(yīng)商",null,addSupplierPanel,"添加供應(yīng)商");tabPane.addTab("修改與刪除供應(yīng)商",null,modifySupplierPanel,"修改與刪除供應(yīng)商");getContentPane().add(tabPane);pack();setVisible(true);}}制作供應(yīng)商管理面板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("添加供應(yīng)商信息"));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("聯(lián)系人:");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,"請輸入所有信息","結(jié)果",2);return;}if(!AddSupplierPanel.this.addSupplierEmail.getText().matches("\\w+[@]\\w+\\.\\S+")){JOptionPane.showMessageDialog(AddSupplierPanel.this,"請核實(shí)您的E-mail地址","結(jié)果",2);return;}SupplierDaosupplierHandler=newSupplierDao();StringstrSupId=AddSupplierPanel.this.addSupplierId.getText();intintSupId=Integer.parseInt(strSupId);if(supplierHandler.isExistSupplierById(intSupId)){JOptionPane.showMessageDialog(AddSupplierPanel.this,"No."+intSupId+"供應(yīng)商已經(jīng)存在,請重新輸入","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,"供應(yīng)商成功添加,請繼續(xù)添加","結(jié)果",1);AddSupplierPanel.this.resetButton.doClick();}else{JOptionPane.showMessageDialog(AddSupplierPanel.this,"系統(tǒng)錯(cuò)誤!");}}}}制作添加供應(yīng)商面板并通過與數(shù)據(jù)庫交互實(shí)現(xiàn)添加供應(yīng)商功能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("修改與刪除供應(yīng)商信息"));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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論