示例#1
0
 public CoverLayer(DeviceInfoDto deviceInfoDto, IParkBoxOptions parkBoxOptions, ILogger logger, Action openRod, Action inOutAction)
 {
     InitializeComponent();
     _parkBoxOptions        = parkBoxOptions;
     _logger                = logger;
     deviceInfo             = deviceInfoDto;
     synchronizationContext = SynchronizationContext.Current;
     if (deviceInfo.EntranceDto.EntranceType == Enum.EntranceType.In)
     {
         TimeClock.Foreground    = new SolidColorBrush(Colors.Orange);
         EntranceName.Foreground = new SolidColorBrush(Colors.Orange);
     }
     else
     {
         TimeClock.Foreground    = new SolidColorBrush(Colors.Green);
         EntranceName.Foreground = new SolidColorBrush(Colors.Green);
     }
     if (deviceInfo.EntranceDto.EntranceType == Enum.EntranceType.Out)
     {
         this.btn_InOut.Content = "手工出场";
     }
     timer = new Timer(x =>
     {
         synchronizationContext.Post(z => this.TimeClock.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), null);
     }, null, 1000, 1000);
     OpenRod     = openRod;
     InOutAction = inOutAction;
 }
        public async Task <DeviceInfoDto> Unsubscribe(DeviceInfoDto input)
        {
            var saveModel = MapEntityDtoToEntity(input);
            await _repository.DeleteAsync(saveModel);

            await CurrentUnitOfWork.SaveChangesAsync();

            return(input);
        }
示例#3
0
        public DeviceViewModel(DeviceInfoDto device, DeviceCategoryViewModel category)
        {
            DeviceInfo = device;
            Category   = category;

            StatusErrorMessage = DeviceErrorMessageUtilities.GetErrorMessage(device.StatusCode);
            DisplayWarning     = device.StatusCode != 0;
            ChildDevices       = new List <DeviceViewModel>(0);
            Caption            = device.Name.Trim();
        }
        public async Task <DeviceInfoDto> Subscribe(DeviceInfoDto input)
        {
            //add extra validatio logic here if required
            var saveModel = MapDtoToEntity(input);
            var result    = await _repository.InsertAsync(saveModel);

            await CurrentUnitOfWork.SaveChangesAsync();

            return(MapEntityToDto(result));
        }
        public Task <DeviceInfoDto> GetDeviceInfo()
        {
            var result = new DeviceInfoDto
            {
                Model        = DeviceInfo.Model,
                Manufacturer = DeviceInfo.Manufacturer,
                Version      = DeviceInfo.VersionString
            };

            return(Task.FromResult(result));
        }
 private DeviceInfo MapDtoToEntity(DeviceInfoDto input)
 {
     return(new DeviceInfo
     {
         UserID = (long)AbpSession.UserId,
         HardwareModel = input.HardwareModel,
         PlatformType = input.PlatformType,
         PlatformVersion = input.PlatformVersion,
         RegID = input.RegID,
         UniqueDeviceId = input.UniqueDeviceId
     });
 }
示例#7
0
        private void OnRegisterDevice(RegisterDevice msg)
        {
            DeviceInfoDto dto = msg.DeviceDto;
            string        uniqueDeviceActorName = ActorSystemReferences.ActorNames.DeviceActorNamePrefix + dto.DeviceId;

            IActorRef deviceActorRef = Context.Child(uniqueDeviceActorName);

            if (deviceActorRef.IsNobody())
            {
                deviceActorRef = Context.ActorOf(Props.Create <DeviceActor>(), uniqueDeviceActorName);
            }
            deviceActorRef.Tell(msg);
        }
示例#8
0
        private bool DeviceLogin(DeviceInfoDto deviceInfoDto)
        {
            long loginId = -1;

            loginId = deviceInfoDto.Controlable.Login(deviceInfoDto.UserName, deviceInfoDto.Password, deviceInfoDto.Port);

            if (deviceInfoDto.DeviceStatus == Enum.DeviceStatus.Online && deviceInfoDto.Handler.HasValue)
            {
                deviceInfoDto.Controlable.Camerable.RealTimeMonitoring(deviceInfoDto.Handler.Value);
            }

            return(loginId > 0);
        }
