Exemple #1
0
        public override void Add()
        {
            frmDYdlg dlg = new frmDYdlg();

            dlg.ProjectID = Itop.Client.MIS.ProgUID;
            dlg.czButtonVisble(true);
            dlg.Name = "";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                //增加记录
                PSP_PowerSubstation_Info dev = dlg.DeviceMx;
                dev.AreaID = Itop.Client.MIS.ProgUID;
                if (dlg.bcflag)  //说明已经创建
                {
                    DataService.Update <PSP_PowerSubstation_Info>(dev);
                }
                else
                {
                    DataService.Create <PSP_PowerSubstation_Info>(dev);
                }
                DataRow row = datatable1.NewRow();
                Itop.Common.DataConverter.ObjectToRow(dev, row);
                datatable1.Rows.Add(row);
            }
            else
            {
                if (dlg.bcflag)
                {
                    //增加记录
                    PSP_PowerSubstation_Info dev = dlg.DeviceMx;
                    dev.AreaID = Itop.Client.MIS.ProgUID;
                }
            }
        }
Exemple #2
0
        private void dycopy_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            object obj = curDevice.SelectedDevice;

            if (obj is PSP_PowerSubstation_Info)
            {
                FrmcopyDYtitle frmdy = new FrmcopyDYtitle();
                if (frmdy.ShowDialog() == DialogResult.OK)
                {
                    PSP_PowerSubstation_Info obj1 = new PSP_PowerSubstation_Info();
                    Itop.Common.DataConverter.CopyTo <PSP_PowerSubstation_Info>(obj as PSP_PowerSubstation_Info, obj1);
                    obj1.UID   = Guid.NewGuid().ToString().Substring(24);
                    obj1.Title = frmdy.DYTitle;
                    UCDeviceBase.DataService.Create <PSP_PowerSubstation_Info>(obj1);
                    IList <PSPDEV> listmx = UCDeviceBase.DataService.GetList <PSPDEV>("SelectPSPDEVByCondition", "where 1=1 and SvgUID='" + ((PSP_PowerSubstation_Info)obj).UID + "'and type='01'");
                    int            number = 0;
                    foreach (PSPDEV pd in listmx)
                    {
                        number++;
                        PSPDEV pv = new PSPDEV();
                        Itop.Common.DataConverter.CopyTo <PSPDEV>(pd, pv);
                        pv.SUID   = Guid.NewGuid().ToString();
                        pv.Name   = frmdy.DYTitle + "G" + number;
                        pv.SvgUID = obj1.UID;
                        UCDeviceBase.DataService.Create <PSPDEV>(pv);
                    }
                    number = 0;
                    IList <PSPDEV> listbyq = UCDeviceBase.DataService.GetList <PSPDEV>("SelectPSPDEVByCondition", "where 1=1 and SvgUID='" + ((PSP_PowerSubstation_Info)obj).UID + "'and type='02'");
                    foreach (PSPDEV pd in listbyq)
                    {
                        number++;
                        PSPDEV pv = new PSPDEV();
                        Itop.Common.DataConverter.CopyTo <PSPDEV>(pd, pv);
                        pv.SUID   = Guid.NewGuid().ToString();
                        pv.Name   = frmdy.DYTitle + "-变压器" + number;
                        pv.SvgUID = obj1.UID;
                        pv.IName  = "";
                        pv.JName  = "";
                        UCDeviceBase.DataService.Create <PSPDEV>(pv);
                    }
                    number = 0;
                    IList <PSPDEV> listfdj = UCDeviceBase.DataService.GetList <PSPDEV>("SelectPSPDEVByCondition", "where 1=1 and SvgUID='" + ((PSP_PowerSubstation_Info)obj).UID + "'and type='04'");
                    foreach (PSPDEV pd in listfdj)
                    {
                        number++;
                        PSPDEV pv = new PSPDEV();
                        Itop.Common.DataConverter.CopyTo <PSPDEV>(pd, pv);
                        pv.SUID   = Guid.NewGuid().ToString();
                        pv.Name   = frmdy.DYTitle + "-发电机" + number;
                        pv.SvgUID = obj1.UID;
                        pv.IName  = "";
                        UCDeviceBase.DataService.Create <PSPDEV>(pv);
                    }
                }
            }
            curDevice.Init();
        }
