Added Open NCR report.
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ReportingServices.Shared.Models.PlanningReport;
|
||||
using ReportingServices.Shared.Models.ProductionReport;
|
||||
using System.Data;
|
||||
@ -767,4 +768,44 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
public List<NCR> GetCurrentNCRs()
|
||||
{
|
||||
List<NCR> ncrs = new();
|
||||
|
||||
OpenConnection();
|
||||
|
||||
SqlCommand cmd = _connection.CreateCommand();
|
||||
|
||||
string query = "SELECT l.ENTRY_DATE, " +
|
||||
" l.SHIFT, " +
|
||||
" l.REACTOR, " +
|
||||
" n.CASS_ID_SAP AS RDS_NO, " +
|
||||
" l.TOT_REJ, n.AC_DESC " +
|
||||
" FROM [NCR List] l, NCR n " +
|
||||
" WHERE l.STATUS = 'Open' " +
|
||||
" AND l.SEQ = n.SEQ";
|
||||
|
||||
cmd.CommandText = query;
|
||||
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
ncrs.Add(new NCR
|
||||
{
|
||||
ENTRY_DATE = DateTime.Parse(reader[0].ToString()),
|
||||
SHIFT = reader[1].ToString(),
|
||||
REACTOR = reader[2].ToString(),
|
||||
RDS_NO = reader[3].ToString(),
|
||||
TOT_REJ = string.IsNullOrEmpty(reader[4].ToString()) ? 0 : int.Parse(reader[4].ToString()),
|
||||
AC_DESC = reader[5].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
|
||||
CloseConnection();
|
||||
|
||||
return ncrs;
|
||||
}
|
||||
}
|
@ -24,4 +24,5 @@ public interface IScrapeDatabaseRepository
|
||||
public List<ScheduledEvent> GetScheduledEvents(string startDate, string endDate);
|
||||
public List<ReactorPSNWORuns> GetReactorPartChanges(string startDate, string endDate);
|
||||
public List<ReactorPSNWORuns> GetProjectedPartChanges(string startDate, string endDate);
|
||||
public List<NCR> GetCurrentNCRs();
|
||||
}
|
Reference in New Issue
Block a user