示例#9
0
        public CoverLayerWinform(DeviceInfoDto deviceInfoDto, IParkBoxOptions parkBoxOptions, ILogger logger, Action openRod, Action inOutAction)
        {
            InitializeComponent();
            _coverLayer            = new CoverLayer(deviceInfoDto, parkBoxOptions, logger, openRod, inOutAction);
            _coverLayer.Background = System.Windows.Media.Brushes.Transparent;

            elementHost.Dock  = DockStyle.Fill;
            elementHost.Child = _coverLayer;
            panel1.Controls.Add(elementHost);
            pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
            pictureBox1.SendToBack();
            //elementHost.Refresh();
        }
示例#10
0
        public LanKaPicture(DeviceInfoDto deviceInfoDto, Action openRod, Action inOutAction, ParkEntranceInfo parkEntrance)
        {
            InitializeComponent();
            deviceInfo    = deviceInfoDto;
            _parkEntrance = parkEntrance;
            _openRod      = openRod;
            _inOutAction  = inOutAction;
            Panel panel = new Panel();

            _lankaPic      = new AxBLC_IPNC();
            _lankaPic.Dock = DockStyle.Fill;
            _lankaPic.BackgroundImageLayout = ImageLayout.Stretch;
            _lankaPic.SendToBack();
            deviceInfoDto.Handler = panel.Handle;
            panel.Controls.Add(_lankaPic);
            InitCoverLayer(panel);
            host.Child = panel;
        }
        // POST api/concentrators/{id}/deviceinfo
        public HttpResponseMessage PostDeviceInfo(string id, [FromBody] DeviceInfoDto deviceInfoDto)
        {
            HttpResponseMessage response;

            var concentrator = m2m.GetNode <Concentrator>(id);

            if (concentrator.DeviceInfo != null)
            {
                response = Request.CreateResponse(HttpStatusCode.NotModified, concentrator.DeviceInfo.ToDto(GetDeviceInfoUri(concentrator.Id)));
            }
            else
            {
                var deviceInfo = deviceInfoDto.FromDto();
                concentrator.DeviceInfo = deviceInfo;
                response = Request.CreateResponse(HttpStatusCode.Created, deviceInfo.ToDto(GetDeviceInfoUri(concentrator.Id)));
            }
            var uri = GetDeviceInfoUri(id);

            response.Headers.Location = new Uri(uri);
            return(response);
        }
示例#12
0
 public ParkEntranceInfo(DeviceInfoDto deviceInfoDto, IParkBoxOptions parkBoxOptions, ILogger logger)
 {
     InitializeComponent();
     deviceInfo             = deviceInfoDto;
     _parkBoxOptions        = parkBoxOptions;
     _logger                = logger;
     _manualEntryAndExit    = IocManager.Instance.Resolve <IManualEntryAndExit>();
     synchronizationContext = SynchronizationContext.Current;
     if (_parkBoxOptions.IsListView)
     {
         //CoverLayerWinform coverLayer = new CoverLayerWinform(deviceInfo, parkBoxOptions, logger, async () => await OpenRod(), InOutAction);
         //coverLayer.Dock = System.Windows.Forms.DockStyle.Fill;
         //coverLayer.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
         Grd_Left.Children.Remove(Cav_CoverLayer);
         //coverLayer.SetImage(_parkBoxOptions.DefultCarmeraImg);
         //host.Child = coverLayer;
     }
     else
     {
         // Grd_Left.Children.Remove(Cav_Winform);
         if (deviceInfo.EntranceDto.EntranceType == Enum.EntranceType.In)
         {
             TimeClock.Foreground    = new SolidColorBrush(Colors.Orange);
             EntranceName.Foreground = new SolidColorBrush(Colors.Orange);
         }
         else
         {
             TimeClock.Foreground    = new SolidColorBrush(Colors.Green);
             EntranceName.Foreground = new SolidColorBrush(Colors.Green);
         }
         if (deviceInfo.EntranceDto.EntranceType == Enum.EntranceType.Out)
         {
             this.btn_InOut.Content = "手工出场";
         }
         timer = new System.Threading.Timer(x =>
         {
             synchronizationContext.Post(z => this.TimeClock.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), null);
         }, null, 1000, 1000);
     }
 }