Exemple #3
0
        private void simpleButton5_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(devObj.Title))
            {
                MessageBox.Show("名称不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(devObj.S3))
            {
                MessageBox.Show("请选择投产时间!");
                return;
            }
            if (Convert.ToDouble(spinEdit1.Value) == 0)
            {
                MessageBox.Show("请填写电压等级!");
                return;
            }
            PSP_PowerSubstation_Info obj = UCDeviceBase.DataService.GetOneByKey <PSP_PowerSubstation_Info>(DeviceMx);

            if (obj == null)
            {
                UCDeviceBase.DataService.Create <PSP_PowerSubstation_Info>(DeviceMx);
            }
            double rl  = 0;
            int    bts = 0;
            frmDeviceManager_children frmc = new frmDeviceManager_children();

            frmc.ParentObj = DeviceMx;
            string[] types = new string[] { "01", "02", "04" };
            frmc.childrendevice(types);
            if (frmc.DialogResult == DialogResult.OK)
            {
                string where = "where projectid='" + Itop.Client.MIS.ProgUID + "'and type='04'and SvgUID='" + DeviceMx.UID + "'";
                IList <PSPDEV> list = Services.BaseService.GetList <PSPDEV>("SelectPSPDEVByCondition", where);
                foreach (PSPDEV pd in list)
                {
                    if (!string.IsNullOrEmpty(pd.OperationYear) && !string.IsNullOrEmpty(pd.Date2) && pd.Date2.Length == 4 && !string.IsNullOrEmpty(DeviceMx.S29) && !string.IsNullOrEmpty(DeviceMx.S30))
                    {
                        if (Convert.ToInt32(pd.OperationYear) >= Convert.ToInt32(DeviceMx.S29) && Convert.ToInt32(pd.Date2) <= Convert.ToInt32(DeviceMx.S30))
                        {
                            rl += pd.P0;
                            bts++;
                        }
                    }
                    else
                    {
                        rl += pd.P0;
                        bts++;
                    }
                }
                if (list.Count > 0)
                {
                    spinEdit2.Value = (decimal)rl;
                }
            }
        }
Exemple #4
0
 public override void UpdateIn(DataTable table)
 {
     for (int i = 0; i < table.Rows.Count; i++)
     {
         if (table.Rows[i][0].ToString().IndexOf("合计") > 0 || table.Rows[i][1].ToString().IndexOf("合计") > 0)
         {
             continue;
         }
         PSP_PowerSubstation_Info area = new PSP_PowerSubstation_Info();
         area.UID       += "|" + ProjectID;
         area.AreaID     = ProjectID;
         area.CreateDate = DateTime.Now;
         foreach (DataColumn col in table.Columns)
         {
             try
             {
                 if (table.Rows[i][col] != null)
                 {
                     string inserted = table.Rows[i][col].ToString();
                     if (inserted == "规划" || inserted == "现状")
                     {
                         area.GetType().GetProperty("Flag").SetValue(area, inserted == "规划" ? "2" : "1", null);
                     }
                     else
                     {
                         Type type = area.GetType().GetProperty(col.ColumnName).PropertyType;//.GetValue(area, null).GetType();
                         if (type == typeof(int))
                         {
                             area.GetType().GetProperty(col.ColumnName).SetValue(area, int.Parse(inserted == "" ? "0" : inserted), null);
                         }
                         else if (type == typeof(string))
                         {
                             area.GetType().GetProperty(col.ColumnName).SetValue(area, inserted, null);
                         }
                         else if (type == typeof(decimal))
                         {
                             area.GetType().GetProperty(col.ColumnName).SetValue(area, decimal.Parse(inserted == "" ? "0" : inserted), null);
                         }
                         else if (type == typeof(double))
                         {
                             area.GetType().GetProperty(col.ColumnName).SetValue(area, double.Parse(inserted == "" ? "0.0" : inserted), null);
                         }
                         else if (type == typeof(DateTime))
                         {
                         }
                     }
                 }
             }
             catch { MessageBox.Show(string.Format("第{0}行{1}列插入有问题", i.ToString(), col.Caption)); }
         }
         DataService.Create <PSP_PowerSubstation_Info>(area);
     }
 }
Exemple #5
0
        private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e)
        {
            int ihand = gridView1.FocusedRowHandle;

            if (ihand < 0)
            {
                return;
            }
            DataRow dr = gridView1.GetDataRow(ihand);
            PSP_PowerSubstation_Info pj = Itop.Common.DataConverter.RowToObject <PSP_PowerSubstation_Info>(dr);
            double rl  = 0;
            int    bts = 0;
            frmDeviceManager_children frmc = new frmDeviceManager_children();

            frmc.ParentObj = pj;
            string[] types = new string[] { "01", "02", "04" };
            frmc.childrendevice(types);
            if (frmc.DialogResult == DialogResult.OK)
            {
                string where = "where projectid='" + Itop.Client.MIS.ProgUID + "'and type='04'and SvgUID='" + pj.UID + "'";
                IList <PSPDEV> list = UCDeviceBase.DataService.GetList <PSPDEV>("SelectPSPDEVByCondition", where);
                foreach (PSPDEV pd in list)
                {
                    if (!string.IsNullOrEmpty(pd.OperationYear) && !string.IsNullOrEmpty(pd.Date2) && pd.Date2.Length == 4 && !string.IsNullOrEmpty(pj.S30) && !string.IsNullOrEmpty(pj.S29))
                    {
                        if (Convert.ToInt32(pd.OperationYear) >= Convert.ToInt32(pj.S29) && Convert.ToInt32(pd.Date2) <= Convert.ToInt32(pj.S30))
                        {
                            rl += pd.P0;
                            bts++;
                        }
                    }
                    else
                    {
                        rl += pd.P0;
                        bts++;
                    }
                }
                if (rl != 0)
                {
                    pj.S2    = rl.ToString();
                    dr["S2"] = rl.ToString();
                }

                UCDeviceBase.DataService.Update <PSP_PowerSubstation_Info>(pj);
            }
        }
