private void device_OnReadOBUInfo(object sender, ReadOBUInfoEventArgs e) { ETCDevice device = sender as ETCDevice; if (device == null) { return; } EntranceInfo entrance = ParkBuffer.Current.GetEntrance(device.EntranceID); OpenCardEventArgs args = new OpenCardEventArgs() { CardID = e.OBUInfo.CardNo, CardType = ETCSetting.CardTyte, Entrance = entrance, Balance = (decimal)e.OBUInfo.Balance / 100, }; if (entrance != null) { var park = ParkBuffer.Current.GetPark(entrance.ParkID); //开始处理与已经存在的同车牌号的名单的冲突 bruce 2017-3-22 var con = new CardSearchCondition(); con.CarPlateOrLast = e.OBUInfo.CardPlate.Trim(); con.Status = Ralid.Park.BusinessModel.Enum.CardStatus.Enabled; var cards = new CardBll(AppSettings.CurrentSetting.ParkConnect).GetCards(con).QueryObjects; if (cards != null) { cards = cards.Where(it => it.CardID != e.OBUInfo.CardNo).ToList(); //选出卡号不一样的记录 } if (cards != null && cards.Count > 0) { if (cards.Count == 1) //如果系统中只有一个同一车牌号的名单 { var cardinfo = cards.Single(it => it.CardID != e.OBUInfo.CardNo); if ((!park.IsWriteCardMode || cardinfo.OnlineHandleWhenOfflineMode) && cardinfo.IsCardList) //如果是在线车场或卡片按在线处理 { args.CardID = cardinfo.CardID; //用现有名单的卡号去读卡 } else //不能在线处理,提示刷卡 { string err = park.ListMode == Ralid.Park.BusinessModel.Enum.ParkListMode.CarPlate ? "人工处理" : "请读车场卡"; if (this.OnError != null) { this.OnError(this, new OpenCardEventArgs() { Entrance = entrance, LastError = err }); } return; } } else //多个同车牌号的名单,提示刷卡 { string err = park.ListMode == Ralid.Park.BusinessModel.Enum.ParkListMode.CarPlate ? "人工处理" : "请读车场卡"; if (this.OnError != null) { this.OnError(this, new OpenCardEventArgs() { Entrance = entrance, LastError = err }); } return; } } //-------------------------------------------结束卡片冲突处理 bruce 2017-3-22 if (!entrance.IsExitDevice || (park != null && park.IsNested)) //入口或者嵌套车场, { ETCPaymentList pr = null; device.RSUWrite(e.OBUInfo, 0, false, out pr); //这里写卡主要是为了让卡片读卡时产生蜂鸣声 if (this.OnReadCard != null) { this.OnReadCard(this, args); } } else { HandlePayment(device, args, e, null); } } else { HandlePayment(device, args, e, null); } }