Пример #1
0
        private static TunnelHChuan selectTunnelHChuan(int tunnelHChuanID)
        {
            ManageDataBase db = new
                                ManageDataBase(DATABASE_TYPE.MiningSchedulingDB);
            string sql = "SELECT * FROM " +
                         TunnelHChuanDbConstNames.TABLE_NAME + " WHERE " +
                         TunnelHChuanDbConstNames.ID + " = " + tunnelHChuanID;
            DataSet      ds = db.ReturnDS(sql);
            TunnelHChuan tunnelHChuanEntity = new TunnelHChuan();

            if (ds.Tables[0].Rows.Count > 0)
            {
                try
                {
                    tunnelHChuanEntity.Id =
                        (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.ID];
                    tunnelHChuanEntity.TunnelId1 =
                        (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_ID1];
                    tunnelHChuanEntity.TunnelId2 =
                        (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_ID2];
                    tunnelHChuanEntity.X1 =
                        (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_X1];
                    tunnelHChuanEntity.Y1 =
                        (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_Y1];
                    tunnelHChuanEntity.Z1 =
                        (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_Z1];
                    tunnelHChuanEntity.X2 =
                        (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_X2];
                    tunnelHChuanEntity.Y2 =
                        (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_Y2];
                    tunnelHChuanEntity.Z2 =
                        (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_Z2];
                    tunnelHChuanEntity.Azimuth =
                        (double)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_AZIMUTH];
                    tunnelHChuanEntity.Team.TeamId =
                        (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TEAM_NAME_ID];
                    tunnelHChuanEntity.StartDate =
                        Convert.ToDateTime(ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.START_DATE]);
                    tunnelHChuanEntity.IsFinish =
                        (int)ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.IS_FINISH];
                    tunnelHChuanEntity.StopDate =
                        Convert.ToDateTime(ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.STOP_DATE]);
                    tunnelHChuanEntity.WorkStyle =
                        ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.WORK_STYLE].ToString();
                    tunnelHChuanEntity.WorkTime =
                        ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.WORK_TIME].ToString();
                    tunnelHChuanEntity.State =
                        ds.Tables[0].Rows[0][TunnelHChuanDbConstNames.TUNNEL_STATE].ToString();
                }
                catch
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
            return(tunnelHChuanEntity);
        }
Пример #2
0
        /// <summary>
        ///     添加横穿进尺
        /// </summary>
        private void AddHChuanjc(TunnelHChuan tunnel, List <IPoint> pntcols, double wid)
        {
            if (textBox_Name.Text == "")
            {
                MessageBox.Show("请输入横穿名称!", "系统提示");
                return;
            }

            var dics = new Dictionary <string, string>();

            dics[GIS_Const.FIELD_ID]   = "0";
            dics[GIS_Const.FIELD_BID]  = tunnel.Id.ToString();
            dics[GIS_Const.FIELD_BS]   = "2";
            dics[GIS_Const.FIELD_HDID] = tunnel.TunnelId1 + "_" + tunnel.TunnelId2;
            dics[GIS_Const.FIELD_XH]   = "-1";
            dics[GIS_Const.FIELD_NAME] = textBox_Name.Text;

            //绘制横穿
            var rightpts = Global.cons.GetLRParallelPnts(pntcols, wid, 1); //右侧平行线上的端点串
            var leftpts  = Global.cons.GetLRParallelPnts(pntcols, wid, 0); //左侧平行线上的端点串
            var results  = Global.cons.ConstructPnts(rightpts, leftpts);

            Global.cons.AddHangdaoToLayer(results, dics, Global.hdfdfulllyr);
            Global.cons.AddHangdaoToLayer(results, dics, Global.hdfdlyr);
        }
Пример #3
0
        public TunnelHChuanEntering(TunnelHChuan tunnelHChuanEntity, TunnelHChuanManagement frmhc)
        {
            frmStop = frmhc;
            this.tunnelHChuanEntity = tunnelHChuanEntity;
            tmpTunnelHChuanEntity   = tunnelHChuanEntity;

            InitializeComponent();

            FormDefaultPropertiesSetter.SetEnteringFormDefaultProperties(this, Const_GM.TUNNEL_HCHUAN_CHANGE);
        }
