Simplified Manual Report Entry

This commit is contained in:
Daniel Wathen
2023-01-04 16:34:31 -07:00
parent 83525d0149
commit 81f7e1a57b
9 changed files with 54 additions and 44 deletions

View File

@ -8,7 +8,6 @@ namespace ReportingServices.UI.Controllers
public class ProductionReportController : Controller
{
private readonly ILogger<ProductionReportController> _logger;
private readonly int _reportIndex = (int)DateTime.Now.DayOfWeek;
private readonly string _dailyRptFilePath = "wwwroot/Assets/DailyReportInfo.json";
private readonly string _toolStateOwnerFilePath = "wwwroot/Assets/ToolStates.json";
@ -44,24 +43,15 @@ namespace ReportingServices.UI.Controllers
public IActionResult EditDailyReport()
{
Dictionary<string, List<ManualReportEntries>> entries = JsonFileHandler.LoadJSONFile<Dictionary<string, List<ManualReportEntries>>>(_dailyRptFilePath);
ManualReportEntries entries = JsonFileHandler.LoadJSONFile<ManualReportEntries>(_dailyRptFilePath);
ManualReportEntries rpt = entries["Current Week"][_reportIndex];
return View(rpt);
return View(entries);
}
[HttpPost]
public IActionResult EditDailyReport(ManualReportEntries rpt)
{
Dictionary<string, List<ManualReportEntries>> report = JsonFileHandler.LoadJSONFile<Dictionary<string, List<ManualReportEntries>>>(_dailyRptFilePath);
rpt.Date = DateTime.Parse(DateTime.Now.ToShortDateString());
rpt.Day = DateTime.Now.DayOfWeek;
report["Current Week"][_reportIndex] = rpt;
JsonFileHandler.SaveJSONFile(report, _dailyRptFilePath);
JsonFileHandler.SaveJSONFile(rpt, _dailyRptFilePath);
return RedirectToAction("DailyReport");
}

View File

@ -14,7 +14,7 @@
int numberOfDaysInWeek = Model.CurrentWeek.OutsByDay.Count;
ManualReportEntries rpt = Model.CurrentEntries[reportIndex];
ManualReportEntries rpt = Model.ManualReportEntries;
string myClass;
List<string> toolsDownGreaterThan12Hours = new();
@ -348,18 +348,16 @@
<td scope="row">ASMs SLL Tool Count</td>
@for (int i = 0; i < 7; i++)
{
int index = i == 6 ? 0 : i + 1;
if (@Model.CurrentEntries[index].ASMSingleLoadLock != 0)
if (i < Model.SLLTools.Count())
{
<td>@Model.CurrentEntries[index].ASMSingleLoadLock</td>
<td>@Model.SLLTools[i].ASM</td>
ASMSLL += @Model.SLLTools[i].ASM;
}
else
{
<td></td>
}
ASMSLL += @Model.CurrentEntries[index].ASMSingleLoadLock;
}
<td>@(ASMSLL / numberOfDaysInWeek)</td>
<td>0</td>
@ -370,16 +368,16 @@
{
int index = i == 6 ? 0 : i + 1;
if (@Model.CurrentEntries[index].HTRSingleLoadLock != 0)
if (i < Model.SLLTools.Count())
{
<td>@Model.CurrentEntries[index].HTRSingleLoadLock</td>
<td>@Model.SLLTools[i].HTR</td>
HTRSLL += @Model.SLLTools[i].HTR;
}
else
{
<td></td>
}
HTRSLL += @Model.CurrentEntries[index].HTRSingleLoadLock;
}
<td>@(HTRSLL / numberOfDaysInWeek)</td>
<td>0</td>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
[{"Date":"2023-01-02T00:00:00","ASM":5,"HTR":12},{"Date":"2023-01-03T00:00:00","ASM":6,"HTR":14},{"Date":"2023-01-04T00:00:00","ASM":7,"HTR":15}]