示例#1
0
        //���ݲ����Ĵ���������ʾ
        public void AllshortcheckYL(string projectSUID, string projectid, double ratecaplity, int caozuoi)
        {
            try
            {
                if (!CheckDL(projectSUID, projectid, ratecaplity))
                {
                    return;
                }
                Dictionary<int, double> nodeshorti = new Dictionary<int, double>();      //��¼ĸ����û�н��й���·
                KeyValuePair<int, double> maxshorti = new KeyValuePair<int, double>(); //ȡ����·������·����
                string con = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='01'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                PSPDEV pspDev = new PSPDEV();
                IList list1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);

                PSPDEV psp = new PSPDEV();
                shortbuscir shortCutCal = new shortbuscir(Compuflag);
                for (int i = 0; i < list1.Count; i++)
                {
                    pspDev = list1[i] as PSPDEV;
                    bool flag = false;
                    string dlr = null;
                    con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='05'AND PSPDEV.KSwitchStatus = '0'AND (PSPDEV.IName='" + pspDev.Name + "'OR PSPDEV.JName='" + pspDev.Name + "')order by PSPDEV.number";

                    IList list2 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);

                    for (int j = 0; j < list2.Count; j++)
                    {
                        psp = list2[j] as PSPDEV;
                        con = " WHERE Name='" + psp.ISwitch + "' AND ProjectID = '" + projectid + "'" + "AND Type='07'";
                        IList listiswitch = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                        con = " WHERE Name='" + psp.JSwitch + "' AND ProjectID = '" + projectid + "'" + "AND Type='07'";
                        IList listjswitch = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                        PSPDEV pspiswitch = (PSPDEV)listiswitch[0];
                        PSPDEV pspjswitch = (PSPDEV)listjswitch[0];

                        if (pspDev.Number == psp.FirstNode && pspiswitch.KSwitchStatus == "0" && pspjswitch.KSwitchStatus == "0")
                        {

                            flag = true;
                            dlr = "0" + " " + psp.FirstNode + " " + psp.LastNode + " " + psp.Number + " " + "0 " + " " + "0 ";

                        }
                        if (pspDev.Number == psp.LastNode && pspiswitch.KSwitchStatus == "0" && pspjswitch.KSwitchStatus == "0")
                        {
                            flag = true;
                            dlr = "0" + " " + psp.FirstNode + " " + psp.LastNode + " " + psp.Number + " " + "1 " + " " + "0 ";
                        }
                        if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\fault.txt"))
                        {
                            File.Delete(System.Windows.Forms.Application.StartupPath + "\\fault.txt");
                        }
                        if (flag)
                        {
                            FileStream VK = new FileStream((System.Windows.Forms.Application.StartupPath + "\\fault.txt"), FileMode.OpenOrCreate);
                            StreamWriter str11 = new StreamWriter(VK);
                            str11.Write(dlr);
                            str11.Close();
                            if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt"))
                            {
                                File.Delete(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt");
                            }
                            //shortcir shortCutCal = new shortcir();
                            shortCutCal.Show_shortcir(0, 0, 1);
                            //bool matrixflag=true;                //�����ж��Ƿ��ɾ����������Ƿ���������
                            string matrixstr = null;
                            if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\Zmatrixcheck.txt"))
                            {
                                matrixstr = "�����ɾ���";
                                // matrixflag = false;
                            }

                            if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\Fmatrixcheck.txt"))
                            {
                                // matrixflag = false;
                                matrixstr += "�����ɾ���";
                            }

                            if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\Lmatrixcheck.txt"))
                            {
                                //matrixflag = false;
                                matrixstr += "�����ɾ���";
                            }
                            if (matrixstr != null)
                            {
                                MessageBox.Show(matrixstr + "�����������������������ٽ��м��㣡", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                            if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt"))
                            {
                            }
                            else
                            {
                                return;
                            }

                            FileStream shorcuit = new FileStream(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt", FileMode.Open);
                            StreamReader readLineGU = new StreamReader(shorcuit, System.Text.Encoding.Default);
                            string strLineGU;
                            string[] arrayGU;
                            char[] charSplitGU = new char[] { ' ' };

                            while ((strLineGU = readLineGU.ReadLine()) != null)
                            {

                                while ((strLineGU = readLineGU.ReadLine()) != null)
                                {
                                    arrayGU = strLineGU.Split(charSplitGU);
                                    string[] shorti = new string[4];
                                    shorti.Initialize();
                                    int m = 0;
                                    foreach (string str in arrayGU)
                                    {

                                        if (str != "")
                                        {

                                            shorti[m++] = str.ToString();

                                        }
                                    }

                                    nodeshorti[pspDev.Number] = Convert.ToDouble(shorti[3]) * 100 / (Math.Sqrt(3) * pspDev.ReferenceVolt);
                                }
                            }
                            readLineGU.Close();
                            break;                 //������ѭ�� ����ĸ�ߵ�����һ��ĸ�߶�·
                        }
                        if (!flag)
                            continue;
                        //������
                    }
                    //�����һ����·��û�������������н���
                    if (!flag)
                    {
                        con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='02'AND PSPDEV.KSwitchStatus = '0'AND(PSPDEV.IName='" + pspDev.Name + "'OR PSPDEV.JName='" + pspDev.Name + "') order by PSPDEV.number";
                        IList list3 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                        for (int j = 0; j < list3.Count; j++)
                        {
                            dlr = null;
                            psp = list3[j] as PSPDEV;
                            //PSPDEV devFirst = new PSPDEV();

                            //con = " WHERE Name='" + psp.IName + "' AND ProjectID = '" + projectid + "'" + "AND Type='01'";
                            //devFirst = (PSPDEV)UCDeviceBase.DataService.GetObject("SelectPSPDEVByCondition", con);
                            //PSPDEV devLast = new PSPDEV();

                            //con = " WHERE Name='" + psp.JName + "' AND ProjectID = '" + projectid + "'" + "AND Type='01'";
                            //devLast = (PSPDEV)UCDeviceBase.DataService.GetObject("SelectPSPDEVByCondition", con);
                            con = " WHERE Name='" + psp.ISwitch + "' AND ProjectID = '" + projectid + "'" + "AND Type='07'";
                            IList listiswitch = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                            con = " WHERE Name='" + psp.JSwitch + "' AND ProjectID = '" + projectid + "'" + "AND Type='07'";
                            IList listjswitch = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                            PSPDEV pspiswitch = (PSPDEV)listiswitch[0];
                            PSPDEV pspjswitch = (PSPDEV)listjswitch[0];
                            if (pspDev.Number == psp.FirstNode && pspiswitch.KSwitchStatus == "0" && pspjswitch.KSwitchStatus == "0")
                            {

                                flag = true;
                                dlr = "0" + " " + psp.FirstNode + " " + psp.LastNode + " " + psp.Number + " " + "0" + " " + "0";

                            }
                            if (pspDev.Number == psp.LastNode && pspiswitch.KSwitchStatus == "0" && pspjswitch.KSwitchStatus == "0")
                            {
                                flag = true;
                                dlr = "0" + " " + psp.FirstNode + " " + psp.LastNode + " " + psp.Number + " " + "1" + " " + "0";
                            }
                            if (flag)
                            {
                                FileStream VK = new FileStream((System.Windows.Forms.Application.StartupPath + "\\fault.txt"), FileMode.OpenOrCreate);
                                StreamWriter str11 = new StreamWriter(VK);
                                str11.Write(dlr);
                                str11.Close();
                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt"))
                                {
                                    File.Delete(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt");
                                }
                                // shortcir shortCutCal = new shortcir();
                                shortCutCal.Show_shortcir(0, 0, 1);
                                //bool matrixflag=true;                //�����ж��Ƿ��ɾ����������Ƿ���������
                                string matrixstr = null;
                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\Zmatrixcheck.txt"))
                                {
                                    matrixstr = "�����ɾ���";
                                    // matrixflag = false;
                                }

                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\Fmatrixcheck.txt"))
                                {
                                    // matrixflag = false;
                                    matrixstr += "�����ɾ���";
                                }

                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\Lmatrixcheck.txt"))
                                {
                                    //matrixflag = false;
                                    matrixstr += "�����ɾ���";
                                }
                                if (matrixstr != null)
                                {
                                    MessageBox.Show(matrixstr + "�����������������������ٽ��м��㣡", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    return;
                                }
                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt"))
                                {
                                }
                                else
                                {
                                    return;
                                }

                                FileStream shorcuit = new FileStream(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt", FileMode.Open);
                                StreamReader readLineGU = new StreamReader(shorcuit, System.Text.Encoding.Default);
                                string strLineGU;
                                string[] arrayGU;
                                char[] charSplitGU = new char[] { ' ' };

                                while ((strLineGU = readLineGU.ReadLine()) != null)
                                {

                                    while ((strLineGU = readLineGU.ReadLine()) != null)
                                    {
                                        arrayGU = strLineGU.Split(charSplitGU);
                                        string[] shorti = new string[4];
                                        shorti.Initialize();
                                        int m = 0;
                                        foreach (string str in arrayGU)
                                        {

                                            if (str != "")
                                            {

                                                shorti[m++] = str.ToString();

                                            }
                                        }

                                        nodeshorti[pspDev.Number] = Convert.ToDouble(shorti[3]) * 100 / (Math.Sqrt(3) * pspDev.ReferenceVolt);
                                    }
                                }
                                readLineGU.Close();
                                break;                 //������ѭ�� ����ĸ�ߵ�����һ��ĸ�߶�·
                            }
                            if (!flag)
                                continue;
                            //������
                        }
                    }
                    if (!flag)
                    {
                        con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='03'AND PSPDEV.KSwitchStatus = '0' AND(PSPDEV.IName='" + pspDev.Name + "'OR PSPDEV.JName='" + pspDev.Name + "'OR PSPDEV.KName='" + pspDev.Name + "') order by PSPDEV.number";
                        IList list4 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                        for (int j = 0; j < list4.Count; j++)
                        {
                            dlr = null;
                            psp = list4[j] as PSPDEV;
                            //PSPDEV devINode = new PSPDEV();

                            //con = " WHERE Name='" + psp.IName + "' AND ProjectID = '" + projectid + "'" + "AND Type='01'";
                            //devINode = (PSPDEV)UCDeviceBase.DataService.GetObject("SelectPSPDEVByCondition", con);
                            //PSPDEV devJNode = new PSPDEV();

                            //con = " WHERE Name='" + psp.JName + "' AND ProjectID = '" + projectid + "'" + "AND Type='01'";
                            //devJNode = (PSPDEV)UCDeviceBase.DataService.GetObject("SelectPSPDEVByCondition", con);
                            //PSPDEV devKNode = new PSPDEV();

                            //con = " WHERE Name='" + psp.KName + "' AND ProjectID = '" + projectid + "'" + "AND Type='01'";
                            //devKNode = (PSPDEV)UCDeviceBase.DataService.GetObject("SelectPSPDEVByCondition", con);

                            con = " WHERE Name='" + psp.ISwitch + "' AND ProjectID = '" + projectid + "'" + "AND Type='07'";
                            IList listiswitch = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                            con = " WHERE Name='" + psp.JSwitch + "' AND ProjectID = '" + projectid + "'" + "AND Type='07'";
                            IList listjswitch = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                            con = " WHERE Name='" + psp.HuganLine1 + "' AND ProjectID = '" + projectid + "'" + "AND Type='07'";
                            IList listkswitch = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                            PSPDEV pspiswitch = (PSPDEV)listiswitch[0];
                            PSPDEV pspjswitch = (PSPDEV)listjswitch[0];
                            PSPDEV pspkswitch = (PSPDEV)listkswitch[0];
                            if (pspDev.Number == psp.FirstNode & pspiswitch.KSwitchStatus == "0" && pspjswitch.KSwitchStatus == "0" && pspkswitch.KSwitchStatus == "0")
                            {

                                flag = true;
                                dlr = "0" + " " + psp.FirstNode + " " + psp.LastNode + " " + psp.Number + " " + "0" + " " + "0";

                            }
                            if (pspDev.Number == psp.LastNode && pspiswitch.KSwitchStatus == "0" && pspjswitch.KSwitchStatus == "0" && pspkswitch.KSwitchStatus == "0")
                            {
                                flag = true;
                                dlr = "0" + " " + psp.FirstNode + " " + psp.LastNode + " " + psp.Number + " " + "1" + " " + "0";
                            }
                            if (pspDev.Number == psp.Flag && pspiswitch.KSwitchStatus == "0" && pspjswitch.KSwitchStatus == "0" && pspkswitch.KSwitchStatus == "0")
                            {
                                flag = true;
                                dlr = "0" + " " + psp.FirstNode + " " + psp.Flag + " " + psp.Number + " " + "1" + " " + "0";
                            }

                            if (flag)
                            {
                                FileStream VK = new FileStream((System.Windows.Forms.Application.StartupPath + "\\fault.txt"), FileMode.OpenOrCreate);
                                StreamWriter str11 = new StreamWriter(VK);
                                str11.Write(dlr);
                                str11.Close();
                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt"))
                                {
                                    File.Delete(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt");
                                }
                                //shortcir shortCutCal = new shortcir();
                                shortCutCal.Show_shortcir(0, 0, 1);
                                //bool matrixflag=true;                //�����ж��Ƿ��ɾ����������Ƿ���������
                                string matrixstr = null;
                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\Zmatrixcheck.txt"))
                                {
                                    matrixstr = "�����ɾ���";
                                    // matrixflag = false;
                                }

                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\Fmatrixcheck.txt"))
                                {
                                    // matrixflag = false;
                                    matrixstr += "�����ɾ���";
                                }

                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\Lmatrixcheck.txt"))
                                {
                                    //matrixflag = false;
                                    matrixstr += "�����ɾ���";
                                }
                                if (matrixstr != null)
                                {
                                    MessageBox.Show(matrixstr + "�����������������������ٽ��м��㣡", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    return;
                                }
                                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt"))
                                {
                                }
                                else
                                {
                                    return;
                                }

                                FileStream shorcuit = new FileStream(System.Windows.Forms.Application.StartupPath + "\\ShortcuitI.txt", FileMode.Open);
                                StreamReader readLineGU = new StreamReader(shorcuit, System.Text.Encoding.Default);
                                string strLineGU;
                                string[] arrayGU;
                                char[] charSplitGU = new char[] { ' ' };

                                while ((strLineGU = readLineGU.ReadLine()) != null)
                                {

                                    while ((strLineGU = readLineGU.ReadLine()) != null)
                                    {
                                        arrayGU = strLineGU.Split(charSplitGU);
                                        string[] shorti = new string[4];
                                        shorti.Initialize();
                                        int m = 0;
                                        foreach (string str in arrayGU)
                                        {

                                            if (str != "")
                                            {

                                                shorti[m++] = str.ToString();

                                            }
                                        }

                                        nodeshorti[pspDev.Number] = Convert.ToDouble(shorti[3]) * 100 / (Math.Sqrt(3) * pspDev.ReferenceVolt);
                                    }
                                }
                                readLineGU.Close();
                                break;                 //������ѭ�� ����ĸ�ߵ�����һ��ĸ�߶�·
                            }
                            if (!flag)
                                continue;
                            //������
                        }
                    }
                }
                //�ҳ���·��������ֵ
                //maxshorti.Key = 1;
                //maxshorti.Value = nodeshorti[1];
                foreach (KeyValuePair<int, double> keyvalue in nodeshorti)
                {
                    if (keyvalue.Value > maxshorti.Value)
                    {
                        maxshorti = keyvalue;
                    }
                }

                //����ȡ����·�� �ж�����ĸ���ڲ��� ������ھͽ���ɾ�� Ȼ������ѹ���бȽ�
                con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='06'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                IList list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);

                for (int i = 0; i < list.Count; i++)
                {
                    bool flag = false;
                    pspDev = list[i] as PSPDEV;
                    for (int j = 0; j < list1.Count; j++)
                    {
                        psp = list1[j] as PSPDEV;
                        if (pspDev.IName == psp.Name)
                            flag = true;

                    }
                    if (!flag)
                    {
                        UCDeviceBase.DataService.Delete<PSPDEV>(pspDev);
                    }
                }
                con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='06'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                for (int i = 0; i < list.Count; i++)
                {
                    pspDev = list[i] as PSPDEV;
                    pspDev.HuganLine3 = "";
                    pspDev.KName = "";
                    if (pspDev.KSwitchStatus == "0")
                    {
                        pspDev.OutP = maxshorti.Value;
                        if (maxshorti.Value > pspDev.HuganTQ1)
                        {
                            pspDev.HuganLine3 = "���ϸ�";
                        }
                        else
                        {
                            pspDev.HuganLine3 = "�ϸ�";
                        }
                        pspDev.HuganLine4 = "";
                        if (pspDev.HuganLine3 == "�ϸ�")
                        {
                            pspDev.KName = "�ϸ�";
                        }
                        else
                            pspDev.KName = "���ϸ�";
                    }

                    UCDeviceBase.DataService.Update<PSPDEV>(pspDev);
                }
                switch (caozuoi)
                {
                    case 1:           //ȫ����·����
                        {
                            pspDev.SvgUID = projectSUID;
                            pspDev.Type = "06";
                            DlqiCheckform dlqicheckform = new DlqiCheckform(pspDev);
                            dlqicheckform.getusercltr.gridView.GroupPanelText = "��·�����������������������";
                            dlqicheckform.ShowDialog();
                            break;
                        }
                    case 2:             //����·����
                        {
                            con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='06'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                            list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                            for (int i = 0; i < list.Count; i++)
                            {
                                pspDev = list[i] as PSPDEV;
                                if (pspDev.KSwitchStatus == "0")
                                {
                                    con = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='01'AND PSPDEV.KSwitchStatus = '0'AND PSPDEV.Name='" + pspDev.IName + "'";

                                    IList list4 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                                    psp = list4[0] as PSPDEV;
                                    try
                                    {
                                        pspDev.OutQ = nodeshorti[psp.Number];
                                        if (pspDev.HuganLine3 == "���ϸ�")
                                        {
                                            if (pspDev.OutQ <= pspDev.HuganTQ1)
                                            {
                                                pspDev.HuganLine3 = "�ϸ�";
                                            }
                                        }
                                        pspDev.HuganLine4 = "";

                                        if (pspDev.HuganLine3 == "�ϸ�")
                                        {
                                            pspDev.KName = "�ϸ�";
                                        }
                                        else
                                            pspDev.KName = "���ϸ�";
                                        UCDeviceBase.DataService.Update<PSPDEV>(pspDev);
                                    }
                                    catch (System.Exception ex)
                                    {
                                        MessageBox.Show("��·���ݲ�����");
                                    }
                                }

                            }
                            pspDev.SvgUID = projectSUID;
                            pspDev.Type = "06";
                            DlqiCheckform dlqicheckform = new DlqiCheckform(pspDev);
                            dlqicheckform.getusercltr.gridView.GroupPanelText = "����·У�˽����";
                            dlqicheckform.ShowDialog();
                            break;
                        }
                    case 3:          //��·��ֱ������
                        {
                            con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='06'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                            list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                            for (int i = 0; i < list.Count; i++)
                            {
                                pspDev = list[i] as PSPDEV;
                                if (pspDev.KSwitchStatus == "0")
                                {
                                    double tx = 0.0;
                                    if (pspDev.HuganLine2 == "���ѿ۶�·��")
                                    {
                                        tx = 0.0;
                                    }
                                    else if (pspDev.HuganLine2 == "���������ѿ۵Ķ�·��")
                                    {
                                        tx = 10;
                                    }
                                    pspDev.HuganTQ4 = (pspDev.OutP / pspDev.HuganTQ1) * Math.Exp((-pspDev.HuganTQ2 - tx) / 45) * 100;
                                    pspDev.HuganTQ5 = (pspDev.OutQ / pspDev.HuganTQ1) * Math.Exp((-pspDev.HuganTQ2 - tx) / 45) * 100;
                                    if (pspDev.HuganTQ3 >= pspDev.HuganTQ4)
                                    {
                                        pspDev.HuganLine4 = "�ϸ�";
                                    }
                                    if (pspDev.HuganTQ3 >= pspDev.HuganTQ5)
                                    {
                                        pspDev.HuganLine4 = "�ϸ�";
                                    }
                                    else if (pspDev.HuganTQ3 < pspDev.HuganTQ5)
                                    {
                                        pspDev.HuganLine4 = "���ϸ�";
                                    }
                                    if (pspDev.HuganLine3 == "�ϸ�" && pspDev.HuganLine4 == "�ϸ�")
                                    {
                                        pspDev.KName = "�ϸ�";
                                    }
                                    else
                                    {
                                        pspDev.KName = "���ϸ�";
                                    }

                                    UCDeviceBase.DataService.Update<PSPDEV>(pspDev);
                                }

                            }
                            pspDev.SvgUID = projectSUID;
                            pspDev.Type = "06";
                            DlqiCheckform dlqicheckform = new DlqiCheckform(pspDev);
                            dlqicheckform.getusercltr.gridView.GroupPanelText = "��·��������������������";
                            dlqicheckform.ShowDialog();
                            break;
                        }

                }

            }
            catch (System.Exception ex)
            {
                MessageBox.Show("��·����������������·�����Ƿ��ܽ��У�");
            }
        }
示例#2
0
        //���ݲ����Ĵ���������ʾ
        public void Allshortcheck(string projectSUID, string projectid, double ratecaplity, int caozuoi)
        {
            try
            {
                string con = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='01'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                PSPDEV pspDev = new PSPDEV();
                IList list1 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                PSPDEV psp = new PSPDEV();
                Dictionary<string, double> nodeshorti = new Dictionary<string, double>();      //��¼ĸ����û�н��й���·
                KeyValuePair<string, double> maxshorti = new KeyValuePair<string, double>();
                con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='06'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                IList list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                if (caozuoi != 3)
                {
                    AllShorti(projectSUID, projectid, 0, ratecaplity, nodeshorti);
                    //�ҳ���·��������ֵ
                    //maxshorti.Key = 1;
                    //maxshorti.Value = nodeshorti[1];

                    foreach (KeyValuePair<string, double> keyvalue in nodeshorti)
                    {
                        if (keyvalue.Value > maxshorti.Value)
                        {
                            maxshorti = keyvalue;
                        }
                    }

                    //����ȡ����·�� �ж�����ĸ���ڲ��� ������ھͽ���ɾ�� Ȼ������ѹ���бȽ�

                    for (int i = 0; i < list.Count; i++)
                    {
                        bool flag = false;
                        pspDev = list[i] as PSPDEV;
                        for (int j = 0; j < list1.Count; j++)
                        {
                            psp = list1[j] as PSPDEV;
                            if (pspDev.IName == psp.Name)
                                flag = true;

                        }
                        if (!flag)
                        {
                            PSP_ElcDevice pel = new PSP_ElcDevice();
                            pel.ProjectSUID = projectSUID;
                            pel.DeviceSUID = pspDev.SUID;
                            UCDeviceBase.DataService.Delete<PSP_ElcDevice>(pel);
                            //UCDeviceBase.DataService.Delete<PSPDEV>(pspDev);
                        }
                    }
                    con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='06'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                    list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    for (int i = 0; i < list.Count; i++)
                    {
                        pspDev = list[i] as PSPDEV;
                        pspDev.HuganLine3 = "";
                        pspDev.KName = "";
                        if (pspDev.KSwitchStatus == "0")
                        {
                            pspDev.OutP = maxshorti.Value;
                            if (maxshorti.Value > pspDev.HuganTQ1)
                            {
                                pspDev.HuganLine3 = "���ϸ�";
                            }
                            else
                            {
                                pspDev.HuganLine3 = "�ϸ�";
                            }
                            pspDev.HuganLine4 = "";
                            if (pspDev.HuganLine3 == "�ϸ�")
                            {
                                pspDev.KName = "�ϸ�";
                            }
                            else
                                pspDev.KName = "���ϸ�";
                        }

                        UCDeviceBase.DataService.Update<PSPDEV>(pspDev);
                    }
                }

                switch (caozuoi)
                {
                    case 1:           //ȫ����·����
                        {
                            pspDev.SvgUID = projectSUID;
                            pspDev.Type = "06";
                            DlqiCheckform dlqicheckform = new DlqiCheckform(pspDev);
                            dlqicheckform.getusercltr.gridView.GroupPanelText = "��·�����������������������";
                            dlqicheckform.ShowDialog();
                            break;
                        }
                    case 2:             //����·����
                        {
                            con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='06'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                            list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                            for (int i = 0; i < list.Count; i++)
                            {
                                pspDev = list[i] as PSPDEV;
                                if (pspDev.KSwitchStatus == "0")
                                {
                                    con = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='01'AND PSPDEV.KSwitchStatus = '0'AND PSPDEV.Name='" + pspDev.IName + "'";

                                    IList list4 = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                                    psp = list4[0] as PSPDEV;
                                    try
                                    {
                                        pspDev.OutQ = nodeshorti[psp.Name];
                                        if (pspDev.HuganLine3 == "���ϸ�")
                                        {
                                            if (pspDev.OutQ <= pspDev.HuganTQ1)
                                            {
                                                pspDev.HuganLine3 = "�ϸ�";
                                            }
                                        }
                                        pspDev.HuganLine4 = "";

                                        if (pspDev.HuganLine3 == "�ϸ�")
                                        {
                                            pspDev.KName = "�ϸ�";
                                        }
                                        else
                                            pspDev.KName = "���ϸ�";
                                        UCDeviceBase.DataService.Update<PSPDEV>(pspDev);
                                    }
                                    catch (System.Exception ex)
                                    {
                                        MessageBox.Show("��·���ݲ�����");
                                    }
                                }

                            }
                            pspDev.SvgUID = projectSUID;
                            pspDev.Type = "06";
                            DlqiCheckform dlqicheckform = new DlqiCheckform(pspDev);
                            dlqicheckform.getusercltr.gridView.GroupPanelText = "����·У�˽����";
                            dlqicheckform.ShowDialog();
                            break;
                        }
                    case 3:          //��·��ֱ������
                        {
                            con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + projectSUID + "'AND PSPDEV.type='06'AND PSPDEV.KSwitchStatus = '0' order by PSPDEV.number";
                            list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                            for (int i = 0; i < list.Count; i++)
                            {
                                pspDev = list[i] as PSPDEV;
                                if (pspDev.KSwitchStatus == "0")
                                {
                                    double tx = 0.0;
                                    if (pspDev.HuganLine2 == "���ѿ۶�·��")
                                    {
                                        tx = 0.0;
                                    }
                                    else if (pspDev.HuganLine2 == "���������ѿ۵Ķ�·��")
                                    {
                                        tx = 10;
                                    }
                                    pspDev.HuganTQ4 = (pspDev.OutP / pspDev.HuganTQ1) * Math.Exp((-pspDev.HuganTQ2 - tx) / 45) * 100;
                                    pspDev.HuganTQ5 = (pspDev.OutQ / pspDev.HuganTQ1) * Math.Exp((-pspDev.HuganTQ2 - tx) / 45) * 100;
                                    if (pspDev.HuganTQ3 >= pspDev.HuganTQ4)
                                    {
                                        pspDev.HuganLine4 = "�ϸ�";
                                    }
                                    if (pspDev.HuganTQ3 >= pspDev.HuganTQ5)
                                    {
                                        pspDev.HuganLine4 = "�ϸ�";
                                    }
                                    else if (pspDev.HuganTQ3 < pspDev.HuganTQ5)
                                    {
                                        pspDev.HuganLine4 = "���ϸ�";
                                    }
                                    if (pspDev.HuganLine3 == "�ϸ�" && pspDev.HuganLine4 == "�ϸ�")
                                    {
                                        pspDev.KName = "�ϸ�";
                                    }
                                    else
                                    {
                                        pspDev.KName = "���ϸ�";
                                    }

                                    UCDeviceBase.DataService.Update<PSPDEV>(pspDev);
                                }

                            }
                            pspDev.SvgUID = projectSUID;
                            pspDev.Type = "06";
                            DlqiCheckform dlqicheckform = new DlqiCheckform(pspDev);
                            dlqicheckform.getusercltr.gridView.GroupPanelText = "��·��������������������";
                            dlqicheckform.ShowDialog();
                            break;
                        }

                }

            }
            catch (System.Exception ex)
            {
                MessageBox.Show("��·����������������·�����Ƿ��ܽ��У�");
            }
        }