Beispiel #1
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            //FindNodes(treeList1.FocusedNode);

            string nodestr = treeList1.FocusedNode.GetValue("Col1").ToString();

            string parentid = treeList1.FocusedNode["ParentID"].ToString();

            if (!base.EditRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }
            if (nodestr == "1" || nodestr == "2" || nodestr == "3" || nodestr == "4" || nodestr == "5" || nodestr == "6" || nodestr == "no")
            {
                MsgBox.Show("固定分类不许修改!");
                return;
            }
            FrmAddPN frm = new FrmAddPN();
            //frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString();
            frm.ParentName = treeList1.FocusedNode.GetValue("Title").ToString();
            frm.Text = "修改分类名";
            frm.SetLabelName = "分类名称";
            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Table_220Result table1 = new Ps_Table_220Result();
                table1 = Common.Services.BaseService.GetOneByKey<Ps_Table_220Result>(treeList1.FocusedNode.GetValue("ID"));
                table1.Title = frm.ParentName;

                try
                {
                    Common.Services.BaseService.Update<Ps_Table_220Result>(table1);
                    treeList1.FocusedNode.SetValue("Title", frm.ParentName);
                }
                catch { }
                //catch(Exception ex)
                //{
                //    MsgBox.Show("修改出错:" + ex.Message);
                //}
            }
        }
Beispiel #2
0
        public void AddModelChild(string id,string pid,string heid)
        {
            string conn = "ProjectID='"+GetProjectID+"' and Col3='shui' and Col4='"+pid+"'";
            IList listshui = Common.Services.BaseService.GetList("SelectPs_Table_110ResultByConn", conn);
            conn = "ProjectID='" + GetProjectID + "' and Col3='huo' and Col4='" + pid + "'";
            IList listhuo = Common.Services.BaseService.GetList("SelectPs_Table_110ResultByConn", conn);
            Ps_Table_220Result res1 = Common.Services.BaseService.GetOneByKey<Ps_Table_220Result>(id);
            Ps_Table_220Result reshe = Common.Services.BaseService.GetOneByKey<Ps_Table_220Result>(heid);
            Ps_Table_220Result table1 = new Ps_Table_220Result();
            table1.ID += "|" + GetProjectID;
            table1.Title = "其中:小水电";
            table1.ParentID = id;
            table1.ProjectID = GetProjectID;
            table1.Col3 = "shui";
            table1.Col1 = "child";
            table1.Col2 = "no";
            table1.Sort = 0;
            Ps_Table_220Result table3 = new Ps_Table_220Result();
            table3.ID += "|" + GetProjectID;
            table3.Title = "35千伏及以下地方小水电出力";
            table3.ParentID = table1.ID;
            table3.ProjectID = GetProjectID;
            table3.Col3 = "35xia";
            table3.Col1 = "child";
            table3.Col2 = "no";
            table3.Sort = 0;
            double temp = 0.0,temp1=0.0,temp2=0.0,temp3=0.0;
            if (listshui.Count > 0)
            {
                for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                {
                    temp=double.Parse(listshui[0].GetType().GetProperty("yf"+i.ToString()).GetValue(listshui[0],null).ToString());
                    temp1 = double.Parse(listshui[0].GetType().GetProperty("yk" + i.ToString()).GetValue(listshui[0], null).ToString());
                    table1.GetType().GetProperty("yf" + i.ToString()).SetValue(table1, temp, null);
                    table1.GetType().GetProperty("yk" + i.ToString()).SetValue(table1, temp1, null);
                    table3.GetType().GetProperty("yf" + i.ToString()).SetValue(table3, temp, null);
                    table3.GetType().GetProperty("yk" + i.ToString()).SetValue(table3, temp1, null);
                    res1.GetType().GetProperty("yf" + i.ToString()).SetValue(res1, temp, null);
                    res1.GetType().GetProperty("yk" + i.ToString()).SetValue(res1, temp1, null);
                    reshe.GetType().GetProperty("yf" + i.ToString()).SetValue(reshe, 0.0-temp, null);
                    reshe.GetType().GetProperty("yk" + i.ToString()).SetValue(reshe, 0.0-temp1, null);
                }
            }
            Ps_Table_220Result table4 = new Ps_Table_220Result();
            table4.ID += "|" + GetProjectID;
            table4.Title = "其它";
            table4.ParentID = id;
            table4.ProjectID = GetProjectID;
            table4.Col3 = "other";
            table4.Col1 = "child";
            table4.Col2 = "no";
            table4.Sort = 3;
            Ps_Table_220Result table2 = new Ps_Table_220Result();
            table2.ID += "|" + GetProjectID;
            table2.Title = "小火电";
            table2.ParentID = id;
            table2.ProjectID = GetProjectID;
            table2.Col3 = "huo";
            table2.Col1 = "child";
            table2.Col2 = "no";
            table2.Sort = 1;
            if (listhuo.Count > 0)
            {
                for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                {
                    temp = double.Parse(listhuo[0].GetType().GetProperty("yf" + i.ToString()).GetValue(listhuo[0], null).ToString());
                    temp1 = double.Parse(listhuo[0].GetType().GetProperty("yk" + i.ToString()).GetValue(listhuo[0], null).ToString());
                    table2.GetType().GetProperty("yf" + i.ToString()).SetValue(table2, temp, null);
                    table2.GetType().GetProperty("yk" + i.ToString()).SetValue(table2, temp1, null);
                    if (listshui.Count > 0)
                    {
                        temp2 = double.Parse(listshui[0].GetType().GetProperty("yf" + i.ToString()).GetValue(listshui[0], null).ToString());
                        temp3 = double.Parse(listshui[0].GetType().GetProperty("yk" + i.ToString()).GetValue(listshui[0], null).ToString());
                        res1.GetType().GetProperty("yf" + i.ToString()).SetValue(res1, temp+temp2, null);
                        res1.GetType().GetProperty("yk" + i.ToString()).SetValue(res1, temp1+temp3, null);
                        reshe.GetType().GetProperty("yf" + i.ToString()).SetValue(reshe, 0.0 - temp-temp2, null);
                        reshe.GetType().GetProperty("yk" + i.ToString()).SetValue(reshe, 0.0 - temp1-temp3, null);
                    }
                }

            }
            Common.Services.BaseService.Create("InsertPs_Table_220Result", table1);
            Common.Services.BaseService.Create("InsertPs_Table_220Result", table3);
            Common.Services.BaseService.Create("InsertPs_Table_220Result", table2);
            Common.Services.BaseService.Create("InsertPs_Table_220Result", table4);
            Common.Services.BaseService.Update<Ps_Table_220Result>(res1);
            Common.Services.BaseService.Update<Ps_Table_220Result>(reshe);
        }
