Added Hold Report to the production reports.

This commit is contained in:
Daniel Wathen
2023-01-16 12:28:48 -07:00
parent bbd396c25e
commit 9525355b55
8 changed files with 124 additions and 6 deletions

View File

@ -19,7 +19,7 @@ public static class DailyReportHelper
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))
if (currentDateTime.DayOfWeek == DayOfWeek.Monday && tools[^1].Date == currentDateTime.Date.AddDays(-1))
report.SLLTools = new List<SLLTool>();
else
report.SLLTools = tools;

View File

@ -0,0 +1,18 @@
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport;
public class HoldLot
{
[JsonPropertyName("WO_NO")]
public string WO_NO { get; set; }
[JsonPropertyName("HOLD_DATE")]
public DateTime HOLD_DATE { get; set; }
[JsonPropertyName("HOLD_USER")]
public string HOLD_USER { get; set; }
[JsonPropertyName("HOLD_REASON")]
public string HOLD_REASON { get; set; }
[JsonPropertyName("RDS_NO")]
public string RDS_NO { get; set; }
[JsonPropertyName("REACTOR")]
public string REACTOR { get; set; }
}

View File

@ -523,4 +523,48 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository
return date;
}
public List<HoldLot> GetCurrentHoldLots()
{
List<HoldLot> lots = new();
OpenConnection();
SqlCommand cmd = _connection.CreateCommand();
string query = "SELECT WO_NO, " +
" HOLD_START_DTM, " +
" HOLD_START_USER, " +
" HOLD_START_REASON, " +
" SEQ, " +
" REACTOR " +
" FROM WO_MAT_HOLD_HISTORY, RDS " +
" WHERE HOLD_STOP_DTM = '1/1/1900' " +
" AND HOLD_START_DTM > '1/1/2022' " +
" AND HOLD_ENTITY_ID = SEQ " +
"ORDER BY HOLD_START_DTM ASC";
cmd.CommandText = query;
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
lots.Add(new HoldLot
{
WO_NO = reader[0].ToString(),
HOLD_DATE = DateTime.Parse(reader[1].ToString()),
HOLD_USER = reader[2].ToString(),
HOLD_REASON = reader[3].ToString(),
RDS_NO = reader[4].ToString(),
REACTOR = reader[5].ToString(),
});
}
cmd.Dispose();
CloseConnection();
return lots;
}
}

View File

@ -19,4 +19,5 @@ public interface IScrapeDatabaseRepository
public int GetLastUpTransaction(string reactorNumber);
public OutsAndScrapTotal GetOutsAndScrapTotals(string startDate, string endDate);
public DateTime GetQuarterStartDate();
public List<HoldLot> GetCurrentHoldLots();
}