public void Execute(IdentificationInfo iInfo)
        {
            bool ret = Compared(iInfo.LicensePlateNumber, iInfo.IdentificationTime);

            if (ret)
            {
                return;
            }

            //获取入场的信息
            IEnteranceRecordService enteranceRecordService = BLL.Container.Container.Resolve <IEnteranceRecordService>();
            EnteranceRecord         enteranceRecord        = enteranceRecordService.Query(iInfo.LicensePlateNumber);
            //获取车主信息
            IOwnerInfoService ownerInfoService = BLL.Container.Container.Resolve <IOwnerInfoService>();
            OwnerInfo         ownerInfo        = ownerInfoService.Query(iInfo.LicensePlateNumber);

            ExitDoor.Execute(iInfo, enteranceRecord, ownerInfo);
        }
Exemple #2
0
        public void Execute(IdentificationInfo iInfo)
        {
            bool ret = Compared(iInfo.LicensePlateNumber, iInfo.IdentificationTime);

            if (ret)
            {
                return;
            }

            IEnteranceRecordService enteranceRecordService = BLL.Container.Container.Resolve <IEnteranceRecordService>();
            EnteranceRecord         enteranceRecord        = null;
            OwnerInfo     ownerInfo    = null;
            ChargesRecord chargeRecord = null;

            try
            {
                if (iInfo.LicensePlateNumber != "ABCDEF")
                {
                    enteranceRecord = enteranceRecordService.Query(iInfo.LicensePlateNumber);
                    //获取车主信息
                    IOwnerInfoService ownerInfoService = BLL.Container.Container.Resolve <IOwnerInfoService>();
                    ownerInfo = ownerInfoService.Query(iInfo.LicensePlateNumber);
                    //获取车辆记录中修改的车辆类型 大车 中车 小车
                    IChargesRecordService chargeRecordService = BLL.Container.Container.Resolve <IChargesRecordService>();
                    chargeRecord = chargeRecordService.Query(iInfo.LicensePlateNumber);
                }
                EnterDoor.Execute(iInfo, ownerInfo);
            }
            finally
            {
                try
                {
                    if (enteranceRecord == null)
                    {
                        int vehicleType = 0;
                        if (iInfo.LicensePlateType == LicensePlateTypes.LT_YELLOW || iInfo.LicensePlateType == LicensePlateTypes.LT_YELLOW2)
                        {
                            vehicleType = 2;
                        }
                        if (chargeRecord != null)
                        {
                            if (vehicleType != chargeRecord.VehicleType)
                            {
                                vehicleType = chargeRecord.VehicleType;
                            }
                        }
                        enteranceRecord = new EnteranceRecord(iInfo.LicensePlateNumber, iInfo.IdentificationTime, vehicleType);
                        enteranceRecordService.Add(enteranceRecord);
                    }
                    else
                    {
                        enteranceRecord.EntranceTime = iInfo.IdentificationTime;
                        enteranceRecordService.Update(enteranceRecord);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message, ex);
                }
            }
        }