Beispiel #3
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode focusedNode = treeList1.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }

            if (!base.AddRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }
            FindNodes(treeList1.FocusedNode);
            string nodestr = treenode.GetValue("Title").ToString();
            if (treeList1.FocusedNode.GetValue("Col1").ToString() == "no" || focusedNode.GetValue("ParentID").ToString()=="0")
            {
                MsgBox.Show( focusedNode.GetValue("Title").ToString()+"不允许添加子分类!");
                return;
            }

            FrmAddPN frm = new FrmAddPN();
            frm.Text = "增加" + focusedNode.GetValue("Title") + "的子分类";
            frm.SetLabelName = "子分类名称";
            if(frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Table_220Result table1 = new Ps_Table_220Result();
                table1.ID += "|" + GetProjectID;
                table1.Title = frm.ParentName;
                table1.ParentID = focusedNode.GetValue("ID").ToString();
                table1.ProjectID = GetProjectID;
                table1.Col1 = "child";
                table1.Col2 = treeList1.FocusedNode.GetValue("Col1").ToString();
                table1.Sort = OperTable.Get220ResultMaxSort()+1;

                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_220Result", table1);
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow()));
                }
                catch(Exception ex)
                {
                    MsgBox.Show("增加子分类出错:" + ex.Message);
                }
            }
        }
Beispiel #4
0
 public void UpdateFuHe(string pid, string col1, Ps_Table_220Result oldrs, Ps_Table_220Result newrs)
 {
     string conn = "ProjectID='" + GetProjectID + "' and Col1='" + col1 + "' and ParentID='" + pid + "'";
     IList list = Common.Services.BaseService.GetList("SelectPs_Table_220ResultByConn", conn);
     if (list.Count > 0)
     {
         for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
         {
             double oldyf = double.Parse(oldrs.GetType().GetProperty("yf" + i.ToString()).GetValue(oldrs, null).ToString());
             double oldyk = double.Parse(oldrs.GetType().GetProperty("yk" + i.ToString()).GetValue(oldrs, null).ToString());
             double newyf = double.Parse(newrs.GetType().GetProperty("yf" + i.ToString()).GetValue(newrs, null).ToString());
             double newyk = double.Parse(newrs.GetType().GetProperty("yk" + i.ToString()).GetValue(newrs, null).ToString());
             double myyf = double.Parse(list[0].GetType().GetProperty("yf" + i.ToString()).GetValue(list[0], null).ToString());
             double myyk = double.Parse(list[0].GetType().GetProperty("yk" + i.ToString()).GetValue(list[0], null).ToString());
             list[0].GetType().GetProperty("yf" + i.ToString()).SetValue(list[0], Math.Round(myyf - oldyf + newyf, 1), null);
             list[0].GetType().GetProperty("yk" + i.ToString()).SetValue(list[0], Math.Round(myyk - oldyk + newyk, 1), null);
         }
         Common.Services.BaseService.Update<Ps_Table_220Result>((Ps_Table_220Result)list[0]);
     }
 }
Beispiel #5
0
 private void barButtonItem15_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     ClearChen();
     UpdateChen();
     IList pareList = Common.Services.BaseService.GetList("SelectPS_Table_AreaWHByConn", "ProjectID='" + GetProjectID +
         "' and ID not in (Select BuildIng From Ps_Table_220Result where ProjectID='" +
         GetProjectID + "' and ParentID='0') order by sort");
     for (int i = 0; i < pareList.Count; i++)
     {
         Ps_Table_220Result table_yd = new Ps_Table_220Result();
         table_yd.ID += "|" + GetProjectID;
         table_yd.Title = ((PS_Table_AreaWH)pareList[i]).Title;
         table_yd.ParentID = "0";
         table_yd.Sort = OperTable.Get220ResultMaxSort() + 1;
         table_yd.ProjectID = GetProjectID;
         table_yd.BuildIng = ((PS_Table_AreaWH)pareList[i]).ID;
         for (int j = yAnge.BeginYear; j <= yAnge.EndYear; j++)
         {
             table_yd.GetType().GetProperty("yf" + j.ToString()).SetValue(table_yd, null, null);
             table_yd.GetType().GetProperty("yk" + j.ToString()).SetValue(table_yd, null, null);
         }
         try
         {
             Common.Services.BaseService.Create("InsertPs_Table_220Result", table_yd);
         }
         catch (Exception ex)
         {
             MsgBox.Show("增加城区出错:" + ex.Message);
         }
         string ParId = "", Heid = "";
         string[] lei = new string[7] { "一、110千伏以下负荷", "二、110千伏直供负荷", "三、220千伏变电站低压侧供电负荷", "四、110千伏及以下地方电源出力", "五、外网110千伏及以下送入电力", "六、外网110千伏及以下送出电力", "七、220千伏供电负荷" };
         for (int k = 0; k < lei.Length; k++)
         {
             Ps_Table_220Result table1 = new Ps_Table_220Result();
             table1.ID += "|" + GetProjectID;
             table1.Title = lei[k];
             table1.ParentID = table_yd.ID;
             table1.ProjectID = GetProjectID;
             table1.Col1 = Convert.ToString(k + 1);
             if (k == 6)
             {
                 table1.Col1 = "no";
                 Heid = table1.ID;
             }
             if (k == 3)
                 ParId = table1.ID;//,table_yd.Title);
             table1.Sort = k + 1;
             try
             {
                 Common.Services.BaseService.Create("InsertPs_Table_220Result", table1);
             }
             catch (Exception ex)
             {
                 MsgBox.Show("增加项目出错:" + ex.Message);
             }
         }
         AddModelChild(ParId, table_yd.Title, Heid);
         this.Cursor = Cursors.WaitCursor;
         treeList1.BeginUpdate();
         //treeList1.ExpandAll();
         LoadData1();
         treeList1.EndUpdate();
         this.Cursor = Cursors.Default;
     }
 }
