/// <summary>
        /// 获取定位最大排序号
        /// </summary>
        /// <returns></returns>
        public static int GetTransportPositionMaxOrder()
        {
            CmcsTransportPosition entity = Dbers.GetInstance().SelfDber.Entity <CmcsTransportPosition>("order by OrderNumber desc");

            if (entity == null)
            {
                return(1);
            }

            return(Convert.ToInt32(entity.OrderNumber) + 1);
        }
        /// <summary>
        /// 移除轨道车辆定位信息
        /// </summary>
        /// <param name="transportId"></param>
        public static bool RemoveTransportPosition(string trainNumber)
        {
            CmcsTrainCarriagePass oldtrain = Dbers.GetInstance().SelfDber.Entity <CmcsTrainCarriagePass>("where TrainNumber=:TrainNumber and PassTime>=:PassTime order by PassTime desc", new { TrainNumber = trainNumber, PassTime = DateTime.Now.AddDays(-1) });

            if (oldtrain == null)
            {
                return(false);
            }
            CmcsTransportPosition entity = Dbers.GetInstance().SelfDber.Entity <CmcsTransportPosition>("where TransportId='" + oldtrain.Id + "' order by CreationTime desc");

            if (entity == null)
            {
                return(false);
            }
            return(Dbers.GetInstance().SelfDber.Delete <CmcsTransportPosition>(entity.Id) > 0);
        }
        /// <summary>
        /// 修改轨道车辆定位信息,设定为未翻车
        /// </summary>
        /// <param name="transportId"></param>
        public static bool UnTurnTransportPosition(string trainNumber)
        {
            CmcsTrainCarriagePass oldtrain = Dbers.GetInstance().SelfDber.Entity <CmcsTrainCarriagePass>("where TrainNumber=:TrainNumber and PassTime>=:PassTime order by PassTime desc", new { TrainNumber = trainNumber, PassTime = DateTime.Now.AddDays(-1) });

            if (oldtrain == null)
            {
                return(false);
            }
            CmcsTransportPosition entity = Dbers.GetInstance().SelfDber.Entity <CmcsTransportPosition>("where TransportId='" + oldtrain.Id + "' and IsDisCharged=1 order by CreationTime desc");

            if (entity == null)
            {
                return(false);
            }

            entity.IsDisCharged = 0;
            entity.TurnCarDate  = DateTime.MinValue;
            return(Dbers.GetInstance().SelfDber.Update(entity) > 0);
        }
        /// <summary>
        /// 插入定位信息
        /// </summary>
        /// <param name="trackNumber"></param>
        /// <param name="transportid"></param>
        /// <returns></returns>
        public static bool InsertTransportPosition(string trackNumber, string carNumber)
        {
            CmcsTrainCarriagePass transport = Dbers.GetInstance().SelfDber.Entity <CmcsTrainCarriagePass>("where TrainNumber=:TrainNumber and PassTime>=:PassTime order by CreationTime desc", new { TrainNumber = carNumber, PassTime = DateTime.Now.AddDays(-1) });

            if (transport == null)
            {
                return(false);
            }
            CmcsTransportPosition entity = Dbers.GetInstance().SelfDber.Entity <CmcsTransportPosition>("where TransportId='" + transport.Id + "'");

            if (entity != null)
            {
                Dbers.GetInstance().SelfDber.Delete <CmcsTransportPosition>(entity.Id);
            }

            return(Dbers.GetInstance().SelfDber.Insert(new CmcsTransportPosition()
            {
                OrderNumber = GetTransportPositionMaxOrder(),
                TrackNumber = trackNumber,
                TransportId = transport.Id,
                IsDisCharged = 0
            }) > 0);
        }