Exemple #6
0
        public override void Delete()
        {
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                PSP_PowerSubstation_Info dev = Itop.Common.DataConverter.RowToObject <PSP_PowerSubstation_Info>(row);
                DialogResult             dr  = Itop.Common.MsgBox.ShowYesNo("是否确认删除[" + dev.Title + "]?");
                if (dr == DialogResult.Yes)
                {
                    DataService.Delete <PSP_PowerSubstation_Info>(dev);
                    ((DataTable)gridControl1.DataSource).Rows.Remove(row);
                    //删除第二层数据

                    string delcon = "SvgUID='" + dev.UID + "'and ProjectID = '" + Itop.Client.MIS.ProgUID + "'";
                    DataService.Update("DeletePSPDEVbywhere", delcon);
                }
            }
        }
Exemple #7
0
        //排除设备
        void barDeleteDevice_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (strID == null || curDevice == null)
            {
                MessageBox.Show("选择有问题!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (curDevice.SelectedDevice != null)
            {
                if (curDevice.SelectedDevice.GetType() == typeof(PSPDEV))
                {
                    PSPDEV        dev       = curDevice.SelectedDevice as PSPDEV;
                    PSP_ElcDevice elcdevice = new PSP_ElcDevice();
                    elcdevice.ProjectSUID = strID;
                    elcdevice.DeviceSUID  = dev.SUID;
                    Services.BaseService.Delete <PSP_ElcDevice>(elcdevice);
                }
                else if (curDevice.SelectedDevice.GetType() == typeof(PSP_Substation_Info))
                {
                    PSP_Substation_Info dev       = curDevice.SelectedDevice as PSP_Substation_Info;
                    PSP_ElcDevice       elcdevice = new PSP_ElcDevice();
                    elcdevice.ProjectSUID = strID;
                    elcdevice.DeviceSUID  = dev.UID;
                    Services.BaseService.Delete <PSP_ElcDevice>(elcdevice);
                }
                else if (curDevice.SelectedDevice.GetType() == typeof(PSP_PowerSubstation_Info))
                {
                    PSP_PowerSubstation_Info dev       = curDevice.SelectedDevice as PSP_PowerSubstation_Info;
                    PSP_ElcDevice            elcdevice = new PSP_ElcDevice();
                    elcdevice.ProjectSUID = strID;
                    elcdevice.DeviceSUID  = dev.UID;
                    Services.BaseService.Delete <PSP_ElcDevice>(elcdevice);
                }
            }


            if (curDevice != null)
            {
                curDevice.strCon = ",psp_elcdevice where psp_elcdevice.devicesuid = pspdev.suid and psp_elcdevice.projectsuid = '" + strID + "' and ";
                curDevice.Init();
            }
        }
Exemple #8
0
        public override void Edit()
        {
            frmDYdlg dlg = new frmDYdlg();

            dlg.czButtonVisble(true);
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                PSP_PowerSubstation_Info dev = Itop.Common.DataConverter.RowToObject <PSP_PowerSubstation_Info>(row);
                dlg.DeviceMx = dev;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    //更新记录
                    dev        = dlg.DeviceMx;
                    dev.AreaID = this.ProjectID;
                    DataService.Update <PSP_PowerSubstation_Info>(dev);
                    Itop.Common.DataConverter.ObjectToRow(dev, row);
                }
            }
        }