Beispiel #6
0
        public void AddTotalRow(ref IList list)
        {
            //合计
            string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";

            int[] year = GetYears();
            Ps_Table_220Result parent = new Ps_Table_220Result();
            parent.ID += "|" + GetProjectID;
            parent.ParentID = "0"; parent.Title = "220千伏合计"; parent.Sort = 1000;// OperTable.GetMaxSort() + 1;
            list.Add(parent);
            totoalParent = parent.ID;
            string[] lei = new string[7] { "一、110千伏供电负荷合计", "二、110千伏直供负荷", "三、220千伏变电站低压侧供电负荷", "四、110千伏及以下地方电源出力", "五、外网110千伏及以下送入电力", "六、外网110千伏及以下送出电力", "七、220千伏供电负荷" };
            for (int i = 0; i < lei.Length; i++)
            {
                conn = "Col1='"+Convert.ToString(i+1)+"' and ProjectID='" + GetProjectID + "'";
                string conn1 = "ProjectID='" + GetProjectID + "' and Col2='"+Convert.ToString(i+1)+"'";
                if (i == 6)
                {
                    conn = "Col1='no' and ProjectID='" + GetProjectID + "'";
                    conn1 = "ProjectID='" + GetProjectID + "' and Col2='no'";
                }
                Ps_Table_220Result table1 = new Ps_Table_220Result();
                table1.ID += "|" + GetProjectID;
                table1.Title = lei[i];
                table1.ParentID = parent.ID;
                table1.ProjectID = GetProjectID;
                table1.Col1 = Convert.ToString(i + 1);
                table1.BuildEd = "total";
                if (i == 6)
                    table1.Col1 = "no";
                IList tList = Common.Services.BaseService.GetList("SelectPs_Table_220ResultByConn", conn);
                for (int j = year[1]; j <= year[2]; j++)
                {
                    double first = 0.0, sec = 0.0;
                    for (int k = 0; k < tList.Count; k++)
                    {
                        first += double.Parse(((Ps_Table_220Result)tList[k]).GetType().GetProperty("yf" + j).GetValue((Ps_Table_220Result)tList[k], null).ToString());
                        sec += double.Parse(((Ps_Table_220Result)tList[k]).GetType().GetProperty("yk" + j).GetValue((Ps_Table_220Result)tList[k], null).ToString());
                    }
                    table1.GetType().GetProperty("yf" + j).SetValue(table1,first, null);
                    table1.GetType().GetProperty("yk" + j).SetValue(table1, sec, null);
                }
                table1.Sort = i + 1;
                list.Add(table1);
                //IList cList = Common.Services.BaseService.GetList("SelectPs_Table_220ResultByConn", conn1);
                //for (int j = 0; j < cList.Count; j++)
                //{
                //    Ps_Table_220Result tablex = new Ps_Table_220Result();
                //    tablex = (Ps_Table_220Result)((Ps_Table_220Result)cList[j]).Clone();
                //    tablex.BuildEd = "total";
                //    tablex.ParentID = table1.ID;
                //    list.Add(tablex);
                //}
            }
        }
Beispiel #7
0
 public void DelAll(string suid)
 {
     string conn = "ParentId='" + suid + "'";
     IList<Ps_Table_220Result> list = Common.Services.BaseService.GetList<Ps_Table_220Result>("SelectPs_Table_220ResultByConn", conn);
     if (list.Count > 0)
     {
         foreach (Ps_Table_220Result var in list)
         {
             string child = var.ID;
             DelAll(child);
             Ps_Table_220Result ny = new Ps_Table_220Result();
             ny.ID = child;
             Common.Services.BaseService.Delete(ny);
         }
     }
     else
         return;
 }
Beispiel #8
0
        private void barButtonItem9_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            if (!base.DeleteRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }
            if (treeList1.FocusedNode.GetValue("ParentID").ToString() != "0")
            {
                MsgBox.Show("此分类不是总分类!");
                return;
            }

            if (MsgBox.ShowYesNo("总分类及其下属分类都将删除,是否删除总分类 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes)
            {
                Ps_Table_220Result table1 = new Ps_Table_220Result();
                // Class1.TreeNodeToDataObject<PSP_Types>(psp_Type, treeList1.FocusedNode);
                table1.ID = treeList1.FocusedNode.GetValue("ID").ToString();
                DelAll(table1.ID);
                try
                {
                    //DeletePSP_ValuesByType里面删除数据和分类
                    Common.Services.BaseService.Delete<Ps_Table_220Result>(table1);//("DeletePs_Table_220Result", table1);

                    treeList1.DeleteNode(treeList1.FocusedNode);
                    //treeList1.ExpandAll();
                    //删除后,如果同级还有其它分类,则重新计算此类的所有年份数据

                }
                catch (Exception ex)
                {
                    //MsgBox.Show("删除出错:" + ex.Message);
                    this.Cursor = Cursors.WaitCursor;
                    treeList1.BeginUpdate();
                    LoadData();
                    treeList1.EndUpdate();
                    this.Cursor = Cursors.Default;
                }
            }
        }
Beispiel #9
0
        private bool SaveCellValue(string year, string typeID, double value)
        {
            Ps_Table_220Result psp = new Ps_Table_220Result();
            Ps_Table_220Result old = Common.Services.BaseService.GetOneByKey<Ps_Table_220Result>(typeID);
            psp = (Ps_Table_220Result)old.Clone();
            psp.GetType().GetProperty(year).SetValue(psp, Math.Round(value,1),null);

            try
            {
                Common.Services.BaseService.Update<Ps_Table_220Result>(psp);
            }
            catch(Exception ex)
            {
                MsgBox.Show("保存数据出错:" + ex.Message);
                return false;
            }
            return true;
        }
Beispiel #10
0
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            if (!base.DeleteRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }

            string nodestr = treeList1.FocusedNode.GetValue("Col1").ToString();
            if (nodestr == "1" || nodestr == "2" || nodestr == "3" || nodestr == "4" || nodestr == "5" || nodestr == "6" || nodestr == "no")
            {
                MsgBox.Show("固定分类不许删除!");
                return;
            }
            string parentid = treeList1.FocusedNode["ParentID"].ToString();

            if (treeList1.FocusedNode.HasChildren)
            {
                MsgBox.Show("此分类下有子分类,请先删除子分类!");
                return;
            }

            if(MsgBox.ShowYesNo("是否删除分类 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes)
            {
                Ps_Table_220Result table1 = new Ps_Table_220Result();
               // Class1.TreeNodeToDataObject<PSP_Types>(psp_Type, treeList1.FocusedNode);
                table1.ID = treeList1.FocusedNode.GetValue("ID").ToString();

                try
                {
                    //DeletePSP_ValuesByType里面删除数据和分类
                    Common.Services.BaseService.Delete <Ps_Table_220Result>(table1);//("DeletePs_Table_220Result", table1);

                    TreeListNode brotherNode = null;
                    if(treeList1.FocusedNode.ParentNode.Nodes.Count > 1)
                    {
                        brotherNode = treeList1.FocusedNode.PrevNode;
                        if(brotherNode == null)
                        {
                            brotherNode = treeList1.FocusedNode.NextNode;
                        }
                    }
                    treeList1.DeleteNode(treeList1.FocusedNode);

                    //删除后,如果同级还有其它分类,则重新计算此类的所有年份数据
                    if(brotherNode != null)
                    {
                        foreach(TreeListColumn column in treeList1.Columns)
                        {
                            if (column.Caption.IndexOf("年") > 0)
                            {
                                CalculateSum(brotherNode, column);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    //MsgBox.Show("删除出错:" + ex.Message);
                    this.Cursor = Cursors.WaitCursor;
                    treeList1.BeginUpdate();
                    LoadData();
                    treeList1.EndUpdate();
                    this.Cursor = Cursors.Default;
                }
            }
        }
Beispiel #11
0
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!base.AddRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }
            Ps_YearRange range = yAnge;
            TreeListNode focusedNode = treeList1.FocusedNode;

            //if (focusedNode == null)
            //{
            //    return;
            //}

            FrmAddPN frm = new FrmAddPN();
            string ParId = "",Heid="";
            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Table_220Result table_yd = new Ps_Table_220Result();
                table_yd.ID += "|" + GetProjectID;
                table_yd.Title = frm.ParentName;
                table_yd.ParentID = "0";
                table_yd.Sort = OperTable.Get220ResultMaxSort() + 1;
                table_yd.ProjectID = GetProjectID;
                for (int i = range.BeginYear; i <= range.EndYear; i++)
                {
                    table_yd.GetType().GetProperty("yf" + i.ToString()).SetValue(table_yd, null, null);
                    table_yd.GetType().GetProperty("yk" + i.ToString()).SetValue(table_yd, null, null);
                }
                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_220Result", table_yd);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加城区出错:" + ex.Message);
                }
                string[] lei = new string[7] { "一、110千伏以下负荷", "二、110千伏直供负荷","三、220千伏变电站低压侧供电负荷","四、110千伏及以下地方电源出力", "五、外网110千伏及以下送入电力", "六、外网110千伏及以下送出电力", "七、220千伏供电负荷" };
                for (int i = 0; i < lei.Length; i++)
                {
                    Ps_Table_220Result table1 = new Ps_Table_220Result();
                    table1.ID += "|" + GetProjectID;
                    table1.Title = lei[i];
                    table1.ParentID = table_yd.ID;
                    table1.ProjectID = GetProjectID;
                    table1.Col1 = Convert.ToString(i+1);
                    if (i == 6)
                    {
                        table1.Col1 = "no";
                        Heid = table1.ID;
                    }
                    if (i == 3)
                        ParId = table1.ID;//,table_yd.Title);
                    table1.Sort = i+1;
                    try
                    {
                        Common.Services.BaseService.Create("InsertPs_Table_220Result", table1);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("增加项目出错:" + ex.Message);
                    }
                }
                AddModelChild(ParId, table_yd.Title, Heid);
                this.Cursor = Cursors.WaitCursor;
                treeList1.BeginUpdate();
                //treeList1.ExpandAll();
                LoadData1();
                FoucsLocation(table_yd.ID, treeList1.Nodes);
                treeList1.EndUpdate();
                this.Cursor = Cursors.Default;
            }
        }
