IsolatedFunctions.cs
1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Sungero.Core;
using Sungero.Docflow.Structures.Module;
namespace Sungero.Docflow.Isolated.BarcodeParser
{
public class IsolatedFunctions
{
/// <summary>
/// Поиск ИД документа по штрихкодам.
/// </summary>
/// <param name="document">Документ.</param>
/// <param name="formattedTenantId">Имя тенанта в формате, нужном при подстановке в штрих-код.</param>
/// <returns>Список распознанных ИД документа.</returns>
/// <remarks>
/// Поиск штрихкодов осуществляется только на первой странице документа.
/// Формат штрихкода: Code128.
/// </remarks>
[Public]
public virtual List<long> SearchDocumentBarcodeIds(System.IO.Stream document, string formattedTenantId)
{
var barcodeParser = this.CreateBarcodeParser();
var documentBarcodes = barcodeParser.GetDocumentBarcodes(document);
return barcodeParser.ParseDocumentIds(documentBarcodes, formattedTenantId);
}
/// <summary>
/// Создать средство поиска штрих-кодов в документе.
/// </summary>
/// <returns>Средство поиска штрих-кодов в документе.</returns>
public virtual Sungero.Docflow.Isolated.BarcodeParser.Parser CreateBarcodeParser()
{
return new BarcodeParser.Parser();
}
}
}