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

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

    Пример

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

    
    
    Imports Vintasoft.Barcode
    Imports Vintasoft.Barcode.BarcodeInfo
    Imports Vintasoft.Barcode.SymbologySubsets
    Imports Vintasoft.Imaging
    
    Class ISBT128DonorGlobalRegistrationIdentifierExample
        ''' <summary>
        ''' Generates and recognizes ISBT 128 barcode that contains Global Registration Identifier for Donors (Data Structure 039).
        ''' </summary>
        Public Shared Sub Test()
            ' create  ISBT Global Registration Identifier for Donors (Data Structure 039),
            ' checksum calculates automatically
            Dim donorGlobalRegistrationIdentifier As New IsbtDonorGlobalRegistrationIdentifier(1012, "ABCDEF1234567")
    
            ' create ISBT 128 barcode value
            Dim barcodeValue As New IsbtValueItem(donorGlobalRegistrationIdentifier)
    
            ' create barcode writer
            Using writer As New BarcodeWriter()
                ' encode ISBT 128 barcode to writer settings
                BarcodeSymbologySubsets.ISBT128.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>
        ''' 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
                If TypeOf dataValue Is IsbtDonorGlobalRegistrationIdentifier Then
                    Dim donorGlobalRegistrationIdentifier As IsbtDonorGlobalRegistrationIdentifier = DirectCast(dataValue, IsbtDonorGlobalRegistrationIdentifier)
                    Console.WriteLine(String.Format("{0} ({1}):", dataValue.DataStructure.Name, dataValue.DataStructure.Number))
                    Console.WriteLine(String.Format("   GRID Issuing Organization Number: {0}", donorGlobalRegistrationIdentifier.GRIDIssuingOrganizationNumber))
                    Console.WriteLine(String.Format("   Registration Donor Identifier:    {0}", donorGlobalRegistrationIdentifier.RegistrationDonorIdentifier))
                    Console.WriteLine(String.Format("   Checksum:                         {0}", donorGlobalRegistrationIdentifier.Checksum))
                Else
                    Console.WriteLine(String.Format("{0} ({1}): {2}", dataValue.DataStructure.Name, dataValue.DataStructure.Number, dataValue.DataContent))
                End If
            Next
        End Sub
    End Class
    
    
    
    using System;
    
    using Vintasoft.Barcode;
    using Vintasoft.Barcode.BarcodeInfo;
    using Vintasoft.Barcode.SymbologySubsets;
    using Vintasoft.Imaging;
    
    class ISBT128DonorGlobalRegistrationIdentifierExample
    {
        /// <summary>
        /// Generates and recognizes ISBT 128 barcode that contains Global Registration Identifier for Donors (Data Structure 039).
        /// </summary>
        public static void Test()
        {
            // create  ISBT Global Registration Identifier for Donors (Data Structure 039),
            // checksum calculates automatically
            IsbtDonorGlobalRegistrationIdentifier donorGlobalRegistrationIdentifier = new IsbtDonorGlobalRegistrationIdentifier(1012, "ABCDEF1234567");
    
            // create ISBT 128 barcode value
            IsbtValueItem barcodeValue = new IsbtValueItem(donorGlobalRegistrationIdentifier);
    
            // create barcode writer
            using (BarcodeWriter writer = new BarcodeWriter())
            {
                // encode ISBT 128 barcode to writer settings
                BarcodeSymbologySubsets.ISBT128.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>
        /// 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)
            {
                if (dataValue is IsbtDonorGlobalRegistrationIdentifier)
                {
                    IsbtDonorGlobalRegistrationIdentifier donorGlobalRegistrationIdentifier = (IsbtDonorGlobalRegistrationIdentifier)dataValue;
                    Console.WriteLine(string.Format("{0} ({1}):", dataValue.DataStructure.Name, dataValue.DataStructure.Number));
                    Console.WriteLine(string.Format("   GRID Issuing Organization Number: {0}", donorGlobalRegistrationIdentifier.GRIDIssuingOrganizationNumber));
                    Console.WriteLine(string.Format("   Registration Donor Identifier:    {0}", donorGlobalRegistrationIdentifier.RegistrationDonorIdentifier));
                    Console.WriteLine(string.Format("   Checksum:                         {0}", donorGlobalRegistrationIdentifier.Checksum));
                }
                else
                {
                    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

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