Exemple #1
0
 public Uploader(ScrapeInfo scrapeInfo, DimensionInfo dimensionInfo, InspectionInfo inspectionInfo, AeiInfo aei)
 {
     this.scrapeInfo     = scrapeInfo ?? throw new ArgumentNullException(nameof(scrapeInfo));
     this.dimensionInfo  = dimensionInfo ?? throw new ArgumentNullException(nameof(dimensionInfo));
     this.inspectionInfo = inspectionInfo ?? throw new ArgumentNullException(nameof(inspectionInfo));
     this.aei            = aei ?? throw new ArgumentNullException(nameof(aei));
 }
Exemple #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (VIN != null ? VIN.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VehicleMake != null ? VehicleMake.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VehicleModel != null ? VehicleModel.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TyreSize != null ? TyreSize.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VehicleType != null ? VehicleType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (WFactor != null ? WFactor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (KFactor != null ? KFactor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LFactor != null ? LFactor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OdometerReading != null ? OdometerReading.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Tampered.GetHashCode();
         hashCode = (hashCode * 397) ^ (InvoiceNumber != null ? InvoiceNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (InspectionInfo != null ? InspectionInfo.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TachographHasAdapter.GetHashCode();
         hashCode = (hashCode * 397) ^ (TachographAdapterSerialNumber != null ? TachographAdapterSerialNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TachographAdapterLocation != null ? TachographAdapterLocation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TachographCableColor != null ? TachographCableColor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MinorWorkDetails != null ? MinorWorkDetails.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TachographType != null ? TachographType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CardSerialNumber != null ? CardSerialNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CalibrationTime.GetHashCode();
         hashCode = (hashCode * 397) ^ IsDigital.GetHashCode();
         hashCode = (hashCode * 397) ^ NewBattery.GetHashCode();
         hashCode = (hashCode * 397) ^ (NewInspectionInfo != null ? NewInspectionInfo.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemple #3
0
        public InspectionInfo Inspect(ImageInfo imageInfo)
        {
            var defectInfos      = new DefectInfo[1024];
            var measurementInfos = new MeasurementInfo[1024];

            var inspectInfo = SimInspectorInteropApi.Inspect(imageInfo, defectInfos, measurementInfos);

            var iiEntity = new InspectionInfo
            {
                Index            = inspectInfo.Index,
                SurfaceTypeIndex = inspectInfo.SurfaceTypeIndex,
                HasError         = (inspectInfo.HasError != 0),
            };

            for (int i = 0; i < inspectInfo.DefectsCount; i++)
            {
                var di = defectInfos[i];
//                di.X = di.X - di.Width/2;
//                di.Y = di.Y - di.Height/2;
                iiEntity.DefectInfos.Add(di);
            }

            for (int i = 0; i < inspectInfo.MeasurementsCount; i++)
            {
                var di = measurementInfos[i];
                iiEntity.MeasurementInfos.Add(di);
            }

            return(iiEntity);
        }
Exemple #4
0
 private void open_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult dialogResult = openFileDialog1.ShowDialog();
         if (dialogResult.ToString() == "OK")
         {
             engine.OpenInspection(openFileDialog1.FileName);
             InspectionInfo info = engine.GetInspectionInfo();
             Path.Text       = string.Copy(info.productName);
             inspect.Enabled = true;
         }
     }
     catch (VBAIException ex)
     {
         Path.Text = String.Copy("");
         MessageBox.Show(ex.Message);
     }
 }
Exemple #5
0
        public InspectionInfo[] GetTargetInspections()
        {
            int size;

            InspectionInfo[] inspectionArray;

            Error err = vbaiGetTargetInspections(_session.nativeSession, null, out size);

            if (err != Error.Success)
            {
                inspectionArray = null;
                ExceptionBuilder.CheckErrorAndThrow(err);
                return(inspectionArray);
            }
            inspectionArray = new InspectionInfo[size];
            err             = vbaiGetTargetInspections(_session.nativeSession, inspectionArray, out size);
            ExceptionBuilder.CheckErrorAndThrow(err);
            return(inspectionArray);
        }
Exemple #6
0
        private void Open_inspection_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();

                if (openFileDialog.ShowDialog() == true)
                {
                    engine.OpenInspection(openFileDialog.FileName);
                    InspectionInfo info = engine.GetInspectionInfo();
                    txtInspectionName.Text = info.productName;
                    btnInspect.IsEnabled   = true;
                }
            }
            catch (VBAIException ex)
            {
                txtInspectionName.Text = "";
                MessageBox.Show(ex.Message);
            }
        }
