天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

981 lines
33 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QMAPP.MESReport.Web.Models.LineQTY;
using QMAPP.Common.Web.Controllers;
using QMFrameWork.WebUI.Attribute;
using QMFrameWork.Data;
using QMAPP.MD.Entity;
using QMAPP.Entity;
using QMAPP.ServicesAgent;
using QMFrameWork.WebUI.DataSource;
using QMFrameWork.Common.Serialization;
using QMAPP.MESReport.Entity.LineQTY;
using System.Collections;
using System.Reflection;
using QMFrameWork.ServiceInterface;
using System.Data.SqlClient;
using System.Data;
using System.Text;
using QMAPP.Common.Web.Util;
using QMFrameWork.WebUI.QMEChart;
using QMFrameWork.WebUI.QMEChart.Data;
using QMAPP.MESReport.Web.Models;
using QMAPP.Common.Web.Controllers;
using QMAPP.MESReport.BLL.LineQTY;
using QMFrameWork.Common.ExcelOperation;
using QMFrameWork.Log;
using ExcelOperationHelper = QMAPP.MESReport.Web.Common.ExcelOperationHelper;
namespace QMAPP.MESReport.Web.Controllers
{
/// <summary>
/// 班次对比分析 2
/// 于子清
/// 2017-10-10
/// </summary>
public class LineShiftQTYCountController : QController
{
public string EmptyItemTitle = " ";
#region 获取信息
/// <summary>
/// 班次对比
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult QTYTrendList(bool? callback)
{
LineQtyConditionModel seachModel = new LineQtyConditionModel();
seachModel.START_DATE = DateTime.Now.Date.AddDays(-30).ToString("yyyy-MM-dd HH:mm:ss");
seachModel.END_DATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
return View(seachModel);
}
/// <summary>
/// 班次趋势
/// </summary>
/// <param name="callback"></param>
/// <returns></returns>
[HandleException]
public ActionResult QTYQuShi(bool? callback)
{
LineQtyConditionModel seachModel = new LineQtyConditionModel();
seachModel.START_DATE = DateTime.Now.Date.AddDays(-30).ToString("yyyy-MM-dd HH:mm:ss");
seachModel.END_DATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
return View(seachModel);
}
#endregion
#region /////////////////////////////////////////////
//public ActionResult GetTrendData(bool? callBack)
//{
// LineDWQTYModel seachModel = null;
// DataPage page = null;
// ServiceAgent wcfAgent = this.GetServiceAgent();
// LineDayQTYCount condition = null;
// DataResult<DataPage> pageResult = new DataResult<DataPage>();
// try
// {
// //获取查询对象
// seachModel = GetModel<LineDWQTYModel>();
// #region 获取缓存值
// if (callBack != null)
// {
// TryGetSelectBuffer<LineDWQTYModel>(out seachModel);
// }
// else
// {
// //保存搜索条件
// SetSelectBuffer<LineDWQTYModel>(seachModel);
// }
// #endregion
// //获取前台分页设置信息
// page = this.GetDataPage(seachModel);
// condition = CopyToModel<LineDayQTYCount, LineDWQTYModel>(seachModel);
// #region wcf服务统一接口
// //page = wcfAgent.InvokeServiceFunction<DataPage>("ProductBLL_GetMaterialDetail", condition, page);
// pageResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>("LineShiftQTYCountBLL_GetEquQTYByShift", condition, page);
// if (pageResult.IsSuccess == false)
// {
// SetMessage(pageResult.Msg);
// return QTYTrendList(true);
// }
// DateGridResult<LineDayQTYCount> result = new DateGridResult<LineDayQTYCount>();
// result.Total = pageResult.Result.RecordCount;
// List<LineDayQTYCount> nli = JsonConvertHelper.GetDeserialize<List<LineDayQTYCount>>(pageResult.Result.Result.ToString());
// result.Rows = nli;
// #endregion
// return Content(result.GetJsonSource());
// }
// catch (Exception ex)
// {
// throw ex;
// }
//}
#endregion
/// <summary>
/// 异步刷新TABLE
/// </summary>
/// <param name="pageIndex"></param>
/// <returns></returns>
public ActionResult GetTableTrend(string WORKCENTER_CODE, string EQUIPMENT_CODE, string SHIFT_CODE, string START_DATE, string END_DATE)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
LineDayQTYCount condition = new LineDayQTYCount();
condition.WORKCENTER_CODE = WORKCENTER_CODE;
condition.EQUIPMENT_CODE = EQUIPMENT_CODE;
condition.SHIFT_CODE = SHIFT_CODE;
condition.START_DATE = START_DATE;
condition.END_DATE = END_DATE;
List<LineDayQTYCount> nli = new List<LineDayQTYCount>();
try
{
#region wcf服务统一接口
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<LineDayQTYCount>>>("LineShiftQTYCountBLL_GetEquQTYByShift", condition);
nli = dataResult.Result;
#endregion
}
catch (Exception ex)
{
throw ex;
}
string sss = GetHTMLStrTrend(nli, WORKCENTER_CODE);
return Json(sss);
}
/// <summary>
/// 拼接字符串
/// </summary>
/// <returns></returns>
public string GetHTMLStrTrend(List<LineDayQTYCount> nli, string WORKCENTER_CODE)
{
StringBuilder html = new StringBuilder();
if (nli == null || nli.Count == 0)
{
return "没有数据";
}
var workcenter = "";
if (!string.IsNullOrEmpty(WORKCENTER_CODE))
{
if (WORKCENTER_CODE == "INJECT")
{
workcenter = "注塑";
}
if (WORKCENTER_CODE == "BORADPASSY")
{
workcenter = "门板";
}
if (WORKCENTER_CODE == "BORAIPASSY")
{
workcenter = "仪表板";
}
}
Dictionary<string, int> tdSum = new Dictionary<string, int>();
List<string> tdList = nli.Select(o => o.EQUIPMENT_NAME).Distinct().OrderBy(x=> x.ToString() ).ToList<string>();
List<string> trList = nli.Select(o => o.SHIFT_NAME).Distinct().OrderByDescending(o => o.ToString()).ToList<string>();
tdList.Add("合计");
//拼接表头
html.Append("<tr><td >" + workcenter + "</td>");
foreach (var std in tdList)
{
if (std == "合计")
{
html.AppendFormat("<td style='background-color:#ECF5FF'>{0}</td>", std);
}
else
{
html.AppendFormat("<td>{0}</td>", std);
}
tdSum[std] = 0;
}
html.Append("</tr>");
//拼接表中
foreach (var str in trList)
{
html.Append("<tr>");
html.Append("<td >" + str + "</td>");
//每行的合计
int trCountValue = 0;
foreach (var std in tdList)
{
if (std == "合计")
{
html.AppendFormat("<td style='background-color:#ECF5FF'>{0}</td>", trCountValue);
tdSum[std] += trCountValue;
}
else
{
var no = nli.FirstOrDefault(o => o.SHIFT_NAME == str && o.EQUIPMENT_NAME == std);
if (no!=null)
{
html.AppendFormat("<td>{0}</td>", no.OK_QTY);
tdSum[std] += Int32.Parse(no.OK_QTY);
trCountValue += Int32.Parse(no.OK_QTY);
}
}
}
html.Append("</tr>");
}
//拼接表尾
html.Append("<tr style='background-color:#ECF5FF'>");
html.Append("<td >合计</td>");
foreach (var std in tdList)
{
html.AppendFormat("<td>{0}</td>", tdSum[std]);
}
html.Append("</tr>");
return html.ToString();
}
/// <summary>
/// 班次对比分析
/// </summary>
/// <returns>处理结果</returns>
[HandleException]
public ActionResult GetEchartDataLine1(string name)
{
#region 源数据定义
LineQtyConditionModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
LineDayQTYCount condition = null;
List<LineDayQTYCount> nli = new List<LineDayQTYCount>();
try
{
//获取查询对象
seachModel = GetModel<LineQtyConditionModel>();
if (string.IsNullOrEmpty(seachModel.START_DATE) || string.IsNullOrEmpty(seachModel.END_DATE))
{
//return Content(null);
}
else
{
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<LineDayQTYCount, LineQtyConditionModel>(seachModel);
#region wcf服务统一接口
var dataResult =
wcfAgent.InvokeServiceFunction<DataResult<List<LineDayQTYCount>>>(
"LineShiftQTYCountBLL_GetEquQTYByShift", condition);
nli = dataResult.Result;
#endregion
}
//return Content(setOption1(nli));
}
catch (Exception ex)
{
throw ex;
}
//生成数据
List<TestEChartModel> dataList = new List<TestEChartModel>();
if (nli != null)
{
foreach (LineDayQTYCount item in nli)
{
dataList.Add(new TestEChartModel() { Week = item.EQUIPMENT_NAME, TypeValue = item.SHIFT_NAME, Value = item.OK_QTY });
}
}
#endregion
#region 设置图表(必选)
//折线图的类型
QMEChartLine chartLine = new QMEChartLine() { LineType = "line1" };
//设置源数据列表
chartLine.DataList = dataList;
//标题设置
chartLine.Title.Text = "班次对比分析";
chartLine.Title.Subtext = "数量";
//XAxis横坐标轴设置
chartLine.HaveXAxis = true;
chartLine.XAxisField = "Week";
//YAxis纵坐标轴设置
chartLine.HaveYAxis = true;
chartLine.YAxis.Type = "value";
//设置Y轴显示格式。
chartLine.YAxis.AxisLabel.Formatter = "{value} 个";
//设置分类
chartLine.LegendField = "TypeValue";
//转换数据格式,用于生成图表的值字段
chartLine.ValueField = "Value";
chartLine.Series = QMEChartHelper.CovertDataToSeries(chartLine);
//是否显示图例
chartLine.HaveLegend = true;
#endregion
#region 设置图表(可选)
//是否生成Tooltip提示窗口
chartLine.HaveTooltip = true;
//是否存在工具栏
chartLine.HaveToolBox = false;
//自定义辅助线
QMECMarkLine ml = new QMECMarkLine()
{
Data = new List<QMECPoint>() { new QMECPoint { Type = "average", Name = "平均值" } }
};
//设置辅助点
QMECMarkPoint mp = new QMECMarkPoint() { Data = new List<QMECPoint>() { new QMECPoint() { Type = "max", Name = "最大值" }, new QMECPoint() { Type = "min", Name = "最小值" } } };
foreach (QMECSerie ser in chartLine.Series)
{
ser.MarkLine = ml;
ser.MarkPoint = mp;
}
#endregion
return Content(QMEChartHelper.QMECHelper<QMEChartLine>(chartLine));
}
public string setOption1(List<LineDayQTYCount> nli)
{
#region 源数据定义
string aqty = "", bqty = "", riqi = "", rdou = "", adou = "", bdou = "";
bool afirst = true;
bool bfirst = true;
bool rfirst = true;
foreach (LineDayQTYCount item in nli)
{
//jihua=生成数量QTY,wancheng=返修数量COMPLETE_QTY。 借用
if (item.SHIFT_CODE == "A")
{
aqty += adou + "'" + item.OK_QTY + "'";
if (afirst)
{
afirst = false;
adou = ",";
}
}
if (item.SHIFT_CODE == "B")
{
bqty += bdou + "'" + item.OK_QTY + "'";
if (bfirst)
{
bfirst = false;
bdou = ",";
}
}
//double fenmu = 1;
//if (!string.IsNullOrEmpty(item.COMPLETE_QTY) && item.COMPLETE_QTY != "0")
//{
// fenmu = Convert.ToDouble(item.COMPLETE_QTY);
//}
//double fenzi = 0;
//if (!string.IsNullOrEmpty(item.QTY))
//{
// fenzi = Convert.ToDouble(item.QTY);
//}
//wclv += dou + "'" + (fenzi / fenmu * 100).ToString("0") + "'";
riqi += rdou + "'" + item.STATIS_DATE + "'";
if (rfirst)
{
rfirst = false;
rdou = ",";
}
}
#region 11111
string strOption = @"{
title: {
text: '',
subtext: ''
},
tooltip: {
trigger: 'axis'
},
legend: {
data:['','']
},
toolbox: {
show: true,
feature: {
dataZoom: {
yAxisIndex: 'none'
},
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
restore: {},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: [" + riqi + @"]
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value} '
}
},
series: [
{
name:'',
type:'line',
data:[" + aqty + @"],
markPoint: {
data: [
{type: 'max', name: ''},
{type: 'min', name: ''}
]
},
markLine: {
data: [
{type: 'average', name: ''}
]
}
},
{
name:'',
type:'line',
data:data:[" + bqty + @"],
markPoint: {
data: [
{type: 'max', name: ''},
{type: 'min', name: ''}
]
},
markLine: {
data: [
{type: 'average', name: ''},
[{
symbol: 'none',
x: '90%',
yAxis: 'max'
}, {
symbol: 'circle',
label: {
normal: {
position: 'start',
formatter: ''
}
},
type: 'max',
name: ''
}]
]
}
}
]
}";
#endregion
#region 222222222
var strOption1 = @"{
title: {
text: '',
subtext: ''
},
tooltip: {
trigger: 'axis'
},
legend: {
data:['','']
},
toolbox: {
show: true,
feature: {
dataZoom: {
yAxisIndex: 'none'
},
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
restore: {},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
axisLabel : { //坐标轴刻度标签的相关设置。
interval:'auto',
rotate:30
},
boundaryGap: false,
data: ['','','','','','','']
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value} °C'
}
},
series: [
{
name:'',
type:'line',
data:[11, 11, 15, 13, 12, 13, 10],
markPoint: {
data: [
{type: 'max', name: ''},
{type: 'min', name: ''}
]
},
markLine: {
data: [
{type: 'average', name: ''}
]
}
},
{
name:'',
type:'line',
data:[1, -2, 2, 5, 3, 2, 0],
markPoint: {
data: [
{name: '', value: -2, xAxis: 1, yAxis: -1.5}
]
},
markLine: {
data: [
{type: 'average', name: ''},
[{
symbol: 'none',
x: '90%',
yAxis: 'max'
}, {
symbol: 'circle',
label: {
normal: {
position: 'start',
formatter: ''
}
},
type: 'max',
name: ''
}]
]
}
}
]
}";
#endregion
#endregion
return strOption1;
}
/// <summary>
/// 异步刷新TABLE
/// </summary>
/// <param name="pageIndex"></param>
/// <returns></returns>
public ActionResult GetTable(string WORKCENTER_CODE, string EQUIPMENT_CODE, string SHIFT_CODE, string START_DATE, string END_DATE)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
LineDayQTYCount condition = new LineDayQTYCount();
condition.WORKCENTER_CODE = WORKCENTER_CODE;
condition.EQUIPMENT_CODE = EQUIPMENT_CODE;
condition.SHIFT_CODE = SHIFT_CODE;
condition.START_DATE = START_DATE;
condition.END_DATE = END_DATE;
List<LineDayQTYCount> nli = new List<LineDayQTYCount>();
try
{
#region wcf服务统一接口
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<LineDayQTYCount>>>("LineShiftQTYCountBLL_GetEquQTYByShift1", condition);
nli = dataResult.Result;
#endregion
}
catch (Exception ex)
{
throw ex;
}
string sss = GetHTMLStr(nli, WORKCENTER_CODE);
return Json(sss);
}
/// <summary>
/// 拼接字符串
/// </summary>
/// <returns></returns>
public string GetHTMLStr(List<LineDayQTYCount> nli, string WORKCENTER_CODE)
{
StringBuilder html = new StringBuilder();
if (nli == null || nli.Count == 0)
{
return "没有数据";
}
var workcenter = "";
if (!string.IsNullOrEmpty(WORKCENTER_CODE))
{
if (WORKCENTER_CODE == "INJECT")
{
workcenter = "注塑";
}
if (WORKCENTER_CODE == "BORADPASSY")
{
workcenter = "门板";
}
if (WORKCENTER_CODE == "BORAIPASSY")
{
workcenter = "仪表板";
}
}
Dictionary<string, int> tdSum = new Dictionary<string, int>();
List<string> tdList = nli.Select(o => o.STATIS_DATE).Distinct().OrderBy(x => x.ToString()).ToList<string>();
List<string> trList = nli.Select(o => o.SHIFT_NAME).Distinct().OrderByDescending(o => o.ToString()).ToList<string>();
tdList.Add("合计");
//拼接表头
html.Append("<tr><td >" + workcenter + "</td>");
foreach (var std in tdList)
{
if (std == "合计")
{
html.AppendFormat("<td style='background-color:#ECF5FF'>{0}</td>", std);
}
else
{
html.AppendFormat("<td>{0}</td>", std);
}
tdSum[std] = 0;
}
html.Append("</tr>");
//拼接表中
foreach (var str in trList)
{
html.Append("<tr>");
html.Append("<td >" + str + "</td>");
//每行的合计
int trCountValue = 0;
foreach (var std in tdList)
{
if (std == "合计")
{
html.AppendFormat("<td style='background-color:#ECF5FF'>{0}</td>", trCountValue);
tdSum[std] += trCountValue;
}
else
{
var no = nli.FirstOrDefault(o => o.SHIFT_NAME == str && o.STATIS_DATE == std);
var qtyNum = "0";
if (no!=null)
{
qtyNum = no.OK_QTY;
}
html.AppendFormat("<td>{0}</td>", qtyNum);
tdSum[std] += Int32.Parse(qtyNum);
trCountValue += Int32.Parse(qtyNum);
}
}
html.Append("</tr>");
}
//拼接表尾
html.Append("<tr style='background-color:#ECF5FF'>");
html.Append("<td >合计</td>");
foreach (var std in tdList)
{
html.AppendFormat("<td>{0}</td>", tdSum[std]);
}
html.Append("</tr>");
return html.ToString();
}
/// <summary>
/// 班次趋势分析
/// </summary>
/// <returns>处理结果</returns>
[HandleException]
public ActionResult GetEchartDataLine2(string name)
{
#region 源数据定义
LineQtyConditionModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
LineDayQTYCount condition = null;
List<LineDayQTYCount> nli = new List<LineDayQTYCount>();
try
{
//获取查询对象
seachModel = GetModel<LineQtyConditionModel>();
if (string.IsNullOrEmpty(seachModel.START_DATE) || string.IsNullOrEmpty(seachModel.END_DATE))
{
//return Content(null);
}
else
{
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<LineDayQTYCount, LineQtyConditionModel>(seachModel);
#region wcf服务统一接口
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<LineDayQTYCount>>>("LineShiftQTYCountBLL_GetEquQTYByShift1", condition);
nli = dataResult.Result;
#endregion
}
//return Content(setOption1(nli));
}
catch (Exception ex)
{
throw ex;
}
#endregion
//生成数据
List<TestEChartModel> dataList = new List<TestEChartModel>();
foreach (LineDayQTYCount item in nli)
{
dataList.Add(new TestEChartModel() { Week = item.STATIS_DATE, TypeValue = item.SHIFT_NAME, Value = item.OK_QTY });
}
#region 设置图表(必选)
//折线图的类型
QMEChartLine chartLine = new QMEChartLine() { LineType = "line1" };
//设置源数据列表
chartLine.DataList = dataList;
//标题设置
chartLine.Title.Text = "班次趋势分析";
chartLine.Title.Subtext = "数量";
//XAxis横坐标轴设置
chartLine.HaveXAxis = true;
chartLine.XAxisField = "Week";
//YAxis纵坐标轴设置
chartLine.HaveYAxis = true;
chartLine.YAxis.Type = "value";
//设置Y轴显示格式。
chartLine.YAxis.AxisLabel.Formatter = "{value} 个";
//设置分类
chartLine.LegendField = "TypeValue";
//转换数据格式,用于生成图表的值字段
chartLine.ValueField = "Value";
chartLine.Series = QMEChartHelper.CovertDataToSeries(chartLine);
//是否显示图例
chartLine.HaveLegend = true;
#endregion
#region 设置图表(可选)
//是否生成Tooltip提示窗口
chartLine.HaveTooltip = true;
//是否存在工具栏
chartLine.HaveToolBox = false;
//自定义辅助线
QMECMarkLine ml = new QMECMarkLine()
{
Data = new List<QMECPoint>() { new QMECPoint { Type = "average", Name = "平均值" } }
};
//设置辅助点
QMECMarkPoint mp = new QMECMarkPoint() { Data = new List<QMECPoint>() { new QMECPoint() { Type = "max", Name = "最大值" }, new QMECPoint() { Type = "min", Name = "最小值" } } };
foreach (QMECSerie ser in chartLine.Series)
{
ser.MarkLine = ml;
ser.MarkPoint = mp;
}
#endregion
return Content(QMEChartHelper.QMECHelper<QMEChartLine>(chartLine));
}
#region 导出班次对比折线图
/// <summary>
/// 导出班次对比折线图
/// </summary>
/// <returns>结果</returns>
[HttpPost]
[HandleException]
public ActionResult ExportBanCi()
{
string imgSend = Request.Form["hiChartImg"];
imgSend = imgSend.Replace(" ", "+");
string[] contents = imgSend.Split(',');
imgSend = contents[1];
byte[] content = Convert.FromBase64String(imgSend);
System.Web.Mvc.FileContentResult result = null;
result = new System.Web.Mvc.FileContentResult(content, "application/png");
result.FileDownloadName = System.Web.HttpUtility.UrlEncode("班次对比折线图.png", System.Text.Encoding.UTF8);
return result;
}
#endregion
#region 导出excel
/// <summary>
/// 导出excel
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult ExportExcel(int Trend)
{
LineQtyConditionModel seachModel = null;
LineDayQTYCount condition = null;
DataTable exportDt = new DataTable();
string selectKey = Request["selectKey"];
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
//获取查询对象
seachModel = GetModel<LineQtyConditionModel>();
condition = CopyToModel<LineDayQTYCount, LineQtyConditionModel>(seachModel);
condition.Trend= Trend;
//获取数据
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<DataTable>>("LineShiftQTYCountBLL_GetExportData", condition);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
exportDt = dataResult.Result;
}
else
{
SetMessage(dataResult.Msg);
return View(true);
}
//根据所选信息进行导出
if (!String.IsNullOrEmpty(selectKey))
{
DataView dv = new DataView(exportDt);
string strWhere = "";
string[] list = selectKey.Split(":".ToCharArray());
foreach (string ID in list)
{
strWhere += " PID='" + ID + "' or";
}
if (strWhere != "")
{
strWhere = strWhere.Remove((strWhere.Length - 2), 2);
}
dv.RowFilter = strWhere;
exportDt = dv.ToTable();
}
//导出
IEExcelHelper ieExcelHelper = new IEExcelHelper();
var sheetInfoName = "QTYQuShiExp";
if (Trend == 0)
{
sheetInfoName = "QTYTrendExp";
}
var sheetInfo = ieExcelHelper.GetMainInfo(sheetInfoName);
var fileName = System.Guid.NewGuid().ToString() + ".xlsx";
ieExcelHelper.ExportExcel(sheetInfo, exportDt, Common.ExcelOperationHelper.GetTempPath() + fileName, true);
return Content(fileName);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo { ErrorInfo = ex, Info = "导出excel", Tag = "班次分析" });
SetMessage("导出excel失败");
return View(true);
}
}
/// <summary>
/// 导出文件
/// </summary>
/// <returns></returns>
public ActionResult ExportFile(int Trend)
{
String filePath = Common.ExcelOperationHelper.GetTempPath();
String fileName = Request["FileName"];
var sheetInfoName = "班次趋势分析.xlsx";
if (Trend == 0)
{
sheetInfoName = "班次对比分析.xlsx";
}
ExcelOperationHelper.FileDownload(Response, filePath + fileName, sheetInfoName);
return Content("");
}
#endregion
}
}