Exemplo n.º 1
0
        private void CheckNestAreaRepeatOut(InputAgs args, ResultAgs rst)
        {
            ParkTimeseries timeseries = null;
            string         errorMsg   = "";

            if (args.NestAreaIORecord != null)
            {
                timeseries = ParkTimeseriesServices.GetTimeseriesesByIORecordID(args.AreadInfo.PKID, args.NestAreaIORecord.RecordID, out errorMsg);
            }
            if (timeseries != null)
            {
                args.Timeseries       = timeseries;
                rst.InDate            = args.Timeseries.EnterTime;
                rst.OutDate           = args.Plateinfo.TriggerTime;
                rst.ResCode           = ResultCode.OutOK;
                rst.InOutBaseCardType = BaseCarType.TempCar;
            }
            else if (args.CarTypeInfo.CarNoLike == YesOrNo.Yes)//是否模糊识别
            {
                rst.ResCode           = ResultCode.OnFindNo;
                rst.InOutBaseCardType = BaseCarType.TempCar;
            }
            else //重复出场判断
            {
                if (args.CarTypeInfo.RepeatOut == YesOrNo.No && args.AreadInfo.NeedToll == YesOrNo.Yes)
                {
                    rst.ResCode = ResultCode.RepeatOut;
                }
                else
                {
                    rst.ResCode           = ResultCode.OutOK;
                    rst.InOutBaseCardType = BaseCarType.TempCar;
                }
            }
        }
Exemplo n.º 2
0
        private void CheckNestAreaRepeatOut(InputAgs args, ResultAgs rst)
        {
            string errorMsg   = "";
            var    timeseries = ParkTimeseriesServices.GetTimeseriesesByIORecordID(args.AreadInfo.PKID, args.NestAreaIORecord.RecordID, out errorMsg);

            if (timeseries != null && !timeseries.IsExit)
            {
                args.Timeseries       = timeseries;
                rst.InDate            = args.Timeseries.EnterTime;
                rst.OutDate           = args.Plateinfo.TriggerTime;
                rst.ResCode           = ResultCode.OutOK;
                rst.InOutBaseCardType = BaseCarType.StoredValueCar;
            }
            else if (args.CarTypeInfo.CarNoLike == YesOrNo.Yes)
            {
                rst.ResCode           = ResultCode.OnFindNo;
                rst.InOutBaseCardType = BaseCarType.StoredValueCar;
            }
            else
            {
                if (args.CarTypeInfo.RepeatOut == YesOrNo.No)
                {
                    rst.ResCode = ResultCode.RepeatOut;
                }
                else
                {
                    rst.ResCode           = ResultCode.OutOK;
                    rst.InOutBaseCardType = BaseCarType.StoredValueCar;
                }
            }
        }
Exemplo n.º 3
0
        private void CheckNestAreaRepeatOut(InputAgs args, ResultAgs rst)
        {
            string errorMsg   = "";
            var    timeseries = ParkTimeseriesServices.GetTimeseriesesByIORecordID(args.AreadInfo.PKID, args.NestAreaIORecord.RecordID, out errorMsg);

            rst.InOutBaseCardType = args.CarTypeInfo.BaseTypeID;
            if ((timeseries == null || timeseries.IsExit) && args.CarTypeInfo.RepeatOut == YesOrNo.No)
            {
                rst.ResCode = ResultCode.RepeatOut;
            }
        }
Exemplo n.º 4
0
        private void CheckNestReaptIn(InputAgs args, ResultAgs rst)
        {
            ParkTimeseries timeseries = null;
            string         errorMsg   = "";

            if (args.NestAreaIORecord != null)//月卡 VIP卡需要
            {
                timeseries = ParkTimeseriesServices.GetTimeseriesesByIORecordID(args.AreadInfo.PKID, args.NestAreaIORecord.RecordID, out errorMsg);
            }
            if (args.CarTypeInfo.RepeatIn == YesOrNo.Yes && timeseries != null)
            {
                //删除入场记录
                RemoveReaptInIorecord(args);
                timeseries.DataStatus = DataStatus.Delete;
                //SynchroService.UpLoadModle(timeseries);
            }
            else if (args.CarTypeInfo.RepeatIn != YesOrNo.Yes && timeseries != null)
            {
                rst.ResCode = ResultCode.RepeatIn;
            }
        }