Exemple #7
0
//        private List<Hdc.Mv.Inspection.MeasurementInfo> c5MeasurementInfos = new List<Hdc.Mv.Inspection.MeasurementInfo>();

        public InspectionInfo Inspect(Hdc.Mv.ImageInfo imageInfo)
        {
            var newSchema = GetInspectionSchema();

            GeneralInspector.ImportInspectionSchema(newSchema);
            GeneralInspector.Inspect(imageInfo);

            var inspectionInfo = new InspectionInfo();
            var originAResult  = GeneralInspector.CircleSearchingResults[0];
            var originBResult  = GeneralInspector.CircleSearchingResults[1];
            var baseLine       = new Line(originAResult.Circle.GetCenterPoint(), originBResult.Circle.GetCenterPoint());
            var baseLineAngle  = 90 - 56;

            for (int i = 1; i < GeneralInspector.CircleSearchingDefinitions.Count; i++)
            {
                var circleSearchingResult = GeneralInspector.CircleSearchingResults[i];
                if (!circleSearchingResult.HasError)
                {
                    var measurement = new Hdc.Mv.Inspection.MeasurementInfo()
                    {
                        StartPointX = originAResult.Circle.CenterX,
                        StartPointY = originAResult.Circle.CenterY,
                        EndPointX   = circleSearchingResult.Circle.CenterX,
                        EndPointY   = circleSearchingResult.Circle.CenterY,
                    };

                    Point targetPoint   = circleSearchingResult.Circle.GetCenterPoint();
                    var   relativePoint = targetPoint.GetRelativePoint(baseLine, baseLineAngle);
                    var   length        = relativePoint.ToVector().Length;

                    //                    measurement.StartPointXActualValue = relativePoint.X;
                    //                    measurement.StartPointXActualValue = relativePoint.X;
                    measurement.Index                  = i;
                    measurement.GroupIndex             = i;
                    measurement.Value                  = length;
                    measurement.StartPointXActualValue = relativePoint.X * 16 / 1000.0;
                    measurement.StartPointYActualValue = relativePoint.Y * 16 / 1000.0;
                    //                                measurement.EndPointXActualValue = relativePoint.X * 16 / 1000.0;
                    //                                measurement.EndPointYActualValue = relativePoint.Y * 16 / 1000.0;
                    measurement.ValueActualValue = length * 16 / 1000.0;
                    measurement.ValueActualValue = circleSearchingResult.Circle.Radius * 16 / 1000.0;

                    counter++;

//                    DateTime dateTime = DateTime.Now;
//                    Debug.WriteLine("begin -------------" + dateTime + "--------------");

                    switch (i)
                    {
                    case 1:
                        measurement.EndPointXActualValue = measurement.StartPointXActualValue - 31.85;
                        measurement.EndPointYActualValue = measurement.StartPointYActualValue - (-21.29);
                        c2MeasurementInfos.Add(measurement);
                        break;

                    case 2:
                        measurement.EndPointXActualValue = measurement.StartPointXActualValue - 40.77;
                        measurement.EndPointYActualValue = measurement.StartPointYActualValue - (-44.45);
                        c3MeasurementInfos.Add(measurement);

                        break;

                    case 3:
                        measurement.EndPointXActualValue = measurement.StartPointXActualValue - 42.43;
                        measurement.EndPointYActualValue = measurement.StartPointYActualValue - 83.06;
                        c4MeasurementInfos.Add(measurement);

                        break;

                    case 4:
                        measurement.EndPointXActualValue = measurement.StartPointXActualValue - (-17.28);
                        measurement.EndPointYActualValue = measurement.StartPointYActualValue - 84.04;
                        c5MeasurementInfos.Add(measurement);

                        break;
                    }

//                    Debug.WriteLine("end -------------" + dateTime + "--------------");

                    inspectionInfo.MeasurementInfos.Add(measurement);
                }
                else
                {
                    //                    innerCircle.Stroke = Brushes.Red;
                    //                    outerCircle.Stroke = Brushes.Red;
                }
            }

            DateTime dateTime = DateTime.Now;

            Debug.WriteLine("begin -------------" + dateTime + "--------------");

            Debug.WriteLine("C2 ---------------------");
            OutputResults(c2MeasurementInfos);
            Debug.WriteLine("C3 ---------------------");
            OutputResults(c3MeasurementInfos);
            Debug.WriteLine("C4 ---------------------");
            OutputResults(c4MeasurementInfos);
            Debug.WriteLine("C5 ---------------------");
            OutputResults(c5MeasurementInfos);

            Debug.WriteLine("end -------------" + dateTime + "--------------");

            foreach (var searchingResult in GeneralInspector.CircleSearchingResults)
            {
                Debug.WriteLine(@"CircleSearchingResults: x={0}, y={1}", searchingResult.Circle.CenterX, searchingResult.Circle.CenterY);
            }


            return(inspectionInfo);
        }
