Exemplo n.º 1
0
        protected virtual List<InputFile[]> getInputFilesFromJobDocuments(JobDocument[] jds)
        {
            List<InputFile[]> list = new List<InputFile[]>(jds.Count());

            foreach (JobDocument jd in jds)
            {
                List<InputFile> inputFiles = new List<InputFile>();
                OutputDocument od = jd.OutputDocuments[0];
                FileContainer file = od.Files[0];
                InputFile inputFile = new InputFile();
                inputFile.OutputDocuments = jd.OutputDocuments;
                inputFile.Id = jd.CustomText;
                inputFile.FileData = file;
                inputFiles.Add(inputFile);

                list.Add(inputFiles.ToArray());
            }
            return list;
        }
Exemplo n.º 2
0
        //test meth
        //private void uploadResultonDisc(JobDocument[] jds)
        //{
        //    foreach (JobDocument jd in jds)
        //    {
        //        OutputDocument od = jd.OutputDocuments[0];
        //        FileContainer file = od.Files[0];
        //        String filename= jd.CustomText + ".tiff";
        //        byte[] content = file.FileContents;
        //        Utils.saveToFileSystem(content, filename);
        //    }
        //}
        protected override List<InputFile[]> getInputFilesFromJobDocuments(JobDocument[] jds)
        {
            var vs = jds.Select(jd => jd.CustomText.Substring(0, 7)).Distinct();
            List<JobDocument[]> jdaList = new List<JobDocument[]>(vs.Count());

            foreach (var v in vs)
            {
                IEnumerable<JobDocument> x = jds.Where(j => j.CustomText.StartsWith(v));
                jdaList.Add(x.ToArray());
            }

            List<InputFile[]> list = new List<InputFile[]>(jdaList.Count());

            foreach (JobDocument[] jda in jdaList)
            {
                List<InputFile> inputFiles = new List<InputFile>();
                foreach (JobDocument jd in jda)
                {
                    OutputDocument od = jd.OutputDocuments[0];
                    FileContainer file = od.Files[0];
                    InputFile inputFile = new InputFile();
                    inputFile.OutputDocuments = jd.OutputDocuments;
                    inputFile.Id = jd.CustomText;
                    inputFile.FileData = file;
                    inputFiles.Add(inputFile);
                }
                list.Add(inputFiles.ToArray());
            }
            return list;
        }
Exemplo n.º 3
0
 protected virtual void addResultToRecognizedContentList(JobDocument[] jds)
 {
     foreach (JobDocument jd in jds)
     {
         byte[] content = jd.OutputDocuments[0].Files[0].FileContents;
         if (content == null || content.Length == 0)
         {
             log.Warn("Recognized content of object " + record.objectId + " is 0 bytes long.");
             continue;
         }
         if (recognizedContent.Keys.Contains(this.record.objectId))
         {
             List<byte[]> p = recognizedContent.Single(x => x.Key == record.objectId).Value;
             p.Add(content);
         }
         else
         {
             List<byte[]> p = new List<byte[]>();
             p.Add(content);
             recognizedContent.Add(record.objectId, p);
         }
     }
 }
Exemplo n.º 4
0
 //public bool proceedRecord(AbbyyRSWrapper abbyyRs)
 //{
 //    abbyyRs.setTimeout(60000);
 //    List<InputFile[]> inputFiles = getInputFilesFromRecord(this.record.content);
 //    JobDocument[] jds = null;
 //    List<ExportSettings> exportSettingsList = getExportSettings(this.record.workTypeId);
 //    int i = 0;
 //    foreach (ExportSettings es in exportSettingsList)
 //    {
 //        i++;
 //        foreach (InputFile[] infile in inputFiles)
 //        {
 //            XmlTicket ticket = getManager().getAbbyService().createTicket(es);
 //            if (ticket == null) return false;
 //            ticket.InputFiles = infile;
 //            jds = abbyyRs.processTicket(ticket, this.record, es.workFlowName);
 //            if (jds == null) return false;
 //            if (i<exportSettingsList.Count())
 //            {
 //                //uploadResultonDisc(jd);
 //                inputFiles = getInputFilesFromJobDocuments(jds);
 //            }
 //            else
 //            {
 //                addResultToRecognizedContentList(jds);
 //            }
 //        }
 //    }
 //    return true;
 //}
 protected override void addResultToRecognizedContentList(JobDocument[] jds)
 {
     foreach (JobDocument jd in jds)
     {
         String barcode = jd.CustomText;
         byte[] content = jd.OutputDocuments[0].Files[0].FileContents;
         if (recognizedContent.Keys.Contains(barcode))
         {
             log.Warn("Recognized content contains duplicate barcode result sets."); //TODO: Сделать добавление обоих результатов, на случай добавления как вложений в составной документ
             continue;
         }
         recognizedContent.Add(barcode, content);
     }
 }