Ejemplo n.º 1
0
        /// <summary>
        /// 车牌缴费
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Index(bool updatePlateNo = false)
        {
            List <string> myLicensePlates    = new List <string>();
            string        defaultPlateNumber = string.Empty;

            if (UserAccount != null)
            {
                myLicensePlates    = CarService.GetTempCarInfoIn(UserAccount.AccountID);
                defaultPlateNumber = OnlineOrderServices.QueryLastPaymentPlateNumber(UserAccount.AccountID);
                if (!string.IsNullOrWhiteSpace(defaultPlateNumber) && !updatePlateNo)
                {
                    ParkIORecord model = ParkIORecordServices.QueryLastExitIORecordByPlateNumber(defaultPlateNumber);
                    if (model != null)
                    {
                        return(RedirectToAction("ComputeParkingFee", "H5ParkingPayment", new { licensePlate = defaultPlateNumber, parkingId = model.ParkingID }));
                    }
                }

                if (!string.IsNullOrWhiteSpace(defaultPlateNumber))
                {
                    if (myLicensePlates.Contains(defaultPlateNumber))
                    {
                        myLicensePlates.Remove(defaultPlateNumber);
                    }
                }
                else if (myLicensePlates.Count > 0)
                {
                    defaultPlateNumber = myLicensePlates.First();
                    myLicensePlates.Remove(defaultPlateNumber);
                }
            }
            ViewBag.PlateNumber = defaultPlateNumber;
            return(View(myLicensePlates));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据车牌缴费
        /// </summary>
        /// <returns></returns>
        public ActionResult LicensePlatePayment(string parkingId, bool menuEnter = false)
        {
            //List<string> myLicensePlates = CarService.GetTempCarInfoIn(WeiXinUser.AccountID);
            ViewBag.ParkingId = parkingId;
            string plateNumber = ""; // OnlineOrderServices.QueryLastPaymentPlateNumber(PaymentChannel.WeiXinPay, WeiXinUser.OpenID);

            if (menuEnter && !string.IsNullOrWhiteSpace(plateNumber))
            {
                ParkIORecord model = ParkIORecordServices.QueryLastExitIORecordByPlateNumber(plateNumber);
                if (model != null)
                {
                    return(RedirectToAction("ComputeParkingFee", "ParkingPayment", new { licensePlate = plateNumber, parkingId = model.ParkingID }));
                }
            }

            //string defaultPlateNumber = plateNumber;
            //if (!string.IsNullOrWhiteSpace(plateNumber))
            //{
            //    if (myLicensePlates.Contains(plateNumber))
            //    {
            //        myLicensePlates.Remove(plateNumber);
            //    }
            //}
            //else if (myLicensePlates.Count > 0)
            //{
            //    defaultPlateNumber = myLicensePlates.First();
            //    myLicensePlates.Remove(defaultPlateNumber);
            //}
            ViewBag.PlateNumber = plateNumber;
            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult QueryWaitPayRecord(string parkingId, string plateNumber, int pageIndex)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(parkingId))
                {
                    throw new MyException("请选择车场");
                }

                int pageSize = 16;
                int recordTotalCount;
                List <ParkIORecord> records = ParkIORecordServices.QueryPageNotExit(parkingId, plateNumber, pageSize, pageIndex, out recordTotalCount);
                var result = from p in records
                             select new
                {
                    RecordID     = p.RecordID,
                    ImageUrl     = GetImagePath(p.EntranceImage),
                    PlateNumber  = p.PlateNumber,
                    EntranceTime = p.EntranceTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    ParkingId    = p.ParkingID
                };
                int    totalPage = (recordTotalCount + pageSize - 1) / pageSize;
                string msg       = string.Format("{0},{1}", recordTotalCount, totalPage);
                return(Json(MyResult.Success(msg, result)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "中央缴费获取待支付记录失败");
                return(Json(MyResult.Error("取待支付记录失败")));
            }
        }
Ejemplo n.º 4
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;
                    }
                }
            }
        }
Ejemplo n.º 5
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;
                }
            }
        }
Ejemplo n.º 6
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;
                }
            }
        }
Ejemplo n.º 7
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;
            }
        }
Ejemplo n.º 8
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;
                }
            }
        }
Ejemplo n.º 9
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;
                }
            }
        }
Ejemplo n.º 10
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("缴费失败")));
            }
        }
Ejemplo n.º 11
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("取待支付记录失败")));
            }
        }
Ejemplo n.º 12
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;
                    }
                }
            }
        }
Ejemplo n.º 13
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;
                }
            }
        }
