/// <summary> /// 获取收费模板字符串 /// </summary> /// <returns></returns> public string GetTollFeesTemplateStr(BillingTemplateModel _model = null) { string strtoll = string.Empty; if (_model != null) { model = m_serializer.Deserialize <SegmentHourlyTollModel>(_model.TemplateJson); } if (model != null) { strtoll = model.FreeMinutes.ToString("X").PadLeft(2, '0') + model.DayBeginTime.ToString("HHmm") + model.DayEndTime.ToString("HHmm") + model.DayFirstHour.ToString().PadLeft(2, '0') + model.DayPerHour.ToString().PadLeft(2, '0') + Convert.ToInt32(model.DayFirstMoney).ToString("X").PadLeft(2, '0') + Convert.ToInt32(model.DayNextMoney).ToString("X").PadLeft(2, '0') + model.NightFirstHour.ToString().PadLeft(2, '0') + model.NightPerHour.ToString().PadLeft(2, '0') + Convert.ToInt32(model.NightFirstMoney).ToString("X").PadLeft(2, '0') + Convert.ToInt32(model.NightNextMoney).ToString("X").PadLeft(2, '0') + model.Timeout.ToString().PadLeft(2, '0') + Convert.ToInt32(model.MaxDayMoney).ToString("X").PadLeft(4, '0') ; strtoll += (model.SpanProcessing == 1 ? "01" : "02"); strtoll += (model.MonetaryUnit == 1 ? "00" : "01") + "00".PadLeft(28, '0'); } return(strtoll); }
/// <summary> /// 计算费用 -1:计算失败 /// </summary> /// <param name="beginTime">计费起始时间</param> /// <param name="endTime">计费截止时间</param> /// <param name="hasFreeMinute">是否有免费分钟</param> /// <returns></returns> public decimal GetFees(BillingTemplateModel _model, DateTime beginTime, DateTime endTime, bool hasFreeMinute) { model = m_serializer.Deserialize <SegmentHourlyTollModel>(_model.TemplateJson); decimal parktollmoney = -1; parktollmoney = Park_CalParkingFee(beginTime.ToString("yyyy-MM-dd HH:mm:ss"), endTime.ToString("yyyy-MM-dd HH:mm:ss"), !hasFreeMinute ? 1 : 0, 6, GetTollFeesTemplateStr()); parktollmoney = parktollmoney / 100; return(parktollmoney); }
/// <summary> /// 获取出场超时时长 /// </summary> /// <returns></returns> public int GetLeaveTimeOut(BillingTemplateModel _model) { try { model = m_serializer.Deserialize <SegmentHourlyTollModel>(_model.TemplateJson); return(model.LeaveTimeout); } catch { return(0); } }
/// <summary> /// 获取计费模板 /// 具体计费方式的基础模型(包含免费时长、超时出场时长) /// </summary> /// <param name="carTypeGuid"></param> /// <returns></returns> public BillingTemplateChargeModel GetBillingTemplateChargeModel(string carTypeGuid) { BillingTemplateModel model = GetBillingTemplate(carTypeGuid); if (model == null) { return(null); } BillingTemplateChargeModel chargeModel = new BillingTemplateChargeModel(); chargeModel.CarTypeGuid = carTypeGuid; switch (model.ChargeMode) { case 1: HourlyTollModel hourlyModel = m_serializer.Deserialize <HourlyTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = hourlyModel.FreeMinutes; chargeModel.LeaveTimeout1 = hourlyModel.LeaveTimeout; chargeModel.BeginTime1 = "00:00"; chargeModel.EndTime1 = "00:00"; break; case 2: SegmentTollModel segmentModel = m_serializer.Deserialize <SegmentTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = segmentModel.FreeMinute1; chargeModel.FreeMinutes2 = segmentModel.FreeMinute2; chargeModel.FreeMinutes3 = segmentModel.FreeMinute3; chargeModel.LeaveTimeout1 = segmentModel.LeaveTimeout; chargeModel.LeaveTimeout2 = segmentModel.LeaveTimeout; chargeModel.LeaveTimeout3 = segmentModel.LeaveTimeout; chargeModel.BeginTime1 = segmentModel.BeginTime1.ToShortTimeString(); chargeModel.BeginTime2 = segmentModel.BeginTime2.ToShortTimeString(); chargeModel.BeginTime3 = segmentModel.BeginTime3.ToShortTimeString(); chargeModel.EndTime1 = segmentModel.EndTime1.ToShortTimeString(); chargeModel.EndTime2 = segmentModel.EndTime2.ToShortTimeString(); chargeModel.EndTime3 = segmentModel.EndTime3.ToShortTimeString(); break; case 3: ShenZhengTollModel shezhenModel = m_serializer.Deserialize <ShenZhengTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = shezhenModel.FreeMinutes; chargeModel.LeaveTimeout1 = shezhenModel.LeaveTimeout; chargeModel.BeginTime1 = "00:00"; chargeModel.EndTime1 = "00:00"; break; case 4: HalfHourTollModel halfHourModel = m_serializer.Deserialize <HalfHourTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = halfHourModel.DayFreeMinutes; chargeModel.LeaveTimeout1 = halfHourModel.LeaveTimeout; chargeModel.BeginTime1 = halfHourModel.DayBeginTime.ToShortTimeString(); chargeModel.EndTime1 = halfHourModel.DayEndTime.ToShortTimeString(); chargeModel.FreeMinutes2 = halfHourModel.NightFreeMinutes; chargeModel.LeaveTimeout2 = halfHourModel.LeaveTimeout; chargeModel.BeginTime2 = halfHourModel.DayEndTime.ToShortTimeString(); chargeModel.EndTime2 = halfHourModel.DayBeginTime.ToShortTimeString(); break; case 5: SimpleSegmentTollModel simpleSegmentModel = m_serializer.Deserialize <SimpleSegmentTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = simpleSegmentModel.FreeMinutes; chargeModel.LeaveTimeout1 = simpleSegmentModel.LeaveTimeout; chargeModel.BeginTime1 = "00:00"; chargeModel.EndTime1 = "00:00"; break; case 6: SegmentHourlyTollModel sementHourlyModel = m_serializer.Deserialize <SegmentHourlyTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = sementHourlyModel.FreeMinutes; chargeModel.LeaveTimeout1 = sementHourlyModel.LeaveTimeout; chargeModel.BeginTime1 = "00:00"; chargeModel.EndTime1 = "00:00"; break; case 7: SegmentNoneHalfHourTollModel segmentNoneHalfHourModel = m_serializer.Deserialize <SegmentNoneHalfHourTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = segmentNoneHalfHourModel.FreeMinutes; chargeModel.LeaveTimeout1 = segmentNoneHalfHourModel.LeaveTimeout; chargeModel.BeginTime1 = "00:00"; chargeModel.EndTime1 = "00:00"; break; case 8: SegmentHalfHourTollModel segmentHalfHourModel = m_serializer.Deserialize <SegmentHalfHourTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = segmentHalfHourModel.FreeMinutes; chargeModel.LeaveTimeout1 = segmentHalfHourModel.LeaveTimeout; chargeModel.BeginTime1 = "00:00"; chargeModel.EndTime1 = "00:00"; break; case 9: NewSegmentTollModel newSegmentModel = m_serializer.Deserialize <NewSegmentTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = newSegmentModel.FreeMinutes; chargeModel.LeaveTimeout1 = newSegmentModel.LeaveTimeout; chargeModel.BeginTime1 = "00:00"; chargeModel.EndTime1 = "00:00"; break; case 10: SegmentQuarterHourTollModel segmentQuarterHourModel = m_serializer.Deserialize <SegmentQuarterHourTollModel>(model.TemplateJson); chargeModel.FreeMinutes1 = segmentQuarterHourModel.DayFreeMinutes; chargeModel.LeaveTimeout1 = segmentQuarterHourModel.LeaveTimeout; chargeModel.BeginTime1 = segmentQuarterHourModel.DayBeginTime.ToShortTimeString(); chargeModel.EndTime1 = segmentQuarterHourModel.DayEndTime.ToShortTimeString(); chargeModel.FreeMinutes2 = segmentQuarterHourModel.NightFreeMinutes; chargeModel.LeaveTimeout2 = segmentQuarterHourModel.LeaveTimeout; chargeModel.BeginTime2 = segmentQuarterHourModel.DayEndTime.ToShortTimeString(); chargeModel.EndTime2 = segmentQuarterHourModel.DayBeginTime.ToShortTimeString(); break; } return(chargeModel); }