天津投入产出系统后端
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.
 
 
 
 
 
 

200 lines
7.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QMAPP.Common.Web.Controllers;
using QMAPP.Entity;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.Entity.EM;
using QMAPP.FJC.Entity.Equipment;
using QMAPP.FJC.Web.Models.Basic;
using QMAPP.FJC.Web.Models.EM;
using QMAPP.FJC.Web.Models.Equipment;
using QMAPP.ServicesAgent;
using QMFrameWork.Common.Serialization;
using QMFrameWork.Data;
using QMFrameWork.WebUI.Attribute;
using QMFrameWork.WebUI.DataSource;
namespace QMAPP.FJC.Web.Controllers
{
public class UsageLogController : QController
{
#region 获取列表
/// <summary>
/// 加载列表
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult List(bool? callBack)
{
UsageLogModel seachModel = new UsageLogModel();
seachModel.START_OPERATION_DATE = DateTime.Now.Date.AddDays(-10).ToString("yyyy-MM-dd HH:mm:ss");
seachModel.END_OPERATION_DATE = DateTime.Now.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss");
if (callBack == true)
TryGetSelectBuffer<UsageLogModel>(out seachModel);
seachModel.rownumbers = false;
seachModel.url = "/UsageLog/GetList";
return View("UsageLogList", seachModel);
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>列表</returns>
[HandleException]
public ActionResult GetList(bool? callBack)
{
UsageLogModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
UsageLogEntity condition = null;
DataResult<DataPage> pageResult = new DataResult<DataPage>();
try
{
//获取查询对象
seachModel = GetModel<UsageLogModel>();
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer<UsageLogModel>(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer<UsageLogModel>(seachModel);
}
#endregion
if (string.IsNullOrEmpty(seachModel.START_OPERATION_DATE) || string.IsNullOrEmpty(seachModel.END_OPERATION_DATE))
{
seachModel.START_OPERATION_DATE = DateTime.Now.Date.AddDays(-10).ToString("yyyy-MM-dd HH:mm:ss");
seachModel.END_OPERATION_DATE = DateTime.Now.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss");
}
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<UsageLogEntity, UsageLogModel>(seachModel);
#region wcf服务统一接口
pageResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>("UsageLogBLL_GetList", condition, page);
if (pageResult.IsSuccess == false)
{
SetMessage(pageResult.Msg);
return List(true);
}
DateGridResult<UsageLogEntity> result = new DateGridResult<UsageLogEntity>();
result.Total = pageResult.Result.RecordCount;
result.Rows = JsonConvertHelper.GetDeserialize<List<UsageLogEntity>>(pageResult.Result.Result.ToString());
#endregion
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 统计
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult Count(bool? callBack)
{
UsageLogCountModel seachModel = new UsageLogCountModel();
if (callBack == true)
TryGetSelectBuffer<UsageLogCountModel>(out seachModel);
seachModel.rownumbers = false;
string ids = Request.Params["PID"];
string stime = Request.Params["STARTDATE"];
string etime = Request.Params["ENDDATE"];
string ftime = Request.Params["FLAG_TIME"];
seachModel.url = "/UsageLog/GetCountList?PID=" + ids + "&STARTDATE=" + stime + "&ENDDATE=" + etime + "&FLAG_TIME=" + ftime;
return View("UsageLogCountList", seachModel);
}
/// <summary>
/// 获取统计列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>列表</returns>
[HandleException]
public ActionResult GetCountList(bool? callBack)
{
UsageLogCountModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
UsageLogEntity condition = null;
DataResult<DataPage> pageResult = new DataResult<DataPage>();
try
{
//获取查询对象
seachModel = GetModel<UsageLogCountModel>();
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer<UsageLogCountModel>(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer<UsageLogCountModel>(seachModel);
}
#endregion
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<UsageLogEntity, UsageLogCountModel>(seachModel);
string ids = Request.Params["PID"];
string stime = Request.Params["STARTDATE"];
string etime = Request.Params["ENDDATE"];
string ftime = Request.Params["FLAG_TIME"];
condition.PID = ids;
condition.START_OPERATION_DATE = stime;
condition.END_OPERATION_DATE = etime;
condition.FLAG_TIME = ftime;
#region wcf服务统一接口
pageResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>("UsageLogBLL_GetCountList", condition, page);
if (pageResult.IsSuccess == false)
{
SetMessage(pageResult.Msg);
return List(true);
}
DateGridResult<UsageLogEntity> result = new DateGridResult<UsageLogEntity>();
result.Total = pageResult.Result.RecordCount;
result.Rows = JsonConvertHelper.GetDeserialize<List<UsageLogEntity>>(pageResult.Result.Result.ToString());
#endregion
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取统计标识下拉列表
/// <summary>
/// 获取统计标识下拉列表
/// </summary>
/// <returns></returns>
public ContentResult GetFlagTimeComboxSource()
{
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = new DictController().EmptyItemTitle });
model.Add(new ComboboxItem { ID = "0", Text = "年" });
model.Add(new ComboboxItem { ID = "1", Text = "月" });
model.Add(new ComboboxItem { ID = "2", Text = "日" });
return Content(model.ToString());
}
#endregion
}
}