Ejemplo n.º 14
0
        private void RemoveReaptInIorecord(InputAgs args)
        {
            string errorMsg = "";

            ParkIORecordServices.RemoveRepeatInIORecordByPlateNumber(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);
        }
Ejemplo n.º 15
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;
                }
            }
        }
Ejemplo n.º 16
0
        //private string GetCompanyId(string pid, string bid) {
        //    try
        //    {
        //        if (!string.IsNullOrWhiteSpace(pid))
        //        {
        //            BaseCompany company = CompanyServices.QueryByParkingId(pid);
        //            if (company != null)
        //            {
        //                return company.CPID;
        //            }
        //        }
        //        if (!string.IsNullOrWhiteSpace(bid))
        //        {
        //            BaseCompany company = CompanyServices.QueryByBoxID(bid);
        //            if (company != null)
        //            {
        //                return company.CPID;
        //            }
        //        }
        //    }
        //    catch (Exception ex) {
        //        ExceptionsServices.AddExceptionToDbAndTxt("QRCodeParkPayment", "GetCompanyId方法处理异常", ex, LogFrom.WeiXin);

        //    }
        //    return string.Empty;
        //}
        /// <summary>
        /// 计算停车费
        /// </summary>
        /// <param name="pid">车场编号</param>
        /// <param name="licensePlate">车牌号</param>
        /// <param name="bid">岗亭编号</param>
        /// <param name="gid">通道编号</param>
        /// <returns></returns>
        public ActionResult ComputeParkingFee(string pid, string licensePlate, string bid, string gid)
        {
            licensePlate = licensePlate.ToPlateNo();
            TxtLogServices.WriteTxtLogEx("QRCodeParkPayment", "进入ComputeParkingFee,pid:{0}, licensePlate:{1}, bid:{2},gid:{3},opendId:{4}", pid, licensePlate, bid, gid, WeiXinOpenId);
            bool IsShowPlateNumber = true;

            try
            {
                OnlineOrder model = new OnlineOrder();
                model.OrderTime = DateTime.Now;

                TempParkingFeeResult result = null;
                bool bClient = false;
                if (!string.IsNullOrWhiteSpace(gid))
                {
                    //result = RechargeService.WXScanCodeTempParkingFeeByGateID(pid, gid, string.Empty, GetOrderSource());
                    result = ParkingFeeService.GetParkingFeeByGateID(pid, gid);
                    if (result == null)
                    {
                        TxtLogServices.WriteTxtLogEx("QRCodeParkPayment", "GetParkingFeeByGateID Result:null");
                    }
                    else
                    {
                        bClient = true;
                        TxtLogServices.WriteTxtLogEx("QRCodeParkPayment", "GetParkingFeeByGateID Result:{0}", (int)result.Result);
                    }
                    if (result == null)
                    {
                        result = RechargeService.WXScanCodeTempParkingFeeByParkGateID(pid, gid, string.Empty, GetOrderSource());
                    }
                    TxtLogServices.WriteTxtLogEx("QRCodeParkPayment", "Result:{0}", (int)result.Result);
                    if (result == null || result.Result == APPResult.NoNeedPay || result.Result == APPResult.RepeatPay)
                    {
                        int type = result.Result == APPResult.NoNeedPay ? 0 : 1;
                        return(RedirectToAction("NotNeedPayment", "QRCodeParkPayment", new { licensePlate = result.PlateNumber, type = type, surplusMinutes = result.OutTime, entranceTime = result.EntranceDate, backUrl = "/QRCode/Index" }));
                    }
                    if (result.Result == APPResult.NoLp)
                    {
                        return(RedirectToAction("Index", "ScanCodeInOut", new { pid = pid, io = gid, source = 1 }));
                    }
                }
                else if (!string.IsNullOrWhiteSpace(bid))
                {
                    result = ParkingFeeService.GetParkingFeeByBoxID(bid);

                    if (result == null)
                    {
                        TxtLogServices.WriteTxtLogEx("QRCodeParkPayment", "GetParkingFeeByBoxID Result:null");
                        result = RechargeService.WXScanCodeTempParkingFee(bid, string.Empty);
                    }
                    else
                    {
                        bClient = true;
                        TxtLogServices.WriteTxtLogEx("QRCodeParkPayment", "GetParkingFeeByBoxID Result:{0}", (int)result.Result);
                    }
                    if (result == null || result.Result == APPResult.NoNeedPay || result.Result == APPResult.RepeatPay)
                    {
                        int type = result.Result == APPResult.NoNeedPay ? 0 : 1;
                        return(RedirectToAction("NotNeedPayment", "QRCodeParkPayment", new { licensePlate = result.PlateNumber, type = type, surplusMinutes = result.OutTime, entranceTime = result.EntranceDate, backUrl = "/QRCode/Index" }));
                    }
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(licensePlate))
                    {
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取车牌信息失败" }));
                    }
                    result = ParkingFeeService.GetParkingFeeByParkingID(pid, licensePlate);

                    if (result == null)
                    {
                        result = RechargeService.WXTempParkingFee(licensePlate, pid, string.Empty, model.OrderTime);
                    }
                    else
                    {
                        bClient = true;
                    }
                    if (result == null || result.Result == APPResult.NoNeedPay || result.Result == APPResult.RepeatPay)
                    {
                        int type = result.Result == APPResult.NoNeedPay ? 0 : 1;
                        return(RedirectToAction("NotNeedPayment", "QRCodeParkPayment", new { licensePlate = licensePlate, type = type, surplusMinutes = result.OutTime, entranceTime = result.EntranceDate }));
                    }
                }

                if (!bClient)
                {
                    RechargeService.CheckCalculatingTempCost(result.Result, result.ErrorDesc);
                    if (result.OrderSource == PayOrderSource.Platform)
                    {
                        bool testResult = CarService.WXTestClientProxyConnectionByPKID(result.ParkingID);
                        if (!testResult)
                        {
                            throw new MyException("车场网络异常,暂无法缴停车费!");
                        }
                        //int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(result.Pkorder.OrderNo);
                        int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(result.Pkorder.OrderNo, result.ParkingID, result.Pkorder.TagID);
                        TxtLogServices.WriteTxtLogEx("QRCodeParkPayment", "ComputeParkingFee,Tag:{0}, OrderNo:{1}, PKID:{2}\r\nResult:{3}", result.Pkorder.TagID, result.Pkorder.OrderNo, result.ParkingID, interfaceOrderState);

                        if (interfaceOrderState != 1)
                        {
                            string msg       = interfaceOrderState == 2 ? "重复支付" : "订单已失效";
                            string companyId = GetCompanyId(pid, bid, gid);
                            return(RedirectToAction("Index", "ErrorPrompt", new { message = msg, returnUrl = "/QRCode/Index?companyId=" + companyId + "" }));
                        }
                    }
                }
                model.OrderSource         = result.OrderSource;
                model.ExternalPKID        = result.ExternalPKID;
                model.ParkCardNo          = result.CardNo;
                model.PKID                = result.ParkingID;
                model.PKName              = result.ParkName;
                model.InOutID             = result.Pkorder.TagID;
                model.TagID               = result.Pkorder.TagID;
                model.PlateNo             = result.PlateNumber;
                model.EntranceTime        = result.EntranceDate;
                model.ExitTime            = model.OrderTime.AddMinutes(result.OutTime);
                model.Amount              = result.Pkorder.Amount;
                model.PayDetailID         = result.Pkorder.OrderNo;
                model.DiscountAmount      = result.Pkorder.DiscountAmount;
                ViewBag.Result            = result.Result;
                ViewBag.PayAmount         = result.Pkorder.PayAmount;
                ViewBag.IsShowPlateNumber = IsShowPlateNumber;

                if (result.ImageUrl.IsEmpty())
                {
                    ParkIORecord record  = ParkIORecordServices.QueryLastExitIORecordByPlateNumber(model.PlateNo);
                    string       htmlurl = "";
                    if (record != null && record.EntranceImage.IsEmpty() == false)
                    {
                        htmlurl = "http://www.yft166.net/Pic/" + record.EntranceImage.Replace('\\', '/');
                    }
                    else
                    {
                        result.ImageUrl = htmlurl;
                    }
                    result.ImageUrl = htmlurl;
                }
                //显示图片的
                ViewBag.url = result.ImageUrl;

                return(View(model));
            }
            catch (MyException ex)
            {
                string companyId = GetCompanyId(pid, bid, gid);
                string parkingId = GetParkingId(pid, bid, gid);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, parkingId = parkingId, returnUrl = "/QRCode/Index?companyId=" + companyId + "" }));
            }
            catch (Exception ex)
            {
                string companyId = GetCompanyId(pid, bid, gid);
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "扫描缴费计算缴费金额失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "计算缴费金额失败", returnUrl = "/QRCode/Index?companyId=" + companyId + "" }));
            }
        }
