/// <summary> /// 不同颜色临时车对应车类数据实体初始化 /// </summary> /// <param name="carColor">车颜色类别 1:蓝牌车 2:黄牌车 3:白牌车 4:绿牌车 5:黑牌车</param> /// <param name="carTypeGuid">车类guid</param> /// <returns></returns> private TempCarTypeModel TempCarTypeDataInit(int carColor, string carTypeGuid) { //根据车类id查到对应的计费模板 BillingTemplateChargeModel billingTemplateModel = GetBillingTemplateChargeModel(carTypeGuid); TempCarTypeModel model = new TempCarTypeModel(); model.CarColor = carColor; model.CarTypeGuid = carTypeGuid; if (billingTemplateModel == null) { return(model); } model.BeginTime1 = billingTemplateModel.BeginTime1; model.BeginTime2 = billingTemplateModel.BeginTime2; model.BeginTime3 = billingTemplateModel.BeginTime3; model.EndTime1 = billingTemplateModel.EndTime1; model.EndTime2 = billingTemplateModel.EndTime2; model.EndTime3 = billingTemplateModel.EndTime3; model.FreeMinutes1 = billingTemplateModel.FreeMinutes1; model.FreeMinutes2 = billingTemplateModel.FreeMinutes2; model.FreeMinutes3 = billingTemplateModel.FreeMinutes3; model.LeaveTimeout1 = billingTemplateModel.LeaveTimeout1; model.LeaveTimeout2 = billingTemplateModel.LeaveTimeout2; model.LeaveTimeout2 = billingTemplateModel.LeaveTimeout3; return(model); }
/// <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); }