(服装销售管理)她他乐服
装销售系统
他她乐服装销售系统
学 校:渤海大学
学 院:信息科学与技术学院
指导教师:沈泽刚
组 长:杨朝文
成 员:马勇喆 王小龙 金振丰
一、项目计划..................................................................3
系统开发目的 ..........................................................3
背景说明..............................................................3
应用范围..............................................................3
二、需求分析..................................................................3
可行性研究............................................................3
技术可行性......................................................3
经济可行性......................................................3
操作可行性......................................................4
需求分析..............................................................4
三、概要设计..................................................................5
系统总体功能......................................................5
局部 E-R图 ........................................................6
将 E-R转换为关系模型 ..............................................9
四、数据模块.................................................................10
五、实现界面和部分源代码.....................................................14
实现 DataBase 和 Java连接代码.....................................14
实现系统总体代码 .................................................15
实现前台界面,登陆,数据库代码 ...................................32
实现后台界面,数据库操作代码 .....................................52
一、项目计划
系统开发目的
为了满足广大消费者的消费愿望(不在劳神费力),特有软件开发团队,结合用户的需求
为服装开发仓库管理系统,来来解决后顾之忧,众所周知:大的服装的商品的存储和调配是不可忽视
的大问题,和好的后备调配为前台的产品销售有很大的帮助,也可以很大程度上提高产品的销售效
率,满足消费者的消费需求
背景说明
信息社会的高科技,商品经济化的高效益,使计算机的应用已普及到经济和
社会生活的各个领域。随着服装规模的不断扩大,服装商品数量急剧增加,有关
商品的各种信息也成倍增加。面对庞大的信息量,就需要有服装进销存系统来提
高服装商品管理工作的效率。通过这样的系统,可以做到信息的规范管理、科学
统计和快速的查询,从而减少管理方面的工作量,所以服装进销存管理系统将会
为服装管理带来了极大的方便。
应用范围
本系统适合应用于各个服装销售。
二、需求分析
可行性研究
系统开始和可行性研究是为系统开发做前期准备。在对一个项目的开发之前,
我们总是要对其进行一个可行性分析与需求分析,通过和指导老师的共同分析得
出了可行性开发计划。对于需求分析我们作了如下调查分析的需求。
技术可行性
随着软件编程技术的不断增加,功能的不断加强,和网络技术的不断成熟,
信息安全的不断完善以及开发工具的日益进步,采用计算机系统来管理服装销售
要求数据的采集、更新能够完整、准确和及时,所以开发通用的服装销售收银系
统已经完全可以做到。
经济可行性
因为通过网络传递销售信息,可以不受距离的限制,因此可以节约许多的人
力和物力,方便管理,由此可以减少不必要的开支,同时该系统可以提高服装的
销售效率,即提高了服装销售的经济效益,所以从经济上是完全可行的。
操作可行性
本系统采用 Windows图形界面,是大家熟悉的操作系统,对于用户只需要具
有一般的计算机知识的人员都可以轻松上手。而且整个销售系统采用最友好的交
互界面,简洁明了,不需要对数据库非常了解。
由此,该系统的操作是可行的,有必要推广该系统。
综合以上三方面,该系统具有很高的开发可行性,无论是从技术上经济上还
是操作上。
需求分析
对于大型服装信息管理系统来说,通常它会把员工人事管理系统也包括在内。
由于现考虑的是小型服装,其可承担的研发支费也有限。所以在这个系统中,要
实现的功能主要如下:
(1)功能要求
对库存产品进行资料管理和统计;
对产品的进库单和产品的销售单进行录入管理和统计;
对进库、销售、库存情况进行查询;
对用户进行管理,具体为添加用户、删除用户、修改用户密码;
对赢利状况分析,进行营业统计,按年月日及商品类别统计;
(2)数据精确度
产品的进货单和销售单中,单价、金额采用浮点数,数量都取整数。
(3)时间特性
该系统软件从启动到进入系统登录界面的时间正常情况下少于 5秒,录入并
更新数据的时间正常情况下少于 10秒。
(4)适用性
该管理系统软件适用于Windows 2000/Windows XP/ Windows7中文版下运行。
三、概要设计
系统总体功能
图 系统总体结构图
销售统计 商品
用户
管理员
入/出库
提交
购买
管理
更新
图 系统总体 E-R图
局部 E-R图
商品
备注
序号
商品编码
条形码
类别编号
商品名称
零售价
商品规格
保质期
进货价
计量单位
图 局部商品 E-R图
图 局部销售统计 E-R图
入/出库
数量
入库编号
商品编号
进货价
下单人
仓库号
入库日期
经手人
图 局部入/出库 E-R图
图 局部会员 E-R图
图 库存 E-R图
商品类别类别编号
序号
类别名
图 商品类别 E-R图
将 E-R转换为关系模型
商品(序号,商品编码,条型码,类别编号,商品名称,零售价,商
品规格,计量单位,进货价,保质期,备注)
销售统计(销售编号,商品编号,销售日期,商品数量,商品单价,
折扣,会员卡号,商品名称)
入/出库(入库编号,商品编号,数量,进货价,入库日期,仓库号,
经手人,下单人)
会员(卡号,用户名,身份证,密码,开卡日期,用户类型,期限,
积分,折扣,备注)
库存(商品编码,数量)
商品类别(序号,商品类别,类别名)
四、数据模块
列名 数据类型 长度 允 许
空
说明 属性
SequenceNumber int 4 序号
MerchandiseNumber varchar 20 商品编码 主键
TreatyCode Varchar 20 条型码
SortNumber Varchar 20 √ 类别编号 外键 references类
别表(SortNumber)
merchandiseName Varchar 50 商品名称
RetailPrice varchar 9 √ 零售价
merchandiseSpec Varchar 50 √ 商品规格
Units Varchar 20 计量单位
PurchasePrice numeric 9 进货价
CheckTerm Varchar 50 √ 保质期
Remark varchar 50 √ 备注
图 商品表
列名 数据类型 长度 允 许
空
说明 属性
EnterStockID Int 4 入库编号 主键
MerNumber varchar 30 商品编号
Number numeric 9 数量 外键 references库存表
(Number)
PurchasePrice numeric 9 进货价
PutDate varchar 30 √ 入库日期
StoreHourse_ID varchar 20 仓库号
dealWithHuman varchar 20 √ 经手人
downName varchar 20 下单人
inout char 1
图 入/出库表
列名 数据类型 长度 允许空 说明 属性
CardID varchar 20 卡号 主键
UseName varchar 20 用户名
IDCard varchar 20 身份证
Password varchar 20 密码
CardDate varchar 30 √ 开卡日期
UserGrade varchar 16 √ 用户类型
term char 10 √ 期限
integral char 10 积分
agio char 10 折扣
remark varchar 200 √ 备注
图 用户表
列名 数据类型 长度 允 许
空
说明 属性
ID numeric 9
MerchandiseNumber varchar 20 商品编码 外键references商品
表
(MerchandiseNumber)
Number numeric 9 √ 数量 主键
图 库存表
列名 数据类型 长度 允许空 说明 属性
SortID int 4 序号
SortNumber varchar 20 类别编号 主键
SortName varchar 20 类别名
图 商品类别表
列名 数据类型 长度 允许空 说明 属性
Sale_ID numeric 9 销售编号 主键
ProductID varchar 10 商品编号
SaleDate varchar 50 销售日期
Number numeric 9 商品数量 外键 references库存表
(Number)
Price numeric 9 商品单价
Discount varchar 10 折扣
VIP_ID varchar 10 √ 会员卡号 外键 references用户表
(CardID)
ProductName varchar 50 商品名称
图 销售统计表
五、实现界面和部分源代码
实现 DataBase 和 Java连接代码
类
package tatale;
import .*;
public class DBAccess {
private static final String DRIVER =
"";
private static final String URL =
"jdbc:microsoft:sqlserver://localhost:1433;databaseName=SuperMarket;";
private static final String USER = "sa";
private static final String PASSWORD = "0";
public static Connection getConnection() { //连接数据库
Connection conn = null;
try {
(DRIVER);
conn = (URL, USER, PASSWORD);
} catch (Exception ex) {
();
}
return conn;
}
}
实现系统总体代码
图 -1
图 -2
类
package tatale;
import .*;
import .*;
import .*;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import tatale.*;
import .*;
import .*;
import ;
import ;
import ;
import ;
import ;
import ;
import _Out_Depot;
import _card;
import _Dialog;
import _dialog;
import _Means;
import ;
import _AboutBox;
import _jMenuItem10_actionAdapter;
import _jMenuItem11_actionAdapter;
import _jMenuItem15_actionAdapter;
import _jMenuItem17_actionAdapter;
import _jMenuItem18_actionAdapter;
import _jMenuItem19_actionAdapter;
import _jMenuItem1_actionAdapter;
import _jMenuItem20_actionAdapter;
import _jMenuItem21_actionAdapter;
import _jMenuItem25_actionAdapter;
import _jMenuItem2_actionAdapter;
import _jMenuItem3_actionAdapter;
import _jMenuItem5_actionAdapter;
import _jMenuItem7_actionAdapter;
import _jMenuItem8_actionAdapter;
import _jMenuItem9_actionAdapter;
import _jTree1_treeSelectionAdapter;
import ;
import ;
public class MainFrame extends JFrame {
JPanel contentPane;
JMenuBar jMenuBar1 = new JMenuBar();
JMenu jMenuFile = new JMenu();
JToolBar jToolBar = new JToolBar();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
ImageIcon image1 = new ImageIcon((
""));
ImageIcon image2 = new ImageIcon((
""));
ImageIcon image3 = new ImageIcon((
""));
JLabel statusBar = new JLabel();
JScrollPane jScrollPane1 = new JScrollPane();
JTree jTree1 = new JTree();
JMenuItem jMenuItem1 = new JMenuItem();
JMenu jMenu1 = new JMenu();
JMenu jMenu2 = new JMenu();
JMenu jMenu3 = new JMenu();
JMenu jMenu4 = new JMenu();
JMenuItem jMenuItem5 = new JMenuItem();
JMenuItem jMenuItem7 = new JMenuItem();
JMenuItem jMenuItem9 = new JMenuItem();
JMenu jMenu5 = new JMenu();
JMenuItem jMenuItem10 = new JMenuItem();
JMenuItem jMenuItem11 = new JMenuItem();
JMenuItem jMenuItem17 = new JMenuItem();
JMenu jMenu7 = new JMenu();
JMenuItem jMenuItem18 = new JMenuItem();
JMenuItem jMenuItem19 = new JMenuItem();
JScrollPane jScrollPane2 = new JScrollPane();
JTable jTable1 = new JTable();
TitledBorder titledBorder1 = new TitledBorder("");
JMenuItem jMenuItem2 = new JMenuItem();
JMenuItem jMenuItem3 = new JMenuItem();
JMenuItem jMenuItem15 = new JMenuItem();
JMenuItem jMenuItem16 = new JMenuItem();
JMenu jMenu9 = new JMenu();
JMenuItem jMenuItem8 = new JMenuItem();
JMenuItem jMenuItem20 = new JMenuItem();
JMenuItem jMenuItem21 = new JMenuItem();
JMenuItem jMenuItem22 = new JMenuItem();
JMenuItem jMenuItem23 = new JMenuItem();
JMenuItem jMenuItem24 = new JMenuItem();
JMenuItem jMenuItem25 = new JMenuItem();
public MainFrame() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
(null);
setSize(new Dimension(930, 600));
setTitle("他她乐服装销售系统");
(" ");
(new Rectangle(0, 585, 800, 15));
//设置树
DefaultMutableTreeNode root = new DefaultMutableTreeNode("进销存管理");
DefaultMutableTreeNode Man2 = new DefaultMutableTreeNode("销售管理");
DefaultMutableTreeNode Man3 = new DefaultMutableTreeNode("库存查询");
DefaultMutableTreeNode Man4 = new DefaultMutableTreeNode("用户管理");
DefaultMutableTreeNode Man5 = new DefaultMutableTreeNode("信息查询");
DefaultMutableTreeNode Man6 = new DefaultMutableTreeNode("商品管理");
DefaultMutableTreeNode annal = new DefaultMutableTreeNode("入库/出库");
(new MainFrame_jMenuItem1_actionAdapter(this));
("添加/修改用户");
(new MainFrame_jMenuItem2_actionAdapter(this));
("个人账户查询");
(new MainFrame_jMenuItem3_actionAdapter(this));
();
(new MainFrame_jMenuItem9_actionAdapter(this));
("后台转前台");
(new
MainFrame_jMenuItem15_actionAdapter(this));
(new
MainFrame_jMenuItem17_actionAdapter(this));
(new
MainFrame_jMenuItem10_actionAdapter(this));
(new MainFrame_jMenuItem7_actionAdapter(this));
(new
MainFrame_jMenuItem11_actionAdapter(this));
("按商品类别查询");
("上衣类查询");
(new MainFrame_jMenuItem8_actionAdapter(this));
("裤子类查询");
(new
MainFrame_jMenuItem20_actionAdapter(this));
("鞋类查询");
(new
MainFrame_jMenuItem21_actionAdapter(this));
(new
MainFrame_jMenuItem18_actionAdapter(this));
(new
MainFrame_jMenuItem19_actionAdapter(this));
("按商品条形码查询");
(new
MainFrame_jMenuItem25_actionAdapter(this));
();
();
();
();
();
();
();
(new MainFrame_jMenuItem5_actionAdapter(this));
(annal);
("File");
("退出");
("仓库");
("账户管理");
("作者信息");
("作者");
("入库/出库");
("查询");
("销售统计");
("查询商品信息");
("按商品名称查询");
("按商品编号查询");
(());
(new Rectangle(167, 93, 750, 435));
(Man2);
(Man3);
(Man4);
(Man5);
(Man6);
DefaultMutableTreeNode Sells = new DefaultMutableTreeNode("销售统计");
(Sells);
DefaultMutableTreeNode Storeinfr = new DefaultMutableTreeNode("库存信息浏览
");
DefaultMutableTreeNode Store1 = new DefaultMutableTreeNode("按库存商品编号
查询");
(Storeinfr);
(Store1);
DefaultMutableTreeNode UserNa = new DefaultMutableTreeNode("添加/修改用户");
DefaultMutableTreeNode UserAdd = new DefaultMutableTreeNode("个人账户查询");
(UserNa);
(UserAdd);
DefaultMutableTreeNode search1 = new DefaultMutableTreeNode("按商品名称查询
");
DefaultMutableTreeNode search2 = new DefaultMutableTreeNode("按商品编号查询
");
DefaultMutableTreeNode search3 = new DefaultMutableTreeNode("按商品条形码查
询");
DefaultMutableTreeNode search5 = new DefaultMutableTreeNode("按商品类别查询
");
DefaultMutableTreeNode sort1 = new DefaultMutableTreeNode("上衣类查询");
DefaultMutableTreeNode sort2 = new DefaultMutableTreeNode("裤子类查询");
DefaultMutableTreeNode sort3 = new DefaultMutableTreeNode("鞋类查询");
(sort1);
(sort2);
(sort3);
(search1);
(search2);
(search3);
(search5); //初始化树
jTree1 = new JTree(root);
(new
MainFrame_jTree1_treeSelectionAdapter(this));
("文件");
(new Rectangle(0, 0, 800, 29));
(new Rectangle(13, 93, 152, 435));
(jMenuFile);
(jMenuItem1);
(jMenu1);
(jMenu2);
(jMenu3);
(jMenu5);
(jMenu4);
setJMenuBar(jMenuBar1);
(image1);
("Open File");
(image2);
("Close File");
(image3);
("Help");
(jButton1);
(jButton2);
(jButton3);
(jToolBar, null);
(statusBar, null);
(jScrollPane1);
(jScrollPane2);
().add(jTable1);
().add(jTree1);
(jMenuItem2);
(jMenuItem3);
(jMenuItem15);
(jMenuItem5);
(jMenuItem7);
(jMenuItem10);
(jMenuItem11);
(jMenuItem17);
(jMenu7);
(jMenuItem18);
(jMenuItem25);
(jMenuItem19);
(jMenu9);
(jMenuItem8);
(jMenuItem20);
(jMenuItem21);
}
void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
Dimension dlgSize = ();
Dimension frmSize = getSize();
Point loc = getLocation();
(( - ) / 2 + ,
( - ) / 2 + );
(true);
();
(true);
}
public void jMenuItem1_actionPerformed(ActionEvent e) {
(0);
}
private void select1(String nubmer) { //输入商品类别参数,把结果显示到表中
Vector tablehead = new Vector();
tablehead = ();
Vector dqselect = new Vector();
dqselect = _sort1(nubmer);
jTable1 = (dqselect, tablehead); //显示内容
().add(jTable1); //把表装入容器
}
private void select_number() { //按商品编号查询
String nubmer = (this, "请输入商品编号", "提示",
_MESSAGE);
if (() != 0) {
Vector tablehead = new Vector();
tablehead = ();
Vector dqselect = new Vector();
dqselect = _sort2(nubmer);
if (() == 0) {
(this, "商品编号不存在", "提示",
_MESSAGE);
return;
}
jTable1 = (dqselect, tablehead); //显示内容
().add(jTable1); //把表装入容器
} else {
(this, "输入不能为空值", "提示",
_MESSAGE);
return;
}
}
private void select_name() { //按商品名称查询
String nubmer = (this, "请输入商品名称",
"提示", _MESSAGE);
if (() != 0) {
Vector tablehead = new Vector();
tablehead = ();
Vector dqselect = new Vector();
dqselect = _sort3(nubmer);
if (() == 0) {
(this, "商品不存在", "提示",
_MESSAGE);
return;
}
jTable1 = (dqselect, tablehead); //显示内容
().add(jTable1); //把表装入容器
} else {
(this, "输入不能为空值", "提示",
JOptionPane.
INFORMATION_MESSAGE);
return;
}
}
private void select_TreatyCode() { //按商品条形码查询
String nubmer = (this, "请输入商品条形码",
"提示", _MESSAGE);
if (() != 0) {
Vector tablehead = new Vector();
tablehead = ();
Vector dqselect = new Vector();
dqselect = _sort4(nubmer);
if (() == 0) {
(this, "商品不存在", "提示",
_MESSAGE);
return;
}
jTable1 = (dqselect, tablehead); //显示内容
().add(jTable1); //把表装入容器
} else {
(this, "输入不能为空值", "提示",
JOptionPane.
INFORMATION_MESSAGE);
return;
}
}
public void jTree1_valueChanged(TreeSelectionEvent e) {
Object obj1 = ();
String s = null;
if (obj1 != null) {
s = ();
if (("销售统计")) {
Earning earn = new Earning();
(true);
(200, 0);
}
if (("库存信息浏览")) {
Vector vec1 = new Vector();
Vector vec2 = new Vector();
("库存编号");
("商品编码");
("商品名称");
("库存数量");
vec1 = _All_repertory();
jTable1 = (vec1, vec2); //显示内容
().add(jTable1); //把表装入容器
}
if (("按库存商品编号查询")) {
String str= (this,"请输入商品编号","提示
",_MESSAGE);
if(()==0){
(this,"您没有输入商品编号","提示
",_MESSAGE);
return;
}
Vector vec1 = new Vector();
Vector vec2 = new Vector();
("库存编号");
("商品编码");
("商品名称");
("库存数量");
vec1 = _repertory(str);
if(()==0){
(this,"商品不存在","提示
",_MESSAGE); return;
}
jTable1 = (vec1, vec2); //显示内容
().add(jTable1); //把表装入容器
}
if (("添加/修改用户")) {
Adminstrator admin_Enter = new Adminstrator();
(true);
("此功能需要管理员权限");
}
if (("个人账户查询")) {
Select_card seCard = new Select_card();
(true);
("个人账户查询");
}
if (("入库/出库")) {
Put_Out_Depot put_out = new Put_Out_Depot();
(true);
(200, 100);
("进/出货表");
}
if (("上衣类查询")) {
select1("DQ1004");
}
if (("裤子类查询")) {
select1("LP1006");
}
if (("鞋类查询")) {
select1("RY1005");
}
if (("按商品编号查询")) {
select_number();
}
if (("按商品名称查询")) {
select_name();
}
if (("按商品条形码查询")) {
select_TreatyCode();
}
}
}
public void jMenuItem2_actionPerformed(ActionEvent e) {
Adminstrator admin_Enter = new Adminstrator();
(true);
("此功能需要超级管理员权限");
}
public void jMenuItem3_actionPerformed(ActionEvent e) {
Select_card seCard = new Select_card();
(true);
("个人账户查询");
}
public void jMenuItem4_actionPerformed(ActionEvent e) {
Vendition_dialog vd = new Vendition_dialog();
(true);
}
public void jMenuItem9_actionPerformed(ActionEvent e) {
JoinAndExceed join = new JoinAndExceed();
(true);
("进/退货表");
(200, 150);
}
public void jMenuItem17_actionPerformed(ActionEvent e) {
Earning earn = new Earning();
(true);
(200, 0);
}
public void jMenuItem10_actionPerformed(ActionEvent e) {
Stock_Dialog stock = new Stock_Dialog();
(true);
(150, 150);
("采购表");
}
public void jMenuItem7_actionPerformed(ActionEvent e) {
Put_Out_Depot put_out = new Put_Out_Depot();
(true);
(200, 100);
("进/出货表");
}
public void jMenuItem11_actionPerformed(ActionEvent e) {
PaymentList paymentList = new PaymentList();
(true);
(100, 100);
("付款单");
}
public void jMenuItem18_actionPerformed(ActionEvent e) {
select_name();
}
public void jMenuItem19_actionPerformed(ActionEvent e) {
select_number();
}
public void jMenuItem8_actionPerformed(ActionEvent e) {
select1("DQ1004");
}
public void jMenuItem20_actionPerformed(ActionEvent e) {
select1("LP1006");
}
public void jMenuItem21_actionPerformed(ActionEvent e) {
select1("RY1005");
}
public void jMenuItem25_actionPerformed(ActionEvent e) {
select_TreatyCode();
}
public void jMenuItem15_actionPerformed(ActionEvent e) {
Vendition_dialog vendition_dialog = new Vendition_dialog();
(true);
(false);
}
public void jMenuItem5_actionPerformed(ActionEvent e) {
Guayuqwomen guayuqwomen = new Guayuqwomen();
(true);
("关于我们");
}
}
class MainFrame_jMenuItem15_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem15_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem25_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem25_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem21_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem21_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem20_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem20_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem8_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem8_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem19_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem19_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem18_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem18_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem10_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem10_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem17_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem17_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem7_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem7_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem5_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem5_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem9_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem9_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem3_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem3_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem2_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem2_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuItem1_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem1_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jTree1_treeSelectionAdapter implements TreeSelectionListener {
private MainFrame adaptee;
MainFrame_jTree1_treeSelectionAdapter(MainFrame adaptee) {
= adaptee;
}
public void valueChanged(TreeSelectionEvent e) {
_valueChanged(e);
}
}
class MainFrame_jMenuItem11_actionAdapter implements ActionListener {
private MainFrame adaptee;
MainFrame_jMenuItem11_actionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
MainFrame adaptee;
MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent actionEvent) {
_actionPerformed(actionEvent);
}
}
实现前台界面,登陆,数据库代码
图 -1
类
package ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import _jButton1_actionAdapter;
import _jButton2_actionAdapter;
import _dialog;
import _Means;
import ;
import ;
public class Admin extends JDialog {
Vendition_dialog form;
JPanel panel1 = new JPanel();
JTextField jTextField1 = new JTextField();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JPasswordField jPasswordField1 = new JPasswordField();
public Admin(Frame owner, String title, boolean modal) {
super(owner, title, modal);
try {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
jbInit();
pack();
} catch (Exception exception) {
();
}
}
public Admin() {
this(new Frame(), "管理员登录", false);
(400, 300);
(300, 200);
}
public Admin(Vendition_dialog form) {
this(new Frame(), "管理员登录", false);
(400, 300);
(300, 200);
= form;
}
private void jbInit() throws Exception {
(null);
().setBackground();
();
(new Rectangle(158, 87, 101, 25));
("用户名");
(new Rectangle(78, 87, 49, 25));
("密 码");
(new Rectangle(76, 124, 49, 25));
(new ("宋体", , 20));
("管理员登录");
(new Rectangle(145, 30, 113, 27));
(new Rectangle(75, 206, 83, 25));
("登 录");
(new Admin_jButton1_actionAdapter(this));
(new Rectangle(210, 206, 83, 25));
("取 消");
(new Admin_jButton2_actionAdapter(this));
(new Rectangle(158, 125, 101, 25));
getContentPane().add(panel1);
(jLabel3);
(jLabel1);
(jTextField1);
(jLabel2);
(jButton1);
(jButton2);
(jPasswordField1);
}
public void jButton1_actionPerformed(ActionEvent e) {
Vector user = new Vector();
String name = ();
String password = ();
user = _User(name, password);
if (() != 0) {
(false);
MainFrame mainFrame = new MainFrame();
(true);
(50, 50);
(false);
}
else {
(this, "用户名或密码不正确,请重新输入", "
错误",
_MESSAGE);
return;
}
}
public void jButton2_actionPerformed(ActionEvent e) {
(false);
}
}
class Admin_jButton2_actionAdapter implements ActionListener {
private Admin adaptee;
Admin_jButton2_actionAdapter(Admin adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Admin_jButton1_actionAdapter implements ActionListener {
private Admin adaptee;
Admin_jButton1_actionAdapter(Admin adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
类
package ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import .*;
import ;
import ;
import ;
import ;
import _Dialog;
import _dialog;
import _dialog_jButton1_actionAdapter;
import _dialog_jButton2_actionAdapter;
import _dialog_jButton3_actionAdapter;
import _dialog_jTextField1_focusAdapter;
import _dialog_jTextField2_keyAdapter;
import _dialog_jTextField5_keyAdapter;
import _dialog_jTextField6_focusAdapter;
import ;
import _stock;
import _Means;
import ;
import ;
import ;
import .*;
import ;
import ;
import ;
import ;
public class Vendition_dialog extends JDialog {
JPanel panel1 = new JPanel();
JScrollPane jScrollPane1 = new JScrollPane();
JTextField jTextField1 = new JTextField();
JLabel jLabel1 = new JLabel();
JTextField jTextField2 = new JTextField();
JTextField jTextField3 = new JTextField();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JLabel jLabel9 = new JLabel();
TitledBorder titledBorder1 = new TitledBorder("");
JTable jTable1 = new JTable();
JTableHeader jTableHeader1 = ();
Vector colnames = new Vector(); //表头
Vector colnames1 = new Vector(); //测试
Vector colnames2 = new Vector(); //测试
Vector colnames4 = new Vector();
JTextField jTextField5 = new JTextField();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JTextField jTextField6 = new JTextField();
JLabel jLabel10 = new JLabel();
JLabel jLabel11 = new JLabel();
JLabel jLabel12 = new JLabel();
JTextField jTextField4 = new JTextField();
public Vendition_dialog(Frame owner, String title, boolean modal) {
super(owner, title, modal);
try {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
jbInit();
pack();
} catch (Exception exception) {
();
}
}
public Vendition_dialog() {
this(new Frame(), "前台收银程序", false);
(800, 600);
(50, 50);
}
private void jbInit() throws Exception {
(null);
(false);
(new ("宋体", , 30));
("0");
(new Rectangle(335, 520, 125, 40));
(new
Vendition_dialog_jTextField5_keyAdapter(this));
(new Rectangle(436, 489, 96, 25));
("删除商品");
(new
Vendition_dialog_jButton1_actionAdapter(this));
(new Rectangle(685, 489, 96, 25));
("交易取消");
(new
Vendition_dialog_jButton2_actionAdapter(this));
(new
Vendition_dialog_jTextField2_keyAdapter(this));
(new Rectangle(560, 489, 96, 25));
("");
("前台转后台");
(new
Vendition_dialog_jButton3_actionAdapter(this));
(new ("宋体", , 20));
(new Rectangle(91, 489, 152, 21));
(new
Vendition_dialog_jTextField6_focusAdapter(this));
("会员卡号");
(new Rectangle(30, 488, 48, 15));
("0");
("0");
(new ("宋体", , 20));
(new
Vendition_dialog_jTextField1_focusAdapter(this));
(new ("宋体", , 20));
("1");
(());
(0);
(new Rectangle(621, 460, 159, 21));
("当前时间");
(new Rectangle(560, 463, 48, 15));
(false);
("100");
(new Rectangle(436, 456, 96, 21));
().add(panel1, );
(new Rectangle(91, 460, 152, 21));
("商品编号");
(new Rectangle(30, 463, 60, 15));
(new Rectangle(302, 460, 72, 21));
(new Rectangle(302, 489, 72, 21));
("数量");
(new Rectangle(267, 463, 42, 15));
("单价");
(new Rectangle(267, 489, 42, 15));
("折扣");
(new Rectangle(399, 460, 42, 15));
(new ("宋体", , 30));
("应收:");
(new Rectangle(26, 517, 88, 40));
();
(new ("宋体", , 30));
(());
(new Rectangle(110, 517, 125, 40));
(new ("宋体", , 30));
("找零:");
(new Rectangle(473, 519, 88, 40));
(new ("宋体", , 30));
(());
(new Rectangle(550, 520, 125, 40));
(new ("宋体", , 30));
("实收:");
(new Rectangle(251, 516, 88, 40));
Timer timer = new Timer();
(new RemindTask(), 0, 1000); //得到当前时间
(jScrollPane1);
().add(jTable1);
(jLabel5);
(jLabel6);
(jLabel9);
(jTextField5);
(jLabel7);
(jLabel8);
(jTextField2);
(jLabel1);
(jTextField1);
(jLabel2);
(jTextField6);
(jLabel10);
(jTextField3);
(jLabel3);
(jLabel4);
(jButton1);
(jButton3);
(jButton2);
(jLabel11);
(jLabel12);
(jTextField4);
().add(jTableHeader1, );
("商品编码");
("商品名称");
("规格");
("单位");
("数量");
("售价");
("折扣");
("金额");
(colnames1);
jTable1 = (colnames2, colnames); //显示内容
().add(jTable1); //把表装入容器
(new Rectangle(24, 28, 746, 419));
();
}
class RemindTask extends TimerTask {
public void run() {
(());
}
}
public void jButton2_actionPerformed(ActionEvent e) {
(true);
("");
();
jTable1 = (colnames4, colnames); //显示内容
().add(jTable1); //把表装入容器
}
public void jTextField5_keyReleased(KeyEvent e) {
int t = (int) ();
if (t == 10) { //如果输入的是回车键
try {
Double gather = new Double(());
double gathering = ((int) (gather * 100)) / ;
Double account = new Double(());
double givechange = ((int) ((gathering - account) * 100)) /
;
if (givechange < 0) {
(this, "输入的金额不足", "错误",
_MESSAGE);
return;
}
Double givechange1 = new Double(givechange);
(());
} catch (Exception ex) {
(this, "输入的金额有误", "错误",
_MESSAGE);
return;
}
Settle_Dialog sett = new Settle_Dialog();
(400, 300);
(300, 250);
(true); //显示结账界面
(());
(());
(());
(true); //会员卡号可编辑
("");
//商品编号 销售日期 商品数量 商品单价 折扣 会员卡号 商品名称
int num1 = 0;
while (num1 < ()) { //更新数据库
Vector ls = new Vector();
ls = (Vector) (num1);
Integer number = new Integer((4).toString()); //数量
Double Price = new Double((5).toString()); //单价
_StockPile(number, (0).toString());
_Sale((0).toString(),
(), number,
Price, (6).toString(),
(),
(1).toString());
num1++;
}
("");
("1");
();
jTable1 = (colnames4, colnames); //显示内容
().add(jTable1); //把表装入容器
}
}
public void jTextField2_keyReleased(KeyEvent e) {
if (().length() == 0) {
(this, "商品编号不能为空", "错误",
_MESSAGE);
return;
}
if (().length() == 0) {
(this, "商品数量不能为空", "错误",
_MESSAGE);
return;
}
();
("商品编码");
("商品名称");
("规格");
("单位");
("数量");
("售价");
("折扣");
("金额");
int t = (int) ();
if (t == 10) {
Vector colnames2 = new Vector();
Vector colnames3 = new Vector();
Vector colnames5 = new Vector();
colnames2 = _sort2(()); //查询商
品信息
colnames3 = (Vector) (0);
if (().length() == 0) {
}
((4).toString());
if (() == 0) {
(this, "无此商品", "错误",
_MESSAGE);
return;
}
((0)); //商品编码
((3)); //商品名称
((5)); //商品规格
((6)); //商品单位
(()); //数量
((4)); //单价
(()); //折扣
try {
Integer number1 = new Integer(());
Double number2 = new Double(());
Double number3 = new Double(());
double money = ((int) (number1 * number2 * number3)) / ;
Double Money = new Double(money);
(()); //金额
(colnames5);
jTable1 = (colnames4, colnames); //显示内容
().add(jTable1); //把表装入容器
int num = 0;
double Payment = 0;
while (num < ()) {
Vector allMoney = new Vector();
allMoney = (Vector) (num);
Double allMoney1 = new Double((7).toString());
Payment += allMoney1;
num++;
}
Double PaymentAll = new Double(Payment);
(());
} catch (Exception ex) {
(this, "输入的数量不正确", "错误",
_MESSAGE);
}
}
}
public void jButton1_actionPerformed(ActionEvent e) {
int row = ();
(row);
jTable1 = (colnames4, colnames); //显示内容
().add(jTable1); //把表装入容器
}
public void jButton3_actionPerformed(ActionEvent e) {
Admin admin = new Admin(this);
(true);
(200, 200);
}
public void jTextField1_focusLost(FocusEvent e) {
if (().length() != 0) {
Vector select1 = _sort2(());
Vector select2 = new Vector();
if (() == 0) {
(this, "商品不存在", "错误",
_MESSAGE);
return;
} else {
select2 = (Vector) (0);
((4).toString()); //单价
}
}
}
public void jTextField6_focusLost(FocusEvent e) {
Vector User = new Vector();
if (().length() == 0) {
} else {
User = _UserManager(jTextField6.
getText());
if (() == 0) {
(this, "无此卡号", "错误",
_MESSAGE);
return;
} else {
String str = (8).toString();
(str);
(false);
}
}
}
}
class Vendition_dialog_jButton3_actionAdapter implements ActionListener {
private Vendition_dialog adaptee;
Vendition_dialog_jButton3_actionAdapter(Vendition_dialog adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Vendition_dialog_jTextField5_keyAdapter extends KeyAdapter {
private Vendition_dialog adaptee;
Vendition_dialog_jTextField5_keyAdapter(Vendition_dialog adaptee) {
= adaptee;
}
public void keyReleased(KeyEvent e) {
_keyReleased(e);
}
}
class Vendition_dialog_jTextField2_keyAdapter extends KeyAdapter {
private Vendition_dialog adaptee;
Vendition_dialog_jTextField2_keyAdapter(Vendition_dialog adaptee) {
= adaptee;
}
public void keyReleased(KeyEvent e) {
_keyReleased(e);
}
}
class Vendition_dialog_jTextField6_focusAdapter extends FocusAdapter {
private Vendition_dialog adaptee;
Vendition_dialog_jTextField6_focusAdapter(Vendition_dialog adaptee) {
= adaptee;
}
public void focusLost(FocusEvent e) {
_focusLost(e);
}
}
class Vendition_dialog_jTextField1_focusAdapter extends FocusAdapter {
private Vendition_dialog adaptee;
Vendition_dialog_jTextField1_focusAdapter(Vendition_dialog adaptee) {
= adaptee;
}
public void focusLost(FocusEvent e) {
_focusLost(e);
}
}
class Vendition_dialog_jButton2_actionAdapter implements ActionListener {
private Vendition_dialog adaptee;
Vendition_dialog_jButton2_actionAdapter(Vendition_dialog adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Vendition_dialog_jButton1_actionAdapter implements ActionListener {
private Vendition_dialog adaptee;
Vendition_dialog_jButton1_actionAdapter(Vendition_dialog adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
类
package ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import _card;
import _card_jButton2_actionAdapter;
import _card_jButton5_actionAdapter;
import _Means;
import ;
public class Select_card extends JDialog {
JPanel panel1 = new JPanel();
JTextField jTextField1 = new JTextField();
JTextField jTextField2 = new JTextField();
JTextField jTextField3 = new JTextField();
JTextField jTextField4 = new JTextField();
JTextField jTextField5 = new JTextField();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JTextField jTextField7 = new JTextField();
JTextField jTextField8 = new JTextField();
JTextArea jTextArea1 = new JTextArea();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JTextField jTextField9 = new JTextField();
JLabel jLabel9 = new JLabel();
JLabel jLabel10 = new JLabel();
JScrollPane jScrollPane1 = new JScrollPane();
JButton jButton2 = new JButton();
JComboBox jComboBox1 = new JComboBox();
JButton jButton5 = new JButton();
public Select_card(Frame owner, String title, boolean modal) {
super(owner, title, modal);
try {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
jbInit();
pack();
} catch (Exception exception) {
();
}
}
public Select_card() {
this(new Frame(), "注册用户", false);
(500, 400);
(300, 200);
}
private void jbInit() throws Exception {
(null);
(new Rectangle(126, 48, 105, 27));
(false);
(new Rectangle(126, 88, 105, 27));
(false);
(new Rectangle(126, 128, 105, 27));
(false);
(new Rectangle(126, 168, 105, 27));
(false);
(new Rectangle(126, 208, 105, 27));
("卡号");
(new Rectangle(51, 53, 42, 15));
("持卡人");
(new Rectangle(51, 94, 42, 15));
("证件号");
(new Rectangle(51, 134, 42, 15));
("级别");
(new Rectangle(51, 173, 42, 15));
("折扣率");
(new Rectangle(51, 213, 42, 15));
(false);
(new Rectangle(308, 87, 105, 27));
(false);
(new Rectangle(309, 128, 105, 27));
("类型");
(new Rectangle(254, 53, 42, 15));
("期限");
(new Rectangle(254, 93, 42, 15));
("积分");
(new Rectangle(254, 133, 42, 15));
(false);
(true);
(new Rectangle(309, 168, 105, 27));
("开卡日期");
(new Rectangle(254, 173, 61, 15));
("备注");
(new Rectangle(254, 213, 48, 15));
(new Rectangle(308, 210, 105, 82));
(new Rectangle(275, 317, 83, 25));
("取消");
(new Select_card_jButton2_actionAdapter(this));
();
(new Rectangle(308, 48, 105, 27));
("普通会员");
("收银员");
(new Rectangle(108, 317, 83, 25));
("查询");
(new Select_card_jButton5_actionAdapter(this));
(false);
(jTextField3);
(jTextField1);
(jTextField2);
(jLabel1);
(jLabel2);
(jLabel3);
(jLabel4);
(jLabel7);
(jLabel8);
(jLabel10);
(jLabel6);
(jLabel9);
(jLabel5);
(jTextField4);
(jTextField5);
(jTextField7);
(jTextField8);
(jTextField9);
(jScrollPane1);
(jComboBox1);
(jButton2);
(jButton5);
().add(jTextArea1);
().add(panel1, );
}
public void jButton5_actionPerformed(ActionEvent e) {
String cardId = (); //卡号
Vector Select_vector = new Vector();
Select_vector = _UserManager(cardId); //查询此卡是否存在
if (() == 0) {
(this, "卡号不存在", "提示",
_MESSAGE);
return;
}
((0).toString()); //卡号
((1).toString()); //持卡人
((2).toString()); //身份证
((3).toString()); //密码
((4).toString()); //开卡日期
if ((5).toString().equals("普通会员")) {
();
("普通会员");
("收银员");
}
if ((5).toString().equals("收银员")) {
();
("收银员");
("普通会员");
}
((6).toString()); //期限
((7).toString()); //积分
((8).toString()); //折扣
((9).toString()); //备注
}
public void jButton2_actionPerformed(ActionEvent e) {
(false);
}
}
class Select_card_jButton2_actionAdapter implements ActionListener {
private Select_card adaptee;
Select_card_jButton2_actionAdapter(Select_card adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Select_card_jButton5_actionAdapter implements ActionListener {
private Select_card adaptee;
Select_card_jButton5_actionAdapter(Select_card adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
类
package ;
import ;
import .*;
import ;
public class SelectEarning {
public static String SQLFind1 = "select
ProductID,ProductName,Number,Price,SaleDate,Number*Price from Sale where
ProductID=?";
public static String SQLFind2 =
"select ProductID,ProductName,Number,Price,SaleDate,Number*Price from
Sale";
public static Vector findAll(String ProductID) {
Vector ve1 = new Vector();
DBAccess dba = new DBAccess();
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
con = ();
try {
if (() == 0) {
ps = (SQLFind2);
}
else {
ps = (SQLFind1);
(1,ProductID);
}
rs = ();
while (()) {
Vector ve = new Vector();
((1));
((2));
((3));
((4));
((5));
Double money=new Double((6));
double money1=((int)(money*100))/;//将金额处理成只含两位小数
Double money2=new Double(money1);
(());
(ve);
}
if (rs != null) {
();
}
if (ps != null) {
();
}
if (con != null) {
();
}
} catch (SQLException ex) {
}
return ve1;
}
public static boolean charbj(String n1, String n2) {
boolean b1 = false;
int i = 0;
while (i < () - 1) {
i++;
if ((i) == (i)) {
b1 = true;
continue;
}
if ((i) > (i)) {
b1 = true;
break;
}
if ((i) < (i)) {
b1 = false;
break;
}
}
return b1;
}
实现后台界面,数据库操作代码
图 -1
图 -2
图 -3
类
package ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import _jButton1_actionAdapter;
import _jButton2_actionAdapter;
import _enroll;
import _Means;
import ;
public class Adminstrator extends JDialog {
JPanel panel1 = new JPanel();
JTextField jTextField1 = new JTextField();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JPasswordField jPasswordField1 = new JPasswordField();
public Adminstrator(Frame owner, String title, boolean modal) {
super(owner, title, modal);
try {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
jbInit();
pack();
} catch (Exception exception) {
();
}
}
public Adminstrator() {
this(new Frame(), "管理员登录", false);
(400, 300);
(300, 200);
}
private void jbInit() throws Exception {
(null);
().setBackground();
();
(new Rectangle(158, 87, 101, 25));
(new Rectangle(81, 202, 83, 25));
("登录");
(new Adminstrator_jButton1_actionAdapter(this));
(new Rectangle(195, 201, 83, 25));
("取消");
(new Adminstrator_jButton2_actionAdapter(this));
("用户名");
(new Rectangle(78, 87, 49, 25));
("密 码");
(new Rectangle(76, 124, 49, 25));
(new ("宋体", , 20));
("管理员登录");
(new Rectangle(145, 30, 113, 27));
(new Rectangle(158, 123, 101, 25));
getContentPane().add(panel1);
(jLabel3);
(jLabel1);
(jTextField1);
(jButton1);
(jButton2);
(jLabel2);
(jPasswordField1);
}
public void jButton1_actionPerformed(ActionEvent e) {
Vector user=new Vector();
String name = ();
String password = ();
user=_User(name,password);
if(()!=0){
(false);//验证通过隐藏当前窗口
Dialog_enroll dlogen = new Dialog_enroll();
(true);//弹出注册窗口
("注册用户");
}
else{
(this,"用户名或密码不正确,请重新输入","错误
",_MESSAGE);
return;
}
}
public void jButton2_actionPerformed(ActionEvent e) {
(false);
}
}
class Adminstrator_jButton2_actionAdapter implements ActionListener {
private Adminstrator adaptee;
Adminstrator_jButton2_actionAdapter(Adminstrator adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Adminstrator_jButton1_actionAdapter implements ActionListener {
private Adminstrator adaptee;
Adminstrator_jButton1_actionAdapter(Adminstrator adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
类
package ;
import ;
import ;
import ;
import ;
import .*;
import tatale.*;
public class Insert_stock {
public Insert_stock() {
}
private static final String insert1 = "insert
stock(MerchandiseNumber,MerchandiseName,department,number,unitprice,overallmoney,da
ta,paymentdate) values(?,?,?,?,?,?,?,?)";
private static final String insert2 = "insert
Merchandise(MerchandiseNumber,TreatyCode, SortNumber,MerchandiseName,
RetailPrice,MerchandiseSpec, Units,PurchasePrice, CheckTerm, Remark)
values(?,?,?,?,?,?,?,?,?,?)";
private static final String insert3 = "insert
UserManage(cardId,UserName,IDcard,password,CardDate,UserGrade,term,integral,agio,re
mark) values(?,?,?,?,?,?,?,?,?,?)";
private static final String insert4 = "insert sale
(ProductID,SaleDate,Number,Price,Discount,VIP_ID,ProductName)
values(?,?,?,?,?,?,?)";
//商品编号 销售日期 商品
数量 商品单价 折扣 会员卡号 商品名称
private static final String insert5 = "insert
EnterStock(MerNumber,Number,PurchasePrice,PutData,StoreHouse_ID,dealWithHuman,downN
ame,inout) values(?,?,?,?,?,?,?,?)";
private static final String insert6 = "insert
BackSale(Product_ID,ProductName,Number,Price,JtDate,SuperMarket,NextBack,reason)
values(?,?,?,?,?,?,?,?)";
public static int Insert_stock(String MerchandiseNumber,
String MerchandiseName,
String department,
String number, String unitprice,
String overallmoney, String date,
String paymentdate) {
int stock = 0;
Connection conn = null;
PreparedStatement pmst = null;
conn = ();
try {
pmst = (insert1);
(1, MerchandiseNumber);
(2, MerchandiseName);
(3, department);
(4, number);
(5, unitprice);
(6, overallmoney);
(7, date);
(8, paymentdate);
stock = ();
} catch (SQLException ex) {
();
} finally {
try {
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return stock;
}
public static int Insert_merchandise(String MerchandiseNumber,String TreatyCode,
String SortNumber,String MerchandiseName, double RetailPrice,String
MerchandiseSpec,String Units,double PurchasePrice, double CheckTerm,String Remark)
{
int stock = 0;
Connection conn = null;
PreparedStatement pmst = null;
conn = ();
try {
pmst = (insert2);
(1, MerchandiseNumber);
(2, TreatyCode);
(3, SortNumber);
(4, MerchandiseName);
(5, RetailPrice);
(6, MerchandiseSpec);
(7, Units);
(8, PurchasePrice);
(9, CheckTerm);
(10, Remark);
stock = ();
} catch (SQLException ex) {
();
} finally {
try {
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return stock;
}
public static int Insert_User(String cardId, String name, String IDcard,
String password, String CardDate,
String UserGrade, String term,
String integral, String agio, String remark) {
int insert_User=0;
Connection conn=null;
PreparedStatement pmst =null;
conn=();
try {
pmst = (insert3);
(1,cardId);
(2,name);
(3,IDcard);
(4,password);
(5,CardDate);
(6,UserGrade);
(7,term);
(8,integral);
(9,agio);
(10,remark);
insert_User=();
} catch (SQLException ex) {
();
}finally {
try {
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return insert_User;
}
public static int Insert_Sale(String Product_ID,String SaleDate,int
Number,double Price,String Discount,String VIP_ID,String ProductName) {
int insert_Sale=0;
Connection conn=null;
PreparedStatement pmst =null;
conn=();
try {
pmst = (insert4);
(1,Product_ID);
(2,SaleDate);
(3,Number);
(4,Price);
(5,Discount);
(6,VIP_ID);
(7,ProductName);
insert_Sale=();
} catch (SQLException ex) {
();
}finally {
try {
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return insert_Sale;
}
public static int Insert_EnterStock(String MerNumber,int Number,double
PurchasePrice,String PutData,String StoreHouse_ID,String dealWithHuman,String
downName,String inout) {
int insert_EnterStock=0;
Connection conn=null;
PreparedStatement pmst =null;
conn=();
try {
pmst = (insert5);
(1,MerNumber);
(2,Number);
(3,PurchasePrice);
(4,PutData);
(5,StoreHouse_ID);
(6,dealWithHuman);
(7,downName);
(8,inout);
insert_EnterStock=();
} catch (SQLException ex) {
();
}finally {
try {
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return insert_EnterStock;
}
public static int Insert_NextBackStock(String Product_ID,String
ProductName,double Number,double Price,String JtDate,String SuperMarket,String
NextBack,String reason) {
int insert_NextBackStock=0;
Connection conn=null;
PreparedStatement pmst =null;
conn=();
try {
pmst = (insert6);
(1,Product_ID);
(2,ProductName);
(3,Number);
(4,Price);
(5,JtDate);
(6,SuperMarket);
(7,NextBack);
(8,reason);
insert_NextBackStock=();
} catch (SQLException ex) {
();
}finally {
try {
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return insert_NextBackStock;
}
}
类
package ;
import ;
import ;
import ;
import ;
import ;
import _Means;
import .*;
public class UpdateData {
public UpdateData() {
}
private static final String Update1 =
"Update UserManage set
UserName=?,IDcard=?,password=?,CardDate=?,UserGrade=?,term=?,integral=?,agio=?,rema
rk=? where cardId=?";
private static final String Update2 ="update StockPile set number=? where
MerchandiseNumber=?";
public static int UpdateCard(String cardId, String name, String IDcard,
String password, String CardDate,
String UserGrade, String term,
String integral, String agio, String remark) {
int i = 0;
Connection conn = null;
PreparedStatement pmst = null;
conn = ();
try {
pmst = (Update1);
(10, cardId);
(1, name);
(2, IDcard);
(3, password);
(4, CardDate);
(5, UserGrade);
(6, term);
(7, integral);
(8, agio);
(9, remark);
i = ();
} catch (SQLException ex) {
();
} finally {
try {
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return i;
}
public static int out_StockPile(int number, String MerchandiseNumber) {
int i = 0;
int updatenumber=0;
updatenumber= _StockPile(MerchandiseNumber);
updatenumber-=number;
Connection conn = null;
PreparedStatement pmst = null;
conn = ();
try {
pmst = (Update2);
(1, updatenumber);
(2, MerchandiseNumber);
i = ();
} catch (SQLException ex) {
();
} finally {
try {
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return i;
}
public static int in_StockPile(int number, String MerchandiseNumber) {
int i = 0;
int updatenumber=0;
updatenumber= _StockPile(MerchandiseNumber);
updatenumber+=number;
Connection conn = null;
PreparedStatement pmst = null;
conn = ();
try {
pmst = (Update2);
(1, updatenumber);
(2, MerchandiseNumber);
i = ();
} catch (SQLException ex) {
();
} finally {
try {
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return i;
}
}
类
package ;
import ;
import .*;
import tatale.*;
import ;
public class Select_Means {
private static final String select1 =
"select * from Merchandise where SortNumber=?";
private static final String select2 =
"select * from Merchandise where MerchandiseNumber=?";
private static final String select3 =
"select * from Merchandise where MerchandiseName=?";
private static final String select4 =
"select * from Merchandise where TreatyCode=?";
private static final String select5 =
"select * from UserManage where CardId=? ";
private static final String select6 =
"select * from UserManage where UserName=? and Password=? and
UserGrade=?";
private static final String select7 =
"select * from BackSale where NextBack=?";
private static final String select8 =
"select * from BackSale where Product_ID=? and NextBack=?";
private static final String select9 =
"select number from StockPile where MerchandiseNumber=?";
private static final String select10 =
"select * from StockPile where MerchandiseNumber=?";
private static final String select11 =
"select * from StockPile";
public Select_Means() {
}
public static Vector tablehead() {
Vector dqname = new Vector();
("商品编码");
("条型码");
("类别编号");
("商品名称");
("零售价(元)");
("商品规格");
("计量单位");
("进货价");
("备注");
return dqname;
}
public static Vector Select_sort1(String number) { //商品类别查询
Connection conn = null;
PreparedStatement pmst = null;
ResultSet rs = null;
Vector vector2 = new Vector();
conn = ();
try {
pmst = (select1);
(1, number);
rs = ();
while (()) {
Vector vector1 = new Vector();
((2));
((3));
((4));
((5));
((6));
((7));
((8));
((9));
((11));
(vector1);
}
} catch (SQLException ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return vector2;
}
public static Vector Select_sort2(String number) { //按商品编号查询
Connection conn = null;
PreparedStatement pmst = null;
ResultSet rs = null;
Vector vector2 = new Vector();
conn = ();
try {
pmst = (select2);
(1, number);
rs = ();
while (()) {
Vector vector1 = new Vector();
((2));
((3));
((4));
((5));
((6));
((7));
((8));
((9));
((11));
(vector1);
}
} catch (SQLException ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return vector2;
}
public static Vector Select_sort3(String number) { //按商品名称查询
Connection conn = null;
PreparedStatement pmst = null;
ResultSet rs = null;
Vector vector2 = new Vector();
conn = ();
try {
pmst = (select3);
(1, number);
rs = ();
while (()) {
Vector vector1 = new Vector();
((2));
((3));
((4));
((5));
((6));
((7));
((8));
((9));
((11));
(vector1);
}
} catch (SQLException ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return vector2;
}
public static Vector Select_sort4(String number) { //按商品条形码查询
Connection conn = null;
PreparedStatement pmst = null;
ResultSet rs = null;
Vector vector2 = new Vector();
conn = ();
try {
pmst = (select4);
(1, number);
rs = ();
while (()) {
Vector vector1 = new Vector();
((2));
((3));
((4));
((5));
((6));
((7));
((8));
((9));
((11));
(vector1);
}
} catch (SQLException ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return vector2;
}
public static Vector Select_User(String name, String password) {//添加/修改用户
Vector vcUser = new Vector();
Connection conn = null;
ResultSet rs = null;
PreparedStatement pmst = null;
try {
conn = ();
pmst = (select6);
(1, name);
(2, password);
(3, "管理员");
rs = ();
();
((1));
((2));
((3));
} catch (Exception ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return vcUser;
}
public static Vector Select_UserManager(String CardId) { //查询卡信息
Vector vcUser = new Vector();
Connection conn = null;
ResultSet rs = null;
PreparedStatement pmst = null;
try {
conn = ();
pmst = (select5);
(1, CardId);
rs = ();
();
((1));
((2));
((3));
((4));
((5));
((6));
((7));
((8));
((9));
((10));
} catch (Exception ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return vcUser;
}
public static Vector Select_inoutSale(String Product_ID, String NextBack) { //
查询进退货信息
Vector vector1 = new Vector();
Vector vector2 = new Vector();
Connection conn = null;
ResultSet rs = null;
PreparedStatement pmst = null;
try {
conn = ();
if (() == 0) {
pmst = (select7);
(1, NextBack);
} else {
pmst = (select8);
(1, Product_ID);
(2, NextBack);
}
rs = ();
();
((2));
((3));
((4));
((5));
((6));
((7));
((8));
((9));
(vector1);
} catch (Exception ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return vector2;
}
public static int Select_StockPile(String Product_ID) { //查询商品库存数量
int number1 = 0;
Connection conn = null;
ResultSet rs = null;
PreparedStatement pmst = null;
try {
conn = ();
pmst = (select9);
(1, Product_ID);
rs = ();
();
String num = (1);
Integer number = new Integer(num);
number1 = number;
} catch (Exception ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return number1;
}
public static Vector Select_repertory(String Product_ID) { //根据商品编码查询库
存
Vector vector2 = new Vector(); //将vector1装入形成一条数据
Connection conn = null;
ResultSet rs = null;
PreparedStatement pmst = null;
try {
conn = ();
pmst = (select10);
(1, Product_ID);
rs = ();
while (()) {
Vector vector1 = new Vector(); //记录查询的数据
Vector vector3 = new Vector(); //接收查询到的商品信息的一条数据
Vector vector4 = new Vector(); //接收vector3中商品的名称
((1));
((2));
vector3 = Select_sort2((2)); //根据商品编号查询商品信息
vector4 = (Vector) (0);
((3).toString());
((3));
(vector1);
}
} catch (Exception ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return vector2;
}
public static Vector Select_All_repertory() { //查询所有库存
Vector vector2 = new Vector(); //将vector1装入形成一条数据
Connection conn = null;
ResultSet rs = null;
PreparedStatement pmst = null;
try {
conn = ();
pmst = (select11);
rs = ();
while (()) {
Vector vector1 = new Vector(); //记录查询的数据
Vector vector3 = new Vector(); //接收查询到的商品信息的一条数据
Vector vector4 = new Vector(); //接收vector3中商品的名称
((1));
((2));
vector3 = Select_sort2((2)); //根据商品编号查询商品
信息
vector4 = (Vector) (0);
((3).toString());
((3));
(vector1);
}
} catch (Exception ex) {
();
} finally {
try {
if (rs != null) {
();
}
if (pmst != null) {
();
}
if (conn != null) {
();
}
} catch (Exception ex1) {
();
}
}
return vector2;
}
}