示例#1
0
        /// <summary>
        /// 设备初始化
        /// </summary>
        public virtual void Init()
        {
            datatable1 = null;
            string con2 = " and ProjectID = '" + Itop.Client.MIS.ProgUID + "'";

            con = strCon + con + con2;
            IList list    = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
            IList listNew = new List <PSPDEV>();

            foreach (PSPDEV dev in list)
            {
                if (dev.Type == "01")
                {
                    if (dev.NodeType == "0")
                    {
                        dev.NodeType = "平衡节点";
                    }
                    else if (dev.NodeType == "1")
                    {
                        dev.NodeType = "PQ节点";
                    }
                    else if (dev.NodeType == "2")
                    {
                        dev.NodeType = "PV节点";
                    }
                }

                if (dev.KSwitchStatus == "1")
                {
                    dev.KSwitchStatus = "退出运行";
                }
                else
                {
                    dev.KSwitchStatus = "投入运行";
                }
                if (dev.UnitFlag == "0")
                {
                    dev.UnitFlag = "p.u.";
                }
                else
                {
                    if (dev.Type == "01" || dev.Type == "04" || dev.Type == "12")
                    {
                        dev.UnitFlag = "kV/MW/MVar";
                    }
                    else
                    {
                        dev.UnitFlag = "Ohm/10-6Siem";
                    }
                }
                if (dev.Type == "01")
                {
                    object obj = DeviceHelper.GetDevice <PSP_PowerSubstation_Info>(dev.SvgUID);
                    if (obj != null)
                    {
                        dev.SubstationName = ((PSP_PowerSubstation_Info)obj).Title;
                    }
                    obj = DeviceHelper.GetDevice <PSP_Substation_Info>(dev.SvgUID);
                    if (obj != null)
                    {
                        dev.SubstationName = ((PSP_Substation_Info)obj).Title;
                    }
                }
                else if (dev.Type == "12")
                {
                    if (dev.NodeType == "0")
                    {
                        dev.NodeType = "恒阻抗模型";
                    }
                    else
                    {
                        dev.NodeType = "综合负荷";
                    }
                }



                listNew.Add(dev);
            }
            datatable1 = Itop.Common.DataConverter.ToDataTable(listNew, typeof(PSPDEV));
            gridControl1.DataSource           = datatable1;
            gridControl1.UseEmbeddedNavigator = true;
            gridControl1.EmbeddedNavigator.Buttons.Append.Visible     = false;
            gridControl1.EmbeddedNavigator.Buttons.Edit.Visible       = false;
            gridControl1.EmbeddedNavigator.Buttons.Remove.Visible     = false;
            gridControl1.EmbeddedNavigator.Buttons.EndEdit.Visible    = false;
            gridControl1.EmbeddedNavigator.Buttons.CancelEdit.Visible = false;
            //创建一条开关数据 为了短路计算所用 如果没有则创建
            string sql = " where Type='07'and ProjectID='" + this.ProjectID + "' order by name";

            list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", sql);
            if (list.Count == 0)
            {
                PSPDEV dev = new PSPDEV();
                dev.Type          = "07";
                dev.Name          = "1";
                dev.Number        = 1;
                dev.KSwitchStatus = "0";
                dev.ProjectID     = this.ProjectID;
                UCDeviceBase.DataService.Create("InsertPSPDEV", dev);
            }
        }
示例#2
0
        public virtual void Statictable(string yearandtype)
        {
            //string constrvalue = " where  ProjectID='@@@@@#@@'";
            //valuelist = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", constrvalue);
            gridView1.CustomDrawCell += new DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventHandler(gridView1_CustomDrawCell);
            int            m        = 1;
            IList <double> templist = DY(yearandtype);

            valuelist = new List <PSPDEV>();
            if (templist.Count != 0)
            {
                for (int i = 0; i < templist.Count; i++)
                {
                    PSPDEV tempdev = new PSPDEV();
                    // tempdev.ProjectID = que[i];
                    tempdev.Name     = templist[i] + "设备";
                    tempdev.RateVolt = templist[i];
                    tempdev.Type     = "T";
                    m = 1;


                    valuelist.Add(tempdev);
                    string         constr   = " where  ProjectID='" + ProjectID + "' and  " + yearandtype + " and RateVolt=" + templist[i] + "   order by Name";
                    IList <PSPDEV> linelist = UCDeviceBase.DataService.GetList <PSPDEV>("SelectPSPDEVByCondition", constr);
                    for (int k = 0; k < linelist.Count; k++)
                    {
                        valuelist.Add(linelist[k]);
                    }
                }
            }
            else
            {
                PSPDEV tempdev = new PSPDEV();
                // tempdev.ProjectID = que[i];
                tempdev.Name = "设备";

                tempdev.Type = "T";
                m            = 1;
                string         constr   = " where  ProjectID='" + ProjectID + "' and  " + yearandtype + " order by Name";
                IList <PSPDEV> linelist = UCDeviceBase.DataService.GetList <PSPDEV>("SelectPSPDEVByCondition", constr);
                for (int k = 0; k < linelist.Count; k++)
                {
                    valuelist.Add(linelist[k]);
                }
            }
            IList listNew = new List <PSPDEV>();

            foreach (PSPDEV dev in valuelist)
            {
                if (dev.Type == "01")
                {
                    if (dev.NodeType == "0")
                    {
                        dev.NodeType = "平衡节点";
                    }
                    else if (dev.NodeType == "1")
                    {
                        dev.NodeType = "PQ节点";
                    }
                    else if (dev.NodeType == "2")
                    {
                        dev.NodeType = "PV节点";
                    }
                }

                if (dev.KSwitchStatus == "1")
                {
                    dev.KSwitchStatus = "退出运行";
                }
                else
                {
                    dev.KSwitchStatus = "投入运行";
                }
                if (dev.UnitFlag == "0")
                {
                    dev.UnitFlag = "p.u.";
                }
                else
                {
                    if (dev.Type == "01" || dev.Type == "04" || dev.Type == "12")
                    {
                        dev.UnitFlag = "kV/MW/MVar";
                    }
                    else
                    {
                        dev.UnitFlag = "Ohm/10-6Siem";
                    }
                }
                if (dev.Type == "01")
                {
                    object obj = DeviceHelper.GetDevice <PSP_PowerSubstation_Info>(dev.SvgUID);
                    if (obj != null)
                    {
                        dev.SubstationName = ((PSP_PowerSubstation_Info)obj).Title;
                    }
                    obj = DeviceHelper.GetDevice <PSP_Substation_Info>(dev.SvgUID);
                    if (obj != null)
                    {
                        dev.SubstationName = ((PSP_Substation_Info)obj).Title;
                    }
                }
                else if (dev.Type == "12")
                {
                    if (dev.NodeType == "0")
                    {
                        dev.NodeType = "恒阻抗模型";
                    }
                    else
                    {
                        dev.NodeType = "综合负荷";
                    }
                }



                listNew.Add(dev);
            }
            datatable1 = Itop.Common.DataConverter.ToDataTable(listNew, typeof(PSPDEV));
            gridControl1.DataSource = datatable1;
        }