SLLTools.json file and DailyReportInfo.json file automatically clear the first time it runs on Monday, and fixed bug when scrap is resolved as null.
This commit is contained in:
parent
11a24b26a0
commit
62df6323d0
@ -12,11 +12,49 @@ public static class DailyReportHelper
|
||||
public static DailyReport SetUpDailyReport(ILogger logger, string baseUrlScrapeDb)
|
||||
{
|
||||
DailyReport report = new();
|
||||
DateTime currentDateTime = DateTime.Now;
|
||||
|
||||
try
|
||||
{
|
||||
report.SLLTools = JsonFileHandler.LoadJSONFile<List<SLLTool>>(_SLLFilePath);
|
||||
report.ManualReportEntries = JsonFileHandler.LoadJSONFile<ManualReportEntries>(_dailyRptFilePath);
|
||||
List<SLLTool> tools = JsonFileHandler.LoadJSONFile<List<SLLTool>>(_SLLFilePath);
|
||||
ManualReportEntries manualEntries = JsonFileHandler.LoadJSONFile<ManualReportEntries>(_dailyRptFilePath);
|
||||
|
||||
if (currentDateTime.DayOfWeek == DayOfWeek.Monday && tools[tools.Count - 1].Date == currentDateTime.Date.AddDays(-1))
|
||||
report.SLLTools = new List<SLLTool>();
|
||||
else
|
||||
report.SLLTools = tools;
|
||||
|
||||
if (currentDateTime.Date > manualEntries.Date)
|
||||
{
|
||||
string weeklyPtChng;
|
||||
|
||||
if (currentDateTime.DayOfWeek == DayOfWeek.Monday)
|
||||
weeklyPtChng = null;
|
||||
else
|
||||
weeklyPtChng = manualEntries.WeeklyPartChanges;
|
||||
|
||||
report.ManualReportEntries = new ManualReportEntries()
|
||||
{
|
||||
Date = currentDateTime.Date,
|
||||
OperatorHeadcountDays = 0,
|
||||
OperatorHeadcountNights = 0,
|
||||
OperatorCallOutsDays = 0,
|
||||
OperatorCallOutsNights = 0,
|
||||
MaintenanceHeadcountDays = 0,
|
||||
MaintenanceHeadcountNights = 0,
|
||||
MaintenanceCallOutsDays = 0,
|
||||
MaintenanceCallOutsNights = 0,
|
||||
EngineeringHeadcountDays = 0,
|
||||
EngineeringHeadcountNights = 0,
|
||||
EngineeringCallOutsDays = 0,
|
||||
EngineeringCallOutsNights = 0,
|
||||
BottleChanges = null,
|
||||
DailyPartChanges = null,
|
||||
WeeklyPartChanges = weeklyPtChng
|
||||
};
|
||||
}
|
||||
else
|
||||
report.ManualReportEntries = manualEntries;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -75,7 +113,7 @@ public static class DailyReportHelper
|
||||
foreach (Reactor reactor in reactors)
|
||||
{
|
||||
toolEvents.Add(ApiCaller.GetApi<List<ReactorEvent>>(baseUrlScrapeDb + "ReactorEvents?startDate=" + report.StartDate.ToString() +
|
||||
"&endDate=" + DateTime.Now.ToString() + "&reactorNumber=" + reactor.ReactorNumber + "&reactorType=" + reactor.Type));
|
||||
"&endDate=" + currentDateTime.ToString() + "&reactorNumber=" + reactor.ReactorNumber + "&reactorType=" + reactor.Type));
|
||||
|
||||
lastUpTransactions.Add(reactor.ReactorNumber.ToString(),
|
||||
ApiCaller.GetApi<int>(baseUrlScrapeDb + "GetLastUpTransaction?reactorNumber=" + reactor.ReactorNumber));
|
||||
@ -91,13 +129,13 @@ public static class DailyReportHelper
|
||||
metrologyEvents.Add(ApiCaller.GetApi<ToolEvent>(baseUrlScrapeDb + "ToolEvents?toolID=" + tool));
|
||||
}
|
||||
|
||||
task1 = ApiCaller.GetApi<YieldInformation>(baseUrlScrapeDb + "ReactorOuts?startDate=" + report.StartDate.ToString() + "&endDate=" + DateTime.Now.ToString());
|
||||
task1 = ApiCaller.GetApi<YieldInformation>(baseUrlScrapeDb + "ReactorOuts?startDate=" + report.StartDate.ToString() + "&endDate=" + currentDateTime.ToString());
|
||||
task2 = ApiCaller.GetApi<YieldInformation>(baseUrlScrapeDb + "ReactorOuts?startDate=" + report.StartDate.AddDays(-7).ToString() + "&endDate=" + report.StartDate.ToString());
|
||||
task3 = ApiCaller.GetApi<DateTime>(baseUrlScrapeDb + "GetQuarterStartDate");
|
||||
targets = ApiCaller.GetApi<QuarterlyTargets>(baseUrlScrapeDb + "Targets");
|
||||
|
||||
rds = ApiCaller.GetApi<List<RDS>>(baseUrlScrapeDb + "RDS?date=" + report.StartDate.ToString());
|
||||
task4 = ApiCaller.GetApi<OutsAndScrapTotal>(baseUrlScrapeDb + "GetOutsAndScrapTotals?startDate=" + task3.Result + "&endDate=" + DateTime.Now.ToString());
|
||||
task4 = ApiCaller.GetApi<OutsAndScrapTotal>(baseUrlScrapeDb + "GetOutsAndScrapTotals?startDate=" + task3.Result + "&endDate=" + currentDateTime.ToString());
|
||||
task5 = ApiCaller.GetApi<OutsAndScrapTotal>(baseUrlScrapeDb + "GetOutsAndScrapTotals?startDate=" + task3.Result + "&endDate=" + report.StartDate.ToString());
|
||||
task6 = ApiCaller.GetApi<OutsAndScrapTotal>(baseUrlScrapeDb + "GetOutsAndScrapTotals?startDate=" + task3.Result + "&endDate=" + report.StartDate.AddDays(-7).ToString());
|
||||
}
|
||||
@ -115,7 +153,7 @@ public static class DailyReportHelper
|
||||
foreach (Task<List<ReactorEvent>> task in toolEvents)
|
||||
{
|
||||
ToolEventView toolEvent = new(task.Result,
|
||||
report.StartDate.ToString(), DateTime.Now.ToString(), task.Result[0].REACT_NO,
|
||||
report.StartDate.ToString(), currentDateTime.ToString(), task.Result[0].REACT_NO,
|
||||
reactors.FirstOrDefault(x => x.ReactorNumber == int.Parse(task.Result[0].REACT_NO)).Type);
|
||||
|
||||
toolEvent.SetDowntime(lastUpTransactions[toolEvent.Reactor].Result);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
public class ManualReportEntries
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
public int OperatorHeadcountDays { get; set; }
|
||||
public int OperatorHeadcountNights { get; set; }
|
||||
public int OperatorCallOutsDays { get; set; }
|
||||
|
@ -86,16 +86,22 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read() && reader[0].ToString() != "1/1/1900 12:00:00 AM")
|
||||
{
|
||||
int twProd = string.IsNullOrEmpty(reader[3].ToString()) ? 0 : int.Parse(reader[3].ToString());
|
||||
int custScrap = string.IsNullOrEmpty(reader[1].ToString()) ? 0 : int.Parse(reader[1].ToString());
|
||||
int manuScrap = string.IsNullOrEmpty(reader[2].ToString()) ? 0 : int.Parse(reader[2].ToString());
|
||||
int totScrap = custScrap + manuScrap;
|
||||
|
||||
scrap.Add(new ScrapByDay
|
||||
{
|
||||
StartDate = reader[0].ToString(),
|
||||
TW_PROD = int.Parse(reader[3].ToString()),
|
||||
TOT_REJ_CUST = int.Parse(reader[1].ToString()),
|
||||
TOT_REJ_MANU = int.Parse(reader[2].ToString()),
|
||||
TOT_REJ_WFRS =
|
||||
int.Parse(reader[1].ToString()) + int.Parse(reader[2].ToString())
|
||||
TW_PROD = twProd,
|
||||
TOT_REJ_CUST = custScrap,
|
||||
TOT_REJ_MANU = manuScrap,
|
||||
TOT_REJ_WFRS = totScrap
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
|
||||
|
@ -52,6 +52,8 @@ public class ProductionReportController : Controller
|
||||
[HttpPost]
|
||||
public IActionResult EditDailyReport(ManualReportEntries rpt)
|
||||
{
|
||||
rpt.Date = DateTime.Now.Date;
|
||||
|
||||
JsonFileHandler.SaveJSONFile(rpt, _dailyRptFilePath);
|
||||
|
||||
return RedirectToAction("DailyReport");
|
||||
|
@ -417,7 +417,7 @@
|
||||
<td></td>
|
||||
}
|
||||
}
|
||||
<td>@(ASMSLL / numberOfDaysInWeek)</td>
|
||||
<td>@(Math.Round((double)ASMSLL / (double)numberOfDaysInWeek))</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -437,7 +437,7 @@
|
||||
<td></td>
|
||||
}
|
||||
}
|
||||
<td>@(HTRSLL / numberOfDaysInWeek)</td>
|
||||
<td>@(Math.Round((double)HTRSLL / (double)numberOfDaysInWeek))</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -455,7 +455,7 @@
|
||||
<td></td>
|
||||
}
|
||||
}
|
||||
<td>@(ASMUnloadTemps / numberOfDaysInWeek)</td>
|
||||
<td>@(Math.Round((double)ASMUnloadTemps / (double)numberOfDaysInWeek))</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -473,7 +473,7 @@
|
||||
<td></td>
|
||||
}
|
||||
}
|
||||
<td>@(HTRUnloadTemps / numberOfDaysInWeek)</td>
|
||||
<td>@(Math.Round((double)HTRUnloadTemps / (double)numberOfDaysInWeek))</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -1 +1 @@
|
||||
{"OperatorHeadcountDays":0,"OperatorHeadcountNights":0,"OperatorCallOutsDays":0,"OperatorCallOutsNights":0,"EngineeringHeadcountDays":0,"EngineeringHeadcountNights":0,"EngineeringCallOutsDays":0,"EngineeringCallOutsNights":0,"MaintenanceHeadcountDays":0,"MaintenanceHeadcountNights":0,"MaintenanceCallOutsDays":0,"MaintenanceCallOutsNights":0,"BottleChanges":null,"DailyPartChanges":null,"WeeklyPartChanges":null}
|
||||
{"Date":"2023-01-15T00:00:00-07:00","OperatorHeadcountDays":14,"OperatorHeadcountNights":12,"OperatorCallOutsDays":0,"OperatorCallOutsNights":1,"EngineeringHeadcountDays":1,"EngineeringHeadcountNights":1,"EngineeringCallOutsDays":0,"EngineeringCallOutsNights":0,"MaintenanceHeadcountDays":3,"MaintenanceHeadcountNights":3,"MaintenanceCallOutsDays":0,"MaintenanceCallOutsNights":0,"BottleChanges":"R22","DailyPartChanges":"R23,R25","WeeklyPartChanges":"R23,R25,R27,R29,R36,R37"}
|
@ -1 +1,37 @@
|
||||
[{"Date":"2023-01-09T00:00:00-07:00","ASM":8,"HTR":16},{"Date":"2023-01-10T00:00:00-07:00","ASM":8,"HTR":16},{"Date":"2023-01-11T00:00:00-07:00","ASM":8,"HTR":16},{"Date":"2023-01-12T00:00:00-07:00","ASM":7,"HTR":16},{"Date":"2023-01-13T00:00:00-07:00","ASM":7,"HTR":15}]
|
||||
[
|
||||
{
|
||||
"Date": "2023-01-09T00:00:00-07:00",
|
||||
"ASM": 8,
|
||||
"HTR": 16
|
||||
},
|
||||
{
|
||||
"Date": "2023-01-10T00:00:00-07:00",
|
||||
"ASM": 8,
|
||||
"HTR": 16
|
||||
},
|
||||
{
|
||||
"Date": "2023-01-11T00:00:00-07:00",
|
||||
"ASM": 8,
|
||||
"HTR": 16
|
||||
},
|
||||
{
|
||||
"Date": "2023-01-12T00:00:00-07:00",
|
||||
"ASM": 7,
|
||||
"HTR": 16
|
||||
},
|
||||
{
|
||||
"Date": "2023-01-13T00:00:00-07:00",
|
||||
"ASM": 7,
|
||||
"HTR": 15
|
||||
},
|
||||
{
|
||||
"Date": "2023-01-14T00:00:00-07:00",
|
||||
"ASM": 8,
|
||||
"HTR": 15
|
||||
},
|
||||
{
|
||||
"Date": "2023-01-15T00:00:00-07:00",
|
||||
"ASM": 9,
|
||||
"HTR": 15
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user