public async Task <IActionResult> SendEosReport( string dept, DateTime shiftDate, string shift ) { if (dept == null) { throw new ArgumentNullException(nameof(dept)); } try { dept = dept.ToLower(); if (dept != "anodize" && dept != "skirt coat" && dept != "assembly") { return(Ok( await _kpiService .SendEosReport(dept, shiftDate, shift) .ConfigureAwait(false) )); } //var anodize = await _kpiService.GetEndOfShiftListDto("Anodize", shiftDate, shift).ConfigureAwait(false); //var sc = await _kpiService.GetEndOfShiftListDto("Skirt Coat", shiftDate, shift).ConfigureAwait(false); var assembly = await _kpiService .GetEndOfShiftListDto("Assembly", shiftDate, shift) .ConfigureAwait(false); //if (!anodize.Any()) throw new OperationCanceledException(EosErrorMsg("Anodize")); //if (!sc.Any()) throw new OperationCanceledException(EosErrorMsg("Skirt Coat")); if (!assembly.Any()) { throw new OperationCanceledException(EosErrorMsg("Assembly")); } //if (anodize.Any()) //{ // await _kpiService.SendEosReport(anodize, "Anodize", shiftDate, shift).ConfigureAwait(false); //} //if (sc.Any()) //{ // await _kpiService.SendEosReport(sc, "Skirt Coat", shiftDate, shift).ConfigureAwait(false); //} if (assembly.Any()) { await _kpiService .SendEosReport(assembly, "Assembly", shiftDate, shift) .ConfigureAwait(false); } return(Ok(true)); } catch (Exception e) { return(BadRequest(_env.IsDevelopment() ? e.StackTrace : e.Message)); } }