From ad494f13d2ddf31f142cf7fb908b3a6e90395a1a Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期四, 01 十二月 2022 12:01:31 +0800 Subject: [PATCH] 苏州金庭10个泵站 对接程序写完 --- Application/IStation.Application.Eta/eta_analy_kpi/EtaAnalyKpi_Controller.cs | 80 ++++++++++++++++++++++++++++++++------- 1 files changed, 65 insertions(+), 15 deletions(-) diff --git a/Application/IStation.Application.Eta/eta_analy_kpi/EtaAnalyKpi_Controller.cs b/Application/IStation.Application.Eta/eta_analy_kpi/EtaAnalyKpi_Controller.cs index dcd948b..02c92d1 100644 --- a/Application/IStation.Application.Eta/eta_analy_kpi/EtaAnalyKpi_Controller.cs +++ b/Application/IStation.Application.Eta/eta_analy_kpi/EtaAnalyKpi_Controller.cs @@ -46,7 +46,9 @@ #region 鏁版嵁 var eta_standard_coal = new Service.ParasConfigure().GetByType(corpId, Configure.Paras_StandardCoal);//鏍囧噯鐓ょ郴鏁� + var eta_standard_list = new Service.EtaStandardConfigure().GetByCorpID(corpId);//鑳芥晥鏍囧噯椤瑰垪琛� + var service_eta = new Service.EtaLogicRealRecord(); var eta_yestoday_record_list = service_eta.GetByObjectOfDay(corpId, ObjectType.LogicArea, logicAreaId, DateTime.Today.AddDays(-1)); //鏄ㄥぉ鐨勬墍鏈夎兘鏁堣褰� @@ -58,7 +60,6 @@ var eta_sum_month_this_record_list = service_eta_sum.GetMonthByObjectOfYear(corpId, ObjectType.LogicArea, logicAreaId, this_year);//浠婂勾鐨勮兘鏁堟湀姹囨�昏褰� var eta_sum_day_last_record_list = service_eta_sum.GetDayByObjectOfYM(corpId, ObjectType.LogicArea, logicAreaId, last_month_day.Year, last_month_day.Month);//涓婃湀鐨勮兘鏁堟棩姹囨�昏褰� var eta_sum_day_this_record_list = service_eta_sum.GetDayByObjectOfYM(corpId, ObjectType.LogicArea, logicAreaId, today.Year, today.Month);//褰撴湀鐨勮兘鏁堟棩姹囨�昏褰� - #endregion var vm = new EtaKpi(); @@ -154,7 +155,15 @@ standard_coal = double.Parse(eta_standard_coal.Value); } var run_coal = eta_pa_record_list.Sum(x => x.Pa.Value * x.Duration / 3600f); - vm_item_coal.Value = ((run_coal / 10000f) * standard_coal).ToString("0.0000"); + var run_coalStandard = ((run_coal / 10000f) * standard_coal); + if (run_coalStandard > 1) + { + vm_item_coal.Value = run_coalStandard.ToString("0.00"); + } + else + { + vm_item_coal.Value = run_coalStandard.ToString("0.0000"); + } } } @@ -517,16 +526,19 @@ var stations = new Service.Station().GetByIds(corpId, stationIds); foreach (var item in stations) { - vm.ErrorMessage += item + "/"; + vm.ErrorMessage += item.Name + "/"; } - vm.ErrorMessage = vm.ErrorMessage.Substring(0, vm.ErrorMessage.Length - 1) + "鏁版嵁寮傚父!"; + vm.ErrorMessage = vm.ErrorMessage.Substring(0, vm.ErrorMessage.Length - 1) + "娴嬬偣寮傚父!"; } } } #endregion - return vm; - + #region 澶囨敞淇℃伅 + var logicArea = new Service.LogicArea().GetByID(corpId, logicAreaId); + vm.Description = logicArea.Description; + #endregion + return vm; } /// <summary> @@ -688,7 +700,15 @@ standard_coal = double.Parse(eta_standard_coal.Value); } var run_coal = eta_run_pa_record_list.Sum(x => x.Pa.Value * x.Duration / 3600f); - vm_item_coal.Value = ((run_coal / 10000f) * standard_coal).ToString("0.0000"); + var run_coalStandard = ((run_coal / 10000f) * standard_coal); + if (run_coalStandard > 1) + { + vm_item_coal.Value = run_coalStandard.ToString("0.00"); + } + else + { + vm_item_coal.Value = run_coalStandard.ToString("0.0000"); + } } } @@ -1082,19 +1102,24 @@ { if (!string.IsNullOrEmpty(eta_last_record.AnalyInfo)) { + vm.ErrorMessage += eta_last_record.GetAnaInfoCN(); var pumpIds = eta_last_record.GetPumpIds(); if (pumpIds != null && pumpIds.Count > 0) { var pumps = new Service.Product().GetByIds(corpId, pumpIds); foreach (var item in pumps) { - vm.ErrorMessage += item + "/"; + vm.ErrorMessage += item.Name + "/"; } - vm.ErrorMessage = vm.ErrorMessage.Substring(0, vm.ErrorMessage.Length - 1) + "鏁版嵁寮傚父!"; - } - vm.ErrorMessage = eta_last_record.GetAnaInfoCN(); + vm.ErrorMessage = vm.ErrorMessage.Substring(0, vm.ErrorMessage.Length - 1) + "娴嬬偣寮傚父!"; + } } } + #endregion + + #region 澶囨敞淇℃伅 + var station = new Service.LogicArea().GetByID(corpId, stationId); + vm.Description = station.Description; #endregion return vm; @@ -1126,22 +1151,28 @@ #region 鏁版嵁 var eta_standard_coal = new Service.ParasConfigure().GetByType(corpId,Configure.Paras_StandardCoal);//鏍囧噯鐓ょ郴鏁� + LogHelper.Info("鏍囧噯鐓ょ郴鏁� 閫氳繃"); + var eta_standard_list = new Service.EtaStandardConfigure().GetByCorpID(corpId);//鑳芥晥鏍囧噯椤瑰垪琛� + LogHelper.Info("鑳芥晥鏍囧噯椤瑰垪琛� 閫氳繃"); var service_eta = new Service.EtaSingleRealRecord(); var eta_yestoday_record_list = service_eta.GetByObjectOfDay(corpId, ObjectType.PipeLine, pipeLineId, DateTime.Today.AddDays(-1));//鏄ㄥぉ鐨勬墍鏈夎兘鏁堣褰� var eta_record_list = service_eta.GetByObjectOfDay(corpId, ObjectType.PipeLine, pipeLineId, DateTime.Today);//褰撳ぉ鎵�鏈夎兘鏁堣褰� var eta_run_record_list = eta_record_list?.Where(x => x.RSa > 0).ToList();//褰撳ぉ鎵�鏈夊紑鏈鸿兘鏁堣褰� var eta_last_record = eta_record_list?.LastOrDefault();//鏈�杩戜竴娆¤兘鏁堣褰� + LogHelper.Info("EtaLogicRealRecord 閫氳繃"); var service_eta_sum = new Service.EtaSumSingleRecord(); var eta_sum_month_last_record_list = service_eta_sum.GetMonthByObjectOfYear(corpId, ObjectType.PipeLine, pipeLineId, last_year);//鍘诲勾鐨勮兘鏁堟湀姹囨�昏褰� var eta_sum_month_this_record_list = service_eta_sum.GetMonthByObjectOfYear(corpId, ObjectType.PipeLine, pipeLineId, this_year);//浠婂勾鐨勮兘鏁堟湀姹囨�昏褰� + LogHelper.Info("EtaSumSingleMonthRecord 閫氳繃"); var eta_sum_day_last_record_list = service_eta_sum.GetDayByObjectOfYM(corpId, ObjectType.PipeLine, pipeLineId, last_month_day.Year, last_month_day.Month);//涓婃湀鐨勮兘鏁堟棩姹囨�昏褰� var eta_sum_day_this_record_list = service_eta_sum.GetDayByObjectOfYM(corpId, ObjectType.PipeLine, pipeLineId, today.Year, today.Month);//褰撴湀鐨勮兘鏁堟棩姹囨�昏褰� + LogHelper.Info("EtaSumSingleDayRecord 閫氳繃"); #endregion - + var vm = new EtaKpi(); #region Kpi鎸囨爣椤� @@ -1233,7 +1264,7 @@ #endregion - #region 鏍囧噯鐓� + #region 鏍囧噯鐓� var vm_item_coal = new EtaKpiItem(); vm_item_coal.Name = "鏍囧噯鐓�"; @@ -1251,7 +1282,15 @@ standard_coal = double.Parse(eta_standard_coal.Value); } var run_coal = eta_run_pa_record_list.Sum(x => x.Pa.Value * x.Duration / 3600f); - vm_item_coal.Value = ((run_coal / 10000f) * standard_coal).ToString("0.0000"); + var run_coalStandard = ((run_coal / 10000f) * standard_coal); + if (run_coalStandard > 1) + { + vm_item_coal.Value = run_coalStandard.ToString("0.00"); + } + else + { + vm_item_coal.Value = run_coalStandard.ToString("0.0000"); + } } } @@ -1680,7 +1719,18 @@ if (eta_last_record != null) { vm.ErrorMessage = eta_last_record.GetAnaInfoCN(); - } + } + #endregion + + #region 澶囨敞淇℃伅 + var pipeLineBinding = new Service.PipeLineBinding().GetUseByPipeLineID(corpId,pipeLineId); + if (pipeLineBinding!=null&&pipeLineBinding.Count>0) + { + var first = pipeLineBinding.First(); + var product = new Service.Product().GetByID(corpId, first.BindingID); + vm.Description = product?.Description; + } + #endregion return vm; -- Gitblit v1.9.3