Exemplo n.º 1
0
        /// <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 <NewSegmentTollModel>(_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, 9, GetTollFeesTemplateStr());
            parktollmoney = parktollmoney / 100;
            return(parktollmoney);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 获取出场超时时长
 /// </summary>
 /// <returns></returns>
 public int GetLeaveTimeOut(BillingTemplateModel _model)
 {
     try
     {
         model = m_serializer.Deserialize <NewSegmentTollModel>(_model.TemplateJson);
         return(model.LeaveTimeout);
     }
     catch
     {
         return(0);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 获取收费模板字符串
        /// </summary>
        /// <returns></returns>
        public string GetTollFeesTemplateStr(BillingTemplateModel _model = null)
        {
            string strtoll = string.Empty;

            if (_model != null)
            {
                model = m_serializer.Deserialize <NewSegmentTollModel>(_model.TemplateJson);
            }
            if (model != null)
            {
                try
                {
                    string time1 = model.BeginTime.Split(':')[0].PadLeft(2, '0');
                    string time2 = model.BeginTime.Split(':')[1].PadLeft(2, '0');
                    string time3 = model.EndTime.Split(':')[0].PadLeft(2, '0');
                    string time4 = model.EndTime.Split(':')[1].PadLeft(2, '0');
                    strtoll = model.FreeMinutes.ToString("X").PadLeft(2, '0') + time1 + time2 + time3 + time4 + model.DayTimeSt1.ToString("X").PadLeft(2, '0') +
                              model.DayTimeFt1.ToString("X").PadLeft(2, '0') +
                              Convert.ToInt32(model.DayTimeFee1).ToString("X").PadLeft(2, '0') +
                              model.DayTimeSt2.ToString("X").PadLeft(2, '0') +
                              model.DayTimeFt2.ToString("X").PadLeft(2, '0') +
                              Convert.ToInt32(model.DayTimeFee2).ToString("X").PadLeft(2, '0') +
                              //model.DayTimeSt3.ToString("X").PadLeft(2, '0') +
                              model.DayTimeFt3.ToString("X").PadLeft(2, '0') +
                              Convert.ToInt32(model.DayTimeFee3).ToString("X").PadLeft(2, '0') +
                              Convert.ToInt32(model.DayTimeMaxAmount).ToString("X").PadLeft(4, '0')
                              + model.NightTimeSt1.ToString("X").PadLeft(2, '0') +
                              model.NightTimeFt1.ToString("X").PadLeft(2, '0') +
                              Convert.ToInt32(model.NightTimeFee1).ToString("X").PadLeft(2, '0') +
                              model.NightTimeSt2.ToString("X").PadLeft(2, '0') +
                              model.NightTimeFt2.ToString("X").PadLeft(2, '0') +
                              Convert.ToInt32(model.NightTimeFee2).ToString("X").PadLeft(2, '0') +
                              //model.NightTimeSt3.ToString("X").PadLeft(2, '0') +
                              model.NightTimeFt3.ToString("X").PadLeft(2, '0') +
                              Convert.ToInt32(model.NightTimeFee3).ToString("X").PadLeft(2, '0') +
                              Convert.ToInt32(model.NightTimeMaxAmount).ToString("X").PadLeft(4, '0') +
                              model.Timeout.ToString().PadLeft(2, '0') +
                              Convert.ToInt32(model.DayTopLimit).ToString("X").PadLeft(4, '0');
                    string bin = "000" + model.CrossSegmentsType + model.CrossSegmentsFreeType +
                                 model.FreeTreatType + model.FreeTreatTypeIsEnable + model.NoSegmentedIsEnable;
                    strtoll += string.Format("{0:x}", Convert.ToInt32(bin, 2)).PadLeft(2, '0');
                    bin      = model.MonetaryUnit == 1 ? "00000000" : "00000001";
                    strtoll += string.Format("{0:x}", Convert.ToInt32(bin, 2)).PadLeft(2, '0');
                    strtoll += "0000";
                }
                catch
                {
                }
            }
            return(strtoll);
        }
Exemplo n.º 4
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);
        }