ningshuxia
2022-12-01 ad494f13d2ddf31f142cf7fb908b3a6e90395a1a
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;