示例#13
0
        public DeviceInfoDto GetDeviceInfo(DeviceId deviceId)
        {
            var info = _deviceInfoHandler.GetDeviceInfo(deviceId);

            if (info == null)
            {
                return(new DeviceInfoDto()
                {
                    DeviceId = deviceId.FullId
                });
            }

            var dto = new DeviceInfoDto()
            {
                DeviceId             = deviceId.FullId,
                DeviceName           = info.DeviceName,
                FcmToken             = info.FcmToken,
                Type                 = info.Type,
                Family               = info.family,
                AdditionalProperties = info.properties
            };

            return(dto);
        }
示例#14
0
 public MqttReceiveMessageReceived(DeviceInfoDto deviceDto)
 {
     DeviceDto = deviceDto;
 }
示例#15
0
        public IActionResult QueryDevices()
        {
            var list = new List <DeviceInfoDto>();

            using (var searcher = new ManagementObjectSearcher(@"\\" + Environment.MachineName + @"\root\CIMV2", "Select * from Win32_PnPEntity"))
                using (var collection = searcher.Get())
                {
                    foreach (var managementObject in collection.Cast <ManagementObject>())
                    {
                        if (managementObject.TryGetProperty <string>("DeviceID") == @"HTREE\ROOT\0")
                        {
                            continue;
                        }

                        var device = new DeviceInfoDto
                        {
                            Name         = managementObject.TryGetProperty <string>("Caption"),
                            DeviceId     = managementObject.TryGetProperty <string>("DeviceID"),
                            Description  = managementObject.TryGetProperty <string>("Description"),
                            Manufacturer = managementObject.TryGetProperty <string>("Manufacturer"),
                            StatusCode   = managementObject.TryGetProperty <uint>("ConfigManagerErrorCode")
                        };
                        var hardwareIds = managementObject.TryGetProperty <string[]>("HardwareID");
                        if (hardwareIds?.Length > 0)
                        {
                            device.HardwareId = hardwareIds[0];
                        }

                        list.Add(device);
                        var classGuidString = managementObject.TryGetProperty <string>("ClassGuid");

                        if (!Guid.TryParse(classGuidString, out var classGuid))
                        {
                            classGuid = Guid.Empty;
                        }

                        device.Category = DeviceCategory.None;

                        foreach (var value in (DeviceCategory[])Enum.GetValues(typeof(DeviceCategory)))
                        {
                            if (value.GetGuid() == classGuid)
                            {
                                device.Category = value;
                                break;
                            }
                        }

                        if (device.Category == DeviceCategory.None)
                        {
                            device.CustomCategory = managementObject.TryGetProperty <string>("PNPClass");
                        }
                    }
                }

            using (var searcher =
                       new ManagementObjectSearcher(@"\\" + Environment.MachineName + @"\root\CIMV2", "Select * from Win32_PnPSignedDriver"))
                using (var collection = searcher.Get())
                {
                    foreach (var managementObject in collection.Cast <ManagementObject>())
                    {
                        var deviceId = managementObject.TryGetProperty <string>("DeviceID");
                        var device   = list.FirstOrDefault(x => x.DeviceId == deviceId);
                        if (device != null)
                        {
                            device.DriverFriendlyName = managementObject.TryGetProperty <string>("FriendlyName");
                            if (managementObject.TryGetDateTime("DriverDate", out var buildDate))
                            {
                                device.DriverBuildDate = buildDate;
                            }

                            device.DriverDescription = managementObject.TryGetProperty <string>("Description");
                            if (managementObject.TryGetDateTime("InstallDate", out var installDate))
                            {
                                device.DriverInstallDate = installDate;
                            }

                            device.DriverName         = managementObject.TryGetProperty <string>("DriverName");
                            device.DriverProviderName = managementObject.TryGetProperty <string>("DriverProviderName");
                            device.DriverSigner       = managementObject.TryGetProperty <string>("Signer");
                            device.DriverVersion      = managementObject.TryGetProperty <string>("DriverVersion");
                            device.DriverInfName      = managementObject.TryGetProperty <string>("InfName");
                        }
                    }
                }

            return(Ok(list));
        }