Ejemplo n.º 17
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;
                }
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 计算停车费
        /// </summary>
        /// <returns></returns>
        ///
        public ActionResult ComputeParkingFee(string licensePlate, string parkingId)
        {
            string htmlurl = string.Empty;

            licensePlate = licensePlate.ToPlateNo();
            if (!string.IsNullOrWhiteSpace(licensePlate) && licensePlate.Length > 2)
            {
                string firstPlate = HttpUtility.UrlEncode(licensePlate.Substring(0, 2), Encoding.GetEncoding("UTF-8"));
                Response.Cookies.Add(new HttpCookie("SmartSystem_WeiXinUser_DefaultPlate", firstPlate));
                //licensePlate = "浙B81X83";
                //string errMsg = "";
                ////string aa = string.Empty;
                ////aa=WXotherServices.GETURL(licensePlate).ToString();
                //ParkIORecord record =  ParkIORecordServices.GetNoExitIORecordByPlateNumber(parkingId, licensePlate, out errMsg);

                //if (record != null && record.EntranceImage.IsEmpty() == false)
                //{
                //    htmlurl = "http://www.yft166.net/Pic/" + record.EntranceImage;
                //}
                //else {
                //    htmlurl = "/Content/mobile/images/images.png";
                //}
                //
                //ViewBag.meas = parkingId;
            }


            bool IsShowPlateNumber = true;

            try
            {
                OnlineOrder model = new OnlineOrder();
                model.OrderTime = DateTime.Now;

                List <WX_CarInfo> myPlates = CarService.GetCarInfoByAccountID(WeiXinUser.AccountID);
                if (myPlates.Count(p => p.PlateNo.ToPlateNo() == licensePlate) == 0)
                {
                    IsShowPlateNumber = false;
                }
                TempParkingFeeResult result = RechargeService.WXTempParkingFee(licensePlate, parkingId, WeiXinUser.AccountID, model.OrderTime);
                if (result.Result == APPResult.NoNeedPay || result.Result == APPResult.RepeatPay)
                {
                    int type = result.Result == APPResult.NoNeedPay ? 0 : 1;
                    return(RedirectToAction("NotNeedPayment", "ParkingPayment", new { licensePlate = licensePlate, type = type, surplusMinutes = result.OutTime, entranceTime = result.EntranceDate }));
                }
                RechargeService.CheckCalculatingTempCost(result.Result);
                if (result.OrderSource == PayOrderSource.Platform)
                {
                    bool testResult = CarService.WXTestClientProxyConnectionByPKID(result.ParkingID);
                    if (!testResult)
                    {
                        throw new MyException("车场网络异常,暂无法缴停车费!");
                    }
                    //int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(result.Pkorder.OrderNo);

                    int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(result.Pkorder.OrderNo, result.ParkingID, result.Pkorder.TagID);
                    if (interfaceOrderState != 1)
                    {
                        string msg = interfaceOrderState == 2 ? "重复支付" : "订单已失效";
                        return(PageAlert("LicensePlatePayment", "ParkingPayment", new { RemindUserContent = msg }));
                    }
                }
                model.ParkCardNo     = result.CardNo;
                model.PKID           = result.ParkingID;
                model.PKName         = result.ParkName;
                model.InOutID        = result.Pkorder.TagID;
                model.TagID          = result.Pkorder.TagID;
                model.PlateNo        = result.PlateNumber;
                model.EntranceTime   = result.EntranceDate;
                model.ExitTime       = model.OrderTime.AddMinutes(result.OutTime);
                model.Amount         = result.Pkorder.Amount;
                model.PayDetailID    = result.Pkorder.OrderNo;
                model.DiscountAmount = result.Pkorder.DiscountAmount;
                model.OrderSource    = result.OrderSource;
                model.ExternalPKID   = result.ExternalPKID;

                ParkIORecord record = ParkIORecordServices.QueryLastExitIORecordByPlateNumber(licensePlate);

                if (record != null && record.EntranceImage.IsEmpty() == false)
                {
                    htmlurl = "http://www.yft166.net/Pic/" + record.EntranceImage.Replace('\\', '/');
                }
                else
                {
                    htmlurl = "/Content/mobile/images/images.png";
                }

                ViewBag.url = htmlurl;

                ViewBag.Result            = result.Result;
                ViewBag.PayAmount         = result.Pkorder.PayAmount;
                ViewBag.IsShowPlateNumber = IsShowPlateNumber;
                return(View(model));
            }
            catch (MyException ex)
            {
                return(PageAlert("LicensePlatePayment", "ParkingPayment", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "计算缴费金额失败", ex, LogFrom.WeiXin);
                return(PageAlert("LicensePlatePayment", "ParkingPayment", new { RemindUserContent = "计算缴费金额失败" }));
            }
        }
Ejemplo n.º 19
0
        protected override void ProcessRule(InputAgs args, ResultAgs rst)
        {
            rst.InOutBaseCardType = args.CarTypeInfo.BaseTypeID;
            string errorMsg = "";

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