Beispiel #1
0
            public void Обработать()
            {
                FixedFileEngine   engine      = new FixedFileEngine(typeof(InvoiceImport));
                InvoiceImport     data        = (InvoiceImport)engine.ReadString(Буфер)[0];
                IObjectSpace      os          = CommonMethods.FindObjectSpaceByObject(this);
                fmCAVTInvoiceType sf_sfz_type = os.GetObjects <fmCAVTInvoiceType>().First(x => x.Prefix == "Z");

                СтрокаОснов.ProcessLine(os, this, data, sf_sfz_type);
            }
Beispiel #2
0
        public static void Run(
            [BlobTrigger("stations/import/{name}", Connection = "StationStorage")] Stream importBlob,
            string name,
            [Queue("station-imports", Connection = "StationStorage")] CloudQueue outputQueue,
            TraceWriter log)
        {
            log.Info($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {importBlob.Length} Bytes");

            //read file
            var file = new StreamReader(importBlob);

            StringBuilder sb = new StringBuilder();
            string        fileLine;

            while ((fileLine = file.ReadLine()) != null)
            {
                if (!fileLine.ToLower().StartsWith("a") || fileLine.ToLower().Contains("file-spec"))
                {
                    continue;
                }

                sb.AppendLine(fileLine);
            }

            file.Close();

            // parse lines
            var engine = new FixedFileEngine <StationImportModel>();

            StationImportModel[] stationImportModels = engine.ReadString(sb.ToString());
            log.Info($"Parsed {stationImportModels.Length} stations.");

            // add to queue
            foreach (var stationImportModel in stationImportModels)
            {
                outputQueue.AddMessage(new CloudQueueMessage(JsonConvert.SerializeObject(stationImportModel)), TimeSpan.FromMinutes(10));
                log.Info($"Station {stationImportModel.StationName} added to queue.");
            }
        }
Beispiel #3
0
        static public void ImportInvoices(IObjectSpace os, ДокИмпортОснований док, TextReader reader)
        {
            FixedFileEngine engine = new FixedFileEngine(typeof(InvoiceImport));
            String          line;

            os.Delete(док.Основания);
            fmCAVTInvoiceType sf_sfz_type = os.GetObjects <fmCAVTInvoiceType>().First(x => x.Prefix == "Z");

            while ((line = reader.ReadLine()) != null)
            {
                InvoiceImport data = (InvoiceImport)engine.ReadString(line)[0];
                if (data.SF_IO_TYPE.Trim() == String.Empty)
                {
                    continue;
                }
                СтрокаОснов строка = os.CreateObject <СтрокаОснов>();
                док.Основания.Add(строка);
                строка.БуферУст(line);
                СтрокаОснов.ImportLine(os, строка, data);
                СтрокаОснов.ProcessLine(os, строка, data, sf_sfz_type);
            }
            reader.Close();
        }