using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QMAPP.Common.Web.Controllers;
using QMFrameWork.WebUI.Attribute;
using QMAPP.FJC.Web.Models.FIS;
using QMFrameWork.Data;
using QMAPP.FJC.Entity.FIS;
using QMAPP.ServicesAgent;
using QMAPP.Entity;
using QMFrameWork.WebUI.DataSource;
using QMFrameWork.Common.Serialization;
using System.Data;
using QMAPP.Common.Web.Models;
using QMAPP.FJC.Entity.Basic;
using QMAPP.MD.Entity;
using QMAPP.FJC.Entity;
using QMAPP.FJC.BLL.FIS;
using QMAPP.FJC.Entity.FileCopy.FIS;
namespace QMAPP.FJC.Web.Controllers
{
///
/// 计划管理操作记录
/// 作 者:周晓东
/// 时 间:2018年03月22日
///
public class OrderPlanTraceController : QController
{
#region 获取信息
///
/// 加载列表
///
/// 结果
[HandleException]
public ActionResult List(bool? callback)
{
OrderPlanTraceModel seachModel = new OrderPlanTraceModel();
string order_type = Request["ORDER_TYPE"];
seachModel.PLANTIMESTART = DateTime.Now.Date.AddDays(-10).ToString("yyyy-MM-dd HH:mm:ss");
seachModel.PLANTIMEEND = DateTime.Now.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss");
//seachModel.ImmediateSearch = false;
seachModel.ORDER_TYPE = order_type;
if (callback == true)
TryGetSelectBuffer(out seachModel);
seachModel.rownumbers = false;
seachModel.url = "/OrderPlanTrace/GetList";
return View("OrderPlanTraceList", seachModel);
}
#endregion
#region 获取列表
///
/// 获取列表
///
/// 是否回调
/// 列表
[HandleException]
public ActionResult GetList(bool? callBack)
{
OrderPlanTraceModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
OrderPlanTrace condition = null;
DataResult pageResult = new DataResult();
try
{
//获取查询对象
seachModel = GetModel();
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer(seachModel);
}
#endregion
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel(seachModel);
pageResult = wcfAgent.InvokeServiceFunction>("OrderPlanBLL_GetTraceList", condition, page);
if (pageResult.IsSuccess == false)
{
SetMessage(pageResult.Msg);
return List(true);
}
DateGridResult result = new DateGridResult();
result.Total = pageResult.Result.RecordCount;
result.Rows = JsonConvertHelper.GetDeserialize>(pageResult.Result.Result.ToString());
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 导出excel
///
/// 导出excel
///
/// 结果
[HttpPost]
public ActionResult ExportExcel()
{
OrderPlanTraceModel seachModel = null;
OrderPlanTrace condition = null;
DataTable exportDt = new DataTable();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
//获取查询对象
seachModel = GetModel();
condition = CopyToModel(seachModel);
condition.PIDList = Request.Form["selectKey"];
//获取数据
//exportDt = wcfAgent.InvokeServiceFunction("OrderPlanBLL_GetExportDataTrace", condition);
exportDt = new OrderPlanBLL().GetExportDataTrace(condition);
//导出
QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool();
return efTool.GetExcelFileResult("OrderPlanTraceExp", "计划操作记录.xlsx", exportDt);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}