Exemple #1
0
 public ReportPreview(BarcodeReport rpt)
 {
     InitializeComponent();
     using (ReportPrintTool printtool = new ReportPrintTool(rpt))
     {
         printtool.ShowRibbonPreviewDialog();
         try
         {
             this.Close();
         }
         catch { }
     }
 }
Exemple #2
0
        /// <summary>
        /// 팔레트 바코드 출력
        /// </summary>
        /// <param name="palletno"></param>
        /// <param name="count"></param>
        public void PrintPallet(string palletno, int count)
        {
            Program.Log.WriteInfo($"{GlobalUsage.UserName}이(가) 팔레트({palletno}) 바코드 {count}개를 인쇄함");
            Pallet_MasterService service = new Pallet_MasterService();
            DataTable            table   = service.GetPalletToDT(palletno, GlobalUsage.WorkOrderNo, count);

            if (table != null)
            {
                BarcodeReport rpt = new BarcodeReport();
                rpt.DataSource = table;

                ReportPreview frm = new ReportPreview(rpt);
            }
        }
Exemple #3
0
        // Unwrap the original image, read the barcode, and display the results.
        private void unwrapBarcodeButton_Click(object sender, EventArgs e)
        {
            // Unwrap annulus region of image.
            Algorithms.Unwrap(imageViewer1.Image, imageViewer2.Image, imageViewer1.Roi, RectangleOrientation.BaseOutside, InterpolationMethod.Bilinear);

            // Invert unwrapped image for barcode reader.
            Algorithms.Inverse(imageViewer2.Image, imageViewer2.Image);

            // Read the barcode from the wrapped image.
            BarcodeReport report = Algorithms.ReadBarcode(imageViewer2.Image, BarcodeTypes.Code39);

            // Display results
            barcodeString.Text   = report.Text;
            confidenceLevel.Text = String.Format("{0:0.0}", report.ConfidenceLevel);
        }
Exemple #4
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            VisionImage image = GetNextImage();

            // Initialize the barcode roi.
            Roi barcodeRoi = new Roi(new Shape[] { new RectangleContour(9, 100, 340, 48) });

            image.Overlays.Default.AddRoi(barcodeRoi);

            // Read the barcode.
            BarcodeReport report = Algorithms.ReadBarcode(image, BarcodeTypes.Ean13, barcodeRoi, true);

            // Display the result.
            barcodeResult.Text = report.OutputChar1.ToString() + report.OutputChar2.ToString() + report.Text;
            imageViewer1.Attach(image);
        }
Exemple #5
0
        public string Process1DBarcode(VisionImage image, TemplateConfig templateConfig, List <BarcodeConfig> barcodeConfigs)
        {
            // Initialize the IVA_Data structure to pass results and coordinate systems.
            IVA_Data ivaData = new IVA_Data(5, 1);

            // Creates a new, empty region of interest.
            Roi roi = new Roi();

            // Creates a new RotatedRectangleContour using the given values.
            //PointContour vaCenter = new PointContour(1294, 972);
            //RotatedRectangleContour vaRotatedRect = new RotatedRectangleContour(vaCenter, 2548, 1904, 0);

            // Creates a new RectangleContour using the given values.
            RectangleContour vaRotatedRect = new RectangleContour(templateConfig.Rectangle.Left,
                                                                  templateConfig.Rectangle.Top, templateConfig.Rectangle.Width, templateConfig.Rectangle.Height);

            roi.Add(vaRotatedRect);

            image.Overlays.Default.AddRoi(roi);

            // MatchPattern Grayscale
            MatchMode vaMode        = MatchMode.RotationInvariant;
            bool      vaSubpixelVal = false;

            int[]  minAngleVals          = { -30, 0 };
            int[]  maxAngleVals          = { 30, 0 };
            int    vaNumMatchesRequested = 1;
            double vaMinMatchScore       = 800;
            double vaOffsetX             = 0;
            double vaOffsetY             = 0;

            pmResults = IVA_MatchPattern(image, ivaData, templateConfig.TemplatePath, vaMode, vaSubpixelVal,
                                         minAngleVals, maxAngleVals, vaNumMatchesRequested, vaMinMatchScore, roi, vaOffsetX, vaOffsetY, 0);

            foreach (PatternMatch match in pmResults)
            {
                image.Overlays.Default.AddPolygon(new PolygonContour(match.Corners), Rgb32Value.RedColor);
            }
            roi.Dispose();
            // Set Coordinate System
            int             vaCoordSystemIndex    = 0;
            int             stepIndexOrigin       = 0;
            int             resultIndexOrigin     = 1;
            int             stepIndexAngle        = 0;
            int             resultIndexAngle      = 3;
            double          refSysOriginX         = templateConfig.Position.X;
            double          refSysOriginY         = templateConfig.Position.Y;
            double          refSysAngle           = 0;
            AxisOrientation refSysAxisOrientation = AxisOrientation.Direct;
            int             vaCoordSystemType     = 3;

            IVA_CoordSys(vaCoordSystemIndex, stepIndexOrigin, resultIndexOrigin, stepIndexAngle,
                         resultIndexAngle, refSysOriginX, refSysOriginY, refSysAngle, refSysAxisOrientation, vaCoordSystemType, ivaData);

            string barcodeInfo = "";

            for (int i = 0; i < barcodeConfigs.Count; i++)
            {
                Roi roiBarcode          = new Roi();
                RectangleContour vaRect = new RectangleContour(barcodeConfigs[i].Rectangle.Left,
                                                               barcodeConfigs[i].Rectangle.Top, barcodeConfigs[i].Rectangle.Width, barcodeConfigs[i].Rectangle.Height);
                roiBarcode.Add(vaRect);
                // Reposition the region of interest based on the coordinate system.
                int coordSystemIndex = 0;
                Algorithms.TransformRoi(roiBarcode, new CoordinateTransform(ivaData.baseCoordinateSystems[coordSystemIndex],
                                                                            ivaData.MeasurementSystems[coordSystemIndex]));
                image.Overlays.Default.AddRoi(roiBarcode);
                // Reads the barcode from the image.
                BarcodeReport vaBarcode = Algorithms.ReadBarcode(image, barcodeConfigs[i].Type, roiBarcode, false);

                barcodeInfo += string.Format("{0},", vaBarcode.Text);

                roiBarcode.Dispose();
            }
            barcodeInfo = barcodeInfo.Substring(0, barcodeInfo.Length - 1);
            // Dispose the IVA_Data structure.
            ivaData.Dispose();
            return(barcodeInfo);
        }