Exemple #1
0
 protected override void ProcessRule(InputAgs args, ResultAgs rst)
 {
     if (!args.AreadInfo.IsNestArea)
     {
         return;
     }
     if (args.NestAreaIORecord == null && (args.CarTypeInfo.BaseTypeID == BaseCarType.TempCar ||
                                           args.CarTypeInfo.BaseTypeID == BaseCarType.StoredValueCar))//临时卡和储值卡不让进
     {
         if (args.GateInfo.IoState == IoState.GoIn)
         {
             if (args.CarTypeInfo.RepeatIn != YesOrNo.Yes && rst.EnterType == 0)
             {
                 rst.ResCode = ResultCode.OnFindNo;
             }
         }
         else
         {
             if (args.CarTypeInfo.RepeatOut != YesOrNo.Yes && rst.EnterType == 0)
             {
                 rst.ResCode = ResultCode.RepeatOut;
             }
         }
     }
 }
Exemple #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;
                }
            }
        }
Exemple #3
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;
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// 应用校验规则
        /// </summary>
        /// <param name="args"></param>
        /// <param name="rst"></param>
        public void ApplyRule(InputAgs args, ResultAgs rst)
        {
            try
            {
                ProcessRule(args, rst);
            }
            catch (Exception ex)
            {
                rst.ResCode = ResultCode.ErrorMSG;
                LogerHelper.Loger.Error(ex);
            }

            //执行下一个职责链
            if (_NextRuleHandler != null && rst.ResCode == ResultCode.Defaut)
            {
                _NextRuleHandler.ApplyRule(args, rst);
            }
            else if (rst.ResCode == ResultCode.OverdueToTemp)
            {
                //职责链中断后的辅助处理
                if (args.GateInfo.IoState == IoState.GoIn)
                {
                    var assistHandler = RuleHandlerFactory.Instance.CreateTempMainInRuleHandler();
                    rst.ResCode = ResultCode.Defaut;
                    assistHandler.ApplyRule(args, rst);
                }
                else
                {
                    var assistHandler = RuleHandlerFactory.Instance.CreateTempMainOutRuleHandler();
                    rst.ResCode = ResultCode.Defaut;
                    assistHandler.ApplyRule(args, rst);
                }
            }
        }
Exemple #5
0
 protected override void ProcessRule(InputAgs args, ResultAgs rst)
 {
     rst.InOutBaseCardType = args.CarTypeInfo.BaseTypeID;
     if (args.GateInfo.Box.IsCenterPayment == YesOrNo.No)//中心收费不判断重复出入场
     {
         CheckReaptIn(args, rst);
     }
 }
Exemple #6
0
 protected override void ProcessRule(InputAgs args, ResultAgs rst)
 {
     if (args.AreadInfo.IsNestArea)
     {
         FindNestAreaIorecord(args, rst);
     }
     else
     {
         FindMainAreaIorecord(args, rst);
     }
 }
Exemple #7
0
 protected override void ProcessRule(InputAgs args, ResultAgs rst)
 {
     if (args.AreadInfo.IsNestArea)
     {
         CheckNestAreaRepeatOut(args, rst);
     }
     else
     {
         CheckMainAreaRepeatOut(args, rst);
     }
 }
Exemple #8
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;
            }
        }
Exemple #9
0
        /// <summary>
        /// 接口的工厂实现
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public ResultAgs Process(InputAgs args)
        {
            var rst         = new ResultAgs();
            var ruleHandler = CreateRuleHandler(args, rst);

            if (ruleHandler != null)
            {
                ruleHandler.ApplyRule(args, rst);
            }
            return(rst);
        }
Exemple #10
0
 private void CheckReaptIn(InputAgs args, ResultAgs rst)
 {
     if (args.AreadInfo.IsNestArea)
     {
         CheckNestReaptIn(args, rst);
     }
     else
     {
         CheckMainReaptIn(args, rst);
     }
 }
