更新库存状况报表的数据
This commit is contained in:
@@ -23,25 +23,39 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void findByType(PageUtil<DepotItem> pageUtil,String type,Integer ProjectId,Long MId,String MonthTime,Boolean isPrev) throws JshException {
|
public void findByType(PageUtil<DepotItem> pageUtil,String type,Integer dId,Long MId,String MonthTime,Boolean isPrev) throws JshException {
|
||||||
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
||||||
Query query;
|
Query query;
|
||||||
StringBuffer queryString = new StringBuffer();
|
StringBuffer queryString = new StringBuffer();
|
||||||
if(isPrev) {
|
if(type.equals("入库")) {
|
||||||
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'");
|
if (isPrev) {
|
||||||
if(ProjectId!=null) {
|
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh where di.HeaderId = dh.id ");
|
||||||
queryString.append(" and DepotId='" + ProjectId +"'");
|
queryString.append(" and ((type='入库' and DepotId='" + dId + "') " +
|
||||||
|
" or (SubType='调拨' and AnotherDepotId='" + dId + "') " +
|
||||||
|
" or (SubType='礼品充值' and AnotherDepotId='" + dId + "')) ");
|
||||||
|
queryString.append(" and MaterialId =" + MId + " and dh.OperTime <'" + MonthTime + "-01 00:00:00' ");
|
||||||
|
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||||
|
} else {
|
||||||
|
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh where di.HeaderId = dh.id ");
|
||||||
|
queryString.append(" and ((type='入库' and DepotId='" + dId + "') " +
|
||||||
|
" or (SubType='调拨' and AnotherDepotId='" + dId + "') " +
|
||||||
|
" or (SubType='礼品充值' and AnotherDepotId='" + dId + "')) ");
|
||||||
|
queryString.append(" and MaterialId =" + MId + " and dh.OperTime >='" + MonthTime + "-01 00:00:00' and dh.OperTime <='" + MonthTime + "-31 59:59:59' ");
|
||||||
|
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||||
}
|
}
|
||||||
queryString.append(" and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' ");
|
|
||||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'");
|
if (isPrev) {
|
||||||
if(ProjectId!=null) {
|
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'");
|
||||||
queryString.append(" and DepotId='" + ProjectId +"'");
|
queryString.append(" and DepotId='" + dId + "'");
|
||||||
|
queryString.append(" and MaterialId =" + MId + " and jsh_depothead.OperTime <'" + MonthTime + "-01 00:00:00' ");
|
||||||
|
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||||
|
} else {
|
||||||
|
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'");
|
||||||
|
queryString.append(" and DepotId='" + dId + "'");
|
||||||
|
queryString.append(" and MaterialId =" + MId + " and jsh_depothead.OperTime >='" + MonthTime + "-01 00:00:00' and jsh_depothead.OperTime <='" + MonthTime + "-31 59:59:59' ");
|
||||||
|
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||||
}
|
}
|
||||||
queryString.append(" and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 59:59:59' ");
|
|
||||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
|
||||||
}
|
}
|
||||||
pageUtil.setTotalCount(query.list().size());
|
pageUtil.setTotalCount(query.list().size());
|
||||||
pageUtil.setPageList(query.list());
|
pageUtil.setPageList(query.list());
|
||||||
@@ -54,12 +68,12 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
|||||||
Query query;
|
Query query;
|
||||||
StringBuffer queryString = new StringBuffer();
|
StringBuffer queryString = new StringBuffer();
|
||||||
if(type.equals("入库")) {
|
if(type.equals("入库")) {
|
||||||
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type='" + type +"'");
|
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type='入库'");
|
||||||
queryString.append(" and MaterialId ="+ MId);
|
queryString.append(" and MaterialId ="+ MId);
|
||||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type='" + type +"'");
|
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type='出库'");
|
||||||
queryString.append(" and SubType!='调拨' and SubType!='礼品充值' and MaterialId ="+ MId);
|
queryString.append(" and SubType!='调拨' and SubType!='礼品充值' and MaterialId ="+ MId);
|
||||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
$.messager.alert('导出提示','请先选择月份再进行查询!','error');
|
$.messager.alert('导出提示','请先选择月份再进行查询!','error');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showPersonDetails(1,3000);
|
showEachDetails(1,3000);
|
||||||
//此处直接去做get请求,用下面的查询每月统计的方法,去获取list,参数长度虽长,但还是可以用get
|
//此处直接去做get请求,用下面的查询每月统计的方法,去获取list,参数长度虽长,但还是可以用get
|
||||||
//window.location.href = "<%=path%>/depotItem/exportExcel.action?browserType=" + getOs();
|
//window.location.href = "<%=path%>/depotItem/exportExcel.action?browserType=" + getOs();
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("#searchProjectId").empty().append('<option value="">全部</option>').append(options);
|
$("#searchProjectId").empty().append(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,8 +289,8 @@
|
|||||||
{
|
{
|
||||||
pageNumber:pageNum,
|
pageNumber:pageNum,
|
||||||
pageSize:pageSize
|
pageSize:pageSize
|
||||||
});
|
});
|
||||||
showPersonDetails(pageNum,pageSize);
|
showEachDetails(pageNum,pageSize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -308,7 +308,7 @@
|
|||||||
|
|
||||||
//搜索处理
|
//搜索处理
|
||||||
function search() {
|
function search() {
|
||||||
showPersonDetails(1,initPageSize);
|
showEachDetails(1,initPageSize);
|
||||||
var opts = $("#tableData").datagrid('options');
|
var opts = $("#tableData").datagrid('options');
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
var pager = $("#tableData").datagrid('getPager');
|
||||||
opts.pageNumber = 1;
|
opts.pageNumber = 1;
|
||||||
@@ -326,7 +326,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function showPersonDetails(pageNo,pageSize)
|
function showEachDetails(pageNo,pageSize)
|
||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
|
|||||||
Reference in New Issue
Block a user