コード例 #1
0
ファイル: SbFuns.cs プロジェクト: s7loves/mypowerscgl
        /// <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;
        }
コード例 #2
0
ファイル: LineLossHelper.cs プロジェクト: s7loves/mypowerscgl
 /// <summary>
 /// 杆塔变压器容量
 /// </summary>
 /// <param name="gt"></param>
 /// <returns></returns>
 public static decimal ByqCapcity(PS_gt gt)//变压器容量
 {
     decimal byqCap = 0;
     IList<PS_xl> listXL = Client.ClientHelper.PlatformSqlMap.GetList<PS_xl>("SelectPS_xlList", " where ParentGT = '" + gt.gtCode + "'");
     foreach (PS_xl line in listXL)
     {
         byqCap += ByqCapcityByLine(line);
     }
     IList<PS_tq> listTQ = Client.ClientHelper.PlatformSqlMap.GetList<PS_tq>("SelectPS_tqList", "where gtID = '" + gt.gtID + "'");
     foreach (PS_tq tq in listTQ)
     {
         IList<PS_tqbyq> listTQBYQ = Client.ClientHelper.PlatformSqlMap.GetList<PS_tqbyq>("SelectPS_tqbyqList", "where tqID = '" + tq.tqID + "'");
         foreach (PS_tqbyq tqbyq in listTQBYQ)
         {
             byqCap += tqbyq.byqCapcity;
         }
     }
     return byqCap;
 }
コード例 #3
0
ファイル: frmgtsbEditM.cs プロジェクト: s7loves/mypowerscgl
 public itemobj(PS_gt gt) {
     Gt = gt;
 }
コード例 #4
0
ファイル: CAD.cs プロジェクト: s7loves/mypowerscgl
 private double getAndgle(PS_gt gt0, PS_gt gt1) {
     int b = 10^6;
     //double[] pnt = new double[3];
     //pnt[0] = (double)gt0.gtLon*b;
     //pnt[1] = (double)gt0.gtLat*b;
     //PointF p1 = new PointF((float)pnt[0], (float)pnt[1]);
     //PointF p2 = new PointF((float)gt1.gtLon*b, (float)gt1.gtLat*b);
     //double x = pnt[0] > (double)gt1.gtLon*b  ? pnt[0]: (double)gt1.gtLon*b;
     //double y = pnt[1] < (double)gt1.gtLat*b  ? pnt[1]: (double)gt1.gtLat*b;
     //PointF p0 = new PointF((float)x, (float)y);
     //double ss = 0;
     //if (p1.Y < p2.Y) {
     //    ss = getAngle(p1, p2, p0);
     //} else {
     //    ss = getAngle(p2, p1, p0);
     //}
     double ss = 0;
     ss = getAngle((float)gt0.gtLon * b, (float)gt0.gtLat * b, (float)gt1.gtLon * b, (float)gt1.gtLat * b);
     return ss;
 }
コード例 #5
0
ファイル: UCPS_GT.cs プロジェクト: s7loves/mypowerscgl
 private void btAddM_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
     if (parentID == null)
         return;
     PS_gt gt = new PS_gt();
     gt.gth = getGgh();
     gt.gtCode = ParentObj.LineCode + gt.gth;
     gt.gtSpan = 50;
     gt.gtMs = 1.7m;
     gt.gtHeight = 10m;
     gt.gtNode = "否";
     gt.gtModle = "直线杆";
     gt.gtType = "混凝土拔梢杆";
     frmgtEdit frm = new frmgtEdit();
     frm.RowData = gt;
     frm.MultipleAdd = true;//批量增加
     if (frm.ShowDialog() == DialogResult.OK) {
         gt = frm.RowData as PS_gt;
         int num = frm.MultipleNum;//批量增加杆塔数
         int gh = int.Parse(gt.gth);
         int count = num;
         PS_Image image = null;
         if (frm.GetImage() != null) {
             count++;
             image = new PS_Image();
             image.ImageName = "杆塔照片";
             image.ImageType = "gt";
             image.ImageData = (byte[])frm.GetImage();
             gt.ImageID = image.ImageID;
         }
         object[] gts = new object[count];
         if (image != null)
             gts[count - 1] = image;
         gt.LineCode = ParentObj.LineCode;
         string id = DateTime.Now.ToString("yyyyMMddHHmmss");
         
         for (int i = 0; i < num; i++) {
             PS_gt newgt = new PS_gt();
             Ebada.Core.ConvertHelper.CopyTo(gt, newgt);
             
             string gth = (gh + 10 * i).ToString("0000");
             newgt.gth = gth;
             newgt.gtID=newgt.gtCode = newgt.LineCode + gth;
             newgt.gtID+= mRandom.Next(10, 99);
             gts[i] = newgt;
         }
         Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(gts, null, null);
         gridViewOperation.BindingList.Add(gts);
     }
 }
コード例 #6
0
ファイル: UCPS_GT.cs プロジェクト: s7loves/mypowerscgl
 /// <summary>
 /// 新建对象设置Key值
 /// </summary>
 /// <param name="newobj"></param>
 void gridViewOperation_CreatingObjectEvent(PS_gt newobj)
 {
     if (parentID == null) return;
     newobj.LineCode = parentID;
     if (gtInsert) {
         gtInsert = false;
         newobj.gth = getInsertGh();
     } else {
         newobj.gth = getGgh();
     }
     newobj.gtCode = ParentObj.LineCode + newobj.gth;
     newobj.c1 = newobj.gth;
     newobj.gtID = newobj.gtCode;
     newobj.gtID += mRandom.Next(10, 99);
     newobj.gtSpan = 50;
     newobj.gtMs = 1.7m;
     newobj.gtHeight = 10m;
     newobj.gtNode = "否";
     newobj.gtModle = "直线杆";
     newobj.gtType = "混凝土拔梢杆";
 }
コード例 #7
0
ファイル: LineOverLay.cs プロジェクト: s7loves/mypowerscgl
        public void ShowDialog(GMapMarker marker) {
            if (marker.Tag is sd_gt) {

                ShowDialogSD(marker);
                return;
            }
            frmgtEdit frm = new frmgtEdit();            
            PS_gt gt0 = marker.Tag as PS_gt;
            GMapMarkerVector pm = (marker as GMapMarkerVector).ParentMarker;
            if (pm != null) {
                gt0.gtSpan = (decimal)Math.Round(control.Manager.GetDistance(pm.Position, marker.Position)*1000, 1);
            }
            PS_gt gt2 = new PS_gt();
            Ebada.Core.ConvertHelper.CopyTo(gt0, gt2);
            frm.RowData =  gt2;
            frm.ShowTab2 = true;
            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK && allowEdit) {
                Ebada.Core.ConvertHelper.CopyTo(frm.RowData, gt0);
                PS_gt gt = gt0;
                PS_Image image = frm.GetPS_Image();
                if (frm.GetImage() != null) {
                    if (gt.ImageID == "" || image == null) {
                        image = new PS_Image();
                        image.ImageName = "杆塔照片";
                        image.ImageType = "gt";
                        image.ImageData = (byte[])frm.GetImage();
                        gt.ImageID = image.ImageID;
                        Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(image, gt, null);
                    } else {

                        Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(null, new object[] { gt, image }, null);
                    }

                } else {
                    Client.ClientHelper.PlatformSqlMap.Update<PS_gt>(gt);
                }
                
                marker.Position = new PointLatLng((double)gt.gtLat, (double)gt.gtLon);
                OnMarkerChanged(marker as GMapMarkerVector);
            }
        }