Exemplo n.º 5
0
 private void RemoveReaptInTimeseries(ParkTimeseries args)
 {
     ParkTimeseriesServices.RemoveTimeseries(args.TimeseriesID);
 }
Exemplo n.º 6
0
        protected override void ProcessRule(InputAgs args, ResultAgs rst)
        {
            if (args.AreadInfo.IsNestArea && args.NestAreaIORecord == null)
            {
                return;
            }
            string errorMsg = "";

            rst.InOutBaseCardType = args.CarTypeInfo.BaseTypeID;
            DateTime?datetime;

            if (args.GateInfo.IoState == IoState.GoIn)//入场时间
            {
                if (args.CardInfo == null)
                {
                    if (args.AreadInfo.IsNestArea)
                    {
                        datetime = ParkTimeseriesServices.GetLastRecordExitDate(args.AreadInfo.PKID, args.NestAreaIORecord.RecordID, out errorMsg);
                        var tempdatetime = ParkTimeseriesServices.GetLastRecordEnterTime(args.AreadInfo.PKID, args.NestAreaIORecord.RecordID, out errorMsg);
                        if (tempdatetime > datetime)
                        {
                            datetime = tempdatetime;
                        }
                    }
                    else
                    {
                        datetime = ParkIORecordServices.GetLastRecordExitDateByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);
                        var tempdatetime = ParkIORecordServices.GetLastRecordEnterTimeByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);
                        if (tempdatetime > datetime)
                        {
                            datetime = tempdatetime;
                        }
                    }
                }
                else
                {
                    if (args.AreadInfo.IsNestArea)
                    {
                        datetime = ParkTimeseriesServices.GetLastRecordExitDate(args.AreadInfo.PKID, args.NestAreaIORecord.RecordID, out errorMsg);
                    }
                    else
                    {
                        datetime = ParkIORecordServices.GetLastRecordExitDateByCarNo(args.AreadInfo.PKID, args.CardInfo.Usercard.CardNo, out errorMsg);
                    }
                }
            }
            else //出场时间
            {
                if (args.CardInfo == null)
                {
                    if (args.AreadInfo.IsNestArea)
                    {
                        datetime = ParkTimeseriesServices.GetLastRecordEnterTime(args.AreadInfo.PKID, args.NestAreaIORecord.RecordID, out errorMsg);
                    }
                    else
                    {
                        datetime = ParkIORecordServices.GetLastRecordEnterTimeByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);
                    }
                }
                else
                {
                    if (args.AreadInfo.IsNestArea)
                    {
                        datetime = ParkTimeseriesServices.GetLastRecordEnterTime(args.AreadInfo.PKID, args.NestAreaIORecord.RecordID, out errorMsg);
                    }
                    else
                    {
                        datetime = ParkIORecordServices.GetLastRecordEnterTimeByCarNo(args.AreadInfo.PKID, args.CardInfo.Usercard.CardNo, out errorMsg);
                    }
                }
            }
            if (datetime != null)
            {
                TimeSpan tstem = args.Plateinfo.TriggerTime - datetime.Value;
                double   s     = tstem.TotalSeconds;// tstem.Days * 24 * 60 * 60 + tstem.Hours * 60 * 60 + tstem.Minutes * 60 + tstem.Seconds;
                if (args.CarTypeInfo.InOutTime > 0 && s < args.CarTypeInfo.InOutTime)
                {
                    rst.ResCode = ResultCode.InOutTime;
                }
                else
                {
                    if (args.GateInfo.IoState == IoState.GoIn)
                    {
                        rst.ResCode = ResultCode.InOK;
                    }
                }
            }
            else
            {
                if (args.GateInfo.IoState == IoState.GoIn)
                {
                    rst.ResCode = ResultCode.InOK;
                }
            }
        }