Beispiel #12
0
        private void AddArea(string Areaname)
        {
            Ps_YearRange range = yAnge;
            Ps_Table_220Result table_yd = new Ps_Table_220Result();
            table_yd.ID += "|" + GetProjectID;
            table_yd.BuildYear = "1.9";
            table_yd.Title = Areaname;
            table_yd.ParentID = "0";
            table_yd.Sort = OperTable.Get220ResultMaxSort() + 1;
            table_yd.ProjectID = GetProjectID;
            for (int i = range.BeginYear; i <= range.EndYear; i++)
            {
                table_yd.GetType().GetProperty("yf" + i.ToString()).SetValue(table_yd, null, null);
                table_yd.GetType().GetProperty("yk" + i.ToString()).SetValue(table_yd, null, null);
            }
            try
            {
                Common.Services.BaseService.Create("InsertPs_Table_220Result", table_yd);
            }
            catch (Exception ex)
            {
                MsgBox.Show("增加城区出错:" + ex.Message);
            }
            // string[] lei = new string[7] { "一、110千伏以下负荷", "二、110千伏直供负荷","三、220千伏变电站低压侧供电负荷","四、110千伏及以下地方电源出力", "五、外网110千伏及以下送入电力", "六、外网110千伏及以下送出电力", "七、220千伏供电负荷" };
            string[] lei = new string[11] { "1、全社会最高负荷", "2、220kV以下电源", "3、直供负荷", "4、外区供电", "5、区内电源出力", "6、需220kV变电供电负荷", "7、需220kV主变容量", "8、安排220kV变电容量", "9、实际220kV容载比", "10、变电容量盈亏", "11、变电站个数" };

            for (int i = 0; i < lei.Length; i++)
            {
                Ps_Table_220Result table1 = new Ps_Table_220Result();
                table1.ID += "|" + GetProjectID;
                table1.Title = lei[i];
                table1.ParentID = table_yd.ID;
                table1.ProjectID = GetProjectID;
                table1.Col3 = Convert.ToString(i + 1);
                table1.Col1 = "no";
                if (i==0||i == 2 || i == 3)
                {
                    table1.Col1 = "";
                }
                //2、220kV以下电源
                if (i == 1 || i == 4 || i == 7 || i == 10)
                {
                    table1.Col1 = "no";
                }

                table1.Sort = i + 1;
                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_220Result", table1);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
            }
            UpdataDY(table_yd.ID);
            UpDataRL(table_yd.ID);
            UpDataBDZ(table_yd.ID);
            UpData(table_yd.ID);

            this.Cursor = Cursors.WaitCursor;
            treeList1.BeginUpdate();
            //treeList1.ExpandAll();
            LoadData1();
            FoucsLocation(table_yd.ID, treeList1.Nodes);
            treeList1.EndUpdate();
            this.Cursor = Cursors.Default;
        }