Пример #4
0
        /// <summary>
        /// 修改掘进巷道数据
        /// </summary>
        /// <returns></returns>
        public static bool updateTunnelHChuan(TunnelHChuan
                                              tunnelHChuanEntity)
        {
            clearTunnelTypeOfHChuan(tunnelHChuanEntity.Id);
            ManageDataBase db = new
                                ManageDataBase(DATABASE_TYPE.MiningSchedulingDB);
            StringBuilder sb = new StringBuilder();

            sb.Append("UPDATE " + TunnelHChuanDbConstNames.TABLE_NAME +
                      " SET " + TunnelHChuanDbConstNames.NAME_HCHUAN + " = '");
            sb.Append(tunnelHChuanEntity.NameHChuan + "'," +
                      TunnelHChuanDbConstNames.TUNNEL_ID1 + " = ");
            sb.Append(tunnelHChuanEntity.TunnelId1 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_ID2 + " = ");
            sb.Append(tunnelHChuanEntity.TunnelId2 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_X1 + " = ");
            sb.Append(tunnelHChuanEntity.X1 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_Y1 + " = ");
            sb.Append(tunnelHChuanEntity.Y1 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_Z1 + " = ");
            sb.Append(tunnelHChuanEntity.Z1 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_X2 + " = ");
            sb.Append(tunnelHChuanEntity.X2 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_Y2 + " = ");
            sb.Append(tunnelHChuanEntity.Y2 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_Z2 + " = ");
            sb.Append(tunnelHChuanEntity.Z2 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_AZIMUTH + " = ");
            sb.Append(tunnelHChuanEntity.Azimuth + "," +
                      TunnelHChuanDbConstNames.TEAM_NAME_ID + " = ");
            sb.Append(tunnelHChuanEntity.Team + "," +
                      TunnelHChuanDbConstNames.START_DATE + "='");
            sb.Append(tunnelHChuanEntity.StartDate + "'," +
                      TunnelHChuanDbConstNames.IS_FINISH + "=");
            sb.Append(tunnelHChuanEntity.IsFinish + "," +
                      TunnelHChuanDbConstNames.STOP_DATE + "='");
            sb.Append(tunnelHChuanEntity.StopDate + "'," +
                      TunnelHChuanDbConstNames.WORK_STYLE + "='");
            sb.Append(tunnelHChuanEntity.WorkStyle + "'," +
                      TunnelHChuanDbConstNames.WORK_TIME + "='");
            sb.Append(tunnelHChuanEntity.WorkTime + "'," +
                      TunnelHChuanDbConstNames.TUNNEL_STATE + " = '");
            sb.Append(tunnelHChuanEntity.State + "'," +
                      TunnelHChuanDbConstNames.TUNNEL_WIDTH + " = '");
            sb.Append(tunnelHChuanEntity.Width + "' WHERE " +
                      TunnelHChuanDbConstNames.ID + "=");
            sb.Append(tunnelHChuanEntity.Id);

            bool bResult = db.OperateDB(sb.ToString());

            //setTunnelAsHChuan(tunnelHChuanEntity.TunnelID1);
            //setTunnelAsHChuan(tunnelHChuanEntity.TunnelID2);

            return(bResult);
        }
Пример #5
0
        private bool RedrawHengChuanPolygon(TunnelHChuan entity)
        {
            //找到导线点图层
            IMap map = new MapClass();

            map = DataEditCommon.g_pMap;
            var           layerName    = LayerNames.DEFALUT_HENGCHUAN; //“默认_导线点”图层
            IFeatureLayer featureLayer = new FeatureLayerClass();

            featureLayer = LayerHelper.GetLayerByName(map, layerName); //获得图层

            if (featureLayer == null)
            {
                MessageBox.Show("没有找到" + layerName + "图层,将不能绘制导线点。", "提示", MessageBoxButtons.OK);
                return(false);
            }

            var point1 = new PointClass {
                X = entity.X1, Y = entity.Y1, Z = entity.Z1, ZAware = true
            };
            var point2 = new PointClass {
                X = entity.X2, Y = entity.Y2, Z = entity.Z2, ZAware = true
            };
            var line = new LineClass {
                FromPoint = point1, ToPoint = point2
            };
            var polygon = new PolygonClass {
                ZAware = true
            };
            var width = entity.Width / 2;

            polygon.AddPoint(ConstructPoint(point2, line.Angle / Deg2Rad + 90, width));
            polygon.AddPoint(ConstructPoint(point2, line.Angle / Deg2Rad - 90, width));
            polygon.AddPoint(ConstructPoint(point1, line.Angle / Deg2Rad + 180 + 90, width));
            polygon.AddPoint(ConstructPoint(point1, line.Angle / Deg2Rad + 180 - 90, width));
            polygon.SimplifyPreserveFromTo();

            var list = new List <ziduan>
            {
                new ziduan("BID", entity.Id.ToString()),
                new ziduan("BID0", entity.TunnelId1.ToString()),
                new ziduan("BID1", entity.TunnelId2.ToString()),
                new ziduan("NAME", entity.NameHChuan)
            };

            var feature = DataEditCommon.ModifyFeature(featureLayer, entity.Id, polygon, list);

            return(feature != null);
        }