Exemplo n.º 7
0
        protected override void ProcessRule(InputAgs args, ResultAgs rst)
        {
            rst.InOutBaseCardType = args.CarTypeInfo.BaseTypeID;

            if (args.CardInfo == null)
            {
                return;
            }
            if (args.CardInfo.State == ParkGrantState.Pause || args.CardInfo.State == ParkGrantState.Stop)
            {
                //rst.ResCode = ResultCode.CarLocked;
                //rst.ValidMsg = args.CardInfo.State == 1 ? "月卡 停用" : "月卡 暂停";
                rst.ResCode = args.CardInfo.State == ParkGrantState.Pause ? ResultCode.MonthCarStop : ResultCode.MonthCarPause;
                return;
            }
            string error;
            var    iorecord = ParkIORecordServices.GetNoExitIORecordByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out error);

            if (args.GateInfo.IoState == IoState.GoOut)//过期用户  或者入场时间在有效时间之外
            {
                if (args.CardInfo.EndDate < args.Plateinfo.TriggerTime || args.CardInfo.EndDate == null)
                {
                    if (args.CarTypeInfo.OverdueToTemp == OverdueToTemp.ProhibitedInAndOut)//不允许入场
                    {
                        rst.ResCode = ResultCode.UserExpired;
                        return;
                    }
                    else//临停转固定
                    {
                        if (iorecord != null)
                        {
                            if (args.CardInfo.EndDate > iorecord.EntranceTime)
                            {
                                rst.OverdueToTempSpan = args.Plateinfo.TriggerTime - args.CardInfo.EndDate;
                            }
                            else
                            {
                                rst.OverdueToTempSpan = args.Plateinfo.TriggerTime - iorecord.EntranceTime;
                            }
                        }
                        rst.InOutBaseCardType = BaseCarType.TempCar;
                        args.CarTypeInfo      = ParkCarTypeServices.QueryCardTypesByBaseCardType(args.AreadInfo.PKID, BaseCarType.TempCar).First();// ShareData.CarTypes.Find(o => o.BaseTypeID == BaseCarType.TempCar);
                        args.CardInfo         = null;
                        rst.ResCode           = ResultCode.OverdueToTemp;
                        rst.ValidMsg          = "月卡车不在有效期内";
                        rst.EnterType         = 1;
                        return;
                    }
                }

                if (iorecord != null)
                {
                    //如果是出场 还有入场记录的话 还需要判断入场时间在有效时间之外
                    if (args.CardInfo.BeginDate > iorecord.EntranceTime)
                    {
                        if (args.CarTypeInfo.OverdueToTemp == OverdueToTemp.ProhibitedInAndOut)//不允许入场
                        {
                            rst.ResCode = ResultCode.UserExpired;
                            return;
                        }
                        else//临停转固定
                        {
                            if (args.CardInfo.BeginDate != null)
                            {
                                if (args.CardInfo.BeginDate > args.Plateinfo.TriggerTime)
                                {
                                    rst.OverdueToTempSpan = args.Plateinfo.TriggerTime - iorecord.EntranceTime;
                                }
                                else
                                {
                                    rst.OverdueToTempSpan = args.CardInfo.BeginDate - iorecord.EntranceTime;
                                }
                            }
                            rst.InOutBaseCardType = BaseCarType.TempCar;
                            args.CarTypeInfo      = ParkCarTypeServices.QueryCardTypesByBaseCardType(args.AreadInfo.PKID, BaseCarType.TempCar).First();// ShareData.CarTypes.Find(o => o.BaseTypeID == BaseCarType.TempCar);
                            args.CardInfo         = null;
                            rst.ResCode           = ResultCode.OverdueToTemp;
                            rst.ValidMsg          = "月卡车不在有效期内";
                            rst.EnterType         = 1;
                            return;
                        }
                    }
                }
            }

            if (args.AreadInfo.IsNestArea)//只在大车场判断车位
            {
                return;
            }
            if (args.GateInfo.IoState == IoState.GoOut)
            { // 出场时根据PkInterim表判断是否临停转固定
                if (iorecord != null)
                {
                    var interimes = ParkInterimServices.GetInterimByIOrecord(iorecord.RecordID, out error);
                    if (interimes != null && interimes.Count > 0)//计算临停的时间
                    {
                        interimes = interimes.OrderBy(i => i.StartInterimTime).ToList();
                        DateTime date = DateTime.MinValue;
                        TimeSpan span = new TimeSpan();
                        foreach (var item in interimes)
                        {
                            if (item.EndInterimTime != DateTime.MinValue)
                            {
                                span += item.EndInterimTime - item.StartInterimTime;
                            }
                            else//如果存在 没有结束时间的 转固定记录  一般是最后一条,如果有多条  也只取最后一条
                            {
                                date = item.StartInterimTime;
                            }
                        }
                        if (date != DateTime.MinValue)
                        {
                            span += args.Plateinfo.TriggerTime - date;
                        }
                        rst.OverdueToTempSpan = span;
                        rst.InOutBaseCardType = BaseCarType.TempCar;
                        args.CarTypeInfo      = ParkCarTypeServices.QueryCardTypesByBaseCardType(args.AreadInfo.PKID, BaseCarType.TempCar).First(); // ShareData.CarTypes.Find(o => o.BaseTypeID == BaseCarType.TempCar);
                        args.CardInfo         = null;
                        rst.ResCode           = ResultCode.OverdueToTemp;
                        rst.IsOverdueToTemp   = true;
                        rst.EnterType         = 2;
                        rst.ValidMsg          = "月卡 临停:" + (span.Days > 0 ? span.ToString(@"dd\天hh\小\时mm\分\钟") : span.ToString(@"hh\小\时mm\分\钟"));
                    }
                }
            }

            if (iorecord != null && rst.OverdueToTempSpan.TotalSeconds <= 0)//如果以上都不是 判断是否有停入未授权区域
            {
                var list = ParkTimeseriesServices.GetAllExitsTimeseriesesByIORecordID(args.AreadInfo.PKID, iorecord.RecordID, out error);

                TimeSpan timespan = new TimeSpan();
                foreach (var item in list)
                {
                    if (!args.CardInfo.GateID.IsEmpty() &&
                        !args.CardInfo.GateID.Contains(item.ExitGateID))     //区域包含 且通道未控制授权 或 通道已经授权
                    {
                        //进入过未授权的区域
                        timespan += args.Plateinfo.TriggerTime - item.EnterTime;
                    }
                }
                if (timespan.TotalSeconds > 0)//进入过未授权区域
                {
                    rst.OverdueToTempSpan = timespan;
                    rst.InOutBaseCardType = BaseCarType.TempCar;
                    args.CarTypeInfo      = ParkCarTypeServices.QueryCardTypesByBaseCardType(args.AreadInfo.PKID, BaseCarType.TempCar).First();// ShareData.CarTypes.Find(o => o.BaseTypeID == BaseCarType.TempCar);
                    args.CardInfo         = null;
                    rst.ResCode           = ResultCode.OverdueToTemp;
                    rst.ValidMsg          = "月卡在未授权区域停放";
                    rst.EnterType         = 1;
                    return;
                }
            }
        }