Beispiel #13
0
        /// <summary>
        /// 更新容量
        /// </summary>
        /// <param name="ParentID"></param>
        public void UpDataRL(string ParentID)
        {
            Hashtable rtable = new Hashtable();
            Ps_Table_220Result pt = Common.Services.BaseService.GetOneByKey<Ps_Table_220Result>(ParentID);
            string AreaName = pt.Title;

            string conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ParentID + "'";

            Ps_Table_220Result col8;

            IList<Ps_Table_220Result> listchild = Common.Services.BaseService.GetList<Ps_Table_220Result>("SelectPs_Table_220ResultByConn", conn);
            for (int i = 0; i < listchild.Count; i++)
            {
                rtable.Add(listchild[i].Col3, listchild[i]);
            }
            col8 = (Ps_Table_220Result)rtable["8"];

            //删除其下的
            string conncol8 = "ProjectID='" + GetProjectID + "' and ParentID='" + col8.ID + "'";

            IList<Ps_Table_220Result> col8list = Common.Services.BaseService.GetList<Ps_Table_220Result>("SelectPs_Table_220ResultByConn", conncol8);
            foreach (Ps_Table_220Result ptr in col8list)
            {
                Common.Services.BaseService.Delete<Ps_Table_220Result>(ptr);
            }

            //更新安排220kV变电容量

            string conn1 = " AreaID='" + GetProjectID + "' and AreaName='" + AreaName + "' and L1=220";
            IList<PSP_Substation_Info> list = Common.Services.BaseService.GetList<PSP_Substation_Info>("SelectPSP_Substation_InfoListByWhere", conn1);

            int startyear = yAnge.BeginYear;
            int endyear = yAnge.EndYear;

            int startyear2 = yAnge.BeginYear;
            int endyear2 = yAnge.EndYear;

            double yf = 0;
            double yk = 0;
            for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
            {
                col8.GetType().GetProperty("yf" + i.ToString()).SetValue(col8, 0, null);
                col8.GetType().GetProperty("yk" + i.ToString()).SetValue(col8, 0, null);
            }
            for (int j = 0; j < list.Count; j++)
            {
                string dyid = list[j].UID;
                Ps_Table_220Result newdy = new Ps_Table_220Result();
                newdy.ParentID = col8.ID;
                newdy.ProjectID = GetProjectID;
                newdy.Col1 = "no";
                newdy.Title = list[j].Title;

                startyear = yAnge.BeginYear;
                endyear = yAnge.EndYear;

                if (list[j].S2 != string.Empty)
                {
                    int.TryParse(list[j].S2, out startyear);
                }
                if (list[j].L29 != string.Empty)
                {
                    int.TryParse(list[j].L29, out endyear);
                }

                string connjz = " where SvgUID ='" + dyid + "' and (Type='02'  or Type='03')";
                IList<PSPDEV> listatt = Common.Services.BaseService.GetList<PSPDEV>("SelectPSPDEVByCondition", connjz);

                for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                {

                    //变电站下是否有机组容量,如果没有机组则直接用源的容量,如果有机组,将所有机组按年份计算求和
                    if (listatt.Count > 0)
                    {
                        for (int k = 0; k < listatt.Count; k++)
                        {
                            startyear2 = yAnge.BeginYear;
                            endyear2 = yAnge.EndYear;

                            if (listatt[k].OperationYear != string.Empty)
                            {
                                int.TryParse(listatt[k].OperationYear, out startyear2);
                            }
                            if (listatt[k].Date2 != string.Empty)
                            {
                                int.TryParse(listatt[k].Date2, out endyear2);
                            }

                            if (startyear2 <= i && i < endyear2)
                            {
                                double dyf = double.Parse(newdy.GetType().GetProperty("yf" + i.ToString()).GetValue(newdy, null).ToString());
                                double dyk = double.Parse(newdy.GetType().GetProperty("yk" + i.ToString()).GetValue(newdy, null).ToString());

                                if (listatt[k].Type == "02")
                                {
                                    double tempdb = double.Parse(listatt[k].Burthen.ToString());
                                    // 累计机组容量
                                    newdy.GetType().GetProperty("yf" + i.ToString()).SetValue(newdy, Math.Round(dyf + tempdb, 2), null);
                                    newdy.GetType().GetProperty("yk" + i.ToString()).SetValue(newdy, Math.Round(dyk + tempdb, 2), null);
                                }
                                else
                                {
                                    double tempdb = listatt[k].SiN;
                                    // 累计机组容量
                                    newdy.GetType().GetProperty("yf" + i.ToString()).SetValue(newdy, Math.Round(dyf + tempdb, 2), null);
                                    newdy.GetType().GetProperty("yk" + i.ToString()).SetValue(newdy, Math.Round(dyk + tempdb, 2), null);
                                }

                            }

                        }

                    }
                    else
                    {
                        if (startyear <= i && i < endyear)
                        {

                            newdy.GetType().GetProperty("yf" + i.ToString()).SetValue(newdy, Math.Round(list[j].L2, 2), null);
                            newdy.GetType().GetProperty("yk" + i.ToString()).SetValue(newdy, Math.Round(list[j].L2, 2), null);

                        }
                    }

                    double d8f = double.Parse(col8.GetType().GetProperty("yf" + i.ToString()).GetValue(col8, null).ToString());
                    double d8k = double.Parse(col8.GetType().GetProperty("yk" + i.ToString()).GetValue(col8, null).ToString());

                    double ddyf = double.Parse(newdy.GetType().GetProperty("yf" + i.ToString()).GetValue(newdy, null).ToString());
                    double ddyk = double.Parse(newdy.GetType().GetProperty("yk" + i.ToString()).GetValue(newdy, null).ToString());

                    col8.GetType().GetProperty("yf" + i.ToString()).SetValue(col8, Math.Round(d8f + ddyf, 2), null);
                    col8.GetType().GetProperty("yk" + i.ToString()).SetValue(col8, Math.Round(d8k + ddyk, 2), null);
                }

                Common.Services.BaseService.Create<Ps_Table_220Result>(newdy);
            }
            Common.Services.BaseService.Update<Ps_Table_220Result>(col8);
        }
