private void GridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { CardEventReport info = this.GridView.Rows[e.RowIndex].Tag as CardEventReport; if (info != null) { if (info.EventStatus == CardEventStatus.CarPlateFail) { if (frmEventDetail == null) { frmEventDetail = new FrmCardEventDetail(); frmEventDetail.CardEventProcessed += new Ralid.Park.UI.EventArgument.CardEventProcessedHandler(frm_CardEventProcessed); } frmEventDetail.ProcessingEvent = info; frmEventDetail.Show(); frmEventDetail.Activate(); } else if (info.EventStatus == CardEventStatus.Valid) { if (frmCarPlateFailDetail == null) { frmCarPlateFailDetail = new FrmCarPlateFailDetail(); frmCarPlateFailDetail.CardEventProcessed += new Ralid.Park.UI.EventArgument.CardEventProcessedHandler(frm_CardEventProcessed); } frmCarPlateFailDetail.ProcessingEvent = info; frmCarPlateFailDetail.Show(); frmCarPlateFailDetail.Activate(); } } } }
public void ProcessReport(ReportBase report) { try { if (report is CardEventReport) { CardEventReport r = report as CardEventReport; ReportHandle(r); } else if (report is ParkVacantReport) { ParkVacantReport r = report as ParkVacantReport; ReportHandle(r); } else if (report is CarSenseReport) { CarSenseReport r = report as CarSenseReport; //车到、车走时清空刷卡事件信息 ReportHandle(r); } else if (report is UpdateSystemParamSettingReport) { UpdateSystemParamSettingReport r = report as UpdateSystemParamSettingReport; ReportHandle(r); } } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); } }
private void AddCardEventReportToGridView(CardEventReport report) { DataGridViewRow row = null; foreach (DataGridViewRow r in GridView.Rows) { CardEventReport preEvent = r.Tag as CardEventReport; if (preEvent != null && preEvent.EntranceID == report.EntranceID && preEvent.ParkID == report.ParkID) { row = r; break; } } if (row != null) { GridView.Rows.Remove(row); } GridView.Rows.Insert(0, 1); row = GridView.Rows[0]; row.Tag = report; DataGridViewCellStyle style = new DataGridViewCellStyle(); style.ForeColor = Color.Red; row.DefaultCellStyle = style; row.Cells["colCardID"].Value = report.CardID; row.Cells["colCardType"].Value = report.CardType.ToString(); row.Cells["colEventDateTime"].Value = report.EventDateTime; row.Cells["colEntranceName"].Value = ParkBuffer.Current.GetEntrance(report.EntranceID).EntranceName; row.Cells["colAccounts"].Value = report.CardPaymentInfo != null ? report.CardPaymentInfo.Accounts : 0; row.Cells["colLastCarPlate"].Value = report.LastCarPlate; row.Cells["colCarPlate"].Value = report.CarPlate; }
private void pad_CardEventReporting(object sender, ReportBase report) { try { if (report is CardEventReport) { CardEventReport cer = report as CardEventReport; if (cer.EventStatus == CardEventStatus.Valid) { lock (_Locker) { if (_SendingEvents.Count >= 1000) { _SendingEvents.Clear(); } _SendingEvents.Push(cer); _AutoResetEvent.Set(); } } } } catch { } }
public Packet CreatePrepayCardExitWaitPacket(byte address, CardEventReport report) { //卡等待/有效/无效指令+参数长度(采用可变长度)+1字节语音参数+1字节开闸模式(总为0)+1字节卡类型+2字节卡编号+ //6字节临时卡入场秒分时日月年+6字节临时卡出场秒分时日月年+1字节费额小数点位数+2字节收费金额+ //+1字节显示车型+1字节语音车型+4字节卡片余额 //5+6+6+1+2+1+1+4=26字节 Packet p = new Packet(); p.Address = address; p.Order = OrderCode.Comm_CardWait; if ((report.ParkingStatus & ParkingStatus.AsTempCard) == ParkingStatus.AsTempCard) { p.AddByte((byte)CardValidVoice.Voice_NoEnoughBalanceTempOut); } else { p.AddByte((byte)CardValidVoice.Voice_PrepayOut); } p.AddByte((byte)0); p.AddByte((byte)CardType.PrePayCard); p.AddShort((short)1000); p.AddDateTime(report.LastDateTime.Value); p.AddDateTime(report.EventDateTime); p.AddByte(TariffSetting.Current.TariffOption.PointCount); p.AddShort((short)TariffSetting.Current.TariffOption.FromYuan(report.CardPaymentInfo.Accounts)); p.AddByte((byte)((byte)report.CarType + 1)); //车型为0-3 对应的车型语音为1-4 p.AddByte((byte)((byte)report.CarType + 1)); p.AddInt(TariffSetting.Current.TariffOption.FromYuan(report.Balance)); return(p); }
private void ShowFrmCarPlateFailDetail(CardEventReport info) { this.txtCardID.Text = info.CardID; this.lblEnterCarPlate.Text = info.LastCarPlate; this.lblExitCarPlate.Text = info.CarPlate; if (info.LastDateTime != null) { this.lblEnterDateTime.Text = info.LastDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } this.lblExitDateTime.Text = info.EventDateTime.ToString("yyyy-MM-dd HH:mm:ss"); SnapShotBll ssbll = new SnapShotBll(AppSettings.CurrentSetting.ParkConnect); this.picIn.Clear(); if (info.LastDateTime != null) { List <SnapShot> imgs = ssbll.GetSnapShots(info.LastDateTime.Value, info.CardID); if (imgs != null && imgs.Count > 0) { this.picIn.ShowSnapShots(imgs); } } this.picOut.Clear(); if (info.EventDateTime != null) { List <SnapShot> outImgs = ssbll.GetSnapShots(info.EventDateTime, info.CardID); if (outImgs != null && outImgs.Count > 0) { this.picOut.ShowSnapShots(outImgs); } } ucVideoes.ShowVideoes(ParkBuffer.Current.GetEntrance(info.EntranceID).VideoSources); }
/// <summary> /// 发送月卡出场等待指令 /// </summary> /// <param name="cardEvent"></param> private void MonthCardExitWait(CardEventReport cardEvent) { Packet p = _PacketCreater.CreateMonthCardExitWaitPacket(Address, cardEvent); _CommComponent.SendPacket(p); DisplayMsg("免收费放行", false); }
/// <summary> /// 处理卡片进出记录,即根据卡片进出记录确定各区域车位数,如果事件被处理则返回真 /// </summary> /// <param name="records"></param> public bool ProcessCardEvent(CardEventReport record) { if (_Areas != null && _Areas.Length > 0 && this.MotorEntrances != null) { OutDoorLedArea ar; if (this.MotorEntrances.Contains(record.EntranceID)) //如果是从电车通道进出 { ar = _Areas.SingleOrDefault(area => area.CarType == 1 && area.CardType == (byte)(record.CardType)); } else { ar = _Areas.SingleOrDefault(area => area.CarType == 0 && area.CardType == (byte)(record.CardType)); } if (ar != null) { if (record.IsExitEvent && ar.Vacant < ar.CarPort) { ar.Vacant += 1; } if (!record.IsExitEvent && ar.Vacant > 0) { ar.Vacant -= 1; } LastUpdate = DateTime.Now; return(true); } } return(false); }
private void ShowCardEventDetail(CardEventReport info) { CardInfo card = (new CardBll(AppSettings.CurrentSetting.ParkConnect)).GetCardByID(info.CardID).QueryObject; if (card != null) { this.txtCardID.Text = card.CardID; this.lblOwnerName.Text = card.OwnerName; this.lblCarNum.Text = card.CarPlate; this.lblValidDate.Text = card.ValidDate.ToString("yyyy-MM-dd"); } if (info.LastDateTime != null) { this.lblEnterDateTime.Text = info.LastDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } this.lblExitDateTime.Text = info.EventDateTime.ToString("yyyy-MM-dd HH:mm:ss"); this.lblParkingTime.Text = (info.CardPaymentInfo != null) ? info.CardPaymentInfo.TimeInterval : string.Empty; this.lblCardType.Text = info.CardType.ToString(); this.lblTariffType.Text = info.CardPaymentInfo != null?Ralid.Park.BusinessModel.Resouce.TariffTypeDescription.GetDescription(info.CardPaymentInfo.TariffType) : string.Empty; this.lblChargingMoneyPlan.Text = (info.CardPaymentInfo != null ? info.CardPaymentInfo.Accounts : 0).ToString(); this.lblBalance.Text = info.Balance.ToString(); this.txtChargedMoney.DecimalValue = info.CardPaymentInfo != null ? info.CardPaymentInfo.Accounts : 0; this.picIn.Clear(); if (info.LastDateTime != null) { List <SnapShot> imgs = (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).GetSnapShots(info.LastDateTime.Value, info.CardID); if (imgs != null && imgs.Count > 0) { this.picIn.ShowSnapShots(imgs); } } ucVideoes.ShowVideoes(ParkBuffer.Current.GetEntrance(info.EntranceID).VideoSources); }
/// <summary> /// 保存卡片以及嵌套车场进出事件 /// </summary> /// <param name="card"></param> /// <param name="report"></param> /// <returns></returns> public CommandResult SaveCardAndNestedEvent(CardInfo card, CardEventReport report) { //内嵌车场事件只改变卡片的停车状态 IUnitWork unitWork = ProviderFactory.Create <IUnitWork>(_RepoUri); CardInfo info = card.Clone(); //卡片状态保持用数据库中的状态 info.ParkingStatus = report.ParkingStatus; if (!report.IsExitEvent) { info.LastNestParkDateTime = report.EventDateTime; //如果是入场事件,则更新卡片的最后进入内车场时间 } _Provider.Update(info, card, unitWork); ICardEventProvider icp = ProviderFactory.Create <ICardEventProvider>(_RepoUri); if (report.IsExitEvent) //如果是入内车场,则不记录最后刷卡时间,如果是出内车场,则保存上次时间 { report.LastDateTime = card.LastNestParkDateTime; } else { report.LastDateTime = null; } icp.Insert((new CardEventRecord(report)), unitWork); CommandResult ret = unitWork.Commit(); if (ret.Result == ResultCode.Successful) //如果成功,则改变卡片状态 { //卡片状态保持用数据库中的状态 card.ParkingStatus = report.ParkingStatus; } return(ret); }
private void ReportHandle(CardEventReport report) { try { //更新到相关控制器的屏上 List <VehicleLedItem> items = _VehicleLedSetting.GetLEDsFromEntranceID(WorkStationInfo.CurrentStation.StationID, report.EntranceID); if (items != null && items.Count > 0) { foreach (VehicleLedItem item in items) { if (VehicleLedItemDisplay(item.ParkID, item.EntranceID, item.ComPort, item.ShowTitle, item.SubAddress1, item.SubTitle1, item.SubInterval1, item.SubMessage1, report)) { //发送后等待一定时间 //Thread.Sleep(_SendInterval); } if (VehicleLedItemDisplay(item.ParkID, item.EntranceID, item.ComPort, item.ShowTitle, item.SubAddress2, item.SubTitle2, item.SubInterval2, item.SubMessage2, report)) { //发送后等待一定时间 //Thread.Sleep(_SendInterval); } if (VehicleLedItemDisplay(item.ParkID, item.EntranceID, item.ComPort, item.ShowTitle, item.SubAddress3, item.SubTitle3, item.SubInterval3, item.SubMessage3, report)) { } } } } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); } }
public void ProcessReport(ReportBase report) { Action <ReportBase> action = delegate(ReportBase report1) { EntranceInfo entrance = ParkBuffer.Current.GetEntrance(report1.EntranceID); if (entrance != null && WorkStationInfo.CurrentStation.EntranceList.Exists(e => e == entrance.EntranceID))//是否是工作站要处理的事件 { if (report1 is CardEventReport) { CardEventReport eventInfo = report1 as CardEventReport; ProcessCardEvent(eventInfo); } if (!(report1 is ParkVacantReport) && !(report1 is EntranceRemainTempCardReport) && !(report1 is EntranceStatusReport)) { eventList.InsertReport(report1); } } }; if (this.InvokeRequired) { this.Invoke(action, report); } else { action(report); } }
private void ShowCardPaymentDetail(CardEventReport info) { this.lblCardID.Text = info.CardID; this.lblOwnerName.Text = info.OwnerName; this.lblExitDateTime.Text = info.EventDateTime.ToString("yyyy-MM-dd HH:mm:ss"); this.lblChargingMoneyPlan.Text = info.Accounts.ToString(); this.lblCardType.Text = info.CardType.ToString(); this.lblChargeMoney.Text = info.Paid.ToString(); if (info.LastDateTime != null) { this.lblEnterDateTime.Text = info.LastDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); this.lblParkingTime.Text = info.ParkInterval; Image imgIn = SnapShotBll.GetFirstSnapShot(info.LastDateTime.Value); if (imgIn != null) { this.picIn.Image = imgIn; } } Image imgOut = SnapShotBll.GetFirstSnapShot(info.EventDateTime); if (imgOut != null) { this.picOut.Image = imgOut; } }
///// <summary> ///// 更新室内停车场累计停车时间 ///// </summary> ///// <param name="dateTime">出场时间</param> //public bool UpdateIndoorTimeInterval(DateTime dateTime) //{ // if (IndoorInDateTime.HasValue && dateTime > IndoorInDateTime.Value) // { // if (IsIndoorPaid)//已缴费,只计算多出的停车时间 // { // if (dateTime > PaidDateTime.Value) // { // TimeSpan ts = new TimeSpan(dateTime.Ticks - PaidDateTime.Value.Ticks); // IndoorTimeInterval += (int)ts.TotalMinutes; // } // } // else//未缴费 // { // TimeSpan ts = new TimeSpan(dateTime.Ticks - IndoorInDateTime.Value.Ticks); // IndoorTimeInterval += (int)ts.TotalMinutes; // } // return true; // } // return false; //} ///// <summary> ///// 获取外车场实际的计费时间,缴费时间-内车场累计停车时间长 ///// </summary> ///// <param name="chargeDateTime"></param> ///// <returns></returns> //public DateTime GetOuterParkChargeDateTime(DateTime chargeDateTime) //{ // return chargeDateTime.AddMinutes(0 - IndoorTimeInterval); //} /// <summary> /// 通过刷卡事件设置卡片的相关信息 /// </summary> /// <param name="report"></param> public void SetEventReportData(CardEventReport report) { if (report != null) { ParkingStatus = report.ParkingStatus;//使用事件的状态 //如果启用了酒店应用,保留免费时间点,否则清空免费时间点 FreeDateTime = report.EnableHotelApp ? report.FreeDateTime : null; } }
private CardInfo _cardInfo;//当前读到的卡片,用于写卡模式 //private string _VideoPath = Application.StartupPath + @"\FrmCardPaying_OpenedVideoes.xml"; #endregion #region 私有方法 private void ShowCardEventInfo(CardEventReport info) { this._EnterVideoes.Visible = false; this.picIn.Clear(); this.picIn.Visible = true; if (info.IsExitEvent) { List <SnapShot> imgs = (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).GetSnapShots(info.LastDateTime.Value, info.CardID); if (imgs != null && imgs.Count > 0) { this.picIn.ShowSnapShots(imgs); } } try { //视频控件容易出问题,这里做一个异常处理 ucVideoes.ShowVideoes(ParkBuffer.Current.GetEntrance(info.EntranceID).VideoSources); } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); } if (info.ChargeAsTempCard) { this.btnCash.Enabled = true; this.btnCardOk.Enabled = UserSetting.Current.OneKeyOpenDoor ? true : false; this.btnYCT.Enabled = (_YCTReader != null) ? true : false; this.btnInvalidEvent.Enabled = true; if (UserSetting.Current.OneKeyOpenDoor) { this.btnCardOk.Focus(); } else { this.btnCash.Focus(); } } else { this.btnCardOk.Enabled = true; this.btnInvalidEvent.Enabled = true; this.AcceptButton = this.btnCardOk; this.btnCardOk.Focus(); this.btnCash.Enabled = false; this.btnYCT.Enabled = false; } if (info.CardPaymentInfo != null) { ShowCardChargeInfo(info.CardPaymentInfo); } CardReaderManager.GetInstance(UserSetting.Current.WegenType).StopReadCard(); }
private void s_OnPaidFail(object sender, OpenCardEventArgs e) { if (string.IsNullOrEmpty(e.CardID)) { return; } if (e.Entrance != null) { IParkingAdapter pad = ParkingAdapterManager.Instance[e.Entrance.RootParkID]; if (pad != null) { if (!e.LastError.Contains("余额不足")) { pad.LedDisplay(new SetLedDisplayNotify(e.Entrance.EntranceID, CanAddress.TicketBoxLed, string.IsNullOrEmpty(e.LastError) ? "扣款失败" : e.LastError, false, 0)); } else { string temp = AppSettings.CurrentSetting.GetConfigContent("RemoteReader"); int reader = 0; if (!int.TryParse(temp, out reader)) { reader = 0; } var ce = new CardEventReport() { EntranceID = e.Entrance.EntranceID, CardID = e.Payment.CardID, CardType = e.Payment.CardType, Reader = (EntranceReader)reader, }; var notify = new EventInvalidNotify() { CardEvent = ce, Balance = e.Balance, OperatorNum = OperatorInfo.CurrentOperator.OperatorNum, InvalidType = EventInvalidType.INV_Balance }; pad.EventInvalid(notify); if (!string.IsNullOrEmpty(e.CardType)) //只有开放卡片才显示余额 { WaitCallback wc = (WaitCallback)((object state) => { System.Threading.Thread.Sleep(AppSettings.CurrentSetting.GetShowBalanceInterval() * 1000); pad.LedDisplay(new SetLedDisplayNotify(e.Entrance.EntranceID, CanAddress.TicketBoxLed, string.Format("车费{0}元 余额{1}元", e.Payment.GetPaying(), e.Balance), false, 0)); }); ThreadPool.QueueUserWorkItem(wc); } } } } if (this.OnPaidFail != null) { this.OnPaidFail(sender, e); } }
public void InsertReport(ReportBase report) { Color color = Color.Empty; if (report is CardEventReport) { CardEventReport ce = report as CardEventReport; color = ce.ComparisonResult == CarPlateComparisonResult.Fail ? Color.Red : Color.Empty; } InsertMessage(report.Description, color); }
public Packet CreateMonthCardExitWaitPacket(byte address, CardEventReport cardEvent) { //卡等待/有效/无效指令+参数长度(采用可变长度)+1字节语音显示参数+1字节内屏显示模式参数(总为0)+1字节卡类型+2字节卡编号+3字节月卡有效期日月年 Packet p = new Packet(); p.Order = OrderCode.Comm_CardWait; p.Address = address; p.AddByte(CardValidVoice.Voice_NormalOut); p.AddByte((byte)0); p.AddByte((byte)CardType.MonthRentCard); p.AddShort((short)1000); return(p); }
public void ProcessReport(ReportBase report) { if (AppSettings.CurrentSetting.VehicleLedCOMPort > 0) { if (report is CardEventReport) { EntranceInfo entrance = ParkBuffer.Current.GetEntrance(report.EntranceID); if (entrance != null && WorkStationInfo.CurrentStation.EntranceList.Exists(e => e == entrance.EntranceID)) { CardEventReport r = report as CardEventReport; ReportRender(r); } } } }
private void ClearCardEvent() { ClearCardChargeInfo(); this.picIn.Clear(); this.picIn.Visible = false; this._EnterVideoes.Visible = true; this.btnCardOk.Enabled = false; this.btnInvalidEvent.Enabled = false; this.btnCash.Enabled = false; this.btnYCT.Enabled = false; this.btnInvalidEvent.Enabled = false; this.AcceptButton = null; _processingEvent = null; _cardInfo = null; CardReaderManager.GetInstance(UserSetting.Current.WegenType).BeginReadCard(); }
private void frm_CardEventProcessed(object sender, Ralid.Park.UI.EventArgument.CardEventProcessedArgs e) { DataGridViewRow row = null; foreach (DataGridViewRow r in GridView.Rows) { CardEventReport preEvent = r.Tag as CardEventReport; if (preEvent.EntranceID == e.ProcessedEvent.EntranceID && preEvent.ParkID == e.ProcessedEvent.ParkID) { row = r; break; } } if (row != null) { GridView.Rows.Remove(row); } }
private void Send_Thread() { while (_AutoResetEvent.WaitOne(int.MaxValue)) { CardEventReport report = Pop(); while (report != null) { Message msg = new Message(report); SendMessage(msg); if (MainForm != null) { MainForm.WriteLine(msg.ToString()); } report = Pop(); } _AutoResetEvent.Reset(); } }
private void RemoveCardEventReportFromGridView(CardEventReport report) { DataGridViewRow row = null; foreach (DataGridViewRow r in GridView.Rows) { CardEventReport preEvent = r.Tag as CardEventReport; if (preEvent.EntranceID == report.EntranceID && preEvent.ParkID == report.ParkID) { row = r; break; } } if (row != null) { GridView.Rows.Remove(row); } }
private void ChargeType_Selected(object sender, EventArgs e) { if (_processingEvent != null && CarTypeSetting.Current[carTypePanel1.SelectedCarType] != null) { int entranceID = _processingEvent.EntranceID; int parkID = _processingEvent.ParkID; //专门针对长隆停车场设置一种“转会员卡"车型,选择“转会员卡"车型时必须重新刷一张会员卡才能时行这个操作,并在收费说明中写入“转会员卡+会员卡号" //这个功能采用硬编码 if (CarTypeSetting.Current[carTypePanel1.SelectedCarType].Description == _ToVipCard) { FrmVipCardReader frm = new FrmVipCardReader(); if (frm.ShowDialog() == DialogResult.OK) { string cardid = frm.VipCardID; CardInfo card = (new CardBll(AppSettings.CurrentSetting.ParkConnect)).GetCardByID(cardid).QueryObject; if (card != null && card.CardType.Name == _VipCard) { _TempCardID = _processingEvent.CardID; _VipCardID = cardid; } else { MessageBox.Show("卡号为 {0} 的卡不存在或者不是会员卡,请刷会员卡", Resource1.Form_Alert); return; } } else { return; } } //end 转会员卡功能 //选择车型后,表明当前的收费明细就是没有用的了,要不然用户不会重新选择车型,这也避免了用户在选择车型后立即按了收费按钮,此时由于选择车型的操作 //是异步的,所以会先处理收费事件,保存收费信息,但新车型的事件上来后用户又会选择一次收费,所以导致偶尔会有同一事件有两条收费记录的情况。 _processingEvent = null; CarTypeSwitchNotify notify = new CarTypeSwitchNotify(entranceID, carTypePanel1.SelectedCarType); if (ParkingAdapterManager.Instance[parkID] != null) { ParkingAdapterManager.Instance[parkID].SwitchCarType(notify); } } }
public CardEventRecord(CardEventReport cardReport) { this.CardID = cardReport.CardID; this.EventDateTime = cardReport.EventDateTime; this.EntranceID = cardReport.EntranceID; this.ParkID = cardReport.ParkID; this.OwnerName = cardReport.OwnerName; this.CardCertificate = cardReport.CardCertificate; this.CardType = cardReport.CardType; this.CarType = cardReport.CarType; this.CarPlate = cardReport.CarPlate; this.EntranceName = cardReport.SourceName; this.IsExitEvent = cardReport.IsExitEvent; this.EventType = cardReport.EventType; this.LastDateTime = cardReport.LastDateTime; this.ParkingStatus = cardReport.ParkingStatus; this.OperatorID = cardReport.OperatorID; this.StationID = cardReport.StationID; }
public void ProcessReport(ReportBase r) { ParkInfo park = ParkBuffer.Current.GetPark(r.ParkID); foreach (DataGridViewRow row in this.dataGridView1.Rows) { CarPlateDevice device = row.Tag as CarPlateDevice; if (device.EntranceID == r.EntranceID) { if (r is CardEventReport) { CardEventReport cardEvent = r as CardEventReport; if (cardEvent.EventStatus == CardEventStatus.Valid && !string.IsNullOrEmpty(device.SnapPath)) { EntranceInfo entrace = ParkBuffer.Current.GetEntrance(r.EntranceID); int videoSourceID = -1; if (entrace != null) { VideoSourceInfo videoSource = entrace.VideoSources.FirstOrDefault(item => item.MediaSource == device.IP && item.Channel == device.VideoID); if (videoSource != null) { videoSourceID = videoSource.VideoID; } } if (videoSourceID == -1) { videoSourceID = r.EntranceID * 1000 + device.VideoID; //没有找到视频ID的,手动生成一个,通道id*1000+视频路数 } SnapShot shot = new SnapShot(cardEvent.EventDateTime, videoSourceID, cardEvent.CardID, device.SnapPath); string master = AppSettings.CurrentSetting.CurrentMasterConnect; string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; CommandResult result = (new SnapShotBll(master)).Insert(shot); if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) { (new SnapShotBll(standby)).Insert(shot); } //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } } } } }
public void CarPlateComparisonTest() { CardEventReport report = new CardEventReport(); report.LastCarPlate = "粤A12345"; report.CarPlate = "粤A12345"; for (int i = 0; i < 8; i++) { Assert.IsTrue(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, i)); } report.CarPlate = "粤B12345"; Assert.IsFalse(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, 0)); for (int i = 1; i < 2; i++) { Assert.IsTrue(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, i)); } report.CarPlate = "粤B22345"; Assert.IsFalse(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, 0)); Assert.IsFalse(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, 1)); for (int i = 2; i < 8; i++) { Assert.IsTrue(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, i)); } report.CarPlate = "粤B1234"; Assert.IsFalse(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, 0)); Assert.IsFalse(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, 1)); report.CarPlate = string.Empty; for (int i = 0; i < 8; i++) { Assert.IsFalse(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, i)); } report.LastCarPlate = null; for (int i = 0; i < 8; i++) { Assert.IsFalse(CarPlateComparer.CarPlateComparison(report.CarPlate, report.LastCarPlate, i)); } }
private void s_OnError(object sender, OpenCardEventArgs e) { if (e.Entrance != null) { IParkingAdapter pad = ParkingAdapterManager.Instance[e.Entrance.RootParkID]; if (pad != null) { if (e.LastError.Contains("黑名单")) { string temp = AppSettings.CurrentSetting.GetConfigContent("RemoteReader"); int reader = 0; if (!int.TryParse(temp, out reader)) { reader = 0; } var f**k = new CardEventReport() { EntranceID = e.Entrance.EntranceID, CardID = e.CardID, CardType = CustomCardTypeSetting.Current.GetCardType(e.CardType), Reader = (EntranceReader)reader, }; var notify = new EventInvalidNotify() { CardEvent = f**k, Balance = e.Balance, OperatorNum = OperatorInfo.CurrentOperator.OperatorNum, InvalidType = EventInvalidType.INV_Invalid, }; pad.EventInvalid(notify); } else { pad.LedDisplay(new SetLedDisplayNotify(e.Entrance.EntranceID, CanAddress.TicketBoxLed, e.LastError, false, 0)); } } } if (this.OnError != null) { this.OnError(this, e); } }
public void HandleCardEvent(CardEventReport report) { GlobalSettings.Current.Get <Dictionary <int, CardEventReport> >()[report.EntranceID] = report; // if (report.EventStatus != CardEventStatus.Valid) { return; } if (report.CardType != null && (report.CardType.Name == YiTingShanFuSetting.CardType || report.CardType.Name == YCT.YCTSetting.CardTyte || report.CardType.Name == ETC.ETCSetting.CardTyte)) // { if (report.IsExitEvent) //出场后,将开放卡片从系统中删除 { CardBll bll = new CardBll(AppSettings.CurrentSetting.MasterParkConnect); CardInfo card = bll.GetCardByID(report.CardID).QueryObject; if (card != null && (card.ParkingStatus & ParkingStatus.Out) == ParkingStatus.Out) //只有在卡片已经出场的情况下才删除它 { bll.DeleteCardAtAll(card); } } } }
public Packet CreateTempCardExitWaitPacket(byte address, CardEventReport report) { //卡等待/有效/无效指令+参数长度(采用可变长度)+1字节语音参数+1字节开闸模式(总为0)+1字节卡类型+2字节卡编号+ //6字节临时卡入场秒分时日月年+6字节临时卡出场秒分时日月年+1字节费额小数点位数+2字节收费金额+1字节显示车型+1字节语音车型 Packet p = new Packet(); p.Address = address; p.Order = OrderCode.Comm_CardWait; p.AddByte((byte)CardValidVoice.Voice_TempCardOut); p.AddByte((byte)0); p.AddByte((byte)CardType.TempCard); p.AddShort((short)1000); p.AddDateTime(report.LastDateTime.Value); p.AddDateTime(report.EventDateTime); p.AddByte(TariffSetting.Current.TariffOption.PointCount); p.AddShort((short)TariffSetting.Current.TariffOption.FromYuan(report.CardPaymentInfo.Accounts)); p.AddByte(GetVoice(report.CarType)); //车型为0-3 对应的车型语音为1-4 p.AddByte(GetVoice(report.CarType)); return(p); }