示例#16
0
 public Task <DeviceInfoDto> Update(DeviceInfoDto input)
 {
     throw new NotImplementedException();
 }
示例#17
0
 public RegisterDevice(DeviceInfoDto deviceDto)
 {
     DeviceDto = deviceDto;
 }
示例#18
0
        private void OnRegisterDevice(RegisterDevice msg)
        {
            _deviceDto = msg.DeviceDto;

            Become(Registered);
        }
示例#19
0
        public async void DoMessage(DeviceInfoDto deviceInfoDto)
        {
            ManualResetEvent manualResetEvent = new ManualResetEvent(false);

            using (var unitOfWork = _unitOfWork.Begin())
            {
                DateTime photoTime = DateTime.Now;
                var      result    = deviceInfoDto.Controlable.Camerable.GetPlateNumber();
                string   carNumber = result.Item1;
                //Task.Run(async () =>
                // {
                await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetImage(await result.Item2);
                //});
                if (deviceInfoDto.EntranceDto.EntranceType == Enum.EntranceType.In)
                {
                    //禁止非机动车入场
                    if (!parkBoxOptions.NonmotorVehicleIn && result.Item4 == CarTypeEnum.NonMotorVehicle)
                    {
                        Logger.Info("非机动车辆禁止进入" + result.Item1);
                        return;
                    }
                    var backList = await _repositoryBlackList.FirstOrDefaultAsync(x => x.CarNumber == carNumber);

                    if (backList != null)
                    {
                        Logger.Info(result.Item1 + " 存在于黑名单 禁止进入");
                    }

                    var permission = _carNumberPermission.CheckCarNumberPermission(carNumber, deviceInfoDto.EntranceDto.Id);
                    var carInModel = new Parks.ParkBox.CarInModel()
                    {
                        CarNumber = carNumber,
                        Img       = null,
                        InOutType = Enum.InOutTypeEnum.Photo,
                        InTime    = DateTime.Now,
                        Entrance  = deviceInfoDto.EntranceDto
                    };
                    if (permission.IsCarIn.HasValue && !permission.IsCarIn.Value)
                    {
                        Logger.Debug(carNumber + "no permission" + permission.ToString());

                        return;
                    }
                    else if (permission.IsCarIn == null)
                    {
                        var cancle = MessageBox.Show("当前车辆无权进入是否放行?", "提示", MessageBoxButton.OKCancel);
                        if (cancle == MessageBoxResult.Cancel)
                        {
                            return;
                        }
                    }
                    //入场时检查是否有场内记录
                    var isCarIn = _vehicleFlow.IsCarIn(deviceInfoDto.EntranceDto.ParkLevel.Park.Id, carNumber);
                    if (isCarIn.IsCarIn)
                    {
                        var carOutModel = new CarOutModel()
                        {
                            CarInRecord = isCarIn.CarInRecord,
                            InOutType   = Enum.InOutTypeEnum.Photo,
                            OutTime     = DateTime.Now,
                            Receivable  = 0,
                            ParkId      = deviceInfoDto.EntranceDto.ParkLevel.Park.Id,
                            Remark      = "有场内纪录,再次入场"
                        };
                        _vehicleFlow.CarErrorOut(isCarIn.CarInRecord, carOutModel);
                    }
                    var carIn = _vehicleFlow.CarIn(carInModel, permission);
                    if (carIn != null)
                    {
                        await deviceInfoDto.Controlable?.Camerable?.OpenRod();

                        //await deviceInfoDto.Controlable.Camerable.OpenRod(); //抬杆
                        await _ledManager.SpeakAndShowText(deviceInfoDto, carInModel, permission); //播报语音

                        await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(carIn);
                    }
                    else
                    {
                        MessageBox.Show("入场失败");
                        return;
                    }
                }
                else
                {
                    /*
                     * 出场逻辑中 无场内车辆的记录也弹出
                     */


                    var isCarIn = _vehicleFlow.IsCarIn(deviceInfoDto.EntranceDto.ParkLevel.Park.Id, carNumber);
                    if (isCarIn.IsCarIn)
                    {
                        var user = _carNumberPermission.GetUser(deviceInfoDto.EntranceDto.ParkLevel.Park.Id, carNumber);
                        if (user != null)
                        {
                            var typeId  = user.CarPorts.FirstOrDefault()?.CarPortTypeId;
                            var carType = _repositoryCarType.GetAll().FirstOrDefault(x => x.Id == (typeId.HasValue ? typeId.Value : parkBoxOptions.TempCarTypeId));
                            //月租车正常出场
                            if (carType.Category == CarType.Month)
                            {
                                if (!isCarIn.CarInRecord.IsMonthTempIn)
                                {
                                    var outRcode = _vehicleFlow.CarOut(isCarIn.CarInRecord, new Parks.ParkBox.CarOutModel()
                                    {
                                        Pay = 0, InOutType = Enum.InOutTypeEnum.Artificial, OutTime = DateTime.Now
                                    });
                                    if (outRcode != null)
                                    {
                                        await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(outRcode);
                                    }
                                    else
                                    {
                                        MessageBox.Show("出场失败!", "提示");
                                    }
                                }
                                else
                                {  //月租车收费
                                    DateTime outTime = DateTime.Now;

                                    FareRule fareRule  = _repositoryFareRule.GetAll().FirstOrDefault(x => x.CarTypeId == parkBoxOptions.TempCarTypeId);
                                    var      rangTimes = _repositoryRangeTime.GetAllIncluding(x => x.FareRule).Where(x => x.FareRuleId == fareRule.Id).ToList();
                                    fareRule.TimeRangeList = rangTimes;

                                    if (isCarIn.CarInRecord.TempConvertMonthTime.HasValue)
                                    {
                                        outTime = isCarIn.CarInRecord.TempConvertMonthTime.Value;
                                    }
                                    var receivable  = fareRule.CalculateFees(isCarIn.CarInRecord.InTime, outTime, 0);
                                    var carOutModel = new CarOutModel()
                                    {
                                        CarInRecord = isCarIn.CarInRecord,
                                        InOutType   = Enum.InOutTypeEnum.Artificial,
                                        OutTime     = DateTime.Now,
                                        Receivable  = receivable,
                                        ParkId      = deviceInfoDto.EntranceDto.ParkLevel.Park.Id
                                    };
                                    if (parkBoxOptions.IsZeroMoneyOut && receivable == 0) //收费为0 直接放行
                                    {
                                        var outRcode = _vehicleFlow.CarOut(isCarIn.CarInRecord, carOutModel);
                                        if (outRcode != null)
                                        {
                                            await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(outRcode);

                                            await deviceInfoDto.Controlable?.Camerable?.OpenRod();

                                            await _ledManager.SpeakAndShowText(deviceInfoDto, carOutModel, OutEnum.SuccessfulPayment); //播报语音
                                        }
                                        else
                                        {
                                            MessageBox.Show("出场失败!", "提示");
                                        }
                                        return;
                                    }


                                    await _ledManager.SpeakAndShowText(deviceInfoDto, carOutModel, OutEnum.CalculationFee); //播报语音

                                    var tollWindow = await GetChargerWindow(_ledManager, carOutModel, fareRule, receivable, _repositoryCarType, parkBoxOptions, _repositoryCarPort, _vehicleFlow, deviceInfoDto, _repositoryFareRule, _repositoryRangeTime, manualResetEvent);

                                    tollWindow.Init();
                                    tollWindow.Show();
                                    WaitHandle.WaitAll(new WaitHandle[] { manualResetEvent });
                                    var isFree = tollWindow.IsClose;
                                    if (isFree.HasValue && isFree.Value)
                                    {
                                        await deviceInfoDto.Controlable?.Camerable?.OpenRod();

                                        await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(tollWindow.CarOutRecord);
                                        await _ledManager.SpeakAndShowText(deviceInfoDto, carOutModel, OutEnum.SuccessfulPayment); //播报语音
                                    }
                                }
                            }
                            else
                            {
                                //其他车类型
                                DateTime outTime = DateTime.Now;

                                FareRule fareRule  = _repositoryFareRule.GetAll().FirstOrDefault(x => x.CarTypeId == carType.Id);
                                var      rangTimes = _repositoryRangeTime.GetAllIncluding(x => x.FareRule).Where(x => x.FareRuleId == fareRule.Id).ToList();
                                fareRule.TimeRangeList = rangTimes;

                                var receivable  = fareRule?.CalculateFees(isCarIn.CarInRecord.InTime, outTime, 0) ?? 0;
                                var carOutModel = new CarOutModel()
                                {
                                    CarInRecord = isCarIn.CarInRecord,
                                    InOutType   = Enum.InOutTypeEnum.Artificial,
                                    OutTime     = outTime,
                                    Receivable  = receivable,
                                    ParkId      = deviceInfoDto.EntranceDto.ParkLevel.Park.Id
                                };

                                if (parkBoxOptions.IsZeroMoneyOut && receivable == 0) //收费为0 直接放行
                                {
                                    var outRcode = _vehicleFlow.CarOut(isCarIn.CarInRecord, carOutModel);
                                    if (outRcode != null)
                                    {
                                        await deviceInfoDto.Controlable?.Camerable?.OpenRod();

                                        await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(outRcode);
                                        await _ledManager.SpeakAndShowText(deviceInfoDto, carOutModel, OutEnum.SuccessfulPayment); //播报语音
                                    }
                                    else
                                    {
                                        MessageBox.Show("出场失败!", "提示");
                                    }
                                    return;
                                }

                                await _ledManager.SpeakAndShowText(deviceInfoDto, carOutModel, OutEnum.CalculationFee); //播报语音

                                var tollWindow = await GetChargerWindow(_ledManager, carOutModel, fareRule, receivable, _repositoryCarType, parkBoxOptions, _repositoryCarPort, _vehicleFlow, deviceInfoDto, _repositoryFareRule, _repositoryRangeTime, manualResetEvent);

                                tollWindow.Init();
                                tollWindow.Show();
                                WaitHandle.WaitAll(new WaitHandle[] { manualResetEvent });
                                var isFree = tollWindow.IsClose;
                                if (isFree.HasValue && isFree.Value)
                                {
                                    await deviceInfoDto.Controlable?.Camerable?.OpenRod();

                                    await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(tollWindow.CarOutRecord);


                                    await _ledManager.SpeakAndShowText(deviceInfoDto, carOutModel, OutEnum.SuccessfulPayment); //播报语音
                                }
                            }
                        }
                        else
                        {  //临时车
                            DateTime outTime = DateTime.Now;

                            FareRule fareRule = _repositoryFareRule.GetAll().FirstOrDefault(x => x.CarTypeId == parkBoxOptions.TempCarTypeId);

                            var rangTimes = _repositoryRangeTime.GetAllIncluding(x => x.FareRule).Where(x => x.FareRuleId == fareRule.Id).ToList();
                            fareRule.TimeRangeList = rangTimes;

                            var receivable = fareRule?.CalculateFees(isCarIn.CarInRecord.InTime, outTime, 0) ?? 0;

                            var carOutModel = new CarOutModel()
                            {
                                CarInRecord = isCarIn.CarInRecord,
                                InOutType   = Enum.InOutTypeEnum.Artificial,
                                OutTime     = outTime,
                                Receivable  = receivable,
                                ParkId      = deviceInfoDto.EntranceDto.ParkLevel.Park.Id
                            };

                            if (parkBoxOptions.IsZeroMoneyOut && receivable == 0) //收费为0 直接放行
                            {
                                var outRcode = _vehicleFlow.CarOut(isCarIn.CarInRecord, carOutModel);
                                if (outRcode != null)
                                {
                                    await deviceInfoDto.Controlable?.Camerable?.OpenRod();

                                    await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(outRcode);
                                    await _ledManager.SpeakAndShowText(deviceInfoDto, carOutModel, OutEnum.SuccessfulPayment); //播报语音
                                }
                                else
                                {
                                    MessageBox.Show("出场失败!", "提示");
                                }
                                return;
                            }

                            await _ledManager.SpeakAndShowText(deviceInfoDto, carOutModel, OutEnum.CalculationFee); //播报语音

                            var tollWindow = await GetChargerWindow(_ledManager, carOutModel, fareRule, receivable, _repositoryCarType, parkBoxOptions, _repositoryCarPort, _vehicleFlow, deviceInfoDto, _repositoryFareRule, _repositoryRangeTime, manualResetEvent);

                            tollWindow.Init();
                            tollWindow.Show();
                            var isFree = tollWindow.IsClose;
                            if (isFree.HasValue && isFree.Value)
                            {
                                await deviceInfoDto.Controlable?.Camerable?.OpenRod();

                                await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(tollWindow.CarOutRecord);
                                await _ledManager.SpeakAndShowText(deviceInfoDto, carOutModel, OutEnum.SuccessfulPayment); //播报语音
                            }
                        }
                    }
                    else
                    {
                        Logger.Info(carNumber + " 无场内记录");
                        //无在场记录如果为月租车直接放行  否则弹出收费框
                        var user = _carNumberPermission.GetUser(deviceInfoDto.EntranceDto.ParkLevel.Park.Id, carNumber);
                        if (user != null)
                        {
                            var model = new Parks.ParkBox.CarOutModel()
                            {
                                Pay = 0, InOutType = Enum.InOutTypeEnum.Artificial, OutTime = DateTime.Now, ParkId = deviceInfoDto.EntranceDto.ParkLevel.Park.Id
                            };
                            var outRcode = _vehicleFlow.CarOut(carNumber, user, model);
                            if (outRcode != null)
                            {
                                await deviceInfoDto.Controlable?.Camerable?.OpenRod();

                                await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(outRcode);


                                await _ledManager.SpeakAndShowText(deviceInfoDto, model, OutEnum.SuccessfulPayment); //播报语音
                            }
                            else
                            {
                                MessageBox.Show("出场失败!", "提示");
                            }
                            return;
                        }
                        else
                        {
                            FareRule fareRule  = _repositoryFareRule.GetAll().FirstOrDefault(x => x.CarTypeId == parkBoxOptions.TempCarTypeId);
                            var      rangTimes = _repositoryRangeTime.GetAllIncluding(x => x.FareRule).Where(x => x.FareRuleId == fareRule.Id).ToList();
                            fareRule.TimeRangeList = rangTimes;

                            ///弹出收费框
                            var tollWindow = await GetChargerWindow(_ledManager, carNumber, fareRule, InOutTypeEnum.Photo, _repositoryCarType, parkBoxOptions, _repositoryCarPort, _vehicleFlow, deviceInfoDto, _repositoryFareRule, _repositoryRangeTime, manualResetEvent);

                            tollWindow.Init();
                            tollWindow.Show();
                            WaitHandle.WaitAll(new WaitHandle[] { manualResetEvent });
                            var isFree = tollWindow.IsClose;
                            if (isFree.HasValue && isFree.Value)
                            {
                                await deviceInfoDto.Controlable?.Camerable?.OpenRod();

                                await parkBoxOptions.SetInfosDic?[deviceInfoDto.EntranceDto.Id]?.SetInfo(tollWindow.CarOutRecord);


                                await _ledManager.SpeakAndShowText(deviceInfoDto, tollWindow.CarOutModel, OutEnum.SuccessfulPayment); //播报语音
                            }
                            return;
                        }
                    }
                }


                await unitOfWork.CompleteAsync();
            }
        }