Ejemplo n.º 1
0
 void gridViewOperation_AfterEdit(PS_xl obj)
 {
     if (obj!=null)
     {
         Client.ClientHelper.PlatformSqlMap.Update<PS_xl>(obj);
     }
 }
Ejemplo n.º 2
0
 public static LineAnaly LineLossAnaly(PS_xl line)
 {
     LineAnaly lineAnaly = new LineAnaly();
     lineAnaly.LossRate = line.TheoryLoss / (line.LineP==Convert.ToDecimal(0)?Convert.ToDecimal(1):line.LineP);
     lineAnaly.EconomyLossRate = 2 * line.K * ((decimal)Math.Pow((double)(LineR(line) + ByqR(line)), 0.5)) / (Convert.ToDecimal(line.LineVol) * line.LineP / (decimal)(Math.Pow((double)(line.LineP * line.LineP + line.LineQ * line.LineQ), 0.5) * 1000));
     lineAnaly.EconomyI = (decimal)Math.Pow((double)(ByqP0(line)/(3*line.K*(LineR(line) + ByqR(line)))),0.5);
     lineAnaly.EconomyByqLoad = (decimal)Math.Pow((double)(ByqP0(line) / ( (LineR(line) + ByqR(line)))), 0.5);
     return lineAnaly;
 }