Exemple #11
0
 protected override void ProcessRule(InputAgs args, ResultAgs rst)
 {
     rst.InOutBaseCardType = args.CarTypeInfo.BaseTypeID;
     if (args.CarTypeInfo.LpDistinguish == LpDistinguish.CardAndPlate)
     {
         if (args.CardInfo.Usercard.CardNo != args.InCardNo || args.CardInfo.OwnerPlateNumber.PlateNo != args.Plateinfo.LicenseNum)
         {
             rst.ResCode = ResultCode.CarNoEqLp;
         }
     }
 }
Exemple #12
0
        protected override void ProcessRule(InputAgs args, ResultAgs rst)
        {
            string errorMsg = "";

            var lockcar = WX_LockCarServices.GetLockCar(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);

            if (lockcar != null && lockcar.Status == 1)
            {
                //已经锁车后 无法出场
                rst.ResCode = ResultCode.CarLocked;
            }
        }
Exemple #13
0
        /// <summary>
        /// 主区域入场记录
        /// </summary>
        /// <param name="args"></param>
        /// <param name="rst"></param>
        private void FindMainAreaIorecord(InputAgs args, ResultAgs rst)
        {
            string errorMsg = "";
            var    iorecord = ParkIORecordServices.GetNoExitIORecordByCardNo(args.AreadInfo.PKID, args.CardInfo.Usercard.CardNo, out errorMsg);

            if (iorecord == null) //根据卡找未找到 可能是进场固定转临停 这个时候根据车牌找记录 找到后更新进出记录
            {
                iorecord = ParkIORecordServices.GetNoExitIORecordByPlateNumber(args.AreadInfo.PKID, args.CardInfo.OwnerPlateNumber.PlateNo, out errorMsg);
                if (iorecord != null)
                {
                    iorecord.CarTypeID = args.CarTypeInfo.CarTypeID;
                    iorecord.CardNo    = args.CardInfo.Usercard.CardNo;
                    iorecord.CardNumb  = args.CardInfo.Usercard.CardNumb;
                    iorecord.CarTypeID = args.CarTypeInfo.CarTypeID;
                    ParkIORecordServices.ModifyIORecord(iorecord, out errorMsg);
                    //SynchroService.UpLoadModle<ParkIORecord>(iorecord);
                }
            }
            if (iorecord != null && !iorecord.IsExit)
            {
                args.IORecord = iorecord;
                if (!iorecord.CarModelID.IsEmpty() && (iorecord.CarModelID.IsEmpty() || (!iorecord.CarModelID.IsEmpty() && args.CarModel.CarModelID != iorecord.CarModelID)))
                {
                    args.CarModel = ParkCarModelServices.QueryByRecordId(iorecord.CarModelID);
                }
                rst.InDate            = args.IORecord.EntranceTime;
                rst.OutDate           = args.Plateinfo.TriggerTime;
                rst.ResCode           = ResultCode.OutOK;
                rst.InOutBaseCardType = BaseCarType.MonthlyRent;
            }
            else
            {
                if (args.CarTypeInfo.CarNoLike == YesOrNo.Yes)
                {
                    rst.ResCode           = ResultCode.OnFindNo;
                    rst.InOutBaseCardType = BaseCarType.MonthlyRent;
                }
                else
                {
                    if (args.CarTypeInfo.RepeatOut == YesOrNo.No)
                    {
                        rst.ResCode = ResultCode.RepeatOut;
                    }
                    else
                    {
                        rst.ResCode           = ResultCode.OutOK;
                        rst.InOutBaseCardType = BaseCarType.MonthlyRent;
                    }
                }
            }
        }
Exemple #14
0
 protected override void ProcessRule(InputAgs args, ResultAgs rst)
 {
     if (args.GateInfo.Box.IsCenterPayment == YesOrNo.No)//中心收费不判断重复出入场
     {
         if (args.AreadInfo.IsNestArea)
         {
             CheckNestAreaRepeatOut(args, rst);
         }
         else
         {
             CheckMainAreaRepeatOut(args, rst);
         }
     }
 }
