Пример #1
0
        /// <summary>
        /// 查找部分对应数据(不包括小区)
        /// </summary>
        public void getPortionAreaData()
        {
            string sql = null;

            try
            {
                // 标记用于区分小区类别
                sql = "SELECT AREA_NO,X_START,X_END,Y_START,Y_END,AREA_TYPE,AREA_NAME FROM UACS_YARDMAP_AREA_DEFINE WHERE BAY_NO LIKE '" + bayNo + "%' ORDER BY AREA_NO DESC";
                #region
                //if (areaTypeS == AreaType.CarArea)
                //{
                //    sql += " WHERE BAY_NO LIKE '"+bayNo+"%'  and AREA_TYPE = 1";
                //}
                //else if (areaTypeS == AreaType.StockArea)
                //{
                //    sql += " WHERE BAY_NO LIKE '"+bayNo+"%'  and AREA_TYPE = 0";
                //}
                //else if (areaTypeS == AreaType.UnitArea)
                //{
                //    sql +=" WHERE BAY_NO LIKE '"+bayNo+"%'  and AREA_TYPE in (4,5)";  //机组出入口
                //}
                //else if (areaTypeS == AreaType.NoStockAndRestsType)
                //{
                //    sql += " WHERE BAY_NO LIKE '"+bayNo+"%'  and AREA_TYPE != 0";
                //}
                //else
                //{
                //    sql += " WHERE BAY_NO LIKE '" + bayNo + "%' ";
                //}
                #endregion
                using (IDataReader rdr = DB2Connect.DBHelper.ExecuteReader(sql))
                {
                    while (rdr.Read())
                    {
                        AreaBase theArea = new AreaBase();
                        if (rdr["AREA_NO"] != System.DBNull.Value)
                        {
                            if (rdr["AREA_NO"] != System.DBNull.Value)
                            {
                                theArea.AreaNo = Convert.ToString(rdr["AREA_NO"]);
                            }
                            if (rdr["X_START"] != System.DBNull.Value)
                            {
                                theArea.X_Start = Convert.ToInt32(rdr["X_START"]);
                            }
                            if (rdr["X_END"] != System.DBNull.Value)
                            {
                                theArea.X_End = Convert.ToInt32(rdr["X_END"]);
                            }
                            if (rdr["Y_START"] != System.DBNull.Value)
                            {
                                theArea.Y_Start = Convert.ToInt32(rdr["Y_START"]);
                            }
                            if (rdr["Y_END"] != System.DBNull.Value)
                            {
                                theArea.Y_End = Convert.ToInt32(rdr["Y_END"]);
                            }
                            if (rdr["AREA_TYPE"] != System.DBNull.Value)
                            {
                                theArea.AreaType = Convert.ToInt32(rdr["AREA_TYPE"]);
                            }
                            if (rdr["AREA_NAME"] != System.DBNull.Value)
                            {
                                theArea.Area_Name = Convert.ToString(rdr["AREA_NAME"]);
                            }
                            #region
                            if (theArea.AreaType == 0)
                            {
                                theArea.AreaSaddleNum = getAreaSaddleNum(theArea.AreaNo);

                                theArea.AreaSaddleNoCoilNum = getAreaSaddleNoCoilNum(theArea.AreaNo);

                                theArea.AreaSaddleCoilNum = getAreaSaddleCoilNum(theArea.AreaNo);

                                //  theArea.TBayNO = theArea.AreaNo.Substring(0, 3);

                                //  theArea.TAreaNo = theArea.AreaNo.Substring(6, theArea.AreaNo.Count() - 6);

                                //StringBuilder sbTagName_Safe = new StringBuilder("AREA_SAFE_");
                                //sbTagName_Safe.Append(theArea.TBayNO);
                                //sbTagName_Safe.Append("_");
                                //sbTagName_Safe.Append(theArea.TAreaNo);

                                //  theArea.AreaDoorSefeName = sbTagName_Safe.ToString();

                                //  StringBuilder sbTagName_Reserve1 = new StringBuilder("SAFE_");
                                //    sbTagName_Reserve.Append(theArea.TBayNO);
                                //  sbTagName_Reserve.Append("_");
                                //  sbTagName_Reserve1.Append(theArea.AreaNo);

                                //  theArea.SAFE_AREA_1 = sbTagName_Reserve1.ToString();

                                //  StringBuilder sbTagName_Reserve2 = new StringBuilder("SAFE_");
                                //    sbTagName_Reserve.Append(theArea.TBayNO);
                                //  sbTagName_Reserve.Append("_");
                                //  sbTagName_Reserve2.Append(theArea.AreaNo);

                                //   theArea.SAFE_AREA_2 = sbTagName_Reserve2.ToString();

                                //   StringBuilder sbTagName_Reserve3 = new StringBuilder("SAFE_");
                                //    sbTagName_Reserve.Append(theArea.TBayNO);
                                //  sbTagName_Reserve.Append("_");
                                //   sbTagName_Reserve3.Append(theArea.AreaNo);

                                //  theArea.SAFE_AREA_3 = sbTagName_Reserve3.ToString();
                            }
                            //     AreaName = theArea.Area_Name;
                            #endregion
                            if (theArea.AreaType == Convert.ToInt32(AreaType.HotPitCoverArea) || theArea.AreaType == Convert.ToInt32(AreaType.TrainCoverArea) || theArea.AreaType == Convert.ToInt32(AreaType.HotPitCoverTemp) || theArea.AreaType == Convert.ToInt32(AreaType.TrainCoverTemp))
                            {
                                sql = string.Format(@"SELECT B.STOCK_STATUS,B.STOCK_NO,B.ENABLE,B.LAYER_NO FROM UACS_YARDMAP_AREA_DEFINE A left join UACS_YARDMAP_TRAIN_STOCK_DEFINE B on A.AREA_NO = B.AREA_NO WHERE A.AREA_NO = '{0}' and B.STOCK_TYPE  IN ('{1}','{2}','{3}','{4}')", theArea.AreaNo, STOCK_TYPE_HOTPIT_COVER, STOCK_TYPE_TRAIN_COVER, STOCK_TYPE_HOTPIT_AREA, STOCK_TYPE_PACKING_AREA);
                                using (IDataReader rdrByCover = DB2Connect.DBHelper.ExecuteReader(sql))
                                {
                                    if (rdrByCover.Read())
                                    {
                                        theArea.STOCK_STATUS = rdrByCover["STOCK_STATUS"].ToString();
                                        theArea.STOCK_NO     = rdrByCover["STOCK_NO"].ToString();
                                        theArea.ENABLE_FLAG  = rdrByCover["ENABLE"].ToString();
                                        theArea.ENABLE_NUM   = rdrByCover["LAYER_NO"].ToString();
                                    }
                                }
                            }
                            #region
                            //    //查询所有保温坑盖情况
                            //    sql = @"SELECT B.STOCK_STATUS as num FROM UACS_YARDMAP_AREA_DEFINE A left join UACS_YARDMAP_TRAIN_STOCK_DEFINE B on A.STOCK_NO = B.STOCK_NO
                            //                        WHERE A.AREA_NO = '" + theArea.AreaNo + "' and B.STOCK_TYPE ='HOTPITCAP'";
                            //    using (IDataReader rdr2 = DB2Connect.DBHelper.ExecuteReader(sql))
                            //        {
                            //            while (rdr2.Read())
                            //            {
                            //                if (rdr2["num"] != DBNull.Value)
                            //                    theArea.STOCK_STATUS = rdr2["num"].ToString();
                            //            }
                            //        }
                            //    //查询火车盖情况
                            ////    A.AREA_NAME = '" + AreaName + "' and
                            // sql = @"SELECT B.STOCK_STATUS as num FROM UACS_YARDMAP_AREA_DEFINE A left join UACS_YARDMAP_TRAIN_STOCK_DEFINE B on A.AREA_NO = B.STOCK_NO
                            //                        WHERE  A.AREA_NAME = '" + AreaName + "' and B.STOCK_TYPE = 'TRAINCAP' ";
                            //    using (IDataReader rdr3 = DB2Connect.DBHelper.ExecuteReader(sql))
                            //    {
                            //        while (rdr3.Read())
                            //        {
                            //            if (rdr3["num"] != DBNull.Value)
                            //                theArea.PSTOCK_STATUS =Convert.ToInt32( rdr3["num"]);
                            //        }
                            //    }
                            //    //查询火车状态信息
                            //    sql = @"select PARKING_STATUS as num from UACS_PARKING_STATUS  WHERE PARKING_NO ='CC1TV01' ";
                            //    using (IDataReader rdr4 = DB2Connect.DBHelper.ExecuteReader(sql))
                            //    {
                            //        while (rdr4.Read())
                            //        {
                            //            if (rdr4["num"] != DBNull.Value)
                            //                theArea.Parking_STATUS = Convert.ToInt32(rdr4["num"]);
                            //        }
                            //    }
                            //    if (theArea.Parking_STATUS == 5)
                            //    {
                            //        try
                            //        {
                            //            sql = @"update UACS_YARDMAP_AREA_DEFINE set X_START =80000, X_END =81000,Y_START =80000, Y_END =81000 WHERE AREA_NO in ('TRAINCAP1','TRAINCAP2','TRAINCAP3')";

                            //            DB2Connect.DBHelper.ExecuteNonQuery(sql);
                            //        }
                            //        catch (Exception er)
                            //        {

                            //        }

                            //    }
                            //    else
                            //    {
                            //        try
                            //        {
                            //            sql = @"update UACS_YARDMAP_AREA_DEFINE set X_START =29000, X_END =41500,Y_START =500, Y_END =3400 WHERE AREA_NO='TRAINCAP1'";

                            //            DB2Connect.DBHelper.ExecuteNonQuery(sql);
                            //        }
                            //        catch (Exception er)
                            //        {

                            //        }
                            //        try
                            //        {
                            //            sql = @"update UACS_YARDMAP_AREA_DEFINE set X_START =41500, X_END =54500,Y_START =500, Y_END =3400 WHERE AREA_NO='TRAINCAP2'";

                            //            DB2Connect.DBHelper.ExecuteNonQuery(sql);
                            //        }
                            //        catch (Exception er)
                            //        {

                            //        }
                            //        try
                            //        {
                            //            sql = @"update UACS_YARDMAP_AREA_DEFINE set X_START =54450, X_END =66950,Y_START =500, Y_END =3400 WHERE AREA_NO='TRAINCAP3'";

                            //            DB2Connect.DBHelper.ExecuteNonQuery(sql);
                            //        }
                            //        catch (Exception er)
                            //        {

                            //        }
                            //    }
                            #endregion
                            dicSaddles[theArea.AreaNo] = theArea;
                        }
                    }
                }
            }
            catch (Exception er)
            {
                throw;
            }
        }
