package com.dao;
import org.hibernate.Session;
import com.core.MySession;
import com.actionForm.StockGoodsForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.LinkedList;
import com.actionForm.StockMainForm;
import org.hibernate.Transaction;
import java.text.NumberFormat;
import com.actionForm.StockDetailForm;
import java.util.Set;
import java.util.HashSet;
import com.actionForm.IfForm;
import org.hibernate.Query;
import com.actionForm.StockMainViewForm;
import java.util.Date;
import com.actionForm.GoodsForm;
import com.actionForm.InStorageForm;
import com.actionForm.StorageForm;
import com.actionForm.CheckForm;
import com.actionForm.LoanForm;
public class InstorageDAO {
private Session session = null;
// session=MySession.openSession(); //打开Session
// MySession.closeSession(session); //关闭Session
public void cart_add(StockGoodsForm goodsForm, HttpServletRequest request) {
HttpSession httpsession = request.getSession();
System.out.println("******************:" +
httpsession.getAttribute("stockgoods") +
"**********");
if (httpsession.getAttribute("stockgoods") != null &&
!httpsession.getAttribute("stockgoods").equals("")) {
List list = (List) httpsession.getAttribute("stockgoods");
boolean flag = true;
for (int i = 0; i < list.size(); i++) { //判断是否已经添加了该记录
StockGoodsForm goodsF = (StockGoodsForm) list.get(i);
if (goodsF.getId() == goodsForm.getId()) { //已经采购
goodsF.setNumber(goodsF.getNumber() + goodsForm.getNumber());
list.set(i, goodsF); //重新设定指定位置i处的元素
flag = false;
break;
}
}
if (flag) {
list.add(goodsForm);
}
httpsession.setAttribute("stockgoods", list);
} else {
System.out.println("goodsForm:" + goodsForm);
List list = new LinkedList();
list.add(goodsForm);
httpsession.setAttribute("stockgoods", list);
}
}
public void cart_remove(int id, HttpServletRequest request) {
HttpSession httpsession = request.getSession();
List list = (List) httpsession.getAttribute("stockgoods");
if (list.size() > 1) {
list.remove(id); //移去指定的物资信息
httpsession.setAttribute("stockgoods", list);
} else {
httpsession.removeAttribute("stockgoods");
}
}
//清空保存物资信息的Session
public void cart_clear(HttpServletRequest request) {
HttpSession httpsession = request.getSession();
httpsession.removeAttribute("stockgoods");
}
//添加采购单信息
public int stockadd(StockMainForm stockMainForm, HttpServletRequest request) {
int rtn = 1;
HttpSession httpsession = request.getSession();
List list = (List) httpsession.getAttribute("stockgoods");
Transaction tx = null;
if (list.size() <= 0) {
rtn = 0;
} else {
session = MySession.openSession(); //打开Session
try {
tx = session.beginTransaction();
System.out.println("供应商ID:" + stockMainForm.getProviderid());
for (int i = 0; i < list.size(); i++) {
StockDetailForm stockDetailForm = new StockDetailForm();
StockGoodsForm stockGoods = (StockGoodsForm) list.get(i);
stockMainForm.setCreateTime(new Date());
int goodsid = stockGoods.getId();
GoodsForm goodsForm = (GoodsForm) session.get(GoodsForm.class,
goodsid);
stockDetailForm.setGoods(goodsForm);
// System.out.println("GOODSID:"+goodsForm.getId());
// stockDetailForm.setGoodsid(stockGoods.getId());
stockDetailForm.setNumber(stockGoods.getNumber());
stockDetailForm.setPrice(stockGoods.getPrice());
stockMainForm.getStockDetail().add(stockDetailForm);
stockDetailForm.setStockMain(stockMainForm);
System.out.println("goods.getId:" + stockGoods.getId() +
"**********" +
stockDetailForm.getGoodsid());
}
session.save(stockMainForm);
/*********生成采购单号*******************/
NumberFormat formater = NumberFormat.getNumberInstance();
int id = stockMainForm.getId();
formater.setMinimumIntegerDigits(5);
java.util.Date createTime = stockMainForm.getCreateTime();
java.sql.Date date = new java.sql.Date(createTime.getTime());
String sNo = "CG" + date +
formater.format(id).toString().replace(",", ""); //组合采购单号
/**************************************/
//插入采购单号
StockMainForm stockmaniF = (StockMainForm) session.get(
StockMainForm.class, id);
stockmaniF.setSno(sNo);
session.update(stockmaniF);
tx.commit();
httpsession.removeAttribute("stockgoods");
rtn=1;
} catch (Exception e) {
if (tx != null) {
tx.rollback();
}
rtn=0;
e.printStackTrace();
System.out.println("保存采购信息时的错误提示:" + e.getMessage());
} finally {
MySession.closeSession(session); //关闭Session
}
}
return rtn;
}
//添加审核入库信息
public int eligibleAdd(int id, HttpServletRequest request) {
int rtn = 1;
session = MySession.openSession(); //打开session
Transaction tx = null;
try {
tx = session.beginTransaction();
InStorageForm inStorageForm = new InStorageForm();
inStorageForm.setStockid(id);
inStorageForm.setCreateTime(new Date());
HttpSession httpsession = request.getSession();
inStorageForm.setUsername((String) httpsession.getAttribute(
"username")); //设置操作员
session.save(inStorageForm); //保存审核入库信息
/********生成审核入库单信息***********/
NumberFormat formater = NumberFormat.getNumberInstance();
int iid = inStorageForm.getId();
formater.setMinimumIntegerDigits(5);
java.util.Date inTime = inStorageForm.getCreateTime();
java.sql.Date date = new java.sql.Date(inTime.getTime());
String ino = "RK" + date +
formater.format(iid).toString().replace(",", ""); //组合入库单号
/**********************************/
//插入入库单号
InStorageForm inStorageF = (InStorageForm) session.get(
InStorageForm.class, iid);
inStorageF.setIno(ino);
session.update(inStorageF);
//修改采购单状态为已入库
StockMainForm stockMainForm = (StockMainForm) session.get(
StockMainForm.class, id);
stockMainForm.setState(1);
session.update(stockMainForm);
//修改库存信息表
String hql = "FROM StockDetailForm WHERE stockid=" + id + "";
System.out.println("HQL:" + hql);
List list = null;
Query query = session.cr
没有合适的资源?快使用搜索试试~ 我知道了~
JAVA系统项目源码物资管理系统项目源码.zip
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共211个文件
jsp:51个
java:36个
class:36个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 128 浏览量
2023-05-12
22:09:28
上传
评论
收藏 11.59MB ZIP 举报
温馨提示
JAVA系统项目源码物资管理系统项目源码
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/DOC.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 211 条
- 1
- 2
- 3
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/489b0721fcb547f0b9912b5e99350062_weixin_67336587.jpg!1)
HappyGirl快乐女孩
- 粉丝: 1w+
- 资源: 4154
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)