Exemple #15
0
        private void CheckMainAreaRepeatOut(InputAgs args, ResultAgs rst)
        {
            string errorMsg = "";
            var    iorecord = ParkIORecordServices.GetNoExitIORecordByCardNo(args.AreadInfo.PKID, args.CardInfo.Usercard.CardNo, out errorMsg);

            if (iorecord == null)//可能是进场后再添加的储值卡
            {
                iorecord = ParkIORecordServices.GetNoExitIORecordByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.PlayPlateNmber, out errorMsg);
                if (iorecord != null)
                {
                    iorecord.CarTypeID = args.CarTypeInfo.CarTypeID;
                    iorecord.CardNo    = args.CardInfo.Usercard.CardNo;
                    iorecord.CardNumb  = args.CardInfo.Usercard.CardNumb;
                    iorecord.CarTypeID = args.CarTypeInfo.CarTypeID;
                    ParkIORecordServices.ModifyIORecord(iorecord, out errorMsg);
                    //SynchroService.UpLoadModle(iorecord);
                }
            }
            if (iorecord != null && !iorecord.IsExit)
            {
                args.IORecord = iorecord;
                if (!iorecord.CarModelID.IsEmpty() && (iorecord.CarModelID.IsEmpty() || (!iorecord.CarModelID.IsEmpty() && args.CarModel.CarModelID != iorecord.CarModelID)))
                {
                    args.CarModel = ParkCarModelServices.QueryByRecordId(iorecord.CarModelID);
                }
                rst.InDate            = args.IORecord.EntranceTime;
                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;
                }
            }
        }
Exemple #16
0
 protected override void ProcessRule(InputAgs args, ResultAgs rst)
 {
     if (!args.AreadInfo.IsNestArea)
     {
         return;
     }
     if (args.NestAreaIORecord == null)
     {
         if (args.AreadInfo.NeedToll == YesOrNo.Yes && args.CarTypeInfo.CarNoLike == YesOrNo.Yes)
         {
             rst.ResCode = ResultCode.OnFindNo;
         }
         else if (args.CarTypeInfo.RepeatOut == YesOrNo.No)
         {
             rst.ResCode = ResultCode.RepeatOut;
         }
     }
 }
Exemple #17
0
        private void CheckMainReaptIn(InputAgs args, ResultAgs rst)
        {
            string       errorMsg = "";
            ParkIORecord ioRecord = ParkIORecordServices.GetNoExitIORecordByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);

            if (args.CarTypeInfo.RepeatIn == YesOrNo.Yes && ioRecord != null && !ioRecord.IsExit)
            {
                //删除入场记录
                RemoveReaptInIorecord(args);
                ioRecord.DataStatus = 2;
            }
            else
            {
                if (ioRecord != null && !ioRecord.IsExit)
                {
                    rst.ResCode = ResultCode.RepeatIn;
                }
            }
        }
Exemple #18
0
        private void CheckMainAreaRepeatOut(InputAgs args, ResultAgs rst)
        {
            string       errorMsg = "";
            ParkIORecord iorecord = null;

            if (args.CardInfo != null)
            {
                iorecord = ParkIORecordServices.GetNoExitIORecordByCardNo(args.AreadInfo.PKID, args.CardInfo.Usercard.CardNo, out errorMsg);
            }
            else
            {
                iorecord = ParkIORecordServices.GetNoExitIORecordByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);
            }
            rst.InOutBaseCardType = args.CarTypeInfo.BaseTypeID;
            if ((iorecord == null || iorecord.IsExit) && args.CarTypeInfo.RepeatOut == YesOrNo.No)
            {
                rst.ResCode = ResultCode.RepeatOut;
            }
        }