Exemple #9
0
        public override void Alldel()
        {
            if (Itop.Common.MsgBox.ShowYesNo("是否确认删除所有数据") == DialogResult.Yes)
            {
                DataTable dat = gridView1.GridControl.DataSource as DataTable;
                foreach (DataRow dr in dat.Rows)
                {
                    if (dr != null)
                    {
                        PSP_PowerSubstation_Info dev = Itop.Common.DataConverter.RowToObject <PSP_PowerSubstation_Info>(dr);
                        UCDeviceBase.DataService.Delete <PSP_PowerSubstation_Info>(dev);
                        //删除第二层数据

                        string delcon = "SvgUID='" + dr["UID"].ToString() + "'and ProjectID = '" + Itop.Client.MIS.ProgUID + "'";
                        DataService.Update("DeletePSPDEVbywhere", delcon);
                    }
                }
                dat.Clear();
                gridView1.GridControl.DataSource = dat;
            }
        }
Exemple #10
0
        /// <summary>
        /// 写入数据
        /// </summary>
        /// <param name="obj"></param>
        private void WriteData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string strYear)
        {
            const int                IntRow = 6;
            PSP_Substation_Info      psi    = null;
            PSP_PowerSubstation_Info ppsi   = null;
            int index = 0;

            for (int i = 0; i < list.Count; i++)
            {
                psi = (PSP_Substation_Info)list[i];
                for (int j = 1; j < obj.ColumnCount; ++j)
                {
                    if (j == 1)//大电网电源点
                    {
                        obj.SetValue(i + IntRow, j, psi.AreaName);
                    }
                    if (j == 2)//电压等级
                    {
                        obj.SetValue(i + IntRow, j, psi.L1);
                    }
                    if (j == 3)//主变台数
                    {
                        obj.SetValue(i + IntRow, j, psi.L3);
                    }
                    if (j == 4)//变电容量
                    {
                        obj.SetValue(i + IntRow, j, psi.L2);
                    }
                    if (j == 5)//最终规模
                    {
                        obj.Cells[i + IntRow, j].Locked = false;
                    }
                }
            }
            //最后5行
            for (int i = (IntRow + list.Count); i < obj.RowCount; ++i)
            {
                for (int j = 0; j < obj.ColumnCount; ++j)
                {
                    if (i == obj.RowCount - 1)//最后一行
                    {
                        PF.CreateSheetView(obj, 1, 1, i, 1, "小计");
                    }
                    else if (i == (IntRow + list.Count))
                    {
                        if (j == 0)
                        {
                            obj.SetValue(i, j, "二");
                        }
                        if (j == 1)
                        {
                            obj.SetValue(i, j, "地方电厂及新能源");
                        }
                        if (j == 2)
                        {
                            obj.SetValue(i, j, "机组类型");
                        }
                        if (j == 3)
                        {
                            obj.SetValue(i, j, "机组容量");
                        }
                        if (j == 4)
                        {
                            obj.SetValue(i, j, "接入电压");
                        }
                        if (j == 5)
                        {
                            obj.SetValue(i, j, "年均发电量");
                        }
                    }
                    else//写入数据
                    {
                        ppsi = (PSP_PowerSubstation_Info)plist[index];
                        switch (j)
                        {
                        case 1:    //地方电厂及新能源
                            obj.SetValue(i, j, ppsi.Title);
                            break;

                        case 2:    //机组类型
                            obj.SetValue(i, j, ReturnedFDJOfName(FB, strYear, ppsi.UID));
                            break;

                        case 3:    //机组容量
                            obj.SetValue(i, j, ppsi.S2);
                            break;

                        case 4:    //接入电压
                            obj.SetValue(i, j, ppsi.S1);
                            break;

                        case 5:    //年均发电量
                            obj.SetValue(i, j, ppsi.S11);
                            break;

                        default:
                            break;
                        }
                    }
                }
                if (i != obj.RowCount - 1 && i != (IntRow + list.Count))
                {
                    index++;
                }
            }
        }
