private static string andparentlinename(sd_xl xl) { string linename = ""; sd_xl xl1 = Client.ClientHelper.PlatformSqlMap.GetOne<sd_xl>(" where lineid='" + xl.ParentID + "'"); if (xl1==null) { linename=xl.LineName; } else { linename += andparentlinename(xl1)+" "; linename += xl.LineName; } return linename; }
void treeViewOperator_AfterAdd(sd_xl newobj) { if (AfterAdd != null) AfterAdd(treeList1, newobj); }
void treeViewOperator_AfterDelete(sd_xl newobj) { if (AfterDelete != null) AfterDelete(treeList1, newobj); }
void treeViewOperator_CreatingObject(sd_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; }
internal static double CountLineLen(sd_xl xl) { double dLen0 = 0;//总长度,包括下级线路 double dLen1 = 0;//当前线路长度 IList<sd_gt> gtList = Client.ClientHelper.PlatformSqlMap.GetList<sd_gt>("where linecode='" + xl.LineCode + "' order by gtcode"); sd_gt gt0 = new sd_gt(); List<object> updateList = new List<object>(); for (int i = 0; i < gtList.Count; i++) { sd_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<sd_xl> xlList = Client.ClientHelper.PlatformSqlMap.GetList<sd_xl>("where parentid='" + xl.LineID + "' and linevol='" + xl.LineVol + "'"); foreach (sd_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; }
public UCsd_GT(sd_xl xl):this() { btGdsList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; btXlList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; ParentObj = xl; }