Exemple #19
0
        protected override void ProcessRule(InputAgs args, ResultAgs rst)
        {
            rst.InOutBaseCardType = BaseCarType.TempCar;
            string errorMsg = "";

            if (args.CarTypeInfo.IsIgnoreHZ && args.Plateinfo.LicenseNum.Length >= 7)
            {
                var plateNumber = args.Plateinfo.LicenseNum.Substring(1, args.Plateinfo.LicenseNum.Length - 1);
                var iorecord    = ParkIORecordServices.QueryInCarTempIORecordByLikePlateNumber(args.AreadInfo.PKID, plateNumber, out errorMsg);
                if (iorecord != null)
                {
                    args.Plateinfo.LicenseNum = iorecord.PlateNumber;
                }
            }
            IsPoliceFree(args, rst);

            var blackList = ParkBlacklistServices.GetBlacklist(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);

            if (blackList != null)
            {
                if (blackList.Status == BlackListStatus.NotEnterAndOut)
                {
                    rst.ResCode = ResultCode.BlacklistCar;
                    return;
                }
                if (args.GateInfo.IoState == IoState.GoOut &&
                    blackList.Status == BlackListStatus.CanEnterAndNotOut)
                {
                    rst.ResCode = ResultCode.BlacklistCar;
                    return;
                }
            }
            if (args.GateInfo.IsTempInOut == YesOrNo.No)//子区域允许月卡进出
            {
                if (!rst.IsPoliceFree)
                {
                    rst.ResCode = ResultCode.NoPermissionsInOut;
                    return;
                }
            }
        }
Exemple #20
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;
            }
        }
Exemple #21
0
 /// <summary>
 /// 是否军警免费车辆
 /// </summary>
 /// <param name="args"></param>
 /// <param name="rst"></param>
 public void IsPoliceFree(InputAgs args, ResultAgs rst)
 {
     if (args.Plateinfo.LicenseNum.Length > 1 && args.AreadInfo.Parkinfo.PoliceFree)
     {
         foreach (var item in FreeCarStartContains)
         {
             if (args.Plateinfo.LicenseNum.StartsWith(item))
             {
                 rst.IsPoliceFree = true;
                 rst.ValidMsg     = "军警免费车辆";
                 break;
             }
         }
         foreach (var item in FreeCarEndContains)
         {
             if (args.Plateinfo.LicenseNum.Contains(item))
             {
                 rst.IsPoliceFree = true;
                 rst.ValidMsg     = "军警免费车辆";
                 break;
             }
         }
     }
 }
