public void ProcessReport(BusinessModel.Report.ReportBase report) { EntranceInfo entrance = ParkBuffer.Current.GetEntrance(report.EntranceID); if (entrance == null) { return; } if (entrance.IsExitDevice) //处理出口 { if (report is CardEventReport) { CardEventReport cer = report as CardEventReport; if (cer.EventStatus == CardEventStatus.Pending) { ZSTHandlerInfo zst = GetZSTHandlerInstance(cer.EntranceID); if (zst != null && !string.IsNullOrEmpty(zst.CardID) && zst.CardID == cer.CardID) { if (zst.Balance >= cer.CardPaymentInfo.Accounts) { zst.ProcessingEvent = cer; _Reader.Consumption(zst.ReaderIP, cer.CardPaymentInfo.Accounts); //余额足够的话就直接扣款 IParkingAdapter pad = ParkingAdapterManager.Instance[cer.ParkID]; if (pad != null) { SetLedDisplayNotify notify = new SetLedDisplayNotify(entrance.ParkID, CanAddress.TicketBoxLed, string.Format("扣款{0}元", cer.CardPaymentInfo.Accounts), false, 0); pad.LedDisplay(notify); } } else { _Reader.MessageConfirm(zst.ReaderIP); //发送中山通读卡确认消息 zst.ClearCardInfo(); //清空读卡器内的卡片信息 IParkingAdapter pad = ParkingAdapterManager.Instance[cer.ParkID]; if (pad != null) { EventInvalidNotify n = new EventInvalidNotify() { InvalidType = EventInvalidType.INV_Balance, Balance = zst.Balance, CardEvent = cer }; pad.EventInvalid(n); } } } } else { ZSTHandlerInfo zst = GetZSTHandlerInstance(cer.EntranceID); if (zst != null && !string.IsNullOrEmpty(zst.CardID) && zst.CardID == cer.CardID) { _Reader.MessageConfirm(zst.ReaderIP); //发送中山通读卡确认消息 zst.ClearCardInfo(); //清空读卡器内的卡片信息 } } } else if (report is CardInvalidEventReport) { CardInvalidEventReport cier = report as CardInvalidEventReport; ZSTHandlerInfo zst = GetZSTHandlerInstance(report.EntranceID); if (zst != null && !string.IsNullOrEmpty(zst.CardID) && zst.CardID == cier.CardID) { _Reader.MessageConfirm(zst.ReaderIP); //发送中山通读卡确认消息 zst.ClearCardInfo(); //清空读卡器内的卡片信息 } } } }
private void reader_CardReadHandler(object sender, ZSTReaderEventArgs e) { if (Setting == null) { _Reader.MessageConfirm(e.ReaderIP); return; } ZSTItem item = Setting.GetReader(e.ReaderIP); if (item == null) { _Reader.MessageConfirm(e.ReaderIP); return; } EntranceInfo entrance = null; entrance = ParkBuffer.Current.GetEntrance(item.EntranceID); OpenCardEventArgs args = new OpenCardEventArgs() { CardID = e.CardID, CardType = ZSTSettings.CardType, Balance = e.Balance, Entrance = entrance, }; if (entrance != null && !entrance.IsExitDevice) //入场时产生读卡事件 { _Reader.MessageConfirm(e.ReaderIP); if (this.OnReadCard != null) { this.OnReadCard(this, args); } } else //中央收费和出口产生收费事件 { if (this.OnPaying != null) { this.OnPaying(this, args); //产生收费事件 } if (args.Payment == null) { return; } if (args.Payment.GetPaying() == 0) //不用收费直接返回收款成功事件 { args.Payment.PaymentCode = Ralid.Park.BusinessModel.Enum.PaymentCode.Computer; args.Payment.PaymentMode = Ralid.Park.BusinessModel.Enum.PaymentMode.ZhongShanTong; if (this.OnPaidOk != null) { this.OnPaidOk(this, args); } } else { lock (_WaitingPayingCardsLocker) { _WaitingPayingCards[e.CardID] = args; //保存某个读卡器目前正在处理的收费记录 } _Reader.Consumption(e.ReaderIP, args.Payment.GetPaying()); //直接扣款 } } }