Ejemplo n.º 3
0
        public UCSharpeDxt(string lineCode) {

            InitializeComponent();
            createCheckGroup();
            PS_xl xl= ClientHelper.PlatformSqlMap.GetOne<PS_xl>("where linecode='" + lineCode + "'");
            if (xl != null)
                _xl = xl;
            InitTree();
            
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 计算线路长度 单位米
        /// 1、计算线路杆塔的档距
        /// 2、统计线路长度,包括分支线路。
        /// </summary>
        /// <param name="xl"></param>
        public static double CountLineLen(PS_xl xl) {
            double dLen0 = 0;//总长度,包括下级线路
            double dLen1 = 0;//当前线路长度
            IList<PS_gt> gtList = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>("where linecode='" + xl.LineCode + "' order by gtcode");
            PS_gt gt0 = new PS_gt();
            List<object> updateList = new List<object>();
            for(int i=0;i<gtList.Count;i++) {
                PS_gt gt = gtList[i];
                double d1 = 0;
                if (gt.gtLat == 0 || gt.gtLon == 0) d1=-1;
                if (gt0.gtLat == 0 || gt0.gtLon == 0) {
                    gt0 = gt; d1=-1;
                }
                if (d1 == 0) {
                    d1 = GetDistance(new PointLatLng(gt.gtLat, gt.gtLon), new PointLatLng(gt0.gtLat, gt0.gtLon));
                    gt.gtSpan = (decimal)Math.Round(d1, 1);
                    if (gt.gtSpan > 9999) {
                        string err=string.Format("数据异常,计算终止。异常杆塔号{0}-{1},所在线路{2}",gt0.gth,gt.gth,xl.LineName);
                        throw new Exception(err);
                    }
                } else {
                    gt.gtSpan = 0;
                    d1 = 0;
                }
                //gt.
                updateList.Add(gt);
                dLen1 += d1;
                gt0 = gt;
            }
            xl.WireLength =(int)(dLen1);//

            Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(null, updateList, null);
            updateList.Clear();
            IList<PS_xl> xlList = Client.ClientHelper.PlatformSqlMap.GetList<PS_xl>("where parentid='" + xl.LineID + "' and linevol='"+xl.LineVol+"'");
            foreach(PS_xl xl0 in xlList){
                double d0= CountLineLen(xl0);
                dLen0 += d0;
                if (xl0.TotalLength == (int)d0) continue;
                xl0.TotalLength = (int)d0;
                updateList.Add(xl0);
            }
            Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(null, updateList, null);
            dLen0 += dLen1;
            return dLen0;
        }
Ejemplo n.º 5
0
        private void simpleButton1_Click(object sender, EventArgs e) {
            //查询
            btnOK.Enabled = false;
            xl = null;
            xl = Client.ClientHelper.PlatformSqlMap.GetOne<PS_xl>(string.Format("where linecode='{0}'", txOldCode.Text.Trim()));
            if (xl != null) {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("线路代码:" + xl.LineCode);
                sb.AppendLine("线路名称:" + xl.LineName);
                sb.AppendLine("电压等级:" + xl.LineVol);
                var xlnum = Client.ClientHelper.PlatformSqlMap.GetRowCount<PS_xl>(string.Format("where linecode like '{0}%' and linevol='{1}'", xl.LineCode, xl.LineVol));
                sb.AppendLine("相关线路数:" + xlnum);

                var gtnum = Client.ClientHelper.PlatformSqlMap.GetRowCount<PS_gt>(string.Format("where linecode in (select linecode from ps_xl where linecode like '{0}%' and linevol='{1}')", xl.LineCode, xl.LineVol));
                
                sb.AppendLine("线路杆塔基数:" +gtnum);
                btnOK.Enabled = true;
                memoEdit1.Text = sb.ToString();
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 线路的变压器开路损耗
 /// </summary>
 /// <param name="listgt"></param>
 /// <returns></returns>
 public static decimal ByqP0(PS_xl line)//变压器开路损耗
 {
     IList<PS_gt> listGT = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>("SelectPS_gtList", "where LineCode ='" + line.LineCode + "'");
     decimal byqpk = 0;
     byqpk = ByqP0(listGT);
     return byqpk;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 变压器等值电阻
 /// </summary>
 /// <param name="line"></param>
 /// <returns></returns>
 public static decimal ByqR(PS_xl line)//变压器等值电阻
 {
     decimal byqloss = 0;
     IList<PS_gt> listGT = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>("SelectPS_gtList", "where LineCode ='" + line.LineCode + "' order by gtCode");
     decimal cap = ByqCapcity(listGT);
     if (cap!=0)
     {
         byqloss = Convert.ToDecimal(line.LineVol) * Convert.ToDecimal(line.LineVol) * ByqPk(listGT) / (cap * cap);
     }            
     return byqloss;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 线路变压器固定损耗
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
        public static decimal ByqLoss(PS_xl line)//变压器固定损耗
        {
            decimal byqloss = 0;
            IList<PS_gt> listGT = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>("SelectPS_gtList", "where LineCode ='" + line.LineCode + "'");

            byqloss = ByqP0(listGT)*line.TotalT/1000;
            return byqloss;
        }
Ejemplo n.º 9
0
        void treeViewOperator_CreatingObject(PS_xl newobj) {

        }
Ejemplo n.º 10
0
 void treeViewOperator_AfterDelete(PS_xl newobj) {
     if (AfterDelete != null)
         AfterDelete(treeList1, newobj);
 }
Ejemplo n.º 11
0
 void treeViewOperator_CreatingObject(PS_xl newobj) {
     string pid = getparentValue();
     TreeListNode pnode=null;
     if (treeList1.Selection[0] != null)
     {
          pnode = treeList1.Selection[0].ParentNode;
          
     }
     if (newobj.ParentID == pid) {//同级
         if(pnode!=null)
             Ebada.Core.ConvertHelper.CopyTo(pnode, newobj);
         newobj.LineCode = newobj.LineID = getcode(pnode, pnode!=null?pnode.Nodes:treeList1.Nodes);
         newobj.LineID += new Random().Next(10, 99);
        newobj.LineType =pnode==null?"1": Math.Min(3, pnode.Level + 2).ToString();
     } else {
         newobj.LineCode = newobj.LineID = getcode(treeList1.Selection[0], treeList1.Selection[0].Nodes);
         newobj.LineID += new Random().Next(10, 99);
         newobj.LineType = Math.Min(3, treeList1.Selection[0].Level + 2).ToString();
     }
     
     //newobj.LineVol = "10";
     newobj.OrgCode = parentID;
 }
Ejemplo n.º 12
0
 void treeViewOperator_CreatingObject(PS_xl newobj)
 {
     //newobj.OrgType = "0";
 }
Ejemplo n.º 13
0
        /// <summary>
        /// 新建对象设置Key值
        /// </summary>
        /// <param name="newobj"></param>
        void gridViewOperation_CreatingObjectEvent(PS_xl newobj) {

        }
Ejemplo n.º 14
0
        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(PJ_19 objorg) {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\19高压配电设备完好率汇总表.xls";

            ex.Open(fname);
            //此处写填充内容代码
            ex.SetCellValue(objorg.OrgName, 4, 2);
            IList<PS_xl> objlist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PS_xl>("where OrgCode ='" + objorg.OrgCode + "' and len(linecode)=6");
            //分页 将要变化的进行分页
            //建立一个求总和的
            PS_xl objz = new PS_xl();
            objlist.Insert(0, objz);
            double xlsum = 0, xl1 = 0, xl2 = 0, xl3 = 0, pdbysum = 0, pdbyts = 0, pdby1 = 0, pdbyts1 = 0, pdby2 = 0, pdbyts2 = 0, pdby3 = 0, pdbyts3 = 0, pdssum = 0, pdstssum = 0, pds1 = 0, pdsts1 = 0, pds2 = 0, pdsts2 = 0, pds3 = 0, pdsts3 = 0;
            double zskgsum = 0, zskg1 = 0, zskg2 = 0, zskg3 = 0;
            int pageindex = 1;
            //杆塔搜索语句


            if (pageindex < Ecommon.GetPagecount(objlist.Count, 13)) {
                pageindex = Ecommon.GetPagecount(objlist.Count, 13);
            }
            for (int j = 1; j <= pageindex; j++) {
                if (j > 1) {
                    ex.CopySheet(1, j);
                }
            }
            ex.ShowExcel();
            for (int j = 1; j <= pageindex; j++) {

                ex.ActiveSheet(j);

                int prepageindex = j - 1;
                //主题
                int starow = prepageindex * 13 + 1;
                int endrow = j * 13;
                if (objlist.Count > endrow) {
                    for (int i = 0; i < 13; i++) {
                        PS_xl obj = objlist[starow - 1 + i];

                        if (j == 1 && i == 0) {
                            //合计的先跳过
                            continue;
                        }
                        //
                        ex.SetCellValue(obj.LineName, 8 + i, 1);
                        //配电线路
                        string gtcon = string.Format(" gtID in (select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where left(LineCode,{0})='{1}' and linevol>=10.0))", obj.LineCode.Length, obj.LineCode);

                        object nobj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xllength", string.Format("where  left(LineCode,{0})='{1}' and linevol>=10.0", obj.LineCode.Length, obj.LineCode));
                        string length = nobj == null ? "0" : Convert.ToDouble(nobj) / 1000.0 + "";
                        string tqcon = "tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')";
                        ex.SetCellValue(length, 8 + i, 2);
                        xlsum += Convert.ToDouble(length);
                        nobj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xllength", string.Format("where  left(LineCode,{0})='{1}' and linevol>=10.0", obj.LineCode.Length, obj.LineCode));
                        length = nobj == null ? "0" : Convert.ToDouble(nobj) / 1000.0 + "";
                        ex.SetCellValue(length, 8 + i, 3);
                        xl1 += Convert.ToDouble(length);
                        length = "0";//二类
                        ex.SetCellValue(length, 8 + i, 4);
                        xl2 += Convert.ToDouble(length);
                        length = "0";//三类
                        ex.SetCellValue(length, 8 + i, 5);
                        xl3 += Convert.ToDouble(length);
                        ex.SetCellValue("100%", 8 + i, 6);
                        //配电变压器
                        string rl = "0";
                        object ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where  " + tqcon);
                        if (ob != null) {
                            rl = ob.ToString();
                        }
                        string ts = "0";
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where  " + tqcon);
                        if (ob != null) {
                            ts = ob.ToString();
                        }
                        ex.SetCellValue(rl + "/" + ts, 8 + i, 7);
                        pdbysum += Convert.ToDouble(rl);
                        pdbyts += Convert.ToDouble(ts);
                        rl = "0";
                        ts = "0";
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where  byqState='1'and " + tqcon);
                        if (ob != null) {
                            rl = ob.ToString();
                        }

                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where  byqState='1'and " + tqcon);
                        if (ob != null) {
                            ts = ob.ToString();
                        }

                        ex.SetCellValue(rl + "/" + ts, 8 + i, 8);
                        pdby1 += Convert.ToDouble(rl);
                        pdbyts1 += Convert.ToDouble(ts);
                        rl = "0";
                        ts = "0";
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where  byqState='2'and " + tqcon);
                        if (ob != null) {
                            rl = ob.ToString();
                        }
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where  byqState='2'and " + tqcon);
                        if (ob != null) {
                            ts = ob.ToString();
                        }
                        ex.SetCellValue(rl + "/" + ts, 8 + i, 9);
                        pdby2 += Convert.ToDouble(rl);
                        pdbyts2 += Convert.ToDouble(ts);
                        rl = "0";
                        ts = "0";
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where byqState='3'and " + tqcon);
                        if (ob != null) {
                            rl = ob.ToString();
                        }
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqState='3'and " + tqcon);
                        if (ob != null) {
                            ts = ob.ToString();
                        }
                        ex.SetCellValue(rl + "/" + ts, 8 + i, 10);
                        pdby3 += Convert.ToDouble(rl);
                        pdbyts3 += Convert.ToDouble(ts);
                        ex.SetCellValue("100%", 8 + i, 11);
                        rl = "0";
                        ts = "0";
                        //配电站
                        
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqRowCount", "Where   xlCode ='" + obj.LineCode + "'");
                        if (ob != null) {
                            ts = ob.ToString();
                        }
                        pdssum += Convert.ToDouble(rl);
                        pdstssum += Convert.ToDouble(ts);
                        ex.SetCellValue(ts, 8 + i, 12);
                        rl = "0";
                        ts = "0";

                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqRowCount", "Where   xlCode ='" + obj.LineCode + "'");
                        if (ob != null) {
                            ts = ob.ToString();
                        }
                        ex.SetCellValue( ts, 8 + i, 13);
                        pds1 += Convert.ToDouble(rl);
                        pdsts1 += Convert.ToDouble(ts);

                        rl = "0";
                        ts = "0";

                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqModle='配电站'or byqModle='配电亭' and byqState='2'and " + tqcon);
                        if (ob != null) {
                            ts = ob.ToString();
                        }
                        ex.SetCellValue(ts, 8 + i, 14);
                        pds2 += Convert.ToDouble(rl);
                        pdsts2 += Convert.ToDouble(ts);

                        rl = "0";
                        ts = "0";

                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqModle='配电站'or byqModle='配电亭' and byqState='3'and " + tqcon);
                        if (ob != null) {
                            ts = ob.ToString();
                        }
                        ex.SetCellValue( ts, 8 + i, 15);
                        pds3 += Convert.ToDouble(rl);
                        pdsts3 += Convert.ToDouble(ts);
                        ex.SetCellValue("100%", 8 + i, 16);
                        rl = "0";
                        ts = "0";
                        //柱上开关
                        string kg = "0";
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where" + gtcon);
                        if (ob != null) kg = ob.ToString();
                        ex.SetCellValue(kg, 8 + i, 17);
                        zskgsum += Convert.ToDouble(kg);
                        kg = "0";
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where " + gtcon);
                        if (ob != null) {
                            kg = ob.ToString();
                        }
                        ex.SetCellValue(kg, 8 + i, 18);
                        zskg1 += Convert.ToDouble(kg);
                        kg = "0";
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgkind='二类' and" + gtcon);
                        if (ob != null) {
                            kg = ob.ToString();
                        }
                        ex.SetCellValue(kg, 8 + i, 19);
                        zskg2 += Convert.ToDouble(kg);
                        kg = "0";
                        ob = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgkind='三类' and" + gtcon);
                        if (ob != null) {
                            kg = ob.ToString();
                        }
                        ex.SetCellValue(kg, 8 + i, 20);
                        zskg3 += Convert.ToDouble(kg);
                        ex.SetCellValue("100%", 8 + i, 21);




                    }
                } else if (objlist.Count <= endrow && objlist.Count >= starow) {
                    for (int i = 0; i < objlist.Count - starow + 1; i++) {
                        PS_xl obj = objlist[starow - 1 + i];
                        if (j == 1 && i == 0) {
                            //合计的先跳过
                            continue;
                        }
                        //
                        ex.SetCellValue(obj.LineName, 8 + i, 1);
                        //配电线路
                        object nobj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xllength", string.Format("where  left(LineCode,{0})='{1}' and linevol>=10.0", obj.LineCode.Length, obj.LineCode));
                        string length = nobj == null ? "0" : Convert.ToDouble(nobj) / 1000.0 + "";
                        string gtcon = string.Format(" gtID in (select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where left(LineCode,{0})='{1}' and linevol>=10.0))", obj.LineCode.Length, obj.LineCode);
                        string tqcon = "tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')";
                        ex.SetCellValue(length, 8 + i, 2);
                        xlsum += Convert.ToDouble(length);
                        nobj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xllength", string.Format("where  left(LineCode,{0})='{1}' and linevol>=10.0", obj.LineCode.Length, obj.LineCode)).ToString();
                        length = nobj == null ? "0" : Convert.ToDouble(nobj) / 1000.0 + "";
                        ex.SetCellValue(length, 8 + i, 3);
                        xl1 += Convert.ToDouble(length);
                        length = "0";// Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xllength", "where LineID='" + obj.LineCode + "'or(ParentID='" + obj.LineCode + "')and LineType='2'").ToString();
                        ex.SetCellValue(length, 8 + i, 4);
                        xl2 += Convert.ToDouble(length);
                        length = "0";// Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xllength", "where LineID='" + obj.LineCode + "'or(ParentID='" + obj.LineCode + "')and LineType='3'").ToString();
                        ex.SetCellValue(length, 8 + i, 5);
                        xl3 += Convert.ToDouble(length);
                        ex.SetCellValue("100%", 8 + i, 6);
                        //配电变压器
                        object bj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where  " + tqcon);
                        string rl = "0", ts = "0";
                        if (bj != null) {
                            nobj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where " + tqcon);
                            rl = nobj == null ? "0" : nobj.ToString();
                            ts = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where  " + tqcon).ToString();
                            ex.SetCellValue(rl + "/" + ts, 8 + i, 7);
                            pdbysum += Convert.ToDouble(rl);
                            pdbyts += Convert.ToDouble(ts);
                            nobj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where " + tqcon);
                            rl = nobj == null ? "0" : nobj.ToString();
                            ts = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where " + tqcon).ToString();
                            ex.SetCellValue(rl + "/" + ts, 8 + i, 8);
                            pdby1 += Convert.ToDouble(rl);
                            pdbyts1 += Convert.ToDouble(ts);
                            nobj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where  byqState='2'and " + tqcon);
                            rl = nobj == null ? "0" : nobj.ToString();
                            ts = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where  byqState='2'and " + tqcon).ToString();
                            ex.SetCellValue(rl + "/" + ts, 8 + i, 9);
                            pdby2 += Convert.ToDouble(rl);
                            pdbyts2 += Convert.ToDouble(ts);
                            nobj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where byqState='3'and " + tqcon);
                            rl = nobj == null ? "0" : nobj.ToString();
                            ts = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where  byqState='3'and " + tqcon).ToString();
                            ex.SetCellValue(rl + "/" + ts, 8 + i, 10);
                            pdby3 += Convert.ToDouble(rl);
                            pdbyts3 += Convert.ToDouble(ts);
                            ex.SetCellValue("100%", 8 + i, 11);
                            //配电站
                            ts = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqRowCount", "Where " + tqcon).ToString();
                            pdssum += Convert.ToDouble(rl);
                            pdstssum += Convert.ToDouble(ts);
                            ex.SetCellValue( ts, 8 + i, 12);
                            ts = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqRowCount", "Where " + tqcon).ToString();
                            ex.SetCellValue(ts, 8 + i, 13);
                            pds1 += Convert.ToDouble(rl);
                            pdsts1 += Convert.ToDouble(ts);
                            ts = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqModle='配电站'or byqModle='配电亭' and byqState='2'and " + tqcon).ToString();
                            ex.SetCellValue( ts, 8 + i, 14);
                            pds2 += Convert.ToDouble(rl);
                            pdsts2 += Convert.ToDouble(ts);
                            ts = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqModle='配电站'or byqModle='配电亭' and byqState='3'and " + tqcon).ToString();
                            ex.SetCellValue( ts, 8 + i, 15);
                            pds3 += Convert.ToDouble(rl);
                            pdsts3 += Convert.ToDouble(ts);
                            ex.SetCellValue("100%", 8 + i, 16);
                        }

                        //柱上开关
                        string kg = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where " + gtcon).ToString();
                        ex.SetCellValue(kg, 8 + i, 17);
                        zskgsum += Convert.ToDouble(kg);
                        kg = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgkind='一类' and " + gtcon).ToString();
                        ex.SetCellValue(kg, 8 + i, 18);
                        zskg1 += Convert.ToDouble(kg);
                        kg = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgkind='二类' and " + gtcon).ToString();
                        ex.SetCellValue(kg, 8 + i, 19);
                        zskg2 += Convert.ToDouble(kg);
                        kg = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgkind='三类' and " + gtcon).ToString();
                        ex.SetCellValue(kg, 8 + i, 20);
                        zskg3 += Convert.ToDouble(kg);
                        ex.SetCellValue("100%", 8 + i, 21);


                    }
                }
            }
            ex.ActiveSheet(1);
            //合计
            //配电线路
            ex.SetCellValue(xlsum.ToString(), 8, 2);
            ex.SetCellValue(xl1.ToString(), 8, 3);
            ex.SetCellValue(xl2.ToString(), 8, 4);
            ex.SetCellValue(xl3.ToString(), 8, 5);
            ex.SetCellValue("100%", 8, 6);
            //配电变压器
            ex.SetCellValue(pdbysum.ToString() + "/" + pdbyts.ToString(), 8, 7);
            ex.SetCellValue(pdby1.ToString() + "/" + pdbyts1.ToString(), 8, 8);
            ex.SetCellValue(pdby2.ToString() + "/" + pdbyts2.ToString(), 8, 9);
            ex.SetCellValue(pdby3.ToString() + "/" + pdbyts3.ToString(), 8, 10);
            ex.SetCellValue("100%", 8, 11);
            //变台边亭
            ex.SetCellValue(pdstssum.ToString(), 8, 12);
            ex.SetCellValue( pdsts1.ToString(), 8, 13);
            ex.SetCellValue( pdsts2.ToString(), 8, 14);
            ex.SetCellValue( pdsts3.ToString(), 8, 15);
            ex.SetCellValue("100%", 8, 16);
            //开关
            ex.SetCellValue(zskgsum.ToString(), 8, 17);
            ex.SetCellValue(zskg1.ToString(), 8, 18);
            ex.SetCellValue(zskg2.ToString(), 8, 19);
            ex.SetCellValue(zskg3.ToString(), 8, 20);
            ex.SetCellValue("100%", 8, 21);
            //在此处得到合计的内容
            ex.ShowExcel();
        }
Ejemplo n.º 15
0
        void btGdsList_EditValueChanged(object sender, EventArgs e) {
            IList<mOrg> list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("where orgcode='" + btGdsList.EditValue + "'");
            mOrg org = null;
            if (list.Count > 0)
            {
                org = list[0];
            }
            else
            {
                repositoryItemLookUpEdit2.DataSource = null;
            }

            if (org != null) {
                ParentObj = org;
                IList<PS_xl> xlList = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PS_xl>(" where OrgCode='" + org.OrgCode + "' and len(Linecode)=6");
                PS_xl xlTemp = new PS_xl();
                xlTemp.LineCode = "0";
                xlTemp.LineID = "0";
                xlTemp.LineName = "所有线路";
                xlList.Insert(0,xlTemp);
                repositoryItemLookUpEdit2.DataSource = xlList;                
                if (SelectGdsChanged != null)
                    SelectGdsChanged(this, org);
            }
            RefreshData();
        }
Ejemplo n.º 16
0
 private decimal lineLength(PS_xl line) {
     return line.WireLength / 1000m;
     //decimal length = 0, lineloss = 0;
     //IList<PS_gt> listGT = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>("SelectPS_gtList", "where LineCode ='" + line.LineCode + "' order by gtCode");
     //foreach (PS_gt gt in listGT) {
     //    IList<PS_xl> listxl = Client.ClientHelper.PlatformSqlMap.GetList<PS_xl>("SelectPS_xlList", " where ParentGT = '" + gt.gtCode + "'");
     //    if (listxl.Count == 0) {
     //        lineloss += gt.gtSpan;
     //        if (lineloss > length) {
     //            length = lineloss;
     //        }
     //    } else {
     //        foreach (PS_xl xl in listxl) {
     //            lineloss += lineLength(xl);
     //            if (lineloss > length) {
     //                length = lineloss;
     //            }
     //        }
     //    }
     //}
     //return length / 1000;
 }
Ejemplo n.º 17
0
 public void SetXL(PS_xl xl)
 {
     m_xl = xl;
 }
Ejemplo n.º 18
0
        public static LineOverlay CreateLine(GMapControl map, PS_xl xl){

            LineOverlay lay = CreateLine(map, xl.LineCode, xl.LineName);
            GMapRoute route = lay.Routes[0];
            if (route.Points.Count > 0)
                CreateLineSub(route, null);
            return lay;
        }
Ejemplo n.º 19
0
 void treeViewOperator_AfterEdit(PS_xl newobj) {
     if (AfterAdd != null)
         AfterEdit(treeList1, newobj);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public static void ExportExcel(PJ_16 obj1) {
     PS_xl xl = new PS_xl() { LineCode = obj1.LineCode, LineName = obj1.LineName };
     ExportExcel(xl);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 线路可变损耗
 /// </summary>
 /// <param name="line"></param>
 /// <returns></returns>
 public static decimal LineLoss(PS_xl line)//线路可变损耗
 {
     
     IList<PS_gt> listGT = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>("SelectPS_gtList", "where LineCode ='" + line.LineCode + "' order by gtCode");
     decimal capSum = ByqCapcity(listGT);
     decimal lineLoss = 0;
     if (capSum!=0)
     {
         if (string.IsNullOrEmpty(line.LineVol))
         {
             MainHelper.ShowWarningMessageBox("线路" + line.LineName + "的电压等级不存在!");
             return 0;
         }
         if (line.TotalT==0)
         {
             MainHelper.ShowWarningMessageBox("线路" + line.LineName + "的投入运行时间为0!");
             return 0;
         }
         lineLoss = (LineR(line) / (capSum * capSum) + ByqR(line)) * line.K * line.K * (line.LineP * line.LineP + line.LineQ * line.LineQ) / (Convert.ToDecimal(line.LineVol) * Convert.ToDecimal(line.LineVol) * line.TotalT * 1000);
     }           
     return lineLoss;
 }
Ejemplo n.º 22
0
        public static void ExportExcel(PS_xl obj) {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\16高压配电线路条图汇总表.xls";

            object ot = new object();
            ex.Open(fname);
            //设置格式      
            try {
                ex.MyExcel.get_Range("A1", "T35").NumberFormat = "@";//文本格式
            } catch { }

            //此处写填充内容代码
            //线路名称
            ex.SetCellValue(obj.LineName, 4, 2);
            //总的杆塔数
            string sumgt = "0";
            //ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_gtRowCount", "where LineCode='" + obj.LineCode + "'or LineCode in( select lineid from PS_xl where parentid='" + obj.LineCode + "')");
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_gtRowCount", string.Format("where gtjg='否' and  linecode in (select linecode from ps_xl where left(LineCode,{0})='{1}' and linevol='10')", obj.LineCode.Length, obj.LineCode));
            if (ot != null) {
                sumgt = ot.ToString();
            }
            ex.SetCellValue(sumgt, 7, 2);
            //铁塔
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_gtRowCount", string.Format("where gtjg='否' and gtType='铁塔' and  linecode in (select linecode from ps_xl where left(LineCode,{0})='{1}' and linevol='10')", obj.LineCode.Length, obj.LineCode));
            if (ot != null) {
                sumgt = ot.ToString();
            }
            ex.SetCellValue(sumgt, 8, 2);
            //钢管杆
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_gtRowCount", string.Format("where gtjg='否' and gtType='钢管杆' and  linecode in (select linecode from ps_xl where left(LineCode,{0})='{1}' and linevol='10')", obj.LineCode.Length, obj.LineCode));
            if (ot != null) {
                sumgt = ot.ToString();
            }
            ex.SetCellValue(sumgt, 9, 2);
            //水泥杆
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_gtRowCount", string.Format("where gtjg='否' and gtType like '混凝土%' and  linecode in (select linecode from ps_xl where left(LineCode,{0})='{1}' and linevol='10')", obj.LineCode.Length, obj.LineCode));
            if (ot != null) {
                sumgt = ot.ToString();
            }
            ex.SetCellValue(sumgt, 10, 2);
            //木杆
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_gtRowCount", string.Format("where gtjg='否' and gtType='木杆' and  linecode in (select linecode from ps_xl where left(LineCode,{0})='{1}' and linevol='10')", obj.LineCode.Length, obj.LineCode));
            if (ot != null) {
                sumgt = ot.ToString();
            }
            ex.SetCellValue(sumgt, 11, 2);
            //主干长
            string length = "0";
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xllength", string.Format(" where LineCode='{0}'", obj.LineCode));
            int lenzg = (int)ot;
            if (ot != null) {
                length = Math.Round(lenzg / 1000.0, 2) + "";//km
            }

            ex.SetCellValue(length, 9, 5);//主干
            //总长度
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xllength", string.Format("where  linecode like '{0}%' and linevol='10'", obj.LineCode));
            if (ot != null) {
                length = Math.Round((int)ot / 1000.0, 2) + "";
            }
            ex.SetCellValue(length, 9, 4);//小计(线路长度)
            ex.SetCellValue(length, 9, 3);//合计
            //分支线的数目和长度
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xlRowCount", string.Format("where  linecode like '{0}%' and linevol='10' and len(linecode)>6", obj.LineCode));
            if (ot != null) {
                sumgt = (int)ot + "";
            }
            ex.SetCellValue(sumgt, 9, 6);

            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_xllength", string.Format("where  linecode like '{0}%' and linevol='10' and len(linecode)>6", obj.LineCode));
            if (ot != null) {
                length = Math.Round((int)ot / 1000.0, 2) + "";
            }
            ex.SetCellValue(length, 9, 8);
            //供电半经
            double gdbj = jsgdbj(obj.LineCode);
            length = Math.Round(gdbj / 1000.0, 2) + "";
            ex.SetCellValue(length, 9, 13);
            //变压器容量和台

            //总容量
            string ts = "0";
            Object bj = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");
            if (bj != null) {
                if (!string.IsNullOrEmpty(obj.LineCode)) {
                    string rl = "0";
                    ot = bj;// Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");
                    if (ot != null) {
                        rl = ot.ToString();
                    }
                    ex.SetCellValue(rl, 15, 1);
                    ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where byqVol like '6%'AND byqPhase='单相'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");
                    rl = "0";
                    if (ot != null) {
                        rl = ot.ToString();
                    }
                    ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqVol like '6%'AND byqPhase='单相'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");

                    if (ot != null) {
                        ts = ot.ToString();
                    }
                    ex.SetCellValue(rl + "/" + ts, 15, 2);
                    ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where byqVol like '10%'AND byqPhase='单相'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");
                    rl = "0";
                    if (ot != null) {
                        rl = ot.ToString();
                    }
                    ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqVol like '10%'AND byqPhase='单相'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");
                    if (ot != null) {
                        ts = ot.ToString();
                    }
                    ex.SetCellValue(rl + "/" + ts, 15, 3);
                    rl = "0";
                    ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where byqVol like '6%'AND byqPhase='三相'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");
                    if (ot != null) {
                        rl = ot.ToString();
                    }
                    ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqVol like '6%'AND byqPhase='三相'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");
                    if (ot != null) {
                        ts = ot.ToString();
                    }
                    ex.SetCellValue(rl + "/" + ts, 15, 4);
                    ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqbyqCapcity", "Where byqVol like '10%'AND byqPhase='三相'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");
                    rl = "0";
                    if (ot != null) {
                        rl = ot.ToString();
                    }
                    ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqVol like '10%'AND byqPhase='三相'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "')");
                    if (ot != null) {
                        ts = ot.ToString();
                    }
                    ex.SetCellValue((rl + "/" + ts).ToString(), 15, 5);
                }

            }
            object ot1 = null, ot2 = null;
            int 小计 = 0;
            int 合计 = 0;


            //开关
            string kg = "0";

            //    ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgModle='油开关'and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgModle like '%DW%' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            ot = ot ?? 0;
            合计 += Convert.ToInt32(ot);
            kg = ot.ToString();
            ex.SetCellValue(kg, 15, 8);

            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgModle like '%ZW%' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            ot = ot ?? 0;
            合计 += Convert.ToInt32(ot);
            kg = ot.ToString();
            ex.SetCellValue(kg, 16, 8);

            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgModle like '%SF6%' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            ot = ot ?? 0;
            合计 += Convert.ToInt32(ot);
            kg = ot.ToString();

            ex.SetCellValue(kg, 17, 8);

            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where kgModle like '%智能%' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            ot = ot ?? 0;
            合计 += Convert.ToInt32(ot);
            kg = ot.ToString();
            ex.SetCellValue(kg, 18, 8);
            //跌落开关
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", string.Format("select sum(sbNumber) from ps_tqsb Where sbname='跌落保险'  and tqID in(select tqid from ps_tq WHERE xlCode ='{0}' )", obj.LineCode));
            ot = ot ?? 0;
            合计 += Convert.ToInt32(ot);
            kg = ot.ToString();
            ex.SetCellValue(kg, 19, 8);
            //开关合计
            //ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_kgRowCount", "Where gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");

            kg = 合计.ToString();
            ex.SetCellValue(kg, 14, 8);

            合计 = 0;
            //台区
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqRowCount", "Where   xlCode ='" + obj.LineCode + "'");
            ts = "0";
            if (ot != null) {
                ts = ot.ToString();
            }
            ex.SetCellValue(ts, 21, 8);
            ts = "0";
            ot = null;// Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqModle='配电站'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "'or xlCode2 in(select lineid from ps_xl where ParentID='" + obj.LineCode + "'))");
            if (ot != null) {
                ts = ot.ToString();
            }
            ex.SetCellValue(ts, 22, 8);
            ts = "0";
            ot = null;// Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_tqbyqRowCount", "Where byqModle='配电亭'and tqID in (select tqID from ps_tq where xlCode ='" + obj.LineCode + "'or xlCode2 in(select lineid from ps_xl where ParentID='" + obj.LineCode + "'))");
            if (ot != null) {
                ts = ot.ToString();
            }
            ex.SetCellValue(ts, 23, 8);
            //避雷器
            string blq = "0";


            //统计型号'Y%'
            //统计杆塔设备库
            ot1 = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", string.Format("select sum(sbNumber) from ps_gtsb Where sbname='避雷器' and sbModle like 'Y%' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT linecode from ps_xl where left(LineCode,{0})='{1}' and linevol='10' ))", obj.LineCode.Length, obj.LineCode));
            //统计台区设备库
            ot2 = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", string.Format("select sum(sbNumber) from ps_tqsb Where sbname='避雷器' and sbModle like 'Y%' and tqID in(select tqid from ps_tq WHERE xlCode ='{0}' )", obj.LineCode));
            ot1 = ot1 ?? 0;
            ot2 = ot2 ?? 0;
            小计 = Convert.ToInt32(ot1) + Convert.ToInt32(ot2);
            合计 += 小计;
            blq = 小计.ToString();
            ex.SetCellValue(blq, 15, 13);

            //统计型号'FZ%'            
            ot1 = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", string.Format("select sum(sbNumber) from ps_gtsb Where sbname='避雷器' and sbModle like 'FZ%' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT linecode from ps_xl where left(LineCode,{0})='{1}' and linevol='10' ))", obj.LineCode.Length, obj.LineCode));
            ot2 = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", string.Format("select sum(sbNumber) from ps_tqsb Where sbname='避雷器' and sbModle like 'FZ%' and tqID in(select tqid from ps_tq WHERE xlCode ='{0}' )", obj.LineCode));
            ot1 = ot1 ?? 0;
            ot2 = ot2 ?? 0;
            小计 = Convert.ToInt32(ot1) + Convert.ToInt32(ot2);
            合计 += 小计;
            blq = 小计.ToString();
            ex.SetCellValue(blq, 16, 13);

            //
            blq = "0";
            //ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_gtsbRowCount", string.Format("Where sbname='避雷器'and sbModle like '%Y5WZ-17/45%' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT linecode from ps_xl where left(LineCode,{0})='{1}' and linevol='10' ))", obj.LineCode.Length, obj.LineCode));
            if (ot != null) {
                blq = ot.ToString();
            }
            ex.SetCellValue(blq, 17, 13);

            blq = 合计.ToString();
            ex.SetCellValue(blq, 14, 13);
            合计 = 0;
            //绝缘子
            string jyuz = "0";
            //  ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_gtsbRowCount", "Where sbname='绝缘子' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            ot = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select sum(sbNumber) from ps_gtsb Where (sbname='高压立瓶' or sbname='高压悬垂' or sbname='高压悬式绝缘子'  or sbname='高压针式绝缘子' or sbname='10KV楔型耐张') and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            if (ot != null) {
                jyuz = ot.ToString();
            }
            ex.SetCellValue(jyuz, 21, 13);
            jyuz = "0";
            //    ot = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select sum(sbNumber) from ps_gtsb Where (sbname='高压立瓶' or sbname='高压针式绝缘子')and (sbModle like  'fp%' or sbModle like  'p-%'or sbModle like  '棕红色硅胶%') and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");

            ot = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select sum(sbNumber) from ps_gtsb Where (sbname='高压立瓶' or sbname='高压针式绝缘子') and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            if (ot != null) {
                jyuz = ot.ToString();
            }
            ex.SetCellValue(jyuz, 22, 13);
            jyuz = "0";
            //       ot = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select sum(sbNumber) from ps_gtsb Where  (sbname='高压悬垂' or sbname='高压悬式绝缘子')and (sbModle like  'fsw%' or sbModle like  'xp-%')  and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");

            ot = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select sum(sbNumber) from ps_gtsb Where  (sbname='高压悬垂' or sbname='高压悬式绝缘子') and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            if (ot != null) {
                jyuz = ot.ToString();
            }
            ex.SetCellValue(jyuz, 23, 13);
            jyuz = "0";
            //          ot = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select sum(sbNumber) from ps_gtsb Where sbname='10KV楔型耐张'and sbModle like 'j10%' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");

            ot = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select sum(sbNumber) from ps_gtsb Where sbname='10KV楔型耐张' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            if (ot != null) {
                jyuz = ot.ToString();
            }
            ex.SetCellValue(jyuz, 24, 13);
            //  ot = Client.ClientHelper.PlatformSqlMap.GetObject("GetPS_gtsbRowCount", "Where sbname='绝缘子'and sbModle='FPQ2W-10/3T20' and gtID in(select gtID from ps_gt WHERE LineCode IN (SELECT lineid from ps_xl where lineid='" + obj.LineCode + "'or ParentID='" + obj.LineCode + "'))");
            // if (ot != null) {
            //     jyuz = ot.ToString();
            //  }
            //  ex.SetCellValue(jyuz, 25, 13);

            ex.ShowExcel();
            Microsoft.Office.Interop.Excel.Worksheet ws = ex.MyExcel.ActiveSheet as Microsoft.Office.Interop.Excel.Worksheet;
            if (ws != null)
                ws.PrintPreview(true);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 线路等值电阻
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
        public static decimal LineR(PS_xl line)//线路等值电阻
        {
            decimal lineloss = 0;
            IList<PS_gt> listGT = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>("SelectPS_gtList", "where LineCode ='" + line.LineCode + "' order by gtCode");
            IList<PS_dxxh> listxh = Client.ClientHelper.PlatformSqlMap.GetList<PS_dxxh>("SelectPS_dxxhList", "where dydj = '" + line.LineVol + "' and dxxh = '" + line.WireType + "'");
            if (listxh.Count<=0)
            {               
                return 0;
            }
            PS_dxxh xh = listxh[0];
            //IList<PS_gt> listGTAfterRemove = new List<PS_gt>(); ;
            //foreach (PS_gt gt in listGT)
            //{
            //    listGTAfterRemove.Add(gt);
            //}
            decimal capSum = ByqCapcity(listGT);
            IList<PS_XLSec>  xlSecList = ListCacheHelper.GetXLSecList(line.SectionalizedMessage);
            foreach (PS_gt gt in listGT) 
            {
                foreach (PS_XLSec xlSec in xlSecList)
                {
                    if (Convert.ToDouble(gt.gtCode) > Convert.ToDouble( xlSec.StartGT) && Convert.ToDouble(gt.gtCode) <= Convert.ToDouble(xlSec.EndGT))
                    {
                        IList<PS_dxxh> listxhnew = Client.ClientHelper.PlatformSqlMap.GetList<PS_dxxh>("SelectPS_dxxhList", "where dydj = '" + line.LineVol + "' and dxxh = '" + xlSec.LineType + "'");
                        if (listxh.Count > 0)
                        {
                            xh = listxhnew[0];
                        }
                        break;
                    }
                }
                //decimal cap = ByqCapcity(listGTAfterRemove);
                lineloss += xh.dwdz * gt.gtSpan * capSum * capSum;
                capSum -= ByqCapcity(gt);
                //listGTAfterRemove.Remove(gt);
            }

            IList<PS_xl> listXL = GetChildrenList(line.LineID);
            foreach (PS_xl linexl in listXL)
            {
                lineloss += LineR(linexl);
            }
            return lineloss;
            
        }
Ejemplo n.º 24
0
 public UCPS_GT(PS_xl xl):this() {
     btGdsList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
     btXlList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
     ParentObj = xl;
 }
Ejemplo n.º 25
0
 /// <summary>
 /// 线路变压器容量
 /// </summary>
 /// <param name="gt"></param>
 /// <returns></returns>
 public static decimal ByqCapcityByLine(PS_xl line)//变压器容量
 {            
     IList<PS_gt> listGT = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>("SelectPS_gtList", "where LineCode ='" + line.LineCode + "'");
     return ByqCapcity(listGT);
 }
Ejemplo n.º 26
0
 private static string andparentlinename(PS_xl xl) {
     string linename = "";
     PS_xl xl1 = Client.ClientHelper.PlatformSqlMap.GetOne<PS_xl>(" where lineid='" + xl.ParentID + "'");
     if (xl1 == null) {
         linename = xl.LineName;
     } else {
         linename += andparentlinename(xl1) + " ";
         linename += xl.LineName;
     }
     return linename;
 }
Ejemplo n.º 27
0
 /// <summary>
 /// 线路的变压器开路损耗
 /// </summary>
 /// <param name="listgt"></param>
 /// <returns></returns>
 public static decimal CapacityLoss(PS_xl line)//电容器损耗
 {
     return 0;
 }
Ejemplo n.º 28
0
        public PS_xl GetXL() {

            if (!string.IsNullOrEmpty(frm.LineCode)) {
                if (mXL != null && mXL.LineCode == frm.LineCode) {

                } else {
                    mXL = Client.ClientHelper.PlatformSqlMap.GetOne<PS_xl>(" where LineCode='" + frm.LineCode + "'");
                }
            }
            return mXL;
        }
Ejemplo n.º 29
0
 /// <summary>
 /// 线路线损
 /// </summary>
 /// <param name="line">线路</param>
 /// <returns>输入线路的线损</returns>
 public static decimal Loss(PS_xl line)//线损
 {
     decimal loss = 0;
     loss = LineLoss(line) + ByqLoss(line);
     return loss;
 }
Ejemplo n.º 30
0
        void treeViewOperator_CreatingObject(PS_xl newobj) {
            string pid = getparentValue();
            TreeListNode pnode = null;
            PS_xl xl1 = null;
            if (treeList1.Selection.Count > 0) {
                xl1 = treeList1.GetDataRecordByNode(treeList1.Selection[0]) as PS_xl;
                pnode = treeList1.Selection[0].ParentNode;
            }
            string linecode = "";
            if (newobj.ParentID == pid) {//同级
                linecode = getcode(pnode, pnode != null ? pnode.Nodes : treeList1.Nodes);
            } else {
                linecode = getcode(treeList1.Selection[0], treeList1.Selection[0].Nodes);
            }
            pid = newobj.ParentID;
            if (xl1 != null)
                Ebada.Core.ConvertHelper.CopyTo(xl1, newobj);
            else if (xl != null) {
                Ebada.Core.ConvertHelper.CopyTo(xl, newobj);
                newobj.LineType = "1";
                newobj.Contractor = tq.Contractor;
            }

            newobj.ParentID = pid;
            if (pid == "0") newobj.ParentID = tq.tqCode;
            newobj.LineID = newobj.LineCode = linecode;
            newobj.LineID += new Random().Next(10, 99);
            newobj.LineVol = "0.4";
            newobj.LineName = "";
            newobj.ParentGT = "";
        }