Beispiel #14
0
        /// <summary>
        /// 更新电源
        /// </summary>
        /// <param name="ParentID"></param>
        public void UpdataDY(string ParentID)
        {
            Hashtable rtable = new Hashtable();
            Ps_Table_220Result pt = Common.Services.BaseService.GetOneByKey<Ps_Table_220Result>(ParentID);
            string AreaName = pt.Title;

            string conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ParentID + "'";

            Ps_Table_220Result col2, col5;

            IList<Ps_Table_220Result> listchild = Common.Services.BaseService.GetList<Ps_Table_220Result>("SelectPs_Table_220ResultByConn", conn);
            for (int i = 0; i < listchild.Count; i++)
            {
                rtable.Add(listchild[i].Col3, listchild[i]);
            }
            col2 = (Ps_Table_220Result)rtable["2"];

            //删除其下的
            string conncol2 = "ProjectID='" + GetProjectID + "' and ParentID='" + col2.ID + "'";

            IList<Ps_Table_220Result> col2list = Common.Services.BaseService.GetList<Ps_Table_220Result>("SelectPs_Table_220ResultByConn", conncol2);
            foreach (Ps_Table_220Result ptr in col2list)
            {
                Common.Services.BaseService.Delete<Ps_Table_220Result>(ptr);
            }

            col5 = (Ps_Table_220Result)rtable["5"];

            //更新220kV以下电源  更新 5、区内电源出力
            //
            string conn1 = " AreaID='" + GetProjectID + "' and S9='" + AreaName + "' and cast(S1 as int)<220";
            IList<PSP_PowerSubstation_Info> list = Common.Services.BaseService.GetList<PSP_PowerSubstation_Info>("SelectPSP_PowerSubstation_InfoListByWhere", conn1);

            int startyear = yAnge.BeginYear;
            int endyear = yAnge.EndYear;

            int startyear2 = yAnge.BeginYear;
            int endyear2 = yAnge.EndYear;

            double yf = 0;
            double yk = 0;
            for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
            {
                col2.GetType().GetProperty("yf" + i.ToString()).SetValue(col2, 0, null);
                col2.GetType().GetProperty("yk" + i.ToString()).SetValue(col2, 0, null);

                col5.GetType().GetProperty("yf" + i.ToString()).SetValue(col5, 0, null);
                col5.GetType().GetProperty("yk" + i.ToString()).SetValue(col5, 0, null);
            }

            for (int j = 0; j < list.Count; j++)
            {
                string dyid = list[j].UID;
                Ps_Table_220Result newdy = new Ps_Table_220Result();
                newdy.ParentID = col2.ID;
                newdy.ProjectID = GetProjectID;
                newdy.Col1 = "no";
                newdy.Title = list[j].Title;

                startyear = yAnge.BeginYear;
                endyear = yAnge.EndYear;

                if (list[j].S2 != string.Empty)
                {
                    int.TryParse(list[j].S2, out startyear);
                }
                if (list[j].S30 != string.Empty)
                {
                    int.TryParse(list[j].S30, out endyear);
                }

                string connjz = " where SvgUID ='" + dyid + "' and Type='04'";
                IList<PSPDEV> listatt = Common.Services.BaseService.GetList<PSPDEV>("SelectPSPDEVByCondition", connjz);
                for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                {
                    //电源下是否有机组容量,如果没有机组则直接用源的容量,如果有机组,将所有机组按年份计算求和
                    if (listatt.Count > 0)
                    {
                        for (int k = 0; k < listatt.Count; k++)
                        {
                            startyear2 = yAnge.BeginYear;
                            endyear2 = yAnge.EndYear;
                            if (listatt[k].OperationYear != string.Empty)
                            {
                                int.TryParse(listatt[k].OperationYear, out startyear2);
                            }
                            if (listatt[k].Date2 != string.Empty)
                            {
                                int.TryParse(listatt[k].Date2, out endyear2);
                            }

                            if (startyear2 <= i && i < endyear2)
                            {
                                double dyf = double.Parse(newdy.GetType().GetProperty("yf" + i.ToString()).GetValue(newdy, null).ToString());
                                double dyk = double.Parse(newdy.GetType().GetProperty("yk" + i.ToString()).GetValue(newdy, null).ToString());
                                // 累计机组容量

                                double tempdb = listatt[k].P0;

                                newdy.GetType().GetProperty("yf" + i.ToString()).SetValue(newdy, Math.Round(dyf + tempdb, 2), null);
                                newdy.GetType().GetProperty("yk" + i.ToString()).SetValue(newdy, Math.Round(dyk + tempdb, 2), null);

                                double d5f = double.Parse(col5.GetType().GetProperty("yf" + i.ToString()).GetValue(col5, null).ToString());
                                double d5k = double.Parse(col5.GetType().GetProperty("yk" + i.ToString()).GetValue(col5, null).ToString());
                                // 累计机组容量*丰期机组出力率  或枯期机组出力率

                                col5.GetType().GetProperty("yf" + i.ToString()).SetValue(col5, Math.Round(d5f + tempdb * listatt[k].HuganTQ1, 2), null);
                                col5.GetType().GetProperty("yk" + i.ToString()).SetValue(col5, Math.Round(d5k + tempdb * listatt[k].HuganTQ2, 2), null);

                            }

                        }

                    }
                    else
                    {
                        if (startyear <= i && i < endyear)
                        {
                            double.TryParse(list[j].S2, out yf);
                            newdy.GetType().GetProperty("yf" + i.ToString()).SetValue(newdy, Math.Round(yf, 2), null);
                            newdy.GetType().GetProperty("yk" + i.ToString()).SetValue(newdy, Math.Round(yf, 2), null);
                            double d5f = double.Parse(col5.GetType().GetProperty("yf" + i.ToString()).GetValue(col5, null).ToString());
                            double d5k = double.Parse(col5.GetType().GetProperty("yk" + i.ToString()).GetValue(col5, null).ToString());

                            col5.GetType().GetProperty("yf" + i.ToString()).SetValue(col5, Math.Round(d5f + yf, 2), null);
                            col5.GetType().GetProperty("yk" + i.ToString()).SetValue(col5, Math.Round(d5k + yf, 2), null);

                        }
                    }

                    double d2f = double.Parse(col2.GetType().GetProperty("yf" + i.ToString()).GetValue(col2, null).ToString());
                    double d2k = double.Parse(col2.GetType().GetProperty("yk" + i.ToString()).GetValue(col2, null).ToString());

                    double ddyf = double.Parse(newdy.GetType().GetProperty("yf" + i.ToString()).GetValue(newdy, null).ToString());
                    double ddyk = double.Parse(newdy.GetType().GetProperty("yk" + i.ToString()).GetValue(newdy, null).ToString());

                    col2.GetType().GetProperty("yf" + i.ToString()).SetValue(col2, Math.Round(d2f + ddyf, 2), null);
                    col2.GetType().GetProperty("yk" + i.ToString()).SetValue(col2, Math.Round(d2k + ddyk, 2), null);
                }

                Common.Services.BaseService.Create<Ps_Table_220Result>(newdy);
            }
            Common.Services.BaseService.Update<Ps_Table_220Result>(col2);
            Common.Services.BaseService.Update<Ps_Table_220Result>(col5);
        }
