public static DataTable GetDayComprehensiveStaticsData(string myOrganizationId, string myVariableId, string myStatisticType, string myStartTime, string myEndTime)
        {
            DataTable m_DayDataTable = new DataTable("DataValue");

            m_DayDataTable.Columns.Add("Vdate", typeof(string));
            m_DayDataTable.Columns.Add("TagValue", typeof(decimal));
            string   m_LevelCode = Analyse_KPICommon.GetLevelCodeByOrganizationId(myOrganizationId);
            DateTime m_StartDate = DateTime.Parse(myStartTime);
            DateTime m_EndDate   = DateTime.Parse(myEndTime);

            while (m_StartDate < m_EndDate)
            {
                if (myStatisticType == "Comprehensive")
                {
                    m_DayDataTable.Rows.Add(m_StartDate.ToString("MMdd"), Analyse_KPICommon.GetComprehensiveConsumptionData(myVariableId, m_StartDate.ToString("yyyy-MM-dd"), m_StartDate.ToString("yyyy-MM-dd"), m_LevelCode, StaticsCycleDay));
                }
                else if (myStatisticType == "Comparable")
                {
                    m_DayDataTable.Rows.Add(m_StartDate.ToString("MMdd"), Analyse_KPICommon.GetComparableConsumptionData(myVariableId, m_StartDate.ToString("yyyy-MM-dd"), m_StartDate.ToString("yyyy-MM-dd"), m_LevelCode, StaticsCycleDay));
                }
                m_StartDate = m_StartDate.AddDays(1);
            }
            return(m_DayDataTable);
        }
        public static string GetBenchmarkingDataValue(string myStartTime, string myEndTime, string myValueType, string myTagInfoJson)
        {
            string m_ValueJson = "";

            string[]  m_RowsJson      = EasyUIJsonParser.Infrastructure.JsonHelper.ArrayPicker("rows", myTagInfoJson);
            DataTable m_TagsInfoTable = EasyUIJsonParser.DataGridJsonParser.JsonToDataTable(m_RowsJson, GetTagsInfoTable());

            if (m_TagsInfoTable != null && m_TagsInfoTable.Rows.Count > 0)
            {
                List <string> m_OrganizationList = new List <string>(0);
                List <string> m_VariableList     = new List <string>(0);
                foreach (DataRow item in m_TagsInfoTable.Rows)           //工序电耗或者主要设备电耗
                {
                    if (myValueType == "ElectricityConsumption_Entity")
                    {
                        item["StatisticType"] = "Entity";
                    }
                    else if (myValueType == "ElectricityConsumption_Comprehensive" || myValueType == "CoalConsumption_Comprehensive" || myValueType == "EnergyConsumption_Comprehensive")
                    {
                        item["StatisticType"] = "Comprehensive";
                    }
                    else if (myValueType == "ElectricityConsumption_Comparable" || myValueType == "CoalConsumption_Comparable" || myValueType == "EnergyConsumption_Comparable")
                    {
                        item["StatisticType"] = "Comparable";
                    }

                    if (item["OrganizationId"] != null && item["OrganizationId"].ToString() != "")
                    {
                        if (item["StatisticType"].ToString() == "Entity")     //工序电耗或者是设备电耗
                        {
                            string m_OrganizationIdItem = item["OrganizationId"].ToString();
                            string m_VariableIdItem     = item["TagItemId"].ToString();
                            m_VariableIdItem = m_VariableIdItem.Substring(0, m_VariableIdItem.Length - 7);
                            if (!m_OrganizationList.Contains(m_OrganizationIdItem))
                            {
                                m_OrganizationList.Add(m_OrganizationIdItem);
                            }
                            if (!m_VariableList.Contains(m_VariableIdItem))
                            {
                                m_VariableList.Add(m_VariableIdItem);
                            }
                        }
                    }
                }

                DataTable ElectricityConsumptionFormulaTable = dal_IAnalysisKPI.GetElectricityConsumptionFormula(m_OrganizationList, m_VariableList);
                DataTable BencharkingDataTable = dal_IAnalysisKPI.GetBenchmarkingDataValue(myStartTime, myEndTime, m_OrganizationList);
                string    preFormula           = "";
                foreach (DataRow dr in ElectricityConsumptionFormulaTable.Rows)                       //构造主要设备的公式
                {
                    if (dr["ValueFormula"] is DBNull)
                    {
                        preFormula         = DealWithFormula(preFormula, dr["VariableId"].ToString().Trim());
                        dr["ValueFormula"] = preFormula;
                    }
                    else
                    {
                        preFormula = dr["ValueFormula"].ToString().Trim();
                    }
                }
                string[]  calColumns = new string[] { "Value" };
                DataTable m_Result   = EnergyConsumption.EnergyConsumptionCalculate.CalculateByOrganizationId(BencharkingDataTable, ElectricityConsumptionFormulaTable, "ValueFormula", calColumns);

                foreach (DataRow item in m_TagsInfoTable.Rows)
                {
                    string m_LevelCode = item["LevelCode"].ToString();
                    if (item["OrganizationId"] != null && item["OrganizationId"].ToString() != "")
                    {
                        if (item["StatisticType"].ToString() == "Comprehensive")       //如果计算综合电耗或者煤耗
                        {
                            item["Value"] = string.Format("{0:F2}", Analyse_KPICommon.GetComprehensiveConsumptionData(item["TagItemId"].ToString(), myStartTime, myEndTime, m_LevelCode, StaticsCycleMonth));
                        }
                        else if (item["StatisticType"].ToString() == "Comparable")     //如果计算可比综合电耗或者煤耗
                        {
                            item["Value"] = string.Format("{0:F2}", Analyse_KPICommon.GetComparableConsumptionData(item["TagItemId"].ToString(), myStartTime, myEndTime, m_LevelCode, StaticsCycleMonth));
                        }
                        else if (item["StatisticType"].ToString() == "Entity")     //工序电耗或者是设备电耗
                        {
                            if (m_Result != null)
                            {
                                string m_OrganizationIdItem = item["OrganizationId"].ToString();
                                string m_VariableIdItem     = item["TagItemId"].ToString();
                                m_VariableIdItem = m_VariableIdItem.Substring(0, m_VariableIdItem.Length - 7);
                                DataRow[] m_DataRow = m_Result.Select(string.Format("OrganizationID = '{0}' and VariableId + '_ElectricityConsumption' = '{1}'", m_OrganizationIdItem, m_VariableIdItem));
                                if (m_DataRow.Length > 0)
                                {
                                    decimal m_Value = m_DataRow[0]["Value"] != null ? (decimal)m_DataRow[0]["Value"] : 0.0m;
                                    item["Value"] = string.Format("{0:F2}", m_Value);   //item["TagItemId"].ToString()
                                }
                            }
                        }
                    }
                }

                m_ValueJson = CreateChartString(m_TagsInfoTable, m_TagsInfoTable.Rows[0]["StatisticName"].ToString(), m_TagsInfoTable.Rows[0]["StatisticType"].ToString());
            }
            return(m_ValueJson);
        }