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.
164 lines
5.6 KiB
164 lines
5.6 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Web;
|
||
|
using System.Web.Mvc;
|
||
|
using QMAPP.MESReport.Web.Models.LineQTY;
|
||
|
using QMAPP.Common.Web.Controllers;
|
||
|
using QMFrameWork.WebUI.Attribute;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMAPP.MD.Entity;
|
||
|
using QMAPP.Entity;
|
||
|
using QMAPP.ServicesAgent;
|
||
|
using QMFrameWork.WebUI.DataSource;
|
||
|
using QMFrameWork.Common.Serialization;
|
||
|
using QMAPP.MESReport.Entity.LineQTY;
|
||
|
|
||
|
using System.Collections;
|
||
|
using System.Reflection;
|
||
|
using QMFrameWork.ServiceInterface;
|
||
|
using System.Data.SqlClient;
|
||
|
using System.Data;
|
||
|
using QMAPP.Common.Web.Util;
|
||
|
using QMAPP.MESReport.BLL;
|
||
|
using QMAPP.MESReport.BLL.LineQTY;
|
||
|
|
||
|
namespace QMAPP.MESReport.Web.Controllers
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 模块:生产日报
|
||
|
/// 于子清
|
||
|
/// 2017-10-7
|
||
|
/// </summary>
|
||
|
|
||
|
public class LineDWQTYCountController : QController
|
||
|
{
|
||
|
public string EmptyItemTitle = " ";
|
||
|
|
||
|
#region 获取信息
|
||
|
/// <summary>
|
||
|
/// 加载列表
|
||
|
/// </summary>
|
||
|
/// <returns>结果</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult DWQTYList(bool? callback)
|
||
|
{
|
||
|
LineDWQTYModel seachModel = new LineDWQTYModel();
|
||
|
seachModel.START_DATE = DateTime.Now.Date.AddDays(-30).ToString("yyyy-MM-dd HH:mm:ss");
|
||
|
seachModel.END_DATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||
|
if (callback == true)
|
||
|
TryGetSelectBuffer<LineDWQTYModel>(out seachModel);
|
||
|
seachModel.rownumbers = false;
|
||
|
seachModel.checkbox = false;
|
||
|
seachModel.url = "/LineDWQTYCount/GetList";
|
||
|
return View("DWQTYList", seachModel);
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
public ActionResult GetList(bool? callBack)
|
||
|
{
|
||
|
LineDWQTYModel seachModel = null;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
LineDayQTYCount condition = null;
|
||
|
DataResult<DataPage> pageResult = new DataResult<DataPage>();
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<LineDWQTYModel>();
|
||
|
#region 获取缓存值
|
||
|
if (callBack != null)
|
||
|
{
|
||
|
TryGetSelectBuffer<LineDWQTYModel>(out seachModel);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//保存搜索条件
|
||
|
SetSelectBuffer<LineDWQTYModel>(seachModel);
|
||
|
}
|
||
|
#endregion
|
||
|
DateGridResult<LineDayQTYCount> result = new DateGridResult<LineDayQTYCount>();
|
||
|
|
||
|
if (string.IsNullOrEmpty(seachModel.START_DATE) || string.IsNullOrEmpty(seachModel.END_DATE))
|
||
|
{
|
||
|
seachModel.START_DATE = DateTime.Now.Date.AddDays(-30).ToString("yyyy-MM-dd HH:mm:ss");
|
||
|
seachModel.END_DATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||
|
}
|
||
|
|
||
|
//获取前台分页设置信息
|
||
|
page = this.GetDataPage(seachModel);
|
||
|
condition = CopyToModel<LineDayQTYCount, LineDWQTYModel>(seachModel);
|
||
|
#region wcf服务统一接口
|
||
|
pageResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>("LineDWQTYCountBLL_GetList", condition, page);
|
||
|
if (pageResult.IsSuccess == false)
|
||
|
{
|
||
|
SetMessage(pageResult.Msg);
|
||
|
return DWQTYList(true);
|
||
|
}
|
||
|
result.Total = pageResult.Result.RecordCount;
|
||
|
List<LineDayQTYCount> nli = JsonConvertHelper.GetDeserialize<List<LineDayQTYCount>>(pageResult.Result.Result.ToString());
|
||
|
|
||
|
foreach (LineDayQTYCount item in nli)
|
||
|
{
|
||
|
if (string.IsNullOrEmpty(item.QTY)||string.IsNullOrEmpty(item.OK_QTY))
|
||
|
{
|
||
|
item.OK_QTY_LV = "0%";
|
||
|
continue;
|
||
|
}
|
||
|
item.OK_QTY_LV = (Convert.ToDouble(item.OK_QTY) * 100 / Convert.ToDouble(item.QTY)).ToString("f2") + "%";
|
||
|
}
|
||
|
|
||
|
result.Rows = nli;
|
||
|
#endregion
|
||
|
return Content(result.GetJsonSource());
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
#region 导出excel
|
||
|
/// <summary>
|
||
|
/// 导出excel
|
||
|
/// </summary>
|
||
|
/// <returns>结果</returns>
|
||
|
[HttpPost]
|
||
|
[HandleException]
|
||
|
public ActionResult ExportExcel()
|
||
|
{
|
||
|
LineDWQTYModel seachModel = null;
|
||
|
LineDayQTYCount condition = null;
|
||
|
DataTable exportDt = new DataTable();
|
||
|
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
|
||
|
PowerUtil pu = new PowerUtil();
|
||
|
|
||
|
|
||
|
string selectKey = Request.Form["selectKey"];
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<LineDWQTYModel>();
|
||
|
condition = CopyToModel<LineDayQTYCount, LineDWQTYModel>(seachModel);
|
||
|
|
||
|
//获取数据
|
||
|
exportDt = agent.InvokeServiceFunction<DataTable>("LineDWQTYCountBLL_GetExportData", condition);
|
||
|
|
||
|
//导出
|
||
|
QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool();
|
||
|
return efTool.GetExportDataResult<LineDWQTYModel>("生产日报.xls", exportDt);
|
||
|
//return efTool.GetExcelFileResult("生产日报", "生产日报.xls", exportDt);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
}
|