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.
205 lines
7.3 KiB
205 lines
7.3 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Web;
|
||
|
using System.Web.Mvc;
|
||
|
using QMAPP.FJC.Entity.Operation;
|
||
|
using QMAPP.FJC.Web.Models.StatisticalAnalysis;
|
||
|
using QMFrameWork.WebUI.Attribute;
|
||
|
using QMAPP.Common.Web.Controllers;
|
||
|
using QMAPP.KB.Entity;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMAPP.ServicesAgent;
|
||
|
using QMFrameWork.WebUI.DataSource;
|
||
|
using QMFrameWork.Common.Serialization;
|
||
|
using System.Data;
|
||
|
using QMAPP.FJC.Entity.Basic;
|
||
|
using QMAPP.FJC.Entity.ProduceManage;
|
||
|
|
||
|
namespace QMAPP.FJC.Web.Controllers
|
||
|
{
|
||
|
public class ProductionDailyController : QController
|
||
|
{
|
||
|
//
|
||
|
// GET: /ProductionDaily/
|
||
|
#region 初始化
|
||
|
/// <summary>
|
||
|
/// 初始化
|
||
|
/// </summary>
|
||
|
/// <returns>结果</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult Init()
|
||
|
{
|
||
|
ProductionDailyModel seachModel = new ProductionDailyModel();
|
||
|
return View("ProductionDaily", seachModel);
|
||
|
}
|
||
|
#endregion
|
||
|
#region 获取列表
|
||
|
/// <summary>
|
||
|
/// 加载列表
|
||
|
/// </summary>
|
||
|
/// <returns>结果</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult List(bool? callBack)
|
||
|
{
|
||
|
ProductionDailyModel seachModel = new ProductionDailyModel();
|
||
|
seachModel.STARTCREATEDATE = DateTime.Now.AddDays(-10);
|
||
|
seachModel.ENDCREATEDATE = DateTime.Now;
|
||
|
seachModel.ImmediateSearch = false;
|
||
|
if (callBack == true)
|
||
|
TryGetSelectBuffer<ProductionDailyModel>(out seachModel);
|
||
|
|
||
|
seachModel.rownumbers = false;
|
||
|
seachModel.url = "/ProductionDaily/GetList";
|
||
|
return View("ProductionDailyList", seachModel);
|
||
|
}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取列表
|
||
|
/// </summary>
|
||
|
/// <param name="callBack">是否回调</param>
|
||
|
/// <returns>列表</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult GetList(bool? callBack)
|
||
|
{
|
||
|
ProductionDailyModel seachModel;
|
||
|
List<ProducePlan> listResult = new List<ProducePlan>();
|
||
|
DataPage page = new DataPage();
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
ProducePlan condition = null;
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<ProductionDailyModel>();
|
||
|
condition = CopyToModel<ProducePlan, ProductionDailyModel>(seachModel);
|
||
|
|
||
|
#region wcf服务统一接口
|
||
|
listResult = wcfAgent.InvokeServiceFunction<List<ProducePlan>>(QMAPP.ServicesAgent.ProduceManage.ProducePlanBLL_GetTotal.ToString(), condition);
|
||
|
#endregion
|
||
|
DateGridResult<ProducePlan> result = new DateGridResult<ProducePlan>();
|
||
|
result.Total = listResult.Count;
|
||
|
result.Rows = listResult;
|
||
|
return Content(result.GetJsonSource());
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 导出excel
|
||
|
/// <summary>
|
||
|
/// 导出excel
|
||
|
/// </summary>
|
||
|
/// <returns>结果</returns>
|
||
|
[HttpPost]
|
||
|
public ActionResult ExportExcel()
|
||
|
{
|
||
|
ProductionDailyModel seachModel = null;
|
||
|
MainOperation condition = null;
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
DataResult<List<MainOperation>> listResult = new DataResult<List<MainOperation>>();
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<ProductionDailyModel>();
|
||
|
condition = CopyToModel<MainOperation, ProductionDailyModel>(seachModel);
|
||
|
//获取数据
|
||
|
listResult = wcfAgent.InvokeServiceFunction<DataResult<List<MainOperation>>>(QMAPP.ServicesAgent.B9BasicService.MainOperationBLL_GetListGroupBy.ToString(), condition);
|
||
|
//导出
|
||
|
QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool();
|
||
|
DataTable dt = JsonConvertHelper.GetDeserialize<DataTable>(JsonConvertHelper.GetSerializes(listResult.Result));
|
||
|
return efTool.GetExcelFileResult("ProductionDailyExp", "产量趋势分析.xlsx", dt);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
|
||
|
#region 获取设备编号下拉列表
|
||
|
/// <summary>
|
||
|
/// 获取设备编号下拉列表
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
public ContentResult GetMachineInfoComboxSource()
|
||
|
{
|
||
|
List<MachineInfo> listMachineInfo = new List<MachineInfo>();
|
||
|
ComboboxResult model = new ComboboxResult();
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
MachineInfo entity = new MachineInfo();
|
||
|
try
|
||
|
{
|
||
|
//获取设备信息
|
||
|
listMachineInfo = wcfAgent.InvokeServiceFunction<List<MachineInfo>>(QMAPP.ServicesAgent.FeedInManage.InjectionRecorderBLL_GetMachineInfoList.ToString(), entity);
|
||
|
|
||
|
foreach (var item in listMachineInfo)
|
||
|
{
|
||
|
if (model.Items.Count == 0)
|
||
|
{
|
||
|
model.Add(new ComboboxItem { ID = "", Text = new DictController().EmptyItemTitle });
|
||
|
model.Add(new ComboboxItem { ID = item.MACHINECODDE, Text = item.MACHINECODDE });
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
model.Add(new ComboboxItem { ID = item.MACHINECODDE, Text = item.MACHINECODDE });
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return Content(model.ToString());
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 获取班次编号下拉列表
|
||
|
/// <summary>
|
||
|
/// 获取班次编号下拉列表
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
public ContentResult GetProductShiftComboxSource()
|
||
|
{
|
||
|
List<ProduceShift> listProductShiftInfo = new List<ProduceShift>();
|
||
|
ComboboxResult model = new ComboboxResult();
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
ProduceShift entity = new ProduceShift();
|
||
|
try
|
||
|
{
|
||
|
//获取班次信息
|
||
|
listProductShiftInfo = wcfAgent.InvokeServiceFunction<List<ProduceShift>>(QMAPP.ServicesAgent.FeedInManage.InjectionRecorderBLL_GetProduceShiftList.ToString(), entity);
|
||
|
|
||
|
foreach (var item in listProductShiftInfo)
|
||
|
{
|
||
|
if (model.Items.Count == 0)
|
||
|
{
|
||
|
model.Add(new ComboboxItem { ID = "", Text = new DictController().EmptyItemTitle });
|
||
|
model.Add(new ComboboxItem { ID = item.PRODUCESHIFTTCODE, Text = item.PRODUCESHIFTTCODE });
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
model.Add(new ComboboxItem { ID = item.PRODUCESHIFTTCODE, Text = item.PRODUCESHIFTTCODE });
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return Content(model.ToString());
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
}
|