Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
        private void reader_PaymentFail(object sender, ZSTReaderEventArgs e)
        {
            ZSTHandlerInfo zst = _HandlerInfoes.SingleOrDefault(item => item.ReaderIP == e.ReaderIP);

            if (zst != null && zst.ProcessingEvent != null)
            {
                _Reader.MessageConfirm(zst.ReaderIP); //发送中山通读卡确认消息
                IParkingAdapter pad = ParkingAdapterManager.Instance[zst.ProcessingEvent.ParkID];
                if (pad != null)
                {
                    EventInvalidNotify n = new EventInvalidNotify()
                    {
                        InvalidType = EventInvalidType.INV_ReadCard,
                        Balance     = zst.Balance,
                        CardEvent   = zst.ProcessingEvent
                    };
                    pad.EventInvalid(n);
                }

                zst.ClearCardInfo();  //清空读卡器内的卡片信息
            }
        }
Esempio n. 4
0
 public bool EventInvalid(EventInvalidNotify notify)
 {
     try
     {
         if (_Channel != null)
         {
             return(_Channel.EventInvalid(notify));
         }
     }
     catch (CommunicationException)
     {
         if (ParkAdapterConnectFail != null)
         {
             ParkAdapterConnectFail(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
     return(false);
 }
Esempio n. 5
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();                  //清空读卡器内的卡片信息
                    }
                }
            }
        }