private void OnVehicleInfoReceived(object sender, PathIdEquipVehicleInfoChangedEventArgs args) { if (VehicleInfoReceiveHandler != null) { T_PathIdentifyEquip equip = CurrentEquipList.Where(it => it.Id == args.VehicleInfo.equipId).FirstOrDefault(); if (equip == null) { throw new Exception("汉王驱动在回调车辆通行数据时发生错误:未能找到目标设备,EQUIPID=" + args.VehicleInfo.equipId.ToString()); } VehicleInfoReceiveEventArgs receiveInfo = new VehicleInfoReceiveEventArgs(); receiveInfo.CloseShotPhoto = args.VehicleInfo.imageNear; receiveInfo.Device = equip; receiveInfo.PanoramaPhoto = args.VehicleInfo.imageAll; receiveInfo.ReachTime = args.VehicleInfo.reachTime; receiveInfo.VehicleLength = args.VehicleInfo.vehicleLength; receiveInfo.VehiclePlateBinPhoto = args.VehicleInfo.imageBin; if (VehiclePlateColorDict.NameColorDict.Keys.Contains(args.VehicleInfo.vehicleColor)) { receiveInfo.VehiclePlateColor = args.VehicleInfo.vehicleColor; } receiveInfo.VehiclePlateNo = args.VehicleInfo.vehicleNo; receiveInfo.VehiclePlatePhoto = args.VehicleInfo.imagePlate; receiveInfo.VehicleSpeed = args.VehicleInfo.vehicleSpeed; VehicleInfoReceiveHandler.Invoke(this, receiveInfo); } }
private static void OnVehicleInfoNotify(object sender, VehicleInfoReceiveEventArgs arg) { string path = ImageSavePath + arg.Device.Id.ToString() + DateTime.Now.ToString("yyyyMMdd") + "\\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string nameid = string.Format("{0}{1}", string.IsNullOrEmpty(arg.VehiclePlateNo) ? "无牌" : arg.VehiclePlateNo, arg.ReachTime.ToString("HHmmss")); T_ReceiveData data = new T_ReceiveData(); data.EquipId = arg.Device.Id; #region 保存图片 if (arg.PanoramaPhoto != null && arg.PanoramaPhoto.Length > 0) { string PanoramaPhotoPath = path + nameid + "_All.jpg"; FileIOUtil.SaveFileByByteArray(PanoramaPhotoPath, arg.PanoramaPhoto); data.ImageAllPath = PanoramaPhotoPath; } if (arg.CloseShotPhoto != null && arg.CloseShotPhoto.Length > 0) { string CloseShotPhotoPath = path + nameid + "_Near.jpg"; FileIOUtil.SaveFileByByteArray(CloseShotPhotoPath, arg.CloseShotPhoto); data.ImageNearPath = CloseShotPhotoPath; } if (arg.VehiclePlatePhoto != null && arg.VehiclePlatePhoto.Length > 0) { string VehiclePlatePhotoPath = path + nameid + "_VehiclePlate.jpg"; FileIOUtil.SaveFileByByteArray(VehiclePlatePhotoPath, arg.VehiclePlatePhoto); data.ImagePlateNoPath = VehiclePlatePhotoPath; } if (arg.VehiclePlateBinPhoto != null && arg.VehiclePlateBinPhoto.Length > 0) { string BinVehiclePlatePhotoPath = path + nameid + "_Bin.jpg"; FileIOUtil.SaveFileByByteArray(BinVehiclePlatePhotoPath, arg.VehiclePlateBinPhoto); data.ImageBinPlateNoPath = BinVehiclePlatePhotoPath; } #endregion 保存图片 data.ReachTime = arg.ReachTime; data.VehicleLength = arg.VehicleLength; data.VehicleSpeed = arg.VehicleSpeed; data.VehPlateColor = string.IsNullOrEmpty(arg.VehiclePlateColor) ? "未知" : arg.VehiclePlateColor; data.VehPlateNo = arg.VehiclePlateNo; DAL_ReceiveData.SaveReceiveData(data); arg.DbData = data; if (VehicleInfoReceiveNotifyHandler != null) { VehicleInfoReceiveNotifyHandler.Invoke(sender, arg); } }
private void OnVehicleInfoNotified(object sender, VehicleInfoReceiveEventArgs args) { string format = string.Format("【车辆通过】设备:{0} 接收到数据,车牌:{1} 通过时间:{2}", args.Device.EquipName, args.VehiclePlateNo, args.ReachTime.ToString()); this.Invoke((MethodInvoker)delegate { int rowIndex = DataReceiveLogGrid.Rows.Add(); DataGridViewRow row = DataReceiveLogGrid.Rows[rowIndex]; row.Cells["colId"].Value = args.Device.Id; row.Cells["colImageFullPath"].Value = args.DbData.ImageAllPath; row.Cells["colImageNear"].Value = args.DbData.ImageNearPath; row.Cells["colVehiclePlate"].Value = args.DbData.ImagePlateNoPath; row.Cells["colBinVehiclePlate"].Value = args.DbData.ImageBinPlateNoPath; row.Cells["colEquipName"].Value = args.Device.EquipName; row.Cells["colVehPlateNo"].Value = args.VehiclePlateNo; row.Cells["colVehPlateColor"].Value = args.VehiclePlateColor; row.Cells["colReachTime"].Value = args.ReachTime.ToString(); row.Cells["colVehSpeed"].Value = args.VehicleSpeed; }); }