Пример #6
0
        private static void clearTunnelTypeOfHChuan(int tunnelHChuanID)
        {
            TunnelHChuan tunnelHChuanEntity =
                selectTunnelHChuan(tunnelHChuanID);

            if (tunnelHChuanEntity != null)
            {
                var tunnel1 = Tunnel.Find(tunnelHChuanEntity.TunnelId1);
                var tunnel2 = Tunnel.Find(tunnelHChuanEntity.TunnelId2);
                tunnel1.TunnelType = TunnelTypeEnum.OTHER;
                tunnel2.TunnelType = TunnelTypeEnum.OTHER;
                tunnel1.Save();
                tunnel2.Save();
            }
        }
Пример #7
0
        /// <summary>
        /// 删除回采巷道数据
        /// </summary>
        /// <returns></returns>
        public static bool deleteTunnelHChuan(TunnelHChuan
                                              tunnelHChuanEntity)
        {
            ManageDataBase db = new
                                ManageDataBase(DATABASE_TYPE.MiningSchedulingDB);
            string sql = "DELETE FROM " +
                         TunnelHChuanDbConstNames.TABLE_NAME + " WHERE " +
                         TunnelHChuanDbConstNames.ID + " = " + tunnelHChuanEntity.Id;
            bool bResult = db.OperateDB(sql);

            if (bResult)
            {
                clearTunnelTypeOfHChuan(tunnelHChuanEntity.Id);
            }
            return(bResult);
        }
Пример #8
0
        /// <summary>
        /// 插入横川数据
        /// </summary>
        /// <returns></returns>
        public static int insertTunnelHChuan(TunnelHChuan
                                             tunnelHChuanEntity)
        {
            ManageDataBase db = new
                                ManageDataBase(DATABASE_TYPE.MiningSchedulingDB);
            StringBuilder sb = new StringBuilder();

            sb.Append("INSERT INTO " + TunnelHChuanDbConstNames.TABLE_NAME
                      + " (" +
                      TunnelHChuanDbConstNames.NAME_HCHUAN + "," +
                      TunnelHChuanDbConstNames.TUNNEL_ID1 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_ID2 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_X1 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_Y1 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_Z1 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_X2 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_Y2 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_Z2 + "," +
                      TunnelHChuanDbConstNames.TUNNEL_AZIMUTH + "," +
                      WorkingFaceDbConstNames.TEAM_NAME_ID + "," +
                      WorkingFaceDbConstNames.START_DATE + "," +
                      WorkingFaceDbConstNames.IS_FINISH + ","
                      + WorkingFaceDbConstNames.STOP_DATE + "," +
                      WorkingFaceDbConstNames.WORK_STYLE + "," +
                      WorkingFaceDbConstNames.WORK_TIME + "," +
                      TunnelHChuanDbConstNames.TUNNEL_STATE + "," +
                      TunnelHChuanDbConstNames.TUNNEL_WIDTH + ") VALUES(");
            sb.Append("'");
            sb.Append(tunnelHChuanEntity.NameHChuan + "',");
            sb.Append(tunnelHChuanEntity.TunnelId1 + ",");
            sb.Append(tunnelHChuanEntity.TunnelId2 + ",");
            sb.Append(tunnelHChuanEntity.X1 + ",");
            sb.Append(tunnelHChuanEntity.Y1 + ",");
            sb.Append(tunnelHChuanEntity.Z1 + ",");
            sb.Append(tunnelHChuanEntity.X2 + ",");
            sb.Append(tunnelHChuanEntity.Y2 + ",");
            sb.Append(tunnelHChuanEntity.Z2 + ",");
            sb.Append(tunnelHChuanEntity.Azimuth + ",");
            sb.Append(tunnelHChuanEntity.Team + ",'");
            sb.Append(tunnelHChuanEntity.StartDate + "',");
            sb.Append(tunnelHChuanEntity.IsFinish + ",'");
            sb.Append(tunnelHChuanEntity.StopDate + "','");
            sb.Append(tunnelHChuanEntity.WorkStyle + "','");
            sb.Append(tunnelHChuanEntity.WorkTime + "','");
            sb.Append(tunnelHChuanEntity.State + "','");
            sb.Append(tunnelHChuanEntity.Width + "');");
            sb.Append("SELECT @@IDENTITY;");

            var ds = db.ReturnDS(sb.ToString());
            int id = -1;

            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                var objId = ds.Tables[0].Rows[0][0];

                int.TryParse(objId.ToString(), out id);
            }

            //bool bResult = db.OperateDB(sb.ToString());

            //setTunnelAsHChuan(tunnelHChuanEntity.TunnelID1);
            //setTunnelAsHChuan(tunnelHChuanEntity.TunnelID2);

            return(id);
        }