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

129 lines
4.5 KiB

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 QMFrameWork.Data;
using QMAPP.ServicesAgent;
using QMAPP.FJC.Entity.Operation;
using QMAPP.FJC.Web.Models.Operation;
using System.Data;
using QMAPP.Entity;
using QMFrameWork.Common.ExcelOperation;
using QMFrameWork.Log;
using QMFrameWork.WebUI.DataSource;
using QMFrameWork.Common.Serialization;
namespace QMAPP.FJC.Web.Controllers
{
public class ProductOutController : QController
{
#region 获取信息
/// <summary>
/// 加载列表
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult List(bool? callback)
{
ProductOutModel seachModel = new ProductOutModel();
seachModel.checkbox = false;
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");
seachModel.ImmediateSearch = false;
if (callback == true)
TryGetSelectBuffer<ProductOutModel>(out seachModel);
seachModel.url = "/ProductOut/GetList";
return View("List", seachModel);
}
#endregion
#region 获取列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>列表</returns>
[HandleException]
public ActionResult GetList(bool? callBack)
{
ProductOutModel seachModel = null;
DataPage page = null;
ServiceAgent wcfAgent = this.GetServiceAgent();
ProductOut condition = null;
DataResult<DataPage> pageResult = new DataResult<DataPage>();
try
{
//获取查询对象
seachModel = GetModel<ProductOutModel>();
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer<ProductOutModel>(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer<ProductOutModel>(seachModel);
}
#endregion
//获取前台分页设置信息
seachModel.pageSize = "200";
page = this.GetDataPage(seachModel);
condition = CopyToModel<ProductOut, ProductOutModel>(seachModel);
#region wcf服务统一接口
pageResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>("ProductOutBLL_GetInfoList", condition, page);
if (pageResult.IsSuccess == false)
{
SetMessage(pageResult.Msg);
return List(true);
}
DateGridResult<ProductOut> result = new DateGridResult<ProductOut>();
result.Total = pageResult.Result.RecordCount;
result.Rows = JsonConvertHelper.GetDeserialize<List<ProductOut>>(pageResult.Result.Result.ToString());
#endregion
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 导出excel
/// <summary>
/// 导出excel
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult ExportExcel()
{
ProductOutModel seachModel = null;
ProductOut condition = null;
DataTable exportDt = new DataTable();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
//获取查询对象
seachModel = GetModel<ProductOutModel>();
condition = CopyToModel<ProductOut, ProductOutModel>(seachModel);
condition.PIDList = Request.Form["selectKey"];
exportDt = wcfAgent.InvokeServiceFunction<DataTable>("ProductOutBLL_GetExportData", condition);
//导出
QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool();
return efTool.GetExcelFileResult("ProductOutExp", "计划外出库信息.xlsx", exportDt);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}