Beispiel #15
0
        /// <summary>
        /// 更新变电站
        /// </summary>
        /// <param name="ParentID"></param>
        public void UpDataBDZ(string ParentID)
        {
            Hashtable rtable = new Hashtable();
            Ps_Table_220Result pt = Common.Services.BaseService.GetOneByKey<Ps_Table_220Result>(ParentID);
            string AreaName = pt.Title;

            string conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ParentID + "'";

            Ps_Table_220Result col11;

            IList<Ps_Table_220Result> listchild = Common.Services.BaseService.GetList<Ps_Table_220Result>("SelectPs_Table_220ResultByConn", conn);
            for (int i = 0; i < listchild.Count; i++)
            {
                rtable.Add(listchild[i].Col3, listchild[i]);
            }
            col11 = (Ps_Table_220Result)rtable["11"];

            //删除其下的
            string conncol11 = "ProjectID='" + GetProjectID + "' and ParentID='" + col11.ID + "'";

            IList<Ps_Table_220Result> col11list = Common.Services.BaseService.GetList<Ps_Table_220Result>("SelectPs_Table_220ResultByConn", conncol11);
            foreach (Ps_Table_220Result ptr in col11list)
            {
                Common.Services.BaseService.Delete<Ps_Table_220Result>(ptr);
            }

            //更新变电站数量  11.变电站个数

            int startyear = yAnge.BeginYear;
            int endyear = yAnge.EndYear;

            int startyear2 = yAnge.BeginYear;
            int endyear2 = yAnge.EndYear;

            Ps_Table_220Result yybdz = new Ps_Table_220Result();
            yybdz.Title = "已有变电站";
            yybdz.ProjectID = GetProjectID;
            yybdz.Col1 = "no";
            yybdz.Sort = 0;
            yybdz.ParentID = col11.ID;

            Ps_Table_220Result xzbdz = new Ps_Table_220Result();
            xzbdz.Title = "新增变电站";
            xzbdz.ProjectID = GetProjectID;
            xzbdz.Col1 = "no";
            xzbdz.Sort = 1;
            xzbdz.ParentID = col11.ID;

            for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
            {
                //已有变电站
                string conn1 = " AreaID='" + GetProjectID + "' and AreaName='" + AreaName + "' and L1=220  and cast(S2 as int)<" + i;
                IList<PSP_Substation_Info> list1 = Common.Services.BaseService.GetList<PSP_Substation_Info>("SelectPSP_Substation_InfoListByWhere", conn1);

                int yybdznumber = 0;

                for (int j = 0; j < list1.Count; j++)
                {

                    string dyid = list1[j].UID;
                    //string connjz = " RelatetableID ='" + dyid + "' and (S2='新建' or S2='扩容')";

                    //IList<Psp_Attachtable> listatt = Common.Services.BaseService.GetList<Psp_Attachtable>("SelectPsp_AttachtableByCont", connjz);

                    string connjz = " where SvgUID ='" + dyid + "' and (Type='02'  or Type='03')";
                    IList<PSPDEV> listatt = Common.Services.BaseService.GetList<PSPDEV>("SelectPSPDEVByCondition", connjz);

                    //如果变站下没有机组,则变电站有效
                    if (listatt.Count > 0)
                    {
                        int jznumber = 0;
                        //找到是否有指定年份还在使用的机组,如果有则变电站有效
                        for (int k = 0; k < listatt.Count; k++)
                        {
                            startyear2 = yAnge.BeginYear;
                            endyear2 = yAnge.EndYear;

                            if (listatt[k].OperationYear != string.Empty)
                            {
                                int.TryParse(listatt[k].OperationYear, out startyear2);
                            }
                            if (listatt[k].Date2 != string.Empty)
                            {
                                int.TryParse(listatt[k].Date2, out endyear2);
                            }
                            if (startyear2 <= i && i <= endyear2)
                            {
                                jznumber++;
                                break;
                            }
                        }
                        if (jznumber > 0)
                        {
                            yybdznumber++;
                        }

                    }
                    else
                    {
                        yybdznumber++;
                    }

                }
                yybdz.GetType().GetProperty("yf" + i.ToString()).SetValue(yybdz, yybdznumber, null);
                yybdz.GetType().GetProperty("yk" + i.ToString()).SetValue(yybdz, yybdznumber, null);

                //新增变电站
                string conn2 = " AreaID='" + GetProjectID + "' and AreaName='" + AreaName + "' and L1=220  and cast(S2 as int)=" + i;
                IList<PSP_Substation_Info> list2 = Common.Services.BaseService.GetList<PSP_Substation_Info>("SelectPSP_Substation_InfoListByWhere", conn2);
                int xzbdznumber = 0;

                for (int j = 0; j < list2.Count; j++)
                {

                    string dyid = list2[j].UID;
                    //string connjz = " RelatetableID ='" + dyid + "' and (S2='新建' or S2='扩容')";

                    //IList<Psp_Attachtable> listatt = Common.Services.BaseService.GetList<Psp_Attachtable>("SelectPsp_AttachtableByCont", connjz);

                    string connjz = " where SvgUID ='" + dyid + "' and (Type='02'  or Type='03')";
                    IList<PSPDEV> listatt = Common.Services.BaseService.GetList<PSPDEV>("SelectPSPDEVByCondition", connjz);

                    //如果变站下没有机组,则变电站有效
                    if (listatt.Count > 0)
                    {
                        int jznumber = 0;
                        //找到是否有指定年份还在使用的机组,如果有则变电站有效
                        for (int k = 0; k < listatt.Count; k++)
                        {
                            startyear2 = yAnge.BeginYear;
                            endyear2 = yAnge.EndYear;

                            if (listatt[k].OperationYear != string.Empty)
                            {
                                int.TryParse(listatt[k].OperationYear, out startyear2);
                            }
                            if (listatt[k].Date2 != string.Empty)
                            {
                                int.TryParse(listatt[k].Date2, out endyear2);
                            }
                            if (startyear2 <= i && i <= endyear2)
                            {
                                jznumber++;
                                break;
                            }
                        }
                        if (jznumber > 0)
                        {
                            xzbdznumber++;
                        }

                    }
                    else
                    {
                        xzbdznumber++;
                    }

                }
                xzbdz.GetType().GetProperty("yf" + i.ToString()).SetValue(xzbdz, xzbdznumber, null);
                xzbdz.GetType().GetProperty("yk" + i.ToString()).SetValue(xzbdz, xzbdznumber, null);

                col11.GetType().GetProperty("yf" + i.ToString()).SetValue(col11, yybdznumber + xzbdznumber, null);
                col11.GetType().GetProperty("yk" + i.ToString()).SetValue(col11, yybdznumber + xzbdznumber, null);

            }

            Common.Services.BaseService.Create<Ps_Table_220Result>(yybdz);
            Common.Services.BaseService.Create<Ps_Table_220Result>(xzbdz);
            Common.Services.BaseService.Update<Ps_Table_220Result>(col11);
        }