Пример #2
0
        /// <summary>
        /// 查找部分对应数据(不包括小区)
        /// </summary>
        public void getPortionAreaData()
        {
            string sql = null;

            try
            {
                // 标记用于区分小区类别
                sql = "SELECT AREA_NO,X_START,X_END,Y_START,Y_END,AREA_TYPE,AREA_NAME FROM UACS_YARDMAP_AREA_DEFINE";

                if (areaTypeS == AreaType.CarArea)
                {
                    sql += " WHERE BAY_NO LIKE '" + bayNo + "%'  and AREA_TYPE = 1";
                }
                else if (areaTypeS == AreaType.StockArea)
                {
                    sql += " WHERE BAY_NO LIKE '" + bayNo + "%'  and AREA_TYPE = 0";
                }
                else if (areaTypeS == AreaType.UnitArea)
                {
                    sql += " WHERE BAY_NO LIKE '" + bayNo + "%'  and AREA_TYPE in (4,5)";  //机组出入口
                }
                else if (areaTypeS == AreaType.NoStockAndRestsType)
                {
                    sql += " WHERE BAY_NO LIKE '" + bayNo + "%'  and AREA_TYPE != 0";
                }
                else
                {
                    sql += " WHERE BAY_NO LIKE '" + bayNo + "%' ";
                }

                using (IDataReader rdr = DB2Connect.DBHelper.ExecuteReader(sql))
                {
                    while (rdr.Read())
                    {
                        if (rdr["AREA_NO"] != System.DBNull.Value)
                        {
                            AreaBase theArea = new AreaBase();
                            if (rdr["AREA_NO"] != System.DBNull.Value)
                            {
                                theArea.AreaNo = Convert.ToString(rdr["AREA_NO"]);
                            }
                            if (rdr["X_START"] != System.DBNull.Value)
                            {
                                theArea.X_Start = Convert.ToInt32(rdr["X_START"]);
                            }
                            if (rdr["X_END"] != System.DBNull.Value)
                            {
                                theArea.X_End = Convert.ToInt32(rdr["X_END"]);
                            }
                            if (rdr["Y_START"] != System.DBNull.Value)
                            {
                                theArea.Y_Start = Convert.ToInt32(rdr["Y_START"]);
                            }
                            if (rdr["Y_END"] != System.DBNull.Value)
                            {
                                theArea.Y_End = Convert.ToInt32(rdr["Y_END"]);
                            }
                            if (rdr["AREA_TYPE"] != System.DBNull.Value)
                            {
                                theArea.AreaType = Convert.ToInt32(rdr["AREA_TYPE"]);
                            }
                            if (rdr["AREA_NAME"] != System.DBNull.Value)
                            {
                                theArea.Area_Name = Convert.ToString(rdr["AREA_NAME"]);
                            }

                            if (theArea.AreaType == 0)
                            {
                                theArea.AreaSaddleNum = getAreaSaddleNum(theArea.AreaNo);

                                theArea.AreaSaddleNoCoilNum = getAreaSaddleNoCoilNum(theArea.AreaNo);

                                theArea.AreaSaddleCoilNum = getAreaSaddleCoilNum(theArea.AreaNo);

                                //theArea.TBayNO = theArea.AreaNo.Substring(0, 3);

                                //theArea.TAreaNo = theArea.AreaNo.Substring(6, theArea.AreaNo.Count() - 6);

                                //StringBuilder sbTagName_Safe = new StringBuilder("AREA_SAFE_");
                                //sbTagName_Safe.Append(theArea.TBayNO);
                                //sbTagName_Safe.Append("_");
                                //sbTagName_Safe.Append(theArea.TAreaNo);

                                //theArea.AreaDoorSefeName = sbTagName_Safe.ToString();

                                //StringBuilder sbTagName_Reserve = new StringBuilder("AREA_RESERVE_");
                                //sbTagName_Reserve.Append(theArea.TBayNO);
                                //sbTagName_Reserve.Append("_");
                                //sbTagName_Reserve.Append(theArea.TAreaNo);

                                //theArea.AreaDoorReserveName = sbTagName_Reserve.ToString();
                            }



                            dicSaddles[theArea.AreaNo] = theArea;
                        }
                    }
                }
            }
            catch (Exception er)
            {
                throw;
            }
        }