Helium Pressure Report

This commit is contained in:
Stoyan Zlatev
2023-04-06 17:02:58 +02:00
parent 220308088f
commit c4b9933eb0
24 changed files with 736 additions and 44 deletions
@@ -13,7 +13,7 @@
public DbContext(string connectionString)
=> this.connectionString = connectionString;
public IEnumerable<T> AsEnumerable<T>(string query, Action<IParameterCollection> parameters, Func<ISqlReader, T> reader)
public IEnumerable<T> AsEnumerable<T>(string query, Action<ParameterCollection> parameters, Func<ISqlReader, T> reader)
{
using (var sqlConnection = new SqlConnection(this.connectionString))
{
@@ -23,13 +23,13 @@
{
sqlCommand.CommandText = query;
parameters(new ParameterCollection(sqlCommand.Parameters));
parameters(sqlCommand.Parameters);
using (var sqlDataReader = sqlCommand.ExecuteReader())
using (SqlReader sqlReader = sqlCommand.ExecuteReader())
{
while (sqlDataReader.Read())
while (sqlReader.Read())
{
yield return reader(new SqlReader(sqlDataReader));
yield return reader(sqlReader);
}
}
}
@@ -46,18 +46,18 @@
{
sqlCommand.CommandText = query;
using (var sqlDataReader = sqlCommand.ExecuteReader())
using (SqlReader sqlReader = sqlCommand.ExecuteReader())
{
while (sqlDataReader.Read())
while (sqlReader.Read())
{
yield return reader(new SqlReader(sqlDataReader));
yield return reader(sqlReader);
}
}
}
}
}
public T FirstOrDefault<T>(string query, Action<IParameterCollection> parameters, Func<ISqlReader, T> reader)
public T FirstOrDefault<T>(string query, Action<ParameterCollection> parameters, Func<ISqlReader, T> reader)
{
var firstOrDefaultResult = default(T);
@@ -69,13 +69,13 @@
{
sqlCommand.CommandText = query;
parameters(new ParameterCollection(sqlCommand.Parameters));
parameters(sqlCommand.Parameters);
using (var sqlDataReader = sqlCommand.ExecuteReader())
using (SqlReader sqlReader = sqlCommand.ExecuteReader())
{
if (sqlDataReader.Read())
if (sqlReader.Read())
{
firstOrDefaultResult = reader(new SqlReader(sqlDataReader));
firstOrDefaultResult = reader(sqlReader);
}
}
}
@@ -84,7 +84,7 @@
return firstOrDefaultResult;
}
public T ScalarTransaction<T>(string query, Action<IParameterCollection> parameters)
public T ScalarTransaction<T>(string query, Action<ParameterCollection> parameters)
{
var scalarResult = default(T);
@@ -99,7 +99,7 @@
sqlCommand.Transaction = sqlTransaction;
sqlCommand.CommandText = query;
parameters(new ParameterCollection(sqlCommand.Parameters));
parameters(sqlCommand.Parameters);
var scalarObject = sqlCommand.ExecuteScalar();
@@ -116,7 +116,7 @@
return scalarResult;
}
public bool Transaction(string query, Action<IParameterCollection> parameters)
public bool Transaction(string query, Action<ParameterCollection> parameters)
{
var canCommitTransaction = true;
@@ -131,7 +131,7 @@
sqlCommand.Transaction = sqlTransaction;
sqlCommand.CommandText = query;
parameters(new ParameterCollection(sqlCommand.Parameters));
parameters(sqlCommand.Parameters);
sqlCommand.ExecuteNonQuery();
}
@@ -5,14 +5,14 @@
public interface IDbContext
{
IEnumerable<T> AsEnumerable<T>(string query, Action<IParameterCollection> parameters, Func<ISqlReader, T> reader);
IEnumerable<T> AsEnumerable<T>(string query, Action<ParameterCollection> parameters, Func<ISqlReader, T> reader);
IEnumerable<T> AsEnumerable<T>(string query, Func<ISqlReader, T> reader);
T FirstOrDefault<T>(string query, Action<IParameterCollection> parameters, Func<ISqlReader, T> reader);
T FirstOrDefault<T>(string query, Action<ParameterCollection> parameters, Func<ISqlReader, T> reader);
T ScalarTransaction<T>(string query, Action<IParameterCollection> parameters);
T ScalarTransaction<T>(string query, Action<ParameterCollection> parameters);
bool Transaction(string query, Action<IParameterCollection> parameters);
bool Transaction(string query, Action<ParameterCollection> parameters);
}
}
@@ -9,7 +9,7 @@
{
private readonly SqlParameterCollection parameters;
public ParameterCollection(SqlParameterCollection parameters)
private ParameterCollection(SqlParameterCollection parameters)
=> this.parameters = parameters;
public IParameterCollection Add(string name, object value)
@@ -30,5 +30,8 @@
return this;
}
public static implicit operator ParameterCollection(SqlParameterCollection sqlParameterCollection)
=> new ParameterCollection(sqlParameterCollection);
}
}
@@ -5,13 +5,19 @@
using System;
using System.Data.SqlClient;
public class SqlReader : ISqlReader
public class SqlReader : ISqlReader, IDisposable
{
private readonly SqlDataReader sqlDataReader;
public SqlReader(SqlDataReader sqlDataReader)
private SqlReader(SqlDataReader sqlDataReader)
=> this.sqlDataReader = sqlDataReader;
public void Dispose()
{
this.sqlDataReader.Close();
this.sqlDataReader.Dispose();
}
public byte[] GetBytes(int index)
{
var bytes = default(byte[]);
@@ -46,5 +52,11 @@
return default(T);
}
internal bool Read()
=> this.sqlDataReader.Read();
public static implicit operator SqlReader(SqlDataReader sqlDataReader)
=> new SqlReader(sqlDataReader);
}
}
@@ -0,0 +1,13 @@
namespace LaaProductionWeb.Services.Interfaces
{
using LaaProductionWeb.Services.Models;
using System.Collections.Generic;
public interface IReportService : ITransient
{
HeliumReportModel LoadHeliumPressureReport(HeliumReportModel model = null);
IEnumerable<HeliumPressurePoint> LoadHeliumPressureResults(int testId);
}
}
@@ -61,8 +61,15 @@
<Compile Include="Interfaces\IAccountService.cs" />
<Compile Include="Interfaces\IOrdersService.cs" />
<Compile Include="Interfaces\IProtocolService.cs" />
<Compile Include="Interfaces\IReportService.cs" />
<Compile Include="Interfaces\IShipmentsService.cs" />
<Compile Include="Interfaces\ITransient.cs" />
<Compile Include="Models\HeliumPressurePoint.cs" />
<Compile Include="Models\HeliumReportFilter.cs" />
<Compile Include="Models\HeliumReportFilterProperty.cs" />
<Compile Include="Models\HeliumReportItem.cs" />
<Compile Include="Models\HeliumReportModel.cs" />
<Compile Include="Models\HeliumReportModelExtensions.cs" />
<Compile Include="Models\PalletPosition.cs" />
<Compile Include="Models\RoleModel.cs" />
<Compile Include="Models\UserRole.cs" />
@@ -84,6 +91,7 @@
<Compile Include="OrdersService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProtocolService.cs" />
<Compile Include="ReportService.cs" />
<Compile Include="ServicesExtensions.cs" />
<Compile Include="ShipmentsService.cs" />
</ItemGroup>
@@ -0,0 +1,11 @@
namespace LaaProductionWeb.Services.Models
{
public class HeliumPressurePoint
{
public int TestId { get; set; }
public int PointNr { get; set; }
public decimal Result { get; set; }
}
}
@@ -0,0 +1,109 @@
namespace LaaProductionWeb.Services.Models
{
using System.Collections.Generic;
using System.Linq;
public class HeliumReportFilter : List<HeliumReportFilterProperty>
{
public HeliumReportFilter()
{
var model = default(HeliumReportItem);
this.Add(model.Property(x => x.AuftragNr, this.Count));
this.Add(model.Property(x => x.FertigungNr, this.Count));
this.Add(model.Property(x => x.PositionNr, this.Count));
this.Add(model.Property(x => x.SerialNr, this.Count));
this.Add(model.Property(x => x.IdentNr, this.Count));
this.Add(model.Property(x => x.HeId, this.Count));
this.Add(model.Property(x => x.HeTestId, this.Count));
this.Add(model.Property(x => x.PcbId, this.Count));
this.Add(model.Property(x => x.Nennweite, this.Count));
this.Add(model.Property(x => x.Baulaenge, this.Count));
this.Add(model.Property(x => x.Typ, this.Count));
this.Add(model.Property(x => x.Druck, this.Count));
this.Add(model.Property(x => x.Temperatur, this.Count));
this.Add(model.Property(x => x.HeLakeRate, this.Count));
this.Add(model.Property(x => x.HeTestPressure, this.Count));
this.Add(model.Property(x => x.IsValid, this.Count));
this.Add(model.Property(x => x.Text, this.Count));
this.Add(model.Property(x => x.TestDate, this.Count, -1));
this.Add(model.Property(x => x.Tester, this.Count));
}
internal SqlExpression OrderBy()
{
var sqlExpression = new SqlExpression();
foreach (var property in this)
{
if (property.OrderBy == 1)
{
sqlExpression.Add($"{property.Column}");
}
else if (property.OrderBy == -1)
{
sqlExpression.Add($"{property.Column} DESC");
}
}
return sqlExpression.BuildOrderBy(", ");
}
internal SqlExpression Where()
{
var sqlExpression = new SqlExpression();
foreach (var property in this)
{
if (string.IsNullOrWhiteSpace(property.Like))
{
continue;
}
var propertyName = $"{property.Property}_{property.Index}";
var propertyValue = $"%{property.Like}%";
sqlExpression.Add($"{property.Column} LIKE @{propertyName}", propertyName, propertyValue);
}
return sqlExpression.BuildWhere(" AND ");
}
public class SqlExpression
{
private readonly ICollection<string> expressions
= new List<string>();
public string Query { get; set; }
public IDictionary<string, object> Parameters { get; set; }
= new Dictionary<string, object>();
internal void Add(string expression)
=> this.expressions.Add(expression);
internal void Add(string expression, string propertyName, string propertyValue)
{
this.Parameters[propertyName] = propertyValue;
this.expressions.Add(expression);
}
internal SqlExpression BuildOrderBy(string delimiter)
{
this.Query = string.Join(delimiter, this.expressions);
return this;
}
internal SqlExpression BuildWhere(string delimiter)
{
this.Query = this.expressions.Any()
? string.Join(delimiter, this.expressions)
: "1 = 1";
return this;
}
}
}
}
@@ -0,0 +1,32 @@
namespace LaaProductionWeb.Services.Models
{
public class HeliumReportFilterProperty
{
public int Index { get; set; }
public string IndexName
=> $"Filter[{this.Index}].{nameof(this.Index)}";
public string Property { get; set; }
public string PropertyName
=> $"Filter[{this.Index}].{nameof(this.Property)}";
public string Column { get; set; }
public string ColumnName
=> $"Filter[{this.Index}].{nameof(this.Column)}";
public string Like { get; set; }
public string LikeName
=> $"Filter[{this.Index}].{nameof(this.Like)}";
public int OrderBy { get; set; }
public string OrderByName
=> $"Filter[{this.Index}].{nameof(this.OrderBy)}";
public string OrderById
=> $"Filter_{this.Index}_{nameof(this.OrderBy)}";
}
}
@@ -0,0 +1,85 @@
namespace LaaProductionWeb.Services.Models
{
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
public class HeliumReportItem
{
[Display(Name = "Auftrag Nr.")]
[Column("[POS].[AuftragNr]")]
public int AuftragNr { get; set; }
[Display(Name = "Fertigung Nr.")]
[Column("[PT].[CordonelPressureTest_FertigungsAuftragsNr]")]
public int FertigungNr { get; set; }
[Display(Name = "Pos.")]
[Column("[POS].[PositionNr]")]
public short PositionNr { get; set; }
[Display(Name = "Serial Nr.")]
[Column("[PCB2SN].[MapPcbIdToSerialNumber_SerialNumber]")]
public int SerialNr { get; set; }
[Display(Name = "Ident Nr.")]
[Column("[ID].[IdentNr]")]
public int IdentNr { get; set; }
[Display(Name = "He Id")]
[Column("[PT_HE].[CordonelPressureTestHe_Id]")]
public int HeId { get; set; }
[Display(Name = "He TestId")]
[Column("[PT_HE].[CordonelPressureTestHe_TestID]")]
public int HeTestId { get; set; }
[Display(Name = "Pcb Id")]
[Column("[PT].[CordonelPressureTest_PcbId]")]
public int PcbId { get; set; }
[Display(Name = "Nennweite")]
[Column("[ID].[Nennweite]")]
public int? Nennweite { get; set; }
[Display(Name = "Baulänge")]
[Column("[ID].[Baulaenge]")]
public int? Baulaenge { get; set; }
[Display(Name = "Typ")]
[Column("[ID].[Typ]")]
public string Typ { get; set; }
[Display(Name = "Druck")]
[Column("[ID].[Druck]")]
public int? Druck { get; set; }
[Display(Name = "°C")]
[Column("[ID].[Temperatur]")]
public int? Temperatur { get; set; }
[Display(Name = "Lake Rate")]
[Column("[PT_HE].[CordonelPressureTestHe_LeakRate]")]
public string HeLakeRate { get; set; }
[Display(Name = "He Druck")]
[Column("[PT_HE].[CordonelPressureTestHe_TestPressure]")]
public string HeTestPressure { get; set; }
[Display(Name = "Valid")]
[Column("[PT].[CordonelPressureTest_Valid]")]
public bool IsValid { get; set; }
[Display(Name = "Text")]
[Column("[PT].[CordonelPressureTest_Text]")]
public string Text { get; set; }
[Display(Name = "Datum")]
[Column("[PT].[CordonelPressureTest_Date]")]
public DateTimeOffset TestDate { get; set; }
[Display(Name = "Tester")]
[Column("[PT_HE].[CordonelPressureTestHe_TesterName]")]
public string Tester { get; set; }
}
}
@@ -0,0 +1,38 @@
namespace LaaProductionWeb.Services.Models
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq.Expressions;
using System.Reflection;
public class HeliumReportModel
{
public HeliumReportFilter Filter { get; set; }
= new HeliumReportFilter();
public IEnumerable<HeliumReportItem> Items { get; set; }
= Array.Empty<HeliumReportItem>();
public static implicit operator HeliumReportModel(HeliumReportFilter filter)
=> new HeliumReportModel { Filter = filter };
public string Display(Expression<Func<HeliumReportItem, object>> expression)
{
var memberInfo = default(MemberInfo);
if (expression.Body is MemberExpression memberExpression)
{
memberInfo = memberExpression.Member;
}
else if (expression.Body is UnaryExpression unaryExpression && unaryExpression.Operand is MemberExpression operandExpression)
{
memberInfo = operandExpression.Member;
}
return memberInfo
?.GetCustomAttribute<DisplayAttribute>()
?.Name;
}
}
}
@@ -0,0 +1,32 @@
namespace LaaProductionWeb.Services.Models
{
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq.Expressions;
using System.Reflection;
public static class HeliumReportModelExtensions
{
public static HeliumReportFilterProperty Property(this HeliumReportItem model, Expression<Func<HeliumReportItem, object>> expression, int index, int orderBy = 0)
{
var memberInfo = default(MemberInfo);
if (expression.Body is MemberExpression memberExpression)
{
memberInfo = memberExpression.Member;
}
else if (expression.Body is UnaryExpression unaryExpression && unaryExpression.Operand is MemberExpression operandExpression)
{
memberInfo = operandExpression.Member;
}
return new HeliumReportFilterProperty
{
Column = memberInfo?.GetCustomAttribute<ColumnAttribute>()?.Name,
Property = memberInfo?.Name,
OrderBy = orderBy,
Index = index,
};
}
}
}
@@ -0,0 +1,109 @@
namespace LaaProductionWeb.Services
{
using LaaProductionWeb.Data.Interfaces;
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models;
using System;
using System.Collections.Generic;
public class ReportService : IReportService
{
private readonly IDbContext dbContext;
public ReportService(IDbContext dbContext)
=> this.dbContext = dbContext;
public HeliumReportModel LoadHeliumPressureReport(HeliumReportModel model = null)
{
if (model is null)
{
model = new HeliumReportModel();
}
var where = model.Filter.Where();
var orderBy = model.Filter.OrderBy();
model.Items = this.dbContext.AsEnumerable($@"
SELECT [POS].[AuftragNr] AS [AuftragNr] -- 0 Filter
, [PT].[CordonelPressureTest_FertigungsAuftragsNr] AS [FertigungNr] -- 1 Filter
, [POS].[PositionNr] AS [PositionNr] -- 2 Filter
, [PCB2SN].[MapPcbIdToSerialNumber_SerialNumber] AS [SerialNr] -- 3
, [ID].[IdentNr] AS [IdentNr] -- 4 Filter
, [PT_HE].[CordonelPressureTestHe_Id] AS [HeId] -- 5
, [PT_HE].[CordonelPressureTestHe_TestID] AS [HeTestId] -- 6
, [PT].[CordonelPressureTest_PcbId] AS [PcbId] -- 7 Filter
, [ID].[Nennweite] AS [Nennweite] -- 8 Filter
, [ID].[Baulaenge] AS [Baulaenge] -- 9 Filter
, [ID].[Typ] AS [Typ] -- 10 Filter
, [ID].[Druck] AS [Druck] -- 11 Filter
, [ID].[Temperatur] AS [Temperatur] -- 12 Filter
, [PT_HE].[CordonelPressureTestHe_LeakRate] AS [HeLakeRate] -- 13
, [PT_HE].[CordonelPressureTestHe_TestPressure] AS [HeTestPressure] -- 14
, [PT].[CordonelPressureTest_Valid] AS [IsValid] -- 15 Filter
, [PT].[CordonelPressureTest_Text] AS [Text] -- 16 Filter
, [PT].[CordonelPressureTest_Date] AS [TestDate] -- 17 Filter
, [PT_HE].[CordonelPressureTestHe_TesterName] AS [Tester] -- 18
FROM [Cordonel_PressureTest] AS [PT]
JOIN [Cordonel_PressureTest_He] AS [PT_HE] ON [PT_HE].[CordonelPressureTestHe_TestID] = [PT].[CordonelPressureTest_Id]
LEFT JOIN [Druckpruefung] AS [DP] ON [DP].[FabNr] = [PT].[CordonelPressureTest_PcbId]
JOIN [MapPcbIdToSerialNumber] AS [PCB2SN] ON [PCB2SN].[MapPcbIdToSerialNumber_PcbId] = [PT].[CordonelPressureTest_PcbId]
JOIN [AuftragPosition_Gesamt] AS [POS] ON [POS].[FertigungsauftragNr] = [PT].[CordonelPressureTest_FertigungsAuftragsNr]
JOIN [Identnr] AS [ID] ON [ID].[IdentNr] = [POS].[Identnr]
WHERE [CordonelPressureTest_IsDeleted] = 0
AND {where.Query}
ORDER BY {orderBy.Query}",
parameters =>
{
foreach (var kvp in where.Parameters)
{
parameters.Add(kvp.Key, kvp.Value);
}
foreach (var kvp in orderBy.Parameters)
{
parameters.Add(kvp.Key, kvp.Value);
}
},
reader => new HeliumReportItem
{
AuftragNr = reader.GetValue<int>(0),
FertigungNr = reader.GetValue<int>(1),
PositionNr = reader.GetValue<short>(2),
SerialNr = reader.GetValue<int>(3),
IdentNr = reader.GetValue<int>(4),
HeId = reader.GetValue<int>(5),
HeTestId = reader.GetValue<int>(6),
PcbId = reader.GetValue<int>(7),
Nennweite = reader.GetValue<int?>(8),
Baulaenge = reader.GetValue<int?>(9),
Typ = reader.GetString(10),
Druck = reader.GetValue<int?>(11),
Temperatur = reader.GetValue<int?>(12),
HeLakeRate = reader.GetString(13),
HeTestPressure = reader.GetString(14),
IsValid = reader.GetValue<bool>(15),
Text = reader.GetString(16),
TestDate = reader.GetValue<DateTimeOffset>(17),
Tester = reader.GetString(18)
});
return model;
}
public IEnumerable<HeliumPressurePoint> LoadHeliumPressureResults(int testId)
=> this.dbContext.AsEnumerable($@"
SELECT [CordonelPressureTestTestPoints_Id]
, [CordonelPressureTest_TestPointNr]
, CAST([CordonelPressureTest_TestPointResult] AS NUMERIC(9, 8))
FROM [Auftrag].[dbo].[Cordonel_PressureTest_TestPoints]
WHERE [CordonelPressureTest_Id] = @{nameof(testId)}",
parameters => parameters.Add(nameof(testId), testId),
reader => new HeliumPressurePoint
{
TestId = reader.GetValue<int>(0),
PointNr = reader.GetValue<int>(1),
Result = reader.GetValue<decimal>(2),
});
}
}
@@ -125,4 +125,20 @@ table.table table.table {
.bg-whitesmoke {
background-color: whitesmoke !important
}
}
.bi-bold:before {
font-weight: bolder !important;
}
.table-responsive::-webkit-scrollbar:horizontal {
position: fixed;
bottom: 0;
}
.cursor-pointer:hover {
cursor: pointer !important;
text-decoration: underline !important;
}
@@ -3,7 +3,10 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Security.Claims;
using System.Security.Principal;
using System.Web.Mvc;
@@ -54,5 +57,25 @@
{
return default(T);
}
public static string Display<T>(this T model, Expression<Func<T, object>> expression)
{
if (expression.Body is MemberExpression memberExpression)
{
return memberExpression
.Member
.GetCustomAttribute<DisplayAttribute>()
.GetName();
}
else if (expression.Body is UnaryExpression unaryExpression && unaryExpression.Operand is MemberExpression operandExpression)
{
return operandExpression
.Member
.GetCustomAttribute<DisplayAttribute>()
.GetName();
}
return default(string);
}
}
}
@@ -0,0 +1,38 @@
namespace LaaProductionWeb.Controllers
{
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models;
using System.Web.Mvc;
public class ReportController : Controller
{
private readonly IReportService reportService;
public ReportController(IReportService reportService)
=> this.reportService = reportService;
[HttpGet]
public ActionResult Index()
{
var model = this.reportService.LoadHeliumPressureReport();
return this.View(model);
}
[HttpPost]
public ActionResult Index(HeliumReportModel model)
{
model = this.reportService.LoadHeliumPressureReport(model);
return this.View(model);
}
public ActionResult Results(int testId = 0)
{
var results = this.reportService.LoadHeliumPressureResults(testId);
return this.PartialView(results);
}
}
}
@@ -145,6 +145,7 @@
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ProtocolController.cs" />
<Compile Include="Controllers\ReportController.cs" />
<Compile Include="Controllers\SearchController.cs" />
<Compile Include="Controllers\ShipmentsController.cs" />
<Compile Include="Global.asax.cs">
@@ -176,6 +177,9 @@
<Content Include="Views\Account\Authorize.cshtml" />
<Content Include="Views\Account\UserRole.cshtml" />
<Content Include="Views\Account\Permissions.cshtml" />
<Content Include="Views\Report\Index.cshtml" />
<Content Include="Views\Report\Filter.cshtml" />
<Content Include="Views\Report\Results.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Content\font\fonts\bootstrap-icons.woff" />
@@ -15,17 +15,17 @@
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" >Learn more &raquo;</a></p>
<p><a class="btn btn-default">Learn more &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" >Learn more &raquo;</a></p>
<p><a class="btn btn-default">Learn more &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" >Learn more &raquo;</a></p>
<p><a class="btn btn-default">Learn more &raquo;</a></p>
</div>
</div>
</div>
@@ -2,19 +2,21 @@
@using LaaProductionWeb.Services.Models
<form action="/Protocol/DeleteFile" method="post" class="nav justify-content-end bg-whitesmoke">
@this.Html.AntiForgeryToken()
@this.Html.HiddenFor(x => x.FileId)
@this.Html.HiddenFor(x => x.OrderId)
<button class="btn btn-link text-danger nav-link">
<i class="bi bi-trash"></i> Delete
</button>
</form>
<div class="d-flex flex-column h-100">
<form action="/Protocol/DeleteFile" method="post" class="nav justify-content-end bg-whitesmoke">
@this.Html.AntiForgeryToken()
@this.Html.HiddenFor(x => x.FileId)
@this.Html.HiddenFor(x => x.OrderId)
<button class="btn btn-link text-danger nav-link">
<i class="bi bi-trash"></i> Delete
</button>
</form>
<div class="container-fluid h-100 p-0">
<div class="row h-100">
<div class="position-relative h-100">
<iframe class="position-absolute align-top align-left w-100 h-100" src="@this.Model.FileContent" frameborder="0" allowfullscreen />
<div class="container-fluid h-100 p-0">
<div class="row h-100">
<div class="position-relative h-100">
<iframe class="position-absolute align-top align-left w-100 h-100" src="@this.Model.FileContent" frameborder="0" allowfullscreen />
</div>
</div>
</div>
</div>
@@ -53,11 +53,10 @@
@this.Html.HiddenFor(x => x.ClientId)
@this.Html.HiddenFor(x => x.ClientName)
@this.Html.HiddenFor(x => x.Positions)
<input name="FilePDF" id="FilePDF" type="file" class="d-none" accept="application/pdf" />
<input name="FilePDF" id="FilePDF" type="file" class="d-none" accept="application/pdf" onchange="javascript: this.form.submit();" />
<div class="input-group flex-nowrap mt-3">
<a class="btn btn-light white-space-nowrap" href="/Protocol/Print?orderId=@this.Model.OrderId" target="_blank"><i class="bi bi-printer me-2"></i> Vorschau</a>
<label for="FilePDF" class="btn btn-outline-light border text-dark white-space-nowrap"><i class="bi bi-filetype-pdf"></i> Auswählen</label>
<button type="submit" class="btn btn-success white-space-nowrap"><i class="bi bi-upload"></i> Hochladen</button>
<a class="btn btn-light white-space-nowrap w-100" href="/Protocol/Print?orderId=@this.Model.OrderId" target="_blank"><i class="bi bi-printer me-2"></i> Vorschau</a>
<label for="FilePDF" class="btn btn-outline-light border text-dark white-space-nowrap w-100"><i class="bi bi-filetype-pdf"></i> Auswählen</label>
</div>
@if (this.TempData.TryGetValue(ProtocolController.FilePDF, out object errorMessage))
{
@@ -0,0 +1,25 @@
@model LaaProductionWeb.Services.Models.HeliumReportFilterProperty
@{
Func<bool, string> isChecked = x => x ? "checked" : string.Empty;
Func<bool, string> bgColor = x => !x ? "bg-light" : string.Empty;
}
<input type="hidden" name="@this.Model.IndexName" value="@this.Model.Index" />
<input type="hidden" name="@this.Model.ColumnName" value="@this.Model.Column" />
<input type="hidden" name="@this.Model.PropertyName" value="@this.Model.Property" />
<input name="@this.Model.LikeName" class="form-control form-control-sm mb-1" autocomplete="off" value="@this.Model.Like" />
<div class="input-group flex-nowrap justify-content-center">
<input id="@(this.Model.OrderById)_1" name="@this.Model.OrderByName" type="radio" value="1" @isChecked(this.Model.OrderBy == 1) class="d-none" />
<label for="@(this.Model.OrderById)_1" class="form-control form-control-sm text-center text-secondary border-light @bgColor(this.Model.OrderBy == 1) cursor-pointer">
<i class="bi bi-chevron-up"></i>
</label>
<input id="@(this.Model.OrderById)_0" name="@this.Model.OrderByName" type="radio" value="0" @isChecked(this.Model.OrderBy == 0) class="d-none" />
<label for="@(this.Model.OrderById)_0" class="form-control form-control-sm text-center text-secondary border-light @bgColor(this.Model.OrderBy == 0) cursor-pointer">
<i class="bi bi-dash"></i>
</label>
<input id="@(this.Model.OrderById)__1" name="@this.Model.OrderByName" type="radio" value="-1" @isChecked(this.Model.OrderBy == -1) class="d-none" />
<label for="@(this.Model.OrderById)__1" class="form-control form-control-sm text-center text-secondary border-light @bgColor(this.Model.OrderBy == -1) cursor-pointer">
<i class="bi bi-chevron-down"></i>
</label>
</div>
@@ -0,0 +1,120 @@
@model LaaProductionWeb.Services.Models.HeliumReportModel
<form action="/Report" method="post" autocomplete="off" class="h-100" id="he_report">
<div class="table-responsive mh-100">
<table class="table table-sm table-bordered mb-0">
<thead class="bg-light">
<tr>
<th class="text-nowrap p-2">@this.Model.Display(x => x.AuftragNr)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.FertigungNr)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.PositionNr)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.SerialNr)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.IdentNr)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.HeId)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.HeTestId)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.PcbId)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.Nennweite)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.Baulaenge)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.Typ)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.Druck)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.Temperatur)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.HeLakeRate)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.HeTestPressure)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.IsValid)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.TestDate)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.Tester)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.Text)</th>
</tr>
<tr>
@foreach (var filter in this.Model.Filter)
{
<td>@this.Html.Partial("Filter", filter)</td>
}
</tr>
</thead>
<tbody>
@foreach (var item in this.Model.Items)
{
<tr>
<td class="text-nowrap p-2">@item.AuftragNr</td>
<td class="text-nowrap p-2">@item.FertigungNr</td>
<td class="text-nowrap p-2">@item.PositionNr</td>
<td class="text-nowrap p-2">@item.SerialNr</td>
<td class="text-nowrap p-2">@item.IdentNr</td>
<td class="text-nowrap p-2">@item.HeId</td>
<td class="text-nowrap p-2">
<a class="text-decoration-none cursor-pointer" href="#@item.HeTestId">
@item.HeTestId
</a>
</td>
<td class="text-nowrap p-2">@item.PcbId</td>
<td class="text-nowrap p-2">@item.Nennweite</td>
<td class="text-nowrap p-2">@item.Baulaenge</td>
<td class="text-nowrap p-2">@item.Typ</td>
<td class="text-nowrap p-2">@item.Druck</td>
<td class="text-nowrap p-2">@item.Temperatur</td>
<td class="text-nowrap p-2">@item.HeLakeRate</td>
<td class="text-nowrap p-2">@item.HeTestPressure</td>
<td class="text-nowrap p-2"><i class="bi bi-bold @(@item.IsValid ? "bi-check text-success" : "bi-x text-danger")"></i></td>
<td class="text-nowrap p-2">@($"{item.TestDate:dd.MM.yyyy}")</td>
<td class="text-nowrap p-2">@item.Tester</td>
<td class="text-nowrap p-2">@item.Text</td>
</tr>
}
</tbody>
</table>
</div>
</form>
<button id="modal_btn" class="d-none" data-bs-toggle="modal" data-bs-target="#modal"></button>
<!-- Modal -->
<div class="modal fade" id="modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">Testergebnisse</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table table-sm table-bordered">
<thead>
<tr>
<th>Test Id</th>
<th>Pint Nr</th>
<th>Result</th>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
</div>
</div>
</div>
</div>
@section scripts {
<script>
let form = document.getElementById('he_report');
let inputFields = form
.querySelectorAll('input')
.forEach(x => x.onchange = () => form.submit());
let tbody = this.document.getElementById('tbody');
let modalBtn = this.document.getElementById('modal_btn');
window.addEventListener('hashchange', function () {
tbody.innerHTML = null;
if (location.hash) {
let testId = location.hash.substring(1);
if (testId) {
fetch(`/Report/Results?testId=${testId}`)
.then(response => response.text())
.then(function (html) {
tbody.innerHTML = html;
modalBtn.click();
})
.catch(x => console.log(x));
}
}
});
</script>
}
@@ -0,0 +1,10 @@
@model IEnumerable<LaaProductionWeb.Services.Models.HeliumPressurePoint>
@foreach (var item in this.Model)
{
<tr>
<td>@item.TestId</td>
<td>@item.PointNr</td>
<td>@item.Result</td>
</tr>
}
@@ -33,6 +33,9 @@
<li class="nav-item">
<a class="nav-link text-smallcaps" href="/Protocol">Prüfprotokoll</a>
</li>
<li class="nav-item">
<a class="nav-link text-smallcaps" href="/Report">[He] Report</a>
</li>
</ul>
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li class="nav-item">