Beispiel #1
0
        private void CalcTotal(ref IList list)
        {
            //合计
            string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";

            int[] year = GetYears();
            Ps_PowerBuild parent = new Ps_PowerBuild();
            parent.ID = parent.ID + "|" + GetProjectID;
            parent.ParentID = "0"; parent.Title = "全网110千伏合计"; parent.Sort = 1000;// OperTable.GetMaxSort() + 1;
            list.Add(parent);
            totoalParent = parent.ID;
            Ps_PowerBuild tablex = new Ps_PowerBuild();
            conn = "Col1='0' and ProjectID='" + GetProjectID + "'";
            IList childx = Common.Services.BaseService.GetList("SelectPs_PowerBuildSumByConn", conn);
            tablex = (Ps_PowerBuild)childx[0];
            tablex.ParentID = parent.ID;
            tablex.ID = Guid.NewGuid().ToString();
            tablex.ID += "|" + GetProjectID;
            tablex.Sort = 1;
            tablex.Col1 = "no";
            tablex.Title = "110千伏主变供电负荷";
            list.Add(tablex);

            Ps_PowerBuild table1 = new Ps_PowerBuild();
            // Ps_PowerBuild con1 = new Ps_PowerBuild();
            // con1.Col4 = rongZai220;
            conn = "Col1='0' and ProjectID='" + GetProjectID + "'";// con1.Title = "Col1='0'";
            //IList child1 = Common.Services.BaseService.GetList("SelectPs_PowerBuildSumByConn", conn);
            table1 = (Ps_PowerBuild)tablex.Clone();// (Ps_PowerBuild)child1[0];
            for (int j = year[1]; j <= year[2]; j++)
            {
                double d = (double)table1.GetType().GetProperty("y" + j).GetValue(table1, null);
                table1.GetType().GetProperty("y" + j).SetValue(table1, Math.Round(double.Parse(rongZai220) * d, 1), null);

            }
            table1.ParentID = parent.ID;
            table1.ID = Guid.NewGuid().ToString();
            table1.ID += "|" + GetProjectID;
            table1.Sort = 2;
            table1.Col1 = "no";
            table1.Title = "110千伏需主变容量(" + rongZai220 + ")";
            list.Add(table1);

            Ps_PowerBuild table = new Ps_PowerBuild();
            //conn = "Col1='1'";
            //IList child = Common.Services.BaseService.GetList("SelectPs_PowerBuildSumByConn", conn);
            //table = (Ps_PowerBuild)child[0];
            for (int j = 0; j < list.Count; j++)
            {
                if (((Ps_PowerBuild)list[j]).Col1 == "1")
                {
                    for (int k = year[1]; k <= year[2]; k++)
                    {
                        table.GetType().GetProperty("y" + k).SetValue(table, double.Parse(table.GetType().GetProperty("y" + k).GetValue(table, null).ToString()) + double.Parse(((Ps_PowerBuild)list[j]).GetType().GetProperty("y" + k).GetValue(((Ps_PowerBuild)list[j]), null).ToString()), null);
                    }
                }
            }
            table.ParentID = parent.ID;
            table.ID = Guid.NewGuid().ToString();
            table.ID += "|" + GetProjectID;
            table.Sort = 3;
            table.Col1 = "no";
            table.Title = "110千伏主变总容量";
            list.Add(table);

            //IList allChild = Common.Services.BaseService.GetList("SelectPs_PowerBuildByConn", conn);
            for (int k = 0; k < list.Count; k++)
            {
                if (((Ps_PowerBuild)list[k]).Col1 == "1")
                {
                    Ps_PowerBuild ps1 = new Ps_PowerBuild();

                    ps1 = (Ps_PowerBuild)((Ps_PowerBuild)list[k]).Clone();
                    ps1.ID = Guid.NewGuid().ToString();
                    ps1.ID += "|" + GetProjectID;
                    ps1.ParentID = parent.ID;
                    ps1.Col1 = "no";
                    ps1.BuildEd = "total";
                    list.Add(ps1);
                }
            }

            //conn = "Col1='0'";
            //Ps_PowerBuild temp1 = (Ps_PowerBuild)Common.Services.BaseService.GetList("SelectPs_PowerBuildByConn", conn)[0];
            Ps_PowerBuild table2 = new Ps_PowerBuild();
            for (int j = year[1]; j <= year[2]; j++)
            {
                double d = (double)tablex.GetType().GetProperty("y" + j).GetValue(tablex, null);
                if (d != 0.0)
                {
                    double chu = (double)table.GetType().GetProperty("y" + j).GetValue(table, null);
                    table2.GetType().GetProperty("y" + j).SetValue(table2, Math.Round(chu / d, 1), null);
                }
            }
            table2.ParentID = parent.ID;
            table2.ID = Guid.NewGuid().ToString();
            table2.ID += "|" + GetProjectID;
            table2.Sort = 1000;
            table2.Col1 = "no";
            table2.Title = "110千伏容载比";
            list.Add(table2);
        }