Exemple #1
0
        public JsonResult GetParkFeeRuleData()
        {
            JsonResult json = new JsonResult();

            try
            {
                if (string.IsNullOrEmpty(Request.Params["parkingId"]))
                {
                    return(json);
                }

                string parkingId = Request.Params["parkingId"].ToString();

                List <ParkCarType>     carTypes  = ParkCarTypeServices.QueryParkCarTypeByParkingId(parkingId);
                List <ParkCarModel>    carModels = ParkCarModelServices.QueryByParkingId(parkingId);
                List <ParkFeeRule>     rules     = ParkFeeRuleServices.QueryParkFeeRuleByParkingId(parkingId);
                List <ParkArea>        areas     = ParkAreaServices.GetParkAreaByParkingId(parkingId);
                List <ParkFeeRuleView> models    = new List <ParkFeeRuleView>();
                foreach (var item in rules)
                {
                    ParkFeeRuleView view = new ParkFeeRuleView().ToParkFeeRuleView(item, areas, carTypes, carModels);
                    view.ParkingID = parkingId;
                    models.Add(view);
                }
                json.Data = models;
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取收费规则集合失败");
            }
            return(json);
        }
Exemple #2
0
 public JsonResult SaveEdit(ParkCarModel model)
 {
     try
     {
         bool result = false;
         if (string.IsNullOrWhiteSpace(model.CarModelID))//增加
         {
             result = ParkCarModelServices.Add(model);
             if (!result)
             {
                 throw new MyException("添加失败");
             }
             return(Json(MyResult.Success()));
         }
         else //修改
         {
             result = ParkCarModelServices.Update(model);
             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 #3
0
        /// <summary>
        /// 获得车形
        /// </summary>
        /// <returns></returns>
        public JsonResult GetCarTypes()
        {
            string     parkingid = Request.Params["parkingid"];
            JsonResult json      = new JsonResult();

            try
            {
                json.Data = ParkCarModelServices.QueryByParkingId(parkingid);
            }
            catch { }
            return(json);
        }
Exemple #4
0
        public JsonResult GetParkCarModel()
        {
            JsonResult json = new JsonResult();

            if (string.IsNullOrEmpty(Request.Params["parkingId"]))
            {
                return(json);
            }
            string parkingId = Request.Params["parkingId"].ToString();

            json.Data = ParkCarModelServices.QueryByParkingId(parkingId);
            return(json);
        }
Exemple #5
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 #6
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 #7
0
 public JsonResult GetCarModelData(string parkingId)
 {
     try
     {
         List <ParkCarModel> carModels = ParkCarModelServices.QueryByParkingId(parkingId);
         return(Json(MyResult.Success("", carModels)));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "获取车型失败");
         return(Json(MyResult.Error("获取车型失败")));
     }
 }
Exemple #8
0
        public JsonResult GetCarModelData(string parkingId)
        {
            JsonResult json = new JsonResult();

            try
            {
                List <ParkCarModel> carModels = ParkCarModelServices.QueryByParkingId(parkingId);
                json.Data = carModels;
                return(json);
            }
            catch (MyException ex)
            {
                ExceptionsServices.AddExceptions(ex, ex.Message);
                return(json);
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取车型失败");
                return(json);
            }
        }
Exemple #9
0
        public static ParkGrant GenerateParkGrantModel(string PKID, EmployeePlate plate, BaseCard card, string pkLot, string carModelId, string carTypeId, string AreaIDS, string GateID)
        {
            ParkGrant model = new ParkGrant();

            model.PKID     = PKID;
            model.CardID   = card.CardID;
            model.PlateID  = plate.PlateID;
            model.PlateNo  = plate.PlateNo;
            model.PKLot    = pkLot;
            model.PKLotNum = 0;

            ParkCarModel carModel = ParkCarModelServices.QueryByRecordId(carModelId);

            if (carModel == null)
            {
                throw new MyException("选择的车型不存在");
            }
            model.CarModelID = carModel.CarModelID;

            ParkCarType carType = ParkCarTypeServices.QueryParkCarTypeByRecordId(carTypeId);

            if (carType == null)
            {
                throw new MyException("选择的车类不存在");
            }
            model.CarTypeID = carType.CarTypeID;

            if (string.IsNullOrWhiteSpace(AreaIDS))
            {
                throw new MyException("获取选择的车场区域失败");
            }
            model.AreaIDS = AreaIDS == "-1" ? string.Empty : AreaIDS;

            if (string.IsNullOrWhiteSpace(GateID))
            {
                throw new MyException("获取选择的车场通道失败");
            }
            model.GateID = GateID == "-1" ? string.Empty : GateID;
            return(model);
        }
Exemple #10
0
        public string GetParkCarModelData()
        {
            JsonResult json = new JsonResult();

            if (string.IsNullOrEmpty(Request.Params["parkingId"]))
            {
                return(string.Empty);
            }
            string parkingid = Request.Params["parkingId"].ToString();
            List <ParkCarModel> carModels = ParkCarModelServices.QueryByParkingId(parkingid);
            StringBuilder       strTree   = new StringBuilder();

            strTree.Append("[");
            int index = 1;

            foreach (var item in carModels)
            {
                strTree.Append("{\"id\":\"" + item.CarModelID + "\",");
                if (item.IsDefault == YesOrNo.Yes)
                {
                    strTree.Append("\"selected\":true,");
                }
                else
                {
                    strTree.Append("\"selected\":false,");
                }
                strTree.Append("\"text\":\"" + item.CarModelName + "\"");
                strTree.Append("}");
                if (index != carModels.Count)
                {
                    strTree.Append(",");
                }
                index++;
            }
            strTree.Append("]");
            json.Data = strTree.ToString();
            return(strTree.ToString());
        }
Exemple #11
0
        public JsonResult GetCarModelData()
        {
            JsonResult json = new JsonResult();

            try
            {
                if (string.IsNullOrEmpty(Request.Params["parkingId"]))
                {
                    return(json);
                }

                string parkingid           = Request.Params["parkingid"].ToString();
                List <ParkCarModel> models = ParkCarModelServices.QueryByParkingId(parkingid);
                var result = from p in models select new {
                    CarModelID     = p.CarModelID,
                    CarModelName   = p.CarModelName,
                    PlateColor     = string.IsNullOrWhiteSpace(p.PlateColor) ? "无" : p.PlateColor,
                    IsDefault      = p.IsDefault,
                    IsNaturalDay   = p.IsNaturalDay,
                    MaxUseMoney    = p.MaxUseMoney,
                    DayMaxMoney    = p.DayMaxMoney,
                    NightMaxMoney  = p.NightMaxMoney,
                    DayStartTime   = p.DayStartTime == DateTime.MinValue? "00:00" : p.DayStartTime.ToString("HH:mm"),
                    DayEndTime     = p.DayEndTime == DateTime.MinValue ? "00:00" : p.DayEndTime.ToString("HH:mm"),
                    NightStartTime = p.NightStartTime == DateTime.MinValue ? "00:00" : p.NightStartTime.ToString("HH:mm"),
                    NightEndTime   = p.NightEndTime == DateTime.MinValue ? "00:00" : p.NightEndTime.ToString("HH:mm"),
                    DayDes         = GetDes(p.DayMaxMoney, p.DayStartTime, p.DayEndTime),
                    NightDes       = GetDes(p.NightMaxMoney, p.NightStartTime, p.NightEndTime)
                };
                json.Data = result;
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "车型管理查询车类型集合失败");
            }
            return(json);
        }
Exemple #12
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 #13
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 #14
0
        /// <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);
        }
