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

1013 lines
34 KiB

using System;
using System.Collections.Generic;
using System.Web.Mvc;
using QMAPP.Common.Web.Controllers;
using QMAPP.Entity;
using QMAPP.FJC.Entity;
using QMAPP.FJC.Entity.WarnManage;
using QMAPP.FJC.Web.Models.ProduceManage;
using QMAPP.FJC.Web.Models.WarnManage;
using QMAPP.ServicesAgent;
using QMFrameWork.Common.Serialization;
using QMFrameWork.Data;
using QMFrameWork.WebUI.Attribute;
using QMFrameWork.WebUI.DataSource;
namespace QMAPP.FJC.Web.Controllers
{
///</summary>
/// 模块编号:M6-3自动报警维护
/// 作 用:自动报警维护
/// 作 者:张敬贺
/// 编写日期:2015年06月19日
/// </summary>
public class WarnManageController : QController
{
#region 报警信息维护
#region 报警信息获取列表
/// <summary>
/// 加载列表
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult WarnInfoList(bool? callBack)
{
WarnInfoModel seachModel = new WarnInfoModel();
seachModel.STARTCREATEDATE = DateTime.Now.Date.AddDays(-10).ToString("yyyy-MM-dd HH:mm:ss");
seachModel.ENDCREATEDATE = DateTime.Now.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss");
seachModel.ImmediateSearch = false;
if (callBack == true)
TryGetSelectBuffer<WarnInfoModel>(out seachModel);
seachModel.rownumbers = false;
seachModel.url = "/WarnManage/GetWarnInfoList";
return View("WarnInfoList", seachModel);
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>列表</returns>
[HandleException]
public ActionResult GetWarnInfoList(bool? callBack)
{
WarnInfoModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
WarnInfo condition = null;
try
{
//获取查询对象
seachModel = GetModel<WarnInfoModel>();
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer<WarnInfoModel>(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer<WarnInfoModel>(seachModel);
}
#endregion
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<WarnInfo, WarnInfoModel>(seachModel);
#region wcf服务统一接口
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_GetWarnInfoList.ToString(), condition, page);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
page = dataResult.Result;
}
DateGridResult<WarnInfo> result = new DateGridResult<WarnInfo>();
result.Total = page.RecordCount;
result.Rows = JsonConvertHelper.GetDeserialize<List<WarnInfo>>(page.Result.ToString());
#endregion
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 报警信息编辑
/// <summary>
/// 编辑载入
/// </summary>
/// <returns>处理结果</returns>
[HandleException]
public ActionResult WarnInfoEdit()
{
WarnInfoModel model = new WarnInfoModel();
string ID = Request.Params["PID"];
WarnInfo Entity = new WarnInfo();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(ID) == false)
{
//修改获取原数据
Entity.PID = ID;
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<WarnInfo>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnInfoGet.ToString(), Entity);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
Entity = dataResult.Result;
}
else
{
SetMessage(dataResult.Msg);
return View("WarnInfoEdit", Entity);
}
model = CopyToModel<WarnInfoModel, WarnInfo>(Entity);
}
return View("WarnInfoEdit", model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 报警信息保存
/// <summary>
/// 保存
/// </summary>
/// <param name="model"></param>
/// <returns>处理结果</returns>
[HttpPost]
[HandleException]
[ValidateInput(false)]
public ActionResult WarnInfoSave(WarnInfoModel saveModel)
{
WarnInfo Entity = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
Entity = CopyToModel<WarnInfo, WarnInfoModel>(saveModel);
//web段调用为手动创建
Entity.CREATETYPE = QMAPP.FJC.Entity.EnumGeter.CREATETYPE.people.GetHashCode().ToString();
if (string.IsNullOrEmpty(Entity.PID) == true)
{
//新增
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnInfoInsert.ToString(), Entity);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
return View("WarnInfoEdit", saveModel);
}
}
else
{
//修改
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<int>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnInfoUpdate.ToString(), Entity);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
return View("WarnInfoEdit", saveModel);
}
}
return this.GetJsViewResult(string.Format("parent.List(1);parent.showTitle('{0}');parent.closeAppWindow1();", AppResource.SaveMessge));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 报警信息删除
/// <summary>
/// 删除
/// </summary>
/// <returns>结果</returns>
[HttpPost]
[HandleException]
public ActionResult WarnInfoDelete(ProducePlanModel saveMode)
{
string selectKey = Request.Form["selectKey"];
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnInfoDelete.ToString(), selectKey);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
}
else
{
SetMessage(AppResource.DeleteMessage);
}
return WarnInfoList(true);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#endregion
#region 报警类别维护
#region 报警类别获取列表
/// <summary>
/// 加载列表
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult WarnTypeList(bool? callBack)
{
WarnTypeModel seachModel = new WarnTypeModel();
if (callBack == true)
TryGetSelectBuffer<WarnTypeModel>(out seachModel);
seachModel.rownumbers = false;
seachModel.url = "/WarnManage/GetWarnTypeList";
return View("WarnTypeList", seachModel);
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>列表</returns>
[HandleException]
public ActionResult GetWarnTypeList(bool? callBack)
{
WarnTypeModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
WarnType condition = null;
try
{
//获取查询对象
seachModel = GetModel<WarnTypeModel>();
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer<WarnTypeModel>(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer<WarnTypeModel>(seachModel);
}
#endregion
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<WarnType, WarnTypeModel>(seachModel);
#region 用于报警通知人关联报警信息查询使用
string WarnInformerId = Request["WarnInformerId"];
if (!string.IsNullOrEmpty(WarnInformerId))
{
condition.WarnInformerId = WarnInformerId;
}
#endregion
#region wcf服务统一接口
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_GetWarnTypeList.ToString(), condition, page);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
page = dataResult.Result;
}
DateGridResult<WarnType> result = new DateGridResult<WarnType>();
result.Total = page.RecordCount;
result.Rows = JsonConvertHelper.GetDeserialize<List<WarnType>>(page.Result.ToString());
#endregion
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 报警类别编辑
/// <summary>
/// 编辑载入
/// </summary>
/// <returns>处理结果</returns>
[HandleException]
public ActionResult WarnTypeEdit()
{
WarnTypeModel model = new WarnTypeModel();
string ID = Request.Params["PID"];
WarnType Entity = new WarnType();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(ID) == false)
{
//修改获取原数据
Entity.PID = ID;
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<WarnType>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnTypeGet.ToString(), Entity);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
Entity = dataResult.Result;
}
else
{
SetMessage(dataResult.Msg);
return View("WarnTypeEdit", Entity);
}
model = CopyToModel<WarnTypeModel, WarnType>(Entity);
}
return View("WarnTypeEdit", model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 报警类别保存
/// <summary>
/// 保存
/// </summary>
/// <param name="model"></param>
/// <returns>处理结果</returns>
[HttpPost]
[HandleException]
[ValidateInput(false)]
public ActionResult WarnTypeSave(WarnTypeModel saveModel)
{
WarnType Entity = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
Entity = CopyToModel<WarnType, WarnTypeModel>(saveModel);
if (string.IsNullOrEmpty(Entity.PID) == true)
{
//新增
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnTypeInsert.ToString(), Entity);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
return View("WarnTypeEdit", saveModel);
}
}
else
{
//修改
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<int>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnTypeUpdate.ToString(), Entity);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
return View("WarnTypeEdit", saveModel);
}
}
return this.GetJsViewResult(string.Format("parent.List(1);parent.showTitle('{0}');parent.closeAppWindow1();", AppResource.SaveMessge));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 报警类别删除
/// <summary>
/// 删除
/// </summary>
/// <returns>结果</returns>
[HttpPost]
[HandleException]
public ActionResult WarnTypeDelete(WarnTypeModel saveMode)
{
string selectKey = Request.Form["selectKey"];
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnTypeDelete.ToString(), selectKey);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
}
else
{
SetMessage(AppResource.DeleteMessage);
}
return WarnTypeList(true);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#endregion
#region 通知人员维护
#region 通知人员获取列表
/// <summary>
/// 加载列表
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult WarnInformerList(bool? callBack)
{
WarnInformerModel seachModel = new WarnInformerModel();
if (callBack == true)
TryGetSelectBuffer<WarnInformerModel>(out seachModel);
seachModel.rownumbers = false;
seachModel.url = "/WarnManage/GetWarnInformerList";
return View("WarnInformerList", seachModel);
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>列表</returns>
[HandleException]
public ActionResult GetWarnInformerList(bool? callBack)
{
WarnInformerModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
WarnInformer condition = null;
try
{
//获取查询对象
seachModel = GetModel<WarnInformerModel>();
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer<WarnInformerModel>(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer<WarnInformerModel>(seachModel);
}
#endregion
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<WarnInformer, WarnInformerModel>(seachModel);
#region wcf服务统一接口
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_GetWarnInformerList.ToString(), condition, page);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
page = dataResult.Result;
}
DateGridResult<WarnInformer> result = new DateGridResult<WarnInformer>();
result.Total = page.RecordCount;
result.Rows = JsonConvertHelper.GetDeserialize<List<WarnInformer>>(page.Result.ToString());
#endregion
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 通知人员编辑
/// <summary>
/// 编辑载入
/// </summary>
/// <returns>处理结果</returns>
[HandleException]
public ActionResult WarnInformerEdit()
{
WarnInformerModel model = new WarnInformerModel();
string ID = Request.Params["PID"];
WarnInformer Entity = new WarnInformer();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(ID) == false)
{
//修改获取原数据
Entity.PID = ID;
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<WarnInformer>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnInformerGet.ToString(), Entity);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
Entity = dataResult.Result;
}
else
{
SetMessage(dataResult.Msg);
return View("WarnInformerEdit", Entity);
}
model = CopyToModel<WarnInformerModel, WarnInformer>(Entity);
}
return View("WarnInformerEdit", model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 通知人员保存
/// <summary>
/// 保存
/// </summary>
/// <param name="model"></param>
/// <returns>处理结果</returns>
[HttpPost]
[HandleException]
[ValidateInput(false)]
public ActionResult WarnInformerSave(WarnInformerModel saveModel)
{
WarnInformer Entity = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
Entity = CopyToModel<WarnInformer, WarnInformerModel>(saveModel);
//报警类别ID
Entity.WarnTypeIds = Request.Params["WarnTypeIds"];
if (string.IsNullOrEmpty(Entity.PID) == true)
{
//新增
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnInformerInsert.ToString(), Entity);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
return View("WarnInformerEdit", saveModel);
}
}
else
{
//修改
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<int>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnInformerUpdate.ToString(), Entity);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
return View("WarnInformerEdit", saveModel);
}
}
return this.GetJsViewResult(string.Format("parent.List(1);parent.showTitle('{0}');parent.closeAppWindow1();", AppResource.SaveMessge));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 通知人员删除
/// <summary>
/// 删除
/// </summary>
/// <returns>结果</returns>
[HttpPost]
[HandleException]
public ActionResult WarnInformerDelete(WarnInformerModel saveMode)
{
string selectKey = Request.Form["selectKey"];
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnInformerDelete.ToString(), selectKey);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
}
else
{
SetMessage(AppResource.DeleteMessage);
}
return WarnInformerList(true);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 校验运单号并进行绑定
/// <summary>
/// 校验运单号并进行绑定
/// </summary>
[HttpGet]
//public JsonResult CheckTransno(string transno)
//{
// DataResult<WarnType> DataResult = new DataResult<WarnType>();
// #region wcf服务统一接口
//ServiceAgent wcfAgent = this.GetServiceAgent();
//DataResult = wcfAgent.InvokeServiceFunction<DataResult<WarnType>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_GetAllWarnTypeList.ToString(), transno);
// List<object> objlist = new List<object>();
// foreach (var o in DataResult.Result.PalletInfoList)
// {
// objlist.Add(new
// {
// PALLETINFOID = o.PALLETINFOID,
// RFIDCODE = o.RFIDCODE,
// PALLETNO = o.PALLETNO,
// PAINTCODE = o.PAINTCODE,
// WAREHOUSENO = o.WAREHOUSENO
// });
// }
// DataResult.Result.PALLETINFOSTRING = JsonConvertHelper.GetSerializes(objlist);
// #endregion
// return Json(DataResult, JsonRequestBehavior.AllowGet);
//}
#endregion
#endregion
#region 发送报警
#region 发送报警页面加载
/// <summary>
/// 发送报警页面加载
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult WarnIsSendList()
{
WarnInformerModel model = new WarnInformerModel();
string WarnInfoIds = Request.Params["WarnInfoId"];
WarnInformer Entity = new WarnInformer();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
#region 用于报警通发送使用
model.WarnInfoIds = WarnInfoIds;
#endregion
return View("WarnIsSendList", model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 报警发送页面报警通知人信息列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>列表</returns>
[HandleException]
public ActionResult GetWarnInformerListForSend(bool? callBack)
{
WarnInformerModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
WarnInformer condition = null;
try
{
//获取查询对象
seachModel = GetModel<WarnInformerModel>();
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer<WarnInformerModel>(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer<WarnInformerModel>(seachModel);
}
#endregion
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<WarnInformer, WarnInformerModel>(seachModel);
#region 用于报警通发送使用
string WarnInfoIds = Request["WarnInfoIds"];
if (!string.IsNullOrEmpty(WarnInfoIds))
{
condition.WarnInfoIds = WarnInfoIds;
}
#endregion
#region wcf服务统一接口
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_GetWarnInformerListForSend.ToString(), condition, page);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
page = dataResult.Result;
}
DateGridResult<WarnInformer> result = new DateGridResult<WarnInformer>();
result.Total = page.RecordCount;
result.Rows = JsonConvertHelper.GetDeserialize<List<WarnInformer>>(page.Result.ToString());
#endregion
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 发送报警
/// <summary>
/// 发送报警
/// </summary>
/// <param name="model"></param>
/// <returns>处理结果</returns>
[HttpPost]
[HandleException]
[ValidateInput(false)]
public ActionResult WarnIsSend(WarnDetailModel saveModel)
{
WarnDetail condition = new WarnDetail();
saveModel.WarnInformerIds = Request["WarnInformerIds"];
saveModel.WPID = Request["WarnInfoIds"];
ServiceAgent wcfAgent = this.GetServiceAgent();
condition = CopyToModel<WarnDetail, WarnDetailModel>(saveModel);
try
{
//发送报警
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnIsSend.ToString(), condition);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
}
else
{
SetMessage(Resource.WarnSendSeccess);
}
return WarnIsSendList();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#endregion
#region 报警信息详情
#region 报警信息获取列表
/// <summary>
/// 加载列表
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult WarnDetailList(bool? callBack)
{
WarnDetailModel seachModel = new WarnDetailModel();
seachModel.WPID = Request.Params["WarnInfoId"];
if (callBack == true)
TryGetSelectBuffer<WarnDetailModel>(out seachModel);
seachModel.rownumbers = false;
seachModel.url = "/WarnManage/GetWarnDetailList?WarnInfoId=" + seachModel.WPID;
return View("WarnDetailList", seachModel);
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>列表</returns>
[HandleException]
public ActionResult GetWarnDetailList(bool? callBack)
{
WarnDetailModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
WarnDetail condition = null;
try
{
//获取查询对象
seachModel = GetModel<WarnDetailModel>();
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer<WarnDetailModel>(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer<WarnDetailModel>(seachModel);
}
#endregion
//获取前台分页设置信息
page = this.GetDataPage(seachModel);
condition = CopyToModel<WarnDetail, WarnDetailModel>(seachModel);
condition.WPID = Request.Params["WarnInfoId"];
#region wcf服务统一接口
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_GetWarnDetailList.ToString(), condition, page);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
page = dataResult.Result;
}
DateGridResult<WarnDetail> result = new DateGridResult<WarnDetail>();
result.Total = page.RecordCount;
result.Rows = JsonConvertHelper.GetDeserialize<List<WarnDetail>>(page.Result.ToString());
#endregion
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#endregion
#region 关闭报警
/// <summary>
/// 关闭报警
/// </summary>
/// <returns>结果</returns>
[HttpPost]
[HandleException]
public ActionResult WarnIsDone()
{
string selectKey = Request.Form["selectKey"];
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
//新增
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.WarnManage.WarnManageBLL_WarnIsDone.ToString(), selectKey);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (!dataResult.IsSuccess)
{
SetMessage(dataResult.Msg);
}
else
{
SetMessage(Resource.WarnDoneSeccess);
}
return WarnInfoList(true);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}