Example #1
0
 public void LedDisplay(SetLedDisplayNotify notify)
 {
     try
     {
         if (_Channel != null)
         {
             _Channel.LedDisplay(notify);
         }
     }
     catch (CommunicationException)
     {
         if (ParkAdapterConnectFail != null)
         {
             ParkAdapterConnectFail(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }
Example #2
0
        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();                  //清空读卡器内的卡片信息
                    }
                }
            }
        }