Exemple #22
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;

            if (args.GateInfo.IoState == IoState.GoIn)
            {
                if (args.CardInfo.EndDate < args.Plateinfo.TriggerTime || args.CardInfo.EndDate == null)
                {
                    if (args.CarTypeInfo.OverdueToTemp == OverdueToTemp.ProhibitedInAndOut)//不允许入场
                    {
                        rst.ResCode = ResultCode.UserExpired;
                        return;
                    }
                    else//临停转固定
                    {
                        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.CardInfo.PKLot.IsEmpty() || args.GateInfo.IoState != IoState.GoIn)
            {
                return;
            }
            if (args.CardInfo.PKLotNum <= 0)//没有车位忽略  如果有车位的话 根据车位查找在场车辆
            {
                return;
            }
            if (args.AreadInfo.IsNestArea)
            {
                if (args.NestAreaIORecord == null)
                {
                    return;
                }
                var interimes = ParkInterimServices.GetInterimByIOrecord(args.NestAreaIORecord.RecordID, out error);
                if (interimes != null && interimes.Find(i => i.EndInterimTime == DateTime.MinValue) != null)//没有正在转临停 说明是月卡
                {
                    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.ValidMsg          = "车位占用转临时车";
                    rst.EnterType         = 2;
                }
            }
            else
            {
                int occupyCount = 0;//如果有多个车位 且多个车位都被占用时 根据配置是否能进或转临停
                var usercards   = ParkGrantServices.GetCardgrantsByLot(args.AreadInfo.PKID, args.CardInfo.PKLot, out error);

                foreach (var card in usercards)
                {
                    var ownerPlateNumber = EmployeePlateServices.GetPlateNumber(args.AreadInfo.Parkinfo.VID, card.PlateID, out error);
                    if (ownerPlateNumber == null)
                    {
                        continue;
                    }
                    if (ownerPlateNumber.PlateNo == args.Plateinfo.LicenseNum)
                    {
                        continue;
                    }
                    var iorecord = ParkIORecordServices.GetNoExitIORecordByPlateNumber(args.AreadInfo.PKID, ownerPlateNumber.PlateNo, out error);
                    if (iorecord == null)
                    {
                        continue;
                    }

                    var cardtype  = ParkCarTypeServices.QueryParkCarTypeByRecordId(iorecord.CarTypeID);
                    var interimes = ParkInterimServices.GetInterimByIOrecord(iorecord.RecordID, out error);
                    if (interimes == null || interimes.Find(i => i.EndInterimTime == DateTime.MinValue) == null)//没有正在转临停 说明是月卡
                    {
                        occupyCount++;
                        continue;
                    }
                }

                if (occupyCount >= args.CardInfo.PKLotNum)
                {
                    if (args.CarTypeInfo.LotOccupy == LotOccupy.ProhibitedInAndOut)//不允许入场
                    {
                        rst.ResCode = ResultCode.NoPermissionsInOut;
                    }
                    else//固定转临时停车
                    {
                        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.ValidMsg          = "车位占用转临时车";
                        rst.EnterType         = 2;
                    }
                }
            }
        }
Exemple #23
0
        protected override void ProcessRule(InputAgs args, ResultAgs rst)
        {
            rst.InOutBaseCardType = BaseCarType.TempCar;
            string errorMsg = "";

            if (args.CarTypeInfo.IsIgnoreHZ && args.Plateinfo.LicenseNum.Length >= 7)
            {
                var plateNumber = args.Plateinfo.LicenseNum.Substring(1, args.Plateinfo.LicenseNum.Length - 1);
                var iorecord    = ParkIORecordServices.QueryInCarTempIORecordByLikePlateNumber(args.AreadInfo.PKID, plateNumber, out errorMsg);
                if (iorecord != null)
                {
                    args.Plateinfo.LicenseNum = iorecord.PlateNumber;
                }
            }
            IsPoliceFree(args, rst);

            var blackList = ParkBlacklistServices.GetBlacklist(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);

            if (blackList != null)
            {
                if (blackList.Status == BlackListStatus.NotEnterAndOut)
                {
                    rst.ResCode = ResultCode.BlacklistCar;
                    return;
                }
                if (args.GateInfo.IoState == IoState.GoOut &&
                    blackList.Status == BlackListStatus.CanEnterAndNotOut)
                {
                    rst.ResCode = ResultCode.BlacklistCar;
                    return;
                }
            }
            var vistar = ParkVisitorServices.GetNormalVisitor(args.AreadInfo.Parkinfo.VID, args.Plateinfo.LicenseNum, out errorMsg);

            if (vistar != null && args.Plateinfo.TriggerTime >= vistar.BeginDate && args.Plateinfo.TriggerTime <= vistar.EndDate &&
                (vistar.VisitorCount > 0 || vistar.VisitorCount == -1))
            {
                var vistarcar = ParkVisitorServices.GetVisitorCar(args.AreadInfo.PKID, vistar.RecordID, out errorMsg);
                if (vistarcar != null && (vistar.VisitorCount == -1 || vistar.VisitorCount > vistarcar.AlreadyVisitorCount))
                {
                    //访客表中  在时段内 且进出次数大于已经进出次数时 允许进出
                    var carModelid = vistar.CarModelID;
                    if (!carModelid.IsEmpty())
                    {
                        var carModel = ParkCarModelServices.QueryByRecordId(vistar.CarModelID);
                        if (carModel != null)
                        {
                            args.CarModel = carModel;
                        }
                    }
                    rst.ValidMsg     = "访客车辆";
                    rst.IsVisitorCar = true;
                    rst.VisitorCar   = vistarcar;
                    return;
                }
                else if (args.GateInfo.IsTempInOut == YesOrNo.No)
                {
                    rst.ResCode = ResultCode.NoPermissionsInOut;
                    return;
                }
            }
            else if (args.GateInfo.IsTempInOut == YesOrNo.No) //子区域允许月卡进出
            {
                if (!rst.IsPoliceFree)
                {
                    rst.ResCode = ResultCode.NoPermissionsInOut;
                    return;
                }
            }
        }
Exemple #24
0
 protected override void ProcessRule(InputAgs args, ResultAgs rst)
 {
     rst.InOutBaseCardType = BaseCarType.StoredValueCar;
 }
Exemple #25
0
        private void CheckMainAreaRepeatOut(InputAgs args, ResultAgs rst)
        {
            string       errorMsg = "";
            ParkIORecord isfindno = null;

            if (args.CardInfo != null)
            {
                isfindno = ParkIORecordServices.GetNoExitIORecordByCardNo(args.AreadInfo.PKID, args.CardInfo.Usercard.CardNo, out errorMsg);
            }
            else
            {
                isfindno = ParkIORecordServices.GetNoExitIORecordByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);
            }
            if (isfindno != null)
            {
                args.IORecord = isfindno;
                if (!isfindno.CarModelID.IsEmpty() && (isfindno.CarModelID.IsEmpty() || (!isfindno.CarModelID.IsEmpty() && (args.CarModel != null && args.CarModel.CarModelID != isfindno.CarModelID))))
                {
                    args.CarModel = ParkCarModelServices.QueryByRecordId(isfindno.CarModelID);
                }

                var list = ParkCarModelServices.QueryByParkingId(args.AreadInfo.PKID);
                foreach (var item in list)
                {
                    if (item.PlateColor.ToInt() != 0 && item.PlateColor.ToInt() == args.Plateinfo.CarModelType)
                    {
                        args.CarModel = item;
                        break;
                    }
                }
                if (args.CarModel == null)
                {
                    //获取卡对应的车类型
                    var carmode = ParkCarModelServices.GetDefaultCarModel(args.AreadInfo.PKID, out errorMsg);
                    if (carmode != null)
                    {
                        args.CarModel = carmode;
                    }
                }

                rst.InDate            = args.IORecord.EntranceTime;
                rst.OutDate           = args.Plateinfo.TriggerTime;
                rst.ResCode           = ResultCode.OutOK;
                rst.InOutBaseCardType = BaseCarType.TempCar;
            }
            else if (rst.IsPoliceFree)
            {
                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)
                {
                    rst.ResCode = ResultCode.RepeatOut;
                }
                else
                {
                    rst.ResCode           = ResultCode.OutOK;
                    rst.InOutBaseCardType = BaseCarType.TempCar;
                }
            }
        }