Exemplo n.º 8
0
        protected override void ProcessRule(InputAgs args, ResultAgs rst)
        {
            rst.InOutBaseCardType = args.CarTypeInfo.BaseTypeID;
            string errorMsg = "";

            if (args.AreadInfo.IsNestArea)
            {
                uint count = ParkTimeseriesServices.GetIsEditCarNum(args.AreadInfo.AreaID, out errorMsg).ToUInt();
                if (args.CarBitNumes == null)
                {
                    return;
                }
                var  carBitNum    = args.CarBitNumes.Find(a => a.Area.AreaID == args.AreadInfo.AreaID);
                uint surplusCount = 0;
                if (count >= carBitNum.CarBitCount)
                {
                    surplusCount = 0;
                    if (args.CarTypeInfo.AllowLose == YesOrNo.No && args.GateInfo.IoState == IoState.GoIn)
                    {
                        rst.ResCode = ResultCode.NoCarBit;
                    }
                }
                else
                {
                    surplusCount = carBitNum.CarBitCount - count;
                }
                if (surplusCount != carBitNum.SurplusCount)//如果和内存中的车位剩余数量不同时,更新所有的车位信息
                {
                    carBitNum.InParkCarNum = count;
                }
            }
            else
            {
                uint count = ParkIORecordServices.GetIsEditCarNum(args.AreadInfo.AreaID, out errorMsg).ToUInt();
                if (args.CarBitNumes == null)
                {
                    return;
                }
                var carBitNum = args.CarBitNumes.Find(a => a.Area.AreaID == args.AreadInfo.AreaID);
                if (carBitNum == null)
                {
                    return;
                }
                uint surplusCount = 0;
                if (count >= carBitNum.CarBitCount)
                {
                    surplusCount = 0;
                    if (args.CarTypeInfo.AllowLose == YesOrNo.No && args.GateInfo.IoState == IoState.GoIn)
                    {
                        rst.ResCode = ResultCode.NoCarBit;
                    }
                }
                else
                {
                    surplusCount = carBitNum.CarBitCount - count;
                }
                if (surplusCount != carBitNum.SurplusCount)//如果和内存中的车位剩余数量不同时,更新所有的车位信息
                {
                    carBitNum.InParkCarNum = count;
                }
            }
        }