Beispiel #16
0
        private void Autofpfh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Dictionary <string, Ps_Table_220Result>           dic220;
            Dictionary <string, Ps_Table_110Result>           dic110;
            Dictionary <string, IList <PSP_Substation_Info> > sub220list;
            Dictionary <string, IList <PSP_Substation_Info> > sub110list;

            if (string.IsNullOrEmpty(parentobj.BelongYear))
            {
                parentobj.BelongYear = DateTime.Now.Year.ToString();
            }
            double    tsl = 1;
            FrmAutofh fa  = new FrmAutofh();

            fa.BelongYear = parentobj.BelongYear;
            if (fa.ShowDialog() == DialogResult.OK)
            {
                dic220     = fa.Dic220;
                dic110     = fa.Dic110;
                tsl        = fa.TSL;
                sub110list = fa.Sub110list;
                sub220list = fa.Sub220list;
                List <string> listarea = fa.ListArea;
                //找出此卷下的所有变电站下的 负荷 或者是输出有功 无功为有功的1/3
                for (int i = 0; i < listarea.Count; i++)
                {
                    //该变电站下同电压等级的负荷
                    Dictionary <PSP_Substation_Info, IList <PSPDEV> > dicfh = new Dictionary <PSP_Substation_Info, IList <PSPDEV> >();
                    double sumbdzrl = 0;
                    double Fhfpz    = 0;
                    //如果110平衡表存在该地区的则只进行该地区的计算
                    if (dic110.ContainsKey(listarea[i]))
                    {
                        Ps_Table_110Result p110  = dic110[listarea[i]];
                        double             qshfh = (double)p110.GetType().GetProperty("yf" + parentobj.BelongYear).GetValue(p110, null);
                        if (qshfh == 0)
                        {
                            continue;
                        }
                        double zgfh = 0;
                        if (sub110list.ContainsKey(listarea[i]))  //存在变电站
                        {
                            // 找出220kv变电站的直供负荷
                            double zgfh220 = 0;
                            if (sub220list.ContainsKey(listarea[i]))
                            {
                                for (int j = 0; j < sub220list[listarea[i]].Count; j++)
                                {
                                    //string con = "where SvgUID='" + sub220list[listarea[i]][j].UID + "'and Type='12' and ProjectID='" + Itop.Client.MIS.ProgUID + "'and VoltR='" + sub220list[listarea[i]][j].L1 + "'or  VoltR is null";
                                    //IList<PSPDEV> listfh = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", con);
                                    //for (int m = 0; m < listfh.Count; m++)
                                    //{
                                    //    zgfh220 += listfh[m].OutP;
                                    //}
                                    fpfhyj(sub220list[listarea[i]][j], ref zgfh220, ref dicfh);
                                }
                            }
                            dicfh = new Dictionary <PSP_Substation_Info, IList <PSPDEV> >();
                            //为110
                            for (int j = 0; j < sub110list[listarea[i]].Count; j++)
                            {
                                sumbdzrl += sub110list[listarea[i]][j].L2;
                                fpfhyj(sub110list[listarea[i]][j], ref zgfh, ref dicfh);
                                //string con = "where SvgUID='" + sub110list[listarea[i]][j].UID + "'and Type='12' and ProjectID='" + Itop.Client.MIS.ProgUID + "'and VoltR='" + sub110list[listarea[i]][j].L1 + "'or  VoltR is null";
                                //IList<PSPDEV> listfh = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", con);
                                //if (listfh.Count>0)
                                //{
                                //    dicfh.Add(sub110list[listarea[i]][j], listfh);
                                //}
                                //else
                                //    continue;
                                //for (int m = 0; m < listfh.Count;m++ )
                                //{
                                //    zgfh += listfh[m].OutP;
                                //}
                            }
                            Fhfpz = qshfh - zgfh - zgfh220;
                            if (Fhfpz <= 0)
                            {
                                continue;
                            }
                            for (int j = 0; j < sub110list[listarea[i]].Count; j++)
                            {
                                double fpl = 0;
                                fpl = ((sub110list[listarea[i]][j].L2 / sumbdzrl) * Fhfpz) / tsl;
                                int fhsum = dicfh[sub110list[listarea[i]][j]].Count;
                                foreach (PSPDEV fh in dicfh[sub110list[listarea[i]][j]])
                                {
                                    fh.InPutP = fpl / fhsum;
                                    fh.InPutQ = fpl / (3 * fhsum);
                                    UCDeviceBase.DataService.Update <PSPDEV>(fh);
                                }
                            }
                        }
                    }
                    else   //如果不存在
                    {
                        //判断220平衡表中的数据是否存在
                        if (dic220.ContainsKey(listarea[i]))
                        {
                            Ps_Table_220Result p220  = dic220[listarea[i]];
                            double             qshfh = (double)p220.GetType().GetProperty("yf" + parentobj.BelongYear).GetValue(p220, null);
                            if (qshfh == 0)
                            {
                                continue;
                            }
                            double zgfh = 0;
                            if (sub220list.ContainsKey(listarea[i]))  //存在变电站
                            {
                                //为220
                                for (int j = 0; j < sub220list[listarea[i]].Count; j++)
                                {
                                    sumbdzrl += sub220list[listarea[i]][j].L2;
                                    fpfhyj(sub220list[listarea[i]][j], ref zgfh, ref dicfh);
                                    //string con = "where SvgUID='" + sub220list[listarea[i]][j].UID + "'and Type='12' and ProjectID='" + Itop.Client.MIS.ProgUID + "'and VoltR='" + sub220list[listarea[i]][j].L1 + "'or  VoltR is null";
                                    //IList<PSPDEV> listfh = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", con);
                                    //if (listfh.Count > 0)
                                    //{
                                    //    dicfh.Add(sub220list[listarea[i]][j], listfh);
                                    //}
                                    //else
                                    //    continue;
                                    //for (int m = 0; m < listfh.Count; m++)
                                    //{
                                    //    zgfh += listfh[m].OutP;
                                    //}
                                }
                                Fhfpz = qshfh - zgfh;
                                if (Fhfpz <= 0)
                                {
                                    continue;
                                }
                                for (int j = 0; j < sub220list[listarea[i]].Count; j++)
                                {
                                    double fpl = 0;
                                    fpl = ((sub220list[listarea[i]][j].L2 / sumbdzrl) * Fhfpz) / tsl;
                                    int fhsum = dicfh[sub110list[listarea[i]][j]].Count;
                                    foreach (PSPDEV fh in dicfh[sub220list[listarea[i]][j]])
                                    {
                                        fh.InPutP = fpl / fhsum;
                                        fh.InPutQ = fpl / (3 * fhsum);
                                        UCDeviceBase.DataService.Update <PSPDEV>(fh);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }