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 初始化 /// /// 初始化 /// /// 结果 [HandleException] public ActionResult Init() { ProductionDailyModel seachModel = new ProductionDailyModel(); return View("ProductionDaily", seachModel); } #endregion #region 获取列表 /// /// 加载列表 /// /// 结果 [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(out seachModel); seachModel.rownumbers = false; seachModel.url = "/ProductionDaily/GetList"; return View("ProductionDailyList", seachModel); } /// /// 获取列表 /// /// 是否回调 /// 列表 [HandleException] public ActionResult GetList(bool? callBack) { ProductionDailyModel seachModel; List listResult = new List(); DataPage page = new DataPage(); ServiceAgent wcfAgent = this.GetServiceAgent(); ProducePlan condition = null; try { //获取查询对象 seachModel = GetModel(); condition = CopyToModel(seachModel); #region wcf服务统一接口 listResult = wcfAgent.InvokeServiceFunction>(QMAPP.ServicesAgent.ProduceManage.ProducePlanBLL_GetTotal.ToString(), condition); #endregion DateGridResult result = new DateGridResult(); result.Total = listResult.Count; result.Rows = listResult; return Content(result.GetJsonSource()); } catch (Exception ex) { throw ex; } } #endregion #region 导出excel /// /// 导出excel /// /// 结果 [HttpPost] public ActionResult ExportExcel() { ProductionDailyModel seachModel = null; MainOperation condition = null; ServiceAgent wcfAgent = this.GetServiceAgent(); DataResult> listResult = new DataResult>(); try { //获取查询对象 seachModel = GetModel(); condition = CopyToModel(seachModel); //获取数据 listResult = wcfAgent.InvokeServiceFunction>>(QMAPP.ServicesAgent.B9BasicService.MainOperationBLL_GetListGroupBy.ToString(), condition); //导出 QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool(); DataTable dt = JsonConvertHelper.GetDeserialize(JsonConvertHelper.GetSerializes(listResult.Result)); return efTool.GetExcelFileResult("ProductionDailyExp", "产量趋势分析.xlsx", dt); } catch (Exception ex) { throw ex; } } #endregion #region 获取设备编号下拉列表 /// /// 获取设备编号下拉列表 /// /// public ContentResult GetMachineInfoComboxSource() { List listMachineInfo = new List(); ComboboxResult model = new ComboboxResult(); ServiceAgent wcfAgent = this.GetServiceAgent(); MachineInfo entity = new MachineInfo(); try { //获取设备信息 listMachineInfo = wcfAgent.InvokeServiceFunction>(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 获取班次编号下拉列表 /// /// 获取班次编号下拉列表 /// /// public ContentResult GetProductShiftComboxSource() { List listProductShiftInfo = new List(); ComboboxResult model = new ComboboxResult(); ServiceAgent wcfAgent = this.GetServiceAgent(); ProduceShift entity = new ProduceShift(); try { //获取班次信息 listProductShiftInfo = wcfAgent.InvokeServiceFunction>(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 } }