示例#1
0
 private void Btn_Add_Click(object sender, EventArgs e)
 {
     try
     {
         var g3e_fno = Combox_sblx.Text.Trim();
         var xhge    = Txt_xhge.Text.Trim();
         if (!string.IsNullOrEmpty(g3e_fno) && !string.IsNullOrEmpty(xhge))
         {
             var fno        = int.Parse(Combox_sblx.SelectedValue.ToString());
             var sourceXHGE = DBEntityFinder.Instance.GetCDXHGE(fno, xhge);
             if (sourceXHGE == null)
             {
                 var result  = InsertDBEntity.InsertXHGE(fno, xhge, null);
                 var message = result ? "添加成功!" : "添加失败!";
                 MessageBox.Show(message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("该型号规格已存在!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
             }
         }
         else
         {
             MessageBox.Show("请把信息填写完整!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }catch (Exception exception)
     {
         MessageBox.Show("添加失败!\n错误信息:" + exception.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#2
0
        /// <summary>
        /// 添加受电馈线
        /// </summary>
        /// <param name="bdz">变电站</param>
        /// <param name="kx">馈线名称</param>
        /// <param name="rowIndex">当前行索引</param>
        private void InsertSDKXAC(string bdz, string kx, int rowIndex)
        {
            //查询受电馈线是否已添加
            var result = DBEntityFinder.Instance.HasSDKX(CurrentFid, bdz, kx);

            if (!result)
            {
                var common = DBEntityFinder.Instance.GetCommon_n(CurrentFid);
                var id     = InsertDBEntity.InsertSDKX(common, bdz, kx);
                if (id > 0)
                {
                    DGV_SDKX.CurrentRow.Cells[2].Value = id;
                    AddSdkxList(kx);
                    #region  步更新校验结果

                    if (MenuControl.orderVerify != null)
                    {
                        var ow = new orderWorkifyArgs
                        {
                            FID = CurrentFid,
                            FNO = CurrentFno
                        };
                        FromPanelMsg(new object(), ow);
                    }
                    #endregion
                }
                PublicMethod.Instance.ShowMessage(id > 0 ? "添加成功!" : "添加失败!");
            }
            else
            {
                //馈线重复,清空
                DGV_SDKX.Rows[rowIndex].Cells[1].Value = "";
                PublicMethod.Instance.ShowMessage("馈线重复!");
            }
        }
示例#3
0
        /// <summary>
        /// 断开导线自动建立包含关系
        /// </summary>
        /// <param name="dxObjIds">导线实体对象ID集合</param>
        private void BreakDxAutoContains(IList <ObjectId> dxObjIds)
        {
            //电杆对象ID集合
            var dgObjIds = LateralLine.dgObjIdList;
            //电杆数
            var dgCount = dgObjIds.Count;

            for (int i = 0; i < dgCount; i++)
            {
                //取得电杆坐标数据
                var dgPt = GetPtValue(i, dgObjIds);

                //最后一根电杆只包含一条线
                if (dgCount - 1 == i)
                {
                    var dxPt = GetPtValue(i, dxObjIds);
                    //获取导线包含表cid
                    var cid = DBEntityFinder.Instance.GetContainCount(dxPt.G3E_FID);
                    InsertDBEntity.AddContain(cid, dgPt.G3E_FID, dxPt);
                }
                else
                {
                    //电杆前面的导线
                    var previousDxPt = GetPtValue(i, dxObjIds);
                    //获取导线包含表cid
                    var cid = DBEntityFinder.Instance.GetContainCount(previousDxPt.G3E_FID);

                    cid = InsertDBEntity.AddContain(cid, dgPt.G3E_FID, previousDxPt);
                    //电杆后面的导线
                    var lastDxPt = GetPtValue(i + 1, dxObjIds);
                    InsertDBEntity.AddContain(cid, dgPt.G3E_FID, lastDxPt);
                }
            }
        }
示例#4
0
 /// <summary>
 /// 新增受电馈线
 /// </summary>
 /// <param name="bdz"></param>
 /// <param name="kxmc"></param>
 private void AddSDKX(string bdz, string kxmc)
 {
     if (_sdkxAcCommons != null && _sdkxAcCommons.Any())
     {
         IList <long> errors = new List <long>();
         foreach (var com in _sdkxAcCommons)
         {
             var kxs = DBEntityFinder.Instance.GetSdkxAcByG3e_FID(com.G3E_FID);
             var kxh = kxs.Where(o => o.KXH == kxmc && o.GDBDZ == bdz);
             if (!kxh.Any())
             {
                 var id = InsertDBEntity.InsertSDKX(com, bdz, kxmc);
                 if (id == 0)
                 {
                     errors.Add(com.G3E_FID);
                 }
             }
         }
         if (errors.Any())
         {
             GetError("新增失败!", errors);
         }
         else
         {
             MessageBox.Show("新增成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
         }
         //重新绑定
         GetSymbolSDKXUnion();
     }
 }
示例#5
0
        /// <summary>
        /// 连续导线自动建立包含关系
        /// </summary>
        /// <param name="dxObjId">导线实体对象ID</param>
        private void ContinuouslyDxAutoContains(ObjectId dxObjId)
        {
            var dxPt = DBSymbolFinder.Instance[dxObjId];

            //获取导线包含表cid
            var cid = DBEntityFinder.Instance.GetContainCount(dxPt.G3E_FID);

            foreach (var item in LateralLine.dgObjIdList)
            {
                //取得电杆坐标数据
                var dgPt = DBSymbolFinder.Instance[item];
                //添加包含关系
                InsertDBEntity.AddContain(cid, dgPt.G3E_FID, dxPt);
            }
        }
示例#6
0
        private void AddZxbz()
        {
            var ssdw   = ComBox_SSDW.Text;
            var bzlx   = ComBox_BZLX.Text;
            var bzText = TXT_BZNR.Text.Trim();

            if (string.IsNullOrEmpty(bzlx))
            {
                MessageBox.Show("标注类型不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (!string.IsNullOrEmpty(bzText))
            {
                //if (!DBEntityFinder.Instance.HasZxbz(entityArgs.g3eObject.G3E_FID.ToString()))
                //{
                isInsert        = true;
                Btn_Add.Enabled = false;
                //杂项标注图层
                var layerID = DCadApi.addLayer("杂项标注");
                //标注大小
                var lbHeight = 0.35 / MapConfig.Instance.earthscale;
                //标注颜色
                var color = Autodesk.AutoCAD.Colors.Color.FromRgb(0, 0, 0);
                ViewHelper.zxLabelManagerPs.KeepFocus = false;
                Entity mText;
                if (bzText.Contains("\n"))
                {
                    mText = SymbolLabel.Mtext(bzText, Point3d.Origin, 0, lbHeight, layerID);
                    //if (!PublicMethod.Instance.MultTextStyleId.IsNull)
                    //    ((MText)mText).TextStyleId = PublicMethod.Instance.MultTextStyleId;
                }
                else
                {
                    mText = SymbolLabel.AddText(bzText, Point3d.Origin, 0, lbHeight, layerID, color);
                }
                if (BlockJig.Jig(mText, true))
                {
                    isInsert = false;
                    DCadApi.AddPinchPoint(mText);
                    DCadApi.AddLabelPinchPoint(mText);
                    //添加到当前模型中
                    var objId = PublicMethod.Instance.ToModelSpace(mText);
                    //转换成空间坐标
                    var            mpt = ConvertGeometry.Instance.GetMultipoint(objId);
                    ElectronSymbol pt  = null;
                    //添加杂标数据
                    var result = InsertDBEntity.InsertZXBZ(entityArgs.g3eObject.G3E_FID, bzText, bzlx, ssdw, mpt, ref pt);
                    if (pt != null)
                    {
                        //保存记录
                        DBSymbolFinder.Instance.Add(objId, pt);
                    }
                    var message = result ? "新增成功!" : "新增失败!";
                    ViewHelper.zxLabelManagerPs.KeepFocus = true;
                    PublicMethod.Instance.ShowMessage(message);
                }
                Btn_Add.Enabled = true;
                //}
                //else
                //    MessageBox.Show("杂项标注已添加!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                TXT_BZNR.Focus();
                MessageBox.Show("标注内容不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }