/// <summary> /// /// </summary> /// <returns></returns> public Data PrepearingData() { //Импортируем данные из эксель. NomenclaturesList = _dataService.Import <Nomenclature>(_filesSettings.NomenclatureFile).ToList(); MachinesList = _dataService.Import <Machine>(_filesSettings.MachinesFile).ToList(); TimesList = _dataService.Import <Time>(_filesSettings.TimesFile).ToList(); var batches = _dataService.Import <Batch>(_filesSettings.BatchesFile).ToList(); //Заполняем очередь партий, проставляем ссылки на нужные объекты при необходимости. batches.ForEach(b => b.Nomenclature = NomenclaturesList.Find(n => n.Id == b.NomenclatureId)); BatchesQueue = new Queue <Batch>(batches); TimesList.ForEach(t => t.Nomenclature = NomenclaturesList.Find(n => n.Id == t.Nomenclatureid)); foreach (var machine in MachinesList) { var times = TimesList.Where(tl => tl.MachineId == machine.Id); machine.TimeDictionary = times.ToDictionary(t => t.Nomenclatureid, o => o.OperationTime); } var data = new Data(MachinesList, BatchesQueue); Log.Information("Данные подготовлены."); //Возвращаем подготовленные данные. return(data); }
public async Task <IActionResult> RunAsync( [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); await Task.Run(() => _service.Import()); return(new NoContentResult()); }
public async Task RunAsync([TimerTrigger("0 0 3 * * *")] TimerInfo myTimer, ILogger log) { log.LogInformation($"ImportData Timer trigger function executed at: {DateTime.UtcNow}"); await Task.Run(() => _service.Import()); }