using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using QMFrameWork.WebUI.Attribute; using QMAPP.Common.Web.Controllers; using QMAPP.FJC.Web.Models.SendManage; using QMFrameWork.Data; using QMAPP.ServicesAgent; using QMAPP.KB.Entity; using QMAPP.FJC.Entity.SendManage; using QMFrameWork.Common.Serialization; using QMFrameWork.WebUI.DataSource; using System.Data; using Common.AssemblyUtil; using QMAPP.FJC.Entity.Operation; using QMAPP.FJC.Entity.FileCopy.FIS; namespace QMAPP.FJC.Web.Controllers { public class SendPlanRecordController : QController { /// /// 模块编号: /// 作 用: /// 作 者: /// 编写日期: /// #region 获取列表 [HandleException] public ActionResult List(bool? callBack) { PastCardModel searchmodel = new PastCardModel(); searchmodel.STARTCREATEDATE = DateTime.Now.AddDays(-10).ToString("yyyy-MM-dd"); searchmodel.ENDCREATEDATE = DateTime.Now.ToString("yyyy-MM-dd"); searchmodel.ImmediateSearch = false; if (callBack == true) TryGetSelectBuffer(out searchmodel); searchmodel.rownumbers = true; searchmodel.url = "/SendPlanRecord/GetList"; return View("SendPlanRecordList", searchmodel); } /// /// 获取列表 /// /// 是否回调 /// 列表 [HandleException] public ActionResult GetList(bool? callBack) { PastCardModel searchmodel = null; DataPage page = null; ServiceAgent wcfAgent = this.GetServiceAgent(); PastCard condition = null; DataResult pageResult = new DataResult(); try { searchmodel = GetModel(); if (callBack != null) { TryGetSelectBuffer(out searchmodel); } else { //保存搜索条件 SetSelectBuffer(searchmodel); } page = this.GetDataPage(searchmodel); condition = CopyToModel(searchmodel); #region wcf服务统一接口 pageResult = wcfAgent.InvokeServiceFunction>(QMAPP.ServicesAgent.B9IPCService.SendPlanRecordBLL_GetList.ToString(), condition, page); DateGridResult result = new DateGridResult(); result.Total = pageResult.Result.RecordCount; result.Rows = JsonConvertHelper.GetDeserialize>(pageResult.Result.Result.ToString()); #endregion return Content(result.GetJsonSource()); } catch (Exception ex) { throw ex; } } #endregion #region 获取列表 /// /// 获取详细列表 /// /// 是否回调 /// 列表 [HandleException] public ActionResult DetailedInformation(bool? callBack) { PastCardModel seachModel = new PastCardModel(); TryGetSelectBuffer(out seachModel); ServiceAgent wcfAgent = this.GetServiceAgent(); PastCard condition = new PastCard(); DataResult dataResult = new DataResult(); List pastcarddetail=new List(); try { //获取查询对象 seachModel = GetModel(); #region 获取缓存值 if (callBack != null) { TryGetSelectBuffer(out seachModel); } else { //保存搜索条件 SetSelectBuffer(seachModel); } #endregion condition = CopyToModel(seachModel); #region wcf服务统一接口,获取详细信息 dataResult = wcfAgent.InvokeServiceFunction>(QMAPP.ServicesAgent.B9IPCService.SendPlanRecordBLL_GetItem.ToString(), condition); pastcarddetail = EntityFactory.GetEntities(dataResult.Result); foreach (PastCardDetail li in pastcarddetail) { li.ONLINEDATE = li.M100_ONLINEDATE.ToString("yyyy-MM-dd HH:mm:ss"); } #endregion return Json(new { Msg = dataResult.Msg, IsSuccess = dataResult.IsSuccess.ToString(), Result = pastcarddetail }); } catch (Exception ex) { throw ex; } } #endregion #region 导出excel /// /// 导出excel /// /// 结果 [HttpPost] public ActionResult ExportExcel() { PastCardModel seachModel = null; PastCard condition = null; ServiceAgent wcfAgent = this.GetServiceAgent(); DataResult result = new DataResult(); string selectKey = Request.Form["selectKey"]; try { //获取查询对象 seachModel = GetModel(); condition = CopyToModel(seachModel); //获取数据 result = wcfAgent.InvokeServiceFunction>(QMAPP.ServicesAgent.B9IPCService.SendPlanRecordBLL_GetExportData.ToString(), condition); //根据所选信息进行导出 if (!String.IsNullOrEmpty(selectKey)) { DataView dv = new DataView(result.Result); string strWhere = ""; string[] list = selectKey.Split(":".ToCharArray()); foreach (string ID in list) { strWhere += " PASTECARDNO='" + ID + "' or"; } if (strWhere != "") { strWhere = strWhere.Remove((strWhere.Length - 2), 2); } dv.RowFilter = strWhere; result.Result = dv.ToTable(); } //导出 QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool(); return efTool.GetExcelFileResult("SendPlanRecordExp", "SendPlanRecordExp.xlsx", result.Result); } catch (Exception ex) { throw ex; } } #endregion #region 导出详细信息excel /// /// 导出excel /// /// 结果 [HttpPost] public ActionResult ExportExcel2() { PastCardDetailModel seachModel = null; PastCardDetail condition = null; DataTable exportDt = new DataTable(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { //获取查询对象 seachModel = GetModel(); condition = CopyToModel(seachModel); condition.PASTECARDNO_List = "('" + Request.Form["selectKey"].Replace(";", "','") + "')"; //获取数据 exportDt = wcfAgent.InvokeServiceFunction("SendPlanRecordBLL_GetExportData2", condition); //导出 QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool(); return efTool.GetExcelFileResult("PastCardDetailExp", "PastCardDetailExp.xlsx", exportDt); } catch (Exception ex) { throw ex; } } #endregion #region 删除 /// /// 删除 /// /// 结果 [HttpPost] [HandleException] public ActionResult Delete(PastCardModel model) { string selectKey = Request.Form["selectKey"]; ServiceAgent wcfAgent = this.GetServiceAgent(); DataResult result = new DataResult(); try { result = wcfAgent.InvokeServiceFunction>("SendPlanRecordBLL_Delete", selectKey); if (result.IsSuccess == false) { SetMessage(result.Msg); return List(true); } SetMessage(AppResource.DeleteMessage); return List(true); } catch (Exception ex) { throw ex; } } #endregion } }