Exemple #15
0
        /// <summary>
        /// 白天黑夜最大收费参数设置
        /// </summary>
        //public static DayAndNightMaxMoneyPara DayAndNightMaxMoneyPara { get; set; }

        //private static XDocument document;
        //public static XDocument _XDocument
        //{
        //    get
        //    {
        //        return document;
        //    }
        //    private set
        //    {
        //        document = value;
        //    }
        //}

        //static RateProcesser()
        //{
        //    try
        //    {
        //        string xmlName = "TimeShareFeeRule.xml";
        //        var dirName = Path.Combine(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase, xmlName);

        //        XDocument xdoc = XDocument.Load(dirName);
        //        foreach (var item in xdoc.Root.Elements())
        //        {
        //            if (item.Attribute("IsEnable").Value.ToBoolean())
        //            {
        //                _XDocument = xdoc;
        //            }
        //            break;
        //        }
        //    }
        //    catch(Exception ex)
        //    {
        //        LogerHelper.Loger.Error(ex);
        //    }
        //}

        //public static void  LoadCustomFeerule(string ruletext)
        //{

        //    try
        //    {
        //        using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(ruletext)))
        //        {
        //            XDocument xdoc = XDocument.Load(stream);
        //            foreach (var item in xdoc.Root.Elements())
        //            {
        //                if (item.Attribute("IsEnable").Value.ToBoolean())
        //                {
        //                    _XDocument = xdoc;
        //                }
        //                break;
        //            }

        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        LogerHelper.Loger.Error(ex);
        //    }
        //}
        /// <summary>
        /// 根据入场记录算费
        /// </summary>
        /// <param name="ioRecord"></param>
        /// <returns></returns>
        public static ResultAgs GetRateResult(ParkIORecord ioRecord, ParkGate outGate, DateTime exitTime, string carModeid = "")
        {
            if (outGate == null)
            {
                return(null);
            }
            string   errorMsg = "";
            InputAgs args     = new InputAgs();

            args.AreadInfo = ParkAreaServices.QueryByRecordId(ioRecord.AreaID);
            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 = "";//找不到就至为空
                }
            }
            args.AreadInfo.Parkinfo = ParkingServices.QueryParkingByParkingID(args.AreadInfo.PKID);
            if (args.AreadInfo.Parkinfo == null)//还是找不到上级区域时
            {
                LogerHelper.Loger.Error(string.Format("找不到区域[{0}]对应的车场.", args.AreadInfo.AreaName));
                return(null);
            }
            args.Plateinfo             = new PlateInfo();
            args.Plateinfo.LicenseNum  = ioRecord.PlateNumber;
            args.Plateinfo.TriggerTime = exitTime;
            args.CarTypeInfo           = ParkCarTypeServices.QueryParkCarTypeByRecordId(ioRecord.CarTypeID);
            string        str         = errorMsg;
            EmployeePlate 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.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.CarModelID.IsEmpty())
                    {
                        carModeid = args.CardInfo.CarModelID;
                    }
                }
            }

            if (args.CarTypeInfo == null)
            {
                return(null);
            }
            if (carModeid.IsEmpty())
            {
                args.CarModel = ParkCarModelServices.GetDefaultCarModel(args.AreadInfo.PKID, out errorMsg);
            }
            else
            {
                args.CarModel = ParkCarModelServices.QueryByRecordId(carModeid);
                if (args.CarModel == null)
                {
                    args.CarModel = ParkCarModelServices.GetDefaultCarModel(args.AreadInfo.PKID, out errorMsg);
                }
            }
            if (args.CarModel == null)
            {
                return(null);
            }
            //获取默认车类型
            args.GateInfo = outGate;
            args.IORecord = ioRecord;

            ResultAgs rst = new ResultAgs();

            rst.InOutBaseCardType = BaseCarType.TempCar;
            rst.ResCode           = ResultCode.OutOK;
            var rateContext = new RateTemplate();

            rateContext.Process(args, rst);
            return(rst);
        }