Exemple #11
0
        private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //生成拓扑关系
            vistlineflag.Clear();
            vistbusflag.Clear();
            vistsubstationflag.Clear();
            vistpowerflag.Clear();
            visttrans2flag.Clear();
            visttrans3flag.Clear();
            vistfdjflag.Clear();
            vistfhflag.Clear();
            vistmlflag.Clear();
            vistml2flag.Clear();
            vistcldkflag.Clear();
            vistcldrflag.Clear();
            vistbldkflag.Clear();
            vistbldrflag.Clear();
            vistdlqflag.Clear();
            string con = " AreaID = '" + Itop.Client.MIS.ProgUID + "' AND Title='" + comboBoxEdit1.Text + "'";
            PSP_Substation_Info list = (PSP_Substation_Info)UCDeviceBase.DataService.GetObject("SelectPSP_Substation_InfoListByWhere", con);

            vistsubstationflag.Add(list.Title, list);
            con = "WHERE SvgUID='" + list.UID + "'AND projectid='" + Itop.Client.MIS.ProgUID + "'AND Type='01'";
            IList buslist = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);

            if (buslist != null)
            {
                for (int i = 0; i < buslist.Count; i++)
                {
                    TopolyCheck(type, (PSPDEV)buslist[i]);
                }
                foreach (KeyValuePair <string, PSPDEV> keyvalue in vistbusflag)
                {
                    if (string.IsNullOrEmpty(keyvalue.Value.SvgUID))
                    {
                        MessageBox.Show(keyvalue.Value.Name + "没有关联变电站!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    else
                    {
                        list.UID = keyvalue.Value.SvgUID;
                    }
                    list.UID = keyvalue.Value.SvgUID;

                    list = (PSP_Substation_Info)UCDeviceBase.DataService.GetObject("SelectPSP_Substation_InfoByKey", list);
                    if (list != null)
                    {
                        if (!vistsubstationflag.ContainsKey(list.Title))
                        {
                            vistsubstationflag.Add(list.Title, list);
                        }
                    }

                    PSP_PowerSubstation_Info pp = new PSP_PowerSubstation_Info();
                    pp.UID = keyvalue.Value.SvgUID;
                    pp     = (PSP_PowerSubstation_Info)UCDeviceBase.DataService.GetObject("SelectPSP_PowerSubstation_InfoByKey", pp);
                    if (pp != null)
                    {
                        if (!vistpowerflag.ContainsKey(pp.Title))
                        {
                            vistpowerflag.Add(pp.Title, pp);
                        }
                    }
                    con = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='11'";
                    IList pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistbldkflag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistbldkflag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='09'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistbldrflag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistbldrflag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='12'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistfhflag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistfhflag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='04'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistfdjflag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistfdjflag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='13'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistmlflag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistmlflag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE JName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='13'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistmlflag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistmlflag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='06'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistdlqflag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistdlqflag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE HuganLine1='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='14'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistml2flag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistml2flag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE HuganLine2='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='14'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistml2flag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistml2flag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='02'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (visttrans2flag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            visttrans2flag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE JName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='02'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (visttrans2flag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            visttrans2flag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='03'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (visttrans3flag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            visttrans3flag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE JName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='03'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (visttrans3flag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            visttrans3flag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE KName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='03'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (visttrans3flag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            visttrans3flag.Add(psp.Name, psp);
                        }
                    }
                }
                foreach (KeyValuePair <string, PSPDEV> keyvalue in vistlineflag)
                {
                    con = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='08'";
                    IList pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistcldrflag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistcldrflag.Add(psp.Name, psp);
                        }
                    }
                    con      = " WHERE IName='" + keyvalue.Value.Name + "' AND ProjectID = '" + Itop.Client.MIS.ProgUID + "'" + "AND Type='10'";
                    pspline1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV psp in pspline1)
                    {
                        if (vistcldkflag.ContainsKey(psp.Name))
                        {
                            continue;
                        }
                        else
                        {
                            vistcldkflag.Add(psp.Name, psp);
                        }
                    }
                }
            }

            else
            {
                MessageBox.Show("此变电站没有拓扑关系,请查询数据后再进行检索!");
            }
        }
Exemple #12
0
        private void button5_Click_1(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            frmGHDeviceList frmDevList = new frmGHDeviceList();

            frmDevList.ProjectID   = Itop.Client.MIS.ProgUID;
            frmDevList.ProjectSUID = ctrlPSP_GProg1.FocusedObject.UID;
            frmDevList.Init();
            if (frmDevList.ShowDialog() == DialogResult.OK)
            {
                foreach (DataRow row in frmDevList.DT.Rows)
                {
                    try {
                        if ((bool)row["C"])
                        {
                            PSP_GprogElevice elcDevice = new PSP_GprogElevice();
                            elcDevice.DeviceSUID = row["A"].ToString();
                            elcDevice.GprogUID   = ctrlPSP_GProg1.FocusedObject.UID;
                            elcDevice            = (PSP_GprogElevice)Services.BaseService.GetObject("SelectPSP_GprogEleviceByKey", elcDevice);
                            if (elcDevice != null)
                            {
                                elcDevice.Type = row["D"].ToString();
                                elcDevice.L2   = "0";
                                Services.BaseService.Update <PSP_GprogElevice>(elcDevice);
                            }
                            else
                            {
                                elcDevice            = new PSP_GprogElevice();
                                elcDevice.DeviceSUID = row["A"].ToString();
                                elcDevice.GprogUID   = ctrlPSP_GProg1.FocusedObject.UID;
                                elcDevice.Type       = row["D"].ToString();
                                elcDevice.L2         = "0";
                                Services.BaseService.Create <PSP_GprogElevice>(elcDevice);
                            }
                        }
                        else
                        {
                            PSP_GprogElevice elcDevice = new PSP_GprogElevice();
                            elcDevice.DeviceSUID = row["A"].ToString();
                            elcDevice.GprogUID   = ctrlPSP_GProg1.FocusedObject.UID;

                            Services.BaseService.Delete <PSP_GprogElevice>(elcDevice);
                        }
                    } catch (System.Exception ex) {
                    }
                }
            }
            else
            {
                return;
            }
            //在此处将其选择的元件设备的属性进行更改

            LayerGrade l1 = new LayerGrade();

            l1.Type       = "1";
            l1.SvgDataUid = svguid;
            IList ttlist = Services.BaseService.GetList("SelectLayerGradeList5", l1);
            int   yy1 = System.DateTime.Now.Year, yy2 = System.DateTime.Now.Year, yy3 = System.DateTime.Now.Year;

            if (ttlist.Count > 0)
            {
                LayerGrade n1 = (LayerGrade)ttlist[0];
                yy1 = Convert.ToInt32(n1.Name.Substring(0, 4));
            }
            l1.Type       = "2";
            l1.SvgDataUid = svguid;
            ttlist        = Services.BaseService.GetList("SelectLayerGradeList5", l1);
            if (ttlist.Count > 0)
            {
                LayerGrade n1 = (LayerGrade)ttlist[0];
                yy2 = Convert.ToInt32(n1.Name.Substring(0, 4));
            }
            l1.Type       = "3";
            l1.SvgDataUid = svguid;
            ttlist        = Services.BaseService.GetList("SelectLayerGradeList5", l1);
            if (ttlist.Count > 0)
            {
                LayerGrade n1 = (LayerGrade)ttlist[0];
                yy3 = Convert.ToInt32(n1.Name.Substring(0, 4));
            }
            string con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND Type= '变电站'";

            IList list = Services.BaseService.GetList("SelectPSP_GprogEleviceByCondition", con);

            foreach (PSP_GprogElevice pg in list)
            {
                PSP_Substation_Info ps = new PSP_Substation_Info();
                ps.UID = pg.DeviceSUID;
                ps     = (PSP_Substation_Info)Services.BaseService.GetObject("SelectPSP_Substation_InfoByKey", ps);
                if (ps != null)
                {
                    int s2 = 0;
                    if (!string.IsNullOrEmpty(ps.S2))
                    {
                        s2 = Convert.ToInt32(ps.S2);
                    }
                    if (s2 <= System.DateTime.Now.Year)
                    {
                        pg.L1 = "现行";
                    }
                    else if (s2 > System.DateTime.Now.Year && Convert.ToInt32(ps.S2) <= yy1)
                    {
                        pg.L1 = "近期";
                    }
                    else if (s2 > yy1 && Convert.ToInt32(ps.S2) <= yy2)
                    {
                        pg.L1 = "中期";
                    }
                    else if (s2 > yy2 && Convert.ToInt32(ps.S2) <= yy3)
                    {
                        pg.L1 = "远期";
                    }
                    Services.BaseService.Update <PSP_GprogElevice>(pg);
                }
                else
                {
                    Services.BaseService.Delete <PSP_GprogElevice>(pg);
                }
            }
            con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND Type= '电源'";

            list = Services.BaseService.GetList("SelectPSP_GprogEleviceByCondition", con);
            foreach (PSP_GprogElevice pg in list)
            {
                PSP_PowerSubstation_Info ps = new PSP_PowerSubstation_Info();
                ps.UID = pg.DeviceSUID;
                ps     = (PSP_PowerSubstation_Info)Services.BaseService.GetObject("SelectPSP_PowerSubstation_InfoByKey", ps);
                if (ps != null)
                {
                    int s2 = 0;
                    if (!string.IsNullOrEmpty(ps.S3))
                    {
                        s2 = Convert.ToInt32(ps.S3);
                    }
                    if (s2 <= System.DateTime.Now.Year)
                    {
                        pg.L1 = "现行";
                    }
                    else if (s2 > System.DateTime.Now.Year && Convert.ToInt32(ps.S3) <= yy1)
                    {
                        pg.L1 = "近期";
                    }
                    else if (s2 > yy1 && Convert.ToInt32(ps.S3) <= yy2)
                    {
                        pg.L1 = "中期";
                    }
                    else if (s2 > yy2 && Convert.ToInt32(ps.S3) <= yy3)
                    {
                        pg.L1 = "远期";
                    }
                    Services.BaseService.Update <PSP_GprogElevice>(pg);
                }
                else
                {
                    Services.BaseService.Delete <PSP_GprogElevice>(pg);
                }
            }
            //变电站里判断两绕和三绕是哪个时期的

            con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND Type= '变电站'";

            list = Services.BaseService.GetList("SelectPSP_GprogEleviceByCondition", con);
            foreach (PSP_GprogElevice pg in list)
            {
                con = "c.UID='" + pg.DeviceSUID + "'and a.Type='02'and a.ProjectID='" + Itop.Client.MIS.ProgUID + "'";
                IList uidlist = Services.BaseService.GetList("SelectPSPDEV_byqSUID", con);
                foreach (string uid in uidlist)
                {
                    con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND Type= '两绕组变压器'AND DeviceSUID='" + uid + "'";
                    PSP_GprogElevice pglr = (PSP_GprogElevice)Services.BaseService.GetObject("SelectPSP_GprogEleviceByCondition", con);
                    if (pglr != null)
                    {
                        pglr.L1 = pg.L1;
                        Services.BaseService.Update <PSP_GprogElevice>(pglr);
                    }
                }
                con     = "c.UID='" + pg.DeviceSUID + "'and a.Type='03'and a.ProjectID='" + Itop.Client.MIS.ProgUID + "'";
                uidlist = Services.BaseService.GetList("SelectPSPDEV_byqSUID", con);
                foreach (string uid in uidlist)
                {
                    con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND Type= '三绕组变压器'AND DeviceSUID='" + uid + "'";
                    PSP_GprogElevice pglr = (PSP_GprogElevice)Services.BaseService.GetObject("SelectPSP_GprogEleviceByCondition", con);
                    if (pglr != null)
                    {
                        pglr.L1 = pg.L1;
                        Services.BaseService.Update <PSP_GprogElevice>(pglr);
                    }
                }
            }
            //发电厂里两绕和三绕组是哪个时期的
            con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND Type= '电源'";

            list = Services.BaseService.GetList("SelectPSP_GprogEleviceByCondition", con);
            foreach (PSP_GprogElevice pg in list)
            {
                con = "c.UID='" + pg.DeviceSUID + "'and a.Type='02'and a.ProjectID='" + Itop.Client.MIS.ProgUID + "'";
                IList uidlist = Services.BaseService.GetList("SelectPSPDEV_byqSUID", con);
                foreach (string uid in uidlist)
                {
                    con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND Type= '两绕组变压器'AND DeviceSUID='" + uid + "'";
                    PSP_GprogElevice pglr = (PSP_GprogElevice)Services.BaseService.GetObject("SelectPSP_GprogEleviceByCondition", con);
                    if (pglr != null)
                    {
                        pglr.L1 = pg.L1;
                        Services.BaseService.Update <PSP_GprogElevice>(pglr);
                    }
                }
                con     = "c.UID='" + pg.DeviceSUID + "'and a.Type='03'and a.ProjectID='" + Itop.Client.MIS.ProgUID + "'";
                uidlist = Services.BaseService.GetList("SelectPSPDEV_byqSUID", con);
                foreach (string uid in uidlist)
                {
                    con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND Type= '三绕组变压器'AND DeviceSUID='" + uid + "'";
                    PSP_GprogElevice pglr = (PSP_GprogElevice)Services.BaseService.GetObject("SelectPSP_GprogEleviceByCondition", con);
                    if (pglr != null)
                    {
                        pglr.L1 = pg.L1;
                        Services.BaseService.Update <PSP_GprogElevice>(pglr);
                    }
                }
            }
            //判断设备参数中有没有在规划设备中的两绕,三绕组变压器,发电机和负荷 如果没有则删掉

            con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND (Type= '两绕组变压器'or Type= '三绕组变压器'or Type= '负荷'or Type= '发电机')";

            list = Services.BaseService.GetList("SelectPSP_GprogEleviceByCondition", con);
            foreach (PSP_GprogElevice pg in list)
            {
                PSPDEV ps = new PSPDEV();
                ps.SUID = pg.DeviceSUID;
                ps      = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByKey", ps);
                if (ps == null)
                {
                    Services.BaseService.Delete <PSP_GprogElevice>(pg);
                }
            }
            //线路信息
            con = "GprogUID = '" + ctrlPSP_GProg1.FocusedObject.UID + "' AND Type= '线路'";

            list = Services.BaseService.GetList("SelectPSP_GprogEleviceByCondition", con);
            foreach (PSP_GprogElevice pg in list)
            {
                PSPDEV ps = new PSPDEV();
                ps.SUID = pg.DeviceSUID;
                ps      = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByKey", ps);
                if (ps != null)
                {
                    int s2 = 0;
                    if (!string.IsNullOrEmpty(ps.OperationYear))
                    {
                        s2 = Convert.ToInt32(ps.OperationYear);
                    }
                    if (s2 <= System.DateTime.Now.Year)
                    {
                        pg.L1         = "运行";
                        ps.LineStatus = "运行";
                    }
                    else
                    {
                        pg.L1         = "待选";
                        ps.LineStatus = "待选";
                    }
                    Services.BaseService.Update <PSP_GprogElevice>(pg);
                    Services.BaseService.Update <PSPDEV>(ps);
                }
                else
                {
                    Services.BaseService.Delete <PSP_GprogElevice>(pg);
                }
            }
        }