Exemple #8
0
        public static void Load()
        {
            int      axleCount;
            DateTime time;

            //找出该列车的探测时间和轴数
            //采用数据的优先级为 AEI -> 探伤 -> 几何尺寸 -> 擦伤
            if (AeiFile != null)
            {
                var a = AeiInfo.Create(AeiFile);
                axleCount = a.AxleCount;
                time      = a.Time;
            }
            else if (InspectionFile != null)
            {
                var ins = InspectionInfo.Create(InspectionFile);
                axleCount = ins.Formations.Count * 32;
                time      = DateTime.ParseExact(ins.Time, "yyyyMMddHHmmss", null);
            }
            else if (DimensionFile != null)
            {
                var dim = DimensionInfo.Create(DimensionFile);
                axleCount = dim.BaseInfo.AxleCount;
                time      = DateTime.ParseExact(dim.BaseInfo.DetectionTime, "yyyyMMddHHmmss", null);
            }
            else if (ScrapeFile != null)
            {
                var scr = ScrapeInfo.Create(ScrapeFile);
                axleCount = scr.AxleCnt;
                time      = DateTime.ParseExact(scr.Time, "yyyyMMddHHmmss", null);
            }
            else
            {
                throw new Exception("AEI,探伤,几何尺寸,擦伤报文均不存在,无法入库");
            }
            if (axleCount >= 22 && axleCount <= 42)
            {
                axleCount = 32;
            }
            else if (axleCount > 42 && axleCount <= 74)
            {
                axleCount = 64;
            }
            ScrapeInfo     scrape;
            DimensionInfo  dimension;
            AeiInfo        aei;
            InspectionInfo inspection;

            if (ScrapeFile is null)
            {
                scrape = ScrapeInfo.CreateDefault(axleCount, time);
            }
            else
            {
                scrape = ScrapeInfo.Create(ScrapeFile);
            }
            if (AeiFile is null)
            {
                aei = AeiInfo.CreateDefault(axleCount, time);
            }
            else
            {
                aei = AeiInfo.Create(AeiFile);
            }
            if (DimensionFile is null)
            {
                dimension = DimensionInfo.CreateDefault(axleCount, time);
            }
            else
            {
                dimension = DimensionInfo.Create(DimensionFile);
            }
            if (InspectionFile is null)
            {
                inspection = InspectionInfo.CreateDefault(axleCount, time);
            }
            else
            {
                inspection = InspectionInfo.Create(InspectionFile);
            }
            var loader = new Uploader(scrape, dimension, inspection, aei);

            loader.Insert();


            Clear();
        }
Exemple #9
0
 private static extern Error vbaiGetInspectionInfo(NativeSession session, out InspectionInfo info);