新增礼品卡报表的功能

This commit is contained in:
季圣华
2017-07-17 00:32:17 +08:00
parent 883890eb00
commit fd0413c187
9 changed files with 439 additions and 29 deletions

View File

@@ -21,6 +21,7 @@
<commons-io.version>2.0.1</commons-io.version> <commons-io.version>2.0.1</commons-io.version>
<commons-lang.version>2.5</commons-lang.version> <commons-lang.version>2.5</commons-lang.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.7</jdk.version>
</properties> </properties>
<!-- 设定主仓库,按设定顺序进行查找。 --> <!-- 设定主仓库,按设定顺序进行查找。 -->

View File

@@ -339,6 +339,50 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e);
} }
} }
/**
* 查找统计信息_根据礼品卡(报表)
* @return
*/
public void findGiftReport() {
try {
PageUtil<DepotHead> pageUtil_in = new PageUtil<DepotHead>();
pageUtil_in.setPageSize(0);
pageUtil_in.setCurPage(0);
pageUtil_in.setAdvSearch(getConditionHead_Gift_In());
depotHeadService.find(pageUtil_in);
List<DepotHead> dataList_in = pageUtil_in.getPageList();
JSONObject outer = new JSONObject();
String headId = "";
if(null != dataList_in) {
for(DepotHead depotHead:dataList_in) {
headId = headId + depotHead.getId() + ",";
}
PageUtil<DepotHead> pageUtil_out = new PageUtil<DepotHead>();
pageUtil_out.setPageSize(0);
pageUtil_out.setCurPage(0);
pageUtil_out.setAdvSearch(getConditionHead_Gift_Out());
depotHeadService.find(pageUtil_out);
List<DepotHead> dataList_out = pageUtil_out.getPageList();
if(null != dataList_out) {
for(DepotHead depotHead:dataList_out) {
headId = headId + depotHead.getId() + ",";
}
}
}
if(headId!="") {
headId = headId.substring(0, headId.lastIndexOf(","));
}
outer.put("HeadIds", headId);
toClient(outer.toString());
}
catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e);
}
catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e);
}
}
/** /**
* 查询单位的累计应收和累计应付,零售不能计入 * 查询单位的累计应收和累计应付,零售不能计入
@@ -442,6 +486,22 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
condition.put("OperTime_s_lteq",model.getMonthTime() + "-31 00:00:00"); condition.put("OperTime_s_lteq",model.getMonthTime() + "-31 00:00:00");
return condition; return condition;
} }
private Map<String,Object> getConditionHead_Gift_In() {
Map<String,Object> condition = new HashMap<String,Object>();
if(model.getProjectId()!=null) {
condition.put("AllocationProjectId_n_eq", model.getProjectId());
}
return condition;
}
private Map<String,Object> getConditionHead_Gift_Out() {
Map<String,Object> condition = new HashMap<String,Object>();
if(model.getProjectId()!=null) {
condition.put("ProjectId_n_eq", model.getProjectId());
}
return condition;
}
//=============以下spring注入以及Model驱动公共方法与Action处理无关================== //=============以下spring注入以及Model驱动公共方法与Action处理无关==================
public DepotHeadModel getModel() public DepotHeadModel getModel()

View File

@@ -240,6 +240,53 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
} }
} }
/**
* 查找礼品卡信息
* @return
*/
public void findGiftByAll() {
try {
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getConditionALL());
depotItemService.find(pageUtil);
List<DepotItem> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
Integer pid = model.getProjectId();
JSONArray dataArray = new JSONArray();
if(null != dataList) {
for(DepotItem depotItem:dataList){
JSONObject item = new JSONObject();
Integer InSum = sumNumberGift("礼品充值", pid, depotItem.getMaterialId().getId(), "in");
Integer OutSum = sumNumberGift("礼品销售", pid, depotItem.getMaterialId().getId(), "out");
item.put("Id", depotItem.getId());
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
item.put("MaterialName", depotItem.getMaterialId().getName());
item.put("MaterialModel", depotItem.getMaterialId().getModel());
item.put("MaterialStandard", depotItem.getMaterialId().getStandard());
item.put("MaterialColor", depotItem.getMaterialId().getColor());
item.put("MaterialUnit", depotItem.getMaterialId().getUnit());
item.put("thisSum", InSum - OutSum);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
}
catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
}
}
/** /**
* 进货统计 * 进货统计
* @return * @return
@@ -487,6 +534,37 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
return sumNumber; return sumNumber;
} }
/**
* 数量合计-礼品卡
* @param type
* @param MId
* @param MonthTime
* @param isPrev
* @return
*/
@SuppressWarnings("unchecked")
public Integer sumNumberGift(String subType,Integer ProjectId,Long MId,String type) {
Integer sumNumber = 0;
String allNumber = "";
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try {
depotItemService.findGiftByType(pageUtil, subType, ProjectId, MId,type);
allNumber = pageUtil.getPageList().toString();
allNumber = allNumber.substring(1,allNumber.length()-1);
if(allNumber.equals("null")){
allNumber = "0";
}
allNumber = allNumber.replace(".0", "");
} catch (JshException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
sumNumber = Integer.parseInt(allNumber);
return sumNumber;
}
/** /**
* 价格合计 * 价格合计
* @param type * @param type

View File

@@ -27,23 +27,23 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
{ {
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便 //多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query; Query query;
String queryString; StringBuffer queryString = new StringBuffer();
if(isPrev) { if(isPrev) {
queryString = "select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'"; queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'");
if(ProjectId!=null) { if(ProjectId!=null) {
queryString += " and ProjectId='" + ProjectId +"'"; queryString.append(" and ProjectId='" + ProjectId +"'");
} }
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' "; 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 = "select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'";
if(ProjectId!=null) {
queryString += " and ProjectId='" + ProjectId +"'";
}
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " ;
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
} }
else {
queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'");
if(ProjectId!=null) {
queryString.append(" and ProjectId='" + ProjectId +"'");
}
queryString.append(" and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' ");
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,21 +54,20 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
{ {
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便 //多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query; Query query;
String queryString; StringBuffer queryString = new StringBuffer();
if(isPrev) { if (isPrev) {
queryString = "select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'"; queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type + "'");
if(ProjectId!=null) { if (ProjectId != null) {
queryString += " and ProjectId='" + ProjectId +"'"; queryString.append(" and ProjectId='" + ProjectId + "'");
} }
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' "; 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())); query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
} } else {
else { queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type + "'");
queryString = "select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'"; if (ProjectId != null) {
if(ProjectId!=null) { queryString.append(" and ProjectId='" + ProjectId + "'");
queryString += " and ProjectId='" + ProjectId +"'";
} }
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' "; queryString.append(" and MaterialId =" + MId + " and jsh_depothead.OperTime >='" + MonthTime + "-01 00:00:00' and jsh_depothead.OperTime <='" + MonthTime + "-31 00:00:00' ");
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
} }
pageUtil.setTotalCount(query.list().size()); pageUtil.setTotalCount(query.list().size());
@@ -90,6 +89,28 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
pageUtil.setTotalCount(query.list().size()); pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list()); pageUtil.setPageList(query.list());
} }
@SuppressWarnings("unchecked")
@Override
public void findGiftByType(PageUtil<DepotItem> pageUtil,String subType,Integer ProjectId,Long MId,String type) throws JshException
{
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
StringBuffer queryString = new StringBuffer();
queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and SubType='" + subType +"'");
if(ProjectId!=null) {
if(type.equals("in")){
queryString.append(" and AllocationProjectId='" + ProjectId +"'"); //礼品充值时
}
else if(type.equals("out")){
queryString.append(" and ProjectId='" + ProjectId +"'");
}
}
queryString.append(" and MaterialId ="+ MId);
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
}
} }

View File

@@ -12,5 +12,7 @@ public interface DepotItemIDAO extends BaseIDAO<DepotItem>
public void findPriceByType(PageUtil<DepotItem> pageUtil,String type,Integer ProjectId,Long MId, String MonthTime,Boolean isPrev) throws JshException; public void findPriceByType(PageUtil<DepotItem> pageUtil,String type,Integer ProjectId,Long MId, String MonthTime,Boolean isPrev) throws JshException;
public void buyOrSale(PageUtil<DepotItem> pageUtil,String type, String subType,Long MId, String MonthTime, String sumType) throws JshException; public void buyOrSale(PageUtil<DepotItem> pageUtil,String type, String subType,Long MId, String MonthTime, String sumType) throws JshException;
public void findGiftByType(PageUtil<DepotItem> pageUtil,String subType,Integer ProjectId,Long MId, String type) throws JshException;
} }

View File

@@ -19,7 +19,9 @@ public interface DepotItemIService extends BaseIService<DepotItem>
void findPriceByType(PageUtil<DepotItem> depotItem, String type,Integer ProjectId, Long MId, String MonthTime,Boolean isPrev)throws JshException; void findPriceByType(PageUtil<DepotItem> depotItem, String type,Integer ProjectId, Long MId, String MonthTime,Boolean isPrev)throws JshException;
void buyOrSale(PageUtil<DepotItem> depotItem, String type, String subType, Long MId, String MonthTime, String sumType)throws JshException; void buyOrSale(PageUtil<DepotItem> depotItem, String type, String subType, Long MId, String MonthTime, String sumType)throws JshException;
void findGiftByType(PageUtil<DepotItem> depotItem, String subType,Integer ProjectId, Long MId, String type)throws JshException;
/** /**
* 导出信息 * 导出信息
* @return * @return

View File

@@ -61,6 +61,12 @@ public class DepotItemService extends BaseService<DepotItem> implements DepotIte
{ {
depotItemDao.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType); depotItemDao.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType);
} }
@Override
public void findGiftByType(PageUtil<DepotItem> pageUtil, String subType,Integer ProjectId,Long MId,String type) throws JshException
{
depotItemDao.findGiftByType(pageUtil, subType, ProjectId, MId, type);
}
/** /**
* 导出Excel表格 * 导出Excel表格

View File

@@ -417,9 +417,10 @@
+ 'AaBb' + rec.AllocationProjectName + 'AaBb' + rec.payType; + 'AaBb' + rec.AllocationProjectName + 'AaBb' + rec.payType;
if(1 == value) if(1 == value)
{ {
var orgId = rec.OrganId? rec.OrganId:0;
str += '<a onclick="showDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-show">查看</span></a>'; str += '<a onclick="showDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-show">查看</span></a>';
str += '<a onclick="editDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-edit">编辑</span></a>'; str += '<a onclick="editDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-edit">编辑</span></a>';
str += '<a onclick="deleteDepotHead('+ rec.Id +',' + rec.OrganId +',' + rec.TotalPrice+ ');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-delete">删除</span></a>'; str += '<a onclick="deleteDepotHead('+ rec.Id +',' + orgId +',' + rec.TotalPrice+ ');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-delete">删除</span></a>';
} }
return str; return str;
} }
@@ -1155,6 +1156,9 @@
if(listSubType === "礼品销售") { if(listSubType === "礼品销售") {
OrganId = orgDefaultId; OrganId = orgDefaultId;
} }
else if(listSubType ==="礼品充值"){
OrganId = null;
}
else { else {
OrganId = $('#OrganId').combobox('getValue'); OrganId = $('#OrganId').combobox('getValue');
} }

View File

@@ -0,0 +1,236 @@
<%@page import="com.jsh.util.Tools"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String clientIp = Tools.getCurrentUserIP();
%>
<!DOCTYPE html>
<html>
<head>
<title>礼品卡统计</title>
<meta charset="utf-8">
<!-- 指定以IE8的方式来渲染 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
<link rel="shortcut icon" href="<%=path%>/images/favicon.ico" type="image/x-icon" />
<script type="text/javascript" src="<%=path %>/js/jquery-1.8.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/icon.css"/>
<link type="text/css" rel="stylesheet" href="<%=path %>/css/common.css" />
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=path %>/js/common/common.js"></script>
</head>
<body>
<!-- 查询 -->
<div id = "searchPanel" class="easyui-panel" style="padding:10px;" title="查询窗口" iconCls="icon-search" collapsible="true" closable="false">
<table id="searchTable">
<tr>
<td>礼品卡:</td>
<td>
<input id="searchGiftId" name="searchGiftId" style="width:110px;" />
</td>
<td>&nbsp;</td>
<td>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
</td>
</tr>
</table>
</div>
<!-- 数据显示table -->
<div id = "tablePanel" class="easyui-panel" style="padding:1px;top:300px;" title="礼品卡统计列表" iconCls="icon-list" collapsible="true" closable="false">
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
</div>
<script type="text/javascript">
//初始化界面
$(function(){
var userBusinessList=null;
var userdepot=null;
initGift();
initTableData();
ininPager();
});
//初始化-礼品卡
function initGift(){
$('#searchGiftId').combobox({
url: "<%=path %>/depot/findGiftByType.action?type=1",
valueField:'id',
textField:'name'
});
//当会员卡号长度超过10位后自动点击下拉框用于兼容刷卡器
$("#searchGiftId").next().find("input").off("keyup").on("keyup",function(){
var self = this;
if($(this).val().length === 10){
setTimeout(function(){
$(".combo-panel .combobox-item-selected").click();
search();
},500);
}
});
}
//初始化表格数据
function initTableData(){
$('#tableData').datagrid({
height:heightInfo,
nowrap: false,
rownumbers: true,
//动画效果
animate:false,
//选中单行
singleSelect : true,
pagination: true,
//交替出现背景
striped : true,
pageSize: 10,
pageList: [10,50,100],
columns:[[
{ title: '名称',field: 'MaterialName',width:60},
{ title: '型号',field: 'MaterialModel',width:80},
{ title: '规格',field: 'MaterialStandard',width:80},
{ title: '颜色',field: 'MaterialColor',width:80},
{ title: '单位',field: 'MaterialUnit',width:80},
{ title: '结存数量',field: 'thisSum',width:80}
]],
onLoadError:function() {
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化键盘enter事件
$(document).keydown(function(event) {
//兼容 IE和firefox 事件
var e = window.event || event;
var k = e.keyCode||e.which||e.charCode;
//兼容 IE,firefox 兼容
var obj = e.srcElement ? e.srcElement : e.target;
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
if(k == "13"&&(obj.id=="Type"||obj.id=="Name")) {
$("#savePerson").click();
}
//搜索按钮添加快捷键
if(k == "13"&&(obj.id=="searchType")) {
$("#searchBtn").click();
}
});
//分页信息处理
function ininPager() {
try {
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
pager.pagination({
onSelectPage:function(pageNum, pageSize)
{
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh',
{
pageNumber:pageNum,
pageSize:pageSize
});
showPersonDetails(pageNum,pageSize);
}
});
}
catch (e)
{
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
}
}
//搜索处理
function search() {
showPersonDetails(1,initPageSize);
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
opts.pageNumber = 1;
opts.pageSize = initPageSize;
pager.pagination('refresh', {
pageNumber:1,
pageSize:initPageSize
});
}
$("#searchBtn").unbind().bind({
click:function() {
var giftId = $('#searchGiftId').combobox('getValue'); //礼品卡Id
if(giftId) {
search();
}
else {
$.messager.alert('查询提示','请选择一张礼品卡!','warning');
}
}
});
function showPersonDetails(pageNo,pageSize) {
var searchGiftId = $("#searchGiftId").combobox("getValue");
$.ajax({
type:"post",
url: "<%=path %>/depotHead/findGiftReport.action",
dataType: "json",
data: ({
ProjectId: searchGiftId
}),
success: function (res) {
var HeadIds = res.HeadIds;
if(HeadIds) {
//获取排序后的产品ID
$.ajax({
type:"post",
url: "<%=path %>/material/findByOrder.action",
dataType: "json",
success: function (resNew) {
var MIds = resNew.mIds;
if(MIds) {
$.ajax({
type:"get",
url: "<%=path %>/depotItem/findGiftByAll.action",
dataType: "json",
data: ({
pageNo:pageNo,
pageSize:pageSize,
ProjectId: searchGiftId,
HeadIds: HeadIds,
MaterialIds: MIds
}),
success: function (data) {
$("#tableData").datagrid('loadData',data);
},
//此处添加错误处理
error:function() {
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
return;
}
});
}
else {
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
}
},
//此处添加错误处理
error:function() {
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
return;
}
});
}
else {
$.messager.alert('查询提示','该礼品卡无数据!','warning');
}
},
//此处添加错误处理
error:function() {
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
return;
}
});
}
</script>
</body>
</html>