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.Operation;
using QMFrameWork.Data;
using QMAPP.ServicesAgent;
using QMAPP.FJC.Entity.Operation;
using QMAPP.Entity;
using QMFrameWork.WebUI.DataSource;
using QMFrameWork.Common.Serialization;
using NPOI.SS.UserModel;
namespace QMAPP.FJC.Web.Controllers
{
///
/// 抽检
/// 20180610
///
public class ProductCheckController : QController
{
#region 获取列表
///
/// 加载列表
///
/// 结果
[HandleException]
public ActionResult List(bool? callBack)
{
ProductCheckModel seachModel = new ProductCheckModel();
seachModel.CREATEDATESTART = DateTime.Now.Date.AddDays(-10).ToString("yyyy-MM-dd HH:mm:ss");
seachModel.CREATEDATEEND = DateTime.Now.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss");
if (callBack == true)
TryGetSelectBuffer(out seachModel);
seachModel.rownumbers = false;
seachModel.url = "/ProductCheck/GetList";
return View("ProductCheckList", seachModel);
}
///
/// 获取列表
///
/// 是否回调
/// 列表
[HandleException]
public ActionResult GetList(bool? callBack)
{
ProductCheckModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
ProductCheck 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);
#region wcf服务统一接口
pageResult = wcfAgent.InvokeServiceFunction>("ProductCheckBLL_GetList", 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());
#endregion
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 加载详细信息
///
/// 加载详细信息
///
/// 结果
[HandleException]
public ActionResult GetProductCheckItemList()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
string pid = Request.Params["PID"];
ProductCheck pc = wcfAgent.InvokeServiceFunction("ProductCheckBLL_Get", new ProductCheck { PID = pid });
List list = new List();
CheckWithMaterial condition = new CheckWithMaterial();
condition.PRODUCTCHECK_PID = pid;
condition.MATERIAL_CODE = pc.MATERIAL_CODE;
#region wcf服务统一接口
var dataResult = wcfAgent.InvokeServiceFunction>>("ProductCheckBLL_GetProductCheckItemList", condition);
//通过返回dataResult判断
if (dataResult.Ex != null)
{
throw dataResult.Ex;
}
else if (dataResult.IsSuccess)
{
list = dataResult.Result;
}
List