Exemple #16
0
        /// <summary>
        /// 模拟参数算费
        /// </summary>
        /// <param name="platenumber"></param>
        /// <param name="areaid"></param>
        /// <param name="intime"></param>
        /// <param name="exitTime"></param>
        /// <param name="cartypeID"></param>
        /// <param name="carModeid"></param>
        /// <returns></returns>
        public static ResultAgs GetRateResult(string platenumber, string areaid, DateTime intime, DateTime exitTime, string cartypeID, string carModeid = "")
        {
            if (areaid.IsEmpty())
            {
                return(null);
            }

            string   errorMsg = "";
            InputAgs args     = new InputAgs();

            args.AreadInfo = ParkAreaServices.QueryByRecordId(areaid);

            args.IORecord = new ParkIORecord();
            args.IORecord.EntranceTime = intime;
            args.IORecord.ExitTime     = exitTime;
            args.IORecord.PlateNumber  = platenumber;
            args.IORecord.CarTypeID    = cartypeID;
            args.IORecord.RecordID     = "";
            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 = "";//找不到就至为空
                }
            }
            args.AreadInfo.Parkinfo = ParkingServices.QueryParkingByParkingID(args.AreadInfo.PKID);
            if (args.AreadInfo.Parkinfo == null)//还是找不到上级区域时
            {
                LogerHelper.Loger.Error(string.Format("找不到区域[{0}]对应的车场.", args.AreadInfo.AreaName));
                return(null);
            }
            args.Plateinfo             = new PlateInfo();
            args.Plateinfo.LicenseNum  = platenumber;
            args.Plateinfo.TriggerTime = exitTime;
            args.CarTypeInfo           = ParkCarTypeServices.QueryParkCarTypeByRecordId(cartypeID);

            if (args.CarTypeInfo == null)
            {
                return(null);
            }
            if (carModeid.IsEmpty())
            {
                args.CarModel = ParkCarModelServices.GetDefaultCarModel(args.AreadInfo.PKID, out errorMsg);
            }
            else
            {
                args.CarModel = ParkCarModelServices.QueryByRecordId(carModeid);
            }
            if (args.CarModel == null)
            {
                return(null);
            }
            //获取默认车类型
            args.GateInfo         = new ParkGate();
            args.GateInfo.IoState = IoState.GoOut;
            ResultAgs rst = new ResultAgs();

            rst.InOutBaseCardType = BaseCarType.TempCar;
            rst.ResCode           = ResultCode.OutOK;
            var rateContext = new RateTemplate();

            rateContext.Process(args, rst);
            return(rst);
        }