Exemple #26
0
 protected override void ProcessRule(InputAgs args, ResultAgs rst)
 {
     rst.InOutBaseCardType = BaseCarType.MonthlyRent;
 }
Exemple #27
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;
                }
            }
        }
Exemple #28
0
        public ActionResult QueryWaitPayDetail(string recordId, string carModelId)
        {
            try
            {
                string       errorMsg = string.Empty;
                ParkIORecord model    = ParkIORecordServices.GetIORecord(recordId, out errorMsg);
                if (!string.IsNullOrWhiteSpace(errorMsg))
                {
                    throw new MyException("获取该入场记录失败");
                }
                if (model == null)
                {
                    throw new MyException("找不到该入场记录");
                }
                if (model.IsExit)
                {
                    throw new MyException("该车辆已经出场");
                }

                DateTime        outTime   = DateTime.Now;
                List <ParkGate> parkGates = ParkGateServices.QueryByParkAreaRecordIds(new List <string>()
                {
                    model.AreaID
                });
                ParkGate outGate = parkGates.FirstOrDefault(p => p.IoState == IoState.GoOut);
                if (outGate == null)
                {
                    throw new MyException("获取出口通道失败");
                }
                ResultAgs billResult = RateProcesser.GetRateResult(model, outGate, outTime, carModelId);
                if (!string.IsNullOrWhiteSpace(billResult.ValidFailMsg))
                {
                    throw new MyException(billResult.ValidFailMsg);
                }
                if (billResult.Rate == null)
                {
                    throw new MyException("计算停车费失败");
                }

                List <ParkIORecord> records = new List <ParkIORecord>()
                {
                    model
                };
                var result = from p in records
                             select new
                {
                    RecordID              = p.RecordID,
                    EntranceImageUrl      = GetImagePath(p.EntranceImage, true, false),
                    EntrancePlateImageUrl = GetImagePath(p.EntranceImage, false, false),
                    PlateNumber           = p.PlateNumber,
                    EntranceTime          = p.EntranceTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    OutTime        = outTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    TotalDuration  = p.EntranceTime.GetParkingDuration(outTime),
                    TotalFee       = billResult.Rate.Amount.ToString("0.0"),
                    PaySuccess     = billResult.Rate.OnlinePayAmount.ToString("0.0"),
                    WaitPay        = billResult.Rate.UnPayAmount.ToString("0.0"),
                    DiscountAmount = billResult.Rate.DiscountAmount.ToString("0.0")
                };

                return(Json(MyResult.Success(string.Empty, result)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "中央缴费获取待支付记录失败");
                return(Json(MyResult.Error("取待支付记录失败")));
            }
        }
Exemple #29
0
        public ActionResult TollRelease(decimal waitPay, string recordId, string carModelId)
        {
            try
            {
                string       errorMsg = string.Empty;
                ParkIORecord model    = ParkIORecordServices.GetIORecord(recordId, out errorMsg);
                if (!string.IsNullOrWhiteSpace(errorMsg))
                {
                    throw new MyException("获取该入场记录失败");
                }
                if (model == null)
                {
                    throw new MyException("找不到该入场记录");
                }
                if (model.IsExit)
                {
                    throw new MyException("该车辆已经出场");
                }

                DateTime        outTime   = DateTime.Now;
                List <ParkGate> parkGates = ParkGateServices.QueryByParkAreaRecordIds(new List <string>()
                {
                    model.AreaID
                });
                ParkGate outGate = parkGates.FirstOrDefault(p => p.IoState == IoState.GoOut);
                if (outGate == null)
                {
                    throw new MyException("获取出口通道失败");
                }
                ResultAgs billResult = RateProcesser.GetRateResult(model, outGate, outTime, carModelId);
                if (!string.IsNullOrWhiteSpace(billResult.ValidFailMsg))
                {
                    throw new MyException(billResult.ValidFailMsg);
                }
                if (billResult.Rate == null)
                {
                    throw new MyException("计算停车费失败");
                }
                if (waitPay != billResult.Rate.UnPayAmount)
                {
                    throw new MyException("缴费金额与实际金额不匹配,请重新选择入场记录");
                }

                bool result = CentralFeeServices.Payment(recordId, model.ParkingID, billResult, GetLoginUser.RecordID);
                if (!result)
                {
                    throw new MyException("缴费失败");
                }

                return(Json(MyResult.Success()));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "提交收费失败");
                return(Json(MyResult.Error("缴费失败")));
            }
        }
Exemple #30
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;
                }
            }
        }