using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using QMAPP.FJC.Entity.SendPlan; using QMAPP.FJC.Web.Models.SendPlanManage; using QMFrameWork.WebUI.Attribute; using QMAPP.Common.Web.Controllers; using QMAPP.KB.Entity; using QMFrameWork.Data; using QMAPP.ServicesAgent; using QMFrameWork.WebUI.DataSource; using QMFrameWork.Common.Serialization; using System.Data; namespace QMAPP.FJC.Web.Controllers { /// /// 模块编号:M8-2 /// 作 用:发车统计分析控制层 /// 作 者:王丹丹 /// 编写日期:2015年06月26日 /// public class SendStatisticsController : QController { #region 初始化 /// /// 初始化 /// /// 结果 [HandleException] public ActionResult Init() { SendStatisticsModel seachModel = new SendStatisticsModel(); return View("SendStatisticsList", seachModel); } #endregion #region 获取列表 /// /// 加载列表 /// /// 结果 [HandleException] public ActionResult List() { SendStatisticsModel seachModel = null; DataResult> listResult = new DataResult>(); DataPage page = new DataPage(); ServiceAgent wcfAgent = this.GetServiceAgent(); SendPlanInfo condition = null; try { //获取查询对象 seachModel = GetModel(); condition = CopyToModel(seachModel); #region wcf服务统一接口 listResult = wcfAgent.InvokeServiceFunction>>(QMAPP.ServicesAgent.B9IPCService.SendPlanInfoBLL_GetSendStatisticsList.ToString(), condition); #endregion if (listResult.IsSuccess == false) { SetMessage(listResult.Msg); return View("SendStatisticsList", seachModel); } object[] arr = new object[listResult.Result.Count]; for (int i = 0; i < listResult.Result.Count; i++) { arr.SetValue( new { PeiZhi = listResult.Result[i].VERSION + "-" + listResult.Result[i].COLORCODE, Count = listResult.Result[i].Counts }, i ); } seachModel.arr = JsonConvertHelper.GetSerializes(arr); if (listResult.Result.Count == 0) { SetMessage("未查到相关数据!"); }  return View("SendStatisticsList", seachModel);   } catch (Exception ex) { throw ex; } } #endregion #region 导出excel /// /// 导出excel /// /// 结果 [HttpPost] public ActionResult ExportExcel() { SendStatisticsModel seachModel = null; SendPlanInfo condition = null; ServiceAgent wcfAgent = this.GetServiceAgent(); DataResult result = new DataResult(); try { //获取查询对象 seachModel = GetModel(); condition = CopyToModel(seachModel); //获取数据 result = wcfAgent.InvokeServiceFunction>(QMAPP.ServicesAgent.B9IPCService.SendPlanInfoBLL_GetSendStatisticsExportData.ToString(), condition); //导出 QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool(); return efTool.GetExcelFileResult("SendStatisticsExp", "统计分析表.xlsx", result.Result); } catch (Exception ex) { throw ex; } } #endregion } }