package bean;
/*
* 本类为增强型数据库操作类,用于返回数据库集合Vector、数据条数、数据页数、修改数据;
* 数据修改方法线程同步;
* 新添根据商品名关键字返回集合;
* 新添升级商品数量方法 upNumData(...);新添根据双关键字返回数据 ;
*/
import java.sql.*;
import java.util.Vector;
/**
*
* @author
*/
public class Dao_up {
public static final int wrong_less = -10;
public Connection con=null;
public Connection con2=null;
public static Statement sta=null;
public static PreparedStatement pre=null;
public void Connect()
{
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String str= "jdbc:sqlserver://127.0.0.1:1433;DatabaseName=pos";
this.con=DriverManager.getConnection(str,"sa","123");
}
catch(Exception e){
System.out.print(e.toString());
}
}
//获取数据库表中记录总条数
@SuppressWarnings("finally")
public Integer getCount(String sql)
{
Statement st = null;
ResultSet rs = null;
Integer i = null;
this.Connect();
try
{
st = this.con.createStatement();
rs = st.executeQuery(sql);
if(rs.next())
i = rs.getInt(1);
else
i = 0;
//return i;
}
catch(Exception e)
{
e.printStackTrace();
//return null;
}
finally
{
try{
this.con.close();
st.close();
rs.close();
return i;
}catch(Exception e){
return -1;
}
}
}
//根据数据库sql语句获取记录集合并以Vector返回
@SuppressWarnings("finally")
public Vector getData(String sql)
{
Statement st = null;
ResultSet rs = null;
this.Connect();
Vector v = new Vector();
try
{
st = this.con.createStatement();
rs = st.executeQuery(sql);
ResultSetMetaData rsmd=rs.getMetaData();
int i = rsmd.getColumnCount();
while(rs.next())
{
Vector vx = new Vector();
for(int m=1;m<=i;m++)
{
vx.add(rs.getObject(m));
}
v.add(vx);
}
//return v;
}
catch(Exception e)
{
e.printStackTrace();
//return null;
}
finally
{
try
{
this.con.close();
st.close();
rs.close();
return v;
}
catch(Exception e)
{
e.printStackTrace();
return v;
}
}
}
//根据表名、列名(主键列)、分页大小、当前分页号获取数据
@SuppressWarnings("finally")
public Vector getVector(String table,String columName,Integer pageSize,Integer pageNum)
{
Statement st = null;
ResultSet rs = null;
this.Connect();
Vector v = new Vector();
try
{
st = this.con.createStatement();
rs = st.executeQuery("select top "+pageSize+" * from "+table+" where "+columName+" not in (select top "+((pageNum-1)*pageSize)+" " +columName+" from "+table+" order by "+columName+" ASC) order by "+columName+" ASC");
ResultSetMetaData rsmd=rs.getMetaData();
int i = rsmd.getColumnCount();
while(rs.next())
{
Vector vx = new Vector();
for(int m=1;m<=i;m++)
{
vx.add(rs.getObject(m));
}
v.add(vx);
}
//return v;
}
catch(Exception e)
{
e.printStackTrace();
//return null;
}
finally
{
try
{
this.con.close();
st.close();
rs.close();
return v;
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
}
}
//根据表中条数和分页大小计算分页数量
public Integer getPageCount(String sql,Integer pageSize)
{
Dao_up du = new Dao_up();
Integer recordCount = null;
Integer pageCount = null;
recordCount = du.getCount(sql);
int i = recordCount%pageSize;
if(i == 0)
{
pageCount = recordCount/pageSize;
}
else
{
pageCount = recordCount/pageSize+1;
}
return pageCount;
}
//根据表名、列名(主键列)、字符数组来删除数据这里的主键是int型,字符数组就是选择框选择的字符串
@SuppressWarnings("finally")
public int delete_Integer(String table,String columName,String[] str)
{
int n = 0;
Statement st = null;
this.Connect();
String sql = "delete from "+table+" where "+columName+" =";
try
{
for(int ii=0;ii<str.length;ii++)
{
if(ii != 0)
sql = sql+" or "+columName+" ="+str[ii];
else
sql = sql+str[ii];
}
st = this.con.createStatement();
n = st.executeUpdate(sql);
//return n;
}
catch(Exception e)
{
e.printStackTrace();
//return 0;
}
finally
{
try{
this.con.close();
st.close();
//rs.close();
return n;
}catch(Exception e){
return -1;
}
//return n;
}
}
//更新货物数量(一般用于登记销售明细)
@SuppressWarnings("finally")
synchronized public int upGoodsNum(String goodsid,Integer num)
{
Statement st = null;
int i = 0;
Dao_up du = new Dao_up();
du.Connect();
try
{
st = du.con.createStatement();
ResultSet rs = st.executeQuery("select storenum from goodsinfo where goodsid="+goodsid);
if(rs.next());else return wrong_less;
Integer formernum = rs.getInt(1);
Integer nownum = formernum+num;
if(nownum<0)
{
du.con.close();
st.close();
i = wrong_less;
}
else
i = du.upData("update goodsinfo set storenum="+nownum+" where goodsid="+goodsid);
//return i;
}
catch(Exception e)
{
e.printStackTrace();
//return 0;
}
finally
{
try{
du.con.close();
st.close();
return i;
}catch(Exception e){
e.printStackTrace();
return -1;
}
}
}
//更新库存数量和最后价格(一般用于入库登记)
@SuppressWarnings("finally")
synchronized public int upNumData(String goodsid,Integer num,String price)
{
Statement st = null;
int i = 0;
Dao_up du = new Dao_up();
du.Connect();
try
{
st = du.con.createStatement();
ResultSet rs = st.executeQuery("select storenum from goodsinfo where goodsid="+goodsid);
if(rs.next());else {i = wrong_less; return i;}
Integer formernum = rs.getInt(1);
Integer nownum = formernum+num;
if(nownum<0)
{
du.con.close();
st.close();
i = wrong_less;
}
else
i = du.upData("update goodsinfo set storenum="+nownum+" ,lastinprice="+price+" where goodsid="+goodsid);
//return i;
}
catch(Exception e)
{
e.printStackTrace();
//return 0;
}
finally
{
try{
du.con.close();
st.close();
return i;
}catch(Exception e){
return -1;
}
}
}
//升级销售单号价格方法
@SuppressWarnings("finally")
synchronized public int upSalesPrice(String Salesid,Double addprice)
{
Statement st = null;
int i = 0;
Dao_up du = new Dao_up();
du.Connect();
try
{
st = du.con.createStatement();
ResultSet rs = st.executeQuery("select SalesMoney from SalesInfo where SalesID="+Salesid);
if(rs.next()); else return wrong_less;
Double formerPrice = rs.getDouble(1);
Double nowPrice = formerPrice + addprice;
i = du.upData("update SalesInfo set SalesMoney="+nowPrice+" where SalesID="+Salesid);
//return i;
}
catch(Exception e)
{
e.printStackTrace();
没有合适的资源?快使用搜索试试~ 我知道了~
JSP.rar_jsp_jsp 超市 库存_商品 进销存管理 系统_进销存_进销存jsp
共153个文件
class:49个
java:49个
jsp:39个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 127 浏览量
2022-09-22
20:28:32
上传
评论 1
收藏 1.28MB RAR 举报
温馨提示
进销存项目 本项目模拟开发中小型企业和超市所用的进销存管理系统,用于对商品和货物的入库、销售、退库管理。可统计销售概况、统计库存盘点、进行库存报警,并要求对商品入库情况进行监控。在系统中可注册员工账号并对员工实行实名制管理,便于统计员工的销售业绩。
资源推荐
资源详情
资源评论
收起资源包目录
JSP.rar_jsp_jsp 超市 库存_商品 进销存管理 系统_进销存_进销存jsp (153个子文件)
Dao_up.class 9KB
Dao_up_ajax.class 5KB
updategoods.class 4KB
addgoodsinfo.class 4KB
salesDetailsQuery1.class 3KB
salesDetailsQuery.class 3KB
salesdetail_ser.class 3KB
jinhuoa.class 3KB
touseruphq.class 3KB
ta.class 3KB
pandiana.class 3KB
salesInfoQueryid1.class 3KB
pandianb.class 3KB
salesInfoQueryid.class 3KB
touserupdate.class 3KB
salesDetailsQueryid1.class 3KB
salesDetailsQueryid.class 3KB
salesInfoQuery1.class 3KB
salesInfoQuery.class 3KB
goodsmodify.class 3KB
classadd.class 3KB
caigouDetaildate1.class 3KB
caigouDetaildate.class 3KB
caigouDetailsfind1.class 3KB
caigouDetailsfind.class 3KB
caigoufind1.class 3KB
caigoufind.class 3KB
update_ser.class 3KB
cs.class 3KB
beupdate.class 3KB
update.class 3KB
rukua.class 3KB
goodsfind.class 3KB
caigoufingdate1.class 3KB
caigoufingdate.class 3KB
updateclass.class 3KB
classupdate.class 3KB
LoginConfig.class 3KB
classdelete.class 3KB
DbDao.class 3KB
delete.class 3KB
salesinfo_ser.class 2KB
goodsExe.class 2KB
jinhuo.class 2KB
goodsmanage.class 2KB
classmanage.class 2KB
User.class 2KB
StrCompare.class 2KB
countTotalPirce.class 1KB
.classpath 526B
org.eclipse.wst.jsdt.ui.superType.container 49B
mysql-connector-java-3.1.14-bin.jar 448KB
sqljdbc.jar 247KB
Dao_up.java 12KB
salesDetailsQuery.java 6KB
salesDetailsQuery1.java 6KB
addgoodsinfo.java 5KB
updategoods.java 5KB
Dao_up_ajax.java 5KB
caigouDetailsfind1.java 4KB
caigouDetailsfind.java 4KB
salesInfoQueryid.java 4KB
salesInfoQueryid1.java 4KB
pandianb.java 4KB
jinhuoa.java 4KB
salesInfoQuery.java 4KB
goodsmodify.java 4KB
salesInfoQuery1.java 4KB
touseruphq.java 4KB
caigouDetaildate1.java 4KB
caigouDetaildate.java 4KB
caigoufind.java 4KB
caigoufind1.java 4KB
goodsfind.java 4KB
salesDetailsQueryid.java 4KB
salesDetailsQueryid1.java 4KB
caigoufingdate1.java 4KB
caigoufingdate.java 4KB
ta.java 4KB
pandiana.java 4KB
classadd.java 4KB
rukua.java 4KB
cs.java 4KB
touserupdate.java 4KB
update_ser.java 4KB
update.java 4KB
beupdate.java 4KB
updateclass.java 4KB
classdelete.java 4KB
delete.java 4KB
salesinfo_ser.java 4KB
classupdate.java 4KB
jinhuo.java 4KB
goodsExe.java 4KB
salesdetail_ser.java 3KB
goodsmanage.java 3KB
classmanage.java 3KB
LoginConfig.java 3KB
DbDao.java 2KB
User.java 2KB
共 153 条
- 1
- 2
资源评论
- AnInami2023-03-11资源很赞,希望多一些这类资源。
邓凌佳
- 粉丝: 79
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 【岗位说明】主管会计岗位职责说明书.doc
- 【岗位说明】财务部岗位职责及制度.docx
- 【岗位说明】财务部岗位职责及任职要求.docx
- 【岗位说明】分管财务副总经理岗位职责.docx
- 【岗位说明】核算员岗位职责.docx
- 【岗位说明】财务主管岗位职责.docx
- 【岗位说明】财务岗位职责.docx
- 【岗位说明】票据岗岗位职责.docx
- 【岗位说明】销售会计的岗位职责.docx
- 【岗位说明】幼儿园财务人员岗位职责.docx
- 晨辉面试抽签和评分管理系统
- 【岗位说明】html开发工程师.doc
- 【岗位说明】3D建模工程师岗位说明书.doc
- 【岗位说明】html开发工程师岗位说明.doc
- 【岗位说明】安保部主管岗位说明.doc
- 【岗位说明】安保部主管岗位职责.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功