private void UpdateDevicePaymentRecord_Thread() { while (true) { try { if (DataBaseConnectionsManager.Current.MasterConnected) { List <EntranceBase> entrances = new List <EntranceBase>(); entrances.AddRange(_Entrances); foreach (ParkBase park in _SubParks) { entrances.AddRange(park.Entrances); } foreach (NetEntrance entrance in entrances) { int capacity = 0; int latestIndex = 0; int beginIndex = entrance.EntranceInfo.PaymentEventIndex + 1; if (entrance.GetPaymentStorageInfo(out capacity, out latestIndex)) { int count = latestIndex - beginIndex + 1; count = count < 0 ? count + 0xFFFFFF : count; if (count > 0) { List <DevicePaymentRecord> deviceRecords = entrance.GetPaymentRecords(beginIndex, count); List <CardPaymentInfo> records = GetCardPaymentRecordsFromDeviceRecords(deviceRecords, entrance.EntranceName); if (records != null) { CardPaymentRecordBll crb = new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect); bool success = true; foreach (CardPaymentInfo record in records) { success = crb.InsertRecordWithCheck(record).Result == ResultCode.Successful ? success : false; if (success) { entrance.EntranceInfo.PaymentEventIndex++; } } if (entrance.EntranceInfo.PaymentEventIndex > 0xFFFFFF)//流水号最大3个字节0xFFFFFF { entrance.EntranceInfo.PaymentEventIndex -= 0xFFFFFF; } EntranceBll ebll = new EntranceBll(AppSettings.CurrentSetting.ParkConnect); ebll.Update(entrance.EntranceInfo); } } } } } } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); } //每30分钟,获取一次 Thread.Sleep(30 * 60 * 1000); } }
public void Init() { EntranceBll bll = new EntranceBll(Ralid.Park.BusinessModel.Configuration.AppSettings.CurrentSetting.ParkConnect); List <EntranceInfo> items = bll.GetAllEntraces().QueryObjects; SetDataSource(items); this.DropDownStyle = ComboBoxStyle.DropDownList; }
public void Init() { ParkBll parkbll = new ParkBll(AppSettings.CurrentSetting.ParkConnect); parkList = parkbll.GetAllParks().QueryObjects; EntranceBll entranceBll = new EntranceBll(AppSettings.CurrentSetting.ParkConnect); entrances = entranceBll.GetAllEntraces().QueryObjects; this.comPark.Init(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { EntranceBll bll = new EntranceBll(); Cname = Request["cname"]; Ename = Request["ename"]; news = Request["news"]; type1 = Request["type1"]; if (Cname != "" && Ename != "" && news != "" && type1 != "") { Entrance model = new Entrance(); model.Cname = Cname; model.Ename = Ename; model.News = news; model.Type = type1; DataTable dt = bll.ShowEnter(); foreach (DataRow item in dt.Rows) { if (item["Cname"].ToString() == Cname) { Response.Write("<script>alert('中文名不能重复!!!');</script>"); Cname = ""; return; } if (item["Ename"].ToString() == Cname) { Response.Write("<script>alert('英文名不能重复!!!');</script>"); Ename = ""; return; } if (item["news"].ToString() == news) { Response.Write("<script>alert('内容不能重复!!!');</script>"); news = ""; return; } } int result = bll.AddEnter(model); if (result > 0) { Response.Write("<script>alert('添加成功!')window.location.href='EnterList.aspx'</script>"); } } else { Response.Write("<script>alert('名字或内容不能为空!!!');</script>"); } } }
public void Init() { ParkBll parkbll = new ParkBll(AppSettings.CurrentSetting.ParkConnect); parkList = parkbll.GetAllParks().QueryObjects; EntranceBll entranceBll = new EntranceBll(AppSettings.CurrentSetting.ParkConnect); entrances = entranceBll.GetAllEntraces().QueryObjects; if (OnlyExit) { entrances = (from e in entrances where e.IsExitDevice select e).ToList(); } this.comPark.Init(); this.comEntrance.DropDownStyle = ComboBoxStyle.DropDownList; }
private bool SyncEntrances() { NotifyMsg(string.Format("{0}{1}......", Resources.Resource1.FrmSyncDataToStandby_Synchronizing, Resources.Resource1.FrmSyncDataToStandby_Entrance)); NotifyProgress(100, 0); bool success = true; CommandResult result = null; EntranceBll masterbll = new EntranceBll(AppSettings.CurrentSetting.CurrentMasterConnect); EntranceBll standbybll = new EntranceBll(AppSettings.CurrentSetting.CurrentStandbyConnect); QueryResultList <EntranceInfo> infos = masterbll.GetAllEntraces(); success = infos.Result == ResultCode.Successful; if (success) { success = standbybll.DeleteAllEntrances().Result == ResultCode.Successful; if (success) { NotifyProgress(infos.QueryObjects.Count, 0); foreach (EntranceInfo info in infos.QueryObjects) { result = standbybll.InsertWithPrimaryKey(info); success = result.Result == ResultCode.Successful; NotifyProgress(null, null); if (!success) { break; } } } } if (!success) { NotifyMsg(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_Entrance, Resources.Resource1.Form_Fail), Color.Red); } else { NotifyMsg(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_Entrance, Resources.Resource1.Form_Success)); } return(success); }
protected void Page_Load(object sender, EventArgs e) { EntranceBll bll1 = new EntranceBll(); NavBLL bll2 = new NavBLL(); NoticeBll bll3 = new NoticeBll(); if (!IsPostBack) { //加载导航信息 DataTable dt2 = bll2.NavQuery(); StringBuilder str3 = new StringBuilder(); StringBuilder str4 = new StringBuilder(); if (dt2.Rows.Count > 0) { str3.Append("<li class='active'><a href='" + dt2.Rows[0]["url"].ToString() + "'>" + dt2.Rows[0]["name"] + "</a></li>"); str4.Append("<li><a href='" + dt2.Rows[0]["url"].ToString() + "'>" + dt2.Rows[0]["name"] + "</a>|</li>"); for (int i = 1; i < dt2.Rows.Count; i++) { str3.Append("<li><a href='" + dt2.Rows[i]["url"].ToString() + "'>" + dt2.Rows[i]["name"] + "</a></li>"); str4.Append("<li><a href='" + dt2.Rows[i]["url"].ToString() + "'>" + dt2.Rows[i]["name"] + "</a>|</li>"); } nav1.InnerHtml = str3.ToString(); nav2.InnerHtml = str4.ToString(); } //加载图标信息 DataTable dt1 = bll1.ShowEnter(); StringBuilder str1 = new StringBuilder(); StringBuilder str2 = new StringBuilder(); for (var i = 0; i < dt1.Rows.Count; i++) { string type = dt1.Rows[i]["Type"].ToString(); if (type == "1") { str1.Append("<div class='col-md-4'><div class='modal-content clearfix'><a href='Labrary_introduce.aspx?Id=" + dt1.Rows[i]["Id"] + "'><span class='icon icon0" + (i + 1) + "'></span><h3>" + dt1.Rows[i]["Cname"].ToString() + "<small>" + dt1.Rows[i]["Ename"].ToString() + "</small></h3><p> " + dt1.Rows[i]["News"].ToString() + "</p></a></div></div>"); enter1.InnerHtml = str1.ToString(); } else if (type == "2") { str2.Append("<div class='col-xs-12 col-md-4 clearfix'><a href='Labrary_introduce.aspx?Id=" + dt1.Rows[i]["Id"] + "' class='img-circle text-center'><img src='img/icon08.png' width='37' height='62'></a><h3><a href='Labrary_introduce.aspx?Id=" + dt1.Rows[i]["Id"] + "'>" + dt1.Rows[i]["Cname"] + "<small>" + dt1.Rows[i]["Ename"] + "</small></a></h3><p>" + dt1.Rows[i]["News"] + "</p><a href='Labrary_introduce.aspx?Id=" + dt1.Rows[i]["Id"] + "' class='btn btn-more'>MORE</a></div>"); enter2.InnerHtml = str2.ToString(); } } //加载通知信息 DataTable dt3 = bll3.showNotice(); StringBuilder str5 = new StringBuilder(); if (dt3.Rows.Count > 0) { for (int i = dt3.Rows.Count - 1; i > dt3.Rows.Count - 11; i--) { str5.Append("<li><a href='#'>" + dt3.Rows[i]["Title"].ToString() + "</a></li>"); inform.InnerHtml = str5.ToString(); } } else { inform.InnerHtml = "暂无通知数据!"; } } }
/// <summary> /// 读取到卡号处理 /// </summary> /// <param name="cardID">卡号</param> /// <param name="info">从卡片扇区数据中读取到的卡片信息</param> private void ReadCardIDHandler(string cardID, CardInfo info) { this.txtCardID.Text = cardID; this.txtCardID.ReadOnly = true; string msg = string.Empty; CardInfo card = info; if (card == null) { msg = Resource1.FrmCardCenterCharge_CardDataErr; } else if (!ValidateCard(card, out msg)) { //卡片无效 } else if (TariffSetting.Current.GetTariff(card.CardType.ID, card.CarType) == null) { msg = Resource1.FrmCardCenterCharge_NotPaymentCard; } else if (!card.IsInPark) { msg = CardInvalidDescripition.GetDescription(EventInvalidType.INV_StillOut); } else if (card.LastDateTime > DateTime.Now) { msg = CardInvalidDescripition.GetDescription(EventInvalidType.INV_WrongInTime); } else { _cardInfo = card; EntranceBll eBll = new EntranceBll(AppSettings.CurrentSetting.ParkConnect); EntranceInfo eInfo = eBll.GetEntranceInfo(_cardInfo.LastEntrance).QueryObject; int parkID = 0; if (eInfo != null) { parkID = eInfo.ParkID; } this.parkCombobox1.SelectedParkID = parkID; this.label1.Visible = true; this.parkCombobox1.Visible = true; //_ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(_cardInfo, TariffSetting.Current, _cardInfo.CarType, DateTime.Now); _ChargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(this.parkCombobox1.SelectedParkID, _cardInfo, TariffSetting.Current, _cardInfo.CarType, DateTime.Now); _ChargeRecord.CarPlate = _cardInfo.CarPlate; ShowCardPaymentInfo(_ChargeRecord); } if (!string.IsNullOrEmpty(msg)) { if (_ChargeLed != null) { _ChargeLed.DisplayMsg(msg); } if (AppSettings.CurrentSetting.EnableTTS) { TTSSpeech.Instance.Speek(msg); } ClearInput(); this.txtCardID.Text = cardID; this.txtMemo.Text = msg; this.eventList.InsertMessage(msg); } }
private void UpdateDevicePaymentRecord_Thread() { try { //开始前先等待10分钟,用于等待硬件设备连接状态检测完成 Thread.Sleep(10 * 60 * 1000); Ralid.GeneralLibrary.LOG.FileLog.Log("UpdateDevicePaymentRecord", "开始UpdateDevicePaymentRecord服务"); while (true) { try { if (DataBaseConnectionsManager.Current.MasterConnected) { List <EntranceBase> entrances = new List <EntranceBase>(); entrances.AddRange(_Entrances); foreach (ParkBase park in _SubParks) { entrances.AddRange(park.Entrances); } Ralid.GeneralLibrary.LOG.FileLog.Log("UpdateDevicePaymentRecord", string.Format("控制器数量: {0} ", entrances.Count)); foreach (NetEntrance entrance in entrances) { int capacity = 0; int latestIndex = 0; int currentIndex = entrance.EntranceInfo.PaymentEventIndex; int beginIndex = entrance.EntranceInfo.PaymentEventIndex + 1; string logDesc = string.Format("【{0}】 当前索引:{1} ", entrance.EntranceName, currentIndex); if (entrance.GetPaymentStorageInfo(out capacity, out latestIndex)) { logDesc += string.Format(" 容量:{0} 最后索引:{1} ", capacity, latestIndex); int count = latestIndex - beginIndex + 1; count = count < 0 ? count + 0xFFFFFF : count; if (count > 0) { List <DevicePaymentRecord> deviceRecords = entrance.GetPaymentRecords(beginIndex, count); List <CardPaymentInfo> records = GetCardPaymentRecordsFromDeviceRecords(deviceRecords, entrance.EntranceName); if (records != null) { logDesc += string.Format(" 获取到记录:{0} ", records.Count); CardPaymentRecordBll crb = new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect); bool success = true; foreach (CardPaymentInfo record in records) { success = crb.InsertRecordWithCheck(record).Result == ResultCode.Successful ? success : false; if (success) { currentIndex += 1; } } if (currentIndex > 0xFFFFFF)//流水号最大3个字节0xFFFFFF { currentIndex -= 0xFFFFFF; } if (currentIndex != entrance.EntranceInfo.PaymentEventIndex) { entrance.EntranceInfo.PaymentEventIndex = currentIndex; EntranceBll ebll = new EntranceBll(AppSettings.CurrentSetting.ParkConnect); ebll.Update(entrance.EntranceInfo); } } } } else { logDesc += string.Format(" 获取容量信息失败 "); } Ralid.GeneralLibrary.LOG.FileLog.Log("UpdateDevicePaymentRecord", logDesc); } } } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); } //每30分钟,获取一次 Thread.Sleep(30 * 60 * 1000); } } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); Ralid.GeneralLibrary.LOG.FileLog.Log("UpdateDevicePaymentRecord", "UpdateDevicePaymentRecord服务异常终止"); } }
/// <summary> /// 停车收费接口 /// </summary> /// <param name="cardID">卡号</param> /// <param name="chargeDateTime">计费时间(格式:yyyy-MM-dd HH:mm:ss.fff)</param> /// <param name="paid">实付金额</param> /// <param name="payMode">支付方式[0代表现金,1代表微信,…]</param> /// <param name="memo">费用说明</param> /// <param name="reserve1">预留1</param> /// <param name="reserve2">预留2</param> /// <returns>Result 0:成功,其他:失败</returns> public CommandResult CardFeePay(string cardID, string chargeDateTime, string paid, string payMode, string memo, string reserve1, string reserve2) { try { #region 先验证输入参数 if (string.IsNullOrEmpty(cardID.Trim())) { return(new CommandResult(ResultCode.ParameterError, "参数卡号错误")); } DateTime chargeTime = new DateTime(2011, 1, 1); if (!DateTime.TryParse(chargeDateTime, out chargeTime)) { return(new CommandResult(ResultCode.ParameterError, "参数计费时间错误")); } if (chargeTime > DateTime.Now) { return(new CommandResult(ResultCode.ParameterError, "计费时间大于系统当前时间")); } decimal paidD = 0; if (!decimal.TryParse(paid, out paidD)) { return(new CommandResult(ResultCode.ParameterError, "参数实付金额错误")); } int payModeI = 0; if (!int.TryParse(payMode, out payModeI)) { return(new CommandResult(ResultCode.ParameterError, "参数支付方式错误")); } #endregion #region 接口日志记录 if (AppConifg.Current.Log) { try { string log = string.Format("卡号:{0} 计费时间:{1} 实付金额:{2} 支付方式:{3} 费用说明:{4} 预留1:{5} 预留2:{6}" , cardID , chargeDateTime , paid , payMode , memo , reserve1 , reserve2); Ralid.GeneralLibrary.LOG.FileLog.Log(AppConifg.Current.LogPath, "CardFeePay", log); } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); } } #endregion #region 验证卡片信息 //查找该卡号的卡片 CardBll cardBll = new CardBll(AppConifg.Current.ParkingConnection); QueryResult <CardInfo> cResult = cardBll.GetCardByID(cardID); if (cResult.Result != ResultCode.Successful) { return(new CommandResult(cResult.Result, "获取卡片信息失败")); } CardInfo card = cResult.QueryObject; if (card == null) { return(new CommandResult(ResultCode.NoRecord, "此卡未登记")); } if (!card.IsInPark) { return(new CommandResult(ResultCode.Fail, "此卡已出场")); } string msg = string.Empty; if (!ValidateCard(card, out msg)) { return(new CommandResult(ResultCode.Fail, msg)); } if (card.LastDateTime > chargeTime) { return(new CommandResult(ResultCode.ParameterError, "入场时间晚于计费时间")); } //获取卡片所在停车场信息 EntranceBll entranceBll = new EntranceBll(AppConifg.Current.ParkingConnection); EntranceInfo entrance = entranceBll.GetEntranceInfo(card.LastEntrance).QueryObject; if (entrance == null) { return(new CommandResult(ResultCode.NoRecord, "没有找到入场通道信息")); } ParkBll parkBll = new ParkBll(AppConifg.Current.ParkingConnection); ParkInfo park = parkBll.GetParkInfoByID(entrance.ParkID).QueryObject; if (park == null) { return(new CommandResult(ResultCode.NoRecord, "没有找到停车场信息")); } //判断卡片合法性 if (card.IsCardList && park.IsWriteCardMode && !card.OnlineHandleWhenOfflineMode) { //写卡模式时,脱机处理的卡片名单不能缴费 return(new CommandResult(ResultCode.Fail, "该卡片为写卡处理卡片,不能进行在线收费")); } #endregion #region 获取费率和节假日 SysParaSettingsBll ssb = new SysParaSettingsBll(AppConifg.Current.ParkingConnection); TariffSetting tariff = ssb.GetSetting <TariffSetting>(); if (tariff == null) { return(new CommandResult(ResultCode.Fail, "获取费率失败")); } TariffSetting.Current = tariff; HolidaySetting holiday = ssb.GetSetting <HolidaySetting>(); if (holiday == null) { return(new CommandResult(ResultCode.Fail, "获取节假日失败")); } HolidaySetting.Current = holiday; #endregion #region 判断是否已缴过费 if (card.IsCompletedPaid && tariff.IsInFreeTime(card.PaidDateTime.Value, chargeTime)) { //已缴费,并且未过免费时间,不允许缴费 msg = string.Format("已缴费,请在{0}分钟内离场!", tariff.FreeTimeRemaining(card.PaidDateTime.Value, chargeTime)); return(new CommandResult(ResultCode.Fail, msg)); } #endregion //生成卡片缴费记录 CardPaymentInfo chargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(park.ParkID, card, tariff, card.CarType, chargeTime); //将收费信息重新赋值 chargeRecord.Paid = paidD; chargeRecord.Discount = chargeRecord.Accounts - paidD; if (chargeRecord.Discount < 0) { chargeRecord.Discount = 0; } chargeRecord.PaymentCode = PaymentCode.Internet; chargeRecord.PaymentMode = payModeI == 1 ? PaymentMode.WeChat : PaymentMode.Cash; chargeRecord.IsCenterCharge = true; chargeRecord.StationID = string.Empty; chargeRecord.OperatorID = string.Empty; if (!string.IsNullOrEmpty(memo)) { chargeRecord.Memo = memo; } if (chargeRecord.Memo == null) { chargeRecord.Memo = string.Empty; } CommandResult result = cardBll.PayParkFee(chargeRecord); if (result.Result == ResultCode.Successful) { //缴费成功,返回缴费后离场提示信息 msg = string.Format("缴费成功,请在{0}分钟内离场!", tariff.FreeTimeRemaining(chargeTime, DateTime.Now)); } return(result); } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); string msg = string.Format("接口发生异常,异常信息:{0}", ex.Message); return(new CommandResult(ResultCode.InterfaceException, msg)); } }
/// <summary> /// 获取某卡号的停车收费信息接口 /// </summary> /// <param name="cardID">卡号</param> /// <param name="discountHour">优惠时长</param> /// <param name="discountAmount">优惠金额</param> /// <param name="reserve1">预留1</param> /// <param name="reserve2">预留2</param> /// <returns>Result 0:成功,其他:失败;QueryObject:返回收费信息对象</returns> public QueryResult <WSCardPaymentInfo> GetCardPayment(string cardID, string discountHour, string discountAmount, string reserve1, string reserve2) { try { #region 先验证输入参数 if (string.IsNullOrEmpty(cardID.Trim())) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.ParameterError, "参数卡号错误", null)); } int discountHourInt = 0; if (!string.IsNullOrEmpty(discountHour.Trim())) { if (!int.TryParse(discountHour, out discountHourInt)) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.ParameterError, "参数优惠时长错误", null)); } } decimal discountAmountD = 0; if (!string.IsNullOrEmpty(discountAmount.Trim())) { if (!decimal.TryParse(discountAmount, out discountAmountD)) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.ParameterError, "参数优惠金额错误", null)); } } #endregion #region 接口日志记录 if (AppConifg.Current.Log) { try { string log = string.Format("卡号:{0} 优惠时长:{1} 优惠金额:{2} 预留1:{3} 预留2:{4}" , cardID , discountHour , discountAmount , reserve1 , reserve2); Ralid.GeneralLibrary.LOG.FileLog.Log(AppConifg.Current.LogPath, "GetCardPayment", log); } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); } } #endregion #region 验证卡片信息 //查找该卡号的卡片 CardBll cardBll = new CardBll(AppConifg.Current.ParkingConnection); QueryResult <CardInfo> cResult = cardBll.GetCardByID(cardID); if (cResult.Result != ResultCode.Successful) { return(new QueryResult <WSCardPaymentInfo>(cResult.Result, "获取卡片信息失败", null)); } CardInfo card = cResult.QueryObject; if (card == null) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.NoRecord, "此卡未登记", null)); } if (!card.IsInPark) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.Fail, "此卡已出场", null)); } string msg = string.Empty; if (!ValidateCard(card, out msg)) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.Fail, msg, null)); } DateTime chargeDateTime = DateTime.Now; if (card.LastDateTime > chargeDateTime) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.Fail, "入场时间晚于计费时间", null)); } //获取卡片所在停车场信息 EntranceBll entranceBll = new EntranceBll(AppConifg.Current.ParkingConnection); EntranceInfo entrance = entranceBll.GetEntranceInfo(card.LastEntrance).QueryObject; if (entrance == null) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.NoRecord, "没有找到入场通道信息", null)); } ParkBll parkBll = new ParkBll(AppConifg.Current.ParkingConnection); ParkInfo park = parkBll.GetParkInfoByID(entrance.ParkID).QueryObject; if (park == null) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.NoRecord, "没有找到停车场信息", null)); } //判断卡片合法性 if (card.IsCardList && park.IsWriteCardMode && !card.OnlineHandleWhenOfflineMode) { //写卡模式时,脱机处理的卡片名单不能缴费 return(new QueryResult <WSCardPaymentInfo>(ResultCode.Fail, "该卡片为写卡处理卡片,不能进行在线缴费", null)); } #endregion #region 获取费率和节假日 SysParaSettingsBll ssb = new SysParaSettingsBll(AppConifg.Current.ParkingConnection); TariffSetting tariff = ssb.GetSetting <TariffSetting>(); if (tariff == null) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.Fail, "获取费率失败", null)); } TariffSetting.Current = tariff; HolidaySetting holiday = ssb.GetSetting <HolidaySetting>(); if (holiday == null) { return(new QueryResult <WSCardPaymentInfo>(ResultCode.Fail, "获取节假日失败", null)); } HolidaySetting.Current = holiday; #endregion #region 判断是否已缴过费 if (card.IsCompletedPaid && tariff.IsInFreeTime(card.PaidDateTime.Value, chargeDateTime)) { //已缴费,并且未过免费时间,不允许缴费 msg = string.Format("已缴费,请在{0}分钟内离场!", tariff.FreeTimeRemaining(card.PaidDateTime.Value, chargeDateTime)); return(new QueryResult <WSCardPaymentInfo>(ResultCode.Fail, msg, null)); } #endregion //重设卡片优惠时长 card.DiscountHour += discountHourInt; if (card.DiscountHour > 0xFF) { card.DiscountHour = 0xFF; } //生成卡片缴费记录 CardPaymentInfo chargeRecord = CardPaymentInfoFactory.CreateCardPaymentRecord(park.ParkID, card, tariff, card.CarType, chargeDateTime); //计算优惠后的缴费费用 chargeRecord.Discount += discountAmountD; if (chargeRecord.Discount > chargeRecord.Accounts) { //如果优惠金额比应收费用多,优惠金额为应收费用,这是为了防止实际支付费用为负数的情况出现 chargeRecord.Discount = chargeRecord.Accounts; } WSCardPaymentInfo wsRecord = new WSCardPaymentInfo(); wsRecord.SetWSCardPaymentInfo(chargeRecord); wsRecord.EntranceName = entrance.EntranceName; return(new QueryResult <WSCardPaymentInfo>(ResultCode.Successful, wsRecord)); } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); string msg = string.Format("接口发生异常,异常信息:{0}", ex.Message); return(new QueryResult <WSCardPaymentInfo>(ResultCode.InterfaceException, msg, null)); } }