/// <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; } } } }
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; } } }
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; } } }
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; } }
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; } } } }
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; } } }
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; } } }
/// <summary> /// Context工厂 /// </summary> /// <param name="args"></param> /// <returns></returns> private RuleHandler CreateRuleHandler(InputAgs args, ResultAgs rst) { string errorMsg = ""; if (args.AreadInfo.IsNestArea && args.AreadInfo.Parent == null)//内部车场时 且上级区域为空时 { args.AreadInfo.Parent = ParkAreaServices.QueryByRecordId(args.AreadInfo.MasterID); if (args.AreadInfo.Parent == null)//还是找不到上级区域时 { LogerHelper.Loger.Error(string.Format("找不到车场[{0}]的上级车场,上级车场ID为[{1}].", args.AreadInfo.AreaName, args.AreadInfo.MasterID)); args.AreadInfo.MasterID = "";//找不到就至为空 } } //判断系统停车或非系统停车 var cartype = BaseCarType.TempCar; if (!args.Plateinfo.LicenseNum.Contains("无") && args.Plateinfo.LicenseNum.Length > 3)//不是“无车牌” { EmployeePlate platenumber = null; if (args.GateInfo.OpenPlateBlurryMatch == YesOrNo.Yes) { string likeplate = args.Plateinfo.LicenseNum; platenumber = EmployeePlateServices.GetEmployeePlateNumberByPlateNumber(args.AreadInfo.Parkinfo.VID, likeplate, out errorMsg); if (platenumber == null && args.Plateinfo.LicenseNum.Length >= 3)//模糊识别 前一位后一位模糊识别 { likeplate = args.Plateinfo.LicenseNum.Substring(2, args.Plateinfo.LicenseNum.Length - 2); platenumber = EmployeePlateServices.GetGrantPlateNumberByLike(args.AreadInfo.Parkinfo.VID, likeplate, out errorMsg); if (platenumber == null) { likeplate = args.Plateinfo.LicenseNum.Substring(0, args.Plateinfo.LicenseNum.Length - 2); platenumber = EmployeePlateServices.GetGrantPlateNumberByLike(args.AreadInfo.Parkinfo.VID, likeplate, out errorMsg); } if (platenumber != null) { args.Plateinfo.LicenseNum = platenumber.PlateNo; } } } else { platenumber = EmployeePlateServices.GetEmployeePlateNumberByPlateNumber(args.AreadInfo.Parkinfo.VID, args.Plateinfo.LicenseNum, out errorMsg); } if (platenumber != null) { //根据车牌获取车辆用户信息 var pkcard = ParkGrantServices.GetParkGrantByPlateNumberID(args.AreadInfo.PKID, platenumber.PlateID, out errorMsg); if (pkcard.Count() > 0) { //判断是否有区域 通道限制 var cardinfo = pkcard.First(); args.LastCardInfo = cardinfo; if (cardinfo.AreaIDS.IsEmpty())//没有限制 { if ((cardinfo.GateID.IsEmpty()) || cardinfo.GateID.Contains(args.GateInfo.GateID)) //区域包含 且通道未控制授权 或 通道已经授权 { args.CardInfo = cardinfo; args.CardInfo.OwnerPlateNumber = platenumber; var usercard = BaseCardServices.GetBaseCard(args.CardInfo.CardID, out errorMsg); if (usercard != null) { args.CardInfo.Usercard = usercard; } else { args.CardInfo = null; } } } else { if (cardinfo.AreaIDS.Contains(args.AreadInfo.AreaID) && (cardinfo.GateID.IsEmpty()) || cardinfo.GateID.Contains(args.GateInfo.GateID)) //区域包含 且通道未控制授权 或 通道已经授权 { args.CardInfo = cardinfo; args.CardInfo.OwnerPlateNumber = platenumber; var usercard = BaseCardServices.GetBaseCard(args.CardInfo.CardID, out errorMsg); if (usercard != null) { args.CardInfo.Usercard = usercard; } else { args.CardInfo = null; } } } if (args.CardInfo == null) { rst.ValidMsg = "非本区域月卡"; } } } if (args.CardInfo != null) { var pkcardtype = ParkCarTypeServices.QueryParkCarTypeByRecordId(args.CardInfo.CarTypeID); if (pkcardtype != null) { args.CarTypeInfo = pkcardtype; } else { //获取对应的卡类型 var pkcardtypes = ParkCarTypeServices.QueryCardTypesByBaseCardType(args.AreadInfo.PKID, BaseCarType.TempCar); if (pkcardtypes != null && pkcardtypes.Count() > 0) { args.CarTypeInfo = pkcardtypes.First(); } } if (!args.CardInfo.CarModelID.IsEmpty()) { var model = ParkCarModelServices.QueryByRecordId(args.CardInfo.CarModelID); args.CarModel = model; } if (args.CarModel == null) { //获取卡对应的车类型 var listcarmodel = ParkCarModelServices.GetDefaultCarModel(args.AreadInfo.PKID, out errorMsg); if (listcarmodel != null) { args.CarModel = listcarmodel; } } } else { //默认为临时车 var pkcardtypes = ParkCarTypeServices.QueryCardTypesByBaseCardType(args.AreadInfo.PKID, BaseCarType.TempCar); if (pkcardtypes != null && pkcardtypes.Count() > 0) { args.CarTypeInfo = pkcardtypes.First(); } ////获取默认车类型 //var listcarmodel = ParkCarModelServices.GetDefaultCarModel(args.AreadInfo.PKID, out errorMsg); //if (listcarmodel != null) //{ // args.CarModel = listcarmodel; //} if (args.Plateinfo.PlateColor != null && args.Plateinfo.PlateColor.Contains("黄")) { var list = ParkCarModelServices.QueryByParkingId(args.AreadInfo.PKID); foreach (var item in list) { if (item.PlateColor != null && item.PlateColor.Contains("黄")) { args.CarModel = item; break; } } } if (args.CarModel == null) { //获取卡对应的车类型 var carmode = ParkCarModelServices.GetDefaultCarModel(args.AreadInfo.PKID, out errorMsg); if (carmode != null) { args.CarModel = carmode; } } } } else { //默认为临时车 var pkcardtypes = ParkCarTypeServices.QueryCardTypesByBaseCardType(args.AreadInfo.PKID, BaseCarType.TempCar); if (pkcardtypes != null && pkcardtypes.Count() > 0) { args.CarTypeInfo = pkcardtypes.First(); } if (args.Plateinfo.PlateColor != null && args.Plateinfo.PlateColor.Contains("黄")) { var list = ParkCarModelServices.QueryByParkingId(args.AreadInfo.PKID); foreach (var item in list) { if (item.PlateColor != null && item.PlateColor.Contains("黄")) { args.CarModel = item; break; } } } if (args.CarModel == null) { //获取卡对应的车类型 var carmode = ParkCarModelServices.GetDefaultCarModel(args.AreadInfo.PKID, out errorMsg); if (carmode != null) { args.CarModel = carmode; } } } if (args.AreadInfo.IsNestArea)//小车场 先查询对应的通行记录 { ParkIORecord ioRecord = ParkIORecordServices.GetNoExitIORecordByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg); args.NestAreaIORecord = ioRecord; } if (args.CarTypeInfo == null) { rst.ResCode = ResultCode.LocalError; throw new Exception("参数错误:默认卡片类型为空"); } if (args.CarTypeInfo == null) { rst.ResCode = ResultCode.LocalError; throw new Exception("参数错误:默认车辆类型为空"); } cartype = args.CarTypeInfo.BaseTypeID; #region 生产对应的验证规则 //此处可根据配置文件利用反射生成配置的验证规则 RuleHandler ruleHandler = null; switch (cartype) { case BaseCarType.MonthlyRent: #region 月卡 if (args.GateInfo.IoState == IoState.GoIn) //进 { ruleHandler = RuleHandlerFactory.Instance.CreateMonthMainInRuleHandler(); } else //出 { ruleHandler = RuleHandlerFactory.Instance.CreateMonthMainOutRuleHandler(); } #endregion break; case BaseCarType.TempCar: #region 临时卡 if (args.GateInfo.IoState == IoState.GoIn) //进 { ruleHandler = RuleHandlerFactory.Instance.CreateTempMainInRuleHandler(); } else //出 { ruleHandler = RuleHandlerFactory.Instance.CreateTempMainOutRuleHandler(); } #endregion break; case BaseCarType.StoredValueCar: #region 储值卡 if (args.GateInfo.IoState == IoState.GoIn) //进 { ruleHandler = RuleHandlerFactory.Instance.CreateValueMainInRuleHandler(); } else //出 { ruleHandler = RuleHandlerFactory.Instance.CreateValueMainOutRuleHandler(); } #endregion break; case BaseCarType.VIPCar: #region VIP卡 if (args.GateInfo.IoState == IoState.GoIn) //进 { ruleHandler = RuleHandlerFactory.Instance.CreateVIPMainInRuleHandler(); } else //出 { ruleHandler = RuleHandlerFactory.Instance.CreateVIPMainOutRuleHandler(); } #endregion break; } #endregion return(ruleHandler); }