diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/MyProject-SupermarketSystem.iml b/.idea/MyProject-SupermarketSystem.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/MyProject-SupermarketSystem.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..6560a98 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,36 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d7d11dc --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..00e8e84 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 576c717..4495ac6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,184 @@ -# test +
+ + +## 写在前面 + +初次引入可能会报错,所以食用前请重新引入好三个jar包,都在lib目录下 + +![](https://cdn.jsdelivr.net/gh/lifealsoisgg/MyProject-SupermarketSystem/images/build.jpg) + +其它修改 + +> 1. 修改config/jdbc.properties里面连接mysql数据库的属性值为自己的。 +> +> 2. 进货功能的邮件发送方面,调用的类为**com.lingnan.supermarket.util/SendQQMailUtil.java**,在**com.lingnan.supermarket.view/InView.java**下调用,如图,照着SendQQMailUtil.java的属性修改即可,前提要开通QQEmail的SMTP服务(自行百度),调用位置如图。**请务必使用自己的SMTP服务方便邮件的发送与接收,如果你实在要用我的请务必将收件人邮箱改为自己的,否则你这边是看不到邮件是否发送成功(修改下面第三个参数的邮箱为自己的即可)!!!** +> +> ![image](https://user-images.githubusercontent.com/52524117/161801771-879d0e13-7133-4efb-94a6-d1c0efb3c608.png) + + + +整个项目的运行入口在**com.lingnan.supermarket.view/LoginView.java**下即main函数放的地方 + + + +## 工具&环境tools + +> - 数据库:Mysql5.7 +> - java环境:Java1.8 +> - 编辑器:Eclipse +> - 服务器:Tomcat8 + + + +## 首页home + +
+ + + +## 人员管理manage + +权限0为超管,1为收货员,2为进货员 + +
+ + + +## 进货系统import + +这里在添加要进货物时偷了懒只有选择编号加入。右上角添加按钮即可添加要进的货,右下角第一个按钮就是确认进货,点击后会发送邮件给相应的仓库,公司等,这里只是模拟。 + +`进货流程就是`(理想情况,实际还需看需求) + +> 1. 进货员添加进货商品 +> 2. 确认进货订单后会发送邮件 +> 3. 供货方收到邮件后准备进货 +> 4. 商场收到货,进货员线下清点好后更改订单状态为已入库 +> 5. 系统库存自动增加 + + + +### 添加进货 + +
+ +### 更改进货数量 + +
+ +### 确认进货订单&发送进货邮件 + +
+ + + + +
+
+ + + +### 供货方查看邮件内容 + +没有用到表格或html,只是简单的字符串排版 + +
+ +### 更改进货订单状态 + +模拟当进货成功后,==修改订单状态==为已入库或者已取消,如果已入库后库存数量会自动增加 + +
+ + + + +
+
+ + + +## 收银系统cashier + +也是没扫描机器,所以只能模拟。 + +`收银流程如下` + +> 1. 添加商品,如果库存不够会提示 +> 2. (手动)确认结账 +> 3. 支付成功后库存减少 + + + +### 添加商品 + +
+ +### 库存不够提示 + +
+ +### 收银结账&支付成功 + +
+ + + + +
+
+ + + +### 首页更新 + +
+ + + +## 商品库存storage + +### 总览 + +
+ +### 库存日志 + +#### 进货库存日志 + +
+ + + + +
+
+ + + +#### 收银库存日志 + +
+ + + + +
+
+ + + +## 供应商supplier + +
+ + + +## 商品目录catalog + +
+ + +## 写在最后last +一个很古老的 swing 项目 diff --git a/Supermarket/.classpath b/Supermarket/.classpath new file mode 100644 index 0000000..f2404ae --- /dev/null +++ b/Supermarket/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Supermarket/.idea/.gitignore b/Supermarket/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Supermarket/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Supermarket/.idea/dataSources.local.xml b/Supermarket/.idea/dataSources.local.xml new file mode 100644 index 0000000..4d6a9c3 --- /dev/null +++ b/Supermarket/.idea/dataSources.local.xml @@ -0,0 +1,22 @@ + + + + + + #@ + ` + + + master_key + root + + + + + + + + + + + \ No newline at end of file diff --git a/Supermarket/.idea/dataSources.xml b/Supermarket/.idea/dataSources.xml new file mode 100644 index 0000000..84f5765 --- /dev/null +++ b/Supermarket/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mysql.8 + true + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306 + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml new file mode 100644 index 0000000..905f93f --- /dev/null +++ b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml @@ -0,0 +1,1328 @@ + + + + + lower/lower + InnoDB + InnoDB + |root||root|localhost|ALTER|G +|root||root|localhost|ALTER ROUTINE|G +|root||root|localhost|CREATE|G +|root||root|localhost|CREATE ROUTINE|G +|root||root|localhost|CREATE TABLESPACE|G +|root||root|localhost|CREATE TEMPORARY TABLES|G +|root||root|localhost|CREATE USER|G +|root||root|localhost|CREATE VIEW|G +|root||root|localhost|DELETE|G +|root||root|localhost|DROP|G +|root||root|localhost|EVENT|G +|root||root|localhost|EXECUTE|G +|root||root|localhost|FILE|G +|root||root|localhost|INDEX|G +|root||root|localhost|INSERT|G +|root||root|localhost|LOCK TABLES|G +|root||root|localhost|PROCESS|G +|root||root|localhost|REFERENCES|G +|root||root|localhost|RELOAD|G +|root||root|localhost|REPLICATION CLIENT|G +|root||root|localhost|REPLICATION SLAVE|G +|root||root|localhost|SELECT|G +|root||root|localhost|SHOW DATABASES|G +|root||root|localhost|SHOW VIEW|G +|root||root|localhost|SHUTDOWN|G +|root||mysql.session|localhost|SUPER|G +|root||root|localhost|SUPER|G +|root||root|localhost|TRIGGER|G +|root||root|localhost|UPDATE|G +|root||root|localhost|grant option|G +performance_schema|schema||mysql.session|localhost|SELECT|G +sys|schema||mysql.sys|localhost|TRIGGER|G + 5.7.44 + + + big5 + 1 + + + big5 + + + dec8 + 1 + + + dec8 + + + cp850 + 1 + + + cp850 + + + hp8 + 1 + + + hp8 + + + koi8r + 1 + + + koi8r + + + latin1 + + + latin1 + 1 + + + latin1 + + + latin1 + + + latin1 + + + latin1 + + + latin1 + + + latin1 + + + latin2 + + + latin2 + 1 + + + latin2 + + + latin2 + + + latin2 + + + swe7 + 1 + + + swe7 + + + ascii + 1 + + + ascii + + + ujis + 1 + + + ujis + + + sjis + 1 + + + sjis + + + hebrew + 1 + + + hebrew + + + tis620 + 1 + + + tis620 + + + euckr + 1 + + + euckr + + + koi8u + 1 + + + koi8u + + + gb2312 + 1 + + + gb2312 + + + greek + 1 + + + greek + + + cp1250 + 1 + + + cp1250 + + + cp1250 + + + cp1250 + + + cp1250 + + + gbk + 1 + + + gbk + + + latin5 + 1 + + + latin5 + + + armscii8 + 1 + + + armscii8 + + + utf8 + 1 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + ucs2 + 1 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + cp866 + 1 + + + cp866 + + + keybcs2 + 1 + + + keybcs2 + + + macce + 1 + + + macce + + + macroman + 1 + + + macroman + + + cp852 + 1 + + + cp852 + + + latin7 + + + latin7 + 1 + + + latin7 + + + latin7 + + + utf8mb4 + 1 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + cp1251 + + + cp1251 + + + cp1251 + + + cp1251 + 1 + + + cp1251 + + + utf16 + 1 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16le + 1 + + + utf16le + + + cp1256 + 1 + + + cp1256 + + + cp1257 + + + cp1257 + + + cp1257 + 1 + + + utf32 + 1 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + binary + 1 + + + geostd8 + 1 + + + geostd8 + + + cp932 + 1 + + + cp932 + + + eucjpms + 1 + + + eucjpms + + + gb18030 + 1 + + + gb18030 + + + gb18030 + + + utf8_general_ci + + + latin1_swedish_ci + + + utf8_general_ci + + + latin1_swedish_ci + + + utf8_general_ci + + + utf8mb4_general_ci + + + utf8mb4_unicode_ci + + + localhost + + + localhost + + + localhost + + + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + varchar(20)|0s + 1 + 1 + + + varchar(20)|0s + 2 + + + float|0s + 3 + + + float|0s + 4 + + + int(11)|0s + 5 + + + int(11)|0s + 6 + + + int(11)|0s + 7 + + + varchar(20)|0s + 8 + + + varchar(20)|0s + 9 + + + float|0s + 10 + + + int(11)|0s + 0 + 11 + + + supplyId + id + supplierinf + + + id2 + id + prodcatalog + + + id + btree + 1 + + + name + btree + 1 + + + supplyId + btree + + + id2 + btree + + + 1 + 1 + PRIMARY + + + name + + + varchar(30)|0s + 1 + 1 + + + float|0s + 2 + + + timestamp|0s + CURRENT_TIMESTAMP + 1 + CURRENT_TIMESTAMP + 3 + + + varchar(15)|0s + 4 + + + int(11)|0s + 2 + 5 + + + int(11)|0s + 1 + 6 + + + iNumber + btree + 1 + + + 1 + 1 + PRIMARY + + + varchar(30)|0s + 1 + + + varchar(20)|0s + 2 + + + int(11)|0s + 3 + + + float|0s + 4 + + + iNumber + iNumber + inorder + + + iNumber + btree + + + varchar(20)|0s + 1 + 1 + + + varchar(20)|0s + 2 + + + float|0s + 3 + + + float|0s + 4 + + + int(11)|0s + 5 + + + int(11)|0s + 6 + + + int(11)|0s + 7 + + + varchar(20)|0s + 8 + + + varchar(20)|0s + 9 + + + float|0s + 10 + + + int(11)|0s + 0 + 11 + + + supplyId + id + supplierinf + + + id2 + id + prodcatalog + + + id + btree + 1 + + + name + btree + 1 + + + supplyId + btree + + + id2 + btree + + + 1 + 1 + PRIMARY + + + name + + + varchar(30)|0s + 1 + 1 + + + float|0s + 2 + + + timestamp|0s + CURRENT_TIMESTAMP + 1 + CURRENT_TIMESTAMP + 3 + + + varchar(15)|0s + 4 + + + int(11)|0s + 1 + 5 + + + oNumber + btree + 1 + + + 1 + 1 + PRIMARY + + + varchar(30)|0s + 1 + + + varchar(20)|0s + 2 + + + int(11)|0s + 3 + + + float|0s + 4 + + + oNumber + oNumber + outorder + + + oNumber + btree + + + varchar(20)|0s + 1 + 1 + + + varchar(20)|0s + 2 + + + id + btree + 1 + + + 1 + 1 + PRIMARY + + + varchar(20)|0s + 1 + 1 + + + varchar(20)|0s + 2 + + + float|0s + 3 + + + float|0s + 4 + + + int(11)|0s + 5 + + + int(11)|0s + 6 + + + int(11)|0s + 7 + + + varchar(20)|0s + 8 + + + varchar(20)|0s + 9 + + + float|0s + 10 + + + int(11)|0s + 1 + 11 + + + id2 + id + prodcatalog + + + id + btree + 1 + + + name + btree + 1 + + + id2 + btree + + + 1 + 1 + PRIMARY + + + name + + + varchar(30)|0s + 1 + + + timestamp|0s + CURRENT_TIMESTAMP + 1 + CURRENT_TIMESTAMP + 2 + + + varchar(20)|0s + 3 + + + enum('+', '-')|0e + 4 + + + int(11)|0s + 5 + + + 9 + int(11)|0s + 1 + 1 + + + varchar(30)|0s + 2 + + + varchar(50)|0s + 3 + + + varchar(11)|0s + 4 + + + varchar(50)|0s + 5 + + + int(11)|0s + 1 + 6 + + + id + btree + 1 + + + name + btree + 1 + + + 1 + 1 + PRIMARY + + + name + + + 6 + int(11)|0s + 1 + 1 + + + varchar(15)|0s + 2 + + + varchar(255)|0s + 3 + + + varchar(20)|0s + 1 + 4 + + + varchar(11)|0s + 5 + + + int(11)|0s + 1 + 6 + + + varchar(50)|0s + 7 + + + int(11)|0s + 1 + 8 + + + id + btree + 1 + + + name + btree + 1 + + + 1 + 1 + PRIMARY + + + name + +
+
\ No newline at end of file diff --git a/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/information_schema.FNRwLQ.meta b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/information_schema.FNRwLQ.meta new file mode 100644 index 0000000..1ff3db2 --- /dev/null +++ b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/information_schema.FNRwLQ.meta @@ -0,0 +1,2 @@ +#n:information_schema +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/mysql.osA4Bg.meta b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/mysql.osA4Bg.meta new file mode 100644 index 0000000..86a53f1 --- /dev/null +++ b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/mysql.osA4Bg.meta @@ -0,0 +1,2 @@ +#n:mysql +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/performance_schema.kIw0nw.meta b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/performance_schema.kIw0nw.meta new file mode 100644 index 0000000..9394db1 --- /dev/null +++ b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/performance_schema.kIw0nw.meta @@ -0,0 +1,2 @@ +#n:performance_schema +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/sys.zb4BAA.meta b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/sys.zb4BAA.meta new file mode 100644 index 0000000..2f4470b --- /dev/null +++ b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/sys.zb4BAA.meta @@ -0,0 +1,2 @@ +#n:sys +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/Supermarket/.idea/misc.xml b/Supermarket/.idea/misc.xml new file mode 100644 index 0000000..0f2ad58 --- /dev/null +++ b/Supermarket/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Supermarket/.idea/modules.xml b/Supermarket/.idea/modules.xml new file mode 100644 index 0000000..4b59c4b --- /dev/null +++ b/Supermarket/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Supermarket/.project b/Supermarket/.project new file mode 100644 index 0000000..5933afc --- /dev/null +++ b/Supermarket/.project @@ -0,0 +1,17 @@ + + + Supermarket + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Supermarket/.settings/org.eclipse.core.resources.prefs b/Supermarket/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/Supermarket/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/Supermarket/.settings/org.eclipse.jdt.core.prefs b/Supermarket/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/Supermarket/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Supermarket/Supermarket.iml b/Supermarket/Supermarket.iml new file mode 100644 index 0000000..ae3b314 --- /dev/null +++ b/Supermarket/Supermarket.iml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Supermarket/bin/.classpath b/Supermarket/bin/.classpath new file mode 100644 index 0000000..f2404ae --- /dev/null +++ b/Supermarket/bin/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Supermarket/bin/.idea/.gitignore b/Supermarket/bin/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Supermarket/bin/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Supermarket/bin/.idea/dataSources.local.xml b/Supermarket/bin/.idea/dataSources.local.xml new file mode 100644 index 0000000..4d6a9c3 --- /dev/null +++ b/Supermarket/bin/.idea/dataSources.local.xml @@ -0,0 +1,22 @@ + + + + + + #@ + ` + + + master_key + root + + + + + + + + + + + \ No newline at end of file diff --git a/Supermarket/bin/.idea/dataSources.xml b/Supermarket/bin/.idea/dataSources.xml new file mode 100644 index 0000000..84f5765 --- /dev/null +++ b/Supermarket/bin/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mysql.8 + true + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306 + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml new file mode 100644 index 0000000..905f93f --- /dev/null +++ b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml @@ -0,0 +1,1328 @@ + + + + + lower/lower + InnoDB + InnoDB + |root||root|localhost|ALTER|G +|root||root|localhost|ALTER ROUTINE|G +|root||root|localhost|CREATE|G +|root||root|localhost|CREATE ROUTINE|G +|root||root|localhost|CREATE TABLESPACE|G +|root||root|localhost|CREATE TEMPORARY TABLES|G +|root||root|localhost|CREATE USER|G +|root||root|localhost|CREATE VIEW|G +|root||root|localhost|DELETE|G +|root||root|localhost|DROP|G +|root||root|localhost|EVENT|G +|root||root|localhost|EXECUTE|G +|root||root|localhost|FILE|G +|root||root|localhost|INDEX|G +|root||root|localhost|INSERT|G +|root||root|localhost|LOCK TABLES|G +|root||root|localhost|PROCESS|G +|root||root|localhost|REFERENCES|G +|root||root|localhost|RELOAD|G +|root||root|localhost|REPLICATION CLIENT|G +|root||root|localhost|REPLICATION SLAVE|G +|root||root|localhost|SELECT|G +|root||root|localhost|SHOW DATABASES|G +|root||root|localhost|SHOW VIEW|G +|root||root|localhost|SHUTDOWN|G +|root||mysql.session|localhost|SUPER|G +|root||root|localhost|SUPER|G +|root||root|localhost|TRIGGER|G +|root||root|localhost|UPDATE|G +|root||root|localhost|grant option|G +performance_schema|schema||mysql.session|localhost|SELECT|G +sys|schema||mysql.sys|localhost|TRIGGER|G + 5.7.44 + + + big5 + 1 + + + big5 + + + dec8 + 1 + + + dec8 + + + cp850 + 1 + + + cp850 + + + hp8 + 1 + + + hp8 + + + koi8r + 1 + + + koi8r + + + latin1 + + + latin1 + 1 + + + latin1 + + + latin1 + + + latin1 + + + latin1 + + + latin1 + + + latin1 + + + latin2 + + + latin2 + 1 + + + latin2 + + + latin2 + + + latin2 + + + swe7 + 1 + + + swe7 + + + ascii + 1 + + + ascii + + + ujis + 1 + + + ujis + + + sjis + 1 + + + sjis + + + hebrew + 1 + + + hebrew + + + tis620 + 1 + + + tis620 + + + euckr + 1 + + + euckr + + + koi8u + 1 + + + koi8u + + + gb2312 + 1 + + + gb2312 + + + greek + 1 + + + greek + + + cp1250 + 1 + + + cp1250 + + + cp1250 + + + cp1250 + + + cp1250 + + + gbk + 1 + + + gbk + + + latin5 + 1 + + + latin5 + + + armscii8 + 1 + + + armscii8 + + + utf8 + 1 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + utf8 + + + ucs2 + 1 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + ucs2 + + + cp866 + 1 + + + cp866 + + + keybcs2 + 1 + + + keybcs2 + + + macce + 1 + + + macce + + + macroman + 1 + + + macroman + + + cp852 + 1 + + + cp852 + + + latin7 + + + latin7 + 1 + + + latin7 + + + latin7 + + + utf8mb4 + 1 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + utf8mb4 + + + cp1251 + + + cp1251 + + + cp1251 + + + cp1251 + 1 + + + cp1251 + + + utf16 + 1 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16le + 1 + + + utf16le + + + cp1256 + 1 + + + cp1256 + + + cp1257 + + + cp1257 + + + cp1257 + 1 + + + utf32 + 1 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + binary + 1 + + + geostd8 + 1 + + + geostd8 + + + cp932 + 1 + + + cp932 + + + eucjpms + 1 + + + eucjpms + + + gb18030 + 1 + + + gb18030 + + + gb18030 + + + utf8_general_ci + + + latin1_swedish_ci + + + utf8_general_ci + + + latin1_swedish_ci + + + utf8_general_ci + + + utf8mb4_general_ci + + + utf8mb4_unicode_ci + + + localhost + + + localhost + + + localhost + + + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + InnoDB + utf8mb4_unicode_ci +
+ + varchar(20)|0s + 1 + 1 + + + varchar(20)|0s + 2 + + + float|0s + 3 + + + float|0s + 4 + + + int(11)|0s + 5 + + + int(11)|0s + 6 + + + int(11)|0s + 7 + + + varchar(20)|0s + 8 + + + varchar(20)|0s + 9 + + + float|0s + 10 + + + int(11)|0s + 0 + 11 + + + supplyId + id + supplierinf + + + id2 + id + prodcatalog + + + id + btree + 1 + + + name + btree + 1 + + + supplyId + btree + + + id2 + btree + + + 1 + 1 + PRIMARY + + + name + + + varchar(30)|0s + 1 + 1 + + + float|0s + 2 + + + timestamp|0s + CURRENT_TIMESTAMP + 1 + CURRENT_TIMESTAMP + 3 + + + varchar(15)|0s + 4 + + + int(11)|0s + 2 + 5 + + + int(11)|0s + 1 + 6 + + + iNumber + btree + 1 + + + 1 + 1 + PRIMARY + + + varchar(30)|0s + 1 + + + varchar(20)|0s + 2 + + + int(11)|0s + 3 + + + float|0s + 4 + + + iNumber + iNumber + inorder + + + iNumber + btree + + + varchar(20)|0s + 1 + 1 + + + varchar(20)|0s + 2 + + + float|0s + 3 + + + float|0s + 4 + + + int(11)|0s + 5 + + + int(11)|0s + 6 + + + int(11)|0s + 7 + + + varchar(20)|0s + 8 + + + varchar(20)|0s + 9 + + + float|0s + 10 + + + int(11)|0s + 0 + 11 + + + supplyId + id + supplierinf + + + id2 + id + prodcatalog + + + id + btree + 1 + + + name + btree + 1 + + + supplyId + btree + + + id2 + btree + + + 1 + 1 + PRIMARY + + + name + + + varchar(30)|0s + 1 + 1 + + + float|0s + 2 + + + timestamp|0s + CURRENT_TIMESTAMP + 1 + CURRENT_TIMESTAMP + 3 + + + varchar(15)|0s + 4 + + + int(11)|0s + 1 + 5 + + + oNumber + btree + 1 + + + 1 + 1 + PRIMARY + + + varchar(30)|0s + 1 + + + varchar(20)|0s + 2 + + + int(11)|0s + 3 + + + float|0s + 4 + + + oNumber + oNumber + outorder + + + oNumber + btree + + + varchar(20)|0s + 1 + 1 + + + varchar(20)|0s + 2 + + + id + btree + 1 + + + 1 + 1 + PRIMARY + + + varchar(20)|0s + 1 + 1 + + + varchar(20)|0s + 2 + + + float|0s + 3 + + + float|0s + 4 + + + int(11)|0s + 5 + + + int(11)|0s + 6 + + + int(11)|0s + 7 + + + varchar(20)|0s + 8 + + + varchar(20)|0s + 9 + + + float|0s + 10 + + + int(11)|0s + 1 + 11 + + + id2 + id + prodcatalog + + + id + btree + 1 + + + name + btree + 1 + + + id2 + btree + + + 1 + 1 + PRIMARY + + + name + + + varchar(30)|0s + 1 + + + timestamp|0s + CURRENT_TIMESTAMP + 1 + CURRENT_TIMESTAMP + 2 + + + varchar(20)|0s + 3 + + + enum('+', '-')|0e + 4 + + + int(11)|0s + 5 + + + 9 + int(11)|0s + 1 + 1 + + + varchar(30)|0s + 2 + + + varchar(50)|0s + 3 + + + varchar(11)|0s + 4 + + + varchar(50)|0s + 5 + + + int(11)|0s + 1 + 6 + + + id + btree + 1 + + + name + btree + 1 + + + 1 + 1 + PRIMARY + + + name + + + 6 + int(11)|0s + 1 + 1 + + + varchar(15)|0s + 2 + + + varchar(255)|0s + 3 + + + varchar(20)|0s + 1 + 4 + + + varchar(11)|0s + 5 + + + int(11)|0s + 1 + 6 + + + varchar(50)|0s + 7 + + + int(11)|0s + 1 + 8 + + + id + btree + 1 + + + name + btree + 1 + + + 1 + 1 + PRIMARY + + + name + +
+
\ No newline at end of file diff --git a/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/information_schema.FNRwLQ.meta b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/information_schema.FNRwLQ.meta new file mode 100644 index 0000000..1ff3db2 --- /dev/null +++ b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/information_schema.FNRwLQ.meta @@ -0,0 +1,2 @@ +#n:information_schema +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/mysql.osA4Bg.meta b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/mysql.osA4Bg.meta new file mode 100644 index 0000000..86a53f1 --- /dev/null +++ b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/mysql.osA4Bg.meta @@ -0,0 +1,2 @@ +#n:mysql +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/performance_schema.kIw0nw.meta b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/performance_schema.kIw0nw.meta new file mode 100644 index 0000000..9394db1 --- /dev/null +++ b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/performance_schema.kIw0nw.meta @@ -0,0 +1,2 @@ +#n:performance_schema +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/sys.zb4BAA.meta b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/sys.zb4BAA.meta new file mode 100644 index 0000000..2f4470b --- /dev/null +++ b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec/storage_v2/_src_/schema/sys.zb4BAA.meta @@ -0,0 +1,2 @@ +#n:sys +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/Supermarket/bin/.idea/misc.xml b/Supermarket/bin/.idea/misc.xml new file mode 100644 index 0000000..0f2ad58 --- /dev/null +++ b/Supermarket/bin/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Supermarket/bin/.idea/modules.xml b/Supermarket/bin/.idea/modules.xml new file mode 100644 index 0000000..4b59c4b --- /dev/null +++ b/Supermarket/bin/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Supermarket/bin/.project b/Supermarket/bin/.project new file mode 100644 index 0000000..5933afc --- /dev/null +++ b/Supermarket/bin/.project @@ -0,0 +1,17 @@ + + + Supermarket + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Supermarket/bin/.settings/org.eclipse.core.resources.prefs b/Supermarket/bin/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/Supermarket/bin/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/Supermarket/bin/.settings/org.eclipse.jdt.core.prefs b/Supermarket/bin/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/Supermarket/bin/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Supermarket/bin/Supermarket.iml b/Supermarket/bin/Supermarket.iml new file mode 100644 index 0000000..ae3b314 --- /dev/null +++ b/Supermarket/bin/Supermarket.iml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Supermarket/bin/com/lingnan/supermarket/componet/BGPanel.class b/Supermarket/bin/com/lingnan/supermarket/componet/BGPanel.class new file mode 100644 index 0000000..48fb917 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/componet/BGPanel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/BufferService.class b/Supermarket/bin/com/lingnan/supermarket/dao/BufferService.class new file mode 100644 index 0000000..e2012f8 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/BufferService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/SupplierInfService.class b/Supermarket/bin/com/lingnan/supermarket/dao/SupplierInfService.class new file mode 100644 index 0000000..289ea8f Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/SupplierInfService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/UserService.class b/Supermarket/bin/com/lingnan/supermarket/dao/UserService.class new file mode 100644 index 0000000..b32b0db Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/UserService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/BufferImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/BufferImpl.class new file mode 100644 index 0000000..9f357e5 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/BufferImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/SupplierInfImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/SupplierInfImpl.class new file mode 100644 index 0000000..eb58e55 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/SupplierInfImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/UserServiceImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/UserServiceImpl.class new file mode 100644 index 0000000..600997b Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/UserServiceImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.class new file mode 100644 index 0000000..6eb7a4a Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.class new file mode 100644 index 0000000..92a062b Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/outOrderServiceImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/outOrderServiceImpl.class new file mode 100644 index 0000000..d1062dc Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/outOrderServiceImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.class new file mode 100644 index 0000000..c84096e Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/prodCatalogImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/prodCatalogImpl.class new file mode 100644 index 0000000..fdb1611 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/prodCatalogImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/productionImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/productionImpl.class new file mode 100644 index 0000000..ff1bba4 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/productionImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/storageRecordImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/storageRecordImpl.class new file mode 100644 index 0000000..caa03f0 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/storageRecordImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/inOrderService.class b/Supermarket/bin/com/lingnan/supermarket/dao/inOrderService.class new file mode 100644 index 0000000..d11b0ef Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/inOrderService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/inRecordService.class b/Supermarket/bin/com/lingnan/supermarket/dao/inRecordService.class new file mode 100644 index 0000000..b3fa760 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/inRecordService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/outOrderService.class b/Supermarket/bin/com/lingnan/supermarket/dao/outOrderService.class new file mode 100644 index 0000000..a58d195 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/outOrderService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/outRecordService.class b/Supermarket/bin/com/lingnan/supermarket/dao/outRecordService.class new file mode 100644 index 0000000..69ca6f6 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/outRecordService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/prodCatalogService.class b/Supermarket/bin/com/lingnan/supermarket/dao/prodCatalogService.class new file mode 100644 index 0000000..4a29c86 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/prodCatalogService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/productionService.class b/Supermarket/bin/com/lingnan/supermarket/dao/productionService.class new file mode 100644 index 0000000..daa22fc Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/productionService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/storageRecordService.class b/Supermarket/bin/com/lingnan/supermarket/dao/storageRecordService.class new file mode 100644 index 0000000..eff8d7c Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dao/storageRecordService.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog$MyItemListener.class new file mode 100644 index 0000000..f97e071 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog.class new file mode 100644 index 0000000..1852673 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeSumDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeSumDialog.class new file mode 100644 index 0000000..c835e1e Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeSumDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/CloseDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/CloseDialog.class new file mode 100644 index 0000000..f75dc33 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/CloseDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog$MyItemListener.class new file mode 100644 index 0000000..3584b04 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog.class new file mode 100644 index 0000000..47fd4db Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/OutDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/OutDialog.class new file mode 100644 index 0000000..519f6ff Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/OutDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog$MyItemListener.class new file mode 100644 index 0000000..c5db66f Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog$MyItemListener1.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog$MyItemListener1.class new file mode 100644 index 0000000..dec8820 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog$MyItemListener1.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog.class new file mode 100644 index 0000000..ea8ac5e Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/SupplierInfDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/SupplierInfDialog.class new file mode 100644 index 0000000..bb919d1 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/SupplierInfDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class new file mode 100644 index 0000000..545b75e Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class new file mode 100644 index 0000000..cee959a Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class new file mode 100644 index 0000000..f3a2c27 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class new file mode 100644 index 0000000..b3b2d9f Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/Buffer.class b/Supermarket/bin/com/lingnan/supermarket/dto/Buffer.class new file mode 100644 index 0000000..9064935 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/Buffer.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/InOrder.class b/Supermarket/bin/com/lingnan/supermarket/dto/InOrder.class new file mode 100644 index 0000000..01faf79 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/InOrder.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/InRecord.class b/Supermarket/bin/com/lingnan/supermarket/dto/InRecord.class new file mode 100644 index 0000000..b6d813f Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/InRecord.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/OutOrder.class b/Supermarket/bin/com/lingnan/supermarket/dto/OutOrder.class new file mode 100644 index 0000000..076b370 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/OutOrder.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/OutRecord.class b/Supermarket/bin/com/lingnan/supermarket/dto/OutRecord.class new file mode 100644 index 0000000..b638aa9 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/OutRecord.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/ProdCatalog.class b/Supermarket/bin/com/lingnan/supermarket/dto/ProdCatalog.class new file mode 100644 index 0000000..81f0fdf Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/ProdCatalog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/Production.class b/Supermarket/bin/com/lingnan/supermarket/dto/Production.class new file mode 100644 index 0000000..dc5fc1e Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/Production.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/StorageRecord.class b/Supermarket/bin/com/lingnan/supermarket/dto/StorageRecord.class new file mode 100644 index 0000000..d964bd7 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/StorageRecord.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/SupplierInf.class b/Supermarket/bin/com/lingnan/supermarket/dto/SupplierInf.class new file mode 100644 index 0000000..5f442a4 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/SupplierInf.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/User.class b/Supermarket/bin/com/lingnan/supermarket/dto/User.class new file mode 100644 index 0000000..472ba94 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/User.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/base/BaseDomain.class b/Supermarket/bin/com/lingnan/supermarket/dto/base/BaseDomain.class new file mode 100644 index 0000000..9784ef6 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/base/BaseDomain.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/base/BaseProduction.class b/Supermarket/bin/com/lingnan/supermarket/dto/base/BaseProduction.class new file mode 100644 index 0000000..f07322e Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/base/BaseProduction.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/base/BsDomain.class b/Supermarket/bin/com/lingnan/supermarket/dto/base/BsDomain.class new file mode 100644 index 0000000..c2b6a29 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/dto/base/BsDomain.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/InOrderTM.class b/Supermarket/bin/com/lingnan/supermarket/table/InOrderTM.class new file mode 100644 index 0000000..4e0822f Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/InOrderTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/InRecordTM.class b/Supermarket/bin/com/lingnan/supermarket/table/InRecordTM.class new file mode 100644 index 0000000..c95657a Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/InRecordTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/InTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/InTableModel.class new file mode 100644 index 0000000..1d34276 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/InTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/OutOrderTM.class b/Supermarket/bin/com/lingnan/supermarket/table/OutOrderTM.class new file mode 100644 index 0000000..807961f Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/OutOrderTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/OutRecordTM.class b/Supermarket/bin/com/lingnan/supermarket/table/OutRecordTM.class new file mode 100644 index 0000000..e674d5f Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/OutRecordTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/OutTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/OutTableModel.class new file mode 100644 index 0000000..6190e1b Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/OutTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/ProdCatalogTM.class b/Supermarket/bin/com/lingnan/supermarket/table/ProdCatalogTM.class new file mode 100644 index 0000000..becc853 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/ProdCatalogTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/StorageRecordTM.class b/Supermarket/bin/com/lingnan/supermarket/table/StorageRecordTM.class new file mode 100644 index 0000000..0a91b4d Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/StorageRecordTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/StorageTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/StorageTableModel.class new file mode 100644 index 0000000..74d0fce Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/StorageTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/SupplierTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/SupplierTableModel.class new file mode 100644 index 0000000..bf99e47 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/SupplierTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/UserTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/UserTableModel.class new file mode 100644 index 0000000..9de7223 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/table/UserTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/CreateOrder.class b/Supermarket/bin/com/lingnan/supermarket/utils/CreateOrder.class new file mode 100644 index 0000000..ce8f346 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/CreateOrder.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/DateUtil.class b/Supermarket/bin/com/lingnan/supermarket/utils/DateUtil.class new file mode 100644 index 0000000..1c69283 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/DateUtil.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/EmailTest.class b/Supermarket/bin/com/lingnan/supermarket/utils/EmailTest.class new file mode 100644 index 0000000..41a0d5c Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/EmailTest.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/FontUtil.class b/Supermarket/bin/com/lingnan/supermarket/utils/FontUtil.class new file mode 100644 index 0000000..314feda Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/FontUtil.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/JDBCUtil.class b/Supermarket/bin/com/lingnan/supermarket/utils/JDBCUtil.class new file mode 100644 index 0000000..cd65a76 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/JDBCUtil.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/SendQQMailUtil.class b/Supermarket/bin/com/lingnan/supermarket/utils/SendQQMailUtil.class new file mode 100644 index 0000000..2dfd88d Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/SendQQMailUtil.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/Test.class b/Supermarket/bin/com/lingnan/supermarket/utils/Test.class new file mode 100644 index 0000000..689a24d Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/Test.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/TimeAndOrder.class b/Supermarket/bin/com/lingnan/supermarket/utils/TimeAndOrder.class new file mode 100644 index 0000000..61597cc Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/TimeAndOrder.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest$1.class b/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest$1.class new file mode 100644 index 0000000..4f46f87 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest$1.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest.class b/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest.class new file mode 100644 index 0000000..85f0006 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/Demo4$1.class b/Supermarket/bin/com/lingnan/supermarket/view/Demo4$1.class new file mode 100644 index 0000000..191fa02 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/Demo4$1.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/Demo4.class b/Supermarket/bin/com/lingnan/supermarket/view/Demo4.class new file mode 100644 index 0000000..cf447ff Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/Demo4.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/HomeView$1.class b/Supermarket/bin/com/lingnan/supermarket/view/HomeView$1.class new file mode 100644 index 0000000..b8f5682 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/HomeView$1.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/HomeView.class b/Supermarket/bin/com/lingnan/supermarket/view/HomeView.class new file mode 100644 index 0000000..48591f1 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/HomeView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/InView$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/view/InView$MyItemListener.class new file mode 100644 index 0000000..d229f62 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/InView$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/InView.class b/Supermarket/bin/com/lingnan/supermarket/view/InView.class new file mode 100644 index 0000000..b79f969 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/InView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/LoginView.class b/Supermarket/bin/com/lingnan/supermarket/view/LoginView.class new file mode 100644 index 0000000..0363364 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/LoginView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/MainView.class b/Supermarket/bin/com/lingnan/supermarket/view/MainView.class new file mode 100644 index 0000000..9184f41 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/MainView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/Nimbus.class b/Supermarket/bin/com/lingnan/supermarket/view/Nimbus.class new file mode 100644 index 0000000..8416915 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/Nimbus.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/OutView.class b/Supermarket/bin/com/lingnan/supermarket/view/OutView.class new file mode 100644 index 0000000..6e07973 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/OutView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView$MyItemListener.class new file mode 100644 index 0000000..d5cd8dd Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView.class b/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView.class new file mode 100644 index 0000000..ad04087 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/StorageView.class b/Supermarket/bin/com/lingnan/supermarket/view/StorageView.class new file mode 100644 index 0000000..33c5f3e Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/StorageView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/SuperView.class b/Supermarket/bin/com/lingnan/supermarket/view/SuperView.class new file mode 100644 index 0000000..97a7513 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/SuperView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/SupplierView.class b/Supermarket/bin/com/lingnan/supermarket/view/SupplierView.class new file mode 100644 index 0000000..5e35ec5 Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/SupplierView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/UserView.class b/Supermarket/bin/com/lingnan/supermarket/view/UserView.class new file mode 100644 index 0000000..2de250a Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/UserView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/base/BaseView.class b/Supermarket/bin/com/lingnan/supermarket/view/base/BaseView.class new file mode 100644 index 0000000..58f926a Binary files /dev/null and b/Supermarket/bin/com/lingnan/supermarket/view/base/BaseView.class differ diff --git a/Supermarket/bin/config/jdbc.properties b/Supermarket/bin/config/jdbc.properties new file mode 100644 index 0000000..f14ded9 --- /dev/null +++ b/Supermarket/bin/config/jdbc.properties @@ -0,0 +1,4 @@ +driver=com.mysql.jdbc.Driver +url=jdbc:mysql://localhost:3306/supermarket +user=root +password=123456 \ No newline at end of file diff --git a/Supermarket/bin/jdbc.properties b/Supermarket/bin/jdbc.properties new file mode 100644 index 0000000..f14ded9 --- /dev/null +++ b/Supermarket/bin/jdbc.properties @@ -0,0 +1,4 @@ +driver=com.mysql.jdbc.Driver +url=jdbc:mysql://localhost:3306/supermarket +user=root +password=123456 \ No newline at end of file diff --git a/Supermarket/bin/lib/activation.jar b/Supermarket/bin/lib/activation.jar new file mode 100644 index 0000000..29a59a9 Binary files /dev/null and b/Supermarket/bin/lib/activation.jar differ diff --git a/Supermarket/bin/lib/mail.jar b/Supermarket/bin/lib/mail.jar new file mode 100644 index 0000000..5954377 Binary files /dev/null and b/Supermarket/bin/lib/mail.jar differ diff --git a/Supermarket/bin/lib/mysql-connector-java-5.1.32.jar b/Supermarket/bin/lib/mysql-connector-java-5.1.32.jar new file mode 100644 index 0000000..f82dd98 Binary files /dev/null and b/Supermarket/bin/lib/mysql-connector-java-5.1.32.jar differ diff --git a/Supermarket/bin/static/bg/bg0.jpg b/Supermarket/bin/static/bg/bg0.jpg new file mode 100644 index 0000000..28409ee Binary files /dev/null and b/Supermarket/bin/static/bg/bg0.jpg differ diff --git a/Supermarket/bin/static/bg/bg1.jpg b/Supermarket/bin/static/bg/bg1.jpg new file mode 100644 index 0000000..5187193 Binary files /dev/null and b/Supermarket/bin/static/bg/bg1.jpg differ diff --git a/Supermarket/bin/static/bg/bg2.jpg b/Supermarket/bin/static/bg/bg2.jpg new file mode 100644 index 0000000..5fcffa2 Binary files /dev/null and b/Supermarket/bin/static/bg/bg2.jpg differ diff --git a/Supermarket/bin/static/bg/bg3.jpg b/Supermarket/bin/static/bg/bg3.jpg new file mode 100644 index 0000000..f195e6a Binary files /dev/null and b/Supermarket/bin/static/bg/bg3.jpg differ diff --git a/Supermarket/bin/static/bg/bg4.jpg b/Supermarket/bin/static/bg/bg4.jpg new file mode 100644 index 0000000..35604c2 Binary files /dev/null and b/Supermarket/bin/static/bg/bg4.jpg differ diff --git a/Supermarket/bin/static/bg/bg5.jpg b/Supermarket/bin/static/bg/bg5.jpg new file mode 100644 index 0000000..85e9554 Binary files /dev/null and b/Supermarket/bin/static/bg/bg5.jpg differ diff --git a/Supermarket/bin/static/bg/bg6.jpg b/Supermarket/bin/static/bg/bg6.jpg new file mode 100644 index 0000000..cc3bc8c Binary files /dev/null and b/Supermarket/bin/static/bg/bg6.jpg differ diff --git a/Supermarket/bin/static/bg/bg7.jpg b/Supermarket/bin/static/bg/bg7.jpg new file mode 100644 index 0000000..f13a4c6 Binary files /dev/null and b/Supermarket/bin/static/bg/bg7.jpg differ diff --git a/Supermarket/bin/static/bg/bg8.jpg b/Supermarket/bin/static/bg/bg8.jpg new file mode 100644 index 0000000..afe3074 Binary files /dev/null and b/Supermarket/bin/static/bg/bg8.jpg differ diff --git a/Supermarket/bin/static/bg/bg9.jpg b/Supermarket/bin/static/bg/bg9.jpg new file mode 100644 index 0000000..5650f6a Binary files /dev/null and b/Supermarket/bin/static/bg/bg9.jpg differ diff --git a/Supermarket/bin/static/bg/bgLogin.jpg b/Supermarket/bin/static/bg/bgLogin.jpg new file mode 100644 index 0000000..4dab570 Binary files /dev/null and b/Supermarket/bin/static/bg/bgLogin.jpg differ diff --git a/Supermarket/bin/static/icon/account.png b/Supermarket/bin/static/icon/account.png new file mode 100644 index 0000000..7bbf595 Binary files /dev/null and b/Supermarket/bin/static/icon/account.png differ diff --git a/Supermarket/bin/static/icon/add.png b/Supermarket/bin/static/icon/add.png new file mode 100644 index 0000000..3b80464 Binary files /dev/null and b/Supermarket/bin/static/icon/add.png differ diff --git a/Supermarket/bin/static/icon/admin.png b/Supermarket/bin/static/icon/admin.png new file mode 100644 index 0000000..53750c2 Binary files /dev/null and b/Supermarket/bin/static/icon/admin.png differ diff --git a/Supermarket/bin/static/icon/back.png b/Supermarket/bin/static/icon/back.png new file mode 100644 index 0000000..31e6008 Binary files /dev/null and b/Supermarket/bin/static/icon/back.png differ diff --git a/Supermarket/bin/static/icon/carrier.png b/Supermarket/bin/static/icon/carrier.png new file mode 100644 index 0000000..399f102 Binary files /dev/null and b/Supermarket/bin/static/icon/carrier.png differ diff --git a/Supermarket/bin/static/icon/cashier.png b/Supermarket/bin/static/icon/cashier.png new file mode 100644 index 0000000..74fb48a Binary files /dev/null and b/Supermarket/bin/static/icon/cashier.png differ diff --git a/Supermarket/bin/static/icon/catalog1.png b/Supermarket/bin/static/icon/catalog1.png new file mode 100644 index 0000000..f376e45 Binary files /dev/null and b/Supermarket/bin/static/icon/catalog1.png differ diff --git a/Supermarket/bin/static/icon/catalog2.png b/Supermarket/bin/static/icon/catalog2.png new file mode 100644 index 0000000..02a4aaf Binary files /dev/null and b/Supermarket/bin/static/icon/catalog2.png differ diff --git a/Supermarket/bin/static/icon/change.png b/Supermarket/bin/static/icon/change.png new file mode 100644 index 0000000..5329759 Binary files /dev/null and b/Supermarket/bin/static/icon/change.png differ diff --git a/Supermarket/bin/static/icon/complaints.png b/Supermarket/bin/static/icon/complaints.png new file mode 100644 index 0000000..7955fc2 Binary files /dev/null and b/Supermarket/bin/static/icon/complaints.png differ diff --git a/Supermarket/bin/static/icon/delete.png b/Supermarket/bin/static/icon/delete.png new file mode 100644 index 0000000..f04a256 Binary files /dev/null and b/Supermarket/bin/static/icon/delete.png differ diff --git a/Supermarket/bin/static/icon/detail.png b/Supermarket/bin/static/icon/detail.png new file mode 100644 index 0000000..826f6c6 Binary files /dev/null and b/Supermarket/bin/static/icon/detail.png differ diff --git a/Supermarket/bin/static/icon/email.png b/Supermarket/bin/static/icon/email.png new file mode 100644 index 0000000..7243017 Binary files /dev/null and b/Supermarket/bin/static/icon/email.png differ diff --git a/Supermarket/bin/static/icon/exit.png b/Supermarket/bin/static/icon/exit.png new file mode 100644 index 0000000..5b5dbff Binary files /dev/null and b/Supermarket/bin/static/icon/exit.png differ diff --git a/Supermarket/bin/static/icon/history.png b/Supermarket/bin/static/icon/history.png new file mode 100644 index 0000000..a94fdf8 Binary files /dev/null and b/Supermarket/bin/static/icon/history.png differ diff --git a/Supermarket/bin/static/icon/home1.png b/Supermarket/bin/static/icon/home1.png new file mode 100644 index 0000000..96bdc41 Binary files /dev/null and b/Supermarket/bin/static/icon/home1.png differ diff --git a/Supermarket/bin/static/icon/home2.png b/Supermarket/bin/static/icon/home2.png new file mode 100644 index 0000000..13530a7 Binary files /dev/null and b/Supermarket/bin/static/icon/home2.png differ diff --git a/Supermarket/bin/static/icon/in1.png b/Supermarket/bin/static/icon/in1.png new file mode 100644 index 0000000..577c9cc Binary files /dev/null and b/Supermarket/bin/static/icon/in1.png differ diff --git a/Supermarket/bin/static/icon/in2.png b/Supermarket/bin/static/icon/in2.png new file mode 100644 index 0000000..a217380 Binary files /dev/null and b/Supermarket/bin/static/icon/in2.png differ diff --git a/Supermarket/bin/static/icon/income.png b/Supermarket/bin/static/icon/income.png new file mode 100644 index 0000000..e29cece Binary files /dev/null and b/Supermarket/bin/static/icon/income.png differ diff --git a/Supermarket/bin/static/icon/loginName.png b/Supermarket/bin/static/icon/loginName.png new file mode 100644 index 0000000..a9caab9 Binary files /dev/null and b/Supermarket/bin/static/icon/loginName.png differ diff --git a/Supermarket/bin/static/icon/logo.png b/Supermarket/bin/static/icon/logo.png new file mode 100644 index 0000000..037abd6 Binary files /dev/null and b/Supermarket/bin/static/icon/logo.png differ diff --git a/Supermarket/bin/static/icon/money.png b/Supermarket/bin/static/icon/money.png new file mode 100644 index 0000000..6c5a434 Binary files /dev/null and b/Supermarket/bin/static/icon/money.png differ diff --git a/Supermarket/bin/static/icon/out1.png b/Supermarket/bin/static/icon/out1.png new file mode 100644 index 0000000..d61adec Binary files /dev/null and b/Supermarket/bin/static/icon/out1.png differ diff --git a/Supermarket/bin/static/icon/out2.png b/Supermarket/bin/static/icon/out2.png new file mode 100644 index 0000000..1982089 Binary files /dev/null and b/Supermarket/bin/static/icon/out2.png differ diff --git a/Supermarket/bin/static/icon/pwd.png b/Supermarket/bin/static/icon/pwd.png new file mode 100644 index 0000000..18c979a Binary files /dev/null and b/Supermarket/bin/static/icon/pwd.png differ diff --git a/Supermarket/bin/static/icon/refresh.png b/Supermarket/bin/static/icon/refresh.png new file mode 100644 index 0000000..2358f69 Binary files /dev/null and b/Supermarket/bin/static/icon/refresh.png differ diff --git a/Supermarket/bin/static/icon/remind1.png b/Supermarket/bin/static/icon/remind1.png new file mode 100644 index 0000000..252f9f3 Binary files /dev/null and b/Supermarket/bin/static/icon/remind1.png differ diff --git a/Supermarket/bin/static/icon/remind2.png b/Supermarket/bin/static/icon/remind2.png new file mode 100644 index 0000000..2b39e46 Binary files /dev/null and b/Supermarket/bin/static/icon/remind2.png differ diff --git a/Supermarket/bin/static/icon/search.png b/Supermarket/bin/static/icon/search.png new file mode 100644 index 0000000..19f34a1 Binary files /dev/null and b/Supermarket/bin/static/icon/search.png differ diff --git a/Supermarket/bin/static/icon/setting.png b/Supermarket/bin/static/icon/setting.png new file mode 100644 index 0000000..c3b401d Binary files /dev/null and b/Supermarket/bin/static/icon/setting.png differ diff --git a/Supermarket/bin/static/icon/skin.png b/Supermarket/bin/static/icon/skin.png new file mode 100644 index 0000000..3a2bbfc Binary files /dev/null and b/Supermarket/bin/static/icon/skin.png differ diff --git a/Supermarket/bin/static/icon/stock.png b/Supermarket/bin/static/icon/stock.png new file mode 100644 index 0000000..de04391 Binary files /dev/null and b/Supermarket/bin/static/icon/stock.png differ diff --git a/Supermarket/bin/static/icon/storage1.png b/Supermarket/bin/static/icon/storage1.png new file mode 100644 index 0000000..79e7f0e Binary files /dev/null and b/Supermarket/bin/static/icon/storage1.png differ diff --git a/Supermarket/bin/static/icon/storage2.png b/Supermarket/bin/static/icon/storage2.png new file mode 100644 index 0000000..2744f4f Binary files /dev/null and b/Supermarket/bin/static/icon/storage2.png differ diff --git a/Supermarket/bin/static/icon/supplier1.png b/Supermarket/bin/static/icon/supplier1.png new file mode 100644 index 0000000..676aa82 Binary files /dev/null and b/Supermarket/bin/static/icon/supplier1.png differ diff --git a/Supermarket/bin/static/icon/supplier2.png b/Supermarket/bin/static/icon/supplier2.png new file mode 100644 index 0000000..e0901df Binary files /dev/null and b/Supermarket/bin/static/icon/supplier2.png differ diff --git a/Supermarket/bin/static/icon/update.png b/Supermarket/bin/static/icon/update.png new file mode 100644 index 0000000..2a0cb73 Binary files /dev/null and b/Supermarket/bin/static/icon/update.png differ diff --git a/Supermarket/bin/static/icon/user1.png b/Supermarket/bin/static/icon/user1.png new file mode 100644 index 0000000..58c3eb2 Binary files /dev/null and b/Supermarket/bin/static/icon/user1.png differ diff --git a/Supermarket/bin/static/icon/user2.png b/Supermarket/bin/static/icon/user2.png new file mode 100644 index 0000000..291422e Binary files /dev/null and b/Supermarket/bin/static/icon/user2.png differ diff --git a/Supermarket/bin/static/icon/新.png b/Supermarket/bin/static/icon/新.png new file mode 100644 index 0000000..68b2b31 Binary files /dev/null and b/Supermarket/bin/static/icon/新.png differ diff --git a/Supermarket/bin/static/img/3.png b/Supermarket/bin/static/img/3.png new file mode 100644 index 0000000..1c55592 Binary files /dev/null and b/Supermarket/bin/static/img/3.png differ diff --git a/Supermarket/bin/static/userimg/u1.png b/Supermarket/bin/static/userimg/u1.png new file mode 100644 index 0000000..4bae0d2 Binary files /dev/null and b/Supermarket/bin/static/userimg/u1.png differ diff --git a/Supermarket/bin/static/userimg/u2.png b/Supermarket/bin/static/userimg/u2.png new file mode 100644 index 0000000..1db27a0 Binary files /dev/null and b/Supermarket/bin/static/userimg/u2.png differ diff --git a/Supermarket/bin/static/userimg/u3.png b/Supermarket/bin/static/userimg/u3.png new file mode 100644 index 0000000..cae9c79 Binary files /dev/null and b/Supermarket/bin/static/userimg/u3.png differ diff --git a/Supermarket/bin/static/userimg/u4.png b/Supermarket/bin/static/userimg/u4.png new file mode 100644 index 0000000..3a0ce7a Binary files /dev/null and b/Supermarket/bin/static/userimg/u4.png differ diff --git a/Supermarket/bin/static/userimg/u5.png b/Supermarket/bin/static/userimg/u5.png new file mode 100644 index 0000000..466efcc Binary files /dev/null and b/Supermarket/bin/static/userimg/u5.png differ diff --git a/Supermarket/bin/static/轮播/00.jpg b/Supermarket/bin/static/轮播/00.jpg new file mode 100644 index 0000000..b59025c Binary files /dev/null and b/Supermarket/bin/static/轮播/00.jpg differ diff --git a/Supermarket/bin/static/轮播/01.jpg b/Supermarket/bin/static/轮播/01.jpg new file mode 100644 index 0000000..3fd3e74 Binary files /dev/null and b/Supermarket/bin/static/轮播/01.jpg differ diff --git a/Supermarket/bin/static/轮播/02.jpg b/Supermarket/bin/static/轮播/02.jpg new file mode 100644 index 0000000..b6eae27 Binary files /dev/null and b/Supermarket/bin/static/轮播/02.jpg differ diff --git a/Supermarket/bin/static/轮播/03.jpg b/Supermarket/bin/static/轮播/03.jpg new file mode 100644 index 0000000..6be1884 Binary files /dev/null and b/Supermarket/bin/static/轮播/03.jpg differ diff --git a/Supermarket/bin/static/轮播/04.jpg b/Supermarket/bin/static/轮播/04.jpg new file mode 100644 index 0000000..8e35e6f Binary files /dev/null and b/Supermarket/bin/static/轮播/04.jpg differ diff --git a/Supermarket/bin/static/轮播/05.jpg b/Supermarket/bin/static/轮播/05.jpg new file mode 100644 index 0000000..95aa25c Binary files /dev/null and b/Supermarket/bin/static/轮播/05.jpg differ diff --git a/Supermarket/bin/static/轮播/06.jpg b/Supermarket/bin/static/轮播/06.jpg new file mode 100644 index 0000000..221f52e Binary files /dev/null and b/Supermarket/bin/static/轮播/06.jpg differ diff --git a/Supermarket/config/jdbc.properties b/Supermarket/config/jdbc.properties new file mode 100644 index 0000000..f14ded9 --- /dev/null +++ b/Supermarket/config/jdbc.properties @@ -0,0 +1,4 @@ +driver=com.mysql.jdbc.Driver +url=jdbc:mysql://localhost:3306/supermarket +user=root +password=123456 \ No newline at end of file diff --git a/Supermarket/lib/activation.jar b/Supermarket/lib/activation.jar new file mode 100644 index 0000000..29a59a9 Binary files /dev/null and b/Supermarket/lib/activation.jar differ diff --git a/Supermarket/lib/mail.jar b/Supermarket/lib/mail.jar new file mode 100644 index 0000000..5954377 Binary files /dev/null and b/Supermarket/lib/mail.jar differ diff --git a/Supermarket/lib/mysql-connector-java-5.1.32.jar b/Supermarket/lib/mysql-connector-java-5.1.32.jar new file mode 100644 index 0000000..f82dd98 Binary files /dev/null and b/Supermarket/lib/mysql-connector-java-5.1.32.jar differ diff --git a/Supermarket/src/com/lingnan/supermarket/componet/BGPanel.java b/Supermarket/src/com/lingnan/supermarket/componet/BGPanel.java new file mode 100644 index 0000000..4b9bc0f --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/componet/BGPanel.java @@ -0,0 +1,36 @@ +package com.lingnan.supermarket.componet; + +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Toolkit; + +import javax.swing.JPanel; + +public class BGPanel extends JPanel{ + + + private Image image; + public BGPanel(Image image) { + this.image = image; + + int width = Toolkit.getDefaultToolkit().getScreenSize().width; + int height = Toolkit.getDefaultToolkit().getScreenSize().height; + this.setSize(width, height); + } + + public BGPanel(Image image,int width,int height) { + this.image = image; + + + this.setSize(width, height); + } + + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + g.drawImage(image,0,0,getWidth(),getHeight(),this); + + } + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/BufferService.java b/Supermarket/src/com/lingnan/supermarket/dao/BufferService.java new file mode 100644 index 0000000..9c643c8 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/BufferService.java @@ -0,0 +1,37 @@ +package com.lingnan.supermarket.dao; + +import java.util.Vector; + +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +public interface BufferService { + + /*主要用于更新操作*/ + + /*根据商品id判断delmark是0还是1,即是否是新添加的商品返回2,还是已经添加的商品返回1,还是不存在的商品返回0*/ + public Vector allOutBuffer(); + public Buffer findOutBufferbyId(String id) ; + public boolean addOutBufferNewProd(String id,int sum); + public boolean addOutBufferExeistProd(String id,int sum,Buffer buffer); + /*public Buffer findOutBufferSumAndOutPrice(String id);*/ + public Float OutBufferAllPrice(); + public boolean Account(String number,String time,String id,int sum,Float price); + public boolean InsertOutOrder(String number,Float allPrice,String time,String username); + public boolean DelAllOutBuffer(); + public boolean DelOutBufferById(String id); + public boolean UpdateOutBufferById(String id,int sum); + + + /*进货模块*/ + public Vector allInBuffer(); + public Buffer findInBufferbyId(String id) ; + public boolean addInBufferNewProd(String id,int sum); + public boolean addInBufferExeistProd(String id,int sum,Buffer buffer); + /*public Buffer findInBufferSumAndInPrice(String id);*/ + public Float InBufferAllPrice(); + public boolean Stock(String number,String time,String id,int sum,Float price); + public boolean InsertInOrder(String number,Float allPrice,String time,String username); + public boolean DelAllInBuffer(); + public boolean DelInBufferById(String id); + public boolean UpdateInBufferById(String id,int sum); +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/SupplierInfService.java b/Supermarket/src/com/lingnan/supermarket/dao/SupplierInfService.java new file mode 100644 index 0000000..3b1285b --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/SupplierInfService.java @@ -0,0 +1,32 @@ +package com.lingnan.supermarket.dao; + +import java.util.ArrayList; +import java.util.Vector; + +import com.lingnan.supermarket.dto.SupplierInf; +import com.lingnan.supermarket.dto.User; + +public interface SupplierInfService { + //查询操作 加where default==1 + Vector findAllSupplierInf(); + + Vector findByNameSupplierInf(SupplierInf supplierInf); + // SupplierInf findByNameSupplierInf(String name); + + //根据id增加 + int addSupplierInf(SupplierInf s); + + //根据id删除 + //int deleteSupplierInf(String id); + + //根据id更新 + int updateSupplierInf(SupplierInf supplierInf); + + int deleteSupplierInf(int id); + + //输出所有供应商名字 + ArrayList findNameSupplier(); + + //通过供应商名查找并输出id + int findIdSupplierByName(String name); + } diff --git a/Supermarket/src/com/lingnan/supermarket/dao/UserService.java b/Supermarket/src/com/lingnan/supermarket/dao/UserService.java new file mode 100644 index 0000000..50ce43d --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/UserService.java @@ -0,0 +1,27 @@ +package com.lingnan.supermarket.dao; + +import java.util.Vector; + +import com.lingnan.supermarket.dto.User; + +// 用户服务接口,定义了一系列与用户操作相关的方法 +public interface UserService { + + // 查询所有用户的方法,返回一个存储用户对象的Vector数组 + Vector allUser(); + + // 根据用户真实姓名查找用户的方法,返回一个存储匹配用户对象的Vector数组 + Vector findByrnameUser(User user); + + // 用户登录方法,传入用户名、密码和用户级别参数,返回一个User对象(可能表示登录成功的用户信息) + User login(String loginName, String password, int usuper); + + // 添加用户的方法,传入一个User对象,返回一个整数表示添加操作是否成功(1表示成功,0表示失败) + int addUser(User user); + + // 根据用户id删除用户记录的方法,传入用户id,返回一个整数表示删除操作是否成功(1表示成功,0表示失败) + int deleteUser(int id); + + // 根据用户id更新用户信息的方法,传入一个User对象,返回一个整数表示更新操作是否成功(1表示成功,0表示失败) + int updateByIdUser(User user); +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/BufferImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/BufferImpl.java new file mode 100644 index 0000000..35da321 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/BufferImpl.java @@ -0,0 +1,645 @@ +package com.lingnan.supermarket.dao.impl; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Vector; + +import com.lingnan.supermarket.dao.BufferService; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.utils.JDBCUtil; + +public class BufferImpl implements BufferService { + + + + + + /*------------------------收银出货模块-----------------------*/ + /*返回出货缓冲表所有delmark=1的记录并排序*/ + public Vector allOutBuffer(){ + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + Vector v = new Vector(); + Buffer Buffer; + try { + pstmt = conn.prepareStatement("select * from OutBuffer "); + resultSet = pstmt.executeQuery(); + while(resultSet.next()) { + Buffer = new Buffer(); + Buffer.setId(resultSet.getString("id")); + Buffer.setName(resultSet.getString("name")); + Buffer.setInPrice(resultSet.getFloat("inPrice")); + Buffer.setOutPrice(resultSet.getFloat("OutPrice")); + Buffer.setLife(resultSet.getInt("life")); + Buffer.setSum(resultSet.getInt("sum")); + Buffer.setSupplyId(resultSet.getInt("supplyId")); + Buffer.setId2(resultSet.getString("id2")); + Buffer.setName2(resultSet.getString("name2")); + Buffer.setPrice(resultSet.getFloat("price")); + Buffer.setDelmark(resultSet.getInt("delmark")); + v.add(Buffer); + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + } + return v; + } + + /*通过id查找返回boolean*/ + public Buffer findOutBufferbyId(String id) + { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + Buffer buffer = new Buffer(); + try { + pstmt = conn.prepareStatement("select * from OutBuffer where id=? "); + pstmt.setString(1, id); + resultSet = pstmt.executeQuery(); + + if(resultSet.next()) { + buffer.setId(resultSet.getString("id")); + buffer.setName(resultSet.getString("name")); + buffer.setInPrice(resultSet.getFloat("inPrice")); + buffer.setOutPrice(resultSet.getFloat("OutPrice")); + buffer.setLife(resultSet.getInt("life")); + buffer.setSum(resultSet.getInt("sum")); + buffer.setSupplyId(resultSet.getInt("supplyId")); + buffer.setId2(resultSet.getString("id2")); + buffer.setName2(resultSet.getString("name2")); + buffer.setPrice(resultSet.getFloat("price")); + buffer.setDelmark(resultSet.getInt("delmark")); + flag = true; + }else { + return null; + } + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + } + return buffer; +} + + /*如果缓冲区没有那就把整条记录插入插入操作*/ + public boolean addOutBufferNewProd(String id,int sum) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + try { + pstmt = conn.prepareStatement("call InsertOutBuffer(?,?) "); + pstmt.setString(1, id); + pstmt.setInt(2, sum); + + + if( pstmt.executeUpdate()==1) { + flag = true; + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + + /*根据商品id获取sum和outprice + public Buffer findOutBufferSumAndOutPrice(String id) { + Buffer Buffer = new Buffer(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + try { + pstmt = conn.prepareStatement("select * from OutBuffer where id=? "); + pstmt.setString(1, id); + resultSet = pstmt.executeQuery(); + + if(resultSet.next()) { + Buffer.setSum(resultSet.getInt("sum")); + Buffer.setOutPrice(resultSet.getFloat("OutPrice")); + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + } + return Buffer; + } + */ + + + /*如果delmark是1,即是已经添加的商品*/ + public boolean addOutBufferExeistProd(String id,int sum,Buffer buffer){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("update OutBuffer set sum=?,price=? where id=? "); + pstmt.setInt(1, sum+buffer.getSum()); + pstmt.setFloat(2,( sum+buffer.getSum()*buffer.getOutPrice())); + pstmt.setString(3, id); + if(pstmt.executeUpdate()==1) { + flag = true; + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + /*获得购物车总价*/ + public Float OutBufferAllPrice(){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("select sum(price) from OutBuffer "); + resultSet=pstmt.executeQuery(); + if(resultSet.next()) { + return resultSet.getFloat("sum(price)"); + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return null; + } + + + /*结账后对5个表进行操作*/ + public boolean Account(String number,String time,String id,int sum,Float price){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("call Account(?,?,?,?,?)"); + pstmt.setString(1,number); + pstmt.setString(2,time ); + pstmt.setString(3,id ); + pstmt.setInt(4,sum ); + pstmt.setFloat(5, price); + if(pstmt.execute()) + flag = true; + + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + /*删除所有购物车*/ + public boolean DelAllOutBuffer(){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("delete from OutBuffer"); + if(pstmt.execute()) + flag = true; + + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + /*往订单表插入一条记录*/ + public boolean InsertOutOrder(String number,Float allPrice,String time,String username){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("insert into OutOrder values(?,?,?,?,?)"); + pstmt.setString(1, number); + pstmt.setFloat(2, allPrice); + pstmt.setString(3, time); + pstmt.setString(4, username); + pstmt.setInt(5, 1); + if(pstmt.execute()) + flag = true; + + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + /*删除缓冲区OutBuffer一条记录通过id*/ + public boolean DelOutBufferById(String id) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null; + try { + pstmt = conn.prepareStatement("delete from OutBuffer where id=?"); + pstmt.setString(1, id); + if(pstmt.executeUpdate()==1) + flag = true; + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + /*更改记录通过id*/ + public boolean UpdateOutBufferById(String id,int sum) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null; + try { + pstmt = conn.prepareStatement("upadte OutBuffer set sum=? where id=?"); + pstmt.setInt(1, sum); + pstmt.setString(2, id); + if(pstmt.execute()) + flag = true; + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + + + + + + + + + + + + /*---------------------------进货模块----------------------------*/ + /*返回出货缓冲表所有delmark=1的记录并排序*/ + public Vector allInBuffer(){ + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + Vector v = new Vector(); + Production production; + try { + pstmt = conn.prepareStatement("select * from InBuffer "); + resultSet = pstmt.executeQuery(); + while(resultSet.next()) { + production = new Production(); + production.setId(resultSet.getString("id")); + production.setName(resultSet.getString("name")); + production.setInPrice(resultSet.getFloat("inPrice")); + production.setOutPrice(resultSet.getFloat("OutPrice")); + production.setLife(resultSet.getInt("life")); + production.setSum(resultSet.getInt("sum")); + production.setSupplyId(resultSet.getInt("supplyId")); + production.setId2(resultSet.getString("id2")); + production.setName2(resultSet.getString("name2")); + production.setPrice(resultSet.getFloat("price")); + production.setDelmark(resultSet.getInt("delmark")); + v.add(production); + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + } + return v; + } + + /*通过id查找返回boolean*/ + public Buffer findInBufferbyId(String id) + { + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + Buffer buffer = new Buffer(); + try { + pstmt = conn.prepareStatement("select * from InBuffer where id=? "); + pstmt.setString(1, id); + resultSet = pstmt.executeQuery(); + + if(resultSet.next()) { + buffer.setId(resultSet.getString("id")); + buffer.setName(resultSet.getString("name")); + buffer.setInPrice(resultSet.getFloat("inPrice")); + buffer.setOutPrice(resultSet.getFloat("OutPrice")); + buffer.setLife(resultSet.getInt("life")); + buffer.setSum(resultSet.getInt("sum")); + buffer.setSupplyId(resultSet.getInt("supplyId")); + buffer.setId2(resultSet.getString("id2")); + buffer.setName2(resultSet.getString("name2")); + buffer.setPrice(resultSet.getFloat("price")); + buffer.setDelmark(resultSet.getInt("delmark")); + } + else { + return null; + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + } + return buffer; +} + + /*如果缓冲区没有那就把整条记录插入插入操作*/ + public boolean addInBufferNewProd(String id,int sum) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + try { + pstmt = conn.prepareStatement("call InsertInBuffer(?,?) "); + pstmt.setString(1, id); + pstmt.setInt(2, sum); + + + if( pstmt.executeUpdate()==1) { + flag = true; + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + public boolean insertInBuffer(Production p) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + try { + pstmt = conn.prepareStatement("insert into InBuffer values(?,?,?,?,?,?,?,?,?,?,?)"); + pstmt.setString(1, p.getId()); + pstmt.setString(2, p.getName()); + pstmt.setFloat(3, p.getInPrice()); + pstmt.setFloat(4, p.getOutPrice()); + pstmt.setInt(5, p.getLife()); + pstmt.setInt(6, p.getSum()); + pstmt.setInt(7, p.getSupplyId()); + pstmt.setString(8, p.getId2()); + pstmt.setString(9, p.getName2()); + pstmt.setFloat(10,p.getPrice()); + pstmt.setInt(11, 1); + pstmt.executeUpdate(); + + + if( pstmt.execute()) { + flag = true; + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; +} + + +/* 根据商品id获取sum和outprice + public Buffer findInBufferSumAndInPrice(String id) { + Buffer Buffer = new Buffer(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + try { + pstmt = conn.prepareStatement("select * from InBuffer where id=? "); + pstmt.setString(1, id); + resultSet = pstmt.executeQuery(); + + if(resultSet.next()) { + Buffer.setSum(resultSet.getInt("sum")); + Buffer.setOutPrice(resultSet.getFloat("InPrice")); + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + } + return Buffer; + }*/ + + + + /*如果delmark是1,即是已经添加的商品*/ + public boolean addInBufferExeistProd(String id,int sum,Buffer buffer){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("update InBuffer set sum=?,price=? where id=? "); + pstmt.setInt(1, sum+buffer.getSum()); + pstmt.setFloat(2,( sum+buffer.getSum()*buffer.getInPrice())); + pstmt.setString(3, id); + if(pstmt.executeUpdate()==1) { + flag = true; + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + /*获得购物车总价*/ + public Float InBufferAllPrice(){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("select sum(price) from InBuffer "); + resultSet=pstmt.executeQuery(); + if(resultSet.next()) { + return resultSet.getFloat("sum(price)"); + } + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return null; + } + + + /*结账后对5个表进行操作*/ + public boolean Stock(String number,String time,String id,int sum,Float price){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("call Stock(?,?,?,?,?)"); + pstmt.setString(1,number); + pstmt.setString(2,time ); + pstmt.setString(3,id ); + pstmt.setInt(4,sum ); + pstmt.setFloat(5, price); + if(pstmt.executeUpdate()==1) + flag = true; + + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + /*删除所有购物车*/ + public boolean DelAllInBuffer(){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("delete from InBuffer"); + if(pstmt.execute()) + flag = true; + + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + + + /*删除缓冲区InBuffer一条记录通过id*/ + public boolean DelInBufferById(String id) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("delete from InBuffer where id=?"); + pstmt.setString(1, id); + if(pstmt.executeUpdate()==1) + flag = true; + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + + + /*更改记录通过id*/ + public boolean UpdateInBufferById(String id,int sum) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null; + try { + pstmt = conn.prepareStatement("upadte InBuffer set sum=? where id=?"); + pstmt.setInt(1, sum); + pstmt.setString(2, id); + if(pstmt.execute()) + flag = true; + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + @Override + public boolean InsertInOrder(String number, Float allPrice, String time, String username) { + // TODO Auto-generated method stub + return false; + } + + + + + + +} + + diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/SupplierInfImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/SupplierInfImpl.java new file mode 100644 index 0000000..26b2dab --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/SupplierInfImpl.java @@ -0,0 +1,218 @@ +package com.lingnan.supermarket.dao.impl; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Vector; + +import com.lingnan.supermarket.dao.SupplierInfService; +import com.lingnan.supermarket.dto.ProdCatalog; +import com.lingnan.supermarket.dto.SupplierInf; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.utils.JDBCUtil; + +public class SupplierInfImpl implements SupplierInfService{ + + @Override + public Vector findAllSupplierInf() { + Vector supplierInfs = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet=null; + + String SQL = "select * from supplierInf where delmark = 1"; + + try { + preparedStatement = conn.prepareStatement(SQL); + resultSet = preparedStatement.executeQuery(); + while(resultSet.next()) { + SupplierInf supplierInf = new SupplierInf(); + supplierInf.setId(resultSet.getInt("id")); + supplierInf.setName(resultSet.getString("name")); + supplierInf.setContact(resultSet.getString("contact")); + supplierInf.setEmail(resultSet.getString("email")); + supplierInf.setAddress(resultSet.getString("address")); + supplierInf.setDelmark(resultSet.getInt("delmark")); + supplierInfs.add(supplierInf); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + return supplierInfs; + } + + @Override + public Vector findByNameSupplierInf(SupplierInf supplierInf) { + //SupplierInf supplierInf = new SupplierInf(); + Connection conn = JDBCUtil.getConn(); + Vector v = new Vector<>(); + System.out.println(supplierInf.getName()); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + + try { + if(!supplierInf.getName().equals("")){ + String s='%'+supplierInf.getName()+'%'; + preparedStatement = conn.prepareStatement("select * from supplierInf where name like ? and delmark = 1"); + preparedStatement.setString(1, s); + }else + preparedStatement = conn.prepareStatement("select * from supplierInf where delmark = 1"); + resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) { + supplierInf = new SupplierInf(); + supplierInf.setId(resultSet.getInt("id")); + supplierInf.setName(resultSet.getString("name")); + supplierInf.setAddress(resultSet.getString("address")); + supplierInf.setContact(resultSet.getString("contact")); + supplierInf.setEmail(resultSet.getString("email")); + supplierInf.setDelmark(1); + v.add(supplierInf); + } + Iterator it=v.iterator(); + while(it.hasNext()){ + supplierInf=it.next(); + System.out.println(supplierInf.getId()+" "+supplierInf.getName()+" "+supplierInf.getAddress()+" "+supplierInf.getContact()+" "+supplierInf.getEmail()+" "+supplierInf.getDelmark()+" "); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return v; + } + + @Override + public int addSupplierInf(SupplierInf supplierInf) { + int flag = 0; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("insert into supplierInf values (null,?,?,?,?,?)"); + //preparedStatement.setInt(1, supplierInf.getId()); + preparedStatement.setString(1, supplierInf.getName()); + preparedStatement.setString(2, supplierInf.getAddress()); + preparedStatement.setString(3, supplierInf.getContact()); + preparedStatement.setString(4, supplierInf.getEmail()); + preparedStatement.setInt(5, 1); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + + return flag; + } + + @Override + public int deleteSupplierInf(int id) { + int flag = 0; + + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("delete from supplierInf where id = ?"); + preparedStatement.setInt(1, id); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + return flag; + } + + @Override + public int updateSupplierInf(SupplierInf supplierInf) { + int flag=0; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement("update supplierInf set name=?,address=?,contact=?,email=?,delmark=? where id = ?"); + preparedStatement.setString(1,supplierInf.getName()); + preparedStatement.setString(2,supplierInf.getAddress()); + preparedStatement.setString(3,supplierInf.getContact()); + preparedStatement.setString(4, supplierInf.getEmail()); + preparedStatement.setInt(5, supplierInf.getDelmark()); + preparedStatement.setInt(6,supplierInf.getId()); + preparedStatement.executeUpdate(); + flag = 1; + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null, preparedStatement, conn); + } + return flag; + } + + @Override + public ArrayList findNameSupplier() { + Connection conn=JDBCUtil.getConn(); + ArrayList v = new ArrayList(); + SupplierInf supplierInf; + PreparedStatement pstmt = null; + ResultSet resultSet=null; + v.add("全部"); + try { + pstmt = conn.prepareStatement("select * from supplierInf"); + resultSet = pstmt.executeQuery(); + while(resultSet.next()){ + + v.add(resultSet.getString("name")); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }finally{ + JDBCUtil.close(resultSet, pstmt, conn); + } + + + return v; + } + + @Override + public int findIdSupplierByName(String name) { + int flag = -1; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet= null; + int id=0; + try { + if(name.equals("全部")) + return id; + preparedStatement = conn.prepareStatement + ("select * from supplierInf where name=?"); + preparedStatement.setString(1, name); + resultSet=preparedStatement.executeQuery(); + if(resultSet.next()){ + return resultSet.getInt("id"); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + + return flag; + } + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/UserServiceImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/UserServiceImpl.java new file mode 100644 index 0000000..90eb5f9 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/UserServiceImpl.java @@ -0,0 +1,293 @@ +package com.lingnan.supermarket.dao.impl; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Iterator; +import java.util.Vector; + +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.utils.JDBCUtil; + +// UserServiceImpl类实现了UserService接口,用于处理与用户相关的数据库操作 +public class UserServiceImpl implements UserService { + + // 实现用户登录功能 + public User login(String Name, String password) { + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); + // 用于存储查询到的用户信息,初始化为null + User user = null; + PreparedStatement pstmt = null; + ResultSet resultSet = null; + + try { + // 准备SQL语句,用于查询满足条件的用户记录 + // 条件是用户名、密码匹配且delmark为1(可能表示未删除状态) + pstmt = conn.prepareStatement("select * from User where name=? and password=? and delmark = 1"); + pstmt.setString(1, Name); + pstmt.setString(2, password); + + // 执行查询操作并获取结果集 + resultSet = pstmt.executeQuery(); + // 如果结果集中有下一条记录,说明找到了匹配的用户 + if (resultSet.next()) { + // 创建一个新的User对象来存储查询到的用户信息 + user = new User(); + // 输出查询到的用户信息(这里可能是用于调试目的) + System.out.println(resultSet.getInt("id") + " " + resultSet.getString("name") + " " + resultSet.getString("password") + " " + resultSet.getInt("sSuper")); + // 将查询到的用户信息设置到User对象中 + user.setId(resultSet.getInt("id")); + user.setUsername(resultSet.getString("name")); + user.setRname(resultSet.getString("rname")); + user.setPassword(resultSet.getString("password")); + user.setPhone(resultSet.getString("phone")); + user.setUsuper(resultSet.getInt("sSuper")); + user.setImg(resultSet.getString("img")); + user.setDelmark(1); + } + } catch (SQLException e) { + // 捕获SQL异常并打印异常信息(这里可以考虑更完善的异常处理,比如记录日志等) + e.printStackTrace(); + } finally { + // 关闭数据库相关资源,释放连接、语句和结果集 + JDBCUtil.close(resultSet, pstmt, conn); + } + + // 返回查询到的用户对象,如果未找到则返回null + return user; + } + + // 添加用户基本信息到数据库的方法 + public int addUser(User user) { + // 用于标记添加操作是否成功,初始化为0表示失败 + int flag = 0; + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); + // 设置默认的用户图片路径(这里可能需要根据实际情况进行调整) + String s = "static\\userimg\\u1.png"; + // 准备插入用户信息的SQL语句,注意values中的null是为了让数据库自动生成id(假设id是自增主键) + String SQL = "insert into User values(null,?,?,?,?,?,?,?)"; + + System.out.println(SQL); + + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + + try { + // 准备SQL语句 + preparedStatement = conn.prepareStatement(SQL); + // 设置SQL语句中的参数,将用户对象的各个属性值传入 + preparedStatement.setString(1, user.getUsername()); + preparedStatement.setString(2, user.getRname()); + preparedStatement.setString(3, user.getPassword()); + preparedStatement.setString(4, user.getPhone()); + preparedStatement.setInt(5, user.getUsuper()); + preparedStatement.setString(6, s); + preparedStatement.setInt(7, 1); + // 执行插入操作 + preparedStatement.executeUpdate(); + // 如果插入成功,将标记设置为1 + flag = 1; + } catch (SQLException e) { + // 捕获SQL异常并打印异常信息 + e.printStackTrace(); + } finally { + // 关闭数据库相关资源 + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + // 返回操作结果标记,1表示成功,0表示失败 + return flag; + } + + // 查询所有用户信息的方法,返回一个存储用户对象的Vector数组 + public Vector allUser() { + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); + // 创建一个Vector来存储查询到的所有用户对象 + Vector v = new Vector<>(); + User user; + PreparedStatement pstmt = null; + ResultSet resultSet = null; + + try { + // 准备查询所有未删除用户(delmark = 1)的SQL语句 + pstmt = conn.prepareStatement("select * from User where delmark = 1"); + + // 执行查询操作并获取结果集 + resultSet = pstmt.executeQuery(); + // 遍历结果集,将每条记录转换为一个User对象并添加到Vector中 + while (resultSet.next()) { + user = new User(); + user.setId(resultSet.getInt("id")); + user.setUsername(resultSet.getString("name")); + user.setRname(resultSet.getString("rname")); + user.setPassword(resultSet.getString("password")); + user.setPhone(resultSet.getString("phone")); + user.setUsuper(resultSet.getInt("sSuper")); + user.setImg(resultSet.getString("img")); + user.setDelmark(1); + v.add(user); + } + } catch (SQLException e) { + // 捕获SQL异常并打印异常信息 + e.printStackTrace(); + } finally { + // 关闭数据库相关资源 + JDBCUtil.close(resultSet, pstmt, conn); + } + + // 返回存储所有用户对象的Vector + return v; + } + + // 根据用户的真实姓名查找用户信息的方法,返回一个存储匹配用户对象的Vector数组 + public Vector findByrnameUser(User user) { + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); + // 创建一个Vector来存储查询到的匹配用户对象 + Vector v = new Vector<>(); + // 输出传入的用户真实姓名(可能用于调试目的) + System.out.println(user.getRname()); + PreparedStatement pstmt = null; + ResultSet resultSet = null; + + try { + // 如果传入的用户真实姓名不为空字符串 + if (!user.getRname().equals("")) { + // 构造模糊查询的条件,使用%作为通配符 + String s = "%" + user.getRname() + "%"; + // 准备根据真实姓名模糊查询用户的SQL语句,且只查询未删除的用户(delmark = 1) + pstmt = conn.prepareStatement("select * from user where rname like? and delmark = 1"); + pstmt.setString(1, s); + } else { + // 如果传入的真实姓名为空字符串,则查询所有未删除的用户 + pstmt = conn.prepareStatement("select * from user where delmark = 1"); + } + + // 执行查询操作并获取结果集 + resultSet = pstmt.executeQuery(); + // 遍历结果集,将每条记录转换为一个User对象并添加到Vector中 + while (resultSet.next()) { + user = new User(); + user.setId(resultSet.getInt("id")); + user.setUsername(resultSet.getString("name")); + user.setRname(resultSet.getString("rname")); + user.setPassword(resultSet.getString("password")); + user.setPhone(resultSet.getString("phone")); + user.setUsuper(resultSet.getInt("sSuper")); + user.setImg(resultSet.getString("img")); + user.setDelmark(1); + v.add(user); + } + + // 遍历查询到的用户对象并输出相关信息(可能用于调试目的) + Iterator it = v.iterator(); + while (it.hasNext()) { + user = it.next(); + System.out.println(user.getId() + " " + user.getUsername() + " " + user.getRname() + " " + user.getPassword() + " " + user.getPhone() + " " + user.getUsuper() + " " + user.getImg() + " " + user.getDelmark() + " "); + } + } catch (SQLException e) { + // 捕获SQL异常并打印异常信息 + e.printStackTrace(); + } finally { + // 关闭数据库相关资源 + JDBCUtil.close(resultSet, pstmt, conn); + } + + // 返回存储匹配用户对象的Vector + return v; + } + + // 根据用户id删除用户记录的方法 + @Override + public int deleteUser(int id) { + // 用于标记删除操作是否成功,初始化为0表示失败 + int flag = 0; + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); + + // 准备删除指定id用户记录的SQL语句 + String SQL = "delete from user where id=?"; + + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + + try { + // 准备SQL语句并设置要删除的用户id参数 + preparedStatement = conn.prepareStatement(SQL); + preparedStatement.setInt(1, id); + + // 执行删除操作 + preparedStatement.executeUpdate(); + // 如果删除成功,将标记设置为1 + flag = 1; + } catch (SQLException e) { + // 捕获SQL异常并打印异常信息 + e.printStackTrace(); + } finally { + // 关闭数据库相关资源 + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + // 返回操作结果标记,1表示成功,0表示失败 + return flag; + } + + // 此方法在原代码中未实现具体功能,只是按照接口定义返回null + // 可能是需要根据具体业务需求进一步完善的登录方法,传入了用户名、密码和用户级别参数 + @Override + public User login(String loginName, String password, int usuper) { + // TODO Auto-generated method stub + return null; + } + + // 根据用户id更新用户信息的方法 + @Override + public int updateByIdUser(User user) { + // 用于标记更新操作是否成功,初始化为0表示失败 + int flag = 0; + // 获取要更新的用户id + int id = user.getId(); + System.out.println(id); + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); + // 准备更新用户信息的SQL语句,根据指定的id更新用户的各项信息 + String SQL = "update User set name=?,rname=?,password=?,phone=?,sSuper=?,img=?,delmark=? where id=? "; + + System.out.println(SQL); + + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + + try { + // 准备SQL语句 + preparedStatement = conn.prepareStatement(SQL); + // 设置SQL语句中的参数,将用户对象的各个属性值传入 + preparedStatement.setString(1, user.getUsername()); + preparedStatement.setString(2, user.getRname()); + preparedStatement.setString(3, user.getPassword()); + preparedStatement.setString(4, user.getPhone()); + preparedStatement.setInt(5, user.getUsuper()); + preparedStatement.setString(6, user.getImg()); + preparedStatement.setInt(7, 1); + preparedStatement.setInt(8, id); + // 执行更新操作 + preparedStatement.executeUpdate(); + // 如果更新成功,将标记设置为1 + flag = 1; + } catch (SQLException e) { + // 捕获SQL异常并打印异常信息 + e.printStackTrace(); + } finally { + // 关闭数据库相关资源 + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + // 返回操作结果标记,1表示成功,0表示失败 + return flag; + } +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.java new file mode 100644 index 0000000..fd81c3b --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.java @@ -0,0 +1,274 @@ +package com.lingnan.supermarket.dao.impl; + +import java.sql.Connection; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Date; +import java.util.Vector; + +import com.lingnan.supermarket.dao.inOrderService; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.utils.DateUtil; +import com.lingnan.supermarket.utils.JDBCUtil; + +public class inOrderServiceImpl implements inOrderService{ + + @Override + public Vector findAllInOrder (){ + Vector inOrders = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet=null; + + String SQL = "select * from inOrder where delmark=1 order by inDate desc"; + + try { + preparedStatement = conn.prepareStatement(SQL); + resultSet = preparedStatement.executeQuery(); + while(resultSet.next()) { + InOrder inOrder = new InOrder(); + inOrder.setiNumber(resultSet.getString("iNumber")); + inOrder.setAllInPrice(resultSet.getFloat("allInPrice")); + inOrder.setInDate(resultSet.getString("inDate")); + inOrder.setPrincipal(resultSet.getString("principal")); + inOrder.setStatus(resultSet.getInt("status")); + inOrder.setDelmark(resultSet.getInt("Delmark")); + inOrders.add(inOrder); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + return inOrders; + + } + + + @Override + public InOrder findByIdinOrder(String iNumber) { + + InOrder inOrder = new InOrder(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + + try { + preparedStatement = conn.prepareStatement("select * from inOrder where iNumber = ?"); + preparedStatement.setString(1, iNumber); + resultSet = preparedStatement.executeQuery(); + if (resultSet.next()) { + inOrder.setiNumber(resultSet.getString("iNumber")); + inOrder.setAllInPrice(resultSet.getFloat("allInPrice")); + inOrder.setInDate(resultSet.getString("inDate")); + inOrder.setPrincipal(resultSet.getString("principal")); + inOrder.setStatus(resultSet.getInt("status")); + } else { + return null; // 没有找到该订单或订单不存在,返回null + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return inOrder; + } + + + @Override + public int addInOrder(String iNumber, float allInPrice) { + int flag = 0; + Timestamp inDate = new Timestamp(System.currentTimeMillis()); + //System.out.println(inDate); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("insert into inOrder values (?,?,?,?)"); + preparedStatement.setString(1, iNumber); + preparedStatement.setFloat(2, allInPrice); + preparedStatement.setTimestamp(3, inDate); + preparedStatement.setString(4, "a1"); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + flag = -1; + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + + return flag; + } + + + @Override + public int deleteInOrder(String iNumber) { + int flag = 0; + + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("update inOrder set delmark=0 where iNumber = ?"); + preparedStatement.setString(1, iNumber); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + flag = -1; + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + return flag; + } + + /*往订单表插入一条记录*/ + public boolean InsertInOrder(String number,Float allPrice,String time,String username,int c){ + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet = null;; + try { + pstmt = conn.prepareStatement("insert into InOrder values(?,?,?,?,?,?)"); + pstmt.setString(1, number); + pstmt.setFloat(2, allPrice); + pstmt.setString(3, time); + pstmt.setString(4, username); + pstmt.setInt(5, 2); + pstmt.setInt(6, 1); + + if(pstmt.execute()) + flag = true; + + + + } catch (SQLException e) { + e.printStackTrace(); + }finally { + + JDBCUtil.close(resultSet, pstmt, conn); + } + return flag; + } + + /*更新状态*/ + public boolean updateInOrderStatus(String iNumber,int status) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + try { + preparedStatement = conn.prepareStatement("update inOrder set status=? where iNumber=?"); + preparedStatement.setInt(1, status); + preparedStatement.setString(2,iNumber); + if(preparedStatement.executeUpdate()==1) + flag = true; + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + return flag; + } + + //查找所有待入库订单*/待确认 + public Vector findUnconfirmInOrder(){ + Vector inOrders = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet=null; + + String SQL = "select * from inOrder where status=2 and delmark=1"; + + try { + preparedStatement = conn.prepareStatement(SQL); + resultSet = preparedStatement.executeQuery(); + while(resultSet.next()) { + InOrder inOrder = new InOrder(); + inOrder.setiNumber(resultSet.getString("iNumber")); + inOrder.setAllInPrice(resultSet.getFloat("allInPrice")); + inOrder.setInDate(resultSet.getString("inDate")); + inOrder.setPrincipal(resultSet.getString("principal")); + inOrder.setStatus(resultSet.getInt("status")); + inOrder.setDelmark(resultSet.getInt("Delmark")); + inOrders.add(inOrder); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + return inOrders; + + } + + //获取今日进货金额 + public Float TodayInPrice(String date) { + + InOrder inOrder = new InOrder(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + Float allInPrice=(float) 0; + + try { + preparedStatement = conn.prepareStatement("select sum(allInPrice) from inOrder where inDate>=? and inDate<=date_add(?,interval 1 day)"); + preparedStatement.setString(1, date); + preparedStatement.setString(2, date); + resultSet = preparedStatement.executeQuery(); + if (resultSet.next()) { + allInPrice=resultSet.getFloat("sum(allInPrice)"); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return allInPrice; + } + + //查找指定状态订单 + public Vector FindStatus(int status){ + Vector inOrders = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet=null; + + + + try { + preparedStatement = conn.prepareStatement("select * from inOrder where status=? and delmark=1 order by inDate desc"); + preparedStatement.setInt(1, status); + resultSet = preparedStatement.executeQuery(); + while(resultSet.next()) { + InOrder inOrder = new InOrder(); + inOrder.setiNumber(resultSet.getString("iNumber")); + inOrder.setAllInPrice(resultSet.getFloat("allInPrice")); + inOrder.setInDate(resultSet.getString("inDate")); + inOrder.setPrincipal(resultSet.getString("principal")); + inOrder.setStatus(resultSet.getInt("status")); + inOrder.setDelmark(resultSet.getInt("Delmark")); + inOrders.add(inOrder); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + return inOrders; + + } + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.java new file mode 100644 index 0000000..bf5f585 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.java @@ -0,0 +1,152 @@ +package com.lingnan.supermarket.dao.impl; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Vector; + +import com.lingnan.supermarket.dao.inRecordService; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.InRecord; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.utils.JDBCUtil; + +public class inRecordServiceImpl implements inRecordService{ + + @Override + public Vector findAllinRecord() { + Vector inRecords = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet=null; + + String SQL = "select * from inRecord"; + + try { + preparedStatement = conn.prepareStatement(SQL); + resultSet = preparedStatement.executeQuery(); + while(resultSet.next()) { + InRecord inRecord = new InRecord(); + inRecord.setiNumber(resultSet.getString("iNumber")); + inRecord.setSum(resultSet.getInt("sum")); + inRecord.setInPrice(resultSet.getFloat("inPrice")); + inRecords.add(inRecord); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + return inRecords; + } + + @Override + public Vector findByIdinRecord(String iNumber) { + InRecord inRecord; + Vector v = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + + try { + preparedStatement = conn.prepareStatement("select * from inRecord where iNumber = ?"); + preparedStatement.setString(1, iNumber); + resultSet = preparedStatement.executeQuery(); + while(resultSet.next()) { + inRecord = new InRecord(); + inRecord.setiNumber(resultSet.getString("iNumber")); + inRecord.setId(resultSet.getString("id")); + inRecord.setSum(resultSet.getInt("sum")); + inRecord.setInPrice(resultSet.getFloat("Price")); + v.add(inRecord); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return v; + } + + @Override + public int addinRecord(InRecord ir) { + int flag = 0; + + String iNumber = ir.getiNumber(); + int sum = ir.getSum(); + Float inPrice = ir.getInPrice(); + + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("insert into inRecord values (?,?,?)"); + preparedStatement.setString(1, iNumber); + preparedStatement.setInt(2, sum); + preparedStatement.setFloat(3, inPrice); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + flag = -1; + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + + return flag; + } + + @Override + public int deleteinRecord(String iNumber) { + int flag = 0; + + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("delete from inRecord where iNumber = ?"); + preparedStatement.setString(1, iNumber); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + flag = -1; + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + return flag; + } + + public boolean insertInRecord(String iNumber,Production p) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement("insert into inRecord values(?,?,?,?)"); + preparedStatement.setString(1, iNumber); + preparedStatement.setString(2, p.getId()); + preparedStatement.setInt(3,p.getSum()); + preparedStatement.setFloat(4, p.getPrice()); + + if(preparedStatement.executeUpdate()==1) + flag = true; + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + return flag; + } + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/outOrderServiceImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/outOrderServiceImpl.java new file mode 100644 index 0000000..dd7af64 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/outOrderServiceImpl.java @@ -0,0 +1,151 @@ +package com.lingnan.supermarket.dao.impl; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Date; +import java.util.Vector; + +import com.lingnan.supermarket.dao.outOrderService; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.OutOrder; +import com.lingnan.supermarket.utils.JDBCUtil; + +public class outOrderServiceImpl implements outOrderService{ + + @Override + public Vector findAllOutOrder() { + Vector outOrders = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet=null; + + String SQL = "select * from OutOrder order by oDate desc"; + + try { + preparedStatement = conn.prepareStatement(SQL); + resultSet = preparedStatement.executeQuery(); + while(resultSet.next()) { + OutOrder outOrder = new OutOrder(); + outOrder.setoNumber(resultSet.getString("oNumber")); + outOrder.setAllOutPrice(resultSet.getFloat("allOutPrice")); + outOrder.setoDate(resultSet.getDate("oDate")); + outOrder.setPrincipal(resultSet.getString("principal")); + outOrders.add(outOrder); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + return outOrders; + } + + @Override + public OutOrder findByIdOutOrder(String oNumber) { + OutOrder outOrder = new OutOrder(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + + try { + preparedStatement = conn.prepareStatement("select * from outOrder where oNumber = ?"); + preparedStatement.setString(1, oNumber); + resultSet = preparedStatement.executeQuery(); + if (resultSet.next()) { + outOrder.setoNumber(resultSet.getString("oNumber")); + outOrder.setAllOutPrice(resultSet.getFloat("allOutPrice")); + outOrder.setoDate(resultSet.getDate("oDate")); + outOrder.setPrincipal(resultSet.getString("principal")); + } else { + return null; // 没有找到该订单或订单不存在,返回null + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return outOrder; + + } + + @Override + public int addOutOrder(String oNumber, float allOutPrice) { + int flag = 0; + Timestamp oDate = new Timestamp(System.currentTimeMillis()); + + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("insert into outOrder values (?,?,?,?)"); + preparedStatement.setString(1, oNumber); + preparedStatement.setFloat(2, allOutPrice); + preparedStatement.setTimestamp(3, oDate); + preparedStatement.setString(4, "a1"); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + flag = -1; + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + + return flag; + } + + @Override + public int deleteOutOrder(String oNumber) { + int flag = 0; + + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("delete from outOrder where oNumber = ?"); + preparedStatement.setString(1, oNumber); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + flag = -1; + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + return flag; + } + + + //获取今日进货金额 + public Float TodayOutPrice(String date) { + + InOrder inOrder = new InOrder(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + Float allInPrice=(float) 0; + + try { + preparedStatement = conn.prepareStatement("select sum(allOutPrice) from outOrder where oDate>=? and oDate<=date_add(?,interval 1 day)"); + preparedStatement.setString(1, date); + preparedStatement.setString(2, date); + resultSet = preparedStatement.executeQuery(); + if (resultSet.next()) { + allInPrice=resultSet.getFloat("sum(allOutPrice)"); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return allInPrice; + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.java new file mode 100644 index 0000000..5347d19 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.java @@ -0,0 +1,129 @@ +package com.lingnan.supermarket.dao.impl; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Vector; + +import com.lingnan.supermarket.dao.outRecordService; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.InRecord; +import com.lingnan.supermarket.dto.OutRecord; +import com.lingnan.supermarket.utils.JDBCUtil; + +public class outRecordServiceImpl implements outRecordService{ + + @Override + public Vector findAllOutRecord() { + Vector outRecords = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet=null; + + String SQL = "select * from outRecord"; + + try { + preparedStatement = conn.prepareStatement(SQL); + resultSet = preparedStatement.executeQuery(); + while(resultSet.next()) { + OutRecord outRecord = new OutRecord(); + outRecord.setoNumber(resultSet.getString("oNumber")); + outRecord.setSum(resultSet.getInt("sum")); + outRecord.setOutPrice(resultSet.getFloat("outPrice")); + outRecords.add(outRecord); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + + return outRecords; + } + + @Override + public Vector findByIdOutRecordr(String oNumber) { + OutRecord outRecord ; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + Vector v = new Vector(); + + try { + preparedStatement = conn.prepareStatement("select * from outRecord where oNumber = ?"); + preparedStatement.setString(1, oNumber); + resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) { + outRecord = new OutRecord(); + outRecord.setoNumber(resultSet.getString("oNumber")); + outRecord.setId(resultSet.getString("id")); + outRecord.setSum(resultSet.getInt("sum")); + outRecord.setOutPrice(resultSet.getFloat("Price")); + v.add(outRecord); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return v; + } + + @Override + public int addoutRecord(OutRecord or) { + + int flag = 0; + + String oNumber = or.getoNumber(); + int sum = or.getSum(); + Float outPrice = or.getOutPrice(); + + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("insert into outRecord values (?,?,?)"); + preparedStatement.setString(1, oNumber); + preparedStatement.setInt(2, sum); + preparedStatement.setFloat(3, outPrice); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + flag = -1; + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + + return flag; + } + + @Override + public int deleteOutOrder(String oNumber) { + int flag = 0; + + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn.prepareStatement + ("delete from outRecord where oNumber = ?"); + preparedStatement.setString(1, oNumber); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + flag = -1; + e.printStackTrace(); + } finally { + JDBCUtil.close(null,preparedStatement, conn); + } + return flag; + } + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/prodCatalogImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/prodCatalogImpl.java new file mode 100644 index 0000000..805f16f --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/prodCatalogImpl.java @@ -0,0 +1,225 @@ +package com.lingnan.supermarket.dao.impl; + +import java.io.StreamCorruptedException; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Vector; + +import com.lingnan.supermarket.dao.prodCatalogService; +import com.lingnan.supermarket.dto.ProdCatalog; +import com.lingnan.supermarket.utils.JDBCUtil; + +public class prodCatalogImpl implements prodCatalogService{ + + /*将商品目录表和商品表联合查询*/ + @Override + public Vector findProdCatalogAndProd() { + Connection conn=JDBCUtil.getConn(); + Vector v = new Vector(); + ProdCatalog prodCatalog; + PreparedStatement pstmt = null; + ResultSet resultSet=null; + try { + pstmt = conn.prepareStatement("call allProdCatalog()"); + resultSet = pstmt.executeQuery(); + while(resultSet.next()){ + prodCatalog = new ProdCatalog(); + prodCatalog.setId(resultSet.getString("id")); + prodCatalog.setName(resultSet.getString("name")); + v.add(prodCatalog); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }finally{ + JDBCUtil.close(resultSet, pstmt, conn); + } + + + return v; + + + } + + + @Override + public String findProdCatalog(String id1 ) { + Connection conn=JDBCUtil.getConn(); + + PreparedStatement pstmt = null; + ResultSet resultSet=null; + String catalog=null; + try { + pstmt = conn.prepareStatement("select *from prodCatalog where id2 =?"); + pstmt.setString(1,id1); + + + resultSet = pstmt.executeQuery(); + if(resultSet.next()){ + catalog=resultSet.getString("name1"); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }finally{ + JDBCUtil.close(resultSet, pstmt, conn); + } + + + return catalog; + + + } + + @Override + public int addProdCatalog(String id1, String id2) { + int flag=0; + String name1=null; + //01 食品 02 电器 03 生活用品 04 其他 + if(id1.equals("01")) + name1="食品"; + else if(id1.equals("02")) + name1="电器"; + else if(id1.equals("03")) + name1="生活用品"; + else + name1="其他"; + + //连接jdbc + Connection conn=JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + + try { + pstmt = conn.prepareStatement("insert into prodCatalog values(?,?,?)"); + pstmt.setString(1,id1); + pstmt.setString(2,name1); + pstmt.setString(3,id2); + + + pstmt.executeUpdate(); + flag=1; + + } catch (SQLException e) { + e.printStackTrace(); + }finally{ + JDBCUtil.close(resultSet, pstmt, conn); + } + + return flag; + } + + + @Override + public int deleteProdCatalog(String id2) { + int flag=0; + //连接jdbc + Connection conn=JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + + try { + pstmt = conn.prepareStatement("delete from prodCatalog where id2=?"); + pstmt.setString(1,id2); + pstmt.executeUpdate(); + flag=1; + + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }finally{ + JDBCUtil.close(resultSet, pstmt, conn); + } + + return flag; + } + + + @Override + //根据商品类production的name查询并输出类别id + public String findProdCatalogByname(String name) { + Connection conn=JDBCUtil.getConn(); + + PreparedStatement pstmt = null; + ResultSet resultSet=null; + + String catalogid="0"; + try { + if(name.equals("全部")){ + return catalogid; + } + pstmt = conn.prepareStatement("select * from prodCatalog where name =?"); + pstmt.setString(1,name); + + + resultSet = pstmt.executeQuery(); + if(resultSet.next()){ + catalogid=resultSet.getString("id"); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }finally{ + JDBCUtil.close(resultSet, pstmt, conn); + } + + + return catalogid; + } +/* public static void main(String[] args) { + ProdCatalog p=new ProdCatalog(); + prodCatalogImpl pi=new prodCatalogImpl(); + p.setName("全部"); + System.out.println(pi.findProdCatalogByname(p.getName())); + }*/ + + + @Override + public ArrayList findNameProdCatalog() { + Connection conn=JDBCUtil.getConn(); + ArrayList v = new ArrayList(); + v.add("全部"); + ProdCatalog prodCatalog; + PreparedStatement pstmt = null; + ResultSet resultSet=null; + try { + pstmt = conn.prepareStatement("select * from prodCatalog"); + resultSet = pstmt.executeQuery(); + while(resultSet.next()){ + + v.add(resultSet.getString("name")); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }finally{ + JDBCUtil.close(resultSet, pstmt, conn); + } + + + return v; + } + /*public static void main(String[] args) { + prodCatalogImpl pi=new prodCatalogImpl(); + ArrayListlog=null; + + + log=pi.findNameProdCatalog(); + String []s=new String[log.size()]; + for(int i=0;i findAllproduction() { + Vector productions = new Vector(); + + Connection conn = JDBCUtil.getConn(); + + String SQL = "select * from production where delmark = 1"; + + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + try { + preparedStatement = conn.prepareStatement(SQL); + + resultSet = preparedStatement.executeQuery(); + + while (resultSet.next()) { + Production production = new Production(); + production.setId(resultSet.getString("id")); + production.setName(resultSet.getString("name")); + production.setInPrice(resultSet.getFloat("inPrice")); + production.setOutPrice(resultSet.getFloat("OutPrice")); + production.setLife(resultSet.getInt("life")); + production.setSum(resultSet.getInt("sum")); + production.setSupplyId(resultSet.getInt("supplyId")); + production.setId2(resultSet.getString("id2")); + production.setName2(resultSet.getString("name2")); + production.setDelmark(resultSet.getInt("delmark")); + productions.add(production); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return productions; + } + + /* 用于收银系统,通过商品id返回所有信息 */ + public Production findByIdProduction(String id) { + Production production = new Production(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + try { + preparedStatement = conn + .prepareStatement("select * from production where id=? and delmark = 1"); + preparedStatement.setString(1, id); + resultSet = preparedStatement.executeQuery(); + + if (resultSet.next()) { + production.setId(resultSet.getString("id")); + production.setName(resultSet.getString("name")); + production.setInPrice(resultSet.getFloat("inPrice")); + production.setOutPrice(resultSet.getFloat("OutPrice")); + production.setLife(resultSet.getInt("life")); + production.setSum(resultSet.getInt("sum")); + production.setSupplyId(resultSet.getInt("supplyId")); + production.setId2(resultSet.getString("id2")); + production.setName2(resultSet.getString("name2")); + production.setDelmark(resultSet.getInt("delmark")); + } else { + System.out.println("未找到"); + return null; + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return production; + } + + @Override + public Vector findproduction(String name) { + /** + * 由一个商品名查找并输出全部商品信息 + */ + Vector productions = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + try { + preparedStatement = conn.prepareStatement("select * from production where name like ? and delmark = 1"); + String s='%'+name+'%'; + preparedStatement.setString(1, s); + resultSet = preparedStatement.executeQuery(); + + while (resultSet.next()) { + Production production = new Production(); + production.setId(resultSet.getString("id")); + production.setName(resultSet.getString("name")); + production.setInPrice(resultSet.getFloat("inPrice")); + production.setOutPrice(resultSet.getFloat("OutPrice")); + production.setLife(resultSet.getInt("life")); + production.setSum(resultSet.getInt("sum")); + production.setSupplyId(resultSet.getInt("supplyId")); + production.setId2(resultSet.getString("id2")); + production.setName2(resultSet.getString("name2")); + production.setDelmark(resultSet.getInt("delmark")); + productions.add(production); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return productions; + } + + @Override + /** + * 通过商品名字来查找输出单个商品信息 + */ + public Production findByNameProduction(String name) { + Production production = new Production(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + try { + preparedStatement = conn + .prepareStatement("select * from production where name=?"); + preparedStatement.setString(1, name); + resultSet = preparedStatement.executeQuery(); + + if (resultSet.next()) { + production.setId(resultSet.getString("id")); + production.setName(resultSet.getString("name")); + production.setInPrice(resultSet.getFloat("inPrice")); + production.setOutPrice(resultSet.getFloat("OutPrice")); + production.setLife(resultSet.getInt("life")); + production.setSum(resultSet.getInt("sum")); + production.setSupplyId(resultSet.getInt("supplyId")); + production.setDelmark(resultSet.getInt("delmark")); + } else { + return null; + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return production; + } + + @Override + /** + * 假设商品不存在,增加商品的信息 + */ + public int addProduction(Production p) { + int flag = 0; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + PreparedStatement preparedStatement1 = null; + ResultSet resultSet1=null; + // 假设商品不存在 + try { + preparedStatement1 = conn.prepareStatement("select * from production where id=?"); + preparedStatement1.setString(1, p.getId()); + resultSet1=preparedStatement1.executeQuery(); + if(resultSet1.next()){ + return flag=2; + } + preparedStatement = conn.prepareStatement("insert into production values(?,?,?,?,?,?,?,?,?,?,?)"); + preparedStatement.setString(1, p.getId()); + preparedStatement.setString(2, p.getName()); + preparedStatement.setFloat(3, p.getInPrice()); + preparedStatement.setFloat(4, p.getOutPrice()); + preparedStatement.setInt(5, p.getLife()); + preparedStatement.setInt(6, p.getSum()); + preparedStatement.setInt(7, p.getSupplyId()); + preparedStatement.setString(8, p.getId2()); + preparedStatement.setString(9, p.getName2()); + preparedStatement.setFloat(10, 0); + preparedStatement.setInt(11, 1); + preparedStatement.executeUpdate(); + flag=1; + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null, preparedStatement, conn); + } + + return flag; + } + + @Override + /** + * 删除商品信息 + */ + public int deleteProduction(String id) { + int flag = 0; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn + .prepareStatement("delete from production where id = ?"); + preparedStatement.setString(1, id); + preparedStatement.executeUpdate(); + flag = 1; + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null, preparedStatement, conn); + } + return flag; + + } + + @Override + /** + * 更新商品信息 + */ + public int updateProduction(Production p) { + int flag = 0; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn + .prepareStatement("update production set name=?,inPrice=?,OutPrice=?,life=?,sum=?,delmark=? where id = ? and supplyId=?"); + + preparedStatement.setString(1, p.getName()); + preparedStatement.setFloat(2, p.getInPrice()); + preparedStatement.setFloat(3, p.getOutPrice()); + preparedStatement.setInt(4, p.getLife()); + preparedStatement.setInt(5, p.getSum()); + preparedStatement.setInt(6, p.getDelmark()); + preparedStatement.setString(7, p.getId()); + preparedStatement.setInt(8, p.getSupplyId()); + + preparedStatement.executeUpdate(); + flag = 1; + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null, preparedStatement, conn); + } + return flag; + } + + @Override + public Vector findProductionById2(String id) { + /** + * 由一个商品类别id2查找并输出全部商品 + */ + + Vector productions = new Vector(); + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + try { + if(id.equals("0")) + preparedStatement = conn.prepareStatement("select * from production where delmark = 1"); + else + {preparedStatement = conn.prepareStatement("select * from production where id2= ? and delmark = 1"); + preparedStatement.setString(1, id);} + resultSet = preparedStatement.executeQuery(); + + while (resultSet.next()) { + Production production = new Production(); + production.setId(resultSet.getString("id")); + production.setName(resultSet.getString("name")); + production.setInPrice(resultSet.getFloat("inPrice")); + production.setOutPrice(resultSet.getFloat("OutPrice")); + production.setLife(resultSet.getInt("life")); + production.setSum(resultSet.getInt("sum")); + production.setSupplyId(resultSet.getInt("supplyId")); + production.setId2(resultSet.getString("id2")); + production.setName2(resultSet.getString("name2")); + production.setDelmark(resultSet.getInt("delmark")); + productions.add(production); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(resultSet, preparedStatement, conn); + } + return productions; + } + @Override + /** + * 更新商品数量和价格 + */ + public boolean updateProductionSum(String prodId,int sum) { + boolean flag = false; + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + + try { + preparedStatement = conn + .prepareStatement("update production set sum=?+(select sum from(select sum from production where id = ? and delmark=1 ) p) where id = ? and delmark=1;"); + + preparedStatement.setInt(1, sum); + preparedStatement.setString(2, prodId); + preparedStatement.setString(3, prodId); + + if(preparedStatement.executeUpdate()==1); + flag = true; + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + JDBCUtil.close(null, preparedStatement, conn); + } + return flag; + } + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/storageRecordImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/storageRecordImpl.java new file mode 100644 index 0000000..c3bfb3e --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/storageRecordImpl.java @@ -0,0 +1,124 @@ +package com.lingnan.supermarket.dao.impl; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Iterator; +import java.util.Vector; + + + + + + + +import com.lingnan.supermarket.dao.storageRecordService; +import com.lingnan.supermarket.dto.StorageRecord; +import com.lingnan.supermarket.utils.DateUtil; +import com.lingnan.supermarket.utils.JDBCUtil; + +public class storageRecordImpl implements storageRecordService { + + @Override + public Vector findAllStorageRecord() { + Vector v=new Vector(); + + + Connection conn=JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + try { + + String sql="select * from storageRecord order by cDate desc"; + pstmt=conn.prepareStatement(sql); + + resultSet=pstmt.executeQuery(); + while(resultSet.next()) { + StorageRecord sr=new StorageRecord(); + sr.setId(resultSet.getString("id")); + sr.setTheNumber(resultSet.getString("theNumber")); + sr.setNum(resultSet.getInt("num")); + sr.setExecute(resultSet.getString("execute")); + sr.setcDate(DateUtil.dateToString(resultSet.getTimestamp("cDate"), null)); + v.add(sr); + } + + + } + + catch (SQLException e) { + e.printStackTrace(); + }finally { + JDBCUtil.close(resultSet, pstmt, conn); + + } + + + + return v; + } + + + @Override + public StorageRecord findByIdStorageRecord(String theNumber) { + + StorageRecord sr=null; + Connection conn=JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + + try { + sr=new StorageRecord(); + pstmt = conn.prepareStatement("select *from storageRecord where theNumber=?"); + pstmt.setString(1,theNumber); + resultSet = pstmt.executeQuery(); + if(resultSet.next()){ + sr.setTheNumber((resultSet.getString("theNumber"))); + sr.setId((resultSet.getString("id"))); + sr.setNum(resultSet.getInt("num")); + sr.setExecute(resultSet.getString("execute")); + sr.setcDate(DateUtil.dateToString(resultSet.getTimestamp("cDate"), null)); + } + + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }finally{ + JDBCUtil.close(resultSet, pstmt, conn); + } + + + return sr; + } + + public boolean insertStorageRecord(String iNumber,String time,String prodId,String execute,int sum) { + boolean flag = false; + Connection conn=JDBCUtil.getConn(); + PreparedStatement pstmt = null; + ResultSet resultSet=null; + + try { + pstmt = conn.prepareStatement("insert into storageRecord values(?,?,?,?,?) "); + pstmt.setString(1,iNumber); + pstmt.setString(2,time); + pstmt.setString(3,prodId); + pstmt.setString(4,execute); + pstmt.setInt(5,sum); + + if(pstmt.executeUpdate()==1){ + flag = true; + } + + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }finally{ + JDBCUtil.close(resultSet, pstmt, conn); + } + + + return flag; + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/inOrderService.java b/Supermarket/src/com/lingnan/supermarket/dao/inOrderService.java new file mode 100644 index 0000000..293aa66 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/inOrderService.java @@ -0,0 +1,18 @@ +package com.lingnan.supermarket.dao; + +import java.util.Vector; + +import com.lingnan.supermarket.dto.InOrder; + +public interface inOrderService { + //查询全部进货订单 + Vector findAllInOrder (); + //查询某个进货订单 + InOrder findByIdinOrder (String iNumber); + + //默认princial为a1. 创建时new一个时间插入,总价随机模拟 + int addInOrder(String iNumber,float allInPrice ); + int deleteInOrder(String iNumber); + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/inRecordService.java b/Supermarket/src/com/lingnan/supermarket/dao/inRecordService.java new file mode 100644 index 0000000..84b6d44 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/inRecordService.java @@ -0,0 +1,17 @@ +package com.lingnan.supermarket.dao; + +import java.util.Vector; + +import com.lingnan.supermarket.dto.InRecord; +import com.lingnan.supermarket.dto.User; + +public interface inRecordService { + //查询全部进货详细订单 + Vector findAllinRecord(); + //查询某个进货详细订单 + public Vector findByIdinRecord(String iNumber); + + //默认princial为a1. 创建时new一个时间插入,总价随机模拟 + int addinRecord(InRecord ir ); + int deleteinRecord(String iNumber); +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/outOrderService.java b/Supermarket/src/com/lingnan/supermarket/dao/outOrderService.java new file mode 100644 index 0000000..9b10c5c --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/outOrderService.java @@ -0,0 +1,18 @@ +package com.lingnan.supermarket.dao; + +import java.util.Vector; + +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.OutOrder; + +public interface outOrderService { + //查询全部进货订单 + Vector findAllOutOrder (); + //查询某个进货订单 + OutOrder findByIdOutOrder (String oNumber ); + + //默认princial为a1. 创建时new一个时间插入,总价随机模拟 + int addOutOrder(String oNumber ,float allOutPrice ); + int deleteOutOrder(String oNumber ); + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/outRecordService.java b/Supermarket/src/com/lingnan/supermarket/dao/outRecordService.java new file mode 100644 index 0000000..729976a --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/outRecordService.java @@ -0,0 +1,16 @@ +package com.lingnan.supermarket.dao; + +import java.util.Vector; + +import com.lingnan.supermarket.dto.OutRecord; + +public interface outRecordService { + //查询全部进货订单 + Vector findAllOutRecord (); + //查询某个进货订单 + Vector findByIdOutRecordr (String oNumber ); + + + int addoutRecord(OutRecord or); + int deleteOutOrder(String oNumber); +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/prodCatalogService.java b/Supermarket/src/com/lingnan/supermarket/dao/prodCatalogService.java new file mode 100644 index 0000000..6fbb624 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/prodCatalogService.java @@ -0,0 +1,22 @@ +package com.lingnan.supermarket.dao; + +import java.util.ArrayList; +import java.util.Vector; + +import com.lingnan.supermarket.dto.ProdCatalog; + +public interface prodCatalogService { + //根据商品类production的id查询并输出类别 + Vector findProdCatalogAndProd(); + String findProdCatalog(String id1 ); + int addProdCatalog(String id1,String id2); + int deleteProdCatalog(String id2); + + //根据商品类production的name查询并输出类别id + String findProdCatalogByname(String name ); + + //查找所有商品类的类名并以数组输出 + ArrayList findNameProdCatalog(); + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/productionService.java b/Supermarket/src/com/lingnan/supermarket/dao/productionService.java new file mode 100644 index 0000000..0e81865 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/productionService.java @@ -0,0 +1,31 @@ +package com.lingnan.supermarket.dao; + +import java.util.Vector; + +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; + +public interface productionService { + //查找并输出全部商品 + Vector findAllproduction (); + //由一个商品名查找并输出全部商品 + Vector findproduction (String name); + Production findByNameProduction(String name); + + //由一个商品类别id2查找并输出全部商品 + Vector findProductionById2 (String id); + + /*通过id查找商品*/ + public Production findByIdProduction(String id); + //根据id增加 + int addProduction(Production p); + + //根据id删除 + public int deleteProduction(String id) ; + + //根据id更新 + int updateProduction(Production p) ; + + boolean updateProductionSum(String prodId,int sum); + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dao/storageRecordService.java b/Supermarket/src/com/lingnan/supermarket/dao/storageRecordService.java new file mode 100644 index 0000000..6b8d383 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dao/storageRecordService.java @@ -0,0 +1,13 @@ +package com.lingnan.supermarket.dao; + +import java.util.Vector; + +import com.lingnan.supermarket.dto.StorageRecord; + +public interface storageRecordService { + /*库存日志,在进货和顾客购买时进行增加或删除操作*/ + //查询全部进货订单 + Vector findAllStorageRecord (); + //查询某个进货订单 + StorageRecord findByIdStorageRecord (String theNumber ); +} diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/ChangeStatusDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/ChangeStatusDialog.java new file mode 100644 index 0000000..637df04 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dialog/ChangeStatusDialog.java @@ -0,0 +1,184 @@ +package com.lingnan.supermarket.dialog; + +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTextField; + +import com.lingnan.supermarket.*; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.BufferImpl; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; +import com.lingnan.supermarket.dao.impl.inOrderServiceImpl; +import com.lingnan.supermarket.dao.impl.inRecordServiceImpl; +import com.lingnan.supermarket.dao.impl.productionImpl; +import com.lingnan.supermarket.dao.impl.storageRecordImpl; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.InRecord; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.table.OutTableModel; +import com.lingnan.supermarket.utils.TimeAndOrder; +import com.lingnan.supermarket.view.HomeView; +import com.lingnan.supermarket.view.OutView; +import com.lingnan.supermarket.view.ProdCatalogView.MyItemListener; + + +public class ChangeStatusDialog extends JDialog implements ActionListener{ + + + private JPanel statusPanel,opePanel,titlePanel,comboPanel; + private JLabel titleLabel,statusLabel; + private JButton UpdateBtn,cancelBtn; + + private String iNumber; + private String status; + + private Vector InRecords; + + private JComboBox combo; + + private String[] log = { "待入库", "已入库", "取消订单" }; + + private inRecordServiceImpl inRecordImpl; + + private int catalog; + + + private productionImpl productionImpl; + + + + + public ChangeStatusDialog(JFrame parent,String iNumber,String status) { + super(parent,"修改进货订单状态"); + + setSize(400,200); + setLocationRelativeTo(null); + setModal(true); + setResizable(false); + this.setLayout(new FlowLayout()); + + this.iNumber=iNumber; + this.status=status; + initView(); + } + + + + + private void initView() { + + titlePanel = new JPanel(); + titleLabel = new JLabel("修改订单为"+iNumber+"的状态"); + titlePanel.add(titleLabel); + + + statusPanel = new JPanel(); + statusLabel = new JLabel("当前状态:"+status); + statusPanel.add(statusLabel); + + + comboPanel = new JPanel(); + combo = new JComboBox(log);/*下拉表*/ + combo.addItemListener(new MyItemListener()); + comboPanel.add(combo); + + + opePanel = new JPanel(); + UpdateBtn = new JButton("更改"); + cancelBtn = new JButton("取消"); + UpdateBtn.addActionListener(this); + cancelBtn.addActionListener(this); + opePanel.add(UpdateBtn); + opePanel.add(cancelBtn); + + Container container = getContentPane(); + container.add(titlePanel,"North"); + container.add(statusPanel,"Center"); + container.add(comboPanel,"South"); + container.add(opePanel); + + + } + + public class MyItemListener implements ItemListener { + + @Override + public void itemStateChanged(ItemEvent e) { + JComboBox cb = (JComboBox) e.getSource(); + String catalog1 = (String) cb.getSelectedItem(); + if (catalog1.equals("已入库")) { + catalog = 1; + } + else if (catalog1.equals("待入库")) { + catalog = 2; + } else if (catalog1.equals("取消订单")) { + catalog = 3; + } + + } + + } + + + public Vector getVector(){ + return InRecords; + } + + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if(source==UpdateBtn){ + System.out.println("此时此刻的catalog为"+catalog); + //这里修改进货订单表的状态*/ + inOrderServiceImpl inOrderImpl = new inOrderServiceImpl(); + inRecordServiceImpl inRecordImpl = new inRecordServiceImpl(); + storageRecordImpl storageRecordImpl = new storageRecordImpl(); + productionImpl = new productionImpl(); + Production p ; + //获得订单信息 + + //修改状态 + inOrderImpl.updateInOrderStatus(iNumber,catalog); + //确认进货,修改状态并对库存和库存日志修改 + if(catalog==1) { + //获得订单详细信息 + this.InRecords = inRecordImpl.findByIdinRecord(iNumber); + //遍历添加库存 + String s[]=TimeAndOrder.TimeAndOrder("");/*生成时间*/ + for(InRecord i:InRecords) { + //查找到原来的价格 + //更新库存表 + productionImpl.updateProductionSum(i.getId(),i.getSum()); + //增加库存日志表 + storageRecordImpl.insertStorageRecord(iNumber,s[1], i.getId(),"+", i.getSum()); + } + + JOptionPane.showMessageDialog(this,"订单已确认,库存更新成功","提示",JOptionPane.INFORMATION_MESSAGE); + } + /*刷新首页*/ + this.dispose(); + + } + else if(source == cancelBtn) { + + this.dispose(); + } + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/ChangeSumDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/ChangeSumDialog.java new file mode 100644 index 0000000..5c95dc2 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dialog/ChangeSumDialog.java @@ -0,0 +1,185 @@ +package com.lingnan.supermarket.dialog; + +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTextField; + +import com.lingnan.supermarket.*; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.BufferImpl; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; +import com.lingnan.supermarket.dao.impl.productionImpl; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.table.OutTableModel; +import com.lingnan.supermarket.view.OutView; + + +public class ChangeSumDialog extends JDialog implements ActionListener{ + + + private JPanel prodIdPanel,sumPanel,phonePanel,opePanel,titlePanel; + + private JLabel prodIdLabel,sumLabel,titleLabel; + private JTextField prodIdTF,sumTF; + + private JButton UpdateBtn,cancelBtn; + + + private OutTableModel outTableModel = new OutTableModel(); + + private Buffer buffer; + + private String prodId,mark;/*mark用来标记是进货还是出货系统*/ + + private Vector v; + + public ChangeSumDialog(JFrame parent,String prodId,String mark,Vector v) { + super(parent,"更改商品数量"); + + setSize(350,200); + setLocationRelativeTo(null); + setModal(true); + setResizable(false); + this.setLayout(new FlowLayout()); + + this.prodId=prodId; + this.mark=mark; + this.v = v; + initView(); + } + + public ChangeSumDialog(JFrame parent,String prodId,String mark) { + super(parent,"更改商品数量"); + + setSize(350,200); + setLocationRelativeTo(null); + setModal(true); + setResizable(false); + this.setLayout(new FlowLayout()); + + this.prodId=prodId; + this.mark=mark; + initView(); + } + + + + + + private void initView() { + + titlePanel = new JPanel(); + titleLabel = new JLabel("修改商品id为"+prodId+"的数量"); + titlePanel.add(titleLabel); + + + + sumPanel = new JPanel(); + sumLabel = new JLabel("数量"); + sumTF = new JTextField(15); + sumPanel.add(sumLabel); + sumPanel.add(sumTF); + + + opePanel = new JPanel(); + UpdateBtn = new JButton("更改"); + cancelBtn = new JButton("取消"); + UpdateBtn.addActionListener(this); + cancelBtn.addActionListener(this); + opePanel.add(UpdateBtn); + opePanel.add(cancelBtn); + + Container container = getContentPane(); + container.add(titlePanel); + container.add(sumPanel); + container.add(opePanel); + } + + public Vector getVector(){ + return v; + } + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if(source==UpdateBtn){ + + //TODO 参数校验 + /*/返回这个记录的信息*/ + + int sum = Integer.parseInt(sumTF.getText());/*获得数量*/ + System.out.println("所要修改的数量sum="+sum); + + if(sumTF.getText().equals("")) { + JOptionPane.showMessageDialog(this,"请输入完整","提示",JOptionPane.ERROR_MESSAGE); + return; + } + + if(sum<0) {/*判断输入大于0*/ + JOptionPane.showMessageDialog(this,"请输入大于0的数量","提示",JOptionPane.ERROR_MESSAGE); + return; + } + + + + + BufferImpl bufferImpl = new BufferImpl(); + + productionImpl productionImpl = new productionImpl(); + Production production = new Production(); + production = productionImpl.findByIdProduction(prodId); + + Buffer buffer = new Buffer(); + boolean flag = false; + + if(mark=="In") {/*进货界面*/ + for(Production p:v) { + if(p.getId().equals(prodId)) + p.setSum(sum); + } + + } + + else if(mark=="Out") {/*出货界面*/ + buffer = bufferImpl.findInBufferbyId(prodId); + if(buffer!=null) {/*记录有这条数据*/ + if(sum>production.getSum())/*修改数量超过库存*/ + JOptionPane.showMessageDialog(this,"库存数量为:"+production.getSum()+",修改数量请勿超过库存","提示",JOptionPane.ERROR_MESSAGE); + else + flag = bufferImpl.UpdateInBufferById(prodId, sum); + + } + + } + + + if(flag = true) {/*如果修改成功*/ + + JOptionPane.showMessageDialog(this,"修改成功","提示",JOptionPane.INFORMATION_MESSAGE); + dispose(); + + }else { + JOptionPane.showMessageDialog(this,"修改失败","提示",JOptionPane.ERROR_MESSAGE); + dispose(); + } + } + + else if(source == cancelBtn) { + + this.dispose(); + } + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/CloseDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/CloseDialog.java new file mode 100644 index 0000000..492eb45 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dialog/CloseDialog.java @@ -0,0 +1,119 @@ +package com.lingnan.supermarket.dialog; + +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTextField; + +import com.lingnan.supermarket.*; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.BufferImpl; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; +import com.lingnan.supermarket.dao.impl.productionImpl; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.table.OutTableModel; +import com.lingnan.supermarket.view.MainView; +import com.lingnan.supermarket.view.OutView; + + +public class CloseDialog extends JDialog implements ActionListener{ + + + /** + * + */ + private JPanel prodIdPanel,sumPanel,phonePanel,opePanel; + + private JLabel prodIdLabel,sumLabel; + private JTextField prodIdTF,sumTF; + + private JButton saveBtn,unSaveBtn,cancleBtn; + + + private OutTableModel outTableModel = new OutTableModel(); + + private BufferImpl bufferImpl; + + private User user; + private Vector v; + + public CloseDialog(JFrame parent,Vector v) { + super(parent,"提示"); + setSize(350,130); + setLocationRelativeTo(null); + setModal(true); + setResizable(false); + this.setLayout(new FlowLayout()); + + this.v = v; + + initView(); + } + + + + + + private void initView() { + prodIdPanel = new JPanel(); + prodIdLabel = new JLabel("您还未结账,是否保存购物车"); + prodIdPanel.add(prodIdLabel); + + + + opePanel = new JPanel(); + saveBtn = new JButton("保存"); + unSaveBtn = new JButton("不保存"); + cancleBtn = new JButton("取消"); + saveBtn.addActionListener(this); + unSaveBtn.addActionListener(this); + cancleBtn.addActionListener(this); + opePanel.add(saveBtn); + opePanel.add(unSaveBtn); + opePanel.add(cancleBtn); + + Container container = getContentPane(); + container.add(prodIdPanel); + container.add(opePanel); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + bufferImpl = new BufferImpl(); + if(source==saveBtn){/*吧vector数组加入到缓冲区中*/ + for(Production p:v) { + System.out.println("保存数据"); + bufferImpl.insertInBuffer(p); + } + + System.exit(0); + }else if(source==unSaveBtn) { + bufferImpl = new BufferImpl(); + bufferImpl.DelAllOutBuffer(); + System.exit(0); + }else if(source==cancleBtn) { + setVisible(false); + + }/*else if(source==WindowEvent)*/ + } + + + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/InDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/InDialog.java new file mode 100644 index 0000000..78ff81d --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dialog/InDialog.java @@ -0,0 +1,225 @@ +package com.lingnan.supermarket.dialog; + +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTextField; + +import com.lingnan.supermarket.*; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.BufferImpl; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; +import com.lingnan.supermarket.dao.impl.productionImpl; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.table.OutTableModel; +import com.lingnan.supermarket.view.InView; +import com.lingnan.supermarket.view.OutView; +import com.lingnan.supermarket.view.ProdCatalogView.MyItemListener; + + +public class InDialog extends JDialog implements ActionListener{ + + + private JPanel prodIdPanel,sumPanel,phonePanel,opePanel; + + private JLabel prodIdLabel,sumLabel; + private JTextField prodIdTF,sumTF; + + private JButton addBtn,cancelBtn; + + + private OutTableModel outTableModel = new OutTableModel(); + + private Production production; + private productionImpl productionImpl; + + private Vector v; + + private User user; + + private JFrame JFramparent; + + private JComboBox combo; + private String allProdId[] = null; + private Vector vAll; + private static String catalog; + + public InDialog(JFrame parent,Vector v,User user) { + super(parent,"添加商品"); + + setSize(250,200); + setLocationRelativeTo(null); + setModal(true); + setResizable(false); + this.setLayout(new FlowLayout()); + JFramparent=parent; + this.v=v; + this.user = user; + initView(); + + + } + + + + + + private void initView() { + prodIdPanel = new JPanel(); + prodIdLabel = new JLabel("编号"); + + + productionImpl= new productionImpl(); + vAll=productionImpl.findAllproduction(); + allProdId = new String[vAll.size()]; + for(int i=0;i(allProdId); + combo.addItemListener(new MyItemListener()); + + prodIdPanel.add(prodIdLabel); + prodIdPanel.add(combo); + + + + sumPanel = new JPanel(); + sumLabel = new JLabel("数量"); + sumTF = new JTextField(10); + sumPanel.add(sumLabel); + sumPanel.add(sumTF); + + + opePanel = new JPanel(); + addBtn = new JButton("添加"); + cancelBtn = new JButton("取消"); + addBtn.addActionListener(this); + cancelBtn.addActionListener(this); + opePanel.add(addBtn); + opePanel.add(cancelBtn); + + Container container = getContentPane(); + container.add(prodIdPanel); + container.add(sumPanel); + container.add(opePanel); + } + + /*将数组传到inview的刷新方法里面再刷新*/ + public Vector getVector(){ + return v; + } + + + //下拉框监听 + static class MyItemListener implements ItemListener{ + + @Override + public void itemStateChanged(ItemEvent e) { + JComboBox cb=(JComboBox)e.getSource(); + String select=(String) cb.getSelectedItem(); + catalog=select; + } + + } + + + + + + + + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if(source==addBtn){ + //1.判断是否存在这个商品 + //2.如果存在就获取这条商品记录为一个对象 + //3.判断购物缓冲区是否有这个记录 + //3.1如果有update数量和price + //3.2如果没有就insert这条记录,把sum更新 + //保存到数据库 + //关闭对话框 + //刷新table + + + String prodId =catalog; + System.out.println("proId="+prodId); + System.out.println("vatalog="+catalog); + + if(sumTF.getText().equals("")) { + JOptionPane.showMessageDialog(this,"请输入完整","提示",JOptionPane.ERROR_MESSAGE); + return; + } + int sum = Integer.parseInt(sumTF.getText()) ; + + if(sum<0) {/*判断输入大于0*/ + JOptionPane.showMessageDialog(this,"请输入大于0的数量","提示",JOptionPane.ERROR_MESSAGE); + return; + } + + //TODO 参数校验 + /*/判断是已添加,未添加还是不存在*/ + productionImpl productionImpl = new productionImpl(); + production = new Production(); + production = productionImpl.findByIdProduction(prodId); + + + if(production!=null) {/*商品库有这个商品存在*/ + int mark = 0; + for(Production p:v) { + + if(p.getId().equals(prodId)){/*如果数组中存在相同商品就更新数量和价格*/ + sum=p.getSum()+sum;/*数量*/ + p.setSum(sum); + p.setPrice(sum*p.getInPrice());/*进货价格*/ + mark = 1; + break; + } + + } + if(mark==0) {/*插入新的*/ + System.out.println("缓存区不存在,插入新的数据"); + production.setSum(sum);/*更新价格和数量后插入心的*/ + production.setPrice(sum*production.getInPrice()); + v.add(production); + + } + + System.out.println("插入后v的大小"+v.size()); + this.dispose(); + JOptionPane.showMessageDialog(this,"添加成功","提示",JOptionPane.ERROR_MESSAGE); + + + } + + + else {/*商品库没有这个商品*/ + JOptionPane.showMessageDialog(this,"商品不存在","提示",JOptionPane.ERROR_MESSAGE); + } + } + else if(source == cancelBtn) { + + this.dispose(); + } + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/OutDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/OutDialog.java new file mode 100644 index 0000000..43cbf84 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dialog/OutDialog.java @@ -0,0 +1,165 @@ +package com.lingnan.supermarket.dialog; + +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTextField; + +import com.lingnan.supermarket.*; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.BufferImpl; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; +import com.lingnan.supermarket.dao.impl.productionImpl; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.table.OutTableModel; +import com.lingnan.supermarket.view.OutView; + + +public class OutDialog extends JDialog implements ActionListener{ + + + private JPanel prodIdPanel,sumPanel,phonePanel,opePanel; + + private JLabel prodIdLabel,sumLabel; + private JTextField prodIdTF,sumTF; + + private JButton addBtn,cancelBtn; + + + private OutTableModel outTableModel = new OutTableModel(); + + private Buffer buffer; + + public OutDialog(JFrame parent) { + super(parent,"添加商品"); + + setSize(350,300); + setLocationRelativeTo(null); + setModal(true); + setResizable(false); + this.setLayout(new FlowLayout()); + + initView(); + } + + + + + + private void initView() { + prodIdPanel = new JPanel(); + prodIdLabel = new JLabel("编号"); + prodIdTF = new JTextField(15); + prodIdPanel.add(prodIdLabel); + prodIdPanel.add(prodIdTF); + + + sumPanel = new JPanel(); + sumLabel = new JLabel("数量"); + sumTF = new JTextField(15); + sumPanel.add(sumLabel); + sumPanel.add(sumTF); + + + opePanel = new JPanel(); + addBtn = new JButton("添加"); + cancelBtn = new JButton("取消"); + addBtn.addActionListener(this); + cancelBtn.addActionListener(this); + opePanel.add(addBtn); + opePanel.add(cancelBtn); + + Container container = getContentPane(); + container.add(prodIdPanel); + container.add(sumPanel); + container.add(opePanel); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if(source==addBtn){ + //1.判断是否存在这个商品 + //2.如果存在就获取这条商品记录为一个对象 + //3.判断购物缓冲区是否有这个记录 + //3.1如果有update数量和price + //3.2如果没有就insert这条记录,把sum更新 + //保存到数据库 + //关闭对话框 + //刷新table + + String prodId =prodIdTF.getText(); + System.out.println("proId="+prodId); + if(prodIdTF.getText().equals("")||sumTF.getText().equals("")) { + JOptionPane.showMessageDialog(this,"请输入完整","提示",JOptionPane.ERROR_MESSAGE); + return; + } + int sum = Integer.parseInt(sumTF.getText()) ; + if(sum<0) {/*判断输入大于0*/ + JOptionPane.showMessageDialog(this,"请输入大于0的数量","提示",JOptionPane.ERROR_MESSAGE); + return; + } + + //TODO 参数校验 + /*/判断是已添加,未添加还是不存在*/ + productionImpl productionImpl = new productionImpl(); + Production production = new Production(); + production = productionImpl.findByIdProduction(prodId); + + + if(production!=null) {/*商品库有这个商品存在*/ + + buffer = new Buffer(); + BufferImpl BufferImpl = new BufferImpl(); + buffer = BufferImpl.findOutBufferbyId(prodId);/*判断购物车是否有这个商品了,获得已添加的sum和价格*/ + + int allSum = production.getSum(); + + if(sum<0) { + JOptionPane.showMessageDialog(this,"请输入大于0的数量","提示",JOptionPane.ERROR_MESSAGE); + return; + } + + if(buffer!=null)/*购物缓冲区已经有添加的商品*/{ + int exeistSum = buffer.getSum(); + if(sum+exeistSum>allSum)/*库存不够*/{ + JOptionPane.showMessageDialog(this,"库存数量不够,库存数:"+allSum,"提示",JOptionPane.ERROR_MESSAGE); + return; + }else + BufferImpl.addOutBufferExeistProd(prodId, sum, buffer); + + } + else if(buffer==null){/*添加新的商品*/ + if(sum>allSum)/*库存不够*/{ + JOptionPane.showMessageDialog(this,"库存数量不够,库存数:"+allSum,"提示",JOptionPane.ERROR_MESSAGE); + return; + }else + BufferImpl.addOutBufferNewProd(prodId, sum); + } + + this.dispose(); + JOptionPane.showMessageDialog(this,"添加成功","提示",JOptionPane.ERROR_MESSAGE); + + } + + else { + JOptionPane.showMessageDialog(this,"商品不存在","提示",JOptionPane.ERROR_MESSAGE); + } + } + else if(source == cancelBtn) { + + this.dispose(); + } + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/ProductionDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/ProductionDialog.java new file mode 100644 index 0000000..9016fb9 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dialog/ProductionDialog.java @@ -0,0 +1,321 @@ +package com.lingnan.supermarket.dialog; + +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import com.lingnan.supermarket.*; +import com.lingnan.supermarket.dao.SupplierInfService; +import com.lingnan.supermarket.dao.productionService; +import com.lingnan.supermarket.dao.impl.SupplierInfImpl; +import com.lingnan.supermarket.dao.impl.prodCatalogImpl; +import com.lingnan.supermarket.dao.impl.productionImpl; +import com.lingnan.supermarket.dto.ProdCatalog; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.SupplierInf; +import com.lingnan.supermarket.table.ProdCatalogTM; +import com.lingnan.supermarket.view.StorageView; +import com.lingnan.supermarket.view.SupplierView; +import com.lingnan.supermarket.view.ProdCatalogView.MyItemListener; + +public class ProductionDialog extends JDialog implements ActionListener { + + private JPanel namePanel, addressPanel, contactPanel, + opePanel,idPanel,inpricePanel,outpricePanel,lifePanel, + sumPanel,supplyidPanel,id2Panel,name2Panel; + + private JLabel nameLabel, addressLabel, contactLabel, + idLabel,inpriceLabel,outpriceLabel,lifeLabel,sumLabel, + supplyidLabel,id2Label,name2Label; + private JTextField nameTF, addressTF, contactTF, + idTF,inpriceTF,outpriceTF,lifeTF,sumTF, + supplyidTF,id2TF,name2TF; + + private JButton saveBtn, cancelBtn; + + private productionService productionService = new productionImpl(); + + //下拉类别 + private String log[]=null; + private ArrayListalog=null; + private ProdCatalogTM prodCatalogTM; + private ProdCatalog pc; + private prodCatalogImpl pci; + private JComboBox combo; + private String id2; + private String name2; + + //下拉供应商类别 + private String superlier[]=null; + private ArrayListasuperlier=null; + private SupplierInf si; + private SupplierInfImpl sii; + private JComboBox combo1; + private int supplyid; + + private StorageView storageView; + + private Production production; + + public ProductionDialog(JFrame parent) { + super(parent, "添加"); + + + setSize(350, 500); + + setLocationRelativeTo(null); + + setModal(true); + setResizable(false); + + this.setLayout(new FlowLayout()); + + initView(); + } + + private void initView() { + idPanel = new JPanel(); + idLabel = new JLabel("商品编号"); + idTF = new JTextField(15); + idPanel.add(idLabel); + idPanel.add(idTF); + + + namePanel = new JPanel(); + nameLabel = new JLabel("名称"); + nameTF = new JTextField(15); + namePanel.add(nameLabel); + namePanel.add(nameTF); + + + inpricePanel = new JPanel(); + inpriceLabel = new JLabel("进货单价"); + inpriceTF = new JTextField(15); + inpricePanel.add(inpriceLabel); + inpricePanel.add(inpriceTF); + + outpricePanel = new JPanel(); + outpriceLabel = new JLabel("购买单价"); + outpriceTF = new JTextField(15); + outpricePanel.add(outpriceLabel); + outpricePanel.add(outpriceTF); + + + lifePanel = new JPanel(); + lifeLabel = new JLabel("保质期(月份数)"); + lifeTF = new JTextField(15); + lifePanel.add(lifeLabel); + lifePanel.add(lifeTF); + + + sumPanel = new JPanel(); + sumLabel = new JLabel("库存"); + sumTF = new JTextField(15); + sumPanel.add(sumLabel); + sumPanel.add(sumTF); + + //供应商名下拉框 传递supplyid + supplyidPanel = new JPanel(); + supplyidLabel = new JLabel("供应商"); +// supplyidTF = new JTextField(15); + + sii=new SupplierInfImpl(); + this.asuperlier=sii.findNameSupplier(); + this.superlier=new String[asuperlier.size()]; + for(int i=0;i(superlier); + combo1.addItemListener(new MyItemListener1()); + + supplyidPanel.add(supplyidLabel); + supplyidPanel.add(combo1); + + + + + + /* id2Panel = new JPanel(); + id2Label = new JLabel("分类id"); + id2TF = new JTextField(id2,15); + id2Panel.add(id2Label); + id2Panel.add(id2TF);*/ + //类名下拉框 + name2Panel = new JPanel(); + name2Label = new JLabel("类名"); + pci=new prodCatalogImpl(); + this.alog=pci.findNameProdCatalog(); + this.log=new String[alog.size()]; + for(int i=0;i(log); + combo.addItemListener(new MyItemListener()); + name2Panel.add(name2Label); + name2Panel.add(combo); + + + addressPanel = new JPanel(); + addressLabel = new JLabel("地址"); + addressTF = new JTextField(15); + addressPanel.add(addressLabel); + addressPanel.add(addressTF); + + contactPanel = new JPanel(); + contactLabel = new JLabel("电话"); + contactTF = new JTextField(15); + contactPanel.add(contactLabel); + contactPanel.add(contactTF); + + opePanel = new JPanel(); + saveBtn = new JButton("保存"); + cancelBtn = new JButton("取消"); + saveBtn.addActionListener(this); + cancelBtn.addActionListener(this); + opePanel.add(saveBtn); + opePanel.add(cancelBtn); + + Container container = getContentPane(); + container.add(idPanel); + container.add(namePanel); + container.add(inpricePanel); + container.add(outpricePanel); + container.add(lifePanel); + container.add(sumPanel); + container.add(supplyidPanel); +// container.add(id2Panel); + container.add(name2Panel); + container.add(opePanel); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if (source == saveBtn) { + // 思路获取数据 + // 保存到数据库 + // 关闭对话框 + // 刷新table + + String name = nameTF.getText(); + String id = idTF.getText(); + float inprice = Float.parseFloat((inpriceTF.getText())); + float outprice = Float.parseFloat(outpriceTF.getText()); + int life = Integer.parseInt(lifeTF.getText()); + int sum = Integer.parseInt(sumTF.getText()); + + + + // TODO 参数校验 + if (this.production == null) { + if(supplyid==-1){ + JOptionPane.showMessageDialog(this, "商品检索出错", "提示", + JOptionPane.ERROR_MESSAGE); + return; + } + if(supplyid==0){ + JOptionPane.showMessageDialog(this, "请选择商品名", "提示", + JOptionPane.ERROR_MESSAGE); + return; + } + if(id2.equals("0")){ + JOptionPane.showMessageDialog(this, "请选择商品类", "提示", + JOptionPane.ERROR_MESSAGE); + return; + } + + Production production = new Production(); + production.setId(id); + production.setName(name); + production.setInPrice(inprice); + production.setOutPrice(outprice); + production.setLife(life); + production.setSum(sum); + production.setSupplyId(supplyid); + production.setId2(id2); + production.setName2(name2); + int result = productionService.addProduction(production); + // int result = 1; + if (result == 1) { + + JOptionPane.showMessageDialog(this, "添加成功", "提示", + JOptionPane.INFORMATION_MESSAGE); + this.dispose(); + } else if(result == 2){ + JOptionPane.showMessageDialog(this, "已存在该商品", "提示", + JOptionPane.ERROR_MESSAGE); + } + else { + JOptionPane.showMessageDialog(this, "出错!添加失败", "提示", + JOptionPane.ERROR_MESSAGE); + } + }/*else{ + //更新 + SupplierInf supplierInf= new SupplierInf(); + supplierInf.setName(name); + supplierInf.setAddress(address); + supplierInf.setContact(contact); + supplierInf.setId(this.supplierInf.getId()); + + int result = supplierInfService.updateSupplierInf(supplierInf); + if(result==1){ + JOptionPane.showMessageDialog(this, "更新成功", "提示", + JOptionPane.INFORMATION_MESSAGE); + } + }*/ + + } else if (source == cancelBtn) { + + this.dispose(); + } + } + public class MyItemListener implements ItemListener { + + @Override + public void itemStateChanged(ItemEvent e) { + JComboBox cb = (JComboBox) e.getSource(); + name2 = (String) cb.getSelectedItem(); + pci =new prodCatalogImpl(); + for(int i=0;i combo; + // 下拉框中的选项内容,包括请选择身份以及不同的权限角色 + private String[] identity = { "请选择身份", "收银员", "管理员", "超级管理员" }; + + // 构造函数,用于创建添加用户信息的对话框 + public UserDialog(JFrame parent) { + // 调用父类JDialog的构造函数,设置对话框的标题为"添加" + super(parent, "添加"); + + // 设置对话框的大小 + setSize(350, 300); + + // 设置对话框在屏幕中央显示 + setLocationRelativeTo(null); + + // 设置对话框为模态对话框,即显示时会阻塞其他窗口的操作 + setModal(true); + + // 设置对话框大小不可调整 + setResizable(false); + + // 设置对话框的布局为流式布局 + this.setLayout(new FlowLayout()); + + // 初始化对话框的视图组件 + initView(); + } + + // 初始化对话框视图组件的方法 + private void initView() { + // 姓名面板及相关组件的初始化 + namePanel = new JPanel(); + nameLabel = new JLabel("姓名"); + nameTF = new JTextField(15); + namePanel.add(nameLabel); + namePanel.add(nameTF); + + // 账号面板及相关组件的初始化 + loginNamePanel = new JPanel(); + loginNameLabel = new JLabel("账号"); + loginNameTF = new JTextField(15); + loginNamePanel.add(loginNameLabel); + loginNamePanel.add(loginNameTF); + + // 手机面板及相关组件的初始化 + phonePanel = new JPanel(); + phoneLabel = new JLabel("手机"); + phoneTF = new JTextField(15); + phonePanel.add(phoneLabel); + phonePanel.add(phoneTF); + + // 密码面板及相关组件的初始化 + passwordPanel = new JPanel(); + passwordLabel = new JLabel("密码"); + passwordTF = new JTextField(15); + passwordPanel.add(passwordLabel); + passwordPanel.add(passwordTF); + + // 权限面板及相关组件的初始化 + sSuperPanel = new JPanel(); + sSuperLabel = new JLabel("权限"); + // 这里原本有一个文本框用于输入权限,后改为下拉框,所以注释掉了 + // sSuperTF = new JTextField(15); + combo = new JComboBox(identity); + // 为下拉框添加监听器,用于监听选项变化事件 + combo.addItemListener(new MyItemListener()); + sSuperPanel.add(sSuperLabel); + sSuperPanel.add(combo); + + // 操作按钮面板及相关组件的初始化 + opePanel = new JPanel(); + saveBtn = new JButton("保存"); + cancelBtn = new JButton("取消"); + // 为保存按钮和取消按钮添加点击事件监听器 + saveBtn.addActionListener(this); + cancelBtn.addActionListener(this); + opePanel.add(saveBtn); + opePanel.add(cancelBtn); + + // 将各个面板添加到对话框的内容面板中 + Container container = getContentPane(); + container.add(namePanel); + container.add(loginNamePanel); + container.add(passwordPanel); + container.add(phonePanel); + container.add(sSuperPanel); + container.add(opePanel); + } + + // 处理按钮点击事件的方法,实现了ActionListener接口中的方法 + @Override + public void actionPerformed(ActionEvent e) { + // 获取触发事件的源组件 + Object source = e.getSource(); + if (source == saveBtn) { + // 如果点击的是保存按钮,执行以下操作: + + // 获取用户在文本框中输入的姓名、账号、手机和密码信息 + String name = nameTF.getText(); + String loginName = loginNameTF.getText(); + String phone = phoneTF.getText(); + String password = passwordTF.getText(); + + // TODO 参数校验部分,这里应该对获取到的用户输入信息进行合法性校验,比如非空、格式等校验,但目前未实现具体逻辑 + + // 创建一个新的User对象,用于存储要添加到数据库的用户信息 + User user = new User(); + user.setRname(name); + user.setUsername(loginName); + user.setPhone(phone); + user.setPassword(password); + user.setUsuper(sSuper); + + // 调用用户服务接口的添加用户方法,将用户信息添加到数据库中,并获取返回结果 + int result = userService.addUser(user); + if (result == 1) { + // 如果添加成功,关闭当前对话框 + this.dispose(); + // 弹出提示框显示添加成功信息 + JOptionPane.showMessageDialog(this, "添加成功", "提示", JOptionPane.INFORMATION_MESSAGE); + } else { + // 如果添加失败,弹出提示框显示添加失败信息 + JOptionPane.showMessageDialog(this, "添加失败", "提示", JOptionPane.ERROR_MESSAGE); + } + } else if (source == cancelBtn) { + // 如果点击的是取消按钮,直接关闭当前对话框 + this.dispose(); + } + } + + // 内部类,实现了ItemListener接口,用于监听下拉框选项变化事件 + static class MyItemListener implements ItemListener { + + @Override + public void itemStateChanged(ItemEvent e) { + // 获取触发事件的下拉框组件 + JComboBox cb = (JComboBox) e.getSource(); + // 获取当前选中的下拉框选项内容 + String sSuper1 = (String) cb.getSelectedItem(); + if (sSuper1.equals("请选择身份")) + sSuper = -1; + else if (sSuper1.equals("收银员")) + sSuper = 2; + else if (sSuper1.equals("管理员")) + sSuper = 1; + else + sSuper = 0; + } + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java new file mode 100644 index 0000000..7fa02c7 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java @@ -0,0 +1,210 @@ + +package com.lingnan.supermarket.dialog; + +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import com.lingnan.supermarket.*; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.view.LoginView; + +// UserInfDialog类继承自JDialog,用于创建一个修改用户信息的对话框窗口,并实现了ActionListener接口来处理按钮点击事件 +public class UserInfDialog extends JDialog implements ActionListener { + + // 以下是用于构建对话框界面的各个面板、标签、文本框和按钮等组件的声明 + private JPanel namePanel, loginNamePanel, phonePanel, opePanel, passwordPanel, sSuperPanel; + private JLabel nameLabel, loginNameLabel, phoneLabel, passwordLabel, sSuperLabel; + private JTextField nameTF, loginNameTF, phoneTF, passwordTF, sSuperTF; + private JButton saveBtn, cancelBtn; + + // 用户服务接口的实现类实例,用于调用与用户相关的数据库操作方法 + private UserService userService = new UserServiceImpl(); + + // 要修改信息的用户对象 + private User user; + + // 用于存储用户权限级别,初始值为从传入的用户对象中获取的权限级别 + private int sSuper = -1; + + // 下拉框组件,用于选择用户权限(这里部分代码被注释掉,可能原本有完整的权限选择功能,后简化了) + private JComboBox combo; + // 下拉框中的选项内容,包括当前权限以及不同的权限角色 + private String[] identity = { "当前权限", "收银员", "管理员", "超级管理员" }; + + // 父窗口JFrame的引用,可能用于在某些操作后对父窗口进行处理 + private JFrame JFrame; + + // 构造函数,用于创建修改用户信息的对话框,传入父窗口JFrame和要修改信息的用户对象 + public UserInfDialog(JFrame parent, User user) { + // 调用父类JDialog的构造函数,设置对话框的标题为"添加"(这里标题可能需要根据实际情况修改为更合适的,比如"修改用户信息") + super(parent, "添加"); + this.user = user; + // 设置当前用户的权限级别 + this.sSuper = user.getUsuper(); + + // 设置对话框的大小 + setSize(350, 300); + + // 设置对话框在屏幕中央显示 + setLocationRelativeTo(null); + + // 设置对话框为模态对话框,即显示时会阻塞其他窗口的操作 + setModal(true); + + // 设置对话框大小不可调整 + setResizable(false); + + // 设置对话框的布局为流式布局 + this.setLayout(new FlowLayout()); + + // 保存父窗口的引用 + this.JFrame = parent; + + // 初始化对话框的视图组件 + initView(); + } + + // 初始化对话框视图组件的方法 + private void initView() { + + // 姓名面板及相关组件的初始化,文本框中显示当前用户的姓名信息 + namePanel = new JPanel(); + nameLabel = new JLabel("姓名"); + nameTF = new JTextField(user.getRname(), 15); + namePanel.add(nameLabel); + namePanel.add(nameTF); + + // 账号面板及相关组件的初始化,文本框中显示当前用户的账号信息 + loginNamePanel = new JPanel(); + loginNameLabel = new JLabel("账号"); + loginNameTF = new JTextField(user.getUsername(), 15); + loginNamePanel.add(loginNameLabel); + loginNamePanel.add(loginNameTF); + + // 手机面板及相关组件的初始化,文本框中显示当前用户的手机信息 + phonePanel = new JPanel(); + phoneLabel = new JLabel("联系"); + phoneTF = new JTextField(user.getPhone(), 15); + phonePanel.add(phoneLabel); + phonePanel.add(phoneTF); + + // 密码面板及相关组件的初始化,文本框中显示当前用户的密码信息 + passwordPanel = new JPanel(); + passwordLabel = new JLabel("密码"); + passwordTF = new JTextField(user.getPassword(), 15); + passwordPanel.add(passwordLabel); + passwordPanel.add(passwordTF); + + // 权限面板及相关组件的初始化,这里部分代码被注释掉,可能原本有完整的权限选择功能,后简化了 + /* + sSuperPanel = new JPanel(); + sSuperLabel = new JLabel("权限"); + // sSuperTF = new JTextField(15); + combo = new JComboBox(identity); + combo.addItemListener(new MyItemListener()); + sSuperPanel.add(sSuperLabel); + sSuperPanel.add(combo); + */ + + // 操作按钮面板及相关组件的初始化 + opePanel = new JPanel(); + saveBtn = new JButton("保存"); + cancelBtn = new JButton("取消"); + // 为保存按钮和取消按钮添加点击事件监听器 + saveBtn.addActionListener(this); + cancelBtn.addActionListener(this); + opePanel.add(saveBtn); + opePanel.add(cancelBtn); + + // 将各个面板添加到对话框的内容面板中 + Container container = getContentPane(); + container.add(namePanel); + container.add(loginNamePanel); + container.add(passwordPanel); + container.add(phonePanel); + /*container.add(sSuperPanel);*/ + container.add(opePanel); + } + + // 处理按钮点击事件的方法,实现了ActionListener接口中的方法 + @Override + public void actionPerformed(ActionEvent e) { + // 获取触发事件的源组件 + Object source = e.getSource(); + if (source == saveBtn) { + // 如果点击的是保存按钮,执行以下操作: + + // 获取用户在文本框中修改后的姓名、账号、手机和密码信息 + String name = nameTF.getText(); + String loginName = loginNameTF.getText(); + String phone = phoneTF.getText(); + String password = passwordTF.getText(); + + // TODO 参数校验部分,这里应该对获取到的用户输入信息进行合法性校验,比如非空、格式等校验,但目前未实现具体逻辑 + + // 创建一个新的User对象,用于存储要更新到数据库的用户信息,设置了部分从原用户对象获取的信息以及修改后的信息 + User user1 = new User(); + user1.setId(user.getId()); + user1.setRname(name); + user1.setUsername(loginName); + user1.setPhone(phone); + user1.setPassword(password); + user1.setImg(user.getImg()); + user1.setUsuper(sSuper); + + // 调用用户服务接口的根据用户id更新用户信息的方法,将更新后的用户信息保存到数据库中,并获取返回结果 + int result = userService.updateByIdUser(user1); + if (result == 1) { + // 如果更新成功,关闭当前对话框 + this.dispose(); + // 弹出提示框显示修改成功信息,并提示重新登录 + JOptionPane.showMessageDialog(this, "修改成功,请重新登陆", "提示", JOptionPane.INFORMATION_MESSAGE); + // 关闭父窗口 + this.JFrame.dispose(); + // 创建并显示新的登录视图 + new LoginView(); + } else { + // 如果更新失败,弹出提示框显示修改失败信息 + JOptionPane.showMessageDialog(this, "修改失败", "提示", JOptionPane.ERROR_MESSAGE); + } + } else if (source == cancelBtn) { + // 如果点击的是取消按钮,直接关闭当前对话框 + this.dispose(); + } + } + + // 内部类,实现了ItemListener接口,用于监听下拉框选项变化事件(这里部分代码被注释掉,可能原本有完整的权限选择功能,后简化了) + public class MyItemListener implements ItemListener { + + @Override + public void itemStateChanged(ItemEvent e) { + // 获取触发事件的下拉框组件 + JComboBox cb = (JComboBox) e.getSource(); + // 获取当前选中的下拉框选项内容 + String sSuper1 = (String) cb.getSelectedItem(); + if (sSuper1.equals("当前权限")) + sSuper = user.getUsuper(); + else if (sSuper1.equals("收银员")) + sSuper = 2; + else if (sSuper1.equals("管理员")): + sSuper = 1; + else + sSuper = 0; + } + } +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dto/Buffer.java b/Supermarket/src/com/lingnan/supermarket/dto/Buffer.java new file mode 100644 index 0000000..5c2df62 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/Buffer.java @@ -0,0 +1,7 @@ +package com.lingnan.supermarket.dto; + +import com.lingnan.supermarket.dto.base.BaseProduction; + +public class Buffer extends BaseProduction{ + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dto/InOrder.java b/Supermarket/src/com/lingnan/supermarket/dto/InOrder.java new file mode 100644 index 0000000..07620d1 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/InOrder.java @@ -0,0 +1,48 @@ +package com.lingnan.supermarket.dto; + +import java.util.Date; + +public class InOrder { + private String iNumber; + private Float allInPrice; + private String inDate; + private String principal; + private int status; + private int delmark; + public String getiNumber() { + return iNumber; + } + public void setiNumber(String iNumber) { + this.iNumber = iNumber; + } + public Float getAllInPrice() { + return allInPrice; + } + public void setAllInPrice(Float allInPrice) { + this.allInPrice = allInPrice; + } + public String getInDate() { + return inDate; + } + public void setInDate(String inDate) { + this.inDate = inDate; + } + public String getPrincipal() { + return principal; + } + public void setPrincipal(String principal) { + this.principal = principal; + } + public int getDelmark() { + return delmark; + } + public void setDelmark(int delmark) { + this.delmark = delmark; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dto/InRecord.java b/Supermarket/src/com/lingnan/supermarket/dto/InRecord.java new file mode 100644 index 0000000..5bc40f7 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/InRecord.java @@ -0,0 +1,27 @@ +package com.lingnan.supermarket.dto; + +import com.lingnan.supermarket.dto.base.BsDomain; + +public class InRecord extends BsDomain{ + private String iNumber; + private int sum; + private Float inPrice; + public String getiNumber() { + return iNumber; + } + public void setiNumber(String iNumber) { + this.iNumber = iNumber; + } + public int getSum() { + return sum; + } + public void setSum(int sum) { + this.sum = sum; + } + public Float getInPrice() { + return inPrice; + } + public void setInPrice(Float inPrice) { + this.inPrice = inPrice; + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dto/OutOrder.java b/Supermarket/src/com/lingnan/supermarket/dto/OutOrder.java new file mode 100644 index 0000000..464ea7f --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/OutOrder.java @@ -0,0 +1,41 @@ +package com.lingnan.supermarket.dto; + +import java.util.Date; + +public class OutOrder { + private String oNumber; + private Float allOutPrice; + private Date oDate; + private String principal; + private int delmark; + public String getoNumber() { + return oNumber; + } + public void setoNumber(String oNumber) { + this.oNumber = oNumber; + } + public Float getAllOutPrice() { + return allOutPrice; + } + public void setAllOutPrice(Float allOutPrice) { + this.allOutPrice = allOutPrice; + } + public Date getoDate() { + return oDate; + } + public void setoDate(Date oDate) { + this.oDate = oDate; + } + public String getPrincipal() { + return principal; + } + public void setPrincipal(String principal) { + this.principal = principal; + } + public int getDelmark() { + return delmark; + } + public void setDelmark(int delmark) { + this.delmark = delmark; + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dto/OutRecord.java b/Supermarket/src/com/lingnan/supermarket/dto/OutRecord.java new file mode 100644 index 0000000..6abc8c3 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/OutRecord.java @@ -0,0 +1,27 @@ +package com.lingnan.supermarket.dto; + +import com.lingnan.supermarket.dto.base.BsDomain; + +public class OutRecord extends BsDomain{ + private String oNumber; + private int sum; + private Float outPrice; + public String getoNumber() { + return oNumber; + } + public void setoNumber(String oNumber) { + this.oNumber = oNumber; + } + public int getSum() { + return sum; + } + public void setSum(int sum) { + this.sum = sum; + } + public Float getOutPrice() { + return outPrice; + } + public void setOutPrice(Float outPrice) { + this.outPrice = outPrice; + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dto/ProdCatalog.java b/Supermarket/src/com/lingnan/supermarket/dto/ProdCatalog.java new file mode 100644 index 0000000..260f059 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/ProdCatalog.java @@ -0,0 +1,20 @@ +package com.lingnan.supermarket.dto; + +public class ProdCatalog { + private String id; + private String name; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dto/Production.java b/Supermarket/src/com/lingnan/supermarket/dto/Production.java new file mode 100644 index 0000000..92b48db --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/Production.java @@ -0,0 +1,8 @@ +package com.lingnan.supermarket.dto; + +import com.lingnan.supermarket.dto.base.BaseProduction; +import com.lingnan.supermarket.dto.base.BsDomain; + +public class Production extends BaseProduction{ + +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dto/StorageRecord.java b/Supermarket/src/com/lingnan/supermarket/dto/StorageRecord.java new file mode 100644 index 0000000..0aa3b09 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/StorageRecord.java @@ -0,0 +1,36 @@ +package com.lingnan.supermarket.dto; + +import java.util.Date; + +import com.lingnan.supermarket.dto.base.BsDomain; + +public class StorageRecord extends BsDomain{ + private String theNumber; + private String cDate; + private int num; + private String execute; + public String getTheNumber() { + return theNumber; + } + public void setTheNumber(String theNumber) { + this.theNumber = theNumber; + } + public String getcDate() { + return cDate; + } + public void setcDate(String cDate) { + this.cDate = cDate; + } + public int getNum() { + return num; + } + public void setNum(int num) { + this.num = num; + } + public String getExecute() { + return execute; + } + public void setExecute(String execute) { + this.execute = execute; + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dto/SupplierInf.java b/Supermarket/src/com/lingnan/supermarket/dto/SupplierInf.java new file mode 100644 index 0000000..96c027a --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/SupplierInf.java @@ -0,0 +1,45 @@ +package com.lingnan.supermarket.dto; + +import com.lingnan.supermarket.dto.base.BaseDomain; + + +public class SupplierInf extends BaseDomain{ + private String name; + private String address; + private String contact; + private String email; + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + private int delmark; + + + + public int getDelmark() { + return delmark; + } + public void setDelmark(int delmark) { + this.delmark = delmark; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getAddress() { + return address; + } + public void setAddress(String address) { + this.address = address; + } + public String getContact() { + return contact; + } + public void setContact(String contact) { + this.contact = contact; + } + } diff --git a/Supermarket/src/com/lingnan/supermarket/dto/User.java b/Supermarket/src/com/lingnan/supermarket/dto/User.java new file mode 100644 index 0000000..1d89b15 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/User.java @@ -0,0 +1,99 @@ +package com.lingnan.supermarket.dto; + +import com.lingnan.supermarket.dto.base.BaseDomain; + +// User类继承自BaseDomain类,用于表示超市系统中的用户信息实体类 +// 该类包含了与用户相关的各种属性信息以及对应的访问器(getter)和修改器(setter)方法 +public class User extends BaseDomain { + + // 用户名,可能用于登录系统等场景 + private String username; + + // 用户的真实姓名 + private String rname; + + // 用户的登录密码 + private String password; + + // 用户的联系电话 + private String phone; + + // 用户的头像图片路径或相关标识(具体根据业务需求确定其存储内容) + private String img; + + // 用户的权限级别,不同的整数值可能代表不同的权限角色,例如:0可能代表超级管理员,1代表管理员,2代表收银员等(具体含义由业务定义) + private int usuper; + + // 标记用户记录是否已被删除,例如:1表示未删除,0表示已删除(具体取值含义由业务定义) + private int delmark; + + // 获取用户头像图片相关信息的方法 + public String getImg() { + return img; + } + + // 设置用户头像图片相关信息的方法 + public void setImg(String img) { + this.img = img; + } + + // 获取用户联系电话的方法 + public String getPhone() { + return phone; + } + + // 设置用户联系电话的方法 + public void setPhone(String phone) { + this.phone = phone; + } + + // 获取用户真实姓名的方法 + public String getRname() { + return rname; + } + + // 设置用户真实姓名的方法 + public void setRname(String rname) { + this.rname = rname; + } + + // 获取用户记录删除标记的方法 + public int getDelmark() { + return delmark; + } + + // 设置用户记录删除标记的方法 + public void setDelmark(int delmark) { + this.delmark = delmark; + } + + // 获取用户名的方法 + public String getUsername() { + return username; + } + + // 设置用户名的方法 + public void setUsername(String username) { + this.username = username; + } + + // 获取用户登录密码的方法 + public String getPassword() { + return password; + } + + // 设置用户登录密码的方法 + public void setPassword(String password) { + this.password = password; + } + + // 获取用户权限级别的方法 + public int getUsuper() { + return usuper; + } + + // 设置用户权限级别的方法 + public void setUsuper(int usuper) { + this.usuper = usuper; + } +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dto/base/BaseDomain.java b/Supermarket/src/com/lingnan/supermarket/dto/base/BaseDomain.java new file mode 100644 index 0000000..52081eb --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/base/BaseDomain.java @@ -0,0 +1,15 @@ +package com.lingnan.supermarket.dto.base; + +public class BaseDomain { + + private Integer id; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + +} diff --git a/Supermarket/src/com/lingnan/supermarket/dto/base/BaseProduction.java b/Supermarket/src/com/lingnan/supermarket/dto/base/BaseProduction.java new file mode 100644 index 0000000..fa82d00 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/base/BaseProduction.java @@ -0,0 +1,86 @@ +package com.lingnan.supermarket.dto.base; + +public class BaseProduction { + private String id; + private String name; + private float inPrice; + private float OutPrice; + private int life; + private int sum; + private int supplyId; + private String id2; + private String name2; + private Float price; + private int delmark; + + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public int getDelmark() { + return delmark; + } + public void setDelmark(int delmark) { + this.delmark = delmark; + } + public int getSum() { + return sum; + } + public void setSum(int sum) { + this.sum = sum; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public float getInPrice() { + return inPrice; + } + public void setInPrice(float inPrice) { + this.inPrice = inPrice; + } + public float getOutPrice() { + return OutPrice; + } + public void setOutPrice(float outPrice) { + OutPrice = outPrice; + } + public int getLife() { + return life; + } + public void setLife(int life) { + this.life = life; + } + + public String getId2() { + return id2; + } + public void setId2(String id2) { + this.id2 = id2; + } + + public String getName2() { + return name2; + } + public void setName2(String name2) { + this.name2 = name2; + } + + public int getSupplyId() { + return supplyId; + } + public void setSupplyId(int supplyId) { + this.supplyId = supplyId; + } + public Float getPrice() { + return price; + } + public void setPrice(Float price) { + this.price = price; + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/dto/base/BsDomain.java b/Supermarket/src/com/lingnan/supermarket/dto/base/BsDomain.java new file mode 100644 index 0000000..470348f --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/dto/base/BsDomain.java @@ -0,0 +1,13 @@ +package com.lingnan.supermarket.dto.base; + +public class BsDomain { + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/InOrderTM.java b/Supermarket/src/com/lingnan/supermarket/table/InOrderTM.java new file mode 100644 index 0000000..60934ee --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/InOrderTM.java @@ -0,0 +1,107 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + +import javax.swing.JFrame; +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.*; +import com.lingnan.supermarket.dialog.InDialog; + + +public class InOrderTM extends AbstractTableModel{ + + private String [] columnName = {"订单号","总价","时间","负责人","状态"}; + + private productionImpl prodDao = new productionImpl(); + + private Vector InOrders; + private inOrderServiceImpl inOrderImpl= new inOrderServiceImpl(); + private InOrder inOrder ; + + String iNumber ;/*订单号*/ + + + public void allInOrderRecord() { + //将添加的商品加入到静态变量Vector数组中 + /*prod = InDialog.getProduction();*/ + InOrders = inOrderImpl.findAllInOrder(); + } + + //查找分类结果 + public void resultOfFind(int catalog) { + if(catalog==0) + InOrders = inOrderImpl.findAllInOrder(); + else + InOrders = inOrderImpl.FindStatus(catalog); + } + + //根据订单查找 + public void resultOfNumber(String Number) { + InOrders=new Vector(); + inOrder = inOrderImpl.findByIdinOrder(Number); + InOrders.add(inOrder); + } + + @Override + public int getRowCount() { + return InOrders.size(); + } + +/* public Float getAllPrice() { + return BufferImpl.InBufferAllPrice(); + } +*/ + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + inOrder = InOrders.get(rowIndex); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + iNumber=inOrder.getiNumber(); + if(columnIndex==0) { + return inOrder.getiNumber(); + }else if(columnIndex==1) { + return inOrder.getAllInPrice(); + }else if(columnIndex==2) { + return inOrder.getInDate(); + }else if(columnIndex==3) { + return inOrder.getPrincipal(); + }else if(columnIndex==4) { + String status = null; + if(inOrder.getStatus()==1) + status= "已入库"; + else if(inOrder.getStatus()==2) + status= "待入库"; + else if(inOrder.getStatus()==3) + status= "已取消"; + return status; + }else { + return null; + } + } + + public String getINumber() { /*返回要修改或删除的记录*/ + return iNumber; + } + + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/InRecordTM.java b/Supermarket/src/com/lingnan/supermarket/table/InRecordTM.java new file mode 100644 index 0000000..8bb0ad9 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/InRecordTM.java @@ -0,0 +1,91 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + +import javax.swing.JFrame; +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.InRecord; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.*; +import com.lingnan.supermarket.dialog.InDialog; + + +public class InRecordTM extends AbstractTableModel{ + + private String [] columnName = {"订单号","id","数量","金额"}; + + private productionImpl prodDao = new productionImpl(); + + private Vector InRecords; + + private inRecordServiceImpl inRecordImpl = new inRecordServiceImpl(); + private InRecord inRecord= new InRecord(); + + + private String iNumber ;/*订单号*/ + + + public InRecordTM(String iNumber) { + this.iNumber=iNumber; + } + + public void findInRecordByINumber() { + //将添加的商品加入到静态变量Vector数组中 + /*prod = InDialog.getProduction();*/ + InRecords = inRecordImpl.findByIdinRecord(iNumber); + } + + + @Override + public int getRowCount() { + return InRecords.size(); + } + +/* public Float getAllPrice() { + return BufferImpl.InBufferAllPrice(); + } +*/ + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + inRecord = InRecords.get(rowIndex); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + iNumber=inRecord.getiNumber(); + if(columnIndex==0) { + return inRecord.getiNumber(); + }else if(columnIndex==1) { + return inRecord.getId(); + }else if(columnIndex==2) { + return inRecord.getSum(); + }else if(columnIndex==3) { + return inRecord.getInPrice(); + }else { + return null; + } + } + + public String getINumber() { /*返回要修改或删除的记录*/ + return iNumber; + } + + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/InTableModel.java b/Supermarket/src/com/lingnan/supermarket/table/InTableModel.java new file mode 100644 index 0000000..b8f28ad --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/InTableModel.java @@ -0,0 +1,99 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + +import javax.swing.JFrame; +import javax.swing.table.AbstractTableModel; + + +import com.lingnan.supermarket.dto.InOrder; + +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.*; +import com.lingnan.supermarket.dialog.InDialog; + + + +public class InTableModel extends AbstractTableModel{ + + + private String [] columnName = {"id","名称","数量","单价","价格","保质期","类别","供应商id"}; + + private productionImpl prodDao = new productionImpl(); + + private Vector v; + + + String id ; + + + public InTableModel(Vector v) { + System.out.println("调用imtablemodel里面的构造函数"); + this.v=v; + } + + + + public int getRowCount() { + return v.size(); + } + + public Float getAllPrice() { + Float allPrice=(float) 0; + for(Production p:v) { + allPrice+=p.getPrice(); + } + return allPrice; + } + + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + Production p = v.get(rowIndex); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + id=p.getId(); + if(columnIndex==0) { + return p.getId(); + }else if(columnIndex==1) { + return p.getName(); + }else if(columnIndex==2) { + return p.getSum(); + }else if(columnIndex==3) { + return p.getInPrice() ; + }else if(columnIndex==4) { + return p.getPrice() ; + }else if(columnIndex==5) { + return p.getLife(); + }else if(columnIndex==6) { + return p.getName2()+p.getId2(); + }else if(columnIndex==7) { + return p.getSupplyId(); + }else { + return null; + } + } + + public String getId() { /*返回要修改或删除的记录*/ + return id; + } + + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + + + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/OutOrderTM.java b/Supermarket/src/com/lingnan/supermarket/table/OutOrderTM.java new file mode 100644 index 0000000..5c36fe1 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/OutOrderTM.java @@ -0,0 +1,93 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + +import javax.swing.JFrame; +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.OutOrder; +import com.lingnan.supermarket.dto.OutRecord; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.*; +import com.lingnan.supermarket.dialog.InDialog; + + +public class OutOrderTM extends AbstractTableModel{ + + private String [] columnName = {"订单号","总价","时间","负责人"}; + + private productionImpl prodDao = new productionImpl(); + + private Vector outOrders; + private outOrderServiceImpl outOrderImpl= new outOrderServiceImpl(); + private OutOrder outOrder ; + + String oNumber ;/*订单号*/ + + + public void allOutOrderRecord() { + //将添加的商品加入到静态变量Vector数组中 + /*prod = InDialog.getProduction();*/ + outOrders = outOrderImpl.findAllOutOrder(); + } + + public void resultOfNumber(String oNumber) { + outOrders = new Vector(); + outOrder = outOrderImpl.findByIdOutOrder(oNumber); + outOrders.add(outOrder); + } + + + + @Override + public int getRowCount() { + return outOrders.size(); + } + +/* public Float getAllPrice() { + return BufferImpl.InBufferAllPrice(); + } +*/ + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + outOrder = outOrders.get(rowIndex); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + oNumber=outOrder.getoNumber(); + if(columnIndex==0) { + return outOrder.getoNumber(); + }else if(columnIndex==1) { + return outOrder.getAllOutPrice(); + }else if(columnIndex==2) { + return outOrder.getoDate(); + }else if(columnIndex==3) { + return outOrder.getPrincipal(); + }else { + return null; + } + } + + public String getOutNumber() { /*返回要修改或删除的记录*/ + return oNumber; + } + + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/OutRecordTM.java b/Supermarket/src/com/lingnan/supermarket/table/OutRecordTM.java new file mode 100644 index 0000000..ba7f8ae --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/OutRecordTM.java @@ -0,0 +1,98 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + +import javax.swing.JFrame; +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.InRecord; +import com.lingnan.supermarket.dto.OutRecord; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.*; +import com.lingnan.supermarket.dialog.InDialog; + + +public class OutRecordTM extends AbstractTableModel{ + + /** + * + */ + + private String [] columnName = {"订单号","id","数量","金额"}; + + private productionImpl prodDao = new productionImpl(); + + private Vector OutRecords; + + private outRecordServiceImpl outRecordImpl = new outRecordServiceImpl(); + private OutRecord outRecord= new OutRecord(); + + + private String oNumber ;/*订单号*/ + + + public OutRecordTM(String oNumber) { + this.oNumber=oNumber; + } + + public void findOutRecordByINumber() { + //将添加的商品加入到静态变量Vector数组中 + /*prod = InDialog.getProduction();*/ + OutRecords = outRecordImpl.findByIdOutRecordr(oNumber); + } + + + + + + @Override + public int getRowCount() { + return OutRecords.size(); + } + +/* public Float getAllPrice() { + return BufferImpl.InBufferAllPrice(); + } +*/ + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + outRecord = OutRecords.get(rowIndex); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + oNumber=outRecord.getoNumber(); + if(columnIndex==0) { + return outRecord.getoNumber(); + }else if(columnIndex==1) { + return outRecord.getId(); + }else if(columnIndex==2) { + return outRecord.getSum(); + }else if(columnIndex==3) { + return outRecord.getOutPrice(); + }else { + return null; + } + } + + public String getONumber() { /*返回要修改或删除的记录*/ + return oNumber; + } + + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/OutTableModel.java b/Supermarket/src/com/lingnan/supermarket/table/OutTableModel.java new file mode 100644 index 0000000..a25663b --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/OutTableModel.java @@ -0,0 +1,81 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + +import javax.swing.JFrame; +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.*; +import com.lingnan.supermarket.dialog.OutDialog; + + +public class OutTableModel extends AbstractTableModel{ + + private String [] columnName = {"id","名称","数量","单价","价格","保质期","类别","供应商id"}; + + private productionImpl prodDao = new productionImpl(); + + private Vector Buffers; + private BufferImpl BufferImpl = new BufferImpl(); + + + public void allOutBuffer() { + //将添加的商品加入到静态变量Vector数组中 + /*prod = OutDialog.getProduction();*/ + Buffers = BufferImpl.allOutBuffer(); + } + + + @Override + public int getRowCount() { + return Buffers.size(); + } + + public Float getAllPrice() { + return BufferImpl.OutBufferAllPrice(); + } + + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + Buffer Buffer = Buffers.get(rowIndex); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + if(columnIndex==0) { + return Buffer.getId(); + }else if(columnIndex==1) { + return Buffer.getName(); + }else if(columnIndex==2) { + return Buffer.getSum(); + }else if(columnIndex==3) { + return Buffer.getOutPrice() ; + }else if(columnIndex==4) { + return Buffer.getPrice() ; + }else if(columnIndex==5) { + return Buffer.getLife(); + }else if(columnIndex==6) { + return Buffer.getName2()+Buffer.getId2(); + }else if(columnIndex==7) { + return Buffer.getSupplyId(); + }else { + return null; + } + } + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/ProdCatalogTM.java b/Supermarket/src/com/lingnan/supermarket/table/ProdCatalogTM.java new file mode 100644 index 0000000..e93774b --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/ProdCatalogTM.java @@ -0,0 +1,65 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.*; + + +public class ProdCatalogTM extends AbstractTableModel{ + + private String [] columnName = {"类别id","类别名称","商品id","商品名称"}; + + private productionImpl prodDao = new productionImpl(); + + private Vector prods; + public void all() { + //查找全部数据 + prods = prodDao.findAllproduction(); + } + public void ById2(Production p) { + //查找全部数据 + prods = prodDao.findProductionById2(p.getId2()); + } + + @Override + public int getRowCount() { + return prods.size(); + } + + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + Production prod = prods.get(rowIndex); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + if(columnIndex==0) { + return prod.getId2(); + }else if(columnIndex==1) { + return prod.getName2(); + }else if(columnIndex==2) { + return prod.getId(); + }else if(columnIndex==3) { + return prod.getName(); + }else { + return null; + } + } + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/StorageRecordTM.java b/Supermarket/src/com/lingnan/supermarket/table/StorageRecordTM.java new file mode 100644 index 0000000..18e43d9 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/StorageRecordTM.java @@ -0,0 +1,75 @@ +package com.lingnan.supermarket.table; + +import java.util.Vector; + +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dao.impl.storageRecordImpl; +import com.lingnan.supermarket.dto.StorageRecord; + + +public class StorageRecordTM extends AbstractTableModel{ + + private String [] columnName = {"订单号","操作时间","商品编号","进货+/出货-","数量"}; + + private storageRecordImpl srDao = new storageRecordImpl(); + + private Vector storageRecords; + private StorageRecord storageRecord ; + + String oNumber ;/*订单号*/ + + + public void allStoragrRecord() { + //将添加的商品加入到静态变量Vector数组中 + /*prod = InDialog.getProduction();*/ + storageRecords = srDao.findAllStorageRecord(); + } + + + @Override + public int getRowCount() { + return storageRecords.size(); + } + +/* public Float getAllPrice() { + return BufferImpl.InBufferAllPrice(); + } +*/ + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + storageRecord = storageRecords.get(rowIndex); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + oNumber=storageRecord.getTheNumber(); + if(columnIndex==0) { + return storageRecord.getTheNumber(); + }else if(columnIndex==1) { + return storageRecord.getcDate(); + }else if(columnIndex==2) { + return storageRecord.getId(); + }else if(columnIndex==3) { + return storageRecord.getExecute(); + }else if(columnIndex==4) { + return storageRecord.getNum(); + }else { + return null; + } + } + + + + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/StorageTableModel.java b/Supermarket/src/com/lingnan/supermarket/table/StorageTableModel.java new file mode 100644 index 0000000..1d23b82 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/StorageTableModel.java @@ -0,0 +1,69 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.*; + + +public class StorageTableModel extends AbstractTableModel{ + + private String [] columnName = {"id","名称","保质期","数量","类别","供应商编号"}; + + private productionImpl prodDao = new productionImpl(); + + private Vector prods; + public void all() { + //查找全部数据 + prods = prodDao.findAllproduction(); + } + public void Byname(Production p) { + //查找全部数据 + prods = prodDao.findproduction(p.getName()); + } + + @Override + public int getRowCount() { + return prods.size(); + } + + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + Production prod = prods.get(rowIndex); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + if(columnIndex==0) { + return prod.getId(); + }else if(columnIndex==1) { + return prod.getName(); + }else if(columnIndex==2) { + return prod.getLife(); + }else if(columnIndex==3) { + return prod.getSum(); + }else if(columnIndex==4) { + return prod.getName2()+prod.getId2(); + }else if(columnIndex==5) { + return prod.getSupplyId(); + }else { + return null; + } + } + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/SupplierTableModel.java b/Supermarket/src/com/lingnan/supermarket/table/SupplierTableModel.java new file mode 100644 index 0000000..8d1fe4f --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/SupplierTableModel.java @@ -0,0 +1,93 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + + + +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dto.SupplierInf; +import com.lingnan.supermarket.dao.SupplierInfService; +import com.lingnan.supermarket.dao.impl.*; + + +public class SupplierTableModel extends AbstractTableModel{ + + private String [] columnName = {"id","名称","地址","联系方式","邮箱"}; + + //private SupplierInfImpl supplierDao = new SupplierInfImpl(); + private SupplierInfService supplierInfService = new SupplierInfImpl(); + + private SupplierInf supplierInf = new SupplierInf(); + + private Vector suppliers; + + private int id=0; + + public void all() { + //查找全部数据 + suppliers = supplierInfService.findAllSupplierInf(); + } + + public void Byname(SupplierInf supplierInf) { + suppliers = supplierInfService.findByNameSupplierInf(supplierInf); + + } + + + @Override + public int getRowCount() { + return suppliers.size(); + } + + @Override + public int getColumnCount() { + return columnName.length; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + SupplierInf prod = suppliers.get(rowIndex); + //id = supplierInf.getId(); +/* System.out.println( "id="+users.get(rowIndex).getId()); + System.out.println("rowIndex"+rowIndex); + System.out.println("columnIndex"+columnIndex);*/ + if(columnIndex==0) { + return prod.getId(); + }else if(columnIndex==1) { + return prod.getName(); + }else if(columnIndex==2) { + return prod.getAddress(); + }else if(columnIndex==3) { + return prod.getContact(); + }else if(columnIndex==4){ + return prod.getEmail(); + } + else { + return null; + } + } + + @Override + public String getColumnName(int column) { + return columnName[column]; + } + +/* + public int getId() { + return id; + } + public int getValueAt(int rowIndex){ + SupplierInf supplierInf = suppliers.get(rowIndex); + id=suppliers.get(rowIndex).getId(); + //System.out.println("rowIndex"+rowIndex); + //System.out.println("columnIndex"+columnIndex); + return supplierInf.getId(); + } + + */ + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/table/UserTableModel.java b/Supermarket/src/com/lingnan/supermarket/table/UserTableModel.java new file mode 100644 index 0000000..0e63ec9 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/table/UserTableModel.java @@ -0,0 +1,118 @@ +package com.lingnan.supermarket.table; + +import java.util.List; +import java.util.Vector; + +import javax.swing.table.AbstractTableModel; + +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; + +// UserTableModel类继承自AbstractTableModel,用于为Swing中的表格组件提供数据模型 +// 它负责管理和提供与用户信息相关的数据,以便在表格中展示 +public class UserTableModel extends AbstractTableModel { + + // 定义表格列名数组,用于指定表格每一列的标题 + private String[] columnName = { "id", "工号", "密码", "姓名", "权限", "电话" }; + + // 用户服务接口的实现类实例,用于调用与用户相关的数据库操作方法,以获取用户数据 + private UserService userService = new UserServiceImpl(); + + // 用于存储当前行对应的用户ID,初始化为0 + private int id = 0; + + // 存储用户信息的向量,用于保存从数据库中获取的用户数据列表,以便在表格中显示 + private Vector users; + + // 方法用于获取所有用户的数据,并将其存储在users向量中 + // 该方法会调用userService的allUser方法从数据库中查询所有用户信息 + public void all() { + // 查找全部数据 + users = userService.allUser(); + } + + // 根据传入的用户对象,通过调用userService的findByrnameUser方法 + // 从数据库中查找匹配该用户真实姓名的相关用户数据,并存储在users向量中 + public void Byrname(User user) { + users = userService.findByrnameUser(user); + } + + // 重写AbstractTableModel中的方法,用于获取表格的行数 + // 返回值是存储用户数据的向量users的大小,即表格中显示的用户记录行数 + @Override + public int getRowCount() { + return users.size(); + } + + // 重写AbstractTableModel中的方法,用于获取表格的列数 + // 返回值是列名数组columnName的长度,即表格中显示的列数 + @Override + public int getColumnCount() { + return columnName.length; + } + + // 重写AbstractTableModel中的方法,用于获取指定单元格的值 + // 根据传入的行索引rowIndex和列索引columnIndex,从users向量中获取对应的用户对象 + // 然后根据列索引返回该用户对象相应属性的值,以便在表格相应单元格中显示 + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + // 从users向量中获取指定行索引的用户对象 + User user = users.get(rowIndex); + id = user.getId(); + /* + * 以下几行代码可能是用于调试目的,输出当前获取到的用户ID、行索引和列索引信息 + * System.out.println( "id=" + users.get(rowIndex).getId()); + * System.out.println("rowIndex" + rowIndex); + * System.out.println("columnIndex" + columnIndex); + */ + if (columnIndex == 0) { + // 如果列索引为0,返回用户的ID + return user.getId(); + } else if (columnIndex == 1) { + // 如果列索引为1,返回用户的工号(这里假设工号对应用户名属性,具体根据业务需求可能有调整) + return user.getUsername(); + } else if (columnIndex == 2) { + // 如果列索引为2,返回用户的密码 + return user.getPassword(); + } else if (columnIndex == 3) { + // 如果列索引为3,返回用户的姓名 + return user.getRname(); + } else if (columnIndex == 4) { + // 如果列索引为4,返回用户的权限级别 + return user.getUsuper(); + } else if (columnIndex == 5) { + // 如果列索引为5,返回用户的电话 + return user.getPhone(); + } else { + // 如果列索引不在有效范围内,返回null + return null; + } + } + + // 获取当前行对应的用户ID的方法 + public int getid() { + return id; + } + + // 该方法的实现可能存在一些混淆,它的名字看起来像是获取指定行索引单元格的值,但实际上它只返回了用户的ID + // 可能原本是想实现类似getValueAt的功能,但代码逻辑不太完整或准确 + public int getValueAt(int rowIndex) { + User user = users.get(rowIndex); + id = users.get(rowIndex).getId(); + /* + * 以下几行代码可能是用于调试目的,输出当前获取到的用户ID、行索引信息 + * System.out.println( "id=" + users.get(rowIndex).getId()); + * System.out.println("rowIndex" + rowIndex); + * System.out.println("columnIndex" + columnIndex); + */ + return user.getId(); + } + + // 重写AbstractTableModel中的方法,用于获取指定列的列名 + // 根据传入的列索引column,从列名数组columnName中获取对应的列名并返回 + @Override + public String getColumnName(int column) { + return columnName[column]; + } +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/utils/CreateOrder.java b/Supermarket/src/com/lingnan/supermarket/utils/CreateOrder.java new file mode 100644 index 0000000..89a9565 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/utils/CreateOrder.java @@ -0,0 +1,28 @@ +package com.lingnan.supermarket.utils; + +import java.util.Vector; + +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.Production; + +public class CreateOrder { + + + public String CreateOrder(Vector v,String oNumber,String time,Float allPrice,String username) { + String xx="----------------------------------------------------------------------------\r\n"; + String InRequireText=time+"\r\n"+xx; + InRequireText += "#名称 #单价 #数量 #金额\r\n";/*生成订单小票*/ + for(Production p:v) { + InRequireText+=p.getName()+" "+p.getInPrice()+" "+p.getSum()+" "+p.getPrice()+"\r\n"; + } + InRequireText+="\r\n"+xx; + InRequireText+="#总进货金额:"+allPrice+"元"; + InRequireText+="\r\n#负责人:"+username; + InRequireText+="\r\n#订单编号:"+oNumber; + InRequireText+="\r\n#地址:新民超市"; + InRequireText+="\r\n#联系电话:xxx"; + + return InRequireText; + } + +} diff --git a/Supermarket/src/com/lingnan/supermarket/utils/DateUtil.java b/Supermarket/src/com/lingnan/supermarket/utils/DateUtil.java new file mode 100644 index 0000000..21e4522 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/utils/DateUtil.java @@ -0,0 +1,22 @@ +package com.lingnan.supermarket.utils; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class DateUtil { + + + /** + * 格式化日期 + * @param date + * @param pattern + * @return + */ + public static String dateToString(Date date,String pattern) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(); + simpleDateFormat.applyPattern(pattern==null?"yyyy-MM-dd HH:mm:ss":pattern); + return simpleDateFormat.format(date); + } + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/utils/EmailTest.java b/Supermarket/src/com/lingnan/supermarket/utils/EmailTest.java new file mode 100644 index 0000000..f3769fb --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/utils/EmailTest.java @@ -0,0 +1,14 @@ +package com.lingnan.supermarket.utils; + +import javax.mail.MessagingException; +import javax.mail.internet.AddressException; + +public class EmailTest { + + public static void main(String[] args) throws AddressException, MessagingException { + // TODO Auto-generated method stub + + + } + +} diff --git a/Supermarket/src/com/lingnan/supermarket/utils/FontUtil.java b/Supermarket/src/com/lingnan/supermarket/utils/FontUtil.java new file mode 100644 index 0000000..b8fbbf3 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/utils/FontUtil.java @@ -0,0 +1,18 @@ +package com.lingnan.supermarket.utils; + +import java.awt.Color; +import java.awt.Font; + +public class FontUtil { + + //常用字体 + public static final Font menuFont = new Font("幼圆",Font.CENTER_BASELINE,25); + //账户字体 + public static final Font userFont = new Font("幼圆",Font.CENTER_BASELINE,20); + //提醒用字*/ + public static final Font remindFont = new Font("幼圆",Font.CENTER_BASELINE,20); + //首页用字体 + public static final Font homeFont = new Font("幼圆",Font.CENTER_BASELINE,40); + //表格字体 + public static final Font tableFont = new Font("幼圆",Font.CENTER_BASELINE,18); +} diff --git a/Supermarket/src/com/lingnan/supermarket/utils/JDBCUtil.java b/Supermarket/src/com/lingnan/supermarket/utils/JDBCUtil.java new file mode 100644 index 0000000..fbc664e --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/utils/JDBCUtil.java @@ -0,0 +1,88 @@ +package com.lingnan.supermarket.utils; + +import java.io.IOException; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Properties; + +public class JDBCUtil { + + private static Properties properties; + private static String url; + private static String user; + private static String password; + static { + InputStream inputStream = JDBCUtil.class.getClassLoader().getResourceAsStream("jdbc.properties"); + + properties = new Properties(); + try { + properties.load(inputStream); + } catch (IOException e) { + e.printStackTrace(); + }finally { + if(inputStream!=null){ + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + //注册驱动 + try { + //类加载会触发static里面代码 + Class.forName(properties.getProperty("driver")); + + url= properties.getProperty("url"); + user= properties.getProperty("user"); + password= properties.getProperty("password"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + + + /** + * 获取连接 + * @return + */ + public static Connection getConn() { + try { + return DriverManager.getConnection(url, user, password); + } catch (SQLException e) { + e.printStackTrace(); + return null; + } + } + + + /** + * 释放资源 + * @param resultSet + * @param statement + * @param connection + */ + public static void close(ResultSet resultSet,Statement statement,Connection connection) { + try { + if(resultSet!=null) { + resultSet.close(); + } + if(statement!=null) { + statement.close(); + } + if(connection!=null) { + connection.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/utils/SendQQMailUtil.java b/Supermarket/src/com/lingnan/supermarket/utils/SendQQMailUtil.java new file mode 100644 index 0000000..3736a31 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/utils/SendQQMailUtil.java @@ -0,0 +1,61 @@ +package com.lingnan.supermarket.utils; +import java.util.Properties; +import java.util.Vector; + +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.AddressException; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import com.lingnan.supermarket.dto.*; + +public class SendQQMailUtil { + + private String FromEamil; + private String Stmt; + private String ToEmail; + private String Title; + private String txtFile; + + + + public SendQQMailUtil (String setFromEamil,String Stmt,String ToEmail,String Title,String txtFile) throws AddressException, MessagingException{ + this.FromEamil=setFromEamil; + this.Stmt=Stmt; + this.ToEmail=ToEmail; + this.Title=Title; + this.txtFile=txtFile; + + System.out.println("Stmt="+Stmt); + + Properties properties = new Properties(); + properties.put("mail.transport.protocol", "smtp");// 连接协议 + properties.put("mail.smtp.host", "smtp.qq.com");// 主机名 + properties.put("mail.smtp.port", 465);// 端口号 + properties.put("mail.smtp.auth", "true"); + properties.put("mail.smtp.ssl.enable", "true");// 设置是否使用ssl安全连接 ---一般都使用 + properties.put("mail.debug", "false");// 设置是否显示debug信息 true 会在控制台显示相关信息 + // 得到回话对象 + Session session = Session.getInstance(properties); + // 获取邮件对象 + Message message = new MimeMessage(session); + // 设置发件人邮箱地址 + message.setFrom(new InternetAddress(FromEamil)); + // 设置收件人邮箱地址 + message.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new InternetAddress(ToEmail)}); + //message.setRecipient(Message.RecipientType.TO, new InternetAddress("xxx@qq.com"));//一个收件人 + // 设置邮件标题 + message.setSubject(Title); + // 设置邮件内容 + message.setText(txtFile); + // 得到邮差对象 + Transport transport = session.getTransport(); + // 连接自己的邮箱账户 + transport.connect(FromEamil, Stmt);// 密码为QQ邮箱开通的stmp服务后得到的客户端授权码 + // 发送邮件 + transport.sendMessage(message, message.getAllRecipients()); + transport.close(); + } +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/utils/Test.java b/Supermarket/src/com/lingnan/supermarket/utils/Test.java new file mode 100644 index 0000000..0a416b5 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/utils/Test.java @@ -0,0 +1,9 @@ +package com.lingnan.supermarket.utils; + +public class Test { + + static { + System.out.println("tasdasd."); + } + +} diff --git a/Supermarket/src/com/lingnan/supermarket/utils/TimeAndOrder.java b/Supermarket/src/com/lingnan/supermarket/utils/TimeAndOrder.java new file mode 100644 index 0000000..55cb65f --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/utils/TimeAndOrder.java @@ -0,0 +1,43 @@ +package com.lingnan.supermarket.utils; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Random; + +public class TimeAndOrder { + public static String[] TimeAndOrder(String username) { + // TODO Auto-generated method stub + + String[] s = new String[2]; + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 + Calendar cal = Calendar.getInstance(); + String date1 = sdf1.format(cal.getTime()); + String date2 = sdf2.format(cal.getTime()); + + Random random=new Random(); + int result1=random.nextInt(10); + int result2=random.nextInt(10); + + s[0]=username+result1+date2+result2; + s[1]=date1; + System.out.println(s[0]); + System.out.println(s[1]); + + return s; + + } + + public static String yMdTime() { + // TODO Auto-generated method stub + + String[] s = new String[2]; + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); + Calendar cal = Calendar.getInstance(); + String date = sdf1.format(cal.getTime()); + + return date; + + } + +} diff --git a/Supermarket/src/com/lingnan/supermarket/utils/tplbTest.java b/Supermarket/src/com/lingnan/supermarket/utils/tplbTest.java new file mode 100644 index 0000000..07db185 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/utils/tplbTest.java @@ -0,0 +1,82 @@ +package com.lingnan.supermarket.utils; +import java.awt. *; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; + +import javax.swing. *; + + + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Scanner; +import java.awt.event.*; +public class tplbTest extends JFrame implements ActionListener +{ + static tplbTest tplb=new tplbTest(); + static JLabel pan=new JLabel(); + + static ImageIcon[] imgs = { + new ImageIcon("static\\bg\\bg1.jpg"), + new ImageIcon("static\\bg\\bg2.jpg"), + new ImageIcon("static\\bg\\bg3.jpg"), + new ImageIcon("static\\bg\\bg4.jpg"), + new ImageIcon("static\\bg\\bg5.jpg"), + new ImageIcon("static\\bg\\bg6.jpg"), + new ImageIcon("static\\bg\\bg7.jpg"), + new ImageIcon("static\\bg\\bg8.jpg"), + }; + + public static void settplb()/*�ܿ��*/ + { + tplb.setTitle("ͼƬ�ֲ�����"); + tplb.setLayout(null); + tplb.setSize(700,800); + tplb.setResizable(false); + tplb.setLocationRelativeTo(null);/*���þ���*/ + tplb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);/*�رճ���*/ + tplb.setVisible(true); + } + + + public static void setpan() + { + pan.setBounds(50, 50, 500, 500); + tplb.add(pan); + Timer timer = new Timer(1000,L); + timer.start(); + } + + static ActionListener L=new ActionListener() + { + int index; + @Override + public void actionPerformed(ActionEvent e) + { + pan.setIcon(imgs[index]); + index++; + if(index==7) + index=0; + } + }; + + + + + public static void main(String[] args) { + settplb(); + setpan(); + } + + + @Override + public void actionPerformed(ActionEvent e) { + // TODO �Զ����ɵķ������ + + } + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/view/Demo4.java b/Supermarket/src/com/lingnan/supermarket/view/Demo4.java new file mode 100644 index 0000000..a9d35fb --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/view/Demo4.java @@ -0,0 +1,82 @@ +package com.lingnan.supermarket.view; +import java.awt. *; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; + +import javax.swing. *; + + + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Scanner; +import java.awt.event.*; +public class Demo4 extends JFrame implements ActionListener +{ + static Demo4 tplb=new Demo4(); + static JLabel pan=new JLabel(); + + static ImageIcon[] imgs = { + new ImageIcon("s"), + new ImageIcon("static\\bg\\bg1.jpg"), + new ImageIcon("static\\bg\\bg2.jpg"), + new ImageIcon("static\\bg\\bg3.jpg"), + new ImageIcon("static\\bg\\bg4.jpg"), + new ImageIcon("static\\bg\\bg5.jpg"), + new ImageIcon("static\\bg\\bg6.jpg"), + new ImageIcon("static\\bg\\bg7.jpg"), + }; + + public static void settplb()/*�ܿ��*/ + { + tplb.setTitle("ͼƬ�ֲ�����"); + tplb.setLayout(null); + tplb.setSize(700,800); + tplb.setResizable(false); + tplb.setLocationRelativeTo(null);/*���þ���*/ + tplb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);/*�رճ���*/ + tplb.setVisible(true); + } + + + public static void setpan() + { + pan.setBounds(50, 50, 500, 500); + tplb.add(pan); + Timer timer = new Timer(1000,L); + timer.start(); + } + + static ActionListener L=new ActionListener() + { + int index; + @Override + public void actionPerformed(ActionEvent e) + { + pan.setIcon(imgs[index]); + index++; + if(index==7) + index=0; + } + }; + + + + + public static void main(String[] args) { + settplb(); + setpan(); + } + + + @Override + public void actionPerformed(ActionEvent e) { + // TODO �Զ����ɵķ������ + + } + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/view/HomeView.java b/Supermarket/src/com/lingnan/supermarket/view/HomeView.java new file mode 100644 index 0000000..d98388d --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/view/HomeView.java @@ -0,0 +1,176 @@ +package com.lingnan.supermarket.view; +import java.awt. *; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; + +import javax.imageio.ImageIO; +import javax.swing. *; + +import com.lingnan.supermarket.componet.BGPanel; +import com.lingnan.supermarket.dao.impl.inOrderServiceImpl; +import com.lingnan.supermarket.dao.impl.outOrderServiceImpl; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.table.UserTableModel; +import com.lingnan.supermarket.utils.FontUtil; +import com.lingnan.supermarket.utils.TimeAndOrder; +import com.lingnan.supermarket.view.base.BaseView; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.IOException; +import java.util.Scanner; +import java.awt.event.*; +public class HomeView extends JPanel implements ActionListener +{ + + private JLabel pan; + +private static JLabel pan1; + +private static JLabel pan2; + +private static JLabel pan3; + + private JFrame jFrame; + + private JPanel tplbPanel; + + private Image bgImage = null; + + private ImageIcon[] imgs; + + private static Float allInPrice; + +private static Float allOutPrice; + + private JButton refreshBtn; + + private JPanel priceJPanel; + + private static String date; + + private static inOrderServiceImpl inOrderImpl ; + private static outOrderServiceImpl outOrderImpl; + + + + public HomeView(JFrame jFrame) { + this.setLayout(null); + this.jFrame = jFrame; + initView(); + + } + + + private void initView() { + + + + pan = new JLabel(); + pan.setBounds(0,0, 1280,351); + + /*tplbPanel.add(pan);*/ + + imgs =new ImageIcon[7]; + for(int i =0;i<7;i++) { + imgs[i]=new ImageIcon("static\\轮播\\0"+i+".jpg"); + } + pan.setIcon(imgs[6]); + Timer timer = new Timer(2500,L); + timer.start(); + this.add(pan); + + date= TimeAndOrder.yMdTime();/*获取今天时间*/ + inOrderImpl = new inOrderServiceImpl(); + outOrderImpl = new outOrderServiceImpl(); + + allInPrice=inOrderImpl.TodayInPrice(date); + allOutPrice=outOrderImpl.TodayOutPrice(date); + System.out.println("今日allInprice="+allInPrice); + System.out.println("今日allOutprice="+allOutPrice); + + pan1 = new JLabel("今日进货总金额:"+allInPrice+"元",new ImageIcon("static\\icon\\money.png"),JLabel.LEFT); + pan2 = new JLabel("今日收银总金额:"+allOutPrice+"元",new ImageIcon("static\\icon\\income.png"),JLabel.LEFT); + pan3 = new JLabel("今日被投诉次数:0次",new ImageIcon("static\\icon\\complaints.png"),JLabel.LEFT); + + pan1.setFont(FontUtil.homeFont); + pan2.setFont(FontUtil.homeFont); + pan3.setFont(FontUtil.homeFont); + + pan1.setBounds(280,300, 600,200); + pan2.setBounds(280,400, 600,200); + pan3.setBounds(280,500, 600,200); + + /* priceJPanel = new JPanel(); + priceJPanel.setBounds(100,200,700,500);*/ + this.add(pan1); + this.add(pan2); + this.add(pan3); + + + + refreshBtn = new JButton(new ImageIcon("static\\icon\\refresh.png")); + refreshBtn.addActionListener(this); + refreshBtn.setBounds(1050,700, 40,40); + this.add(refreshBtn); + + + + + } + ActionListener L=new ActionListener() + { + int index; + @Override + public void actionPerformed(ActionEvent e) + { + pan.setIcon(imgs[index]); + index++; + if(index==7) + index=0; + } + }; + + public static void refreshHome() { + + date= TimeAndOrder.yMdTime();/*获取今天时间*/ + + allInPrice=inOrderImpl.TodayInPrice(date); + allOutPrice=outOrderImpl.TodayOutPrice(date); + System.out.println("今日allInprice="+allInPrice); + System.out.println("今日allOutprice="+allOutPrice); + + pan1.setText("今日进货总金额:"+allInPrice+"元"); + pan2.setText("今日收银总金额:"+allOutPrice+"元"); + pan3.setText("今日被投诉次数:0次"); + + + /* priceJPanel = new JPanel(); + priceJPanel.setBounds(100,200,700,500);*/ +/* this.add(pan1); + this.add(pan2); + this.add(pan3);*/ + } + + + + + + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + Object source = e.getSource(); + if(source==refreshBtn) { + new HomeView(jFrame); + refreshHome(); + } + + } + + + +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/view/InView.java b/Supermarket/src/com/lingnan/supermarket/view/InView.java new file mode 100644 index 0000000..6738cf3 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/view/InView.java @@ -0,0 +1,513 @@ +package com.lingnan.supermarket.view; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Vector; + +import javax.mail.MessagingException; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.text.html.HTMLDocument.Iterator; + +import com.lingnan.supermarket.componet.BGPanel; +import com.lingnan.supermarket.dao.impl.BufferImpl; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; +import com.lingnan.supermarket.dao.impl.inOrderServiceImpl; +import com.lingnan.supermarket.dao.impl.inRecordServiceImpl; +import com.lingnan.supermarket.dao.impl.prodCatalogImpl; +import com.lingnan.supermarket.dialog.ChangeStatusDialog; +import com.lingnan.supermarket.dialog.ChangeSumDialog; +import com.lingnan.supermarket.dialog.InDialog; +import com.lingnan.supermarket.dialog.UserDialog; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.InRecord; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.table.*; +import com.lingnan.supermarket.utils.CreateOrder; +import com.lingnan.supermarket.utils.FontUtil; +import com.lingnan.supermarket.utils.SendQQMailUtil; +import com.lingnan.supermarket.utils.TimeAndOrder; +import com.lingnan.supermarket.view.ProdCatalogView.MyItemListener; + +public class InView extends JPanel implements ActionListener{ + + + //上面 + private JPanel toolBarPanel; + + private JPanel searchPanel; + private JLabel nameLabel,locationLabel; + private JTextField nameSearchTF; + private JButton searchBtn,StockBtn,exitBtn; + + private JPanel opePanel; + private JButton addBtn,updateBtn,deleteBtn,historyBtn,backBtn,detailBtn; + + //中间 + private JScrollPane tableScrollPane; + private JTable inTable; + + //下面 + private JPanel bottomPanel,bottomPanelLeft,bottomPanelRight; + private JLabel countInfoLabel,countInfoLabel2; + + private Buffer Buffer; + private BufferImpl BufferImpl; + + private static Vector v = new Vector(); + + private JComboBox combo; + private String[] status ={"全部","已入库","待入库","已取消"}; + private int catalog; + + private JFrame jFrame; + private User user; + + private InTableModel inTableModel ; + + private BufferImpl bufferImpl = new BufferImpl(); + + private int mark;/*标记从提醒那里来1是进货表,0是提醒过来的表*/ + + private inOrderServiceImpl inOrderImpl; + + private Float allPrice; + private int row; + private String uname; + + public InView(JFrame jFrame,User user,Vector v,int mark) { + this.setLayout(new BorderLayout()); + this.jFrame = jFrame; + this.user = user; + //获得进货缓冲区的保存的货物并删除缓冲区 + this.v =bufferImpl.allInBuffer(); + bufferImpl.DelAllInBuffer(); + + this.mark=mark; + System.out.println("mark="+mark); + uname = user.getUsername(); + initView(); + + + } + + private void initView() { + + + toolBarPanel = new JPanel(new BorderLayout()); + + searchPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + nameLabel = new JLabel("订单号"); + nameSearchTF = new JTextField(20); + searchBtn = new JButton(new ImageIcon("static\\icon\\search.png")); + searchBtn.addActionListener(this); + locationLabel=new JLabel("当前位置>进货系统"); + locationLabel.setFont(new FontUtil().userFont); + locationLabel.setForeground(new Color(18, 150, 219)); + + + + combo = new JComboBox(status); + combo.addItemListener(new MyItemListener()); + + + + opePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + addBtn =new JButton(new ImageIcon("static\\icon\\add.png")); + updateBtn =new JButton(new ImageIcon("static\\icon\\change.png")); + deleteBtn =new JButton(new ImageIcon("static\\icon\\delete.png")); + historyBtn =new JButton(new ImageIcon("static\\icon\\history.png")); + backBtn =new JButton(new ImageIcon("static\\icon\\back.png")); + detailBtn = new JButton(new ImageIcon("static\\icon\\detail.png")); + + addBtn.addActionListener(this); + updateBtn.addActionListener(this); + deleteBtn.addActionListener(this); + historyBtn.addActionListener(this); + backBtn.addActionListener(this); + detailBtn.addActionListener(this); + + backBtn.setVisible(false);/*在记录页面显示出来*/ + detailBtn.setVisible(false);/*在订单详情页显示出来*/ + + opePanel.add(addBtn); + opePanel.add(backBtn); + opePanel.add(detailBtn); + opePanel.add(updateBtn); + opePanel.add(deleteBtn); + opePanel.add(historyBtn); + + + searchPanel.add(locationLabel); + searchPanel.add(nameLabel); + searchPanel.add(nameSearchTF); + searchPanel.add(searchBtn); + searchPanel.add(combo); + + + + toolBarPanel.add(searchPanel,"West"); + toolBarPanel.add(opePanel,"East"); + + + //中间表 + inTableModel = new InTableModel(v); + + inTable = new JTable(inTableModel); + inTable.setFont(FontUtil.tableFont); + inTable.setRowHeight(50); + tableScrollPane = new JScrollPane(inTable); + + allPrice = inTableModel.getAllPrice(); + row = inTableModel.getRowCount(); + + + //下面 + bottomPanelLeft = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + countInfoLabel = new JLabel("商品种类:"+row+",总价:"+allPrice); + bottomPanelLeft.add(countInfoLabel,"Left"); + + bottomPanelRight = new JPanel(new FlowLayout(FlowLayout.LEFT)); + StockBtn =new JButton(new ImageIcon("static\\icon\\stock.png"));/*结账按钮*/ + exitBtn =new JButton(new ImageIcon("static\\icon\\exit.png"));/*退出按钮*/ + StockBtn.addActionListener(this); + exitBtn.addActionListener(this); + bottomPanelRight.add(StockBtn); + bottomPanelRight.add(exitBtn); + + bottomPanel = new JPanel(new BorderLayout()); + bottomPanel.add(bottomPanelRight,"East"); + bottomPanel.add(bottomPanelLeft,"West"); + + + this.add(toolBarPanel,"North"); + this.add(tableScrollPane,"Center");/*将表格放到中间*/ + this.add(bottomPanel,"South"); + + if(mark==1) /*判断是不是从提醒那里过来的*/{ + refreshBuffer(v); + } + + else if(mark==0) { + InOrderRecord(); + } + + + + + + setVisible(true); + + + + + + + } + + public static Vector getVector(){ + return v; + } + + + public class MyItemListener implements ItemListener { + + @Override + public void itemStateChanged(ItemEvent e) { + JComboBox cb = (JComboBox) e.getSource(); + String catalog1 = (String) cb.getSelectedItem(); + if(catalog1.equals("全部")) + catalog=0; + else if(catalog1.equals("已入库")) + catalog=1; + else if(catalog1.equals("待入库")) + catalog=2; + else if(catalog1.equals("已取消")) + catalog=3; + + resultOfFindStatus(catalog); + + } + + } + + + + + //按钮组件隐藏 + public void OrderView() { + backBtn.setVisible(true); + detailBtn.setVisible(true); + updateBtn.setVisible(true); + deleteBtn.setVisible(true); + addBtn.setVisible(false); + historyBtn.setVisible(false); + } + + + public void resultOfNumber(String iNumber) { + this.mark=0; + InOrderTM inOrderTM = new InOrderTM(); + inOrderTM.resultOfNumber(iNumber); + inTable.setModel(inOrderTM); + bottomPanelLeft.removeAll(); + countInfoLabel = new JLabel("共"+inOrderTM.getRowCount()+"条记录"); + bottomPanelLeft.add(countInfoLabel); + OrderView(); + } + + public void resultOfFindStatus(int catalog) { + this.mark=0; + InOrderTM inOrderTM = new InOrderTM(); + inOrderTM.resultOfFind(catalog); + inTable.setModel(inOrderTM); + bottomPanelLeft.removeAll(); + countInfoLabel = new JLabel("共"+inOrderTM.getRowCount()+"条记录"); + bottomPanelLeft.add(countInfoLabel); + OrderView(); + } + + + /*刷新*/ + public void refreshBuffer(Vector v) { + this.mark=1; + + InTableModel inTableModel = new InTableModel(v); + inTable.setModel(inTableModel); + bottomPanelLeft.removeAll(); + countInfoLabel = new JLabel("商品种类:"+inTableModel.getRowCount()+",总价:"+inTableModel.getAllPrice()); + bottomPanelLeft.add(countInfoLabel); + backBtn.setVisible(false); + detailBtn.setVisible(false); + historyBtn.setVisible(true); + updateBtn.setVisible(true); + addBtn.setVisible(true); + deleteBtn.setVisible(true); + + allPrice = inTableModel.getAllPrice(); + row = inTableModel.getRowCount(); + } + + /*调出进货订单表*/ + public void InOrderRecord() { + this.mark=0; + InOrderTM inOrderTM = new InOrderTM(); + inOrderTM.allInOrderRecord(); + inTable.setModel(inOrderTM); + bottomPanelLeft.removeAll(); + countInfoLabel = new JLabel("共"+inOrderTM.getRowCount()+"条记录"); + bottomPanelLeft.add(countInfoLabel); + OrderView(); + + } + + /*调出进货订单表*/ + public void InRecord(String iNumber) { + this.mark=2; + InRecordTM inRecordTM = new InRecordTM(iNumber); + inRecordTM.findInRecordByINumber(); + inTable.setModel(inRecordTM); + bottomPanelLeft.removeAll(); + countInfoLabel = new JLabel("订单号@"+iNumber+"共有"+inRecordTM.getRowCount()+"条记录"); + bottomPanelLeft.add(countInfoLabel); + backBtn.setVisible(true); + detailBtn.setVisible(false); + updateBtn.setVisible(false); + addBtn.setVisible(false); + historyBtn.setVisible(false); + deleteBtn.setVisible(false); + + } + + + + + + /*按钮监听时间*/ + @Override + public void actionPerformed(ActionEvent e) { + BufferImpl = new BufferImpl();/*获得购物车*/ + Object source = e.getSource(); + + if(searchBtn==source) { + String number = nameSearchTF.getText(); + System.out.println("搜索后的订单:"+number); + resultOfNumber(number); + } + + else if(addBtn==source) {/*添加*/ + InDialog outDialog = new InDialog(jFrame,v,user); + outDialog.setVisible(true); + v=outDialog.getVector(); + refreshBuffer(v); + + } + + + else if(updateBtn==source) {/*更新*/ + System.out.println("mark="+mark); + int rowIndex = inTable.getSelectedRow(); + if(rowIndex==-1) { + JOptionPane.showMessageDialog(this,"请选中一条进行更改数量"); + return; + } + //进货表修改 + if(mark==1) { + String id =(String) inTable.getValueAt(rowIndex,0); + ChangeSumDialog changesumDialog = new ChangeSumDialog(jFrame,id,"In",v); + changesumDialog.setVisible(true); + v = changesumDialog.getVector(); + System.out.println("更改状态后v.size="+v.size()); + refreshBuffer(v); + } + + //inOrder修改,修改状态 + else if(mark==0) { + String iNumber =(String) inTable.getValueAt(rowIndex,0); + String status =(String) inTable.getValueAt(rowIndex,4); + if(status.equals("已入库")) { + JOptionPane.showMessageDialog(this,"订单上的货物已入库无法修改状态","提示",JOptionPane.INFORMATION_MESSAGE); + return; + } + + ChangeStatusDialog changeStatusDialog = new ChangeStatusDialog(jFrame,iNumber,status); + changeStatusDialog.setVisible(true); + MainView.refreshRemind(); + HomeView.refreshHome(); + InOrderRecord(); + } + + } + + + else if(deleteBtn==source) { + int rowIndex = inTable.getSelectedRow(); + if(rowIndex==-1) { + JOptionPane.showMessageDialog(this,"请选中一条"); + return; + } + + /*删除进货表的*/ + if(mark==1) { + System.out.println("删除进货表"); + String id =(String) inTable.getValueAt(rowIndex,0); + int select = JOptionPane.showConfirmDialog(this,"是否删除id为"+id+"的记录","提示",JOptionPane.YES_NO_OPTION); + if(select==JOptionPane.YES_OPTION) {/*选择是*/ + for(int i =0;i(); + refreshBuffer(v); + MainView.refreshRemind(); + JOptionPane.showConfirmDialog(null,"发送邮件成功\r\n订单号:"+s[0]+"\r\n负责人:"+uname, "提示", JOptionPane.YES_OPTION); + + } + + + } + + }else if(exitBtn==source) { + int res = JOptionPane.showConfirmDialog(null,"确定退出并清空购物车吗", "结账", JOptionPane.YES_NO_OPTION); + if(res==JOptionPane.YES_OPTION)/*如果退出*/{ + v=new Vector();/*将数组置空*/ + refreshBuffer(v); + JOptionPane.showConfirmDialog(null,"退出成功", "提示", JOptionPane.PLAIN_MESSAGE); + } + } + } + } diff --git a/Supermarket/src/com/lingnan/supermarket/view/LoginView.java b/Supermarket/src/com/lingnan/supermarket/view/LoginView.java new file mode 100644 index 0000000..e52dcb4 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/view/LoginView.java @@ -0,0 +1,158 @@ +package com.lingnan.supermarket.view; + +import java.awt.Container; +import java.awt.Event; +import java.awt.Font; +import java.awt.Image; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.io.File; +import java.io.IOException; +import java.util.Random; +import java.util.Vector; + +import javax.imageio.ImageIO; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JRadioButton; +import javax.swing.JTextField; + +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.componet.BGPanel; +import com.lingnan.supermarket.view.base.BaseView; + +public class LoginView extends BaseView implements ActionListener{ + + //setLayout(null); + //setBounds(x,y,width,height) + private JPanel containerPanel,namePanel,passwordPanel; + + private JLabel nameLabel,pwdLabel; + private JTextField nameTF; + private JPasswordField pwdTF; + + private JButton loginBtn; + + private User user=null; + + + /*创建窗口*/ + public LoginView() { + super(350, 250, "新民超市"); + ImageIcon icon=new ImageIcon("static\\icon\\新.png"); //xxx代表图片存放路径,2.png图片名称及格式 + this.setIconImage(icon.getImage()); + + } + + /*添加组件*/ + @Override/*界面*/ + protected void initView() { + + Image bgImage = null; + try { + bgImage = ImageIO.read(new File("static\\bg\\bg1.jpg")); + } catch (IOException e) { + e.printStackTrace(); + } + containerPanel = new BGPanel(bgImage); + + + + //用户名 + namePanel = new JPanel(); + nameLabel = new JLabel(new ImageIcon("static\\icon\\loginName.png")); + nameTF = new JTextField("z001",22); + namePanel.add(nameLabel); + namePanel.add(nameTF); + + + //密码 + passwordPanel = new JPanel(); + pwdLabel = new JLabel(new ImageIcon("static\\icon\\pwd.png")); + pwdTF = new JPasswordField("0.00.0",22); + passwordPanel.add(pwdLabel); + passwordPanel.add(pwdTF); + + //登录 + loginBtn = new JButton("登录"); + loginBtn.addActionListener(this); + + + + + + /*添加组件*/ + containerPanel.add(namePanel); + containerPanel.add(passwordPanel); + containerPanel.add(loginBtn); + + + + + Container container = getContentPane(); + container.add(containerPanel); + } + + /*事件处理*/ + @Override + public void actionPerformed(ActionEvent e) { + /*如果点击登录*/ + if(e.getSource()==loginBtn){ + String loginName = nameTF.getText(); + String password = new String(pwdTF.getPassword()); + System.out.println("点击登录后"); + System.out.println("用户名为"+loginName); + System.out.println("密码为"+password); + //TODO 参数校验 + UserServiceImpl userService = new UserServiceImpl(); + user = userService.login(loginName, password); + + if(user==null) { + JOptionPane.showMessageDialog(this,"账号或密码错误"); + }else { + //去到主界面 + Random random=new Random(); + int skin=random.nextInt(10); + System.out.println("skin="+skin); + String iconSkin = "static\\icon\\新.png";/*默认icon*/ + new MainView(user,skin,iconSkin); + this.dispose(); + } + } + + } + + + + public static void main(String[] args) { + Nimbus.Nimbus(); + LoginView loginView = new LoginView(); + } + + @Override + protected void initView(User user,int skin) { + // TODO Auto-generated method stub + + } + + + + + + + + +} + + + diff --git a/Supermarket/src/com/lingnan/supermarket/view/MainView.java b/Supermarket/src/com/lingnan/supermarket/view/MainView.java new file mode 100644 index 0000000..2d25fde --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/view/MainView.java @@ -0,0 +1,598 @@ +package com.lingnan.supermarket.view; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.io.File; +import java.io.IOException; +import java.util.Date; +import java.util.Random; +import java.util.Vector; + +import javax.imageio.ImageIO; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.Timer; + +import com.lingnan.supermarket.componet.BGPanel; +import com.lingnan.supermarket.dao.impl.BufferImpl; +import com.lingnan.supermarket.dao.impl.inOrderServiceImpl; +import com.lingnan.supermarket.dialog.CloseDialog; +import com.lingnan.supermarket.dialog.InDialog; +import com.lingnan.supermarket.dialog.UserDialog; +import com.lingnan.supermarket.dialog.UserInfDialog; +import com.lingnan.supermarket.dto.InOrder; +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.utils.DateUtil; +import com.lingnan.supermarket.utils.FontUtil; +import com.lingnan.supermarket.view.base.BaseView; + +import java.awt.*; + +public class MainView extends BaseView implements ActionListener, MouseListener,WindowListener{ + + + JMenuBar menuBar; + JMenu settingMenu,helpMenu; + + JMenuItem skinMenuItem,configMenuItem; + + + JSplitPane containerPanel; + + CardLayout rightPanelLayout; + JPanel leftPanel,rightPanel; + + /*菜单栏*/ + JLabel logoLabel,userMenuLabel1,homeMenuLabel,userMenuLabel,inMenuLabel, + outMenuLabel,storageMenuLabel,supplierMenuLabel,catalogMenuLabel; + + static JLabel remindMenuLabel;/*全局调用刷新*/ + + JPanel bottomPanel; + + JLabel timeLabel; + + JPanel purposePanel,timePanel; + JLabel purposeLabel; + + + JButton saveBtn,unSaveBtn,cancleBtn;/*退出时按钮*/ + + // + Timer timer; + + private User user ;/*从登录界面传过来的用户信息*/ + + private BufferImpl bufferImpl; + + private Image bgImage ; + private String iconSkin; + private int skin; + + private Vector vP=new Vector() ;/*用于进货缓存*/ + + + private int location; + + private int sSuper=-1;//界面权限 + + private static inOrderServiceImpl inOrderImpl = new inOrderServiceImpl(); + private static int unConfirmmark;/*未确认订单*/ + + public MainView(User user,int skin,String iconSkin) { + super(1300,850,"新民超市管理系统欢迎您",user,skin); + timer = new Timer(1000,this); + timer.start(); + this.user = user; + + this.sSuper=user.getUsuper();//界面权限 + System.out.println("userid="+user.getId()); + this.addWindowListener(this); + + this.skin = skin; + this.iconSkin = iconSkin; + ImageIcon icon=new ImageIcon(iconSkin); //xxx代表图片存放路径,2.png图片名称及格式 + this.setIconImage(icon.getImage()); + + //获得未进货的信息 + Vector vInOrder; + vInOrder = inOrderImpl.findUnconfirmInOrder(); + unConfirmmark=vInOrder.size(); + + + initView(user,skin); + } + + public MainView(User user) { + super(1300,850,"新民超市管理系统欢迎您"); + timer = new Timer(1000,this); + timer.start(); + this.user = user; + + this.sSuper=user.getUsuper();//界面权限 + System.out.println("userid="+user.getId()); + this.addWindowListener(this); + + + + //获得未进货的信息 + Vector vInOrder; + vInOrder = inOrderImpl.findUnconfirmInOrder(); + unConfirmmark=vInOrder.size(); + + + initView(user,skin); + } + + public static void refreshRemind() { + Vector vInOrder; + vInOrder = inOrderImpl.findUnconfirmInOrder(); + unConfirmmark=vInOrder.size(); + remindMenuLabel.setText("待确认进货:"+unConfirmmark); + } + + + + + +/* public static User getUserInf() { + return user; + }*/ + + @Override + protected void initView(User user,int skin) { + + + + + /*菜单栏*/ + menuBar = new JMenuBar(); + + settingMenu = new JMenu("设置"); + + helpMenu = new JMenu("帮助"); + + skinMenuItem = new JMenuItem("随机切换皮肤",new ImageIcon("static\\icon\\skin.png")); + +/* for(int i = 3;i<9;i++) { + + }*/ + configMenuItem = new JMenuItem("参数设置",new ImageIcon("static\\icon\\setting.png")); + skinMenuItem.addActionListener(this); + + settingMenu.add(configMenuItem); + settingMenu.add(skinMenuItem); + menuBar.add(settingMenu); + menuBar.add(helpMenu); + + setJMenuBar(menuBar); + + + /*左边菜单栏设置*/ + + + try { + bgImage = ImageIO.read(new File("static\\bg\\bg"+skin+".jpg")); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + leftPanel = new BGPanel(bgImage);/*皮肤*/ + leftPanel.setLayout(null); + + + /*菜单栏:用户登录信息*/ + System.out.println("用户头像地址=="+user.getImg()); + JLabel logoLabel = new JLabel(new ImageIcon(user.getImg()),JLabel.LEFT); + System.out.println(user.getImg()); + leftPanel.add(logoLabel); + logoLabel.setBounds(25, 30,150,150); + + /*账号名字*/ + String x = UsuperIcon(user.getUsuper());/*判断权限返回icon地址*/ + System.out.println("身份地址:"+x); + userMenuLabel1 = new JLabel("|"+user.getUsername()+"|"+user.getRname(),new ImageIcon(x),JLabel.LEFT); + userMenuLabel1.setFont(FontUtil.userFont); + userMenuLabel1.addMouseListener(this); + userMenuLabel1.setBounds(20, 170,180,32); + userMenuLabel1.setForeground(Color.white); + leftPanel.add(userMenuLabel1);/*添加用户选项到菜单栏*/ + + + + /*菜单栏:首页*/ + homeMenuLabel = new JLabel("新民首页",new ImageIcon("static\\icon\\home1.png"),JLabel.LEFT); + homeMenuLabel.setFont(FontUtil.menuFont); + homeMenuLabel.addMouseListener(this); + homeMenuLabel.setBounds(20, 250,150,32); + homeMenuLabel.setForeground(Color.white); + leftPanel.add(homeMenuLabel);/*添加用户选项到菜单栏*/ + + + + /*菜单栏:人员管理*/ + userMenuLabel = new JLabel("人员管理",new ImageIcon("static\\icon\\user1.png"),JLabel.LEFT); + userMenuLabel.setFont(FontUtil.menuFont); + userMenuLabel.addMouseListener(this); + userMenuLabel.setBounds(20, 300,150,32); + userMenuLabel.setForeground(Color.white); + leftPanel.add(userMenuLabel);/*添加用户选项到菜单栏*/ + + /*菜单栏:进货系统*/ + inMenuLabel = new JLabel("进货系统",new ImageIcon("static\\icon\\in1.png") ,JLabel.LEFT); + inMenuLabel.setFont(FontUtil.menuFont); + inMenuLabel.addMouseListener(this); + inMenuLabel.setBounds(20, 350,150,32); + inMenuLabel.setForeground(Color.white); + leftPanel.add(inMenuLabel); + + /*菜单栏:收银系统*/ + outMenuLabel = new JLabel("收银系统",new ImageIcon("static\\icon\\out1.png") ,JLabel.LEFT); + outMenuLabel.setFont(FontUtil.menuFont); + outMenuLabel.addMouseListener(this); + outMenuLabel.setBounds(20, 400,150,32); + outMenuLabel.setForeground(Color.white); + leftPanel.add(outMenuLabel); + + /*菜单栏:库存*/ + storageMenuLabel = new JLabel("商品库存",new ImageIcon("static\\icon\\storage1.png") ,JLabel.LEFT); + storageMenuLabel.setFont(FontUtil.menuFont); + storageMenuLabel.addMouseListener(this); + storageMenuLabel.setBounds(20, 450,150,32); + storageMenuLabel.setForeground(Color.white); + leftPanel.add(storageMenuLabel); + + /*菜单栏:供应商*/ + supplierMenuLabel = new JLabel("供应商",new ImageIcon("static\\icon\\supplier1.png") ,JLabel.LEFT); + supplierMenuLabel.setFont(FontUtil.menuFont); + supplierMenuLabel.addMouseListener(this); + supplierMenuLabel.setBounds(20, 500,150,32); + supplierMenuLabel.setForeground(Color.white); + leftPanel.add(supplierMenuLabel); + + /*菜单栏:商品目录*/ + catalogMenuLabel = new JLabel("商品目录",new ImageIcon("static\\icon\\catalog1.png") ,JLabel.LEFT); + catalogMenuLabel.setFont(FontUtil.menuFont); + catalogMenuLabel.addMouseListener(this); + catalogMenuLabel.setBounds(20,550,150,32); + catalogMenuLabel.setForeground(Color.white); + leftPanel.add(catalogMenuLabel); + + /*提醒进货确认模块*/ + remindMenuLabel = new JLabel("待确认进货:"+unConfirmmark,new ImageIcon("static\\icon\\remind1.png") ,JLabel.LEFT); + remindMenuLabel.setFont(FontUtil.remindFont); + remindMenuLabel.addMouseListener(this); + remindMenuLabel.setBounds(0,650,200,32); + remindMenuLabel.setForeground(Color.white); + leftPanel.add(remindMenuLabel); + + + rightPanelLayout = new CardLayout(); + + //0.超市首页展示 + JPanel homePanel = new HomeView(this); + + //1.用户管理界面:用户的列表 + JPanel userPanel = new UserView(this); + + //2.进货系统界面 + JPanel inPanel = new InView(this,user,vP,1); + + //3收银系统界面 + JPanel outPanel = new OutView(this,user); + + //4.库存系统界面 + JPanel storagePanel = new StorageView(this); + + //5.供应商界面 + JPanel supplierPanel = new SupplierView(this); + + //6商品目录界面 + JPanel ProdCatalogPanel = new ProdCatalogView(this); + + //7商品目录界面 + JPanel superPanel = new SuperView(this); + + //8进货信息提示 + JPanel inPanel2 = new InView(this,user,vP,0); + + /*添加界面并给索引*/ + rightPanel = new JPanel(rightPanelLayout); + rightPanel.add(homePanel, "0"); + rightPanel.add(userPanel, "1"); + rightPanel.add(inPanel, "2"); + rightPanel.add(outPanel, "3"); + rightPanel.add(storagePanel, "4"); + rightPanel.add(supplierPanel, "5"); + rightPanel.add(ProdCatalogPanel, "6"); + rightPanel.add(superPanel, "7"); + rightPanel.add(inPanel2, "8"); + + + containerPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPanel,rightPanel); + containerPanel.setDividerLocation(180); + containerPanel.setDividerSize(0); + + bottomPanel = new JPanel();//默认的布局是流式布局 + + bottomPanel.setBackground(Color.WHITE); + bottomPanel.setLayout(new BorderLayout()); + + purposePanel = new JPanel(); + purposePanel.setLayout(new FlowLayout(FlowLayout.LEFT)); + purposePanel.setBackground(Color.WHITE); + purposeLabel = new JLabel("当前位置是:超市首页"); + purposePanel.add(purposeLabel); + + timePanel=new JPanel(); + timePanel.setLayout(new FlowLayout(FlowLayout.TRAILING)); + timePanel.setBackground(Color.WHITE); + timeLabel = new JLabel(DateUtil.dateToString(new Date(),null)); + timePanel.add(timeLabel); + + bottomPanel.add(purposePanel,"West"); + bottomPanel.add(timePanel,"East"); + Container container = getContentPane(); + container.add(containerPanel,"Center"); + container.add(bottomPanel,"South"); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + timeLabel.setText(DateUtil.dateToString(new Date(),null)); + if(source==skinMenuItem)/*换肤*/{ + System.out.println("切换皮肤"); + Random random=new Random(); + skin=random.nextInt(10); + this.dispose(); + new MainView(user,skin,iconSkin); + } + + } + + @Override/*左侧菜单栏点击事件*/ + public void mouseClicked(MouseEvent e) { + Object source = e.getSource(); + if(source==homeMenuLabel) { + rightPanelLayout.show(rightPanel,"0"); + location=0; + }else if(source==userMenuLabel) { + if(sSuper==0) + rightPanelLayout.show(rightPanel,"1"); + else{ + rightPanelLayout.show(rightPanel,"7"); + } + location=1; + } + else if(source==inMenuLabel) { + if(sSuper==2) + rightPanelLayout.show(rightPanel,"7"); + else{ + rightPanelLayout.show(rightPanel,"2"); + + } + location=2; + } + else if(source==outMenuLabel) { + rightPanelLayout.show(rightPanel,"3"); + location=3; + } + else if(source==storageMenuLabel) { + rightPanelLayout.show(rightPanel,"4"); + location=4; + } + else if(source==supplierMenuLabel) { + rightPanelLayout.show(rightPanel,"5"); + + location=5; + + } + else if(source==catalogMenuLabel) { + rightPanelLayout.show(rightPanel,"6"); + location=6; + + }else if(source==remindMenuLabel) { + if(sSuper==2) + rightPanelLayout.show(rightPanel,"7"); + else{ + rightPanelLayout.show(rightPanel,"8"); + } + location=7; + }else if(source==userMenuLabel1){ + + UserInfDialog userInfDialog = new UserInfDialog(this,user); + userInfDialog.setVisible(true); + location=8; + } + + refreshRemove(); + } + //获取当前位置 + public void refreshRemove(){ + + purposePanel.removeAll(); + if(location==0){ + purposeLabel = new JLabel("当前位置是:"+homeMenuLabel.getText()); + + }else if(location==1){ + purposeLabel = new JLabel("当前位置是:"+userMenuLabel.getText()); + + }else if(location==2){ + purposeLabel = new JLabel("当前位置是:"+inMenuLabel.getText()); + + }else if(location==3){ + purposeLabel = new JLabel("当前位置是:"+outMenuLabel.getText()); + + }else if(location==4){ + purposeLabel = new JLabel("当前位置是:"+storageMenuLabel.getText()); + + }else if(location==5){ + purposeLabel = new JLabel("当前位置是:"+supplierMenuLabel.getText()); + + }else{ + purposeLabel = new JLabel("当前位置是:"+catalogMenuLabel.getText()); + } + + purposePanel.add(purposeLabel); + + } + + @Override + public void mousePressed(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override/*鼠标焦点时*/ + public void mouseEntered(MouseEvent e) { + Object source = e.getSource(); + if(source==homeMenuLabel) { + homeMenuLabel.setForeground(new Color(18, 150, 219)); + homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home2.png")); + } + if(source==userMenuLabel) { + userMenuLabel.setForeground(new Color(18, 150, 219)); + userMenuLabel.setIcon(new ImageIcon("static\\icon\\user2.png")); + }else if(source==inMenuLabel) { + inMenuLabel.setForeground(new Color(18, 150, 219)); + inMenuLabel.setIcon(new ImageIcon("static\\icon\\in2.png")); + }else if(source==outMenuLabel) { + outMenuLabel.setForeground(new Color(18, 150, 219)); + outMenuLabel.setIcon(new ImageIcon("static\\icon\\out2.png")); + }else if(source==storageMenuLabel) { + storageMenuLabel.setForeground(new Color(18, 150, 219)); + storageMenuLabel.setIcon(new ImageIcon("static\\icon\\storage2.png")); + }else if(source==supplierMenuLabel) { + supplierMenuLabel.setForeground(new Color(18, 150, 219)); + supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier2.png")); + }else if(source==catalogMenuLabel) { + catalogMenuLabel.setForeground(new Color(18, 150, 219)); + catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog2.png")); + } + else if(source==userMenuLabel1) { + userMenuLabel1.setForeground(new Color(18, 150, 219)); + + } +} + + @Override + public void mouseExited(MouseEvent e) { + Object source = e.getSource(); + if(source==homeMenuLabel) { + homeMenuLabel.setForeground(Color.white); + homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home1.png")); + } + else if(source==userMenuLabel) { + userMenuLabel.setForeground(Color.white); + userMenuLabel.setIcon(new ImageIcon("static\\icon\\user1.png")); + }else if(source==inMenuLabel) { + inMenuLabel.setForeground(Color.white); + inMenuLabel.setIcon(new ImageIcon("static\\icon\\in1.png")); + }else if(source==outMenuLabel) { + outMenuLabel.setForeground(Color.white); + outMenuLabel.setIcon(new ImageIcon("static\\icon\\out1.png")); + }else if(source==storageMenuLabel) { + storageMenuLabel.setForeground(Color.white); + storageMenuLabel.setIcon(new ImageIcon("static\\icon\\storage1.png")); + }else if(source==supplierMenuLabel) { + supplierMenuLabel.setForeground(Color.white); + supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier1.png")); + }else if(source==catalogMenuLabel) { + catalogMenuLabel.setForeground(Color.white); + catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog1.png")); + } + else { + userMenuLabel1.setForeground(Color.white); + + } + + } + + + @Override + protected void initView() { + // TODO Auto-generated method stub + + } + + @Override + public void windowOpened(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowClosing(WindowEvent e) { + // TODO Auto-generated method stub + Object source = e.getSource(); + if(source==this) {/*关闭窗口时检查进货系统和出货系统是否还有记录*/ + this.vP =InView.getVector(); + System.out.println("v的size="+vP.size()); + bufferImpl = new BufferImpl(); + if(vP.size()!=0||bufferImpl.allOutBuffer().size()!=0) {/*如果购物车还有记录*/ + CloseDialog closeDialog = new CloseDialog(this,vP); + closeDialog.setVisible(true); + }else + System.exit(0); + + + } + } + + @Override + public void windowClosed(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowIconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeiconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowActivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeactivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + + + + + + + +} diff --git a/Supermarket/src/com/lingnan/supermarket/view/Nimbus.java b/Supermarket/src/com/lingnan/supermarket/view/Nimbus.java new file mode 100644 index 0000000..bdfaac6 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/view/Nimbus.java @@ -0,0 +1,14 @@ +package com.lingnan.supermarket.view; +import javax.swing.UIManager; + +public class Nimbus { + + /*nimbus风格*/ + public static void Nimbus() { + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/Supermarket/src/com/lingnan/supermarket/view/OutView.java b/Supermarket/src/com/lingnan/supermarket/view/OutView.java new file mode 100644 index 0000000..01a2ddb --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/view/OutView.java @@ -0,0 +1,338 @@ +package com.lingnan.supermarket.view; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Vector; + +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.text.html.HTMLDocument.Iterator; + +import com.lingnan.supermarket.dao.impl.BufferImpl; +import com.lingnan.supermarket.dialog.ChangeSumDialog; +import com.lingnan.supermarket.dialog.OutDialog; +import com.lingnan.supermarket.dialog.UserDialog; +import com.lingnan.supermarket.dto.Buffer; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.table.*; +import com.lingnan.supermarket.utils.FontUtil; +import com.lingnan.supermarket.utils.TimeAndOrder; + +public class OutView extends JPanel implements ActionListener{ + + + //上面 + private JPanel toolBarPanel; + + private JPanel searchPanel; + private JLabel nameLabel,locationLabel; + private JTextField nameSearchTF; + private JButton searchBtn,AccountBtn,exitBtn; + + private JPanel opePanel; + private JButton addBtn,updateBtn,deleteBtn,historyBtn,backBtn,detailBtn; + + //中间 + private JScrollPane tableScrollPane; + private JTable outTable; + + //下面 + private JPanel bottomPanel,bottomPanelLeft,bottomPanelRight; + private JLabel countInfoLabel,countInfoLabel2; + + private Buffer Buffer; + private BufferImpl BufferImpl; + + private Vector v; + + + private JFrame jFrame; + private User user; + + private OutTableModel outTableModel = new OutTableModel(); + + private int mark;/*标记订单表和订单详情表*/ + + public OutView(JFrame jFrame,User user) { + this.setLayout(new BorderLayout()); + initView(); + this.jFrame = jFrame; + this.user = user; + } + + private void initView() { + + toolBarPanel = new JPanel(new BorderLayout()); + + searchPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + nameLabel = new JLabel("订单号"); + nameSearchTF = new JTextField(20); + + searchBtn = new JButton(new ImageIcon("static\\icon\\search.png")); + searchBtn.addActionListener(this); + locationLabel=new JLabel("当前位置>收银系统"); + locationLabel.setFont(new FontUtil().userFont); + locationLabel.setForeground(new Color(18, 150, 219)); + + opePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + addBtn =new JButton(new ImageIcon("static\\icon\\add.png")); + updateBtn =new JButton(new ImageIcon("static\\icon\\change.png")); + deleteBtn =new JButton(new ImageIcon("static\\icon\\delete.png")); + historyBtn =new JButton(new ImageIcon("static\\icon\\history.png")); + backBtn =new JButton(new ImageIcon("static\\icon\\back.png")); + detailBtn = new JButton(new ImageIcon("static\\icon\\detail.png")); + backBtn.setVisible(false);/*在记录页面显示出来*/ + detailBtn.setVisible(false);/*在订单详情页显示出来*/ + + + addBtn.addActionListener(this); + updateBtn.addActionListener(this); + deleteBtn.addActionListener(this); + historyBtn.addActionListener(this); + backBtn.addActionListener(this); + detailBtn.addActionListener(this); + + opePanel.add(addBtn); + opePanel.add(backBtn); + opePanel.add(detailBtn); + opePanel.add(updateBtn); + opePanel.add(deleteBtn); + opePanel.add(historyBtn); + + searchPanel.add(locationLabel); + searchPanel.add(nameLabel); + searchPanel.add(nameSearchTF); + searchPanel.add(searchBtn); + + + toolBarPanel.add(searchPanel,"West"); + toolBarPanel.add(opePanel,"East"); + + + //中间表格 + outTableModel = new OutTableModel(); + outTableModel.allOutBuffer();/*查找所有购物车*/ + outTable = new JTable(outTableModel); + outTable.setFont(FontUtil.tableFont); + outTable.setRowHeight(50); + tableScrollPane = new JScrollPane(outTable); + + //下面 + bottomPanelLeft = new JPanel(new FlowLayout(FlowLayout.LEFT)); + countInfoLabel = new JLabel("商品种类:"+outTableModel.getRowCount()+",总价:"+outTableModel.getAllPrice()); + bottomPanelLeft.add(countInfoLabel); + + bottomPanelRight = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + AccountBtn =new JButton(new ImageIcon("static\\icon\\Account.png"));/*结账按钮*/ + exitBtn =new JButton(new ImageIcon("static\\icon\\exit.png"));/*退出按钮*/ + AccountBtn.addActionListener(this); + exitBtn.addActionListener(this); + bottomPanelRight.add(AccountBtn); + bottomPanelRight.add(exitBtn); + + bottomPanel = new JPanel(new BorderLayout()); + bottomPanel.add(bottomPanelRight,"East"); + bottomPanel.add(bottomPanelLeft,"West"); + + + this.add(toolBarPanel,"North"); + this.add(tableScrollPane,"Center");/*将表格放到中间*/ +/* this.add(bottomPanel,"South");*/ + this.add(bottomPanel,"South"); + + setVisible(true); + } + + + //按钮组件隐藏 + public void OrderView() { + backBtn.setVisible(true); + detailBtn.setVisible(true); + updateBtn.setVisible(false); + deleteBtn.setVisible(true); + addBtn.setVisible(false); + historyBtn.setVisible(false); + } + + + + + + //通过订单查找 + public void resultOfNumber(String oNumber) { + this.mark=1; + OutOrderTM outOrderTM = new OutOrderTM(); + outOrderTM.resultOfNumber(oNumber); + outTable.setModel(outOrderTM); + bottomPanelLeft.removeAll(); + countInfoLabel = new JLabel("共"+outOrderTM.getRowCount()+"条记录"); + bottomPanelLeft.add(countInfoLabel); + OrderView(); + } + + + /*刷新*/ + public void refreshOutBuffer() { + OutTableModel outTableModel = new OutTableModel(); + outTableModel.allOutBuffer(); + outTable.setModel(outTableModel); + bottomPanelLeft.removeAll(); + countInfoLabel = new JLabel("商品种类:"+outTableModel.getRowCount()+",总价:"+outTableModel.getAllPrice()); + bottomPanelLeft.add(countInfoLabel); + backBtn.setVisible(false); + detailBtn.setVisible(false); + historyBtn.setVisible(true); + updateBtn.setVisible(true); + addBtn.setVisible(true); + deleteBtn.setVisible(true); + } + + /*调出收银出货订单表*/ + public void OutOrderRecord() { + this.mark=1; + OutOrderTM outOrderTM = new OutOrderTM(); + outOrderTM.allOutOrderRecord(); + outTable.setModel(outOrderTM); + bottomPanelLeft.removeAll(); + countInfoLabel = new JLabel("共"+outOrderTM.getRowCount()+"条记录"); + bottomPanelLeft.add(countInfoLabel); + OrderView(); + } + + public void OutRecord(String oNumber) { + this.mark=0; + OutRecordTM outRecordTM = new OutRecordTM(oNumber); + outRecordTM.findOutRecordByINumber(); + outTable.setModel(outRecordTM); + bottomPanelLeft.removeAll(); + countInfoLabel = new JLabel("订单号@"+oNumber+"共有"+outRecordTM.getRowCount()+"条记录"); + bottomPanelLeft.add(countInfoLabel); + backBtn.setVisible(true); + detailBtn.setVisible(false); + updateBtn.setVisible(false); + addBtn.setVisible(false); + historyBtn.setVisible(false); + deleteBtn.setVisible(false); + } + + + + /*按钮监听时间*/ + @Override + public void actionPerformed(ActionEvent e) { + BufferImpl = new BufferImpl();/*获得购物车*/ + Object source = e.getSource(); + + if(searchBtn==source) { + String number = nameSearchTF.getText(); + resultOfNumber(number); + } + + if(addBtn==source) { + OutDialog outDialog = new OutDialog(jFrame); + outDialog.setVisible(true); + refreshOutBuffer(); + } + + else if(updateBtn==source) { + int rowIndex = outTable.getSelectedRow(); + if(rowIndex==-1) { + JOptionPane.showMessageDialog(this,"请选中一条进行更改数量"); + return; + } + String id =(String) outTable.getValueAt(rowIndex,0); + ChangeSumDialog changesumDialog = new ChangeSumDialog(jFrame,id,"Out"); + changesumDialog.setVisible(true); + refreshOutBuffer(); + } + + else if(deleteBtn==source) { + int rowIndex = outTable.getSelectedRow(); + if(rowIndex==-1) { + JOptionPane.showMessageDialog(this,"请选中一条"); + return; + } + String id =(String) outTable.getValueAt(rowIndex,0); + int select = JOptionPane.showConfirmDialog(this,"是否删除id为"+id+"的记录","提示",JOptionPane.YES_NO_OPTION); + if(select==JOptionPane.YES_OPTION) {/*选择是*/ + if(BufferImpl.DelOutBufferById(id)==true) { + JOptionPane.showMessageDialog(this,"删除成功","提示",JOptionPane.INFORMATION_MESSAGE); + }else { + JOptionPane.showMessageDialog(this,"删除失败","提示",JOptionPane.ERROR_MESSAGE); + } + refreshOutBuffer(); + } + + + }else if(historyBtn==source) {/*查看历史全部记录*/ + OutOrderRecord(); + }else if(backBtn==source) {/*历史记录中的返回按钮*/ + System.out.println("outView中的mark="+mark); + if(mark==1) { + refreshOutBuffer(); + }else if(mark==0) { + OutOrderRecord(); + } + + }else if(detailBtn==source) {/*查看订单详细*/ + + int rowIndex = outTable.getSelectedRow(); + if(rowIndex==-1) { + JOptionPane.showMessageDialog(this,"请选中一条查看订单详细信息"); + return; + } + + String oNumber =(String) outTable.getValueAt(rowIndex,0); + System.out.println("详情订单号为="+oNumber); + OutRecord(oNumber); + } + + + + else if(AccountBtn==source) {/*结账*/ + refreshOutBuffer(); + v = BufferImpl.allOutBuffer(); + if(v.size()==0)/*购物车为空*/{ + JOptionPane.showMessageDialog(null,"您的购物车为空", "提示", JOptionPane.YES_OPTION); + } + else {/*购物车不为空*/ + int res = JOptionPane.showConfirmDialog(null,"总金额:"+outTableModel.getAllPrice()+"元\r\n是否已经结账", "结账", JOptionPane.YES_NO_OPTION); + if(res==JOptionPane.YES_OPTION)/*如果已经结账*/{ + + String[] s =TimeAndOrder.TimeAndOrder(user.getUsername());/*获得时间和订单号*/ + + BufferImpl.InsertOutOrder(s[0],outTableModel.getAllPrice(), s[1], user.getUsername());/*往订单表插入一条记录*/ + for(int i=0;i combo; + private String log[]=null; + private ArrayListalog=null; + private ProdCatalogTM prodCatalogTM; + private ProdCatalog pc; + private prodCatalogImpl pci; + + // 中间 + private JScrollPane tableScrollPane; + private JTable prodCatalogTable; + + // 下面 + private JPanel bottomPanel; + private JLabel countInfoLabel; + + private JFrame jFrame; + + public ProdCatalogView(JFrame jFrame) { + this.setLayout(new BorderLayout()); + initView(); + this.jFrame = jFrame; + } + + + private void initView() { + + toolBarPanel = new JPanel(new BorderLayout()); + + searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + locationLabel = new JLabel("商品目录"); + locationLabel.setFont(new FontUtil().userFont); + locationLabel.setForeground(new Color(18, 150, 219)); + logLabel = new JLabel("分类"); + nameSearchTF = new JTextField(10); + + searchBtn = new JButton("搜索", new ImageIcon("static\\icon\\search.png")); + +// opePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); +// addBtn = new JButton(new ImageIcon("static\\icon\\add.png")); +// updateBtn = new JButton(new ImageIcon("static\\icon\\update.png")); +// deleteBtn = new JButton(new ImageIcon("static\\icon\\delete.png")); + +// addBtn.addActionListener(this); +// updateBtn.addActionListener(this); +// deleteBtn.addActionListener(this); + +// opePanel.add(addBtn); +// opePanel.add(updateBtn); +// opePanel.add(deleteBtn); + + pci=new prodCatalogImpl(); + this.alog=pci.findNameProdCatalog(); + this.log=new String[alog.size()]; + for(int i=0;i(log); + combo.addItemListener(new MyItemListener()); + + searchPanel.add(locationLabel); + searchPanel.add(logLabel); + searchPanel.add(combo); + /* + * searchPanel.add(nameSearchTF); searchPanel.add(searchBtn); + */ + + toolBarPanel.add(searchPanel, "West"); +// toolBarPanel.add(opePanel, "East"); + + // 中间表格 + prodCatalogTM = new ProdCatalogTM(); + prodCatalogTM.all(); + prodCatalogTable = new JTable(prodCatalogTM); + prodCatalogTable.setFont(FontUtil.tableFont); + prodCatalogTable.setRowHeight(50); + tableScrollPane = new JScrollPane(prodCatalogTable); + + // 下面 + bottomPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + countInfoLabel = new JLabel("总共" + prodCatalogTable.getRowCount() + "条"); + bottomPanel.add(countInfoLabel); + + this.add(toolBarPanel, "North"); + this.add(tableScrollPane, "Center");/* 将表格放到中间 */ + this.add(bottomPanel, "South"); + + setVisible(true); + } + +// @Override +// public void actionPerformed(ActionEvent e) { +// Object source = e.getSource(); +// if (addBtn == source) { +// UserDialog userDialog = new UserDialog(jFrame); +// userDialog.setVisible(true); +// } else if (updateBtn == source) { +// +// } else if (deleteBtn == source) { +// +// } +// } + + public class MyItemListener implements ItemListener { + + @Override + public void itemStateChanged(ItemEvent e) { + JComboBox cb = (JComboBox) e.getSource(); + String catalog1 = (String) cb.getSelectedItem(); + pci =new prodCatalogImpl(); + for(int i=0;i商品库存"); + locationLabel.setFont(new FontUtil().userFont); + locationLabel.setForeground(new Color(18, 150, 219)); + nameLabel = new JLabel("商品名"); + nameSearchTF = new JTextField(10); + + searchBtn = new JButton(new ImageIcon("static\\icon\\search.png")); + + opePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + addBtn =new JButton(new ImageIcon("static\\icon\\add.png")); + updateBtn =new JButton(new ImageIcon("static\\icon\\update.png")); + deleteBtn =new JButton(new ImageIcon("static\\icon\\delete.png")); + backBtn =new JButton(new ImageIcon("static\\icon\\back.png")); + historyBtn =new JButton(new ImageIcon("static\\icon\\history.png")); + backBtn.setVisible(false); + + addBtn.addActionListener(this); + updateBtn.addActionListener(this); + deleteBtn.addActionListener(this); + searchBtn.addActionListener(this); + backBtn.addActionListener(this); + historyBtn.addActionListener(this); + + opePanel.add(addBtn); + opePanel.add(updateBtn); + opePanel.add(deleteBtn); + opePanel.add(backBtn); + opePanel.add(historyBtn); + + searchPanel.add(locationLabel); + searchPanel.add(nameLabel); + searchPanel.add(nameSearchTF); + searchPanel.add(searchBtn); + + + toolBarPanel.add(searchPanel,"West"); + toolBarPanel.add(opePanel,"East"); + + + //中间表格 + storageTableModel = new StorageTableModel(); + storageTableModel.all(); + storageTable = new JTable(storageTableModel); + storageTable.setFont(FontUtil.tableFont); + storageTable.setRowHeight(50); + + tableScrollPane = new JScrollPane(storageTable); + + //下面 + bottomPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + countInfoLabel = new JLabel("总共"+storageTableModel.getRowCount()+"条"); + bottomPanel.add(countInfoLabel); + + + this.add(toolBarPanel,"North"); + this.add(tableScrollPane,"Center");/*将表格放到中间*/ + this.add(bottomPanel,"South"); + + setVisible(true); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if(addBtn==source) { + //添加数据的对话框 + ProductionDialog productionDialog = new ProductionDialog(jFrame); + productionDialog.setVisible(true); + refreshProduction(); + }else if(updateBtn==source) { + refreshProduction(); + }else if(historyBtn==source) { + storageRecord(); + }else if(backBtn==source) { + refreshProduction(); + } + + else if(deleteBtn==source) { + //获取选中记录,删除 + int[] rowIndexs = storageTable.getSelectedRows(); + if(rowIndexs.length==0) { + JOptionPane.showMessageDialog(this,"请至少选中一条"); + return; + } + int select=JOptionPane.showConfirmDialog(this,"是否删除选中的"+rowIndexs.length+"条记录","提示",JOptionPane.YES_NO_OPTION); + if(select==JOptionPane.YES_OPTION){ + + for(int i=0;i供应商"); + locationLabel.setFont(new FontUtil().userFont); + locationLabel.setForeground(new Color(18, 150, 219)); + nameLabel = new JLabel("公司名称"); + nameSearchTF = new JTextField(10); + + searchBtn = new JButton(new ImageIcon("static\\icon\\search.png")); + + opePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + addBtn =new JButton(new ImageIcon("static\\icon\\add.png")); + updateBtn =new JButton(new ImageIcon("static\\icon\\update.png")); + deleteBtn =new JButton(new ImageIcon("static\\icon\\delete.png")); + + addBtn.addActionListener(this); + updateBtn.addActionListener(this); + deleteBtn.addActionListener(this); + searchBtn.addActionListener(this); + + opePanel.add(addBtn); + opePanel.add(updateBtn); + opePanel.add(deleteBtn); + + searchPanel.add(locationLabel); + searchPanel.add(nameLabel); + searchPanel.add(nameSearchTF); + searchPanel.add(searchBtn); + + + toolBarPanel.add(searchPanel,"West"); + toolBarPanel.add(opePanel,"East"); + + + //中间表格 + SupplierTableModel supplierTableModel = new SupplierTableModel(); + supplierTableModel.all(); + supplierTable = new JTable(supplierTableModel); + supplierTable.setFont(FontUtil.tableFont); + supplierTable.setRowHeight(50); + + tableScrollPane = new JScrollPane(supplierTable);/*滑动条*/ + + //下面 + bottomPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + countInfoLabel = new JLabel("总共"+supplierTableModel.getRowCount()+"条"); + bottomPanel.add(countInfoLabel); + + + this.add(toolBarPanel,"North"); + this.add(tableScrollPane,"Center");/*将表格放到中间*/ + this.add(bottomPanel,"South"); + + setVisible(true); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if(addBtn==source) { + SupplierInfDialog supplierInfDialog = new SupplierInfDialog(jFrame, null); + supplierInfDialog.setVisible(true); + refreshSupplier(); + }else if(updateBtn==source) { + refreshSupplier(); + }else if(deleteBtn==source) { + //获取选中记录 + int rowIndex = supplierTable.getSelectedRow(); + if(rowIndex==-1) { + JOptionPane.showMessageDialog(this,"请选中一条"); + return; + } + int id = (Integer)supplierTable.getValueAt(rowIndex,0); + int select=JOptionPane.showConfirmDialog(this,"是否删除id="+id,"提示",JOptionPane.YES_NO_OPTION); + if(select==JOptionPane.YES_OPTION){ + if(supplierInfService.deleteSupplierInf(id)==1) { + JOptionPane.showMessageDialog(this,"删除成功","提示",JOptionPane.INFORMATION_MESSAGE); + refreshSupplier(); + }else { + JOptionPane.showMessageDialog(this,"删除失败","提示",JOptionPane.ERROR_MESSAGE); + } + } + }else{ + System.out.println("搜索"); + refreshFindRname(); + } + } + public void refreshFindRname() { + String name = nameSearchTF.getText(); + SupplierInf supplierInf =new SupplierInf(); + supplierInf.setName(name); + + + supplierTableModel = new SupplierTableModel(); + supplierTableModel.Byname(supplierInf); + + supplierTable.setModel(supplierTableModel); + + refreshCount(); + + } + public void refreshSupplier() { + supplierTableModel = new SupplierTableModel(); + supplierTableModel.all(); + supplierTable.setModel(supplierTableModel); + + refreshCount(); + } + public void refreshCount(){ + bottomPanel.removeAll(); + countInfoLabel = new JLabel("总共"+supplierTableModel.getRowCount()+"条"); + bottomPanel.add(countInfoLabel); + } + +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/view/UserView.java b/Supermarket/src/com/lingnan/supermarket/view/UserView.java new file mode 100644 index 0000000..6d460d0 --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/view/UserView.java @@ -0,0 +1,185 @@ +package com.lingnan.supermarket.view; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; + +import com.lingnan.supermarket.dao.UserService; +import com.lingnan.supermarket.dao.impl.UserServiceImpl; +import com.lingnan.supermarket.dialog.UserDialog; +import com.lingnan.supermarket.dto.User; +import com.lingnan.supermarket.table.UserTableModel; +import com.lingnan.supermarket.utils.FontUtil; + +public class UserView extends JPanel implements ActionListener{ + + + //上面 + private JPanel toolBarPanel; + + private JPanel searchPanel; + private JLabel nameLabel,locationLabel; + private JTextField nameSearchTF; + private JButton searchBtn; + + private JPanel opePanel; + private JButton addBtn,updateBtn,deleteBtn; + + //中间 + private JScrollPane tableScrollPane; + private JTable userTable; + + //删除时选中赋值给id + private int id; + + //下面 + private JPanel bottomPanel; + private JLabel countInfoLabel; + + private JFrame jFrame; + + + private UserTableModel userTableModel ; + + + private UserService userService=new UserServiceImpl(); + public UserView(JFrame jFrame) { + this.setLayout(new BorderLayout()); + initView(); + this.jFrame = jFrame; + } + + private void initView() { + + toolBarPanel = new JPanel(new BorderLayout()); + + searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + locationLabel=new JLabel("当前位置>人员管理"); + locationLabel.setFont(new FontUtil().userFont); + locationLabel.setForeground(new Color(18, 150, 219)); + nameLabel = new JLabel("姓名"); + nameSearchTF = new JTextField(10); + + searchBtn = new JButton(new ImageIcon("static\\icon\\search.png")); + + /*右边功能模块*/ + opePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + addBtn =new JButton(new ImageIcon("static\\icon\\add.png")); + updateBtn =new JButton(new ImageIcon("static\\icon\\update.png")); + deleteBtn =new JButton(new ImageIcon("static\\icon\\delete.png")); + + addBtn.addActionListener(this); + updateBtn.addActionListener(this); + deleteBtn.addActionListener(this); + searchBtn.addActionListener(this); + + opePanel.add(addBtn); + opePanel.add(updateBtn); + opePanel.add(deleteBtn); + + searchPanel.add(locationLabel); + searchPanel.add(nameLabel); + searchPanel.add(nameSearchTF); + searchPanel.add(searchBtn); + + + toolBarPanel.add(searchPanel,"West"); + toolBarPanel.add(opePanel,"East"); + + + //中间表格 + userTableModel = new UserTableModel(); + userTableModel.all(); + + userTable = new JTable(userTableModel); + userTable.setFont(FontUtil.tableFont); + userTable.setRowHeight(50); + tableScrollPane = new JScrollPane(userTable); + + //下面 + bottomPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + countInfoLabel = new JLabel("总共"+userTableModel.getRowCount()+"条"); + bottomPanel.add(countInfoLabel); + + + this.add(toolBarPanel,"North"); + this.add(tableScrollPane,"Center");/*将表格放到中间*/ + this.add(bottomPanel,"South"); + + setVisible(true); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if(addBtn==source) { + //添加数据的对话框 + UserDialog userDialog = new UserDialog(jFrame); + userDialog.setVisible(true); + refreshUser(); + }else if(updateBtn==source) { + + refreshUser(); + }else if(deleteBtn==source) { + //获取选中记录 + int rowIndex = userTable.getSelectedRow(); + if(rowIndex==-1) { + JOptionPane.showMessageDialog(this,"请选中一条"); + return; + } + int id = (Integer)userTable.getValueAt(rowIndex,0); + int select=JOptionPane.showConfirmDialog(this,"是否删除id="+id,"提示",JOptionPane.YES_NO_OPTION); + if(select==JOptionPane.YES_OPTION){ + + if(userService.deleteUser(id)==1) { + JOptionPane.showMessageDialog(this,"删除成功","提示",JOptionPane.INFORMATION_MESSAGE); + + }else { + JOptionPane.showMessageDialog(this,"删除失败","提示",JOptionPane.ERROR_MESSAGE); + } + } + refreshUser(); + + }else{ + System.out.println("搜索"); + refreshFindRname(); + } + + } + public void refreshFindRname() { + String rname = nameSearchTF.getText(); + User user =new User(); + user.setRname(rname); + userTableModel = new UserTableModel(); + userTableModel.Byrname(user); + userTable.setModel(userTableModel); + //同时更新下面的记录数 + refreshCount(); + } + public void refreshUser() { + userTableModel = new UserTableModel(); + userTableModel.all(); + userTable.setModel(userTableModel); + //同时更新下面的记录数 + refreshCount(); + + } + public void refreshCount(){ + bottomPanel.removeAll(); + countInfoLabel = new JLabel("总共"+userTableModel.getRowCount()+"条"); + bottomPanel.add(countInfoLabel); + } +} + diff --git a/Supermarket/src/com/lingnan/supermarket/view/base/BaseView.java b/Supermarket/src/com/lingnan/supermarket/view/base/BaseView.java new file mode 100644 index 0000000..1a219ad --- /dev/null +++ b/Supermarket/src/com/lingnan/supermarket/view/base/BaseView.java @@ -0,0 +1,71 @@ +package com.lingnan.supermarket.view.base; + +import java.awt.Toolkit; +import java.util.Vector; + +import javax.swing.JFrame; + +import com.lingnan.supermarket.dto.Production; +import com.lingnan.supermarket.dto.User; + +public abstract class BaseView extends JFrame { + + public BaseView(int initWidth,int initHeigth,String title) { + this.setTitle(title); + this.setSize(initWidth,initHeigth); + int width = Toolkit.getDefaultToolkit().getScreenSize().width; + int height = Toolkit.getDefaultToolkit().getScreenSize().height; + this.setLocation((width-getWidth())/2,(height-getHeight())/2); + + initView(); + + this.setVisible(true); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + + /*带对象参数的构造方法*/ + public BaseView(int initWidth,int initHeigth,String title,User user,int skin) { + this.setTitle(title); + this.setSize(initWidth,initHeigth); + int width = Toolkit.getDefaultToolkit().getScreenSize().width; + int height = Toolkit.getDefaultToolkit().getScreenSize().height; + this.setLocation((width-getWidth())/2,(height-getHeight())/2); + + + + this.setVisible(true); + this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + } + + + + protected abstract void initView(); + protected abstract void initView(User user,int skin); + + + /*判断权限并返回字符*/ + public String Usuper(int usuper) { + String x=null; + if(usuper==0) + x="管理员"; + else if(usuper==1) + x="进货员"; + else if(usuper==2) + x="收银员"; + return x; + } + + /*判断权限并返回icon地址*/ + public String UsuperIcon(int usuper) { + String x=null; + if(usuper==0) + x="static\\icon\\admin.png"; + else if(usuper==1) + x="static\\icon\\carrier.png"; + else if(usuper==2) + x="static\\icon\\cashier.png"; + return x; + } + + +} diff --git a/Supermarket/static/bg/bg0.jpg b/Supermarket/static/bg/bg0.jpg new file mode 100644 index 0000000..28409ee Binary files /dev/null and b/Supermarket/static/bg/bg0.jpg differ diff --git a/Supermarket/static/bg/bg1.jpg b/Supermarket/static/bg/bg1.jpg new file mode 100644 index 0000000..5187193 Binary files /dev/null and b/Supermarket/static/bg/bg1.jpg differ diff --git a/Supermarket/static/bg/bg2.jpg b/Supermarket/static/bg/bg2.jpg new file mode 100644 index 0000000..5fcffa2 Binary files /dev/null and b/Supermarket/static/bg/bg2.jpg differ diff --git a/Supermarket/static/bg/bg3.jpg b/Supermarket/static/bg/bg3.jpg new file mode 100644 index 0000000..f195e6a Binary files /dev/null and b/Supermarket/static/bg/bg3.jpg differ diff --git a/Supermarket/static/bg/bg4.jpg b/Supermarket/static/bg/bg4.jpg new file mode 100644 index 0000000..35604c2 Binary files /dev/null and b/Supermarket/static/bg/bg4.jpg differ diff --git a/Supermarket/static/bg/bg5.jpg b/Supermarket/static/bg/bg5.jpg new file mode 100644 index 0000000..85e9554 Binary files /dev/null and b/Supermarket/static/bg/bg5.jpg differ diff --git a/Supermarket/static/bg/bg6.jpg b/Supermarket/static/bg/bg6.jpg new file mode 100644 index 0000000..cc3bc8c Binary files /dev/null and b/Supermarket/static/bg/bg6.jpg differ diff --git a/Supermarket/static/bg/bg7.jpg b/Supermarket/static/bg/bg7.jpg new file mode 100644 index 0000000..f13a4c6 Binary files /dev/null and b/Supermarket/static/bg/bg7.jpg differ diff --git a/Supermarket/static/bg/bg8.jpg b/Supermarket/static/bg/bg8.jpg new file mode 100644 index 0000000..afe3074 Binary files /dev/null and b/Supermarket/static/bg/bg8.jpg differ diff --git a/Supermarket/static/bg/bg9.jpg b/Supermarket/static/bg/bg9.jpg new file mode 100644 index 0000000..5650f6a Binary files /dev/null and b/Supermarket/static/bg/bg9.jpg differ diff --git a/Supermarket/static/bg/bgLogin.jpg b/Supermarket/static/bg/bgLogin.jpg new file mode 100644 index 0000000..4dab570 Binary files /dev/null and b/Supermarket/static/bg/bgLogin.jpg differ diff --git a/Supermarket/static/icon/account.png b/Supermarket/static/icon/account.png new file mode 100644 index 0000000..7bbf595 Binary files /dev/null and b/Supermarket/static/icon/account.png differ diff --git a/Supermarket/static/icon/add.png b/Supermarket/static/icon/add.png new file mode 100644 index 0000000..3b80464 Binary files /dev/null and b/Supermarket/static/icon/add.png differ diff --git a/Supermarket/static/icon/admin.png b/Supermarket/static/icon/admin.png new file mode 100644 index 0000000..53750c2 Binary files /dev/null and b/Supermarket/static/icon/admin.png differ diff --git a/Supermarket/static/icon/back.png b/Supermarket/static/icon/back.png new file mode 100644 index 0000000..31e6008 Binary files /dev/null and b/Supermarket/static/icon/back.png differ diff --git a/Supermarket/static/icon/carrier.png b/Supermarket/static/icon/carrier.png new file mode 100644 index 0000000..399f102 Binary files /dev/null and b/Supermarket/static/icon/carrier.png differ diff --git a/Supermarket/static/icon/cashier.png b/Supermarket/static/icon/cashier.png new file mode 100644 index 0000000..74fb48a Binary files /dev/null and b/Supermarket/static/icon/cashier.png differ diff --git a/Supermarket/static/icon/catalog1.png b/Supermarket/static/icon/catalog1.png new file mode 100644 index 0000000..f376e45 Binary files /dev/null and b/Supermarket/static/icon/catalog1.png differ diff --git a/Supermarket/static/icon/catalog2.png b/Supermarket/static/icon/catalog2.png new file mode 100644 index 0000000..02a4aaf Binary files /dev/null and b/Supermarket/static/icon/catalog2.png differ diff --git a/Supermarket/static/icon/change.png b/Supermarket/static/icon/change.png new file mode 100644 index 0000000..5329759 Binary files /dev/null and b/Supermarket/static/icon/change.png differ diff --git a/Supermarket/static/icon/complaints.png b/Supermarket/static/icon/complaints.png new file mode 100644 index 0000000..7955fc2 Binary files /dev/null and b/Supermarket/static/icon/complaints.png differ diff --git a/Supermarket/static/icon/delete.png b/Supermarket/static/icon/delete.png new file mode 100644 index 0000000..f04a256 Binary files /dev/null and b/Supermarket/static/icon/delete.png differ diff --git a/Supermarket/static/icon/detail.png b/Supermarket/static/icon/detail.png new file mode 100644 index 0000000..826f6c6 Binary files /dev/null and b/Supermarket/static/icon/detail.png differ diff --git a/Supermarket/static/icon/email.png b/Supermarket/static/icon/email.png new file mode 100644 index 0000000..7243017 Binary files /dev/null and b/Supermarket/static/icon/email.png differ diff --git a/Supermarket/static/icon/exit.png b/Supermarket/static/icon/exit.png new file mode 100644 index 0000000..5b5dbff Binary files /dev/null and b/Supermarket/static/icon/exit.png differ diff --git a/Supermarket/static/icon/history.png b/Supermarket/static/icon/history.png new file mode 100644 index 0000000..a94fdf8 Binary files /dev/null and b/Supermarket/static/icon/history.png differ diff --git a/Supermarket/static/icon/home1.png b/Supermarket/static/icon/home1.png new file mode 100644 index 0000000..96bdc41 Binary files /dev/null and b/Supermarket/static/icon/home1.png differ diff --git a/Supermarket/static/icon/home2.png b/Supermarket/static/icon/home2.png new file mode 100644 index 0000000..13530a7 Binary files /dev/null and b/Supermarket/static/icon/home2.png differ diff --git a/Supermarket/static/icon/in1.png b/Supermarket/static/icon/in1.png new file mode 100644 index 0000000..577c9cc Binary files /dev/null and b/Supermarket/static/icon/in1.png differ diff --git a/Supermarket/static/icon/in2.png b/Supermarket/static/icon/in2.png new file mode 100644 index 0000000..a217380 Binary files /dev/null and b/Supermarket/static/icon/in2.png differ diff --git a/Supermarket/static/icon/income.png b/Supermarket/static/icon/income.png new file mode 100644 index 0000000..e29cece Binary files /dev/null and b/Supermarket/static/icon/income.png differ diff --git a/Supermarket/static/icon/loginName.png b/Supermarket/static/icon/loginName.png new file mode 100644 index 0000000..a9caab9 Binary files /dev/null and b/Supermarket/static/icon/loginName.png differ diff --git a/Supermarket/static/icon/logo.png b/Supermarket/static/icon/logo.png new file mode 100644 index 0000000..037abd6 Binary files /dev/null and b/Supermarket/static/icon/logo.png differ diff --git a/Supermarket/static/icon/money.png b/Supermarket/static/icon/money.png new file mode 100644 index 0000000..6c5a434 Binary files /dev/null and b/Supermarket/static/icon/money.png differ diff --git a/Supermarket/static/icon/out1.png b/Supermarket/static/icon/out1.png new file mode 100644 index 0000000..d61adec Binary files /dev/null and b/Supermarket/static/icon/out1.png differ diff --git a/Supermarket/static/icon/out2.png b/Supermarket/static/icon/out2.png new file mode 100644 index 0000000..1982089 Binary files /dev/null and b/Supermarket/static/icon/out2.png differ diff --git a/Supermarket/static/icon/pwd.png b/Supermarket/static/icon/pwd.png new file mode 100644 index 0000000..18c979a Binary files /dev/null and b/Supermarket/static/icon/pwd.png differ diff --git a/Supermarket/static/icon/refresh.png b/Supermarket/static/icon/refresh.png new file mode 100644 index 0000000..2358f69 Binary files /dev/null and b/Supermarket/static/icon/refresh.png differ diff --git a/Supermarket/static/icon/remind1.png b/Supermarket/static/icon/remind1.png new file mode 100644 index 0000000..252f9f3 Binary files /dev/null and b/Supermarket/static/icon/remind1.png differ diff --git a/Supermarket/static/icon/remind2.png b/Supermarket/static/icon/remind2.png new file mode 100644 index 0000000..2b39e46 Binary files /dev/null and b/Supermarket/static/icon/remind2.png differ diff --git a/Supermarket/static/icon/search.png b/Supermarket/static/icon/search.png new file mode 100644 index 0000000..19f34a1 Binary files /dev/null and b/Supermarket/static/icon/search.png differ diff --git a/Supermarket/static/icon/setting.png b/Supermarket/static/icon/setting.png new file mode 100644 index 0000000..c3b401d Binary files /dev/null and b/Supermarket/static/icon/setting.png differ diff --git a/Supermarket/static/icon/skin.png b/Supermarket/static/icon/skin.png new file mode 100644 index 0000000..3a2bbfc Binary files /dev/null and b/Supermarket/static/icon/skin.png differ diff --git a/Supermarket/static/icon/stock.png b/Supermarket/static/icon/stock.png new file mode 100644 index 0000000..de04391 Binary files /dev/null and b/Supermarket/static/icon/stock.png differ diff --git a/Supermarket/static/icon/storage1.png b/Supermarket/static/icon/storage1.png new file mode 100644 index 0000000..79e7f0e Binary files /dev/null and b/Supermarket/static/icon/storage1.png differ diff --git a/Supermarket/static/icon/storage2.png b/Supermarket/static/icon/storage2.png new file mode 100644 index 0000000..2744f4f Binary files /dev/null and b/Supermarket/static/icon/storage2.png differ diff --git a/Supermarket/static/icon/supplier1.png b/Supermarket/static/icon/supplier1.png new file mode 100644 index 0000000..676aa82 Binary files /dev/null and b/Supermarket/static/icon/supplier1.png differ diff --git a/Supermarket/static/icon/supplier2.png b/Supermarket/static/icon/supplier2.png new file mode 100644 index 0000000..e0901df Binary files /dev/null and b/Supermarket/static/icon/supplier2.png differ diff --git a/Supermarket/static/icon/update.png b/Supermarket/static/icon/update.png new file mode 100644 index 0000000..2a0cb73 Binary files /dev/null and b/Supermarket/static/icon/update.png differ diff --git a/Supermarket/static/icon/user1.png b/Supermarket/static/icon/user1.png new file mode 100644 index 0000000..58c3eb2 Binary files /dev/null and b/Supermarket/static/icon/user1.png differ diff --git a/Supermarket/static/icon/user2.png b/Supermarket/static/icon/user2.png new file mode 100644 index 0000000..291422e Binary files /dev/null and b/Supermarket/static/icon/user2.png differ diff --git a/Supermarket/static/icon/新.png b/Supermarket/static/icon/新.png new file mode 100644 index 0000000..68b2b31 Binary files /dev/null and b/Supermarket/static/icon/新.png differ diff --git a/Supermarket/static/img/3.png b/Supermarket/static/img/3.png new file mode 100644 index 0000000..1c55592 Binary files /dev/null and b/Supermarket/static/img/3.png differ diff --git a/Supermarket/static/userimg/u1.png b/Supermarket/static/userimg/u1.png new file mode 100644 index 0000000..4bae0d2 Binary files /dev/null and b/Supermarket/static/userimg/u1.png differ diff --git a/Supermarket/static/userimg/u2.png b/Supermarket/static/userimg/u2.png new file mode 100644 index 0000000..1db27a0 Binary files /dev/null and b/Supermarket/static/userimg/u2.png differ diff --git a/Supermarket/static/userimg/u3.png b/Supermarket/static/userimg/u3.png new file mode 100644 index 0000000..cae9c79 Binary files /dev/null and b/Supermarket/static/userimg/u3.png differ diff --git a/Supermarket/static/userimg/u4.png b/Supermarket/static/userimg/u4.png new file mode 100644 index 0000000..3a0ce7a Binary files /dev/null and b/Supermarket/static/userimg/u4.png differ diff --git a/Supermarket/static/userimg/u5.png b/Supermarket/static/userimg/u5.png new file mode 100644 index 0000000..466efcc Binary files /dev/null and b/Supermarket/static/userimg/u5.png differ diff --git a/Supermarket/static/轮播/00.jpg b/Supermarket/static/轮播/00.jpg new file mode 100644 index 0000000..b59025c Binary files /dev/null and b/Supermarket/static/轮播/00.jpg differ diff --git a/Supermarket/static/轮播/01.jpg b/Supermarket/static/轮播/01.jpg new file mode 100644 index 0000000..3fd3e74 Binary files /dev/null and b/Supermarket/static/轮播/01.jpg differ diff --git a/Supermarket/static/轮播/02.jpg b/Supermarket/static/轮播/02.jpg new file mode 100644 index 0000000..b6eae27 Binary files /dev/null and b/Supermarket/static/轮播/02.jpg differ diff --git a/Supermarket/static/轮播/03.jpg b/Supermarket/static/轮播/03.jpg new file mode 100644 index 0000000..6be1884 Binary files /dev/null and b/Supermarket/static/轮播/03.jpg differ diff --git a/Supermarket/static/轮播/04.jpg b/Supermarket/static/轮播/04.jpg new file mode 100644 index 0000000..8e35e6f Binary files /dev/null and b/Supermarket/static/轮播/04.jpg differ diff --git a/Supermarket/static/轮播/05.jpg b/Supermarket/static/轮播/05.jpg new file mode 100644 index 0000000..95aa25c Binary files /dev/null and b/Supermarket/static/轮播/05.jpg differ diff --git a/Supermarket/static/轮播/06.jpg b/Supermarket/static/轮播/06.jpg new file mode 100644 index 0000000..221f52e Binary files /dev/null and b/Supermarket/static/轮播/06.jpg differ diff --git a/images/build.jpg b/images/build.jpg new file mode 100644 index 0000000..414a00a Binary files /dev/null and b/images/build.jpg differ diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 0000000..0047c25 Binary files /dev/null and b/images/logo.png differ diff --git a/images/sendEmail.jpg b/images/sendEmail.jpg new file mode 100644 index 0000000..8450d5c Binary files /dev/null and b/images/sendEmail.jpg differ diff --git a/images/人员管理.jpg b/images/人员管理.jpg new file mode 100644 index 0000000..c10dd9d Binary files /dev/null and b/images/人员管理.jpg differ diff --git a/images/供应商.jpg b/images/供应商.jpg new file mode 100644 index 0000000..abfa128 Binary files /dev/null and b/images/供应商.jpg differ diff --git a/images/商品库存.jpg b/images/商品库存.jpg new file mode 100644 index 0000000..0596935 Binary files /dev/null and b/images/商品库存.jpg differ diff --git a/images/商品目录.jpg b/images/商品目录.jpg new file mode 100644 index 0000000..61fcfe7 Binary files /dev/null and b/images/商品目录.jpg differ diff --git a/images/库存收银记录.jpg b/images/库存收银记录.jpg new file mode 100644 index 0000000..c939ff9 Binary files /dev/null and b/images/库存收银记录.jpg differ diff --git a/images/库存进货记录.jpg b/images/库存进货记录.jpg new file mode 100644 index 0000000..3cf256c Binary files /dev/null and b/images/库存进货记录.jpg differ diff --git a/images/收银修改数量.jpg b/images/收银修改数量.jpg new file mode 100644 index 0000000..7559b9f Binary files /dev/null and b/images/收银修改数量.jpg differ diff --git a/images/收银库存不够.jpg b/images/收银库存不够.jpg new file mode 100644 index 0000000..ed8bd85 Binary files /dev/null and b/images/收银库存不够.jpg differ diff --git a/images/收银成功首页.jpg b/images/收银成功首页.jpg new file mode 100644 index 0000000..16f1e98 Binary files /dev/null and b/images/收银成功首页.jpg differ diff --git a/images/收银支付成功.jpg b/images/收银支付成功.jpg new file mode 100644 index 0000000..edb5560 Binary files /dev/null and b/images/收银支付成功.jpg differ diff --git a/images/收银添加商品.jpg b/images/收银添加商品.jpg new file mode 100644 index 0000000..2051c99 Binary files /dev/null and b/images/收银添加商品.jpg differ diff --git a/images/收银结账.jpg b/images/收银结账.jpg new file mode 100644 index 0000000..9c31ebd Binary files /dev/null and b/images/收银结账.jpg differ diff --git a/images/收银订单详情.jpg b/images/收银订单详情.jpg new file mode 100644 index 0000000..5dad17f Binary files /dev/null and b/images/收银订单详情.jpg differ diff --git a/images/进货修改数量.jpg b/images/进货修改数量.jpg new file mode 100644 index 0000000..9e2a8d1 Binary files /dev/null and b/images/进货修改数量.jpg differ diff --git a/images/进货发送邮件.jpg b/images/进货发送邮件.jpg new file mode 100644 index 0000000..78909a4 Binary files /dev/null and b/images/进货发送邮件.jpg differ diff --git a/images/进货库存更新成功.jpg b/images/进货库存更新成功.jpg new file mode 100644 index 0000000..5d6f17e Binary files /dev/null and b/images/进货库存更新成功.jpg differ diff --git a/images/进货更改订单状态.jpg b/images/进货更改订单状态.jpg new file mode 100644 index 0000000..71e82a0 Binary files /dev/null and b/images/进货更改订单状态.jpg differ diff --git a/images/进货添加进货.jpg b/images/进货添加进货.jpg new file mode 100644 index 0000000..992cc8a Binary files /dev/null and b/images/进货添加进货.jpg differ diff --git a/images/进货确认订单.jpg b/images/进货确认订单.jpg new file mode 100644 index 0000000..870be8f Binary files /dev/null and b/images/进货确认订单.jpg differ diff --git a/images/进货订单状态.jpg b/images/进货订单状态.jpg new file mode 100644 index 0000000..b5800e3 Binary files /dev/null and b/images/进货订单状态.jpg differ diff --git a/images/进货订单详情.jpg b/images/进货订单详情.jpg new file mode 100644 index 0000000..b9e1b4a Binary files /dev/null and b/images/进货订单详情.jpg differ diff --git a/images/进货邮件内容.jpg b/images/进货邮件内容.jpg new file mode 100644 index 0000000..521e782 Binary files /dev/null and b/images/进货邮件内容.jpg differ diff --git a/images/进货首页.jpg b/images/进货首页.jpg new file mode 100644 index 0000000..ffaa702 Binary files /dev/null and b/images/进货首页.jpg differ diff --git a/images/首页.jpg b/images/首页.jpg new file mode 100644 index 0000000..9bec400 Binary files /dev/null and b/images/首页.jpg differ diff --git a/仓库管理系统.sql b/仓库管理系统.sql new file mode 100644 index 0000000..45a146c --- /dev/null +++ b/仓库管理系统.sql @@ -0,0 +1,267 @@ +drop database if exists Supermarket; +create database Supermarket; +use Supermarket; + +drop table if exists User; +create table User( +id int auto_increment primary key, +name varchar(15) unique,/*仓库管理员或收银员名称,一般为工号*/ +rname varchar(15), +password varchar(20) not null, +phone varchar(11), +sSuper int not null,/*0为超级管理员,1为仓库管理员,2收银员*/ +img varchar(50), +delmark int DEFAULT 1 +); + +insert into User values(null,"z001","陈龙","0.00.0",'666666',"0","static\\userimg\\u1.png","1"); +insert into User values("2","a001",'吴鸿发',"0.00.0",'666666',"1","static\\userimg\\u2.png","1"); +insert into User values("3","a002",'刘锦生',"0.00.0",'666666',"1","static\\userimg\\u3.png","1"); +insert into User values("4","b001",'陆伟逊',"0.00.0",'666666',"2","static\\userimg\\u4.png","1"); +insert into User values("5","b002",'殷瑞',"0.00.0",'666666',"2","static\\userimg\\u5.png","1"); + +/*供应商信息*/ +create table SupplierInf( +id int auto_increment primary key, +name varchar(30) unique, +address varchar(50), +contact varchar(11), +email varchar(50), +delmark int DEFAULT 1 +); + +insert into supplierInf values('1','安徽大兴批发部','安徽省芜湖市','113831280','1138312802@qq.com','1'); +insert into supplierInf values('2','湖北良品铺子批发零售转存中心','湖北省武汉市','15354253','153542534@qq.com','1'); +insert into supplierInf values('3','深圳百果园实业发展仓库','广东省深圳市','2858710006','2858710006@qq.com','1'); +insert into supplierInf values('4','蒙牛乳业股份有限公司','内蒙古自治区呼和浩特市','1138312802','1138312802@qq.com','1'); +insert into supplierInf values('5','内蒙古伊利实业集团股份有限公司','内蒙古自治区呼和浩特市','2858710006','2858710006@qq.com','1'); +insert into supplierInf values('6','美的集团广东分区批发部','广东省顺德市','153542534','153542534@qq.com','1'); +insert into supplierInf values('7','康师傅集团广东分区','广东省珠海市','1138312802','1138312802@qq.com','1'); +insert into supplierInf values('8','宝洁公司','美国俄亥俄州辛辛那堤市','2858710006','2858710006@qq.com','1'); + + +/*目录关系,id1为目录第一级,在系统中简化为3个类别食品,电器,生活用品*/ +create table ProdCatalog( +id varchar(20) primary key, +name varchar(20) +); + +insert into prodCatalog values('01','食品'); +insert into prodCatalog values('02','电器'); +insert into prodCatalog values('03','乳制品'); +insert into prodCatalog values('04','生活用品'); + + + +/*商品目录*/ +drop table if exists production; +create table Production( +id varchar(20) primary key, +name varchar(20) unique, +inPrice float,/*进货单价*/ +OutPrice float,/*购买单价*/ +life int,/*月份为单位*/ +sum int, +supplyId int, +id2 varchar(20), +name2 varchar(20), +price float,/*方便把记录插到InBuffer表中*/ +delmark int DEFAULT 1, +foreign key (id2) references prodCatalog(id) +); + +insert into production values('01001','猪肉脯','10','15','12','200','1','01','食品','0','1'); +insert into production values('01002','芒果干','6','12','12','200','1','01','食品','0','1'); +insert into production values('01003','碧根果','13','25','8','200','2','01','食品','0','1'); +insert into production values('01004','葡萄','20','35','0.25','50','3','01','食品','0','1'); +insert into production values('02001','蒙牛纯甄','40','65','18','300','4','03','乳制品','0','1'); +insert into production values('02002','伊利安慕希','45','65','24','350','5','03','乳制品','0','1'); +insert into production values('03001','美的变频空调','2400','3500',null,'50','6','02','电器','0','1'); +insert into production values('03002','格力节能冰箱','3500','4300',null,'50','7','02','电器','0','1'); +insert into production values('04001','海飞丝去屑洗发水','28','35','18','180','8','04','生活用品','0','1'); +insert into production values('04002','汰渍洗衣液','24','32','18','180','8','04','生活用品','0','1'); + + + +/*超市进货订单信息*/ +create table InOrder( +iNumber varchar(30) primary key,/*用java根据时间年月日时分秒和柜台号和一个随机数确定*/ +allInPrice float,/*这个订单的总价*/ +inDate Timestamp, +principal varchar(15), +status int DEFAULT 2,/*1为已入库,2为待入库,3为取消订单*/ +delmark int DEFAULT 1 +); + +insert into inOrder values('a0011201907272322391','6.5','2019-07-27 23:22:39','a001','1','1'); +insert into inOrder values('a0014201907272327143','13100','2019-07-27 23:27:14','a001','1','1'); +insert into inOrder values('a0021201907272332006','235','2019-07-27 23:32:00','a002','1','1'); + +/*进货订单信息*/ +create table InRecord( +iNumber varchar(30), +id varchar(20), +sum int, +Price float,/*单个物品进货总价*/ +foreign key (iNumber) references InOrder(iNumber) +); + +insert into inRecord values('a0011201907272322391','01001','5','2.5'); +insert into inRecord values('a0011201907272322391','01002','5','4'); +insert into inRecord values('a0014201907272327143','02001','5','5000'); +insert into inRecord values('a0014201907272327143','02002','5','600'); +insert into inRecord values('a0014201907272327143','02003','5','7500'); +insert into inRecord values('a0021201907272332006','03001','5','115'); +insert into inRecord values('a0021201907272332006','03002','5','120'); + + +/*进货时缓冲区*/ +drop table if exists InBuffer; +create table InBuffer( +id varchar(20) primary key, +name varchar(20) unique, +inPrice float,/*进货单价*/ +OutPrice float,/*购买单价*/ +life int,/*月份为单位*/ +sum int, +supplyId int, +id2 varchar(20), +name2 varchar(20), +price float, +delmark int DEFAULT 0, +foreign key (supplyId) references supplierInf(id), +foreign key (id2) references prodCatalog(id) +); + + +/*顾客购买订单信息*/ +create table OutOrder( +oNumber varchar(30) primary key,/*用java根据时间年月日时分秒和柜台号和一个随机数确定*/ +allOutPrice float,/*这个订单的总价*/ +oDate Timestamp, +principal varchar(15), +delmark int DEFAULT 1 +); +insert into outOrder values('b0010201907272344271','68','2019-07-27 23:44:27','b001','1'); + +/*出货记录,即买单记录,订单信息*/ +drop table if exists OutRecord; +create table OutRecord( +oNumber varchar(30), +id varchar(20), +sum int, +Price float,/*单个物品出售总价*/ +foreign key (oNumber) references OutOrder(oNumber) +); + +insert into outRecord values('b0010201907272344271','01001','2','2'); +insert into outRecord values('b0010201907272344271','03001','2','66'); + + +/*收银出货时缓冲区*/ +drop table if exists OutBuffer; +create table OutBuffer( +id varchar(20) primary key, +name varchar(20) unique, +inPrice float,/*进货单价*/ +OutPrice float,/*购买单价*/ +life int,/*月份为单位*/ +sum int, +supplyId int, +id2 varchar(20), +name2 varchar(20), +price float, +delmark int DEFAULT 0, +foreign key (supplyId) references supplierInf(id), +foreign key (id2) references prodCatalog(id) +); + +/*库存*/ +/*create table storage( +id varchar(20) primary key, +sum int +); + +insert into storage values('01001','8'); +insert into storage values('01002','10'); +insert into storage values('02001','10'); +insert into storage values('02002','10'); +insert into storage values('02003','10'); +insert into storage values('03001','8'); +insert into storage values('03002','10');*/ + +/*库存日志,在进货和顾客购买时进行增加或删除操作*/ + + +create table storageRecord( +theNumber varchar(30), +cDate Timestamp, +id varchar(20), +execute enum("+","-"), +num int +); + +insert into storageRecord values('a0011201907272322391',"2019-07-27 23:22:39","01001","+","5"); +insert into storageRecord values('a0011201907272322391',"2019-07-27 23:22:39","01002","+","5"); +insert into storageRecord values('a0014201907272327143',"2019-07-27 23:27:14","02001","+","5"); +insert into storageRecord values('a0014201907272327143',"2019-07-27 23:27:14","02002","+","5"); +insert into storageRecord values('a0014201907272327143',"2019-07-27 23:27:14","02003","+","5"); +insert into storageRecord values('a0021201907272332006',"2019-07-27 23:32:00","03001","+","5"); +insert into storageRecord values('a0021201907272332006',"2019-07-27 23:32:00","03002","+","5"); +insert into storageRecord values('b0010201907272344271',"2019-07-27 23:44:27","01001","-","2"); +insert into storageRecord values('b0010201907272344271',"2019-07-27 23:44:27","03001","-","2"); + + +/*-----------收银模块----------*/ +/*插入缓冲区并修改sum*/ +drop procedure if exists InsertOutBuffer; +DELIMITER $$ +create procedure InsertOutBuffer(In prodid varchar(10),In addsum int) + begin + insert into OutBuffer select * from Production where id = prodid; + update OutBuffer set sum=addsum,price=addsum*(select outPrice from Production where id = prodid) where id = prodid; + END $$ +DELIMITER ; + +/*结账时插入库存日志,商品表中sum值,出货订单记录表,出货订单详细表并清空购物缓冲表记录共五个表*/ +drop procedure if exists Account; +DELIMITER $$ +create procedure Account(In nNumber varchar(30),In tTime Timestamp,In prodid varchar(20),In addsum int ,In pPrice float) + + begin + declare allsum int; + select sum into allsum from production where id = prodid; + update production set sum=allsum-addsum where id = prodid; + insert into outRecord values(nNumber,prodid,addsum,pPrice); + insert into storageRecord values(nNumber,tTime,prodid,'-',addsum); + delete from OutBuffer; + END $$ +DELIMITER ; + + + + + + +/*-----------进货模块----------*/ +/*drop procedure if exists InsertInBuffer; +DELIMITER $$ +create procedure InsertInBuffer(In prodid varchar(10),In addsum int) + begin + insert into InBuffer select * from Production where id = prodid; + update InBuffer set sum=addsum,price=addsum*(select inPrice from Production where id = prodid) where id = prodid; + END $$ +DELIMITER ;*/ + +/*将购物车vector数组插入订单表inOrder和订单详细表inRecord*/ +/*drop procedure if exists Stock; +DELIMITER $$+ +create procedure Stock(In nNumber varchar(30),In tTime Timestamp,In prodid varchar(20),In addsum int ,In pPrice float) + + begin + declare allsum int; + select sum into allsum from production where id = prodid; + insert into inRecord values(nNumber,prodid,addsum,pPrice); + delete from InBuffer; + END $$ +DELIMITER ;*/ \ No newline at end of file