VintaSoft Barcode .NET SDK 15.0: Руководство для .NET разработчика
Vintasoft.Barcode.SymbologySubsets Namespace / BarcodeSymbologySubsets Class / ISBT128DataMatrix Property
Синтаксис Ремарки Example Требования Смотрите также
В этом разделе
    ISBT128DataMatrix Свойство (BarcodeSymbologySubsets)
    В этом разделе
    Возвращает символику штрих-кода ISBT 128 Data Matrix.
    Синтаксис
    'Declaration
    
    Public Shared ReadOnly Property ISBT128DataMatrix As Isbt128DataMatrixBarcodeSymbology
    
    
    public static Isbt128DataMatrixBarcodeSymbology ISBT128DataMatrix { get; }
    
    
    public: __property static Isbt128DataMatrixBarcodeSymbology* get_ISBT128DataMatrix();
    
    
    
    public:
    static property Isbt128DataMatrixBarcodeSymbology^ ISBT128DataMatrix { Isbt128DataMatrixBarcodeSymbology^ get(); }
    Ремарки

    ISBT 128 - это глобальный стандарт идентификации, маркировки, и передача информации о медицинских изделиях человеческого происхождения. Подмножество символов штрих-кода Data Matrix.

    Пример

    Этот C#/VB.NET код показывает, как сгенерировать и распознать штрих-код ISBT 128 Data Matrix.

    
    
    Imports Vintasoft.Barcode
    Imports Vintasoft.Barcode.BarcodeInfo
    Imports Vintasoft.Barcode.SymbologySubsets
    Imports Vintasoft.Imaging
    
    Class ISBT128DataMatrixExample
        ''' <summary>
        ''' Generates and recognizes ISBT 128 barcode use value item.
        ''' </summary>
        Public Shared Sub TestUseValueItem()
            ' create compound message - 3 data structures
            ' 4 - referencing an entry in an ICCBBA maintained table, requires 001, 003, 005 data structures
            Dim compoundMessage As New IsbtCompoundMessage(3, 4)
    
            ' Donation Identification Number
            Dim dataValue001 As IsbtDataValue = IsbtDataStructures.GetDataStructureByNumber(1).Parse("=A99981712345600")
    
            ' Product Code
            Dim dataValue003 As IsbtDataValue = IsbtDataStructures.GetDataStructureByNumber(3).Parse("=<S1200100")
    
            ' Expiration Date
            Dim dataValue005 As IsbtDataValue = IsbtDataStructures.GetDataStructureByNumber(5).Parse("&>0271322359")
    
            ' create ISBT 128 barcode value
            Dim barcodeValue As New IsbtValueItem(compoundMessage, dataValue001, dataValue003, dataValue005)
    
            ' create barcode writer
            Using writer As New BarcodeWriter()
                ' encode ISBT 128 Data Matrix barcode to writer settings
                BarcodeSymbologySubsets.ISBT128DataMatrix.Encode(barcodeValue, writer.Settings)
    
                ' generate barcode image
                Using barcodeImage As VintasoftBitmap = writer.GetBarcodeAsVintasoftBitmap()
                    ' recognize barcode value
                    Dim recognizedValue As IsbtValueItem = Recognize(barcodeImage)
    
                    ' check value
                    If barcodeValue.ToString() <> recognizedValue.ToString() Then
                        Throw New ApplicationException()
                    End If
    
                    ' privt value
                    PrintValue(recognizedValue)
                End Using
            End Using
        End Sub
    
    
        ''' <summary>
        ''' Generates and recognizes ISBT 128 barcode use text value.
        ''' </summary>
        Public Shared Sub TestUseTextValue()
            Dim barcodeValue As String = "=+03004=A99981712345600=<S1200100&>0271322359"
    
            ' create barcode writer
            Using writer As New BarcodeWriter()
                ' encode ISBT 128 Data Matrix barcode to writer settings
                BarcodeSymbologySubsets.ISBT128DataMatrix.Encode(barcodeValue, writer.Settings)
    
                ' generate barcode image
                Using barcodeImage As VintasoftBitmap = writer.GetBarcodeAsVintasoftBitmap()
                    ' recognize barcode value
                    Dim recognizedValue As IsbtValueItem = Recognize(barcodeImage)
    
                    ' check value
                    If barcodeValue <> recognizedValue.ToString() Then
                        Throw New ApplicationException()
                    End If
    
                    ' privt value
                    PrintValue(recognizedValue)
                End Using
            End Using
        End Sub
    
    
        ''' <summary>
        ''' Recognizes the ISBT 128 barcode from image.
        ''' </summary>
        ''' <param name="barcodeImage">The barcode image.</param>
        Private Shared Function Recognize(barcodeImage As VintasoftBitmap) As IsbtValueItem
            ' create barcode reader
            Using reader As New BarcodeReader()
                reader.Settings.ScanDirection = ScanDirection.Vertical Or ScanDirection.Horizontal
                reader.Settings.AutomaticRecognition = True
    
                ' specify that ISBT 128 barcode must be recognizeds
                reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.ISBT128)
                reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.ISBT128DataMatrix)
    
                ' recognize barcodes
                Dim info As IBarcodeInfo = reader.ReadBarcodes(barcodeImage)(0)
    
                ' return ISBT 128 value
                Return DirectCast(info, IsbtBarcodeInfo).IsbtValue
            End Using
        End Function
    
        ''' <summary>
        ''' Prints ISBT 128 barcode value.
        ''' </summary>
        ''' <param name="recognizedValue">The recognized value.</param>
        Private Shared Sub PrintValue(recognizedValue As IsbtValueItem)
            ' print value
            Console.WriteLine("Barcode value: " & recognizedValue.ToString())
            Dim value As IsbtDataValue() = recognizedValue.DataValues
            For Each dataValue As IsbtDataValue In value
                Console.WriteLine(String.Format("{0} ({1}): {2}", dataValue.DataStructure.Name, dataValue.DataStructure.Number, dataValue.DataContent))
            Next
        End Sub
    End Class
    
    
    
    using System;
    
    using Vintasoft.Barcode;
    using Vintasoft.Barcode.BarcodeInfo;
    using Vintasoft.Barcode.SymbologySubsets;
    using Vintasoft.Imaging;
    
    class ISBT128DataMatrixExample
    {
        /// <summary>
        /// Generates and recognizes ISBT 128 barcode use value item.
        /// </summary>
        public static void TestUseValueItem()
        {
            // create compound message - 3 data structures
            // 4 - referencing an entry in an ICCBBA maintained table, requires 001, 003, 005 data structures
            IsbtCompoundMessage compoundMessage = new IsbtCompoundMessage(3, 4);
    
            // Donation Identification Number
            IsbtDataValue dataValue001 = IsbtDataStructures.GetDataStructureByNumber(001).Parse("=A99981712345600");
    
            // Product Code
            IsbtDataValue dataValue003 = IsbtDataStructures.GetDataStructureByNumber(003).Parse("=<S1200100");
    
            // Expiration Date
            IsbtDataValue dataValue005 = IsbtDataStructures.GetDataStructureByNumber(005).Parse("&>0271322359");
    
            // create ISBT 128 barcode value
            IsbtValueItem barcodeValue = new IsbtValueItem(compoundMessage, dataValue001, dataValue003, dataValue005);
    
            // create barcode writer
            using (BarcodeWriter writer = new BarcodeWriter())
            {
                // encode ISBT 128 Data Matrix barcode to writer settings
                BarcodeSymbologySubsets.ISBT128DataMatrix.Encode(barcodeValue, writer.Settings);
    
                // generate barcode image
                using (VintasoftBitmap barcodeImage = writer.GetBarcodeAsVintasoftBitmap())
                {
                    // recognize barcode value
                    IsbtValueItem recognizedValue = Recognize(barcodeImage);
    
                    // check value
                    if (barcodeValue.ToString() != recognizedValue.ToString())
                        throw new ApplicationException();
    
                    // privt value
                    PrintValue(recognizedValue);
                }
            }
        }
    
    
        /// <summary>
        /// Generates and recognizes ISBT 128 barcode use text value.
        /// </summary>
        public static void TestUseTextValue()
        {
            string barcodeValue = @"=+03004=A99981712345600=<S1200100&>0271322359";
    
            // create barcode writer
            using (BarcodeWriter writer = new BarcodeWriter())
            {
                // encode ISBT 128 Data Matrix barcode to writer settings
                BarcodeSymbologySubsets.ISBT128DataMatrix.Encode(barcodeValue, writer.Settings);
    
                // generate barcode image
                using (VintasoftBitmap barcodeImage = writer.GetBarcodeAsVintasoftBitmap())
                {
                    // recognize barcode value
                    IsbtValueItem recognizedValue = Recognize(barcodeImage);
    
                    // check value
                    if (barcodeValue != recognizedValue.ToString())
                        throw new ApplicationException();
    
                    // privt value
                    PrintValue(recognizedValue);
                }
            }
        }
    
    
        /// <summary>
        /// Recognizes the ISBT 128 barcode from image.
        /// </summary>
        /// <param name="barcodeImage">The barcode image.</param>
        private static IsbtValueItem Recognize(VintasoftBitmap barcodeImage)
        {
            // create barcode reader
            using (BarcodeReader reader = new BarcodeReader())
            {
                reader.Settings.ScanDirection = ScanDirection.Vertical | ScanDirection.Horizontal;
                reader.Settings.AutomaticRecognition = true;
    
                // specify that ISBT 128 barcode must be recognizeds
                reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.ISBT128);
                reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.ISBT128DataMatrix);
    
                // recognize barcodes
                IBarcodeInfo info = reader.ReadBarcodes(barcodeImage)[0];
    
                // return ISBT 128 value
                return ((IsbtBarcodeInfo)info).IsbtValue;
            }
        }
    
        /// <summary>
        /// Prints ISBT 128 barcode value.
        /// </summary>
        /// <param name="recognizedValue">The recognized value.</param>
        private static void PrintValue(IsbtValueItem recognizedValue)
        {
            // print value
            Console.WriteLine("Barcode value: " + recognizedValue.ToString());
            IsbtDataValue[] value = recognizedValue.DataValues;
            foreach (IsbtDataValue dataValue in value)
            {
                Console.WriteLine(string.Format("{0} ({1}): {2}", dataValue.DataStructure.Name, dataValue.DataStructure.Number, dataValue.DataContent));
            }
        }
    }
    
    

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также